Mixer: Fix glitch in redrawing of meter scales when scrolling.

This commit is contained in:
Jonathan Moore Liles 2020-12-01 15:56:52 -08:00
parent 7c071c7422
commit e0402a3b99
4 changed files with 54 additions and 37 deletions

View File

@ -89,14 +89,13 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
const int marks [] = { -70, -50, -40, -30, -20, -10, -3, 0, 4 }; const int marks [] = { -70, -50, -40, -30, -20, -10, -3, 0, 4 };
void void
DPM::draw_label ( void ) DPM::public_draw_label ( int X, int Y, int W, int H )
{ {
fl_push_clip(X,Y,W,H);
fl_rectf( X,Y,W,H, FL_BACKGROUND_COLOR);
/* dirty hack */
if ( parent()->child( 0 ) == this )
{
fl_font( FL_TIMES, 8 ); fl_font( FL_TIMES, 8 );
fl_color( FL_FOREGROUND_COLOR ); fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive( FL_FOREGROUND_COLOR ) );
/* draw marks */ /* draw marks */
char pat[5]; char pat[5];
if ( type() == FL_HORIZONTAL ) if ( type() == FL_HORIZONTAL )
@ -107,7 +106,7 @@ DPM::draw_label ( void )
int v = w() * deflection( (float)marks[ i ] ); int v = w() * deflection( (float)marks[ i ] );
fl_draw( pat, x() + v, (y() + h() + 8), 19, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) ); fl_draw( pat, X + v, (Y + H + 8), W, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) );
} }
} }
@ -119,10 +118,11 @@ DPM::draw_label ( void )
int v = h() * deflection( (float)marks[ i ] ); int v = h() * deflection( (float)marks[ i ] );
fl_draw( pat, x() - 20, (y() + h() - 4) - v, 19, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) ); fl_draw( pat, X, (Y + H - 4) - v, W, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) );
}
} }
} }
fl_pop_clip();
} }
void void
@ -166,9 +166,6 @@ DPM::draw ( void )
int X,Y,W,H; int X,Y,W,H;
bbox(X,Y,W,H); bbox(X,Y,W,H);
if ( 0 == fl_not_clipped(X,Y,W,H ) )
return;
int v = pos( value() ); int v = pos( value() );
int pv = pos( peak() ); int pv = pos( peak() );
@ -179,9 +176,12 @@ DPM::draw ( void )
/* int bw = _pixels_per_segment; */ /* int bw = _pixels_per_segment; */
int bw = W / _segments; int bw = W / _segments;
if ( 0 == fl_not_clipped(X,Y,W,H ) )
return;
if ( damage() & FL_DAMAGE_ALL ) if ( damage() & FL_DAMAGE_ALL )
{ {
draw_label(); /* draw_label(); */
draw_box( box(), X, Y, W, H, color() ); draw_box( box(), X, Y, W, H, color() );
} }

View File

@ -56,14 +56,15 @@ class DPM : public Meter
protected: protected:
virtual void draw_label ( void );
virtual void draw ( void ); virtual void draw ( void );
virtual void resize ( int, int, int, int ); virtual void resize ( int, int, int, int );
/* virtual void draw_label ( void ); */
void bbox ( int &X, int &Y, int &W, int &H ); void bbox ( int &X, int &Y, int &W, int &H );
public: public:
void public_draw_label ( int X, int Y, int W, int H );
DPM ( int X, int Y, int W, int H, const char *L = 0 ); DPM ( int X, int Y, int W, int H, const char *L = 0 );

View File

@ -57,7 +57,13 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
control_input[0].hints.visible = false; control_input[0].hints.visible = false;
dpm_pack = new Fl_Scalepack( x() + 2, y() + 2, w() - 4, h() - 4 ); /* dpm_pack = new Fl_Scalepack( x() + 2, y() + 2, w() - 4, h() - 4 ); */
/* /\* dpm_pack->color( FL_BACKGROUND_COLOR ); *\/ */
/* dpm_pack->box( FL_NO_BOX ); */
/* dpm_pack->type( FL_HORIZONTAL ); */
/* dpm_pack->spacing(1); */
dpm_pack = new Fl_Scalepack( x() + 20 + 2, y() + 2, w() - 20 - 4, h() - 4 );
/* dpm_pack->color( FL_BACKGROUND_COLOR ); */ /* dpm_pack->color( FL_BACKGROUND_COLOR ); */
dpm_pack->box( FL_NO_BOX ); dpm_pack->box( FL_NO_BOX );
dpm_pack->type( FL_HORIZONTAL ); dpm_pack->type( FL_HORIZONTAL );
@ -90,16 +96,26 @@ Meter_Indicator_Module::~Meter_Indicator_Module ( )
void Meter_Indicator_Module::resize ( int X, int Y, int W, int H ) void Meter_Indicator_Module::resize ( int X, int Y, int W, int H )
{ {
Fl_Group::resize(X,Y,W,H); Fl_Group::resize(X,Y,W,H);
dpm_pack->resize( x() + DX, y() + DX, w() - DX*2, h() - DX*2); dpm_pack->resize( x() + 20 + DX , y() + DX, w() - 20 - DX*2, h() - DX*2);
} }
void void
Meter_Indicator_Module::draw ( void ) Meter_Indicator_Module::draw ( void )
{ {
/* draw_box(x(),y(),w(),h()); */ /* if ( damage() & FL_DAMAGE_ALL ) */
/* draw_box(x(),y(),w(),h()); */
Fl_Group::draw(); Fl_Group::draw();
if ( damage() & FL_DAMAGE_ALL )
{
/* need to trigger redraw of exterior label */
if ( dpm_pack->children() )
{
((DPM*)dpm_pack->child(0))->public_draw_label( x(), y(), 19, h() );
}
}
fl_rect( x(), y(), w(), h(), fl_darker(fl_darker(FL_BACKGROUND_COLOR))); fl_rect( x(), y(), w(), h(), fl_darker(fl_darker(FL_BACKGROUND_COLOR)));
} }

View File

@ -675,7 +675,7 @@ Mixer_Strip::init ( )
{ Fl_Scalepack* o = new Fl_Scalepack(2, 135, 105, 311 ); { Fl_Scalepack* o = new Fl_Scalepack(2, 135, 105, 311 );
// o->box( FL_BORDER_BOX ); // o->box( FL_BORDER_BOX );
// o->color( FL_RED ); // o->color( FL_RED );
o->spacing( 20 ); o->spacing( 0 );
o->type( Fl_Scalepack::HORIZONTAL ); o->type( Fl_Scalepack::HORIZONTAL );
{ Controller_Module *o = gain_controller = new Controller_Module( true ); { Controller_Module *o = gain_controller = new Controller_Module( true );
o->horizontal(false); o->horizontal(false);