Make mark labels editable.

This commit is contained in:
Jonathan Moore Liles 2008-04-26 07:37:25 -05:00
parent c4812d0ade
commit 07b193c9c5
3 changed files with 22 additions and 6 deletions

View File

@ -22,6 +22,8 @@
#include "Loggable.H"
#include "Sequence_Point.H"
#include <FL/fl_ask.H>
class Ruler_Point : public Sequence_Point
{
@ -33,6 +35,7 @@ public:
if ( _label )
free( _label );
_label = strdup( s );
redraw();
}
protected:
@ -61,7 +64,7 @@ protected:
name( v );
}
timeline->redraw();
// timeline->redraw();
}
Ruler_Point ( )
@ -105,6 +108,18 @@ public:
int
handle ( int m )
{
Logger _log( this );
if ( m == FL_PUSH && Fl::event_button3() && ! Fl::event_ctrl() )
{
const char *s = fl_input( "New name for mark:", name() );
if ( s )
name( s );
return 1;
}
int r = Sequence_Widget::handle( m );
if ( m == FL_RELEASE )

View File

@ -95,10 +95,9 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color
if ( align & FL_ALIGN_BOTTOM )
fl_draw_box( b, X - dx - bx, Y + H - lh, lw + bw, lh, FL_GRAY );
else
if ( align & FL_ALIGN_LEFT )
fl_draw_box( b, X - dx, Y, lw + bw, lh, FL_GRAY );
else
else if ( align == FL_ALIGN_LEFT )
fl_draw_box( b, X - dx, Y + ((H / 2) - (lh / 2)), lw + bw, lh, FL_GRAY );
else if ( align & FL_ALIGN_TOP )
fl_draw_box( b, X - dx - bx + ((W / 2) - (lw / 2)), Y + ((H / 2) - (lh / 2)), lw + bw, lh, FL_GRAY );
}

View File

@ -168,6 +168,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
}
}
/* rulers go above tracks... */
add( rulers );
/* make sure scrollbars are on top */
add( vscroll );