From 2cca17376a5728172a8fece0981e0e1bdf6ebb27 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 1 Sep 2013 20:07:16 -0700 Subject: [PATCH] Mixer/Module: Clean up some focus issues, add tooltip, and focus keybinding. --- mixer/src/Module.C | 30 ++++++++++++++++++++++++------ mixer/src/Module.H | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 29bfec6..a15096e 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -141,6 +141,7 @@ Module::init ( void ) selection_color( FL_RED ); labelsize(12); color( fl_color_average( FL_WHITE, FL_CYAN, 0.40 ) ); + tooltip( "Left click to edit parameters; Ctrl + left click to select; right click or MENU key for menu." ); } @@ -625,10 +626,6 @@ Module::draw_box ( int tx, int ty, int tw, int th ) fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, c ); } - if ( this == Fl::focus() ) - { - fl_draw_box( FL_UP_FRAME, tx, ty, tw, th, selection_color() ); - } if ( audio_input.size() && audio_output.size() ) { @@ -650,6 +647,11 @@ Module::draw_box ( int tx, int ty, int tw, int th ) fl_pop_clip(); + if ( this == Fl::focus() ) + { + fl_draw_box( FL_UP_FRAME, tx, ty, tw, th, selection_color() ); + } + fl_pop_clip(); } @@ -833,14 +835,17 @@ Module::menu_cb ( const Fl_Menu_ *m ) if ( ! strcmp( picked, "Edit Parameters" ) ) command_open_parameter_editor(); else if ( ! strcmp( picked, "Bypass" ) ) + { if ( ! bypassable() ) { fl_alert( "Due to its channel configuration, this module cannot be bypassed." ); } else { - bypass( ! ( m->mvalue()->flags & FL_MENU_VALUE ) ); + bypass( !bypass() ); + redraw(); } + } else if ( ! strcmp( picked, "Cut" ) ) { if ( copy() ) @@ -940,6 +945,14 @@ Module::handle ( int m ) unsigned long evstate = Fl::event_state(); + switch ( m ) + { + case FL_ENTER: +// Fl::focus(this); + case FL_LEAVE: + return 1; + } + if ( Fl_Group::handle( m ) ) return 1; @@ -971,7 +984,12 @@ Module::handle ( int m ) if ( ! Fl::event_inside( this ) ) return 1; - if ( e & FL_BUTTON1 ) + if ( ( e & FL_BUTTON1 ) && ( e & FL_CTRL ) ) + { + Fl::focus(this); + return 1; + } + else if ( e & FL_BUTTON1 ) { command_open_parameter_editor(); return 1; diff --git a/mixer/src/Module.H b/mixer/src/Module.H index e8460da..3feec3e 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -406,7 +406,7 @@ public: } virtual bool bypass ( void ) const { return _bypass; } - virtual void bypass ( bool v ) { _bypass = v; redraw(); } + virtual void bypass ( bool v ) { _bypass = v; } virtual bool bypassable ( void ) const {