Mixer: Fix glitch in redrawing of meter scales when scrolling.
This commit is contained in:
parent
7c071c7422
commit
e0402a3b99
|
@ -89,40 +89,40 @@ 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 };
|
||||
|
||||
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_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive( FL_FOREGROUND_COLOR ) );
|
||||
/* draw marks */
|
||||
char pat[5];
|
||||
if ( type() == FL_HORIZONTAL )
|
||||
{
|
||||
fl_font( FL_TIMES, 8 );
|
||||
fl_color( FL_FOREGROUND_COLOR );
|
||||
/* draw marks */
|
||||
char pat[5];
|
||||
if ( type() == FL_HORIZONTAL )
|
||||
{
|
||||
for ( int i = sizeof( marks ) / sizeof( marks[0] ); i-- ; )
|
||||
{
|
||||
sprintf( pat, "%d", marks[ i ] );
|
||||
for ( int i = sizeof( marks ) / sizeof( marks[0] ); i-- ; )
|
||||
{
|
||||
sprintf( pat, "%d", marks[ i ] );
|
||||
|
||||
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) );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = sizeof( marks ) / sizeof( marks[0] ); i-- ; )
|
||||
{
|
||||
sprintf( pat, "%d", 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) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = sizeof( marks ) / sizeof( marks[0] ); i-- ; )
|
||||
{
|
||||
sprintf( pat, "%d", marks[ i ] );
|
||||
|
||||
int v = h() * deflection( (float)marks[ i ] );
|
||||
|
||||
fl_draw( pat, X, (Y + H - 4) - v, W, 8, (Fl_Align) (FL_ALIGN_RIGHT | FL_ALIGN_TOP) );
|
||||
}
|
||||
}
|
||||
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -166,9 +166,6 @@ DPM::draw ( void )
|
|||
int X,Y,W,H;
|
||||
bbox(X,Y,W,H);
|
||||
|
||||
if ( 0 == fl_not_clipped(X,Y,W,H ) )
|
||||
return;
|
||||
|
||||
int v = pos( value() );
|
||||
int pv = pos( peak() );
|
||||
|
||||
|
@ -179,9 +176,12 @@ DPM::draw ( void )
|
|||
/* int bw = _pixels_per_segment; */
|
||||
int bw = W / _segments;
|
||||
|
||||
if ( 0 == fl_not_clipped(X,Y,W,H ) )
|
||||
return;
|
||||
|
||||
if ( damage() & FL_DAMAGE_ALL )
|
||||
{
|
||||
draw_label();
|
||||
/* draw_label(); */
|
||||
|
||||
draw_box( box(), X, Y, W, H, color() );
|
||||
}
|
||||
|
|
|
@ -56,14 +56,15 @@ class DPM : public Meter
|
|||
|
||||
protected:
|
||||
|
||||
virtual void draw_label ( void );
|
||||
virtual void draw ( void );
|
||||
virtual void resize ( int, int, int, int );
|
||||
/* virtual void draw_label ( void ); */
|
||||
|
||||
void bbox ( int &X, int &Y, int &W, int &H );
|
||||
|
||||
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 );
|
||||
|
||||
|
|
|
@ -57,7 +57,13 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
|
|||
|
||||
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->box( FL_NO_BOX );
|
||||
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 )
|
||||
{
|
||||
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
|
||||
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();
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ Mixer_Strip::init ( )
|
|||
{ Fl_Scalepack* o = new Fl_Scalepack(2, 135, 105, 311 );
|
||||
// o->box( FL_BORDER_BOX );
|
||||
// o->color( FL_RED );
|
||||
o->spacing( 20 );
|
||||
o->spacing( 0 );
|
||||
o->type( Fl_Scalepack::HORIZONTAL );
|
||||
{ Controller_Module *o = gain_controller = new Controller_Module( true );
|
||||
o->horizontal(false);
|
||||
|
|
Loading…
Reference in New Issue