From 3fad04c2d58e14543605ac4a0a6bb2cebb3a63ab Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 8 Sep 2013 13:59:52 -0700 Subject: [PATCH] Mixer: Tweak appearance. --- FL/focus_frame.C | 18 ++++++++++++++---- FL/focus_frame.H | 2 +- mixer/src/Mixer_Strip.C | 5 ++--- mixer/src/Module.C | 22 +++++++++++++++------- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/FL/focus_frame.C b/FL/focus_frame.C index 44210d9..73ed0e8 100644 --- a/FL/focus_frame.C +++ b/FL/focus_frame.C @@ -27,13 +27,13 @@ draw_focus_frame ( int x, int y, int w, int h, Fl_Color c ) // fl_color( fl_color_average( FL_GRAY, c, 0.50 ) ); - fl_color( fl_color_add_alpha( c, 100 ) ); + /* fl_color( fl_color_add_alpha( c, 100 ) ); */ - fl_line_style( FL_DASH, 2 ); + /* fl_line_style( FL_DASH, 2 ); */ - fl_rect( x, y, w, h ); + /* fl_rect( x, y, w, h ); */ - fl_line_style( FL_SOLID, 2 ); + fl_line_style( FL_SOLID, 3 ); fl_color( c ); @@ -55,3 +55,13 @@ draw_focus_frame ( int x, int y, int w, int h, Fl_Color c ) fl_pop_clip(); } + +bool +focused_r ( Fl_Widget *w ) +{ + for ( Fl_Widget *p = Fl::focus(); p; p = p->parent() ) + if ( p == w ) + return true; + + return false; +} diff --git a/FL/focus_frame.H b/FL/focus_frame.H index b464b93..9ed1788 100644 --- a/FL/focus_frame.H +++ b/FL/focus_frame.H @@ -19,4 +19,4 @@ void draw_focus_frame ( int x, int y, int w, int h, Fl_Color c ); - +bool focused_r ( Fl_Widget *w ); diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index dd003be..77a5418 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -518,8 +518,7 @@ Mixer_Strip::update ( void ) void Mixer_Strip::init ( ) { - selection_color( FL_MAGENTA ); - + selection_color( FL_YELLOW ); _manual_connection = 0; _auto_input = 0; _mute_controller_mode = 0; @@ -754,7 +753,7 @@ Mixer_Strip::draw ( void ) // if ( damage() & ~FL_DAMAGE_USER1 ) Fl_Group::draw(); - if ( Fl::focus() == this ) + if ( focused_r( this ) ) draw_focus_frame( x(),y(),w(),h(), Fl_Group::selection_color() ); /* else */ /* clear_focus_frame( x(),y(),w(),h(), FL_BACKGROUND_COLOR ); */ diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 1595fc7..df378ee 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -139,9 +139,10 @@ Module::init ( void ) labeltype( FL_NO_LABEL ); align( FL_ALIGN_CENTER | FL_ALIGN_INSIDE ); set_visible_focus(); - selection_color( FL_MAGENTA ); + selection_color( FL_YELLOW ); + labelsize(12); - color( fl_color_average( FL_WHITE, FL_CYAN, 0.40 ) ); + color( fl_rgb_color( 122,190,200 ) ); tooltip( "Left click to edit parameters; Ctrl + left click to select; right click or MENU key for menu." ); } @@ -616,8 +617,6 @@ Module::draw_box ( int tx, int ty, int tw, int th ) Fl_Color c = color(); - c = active() && ! bypass() ? c : FL_GRAY; - if ( ! active_r() ) c = fl_inactive( c ); @@ -648,7 +647,7 @@ Module::draw_box ( int tx, int ty, int tw, int th ) fl_pop_clip(); - if ( this == Fl::focus() ) + if ( focused_r( this ) ) draw_focus_frame( tx,ty,tw,th, selection_color() ); fl_pop_clip(); @@ -664,9 +663,9 @@ Module::draw_label ( int tx, int ty, int tw, int th ) char *lab = strdup( label() ); - Fl_Color c = fl_contrast( FL_FOREGROUND_COLOR, bypass() ? FL_BLACK : color() ); + Fl_Color c = fl_contrast( FL_FOREGROUND_COLOR, color() ); - fl_color( active_r() ? c : fl_inactive(c) ); + fl_color( active_r() && ! bypass() ? c : fl_inactive(c) ); fl_font( FL_HELVETICA, labelsize() ); @@ -717,6 +716,15 @@ Module::draw_label ( int tx, int ty, int tw, int th ) } fl_draw( s ? s : lab, tx, ty, tw, th, align() | FL_ALIGN_CLIP ); + + if ( bypass() ) + { + fl_color( fl_color_add_alpha( fl_color(), 127 ) ); + fl_line_style( FL_SOLID, 2 ); + fl_line( tx, ty + th * 0.5, tx + tw, ty + th * 0.5 ); + fl_line_style( FL_SOLID, 0 ); + } + free(lab);