1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-08 16:37:44 +02:00

Draw slider background in correct colour on MixerBoard.

This commit is contained in:
James Crook 2018-04-15 13:46:03 +01:00
parent 35d24bbed5
commit 933c86dce3
2 changed files with 17 additions and 17 deletions

@ -702,9 +702,9 @@ void MixerTrackCluster::OnPaint(wxPaintEvent & WXUNUSED(event))
wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ; wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ;
SetBackgroundColour( col ); SetBackgroundColour( col );
mMeter->SetBackgroundColour( col ); mMeter->SetBackgroundColour( col );
mStaticText_TrackName->SetBackgroundColour( col );
mSlider_Gain->SetBackgroundColour( col ); mSlider_Gain->SetBackgroundColour( col );
mSlider_Pan->SetBackgroundColour( col ); mSlider_Pan->SetBackgroundColour( col );
mStaticText_TrackName->SetBackgroundColour( col );
wxPaintDC dc(this); wxPaintDC dc(this);

@ -568,10 +568,12 @@ void LWSlider::OnPaint(wxDC &dc, bool highlight)
thumbPos += 8-mThumbHeight/2; thumbPos += 8-mThumbHeight/2;
} }
// Previously not done on mac, but with wx3.1.1. it // Draw the background.
// needs to be. // If we are lightweight, this has already been done for us.
if( mHW ) if( mHW ){
dc.SetBackground( wxBrush(mParent->GetBackgroundColour()) );
dc.Clear(); dc.Clear();
}
dc.DrawBitmap(*mBitmap, mLeft, mTop, true); dc.DrawBitmap(*mBitmap, mLeft, mTop, true);
const auto &thumbBitmap = const auto &thumbBitmap =
@ -622,8 +624,14 @@ void LWSlider::DrawToBitmap(wxDC & paintDC)
wxMemoryDC dc; wxMemoryDC dc;
dc.SelectObject(*mBitmap); dc.SelectObject(*mBitmap);
// The backgroundColour is the expected background colour.
// This bitmap is masked, so the colour affects anti-aliassing
// at the edges.
wxColour backgroundColour = theTheme.Colour(clrTrackInfo); wxColour backgroundColour = theTheme.Colour(clrTrackInfo);
dc.SetBackground(backgroundColour); if( mHW )
backgroundColour = mParent->GetBackgroundColour();
dc.SetBackground(wxBrush(backgroundColour));
dc.Clear(); dc.Clear();
// Draw the line along which the thumb moves. // Draw the line along which the thumb moves.
@ -653,12 +661,7 @@ void LWSlider::DrawToBitmap(wxDC & paintDC)
// Colors // Colors
dc.SetTextForeground( theTheme.Colour( clrTrackPanelText )); dc.SetTextForeground( theTheme.Colour( clrTrackPanelText ));
dc.SetTextBackground( backgroundColour );
// backgroundColour should be same as clrTrackInfo.
// This setting of colours may have been necessary at one time to avoid
// antialiasing the font against white, even on dark background.
dc.SetTextBackground( theTheme.Colour( clrTrackInfo ) );
dc.SetBackground( theTheme.Colour( clrTrackInfo ) );
// Used to use wxSOLID here, but wxTRANSPARENT is better for mac, and // Used to use wxSOLID here, but wxTRANSPARENT is better for mac, and
// works fine on windows. // works fine on windows.
dc.SetBackgroundMode( wxTRANSPARENT ); dc.SetBackgroundMode( wxTRANSPARENT );
@ -753,12 +756,9 @@ void LWSlider::DrawToBitmap(wxDC & paintDC)
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
// safenew, because SetMask takes ownership // safenew, because SetMask takes ownership
// On toolbars (etc) we have a HeavyWeight control, with fixed colour background. // We always mask. If we are HeavyWeight, the ASlider draws the
// So we do not need a mask. // background.
// On the TrackPanel we use as a LightWeight control, the background colour is mBitmap->SetMask(safenew wxMask(*mBitmap, backgroundColour));
// not guaranteed to be the same, so we use a mask
if( !mHW )
mBitmap->SetMask(safenew wxMask(*mBitmap, backgroundColour));
} }
void LWSlider::SetToolTipTemplate(const wxString & tip) void LWSlider::SetToolTipTemplate(const wxString & tip)