diff --git a/timeline/src/Control_Sequence.C b/timeline/src/Control_Sequence.C index c5eaddf..1c02a6a 100644 --- a/timeline/src/Control_Sequence.C +++ b/timeline/src/Control_Sequence.C @@ -41,6 +41,8 @@ using std::list; #include "FL/event_name.H" #include "FL/test_press.H" +#include +#include "FL/menu_popup.H" @@ -191,6 +193,10 @@ Control_Sequence::cb_button ( Fl_Widget *w ) { Fl::delete_widget( this ); } + else if ( w == header()->menu_button ) + { + menu_popup( &menu(), header()->menu_button->x(), header()->menu_button->y() ); + } /* else if ( w == header()->promote_button ) */ /* { */ /* track()->sequence( this ); */ @@ -206,6 +212,7 @@ Control_Sequence::init ( void ) o->name_input->callback( cb_button, this ); o->delete_button->callback( cb_button, this ); + o->menu_button->callback( cb_button, this ); /* o->promote_button->callback( cb_button, this ); */ Fl_Group::add( o ); } @@ -498,7 +505,6 @@ Control_Sequence::draw ( void ) } } -#include "FL/menu_popup.H" void Control_Sequence::menu_cb ( Fl_Widget *w, void *v ) @@ -673,12 +679,38 @@ Control_Sequence::peer_callback( const char *name, const OSC::Signal *sig ) void Control_Sequence::add_osc_peers_to_menu ( Fl_Menu_Button *m, const char *prefix ) { - peer_menu = m; + peer_menu = m; peer_prefix = prefix; timeline->osc->list_peer_signals( &Control_Sequence::peer_callback, this ); } +Fl_Menu_Button & +Control_Sequence::menu ( void ) +{ + static Fl_Menu_Button _menu( 0, 0, 0, 0, "Control Sequence" ); + + _menu.clear(); + + if ( mode() == OSC ) + { + add_osc_peers_to_menu( &_menu, "Connect To" ); + } + + _menu.add( "Interpolation/None", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == None ? FL_MENU_VALUE : 0 ) ); + _menu.add( "Interpolation/Linear", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == Linear ? FL_MENU_VALUE : 0 ) ); + _menu.add( "Mode/Control Voltage (JACK)", 0, 0, 0 ,FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) ); + _menu.add( "Mode/Control Signal (OSC)", 0, 0, 0 , FL_MENU_RADIO | ( mode() == OSC ? FL_MENU_VALUE : 0 ) ); + + _menu.add( "Rename", 0, 0, 0 ); + _menu.add( "Color", 0, 0, 0 ); + _menu.add( "Remove", 0, 0, 0 ); + + _menu.callback( &Control_Sequence::menu_cb, (void*)this); + + return _menu; +} + int Control_Sequence::handle ( int m ) { @@ -744,31 +776,7 @@ Control_Sequence::handle ( int m ) else if ( Fl::event_x() < drawable_x() && test_press( FL_BUTTON3 ) ) { - Fl_Menu_Button *menu = new Fl_Menu_Button( 0, 0, 0, 0, "Control Sequence" ); - - menu->clear(); - - if ( mode() == OSC ) - { - add_osc_peers_to_menu( menu, "Connect To" ); - } - - menu->add( "Interpolation/None", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == None ? FL_MENU_VALUE : 0 ) ); - menu->add( "Interpolation/Linear", 0, 0, 0, FL_MENU_RADIO | ( interpolation() == Linear ? FL_MENU_VALUE : 0 ) ); - menu->add( "Mode/Control Voltage (JACK)", 0, 0, 0 ,FL_MENU_RADIO | ( mode() == CV ? FL_MENU_VALUE : 0 ) ); - menu->add( "Mode/Control Signal (OSC)", 0, 0, 0 , FL_MENU_RADIO | ( mode() == OSC ? FL_MENU_VALUE : 0 ) ); - - menu->add( "Rename", 0, 0, 0 ); - menu->add( "Color", 0, 0, 0 ); - menu->add( "Remove", 0, 0, 0 ); - - menu->callback( &Control_Sequence::menu_cb, (void*)this); - - menu_popup( menu ); - - delete menu; - -// redraw(); + menu_popup( &menu() ); return 1; } diff --git a/timeline/src/Control_Sequence.H b/timeline/src/Control_Sequence.H index e86ab4a..7a3b9ed 100644 --- a/timeline/src/Control_Sequence.H +++ b/timeline/src/Control_Sequence.H @@ -29,6 +29,7 @@ #include "OSC/Endpoint.H" class Control_Sequence_Header; +class Fl_Menu_Button; class Control_Sequence : public Sequence { @@ -103,6 +104,9 @@ protected: void update_port_name ( void ); + + Fl_Menu_Button & menu ( void ); + public: Control_Sequence_Header * header ( void ) { return (Control_Sequence_Header*)child(0); } diff --git a/timeline/src/Track.C b/timeline/src/Track.C index bc2f397..1ed21e8 100644 --- a/timeline/src/Track.C +++ b/timeline/src/Track.C @@ -46,6 +46,11 @@ #include "const.h" #include "debug.h" +#include +#include "FL/menu_popup.H" + + + static Fl_Color random_color ( void ) @@ -149,6 +154,7 @@ Track::init ( void ) record_button = o->rec_button; mute_button = o->mute_button; solo_button = o->solo_button; + menu_button = o->menu_button; show_all_takes_button = o->show_all_takes_button; overlay_controls_button = o->overlay_controls_button; @@ -159,6 +165,7 @@ Track::init ( void ) show_all_takes_button->callback( cb_button, this ); overlay_controls_button->callback( cb_button, this ); + menu_button->callback( cb_button, this ); resizable( o ); // o->color( (Fl_Color)53 ); @@ -411,6 +418,10 @@ Track::cb_button ( Fl_Widget *w ) { overlay_controls( overlay_controls_button->value() ); } + else if ( w == menu_button ) + { + menu_popup( &menu(), menu_button->x(), menu_button->y() ); + } } static int pack_visible( Fl_Pack *p ) @@ -725,8 +736,6 @@ Track::select ( int X, int Y, int W, int H, } -#include - void Track::menu_cb ( Fl_Widget *w, void *v ) { @@ -926,8 +935,6 @@ Track::get_unique_control_name ( const char *name ) } -#include "FL/menu_popup.H" - /** build the context menu */ Fl_Menu_Button & Track::menu ( void ) const diff --git a/timeline/src/Track.H b/timeline/src/Track.H index 362a806..7bb6006 100644 --- a/timeline/src/Track.H +++ b/timeline/src/Track.H @@ -141,6 +141,7 @@ public: Fl_Button *solo_button; Fl_Button *show_all_takes_button; Fl_Button *overlay_controls_button; + Fl_Button *menu_button; Fl_Pack *pack; Fl_Pack *annotation; diff --git a/timeline/src/Track_Header.fl b/timeline/src/Track_Header.fl index 8b378e2..e130784 100644 --- a/timeline/src/Track_Header.fl +++ b/timeline/src/Track_Header.fl @@ -9,14 +9,14 @@ decl {\#include "FL/Fl_Blink_Button.H"} {public global } widget_class Track_Header {open - xywh {635 603 525 60} type Double box NO_BOX resizable visible + xywh {897 224 525 60} type Double box NO_BOX resizable visible } { Fl_Group box_group {open private xywh {0 0 200 60} box THIN_UP_BOX color 63 code0 {o->resizable(0);} } { Fl_Group {} {open - xywh {0 0 200 50} + xywh {0 0 200 51} code0 {o->resizable(0);} } { Fl_Input name_input { @@ -32,13 +32,17 @@ widget_class Track_Header {open label out tooltip {lit if outputs are connected} xywh {31 27 24 16} box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 labelcolor 53 hide } + Fl_Button menu_button { + label menu + tooltip {Expand controls} xywh {4 26 31 24} selection_color 3 labelfont 4 labelsize 10 + } Fl_Button overlay_controls_button { label {c-} - tooltip {Expand controls} xywh {5 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 + tooltip {Expand controls} xywh {39 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 } Fl_Button show_all_takes_button { label {t+} - tooltip {Show all takes} xywh {32 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 + tooltip {Show all takes} xywh {66 26 24 24} type Toggle selection_color 3 labelfont 5 labelsize 12 } Fl_Button rec_button { label r @@ -68,16 +72,20 @@ Fl_Group::draw();} {} } widget_class Control_Sequence_Header {open - xywh {309 702 200 55} type Double box NO_BOX visible + xywh {315 771 200 55} type Double box NO_BOX visible } { Fl_Input name_input { - label {input:} selected + label {input:} xywh {5 3 192 22} labeltype NO_LABEL align 20 when 8 textsize 12 class Fl_Sometimes_Input } + Fl_Button menu_button { + label menu selected + tooltip {Expand controls} xywh {5 26 31 24} selection_color 3 labelfont 4 labelsize 10 + } Fl_Button outputs_indicator { label out - tooltip {lit if outputs are connected} xywh {33 26 24 16} box BORDER_BOX down_box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 + tooltip {lit if outputs are connected} xywh {40 26 24 16} box BORDER_BOX down_box BORDER_BOX color 48 selection_color 90 labelfont 5 labelsize 10 code0 {o->ignore_input( true );} code1 {o->blink( false );} class Fl_Blink_Button @@ -95,14 +103,14 @@ widget_class Control_Sequence_Header {open } widget_class Audio_Sequence_Header {open - xywh {326 544 200 50} type Double box NO_BOX resizable visible + xywh {332 613 200 50} type Double box NO_BOX resizable visible } { Fl_Group {} {open xywh {0 0 200 55} code0 {o->resizable(0);} } { Fl_Input name_input { - label {input:} selected + label {input:} xywh {0 3 193 22} labeltype NO_LABEL align 20 when 8 textsize 12 class Fl_Sometimes_Input }