From c34dd3172be89cfa062e786c62e96b8c50ba89f1 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sat, 14 Apr 2018 21:38:53 +0100 Subject: [PATCH] Reduce flicker of Selection Toolbar Text Previously there could be long delays between erasing text and painting it. Now we erase in the paint event. --- src/Theme.cpp | 2 ++ src/Theme.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/Theme.cpp b/src/Theme.cpp index f575d3bd6..1e4c1e21e 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -1299,6 +1299,7 @@ void ThemeBase::RotateImageInto( int iTo, int iFrom, bool bClockwise ) BEGIN_EVENT_TABLE(auStaticText, wxWindow) EVT_PAINT(auStaticText::OnPaint) + EVT_ERASE_BACKGROUND(auStaticText::OnErase) END_EVENT_TABLE() @@ -1326,6 +1327,7 @@ void auStaticText::OnPaint(wxPaintEvent & WXUNUSED(evt)) { wxPaintDC dc(this); //dc.SetTextForeground( theTheme.Colour( clrTrackPanelText)); + dc.Clear(); dc.DrawText( GetLabel(), 0,0); } diff --git a/src/Theme.h b/src/Theme.h index df9fd23b1..7f421631e 100644 --- a/src/Theme.h +++ b/src/Theme.h @@ -180,6 +180,9 @@ public: auStaticText(wxWindow* parent, wxString text); void OnPaint(wxPaintEvent & evt); bool AcceptsFocus() const override { return false; } + void OnErase(wxEraseEvent& event) { + static_cast(event); + }; DECLARE_EVENT_TABLE(); };