diff --git a/DPM.C b/DPM.C index dbf03d0..dae915f 100644 --- a/DPM.C +++ b/DPM.C @@ -26,6 +26,10 @@ #include #include +#include + +#include +#include DPM::DPM ( int X, int Y, int W, int H, const char *L ) : Meter( X, Y, W, H, L ) @@ -35,14 +39,35 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) : dim( 0.80f ); - min_color( FL_GREEN ); + min_color( fl_darker( FL_GREEN ) ); max_color( FL_RED ); box( FL_ROUNDED_BOX ); } /* which marks to draw beside meter */ -const int marks [] = { -70, -50, -40, -30, -10, -3, 0, 4 }; +const int marks [] = { -70, -50, -40, -30, -20, -10, -3, 0, 4 }; + +void +DPM::draw_label ( void ) +{ + /* dirty hack */ + if ( parent()->child( 0 ) == this ) + { + fl_font( FL_TIMES, 8 ); + fl_color( FL_WHITE ); + /* draw marks */ + for ( int i = sizeof( marks ) / sizeof( marks[0] ); i-- ; ) + { + char pat[5]; + sprintf( pat, "%d", marks[ i ] ); + + int v = h() * deflection( (float)marks[ i ] ); + + fl_draw( pat, x() - 20, (y() + h() - 8) - v, 19, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) ); + } + } +} void DPM::draw ( void ) @@ -54,9 +79,13 @@ DPM::draw ( void ) int bh = h() / _divisions; int bw = w() / _divisions; + if ( damage() & FL_DAMAGE_ALL ) + draw_label(); + for ( int p = _divisions; p > 0; p-- ) { - Fl_Color c = fl_color_average( _max_color, _min_color, (float)p / _divisions ); +// Fl_Color c = fl_color_average( _min_color, _max_color, ((30.0f * log10f( (float)(_divisions - p ) ) )) / _divisions ); + Fl_Color c = fl_color_average( _max_color, _min_color, (float) p / _divisions ); if ( p > v && p != pv ) // c = fl_color_average( color(), c, _dim ); @@ -70,4 +99,5 @@ DPM::draw ( void ) else draw_box( box(), x(), y() + h() - (p * bh), w(), bh, c ); } + } diff --git a/DPM.H b/DPM.H index 617d1f7..e6942f7 100644 --- a/DPM.H +++ b/DPM.H @@ -39,6 +39,7 @@ class DPM : public Meter protected: + virtual void draw_label ( void ); virtual void draw ( void ); public: diff --git a/Mixer_Strip.fl b/Mixer_Strip.fl index e35dc88..c0e2291 100644 --- a/Mixer_Strip.fl +++ b/Mixer_Strip.fl @@ -40,8 +40,8 @@ widget_class Mixer_Strip {open } } Fl_Button {} { - label {output/input} selected - xywh {52 182 59 25} type Toggle box ROUNDED_BOX color 106 selection_color 65 align 64 + label {output/input} + xywh {56 182 55 25} type Toggle box ROUNDED_BOX color 106 selection_color 65 align 64 class Fl_Flip_Button } Fl_Group {} {open @@ -53,13 +53,13 @@ widget_class Mixer_Strip {open xywh {9 208 33 448} type {Vert Knob} color 32 selection_color 1 minimum 1.5 maximum 0 step 0.01 value 1 textsize 14 } Fl_Pack meters_pack { - label meters open - xywh {52 208 59 471} type HORIZONTAL labeltype NO_LABEL align 0 + label meters open selected + xywh {56 208 55 471} type HORIZONTAL labeltype NO_LABEL align 0 class Fl_Scalepack } { Fl_Box meter { label DPM - xywh {52 208 28 459} box ROUNDED_BOX selection_color 88 + xywh {56 208 24 459} box ROUNDED_BOX selection_color 88 class DPM } Fl_Box {} {