Mixer: Improve keyboard focus.
This commit is contained in:
parent
9002016db5
commit
8b95806b2f
|
@ -170,6 +170,7 @@ public:
|
|||
case FL_LEAVE:
|
||||
return 1;
|
||||
case FL_FOCUS:
|
||||
case FL_UNFOCUS:
|
||||
return 1;
|
||||
case FL_KEYBOARD:
|
||||
{
|
||||
|
|
|
@ -262,6 +262,7 @@ Controller_Module::connect_to ( Port *p )
|
|||
|
||||
control_value = p->control_value();
|
||||
|
||||
w->set_visible_focus();
|
||||
w->align(FL_ALIGN_TOP);
|
||||
w->labelsize( 10 );
|
||||
w->callback( cb_handle, this );
|
||||
|
@ -269,6 +270,7 @@ Controller_Module::connect_to ( Port *p )
|
|||
if ( _pad )
|
||||
{
|
||||
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( w );
|
||||
flg->set_visible_focus();
|
||||
size( flg->w(), flg->h() );
|
||||
add( flg );
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
|
|||
|
||||
end();
|
||||
|
||||
clear_visible_focus();
|
||||
|
||||
Fl::add_timeout( CONTROL_UPDATE_FREQ, update_cb, this );
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ Mixer_Strip::update ( void )
|
|||
void
|
||||
Mixer_Strip::init ( )
|
||||
{
|
||||
selection_color( FL_FOREGROUND_COLOR );
|
||||
selection_color( FL_RED );
|
||||
|
||||
_chain = 0;
|
||||
|
||||
|
@ -313,6 +313,7 @@ Mixer_Strip::init ( )
|
|||
|
||||
Fl_Group::color( FL_BACKGROUND_COLOR );
|
||||
|
||||
set_visible_focus();
|
||||
clip_children( 1 );
|
||||
|
||||
Fl_Pack *gain_pack;
|
||||
|
@ -469,7 +470,7 @@ Mixer_Strip::draw ( void )
|
|||
if ( damage() != FL_DAMAGE_USER1 )
|
||||
Fl_Group::draw();
|
||||
|
||||
Fl_Group::draw_box( FL_ROUNDED_FRAME, x(), y(), w(), h(), _focused ? Fl_Group::selection_color() : FL_BLACK );
|
||||
Fl_Group::draw_box( FL_UP_FRAME, x(), y(), w(), h(), Fl::focus() == this ? Fl_Group::selection_color() : FL_BLACK );
|
||||
}
|
||||
|
||||
|
||||
|
@ -588,7 +589,8 @@ Mixer_Strip::handle ( int m )
|
|||
|
||||
if ( Fl_Group::handle( m ) )
|
||||
return 1;
|
||||
else if ( test_press( FL_BUTTON3 ) )
|
||||
|
||||
if ( test_press( FL_BUTTON3 ) )
|
||||
{
|
||||
menu_popup( &menu() );
|
||||
return 1;
|
||||
|
@ -597,13 +599,11 @@ Mixer_Strip::handle ( int m )
|
|||
return 0;
|
||||
}
|
||||
case FL_FOCUS:
|
||||
_focused = true;
|
||||
damage( FL_DAMAGE_USER1 );
|
||||
return 1;
|
||||
return Fl_Group::handle( m ) || 1;
|
||||
case FL_UNFOCUS:
|
||||
_focused = false;
|
||||
damage( FL_DAMAGE_USER1 );
|
||||
return 1;
|
||||
return Fl_Group::handle( m ) || 1;
|
||||
}
|
||||
|
||||
return Fl_Group::handle( m );
|
||||
|
|
|
@ -109,8 +109,6 @@ private:
|
|||
void cb_handle(Fl_Widget*);
|
||||
static void cb_handle(Fl_Widget*, void*);
|
||||
|
||||
bool _focused;
|
||||
|
||||
void set_tab ( void );
|
||||
|
||||
void update_port_names ( void );
|
||||
|
|
|
@ -95,9 +95,12 @@ Module::init ( void )
|
|||
_chain = 0;
|
||||
_instances = 1;
|
||||
_bypass = 0;
|
||||
|
||||
box( FL_UP_BOX );
|
||||
labeltype( FL_NO_LABEL );
|
||||
clip_children( 1 );
|
||||
set_visible_focus();
|
||||
selection_color( FL_RED );
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,6 +328,11 @@ Module::draw_box ( void )
|
|||
fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, Fl::belowmouse() == this ? fl_lighter( c ) : c );
|
||||
}
|
||||
|
||||
if ( this == Fl::focus() )
|
||||
{
|
||||
fl_draw_box( FL_UP_FRAME, x(), y(), w(), h(), selection_color() );
|
||||
}
|
||||
|
||||
if ( audio_input.size() && audio_output.size() )
|
||||
{
|
||||
/* maybe draw control indicators */
|
||||
|
@ -556,6 +564,8 @@ Module::handle ( int m )
|
|||
}
|
||||
case FL_PUSH:
|
||||
{
|
||||
take_focus();
|
||||
|
||||
if ( Fl_Group::handle( m ) )
|
||||
return 1;
|
||||
else if ( test_press( FL_BUTTON3 ) )
|
||||
|
@ -582,6 +592,10 @@ Module::handle ( int m )
|
|||
|
||||
return 0;
|
||||
}
|
||||
case FL_FOCUS:
|
||||
case FL_UNFOCUS:
|
||||
redraw();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return Fl_Group::handle( m );
|
||||
|
|
|
@ -239,6 +239,9 @@ Module_Parameter_Editor::make_controls ( void )
|
|||
o->resizable( 0 );
|
||||
o->end();
|
||||
|
||||
o->set_visible_focus();
|
||||
flg->set_visible_focus();
|
||||
|
||||
flg->position( o->x(), o->y() );
|
||||
bound->position( o->x(), flg->y() + flg->h() );
|
||||
o->size( flg->w(), flg->h() + bound->h() );
|
||||
|
|
Loading…
Reference in New Issue