Mixer: Fix focus issues with new sliders.

This commit is contained in:
Jonathan Moore Liles 2013-09-19 21:28:02 -07:00
parent 5ab7d7c410
commit 423a8428e1
4 changed files with 46 additions and 4 deletions

View File

@ -42,6 +42,17 @@ void Fl_Value_SliderX::input_cb(Fl_Widget*, void* v) {
{ {
t.value_damage(); t.value_damage();
t.do_callback(); t.do_callback();
// Fl::focus(NULL);
for ( Fl_Widget *p = t.parent(); p; p = p->parent() )
{
if ( p->visible_focus() )
{
p->take_focus();
break;
}
}
} }
} }
} }
@ -75,9 +86,9 @@ Fl_Value_SliderX::Fl_Value_SliderX(int X, int Y, int W, int H, const char*l)
input.parent((Fl_Group *)this); // kludge! input.parent((Fl_Group *)this); // kludge!
input.callback(input_cb, this); input.callback(input_cb, this);
input.when(FL_WHEN_ENTER_KEY); input.when(FL_WHEN_ENTER_KEY);
box(input.box()); /* box(input.box()); */
color(input.color()); /* color(input.color()); */
selection_color(input.selection_color()); /* selection_color(input.selection_color()); */
align(FL_ALIGN_LEFT); align(FL_ALIGN_LEFT);
value_damage(); value_damage();
textsize(9); textsize(9);

View File

@ -52,6 +52,20 @@ bool Controller_Module::learn_by_number = false;
bool Controller_Module::_learn_mode = false; bool Controller_Module::_learn_mode = false;
void
Controller_Module::take_focus ( void )
{
bool v = visible_focus();
if ( ! v )
set_visible_focus();
Fl_Widget::take_focus();
if ( ! v )
clear_visible_focus();
}
Controller_Module::Controller_Module ( bool is_default ) : Module( is_default, 50, 100, name() ) Controller_Module::Controller_Module ( bool is_default ) : Module( is_default, 50, 100, name() )
{ {
// label( "" ); // label( "" );
@ -72,6 +86,7 @@ Controller_Module::Controller_Module ( bool is_default ) : Module( is_default, 5
end(); end();
// clear_visible_focus();
log_create(); log_create();
} }
@ -310,6 +325,7 @@ Controller_Module::maybe_create_panner ( void )
} }
else else
{ {
// o->clear_visible_focus();
o->resize( x(), y(), w(), h() ); o->resize( x(), y(), w(), h() );
add( o ); add( o );
resizable( o ); resizable( o );
@ -496,7 +512,7 @@ Controller_Module::connect_to ( Port *p )
control_value = p->control_value(); control_value = p->control_value();
w->set_visible_focus(); w->clear_visible_focus();
w->align(FL_ALIGN_TOP); w->align(FL_ALIGN_TOP);
w->labelsize( 10 ); w->labelsize( 10 );
w->callback( cb_handle, this ); w->callback( cb_handle, this );

View File

@ -105,6 +105,7 @@ public:
int handle ( int m ); int handle ( int m );
void take_focus ( void );
// void set_control_value ( float f ) { control_value = f; } // void set_control_value ( float f ) { control_value = f; }
protected: protected:

View File

@ -650,6 +650,7 @@ Mixer_Strip::init ( )
o->type( Fl_Scalepack::HORIZONTAL ); o->type( Fl_Scalepack::HORIZONTAL );
{ Controller_Module *o = gain_controller = new Controller_Module( true ); { Controller_Module *o = gain_controller = new Controller_Module( true );
o->horizontal(false); o->horizontal(false);
o->clear_visible_focus();
o->pad( false ); o->pad( false );
o->size( 33, 100 ); o->size( 33, 100 );
} }
@ -872,6 +873,16 @@ Mixer_Strip::menu_cb ( const Fl_Menu_ *m )
if ( Fl::event_shift() || 1 == fl_choice( "Are you sure you want to remove this strip?\n\n(this action cannot be undone)", "Cancel", "Remove", NULL ) ) if ( Fl::event_shift() || 1 == fl_choice( "Are you sure you want to remove this strip?\n\n(this action cannot be undone)", "Cancel", "Remove", NULL ) )
command_close(); command_close();
} }
else if ( ! strcmp( picked, "/Gain" ) )
{
gain_controller->take_focus();
}
else if ( ! strcmp( picked, "/Mute" ) )
{
((Fl_Button*)mute_controller->child(0))->value( !
((Fl_Button*)mute_controller->child(0))->value());
}
else if ( ! strcmp( picked, "Auto Output/On" ) ) else if ( ! strcmp( picked, "Auto Output/On" ) )
{ {
manual_connection( false ); manual_connection( false );
@ -1079,6 +1090,9 @@ Mixer_Strip::menu ( void ) const
m.add( "Width/Wide", 'w', 0, 0, FL_MENU_RADIO | ( width_button->value() ? FL_MENU_VALUE : 0 ) ); m.add( "Width/Wide", 'w', 0, 0, FL_MENU_RADIO | ( width_button->value() ? FL_MENU_VALUE : 0 ) );
m.add( "View/Fader", 'f', 0, 0, FL_MENU_RADIO | ( 0 == tab_button->value() ? FL_MENU_VALUE : 0 ) ); m.add( "View/Fader", 'f', 0, 0, FL_MENU_RADIO | ( 0 == tab_button->value() ? FL_MENU_VALUE : 0 ) );
m.add( "View/Signal", 's', 0, 0, FL_MENU_RADIO | ( 1 == tab_button->value() ? FL_MENU_VALUE : 0 ) ); m.add( "View/Signal", 's', 0, 0, FL_MENU_RADIO | ( 1 == tab_button->value() ? FL_MENU_VALUE : 0 ) );
m.add( "Mute", 'm', 0, 0, 0 );
// ( 1 == mute_controller->control_output[0].connected_port()->control_value() ? FL_MENU_VALUE : 0 ) );
m.add( "Gain", 'g', 0, 0 );
m.add( "Move Left", '[', 0, 0 ); m.add( "Move Left", '[', 0, 0 );
m.add( "Move Right", ']', 0, 0 ); m.add( "Move Right", ']', 0, 0 );
m.add( "Color", 0, 0, 0 ); m.add( "Color", 0, 0, 0 );