From 29479f73c43f4e4f6d5becaa330d141419424270 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 10 Apr 2013 22:40:58 -0700 Subject: [PATCH] Mixer: Ensure that meters are drawn correctly before the first resize. --- mixer/src/DPM.C | 17 +++++------------ mixer/src/Meter_Indicator_Module.C | 4 +--- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/mixer/src/DPM.C b/mixer/src/DPM.C index 4ef25a6..8cb551a 100644 --- a/mixer/src/DPM.C +++ b/mixer/src/DPM.C @@ -39,8 +39,6 @@ Fl_Color DPM::_dim_gradient[128]; DPM::DPM ( int X, int Y, int W, int H, const char *L ) : Meter( X, Y, W, H, L ) { - _value = 0.0f; - tooltip( peak_string ); _last_drawn_hi_segment = 0; @@ -59,6 +57,8 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) : box( FL_FLAT_BOX ); color( FL_BACKGROUND_COLOR ); + + resize( X,Y,W,H); } /* which marks to draw beside meter */ @@ -108,7 +108,7 @@ DPM::resize ( int X, int Y, int W, int H ) else _segments = floor( H / (double)_pixels_per_segment ); -// _last_drawn_hi_segment = 0; + _last_drawn_hi_segment = 0; Fl_Widget::resize( X, Y, W, H ); } @@ -116,15 +116,9 @@ DPM::resize ( int X, int Y, int W, int H ) void DPM::draw ( void ) { - if ( !_segments ) - return; - snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() ); tooltip( peak_string ); - if ( ! fl_not_clipped( x(), y(), w(), h() ) ) - return; - int X = x() + 2; int Y = y() + 2; int W = w() - 4; @@ -138,11 +132,11 @@ DPM::draw ( void ) int bh = h() / _segments; int bw = w() / _segments; - if ( damage() == FL_DAMAGE_ALL ) + if ( damage() & FL_DAMAGE_ALL ) { draw_label(); - draw_box( FL_UP_FRAME, x(), y(), w(), h(), FL_BLACK ); + draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK ); } fl_push_clip( X, Y, W, H ); @@ -173,7 +167,6 @@ DPM::draw ( void ) _last_drawn_hi_segment = v; - for ( int p = lo; p <= hi; p++ ) { Fl_Color c; diff --git a/mixer/src/Meter_Indicator_Module.C b/mixer/src/Meter_Indicator_Module.C index 6ec5e68..2defb29 100644 --- a/mixer/src/Meter_Indicator_Module.C +++ b/mixer/src/Meter_Indicator_Module.C @@ -48,7 +48,7 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default ) : Module ( is_default, 50, 100, name() ) { box( FL_FLAT_BOX ); - color( FL_BACKGROUND_COLOR ); + color( FL_BLACK ); _disable_context_menu = false; _pad = true; @@ -174,8 +174,6 @@ Meter_Indicator_Module::update_cb ( void ) dpm->value( -70.0f ); } -// redraw(); - /* engine->unlock(); */ } else