From 11f420a1a453aeb1714b237f537e317ad904f6b9 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 28 Apr 2008 13:17:46 -0500 Subject: [PATCH] Allow renaming of control sequences. --- Timeline/Control_Sequence.C | 36 ++++++++++++++++++++++++++++++++++++ Timeline/Track.C | 7 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Timeline/Control_Sequence.C b/Timeline/Control_Sequence.C index 6b1f71c..05ebdaf 100644 --- a/Timeline/Control_Sequence.C +++ b/Timeline/Control_Sequence.C @@ -17,6 +17,8 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ +#include + #include "Control_Sequence.H" #include "Track.H" @@ -259,12 +261,46 @@ Control_Sequence::handle ( int m ) { case FL_PUSH: { + Logger log( this ); + if ( Fl::event_button1() ) { Control_Point *r = new Control_Point( this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ), (float)(Fl::event_y() - y()) / h() ); add( r ); } + else if ( Fl::event_button3() && ! ( Fl::event_state() & ( FL_ALT | FL_SHIFT | FL_CTRL ) ) ) + { + + Fl_Menu_Item menu[] = + { + { "Rename" }, + { "Remove" }, + { 0 } + }; + + const Fl_Menu_Item *r = menu->popup( Fl::event_x(), Fl::event_y(), "Control Sequence" ); + + if ( r ) + { + if ( r == &menu[ 0 ] ) + { + const char *s = fl_input( "Input new name for control sequence:", name() ); + + if ( s ) + name( s ); + + redraw(); + } + else if ( r == &menu[ 1 ] ) + { + /* TODO: remove */ + } + + } + + return 1; + } return 1; } diff --git a/Timeline/Track.C b/Timeline/Track.C index a997cbe..b585cdf 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -424,6 +424,7 @@ Track::handle ( int m ) { "Quad", 0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) }, { "...", 0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) }, { 0 }, + { "Add Control" }, { "Color" }, { "Remove", 0, 0, 0, transport->rolling ? FL_MENU_INACTIVE : 0 }, { 0 }, @@ -458,6 +459,10 @@ Track::handle ( int m ) } } else if ( r == &menu[ 6 ] ) + { + new Control_Sequence( this ); + } + else if ( r == &menu[ 7 ] ) { unsigned char r, g, b; @@ -471,7 +476,7 @@ Track::handle ( int m ) // color( fl_show_colormap( color() ) ); redraw(); } - else if ( r == &menu[ 7 ] ) + else if ( r == &menu[ 8 ] ) { int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );