Mixer: Try harder to avoid drawing meters more than necessary.

pull/3/head
Jonathan Moore Liles 2012-03-02 00:16:55 -08:00
parent 32bd29a28b
commit 5fbdd940be
3 changed files with 21 additions and 5 deletions

View File

@ -31,6 +31,8 @@ class DPM : public Meter
int _pixels_per_segment;
int _last_drawn_hi_segment;
float _value;
int pos ( float v )
{
return deflection( v ) * _segments;
@ -63,7 +65,21 @@ public:
DPM ( int X, int Y, int W, int H, const char *L = 0 );
// void value ( float v ) { if ( pos( v ) != pos( value() ) ) redraw(); Meter::value( v ) }
void value ( float v )
{
if ( _value != v )
{
if ( pos( v ) != pos( _value ) )
Meter::value( v );
}
_value = v;
}
float value ( void ) const
{
return _value;
}
void pixels_per_segment ( int v ) { _pixels_per_segment = v; }

View File

@ -81,7 +81,7 @@ public:
virtual ~Meter ( ) { }
void value ( float v )
virtual void value ( float v )
{
damage( FL_DAMAGE_USER1 );
@ -91,7 +91,7 @@ public:
_peak = _value;
}
float value ( void ) const { return _value; }
virtual float value ( void ) const { return _value; }
float peak ( void ) const { return _peak; }
void reset ( void ) { _peak = -80.0f; redraw(); }

View File

@ -371,9 +371,9 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
o->add( "_&Options/&Display/&Colors/&Light", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&Gray", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );
o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );
o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO );
o->add( "&Help/&Manual" );
o->add( "&Help/&About" );