Timeline: Add menu button to track and control sequence headers.

pull/3/head
Jonathan Moore Liles 2012-12-11 18:06:08 -08:00
parent be495a6ded
commit a985cb3168
5 changed files with 68 additions and 40 deletions

View File

@ -41,6 +41,8 @@ using std::list;
#include "FL/event_name.H"
#include "FL/test_press.H"
#include <FL/Fl_Menu_Button.H>
#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;
}

View File

@ -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); }

View File

@ -46,6 +46,11 @@
#include "const.h"
#include "debug.h"
#include <FL/Fl_Menu_Button.H>
#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 <FL/Fl_Menu_Button.H>
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

View File

@ -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;

View File

@ -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
}