1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-09 07:55:42 +01:00

Appearance on OSX is now back to normal or better

Some additional wx3 cleanup as well.
This commit is contained in:
Leland Lucius
2015-08-23 20:25:01 -05:00
parent 1878a0ddd0
commit 6a9dae20f5
35 changed files with 876 additions and 924 deletions

View File

@@ -414,7 +414,8 @@ void Meter::OnErase(wxEraseEvent & WXUNUSED(event))
void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
{
wxDC *paintDC = wxAutoBufferedPaintDCFactory(this);
// wxDC *paintDC = wxAutoBufferedPaintDCFactory(this);
wxPaintDC *paintDC = new wxPaintDC(this);
wxDC & destDC = *paintDC;
if (mLayoutValid == false)
@@ -425,10 +426,11 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
}
// Create a new one using current size and select into the DC
mBitmap = new wxBitmap(mWidth, mHeight);
mBitmap = new wxBitmap();
mBitmap->Create(mWidth, mHeight, destDC);
wxMemoryDC dc;
dc.SelectObject(*mBitmap);
// Go calculate all of the layout metrics
HandleLayout(dc);
@@ -446,7 +448,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
dc.SetBrush(mBkgndBrush);
dc.DrawRectangle(0, 0, mWidth, mHeight);
#endif
// MixerTrackCluster style has no icon or L/R labels
if (mStyle != MixerTrackCluster)
{
@@ -1486,62 +1488,16 @@ void Meter::RepaintBarsNow()
{
if (mLayoutValid)
{
#if defined(__WXMSW__)
wxClientDC clientDC(this);
wxBufferedDC dc(&clientDC, *mBitmap);
#else
wxClientDC dc(this);
#endif
// Invalidate the bars so they get redrawn
for (int i = 0; i < mNumBars; i++)
{
DrawMeterBar(dc, &mBar[i]);
Refresh(false, &mBar[i].r);
}
#if defined(__WXMAC__) || defined(__WXGTK__)
// Due to compositing or antialiasing on the Mac, we have to make
// sure all remnants of the previous ruler text is completely gone.
// Otherwise, we get a strange bolding effect.
//
// Since redrawing the rulers above wipe out most of the ruler, the
// only thing that is left is the bits between the bars.
if (mStyle == HorizontalStereoCompact)
{
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(mBkgndBrush);
dc.DrawRectangle(mBar[0].b.GetLeft(),
mBar[0].b.GetBottom() + 1,
mBar[0].b.GetWidth(),
mBar[1].b.GetTop() - mBar[0].b.GetBottom() - 1);
AColor::Bevel(dc, false, mBar[0].b);
AColor::Bevel(dc, false, mBar[1].b);
}
else if (mStyle == VerticalStereoCompact)
{
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(mBkgndBrush);
dc.DrawRectangle(mBar[0].b.GetRight() + 1,
mBar[0].b.GetTop(),
mBar[1].b.GetLeft() - mBar[0].b.GetRight() - 1,
mBar[0].b.GetHeight());
AColor::Bevel(dc, false, mBar[0].b);
AColor::Bevel(dc, false, mBar[1].b);
}
#endif
// Immediate redraw (using wxPaintDC)
Update();
#if defined(__WXMSW__) || defined(__WXGTK__)
if (mIsFocused)
{
wxRect r = mIconRect;
AColor::DrawFocus(dc, r.Inflate(1, 1));
}
#endif
// Compact style requires redrawing ruler
if (mStyle == HorizontalStereoCompact || mStyle == VerticalStereoCompact)
{
mRuler.Draw(dc);
}
return;
}
}