Mixer: Ensure that meters are drawn correctly before the first resize.

This commit is contained in:
Jonathan Moore Liles 2013-04-10 22:40:58 -07:00
parent cbf7df0e0d
commit 29479f73c4
2 changed files with 6 additions and 15 deletions

View File

@ -39,8 +39,6 @@ Fl_Color DPM::_dim_gradient[128];
DPM::DPM ( int X, int Y, int W, int H, const char *L ) : DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
Meter( X, Y, W, H, L ) Meter( X, Y, W, H, L )
{ {
_value = 0.0f;
tooltip( peak_string ); tooltip( peak_string );
_last_drawn_hi_segment = 0; _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 ); box( FL_FLAT_BOX );
color( FL_BACKGROUND_COLOR ); color( FL_BACKGROUND_COLOR );
resize( X,Y,W,H);
} }
/* which marks to draw beside meter */ /* which marks to draw beside meter */
@ -108,7 +108,7 @@ DPM::resize ( int X, int Y, int W, int H )
else else
_segments = floor( H / (double)_pixels_per_segment ); _segments = floor( H / (double)_pixels_per_segment );
// _last_drawn_hi_segment = 0; _last_drawn_hi_segment = 0;
Fl_Widget::resize( X, Y, W, H ); Fl_Widget::resize( X, Y, W, H );
} }
@ -116,15 +116,9 @@ DPM::resize ( int X, int Y, int W, int H )
void void
DPM::draw ( void ) DPM::draw ( void )
{ {
if ( !_segments )
return;
snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() ); snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() );
tooltip( peak_string ); tooltip( peak_string );
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
return;
int X = x() + 2; int X = x() + 2;
int Y = y() + 2; int Y = y() + 2;
int W = w() - 4; int W = w() - 4;
@ -138,11 +132,11 @@ DPM::draw ( void )
int bh = h() / _segments; int bh = h() / _segments;
int bw = w() / _segments; int bw = w() / _segments;
if ( damage() == FL_DAMAGE_ALL ) if ( damage() & FL_DAMAGE_ALL )
{ {
draw_label(); 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 ); fl_push_clip( X, Y, W, H );
@ -173,7 +167,6 @@ DPM::draw ( void )
_last_drawn_hi_segment = v; _last_drawn_hi_segment = v;
for ( int p = lo; p <= hi; p++ ) for ( int p = lo; p <= hi; p++ )
{ {
Fl_Color c; Fl_Color c;

View File

@ -48,7 +48,7 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
: Module ( is_default, 50, 100, name() ) : Module ( is_default, 50, 100, name() )
{ {
box( FL_FLAT_BOX ); box( FL_FLAT_BOX );
color( FL_BACKGROUND_COLOR ); color( FL_BLACK );
_disable_context_menu = false; _disable_context_menu = false;
_pad = true; _pad = true;
@ -174,8 +174,6 @@ Meter_Indicator_Module::update_cb ( void )
dpm->value( -70.0f ); dpm->value( -70.0f );
} }
// redraw();
/* engine->unlock(); */ /* engine->unlock(); */
} }
else else