From 8c59f665835409cb66f9b18a15e2d22f84627d24 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 5 Jul 2019 13:21:26 -0400 Subject: [PATCH] ScrubbingToolBar eats less idle time after commit 192530d --- src/toolbars/ScrubbingToolBar.cpp | 2 -- src/widgets/AButton.cpp | 14 +++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/toolbars/ScrubbingToolBar.cpp b/src/toolbars/ScrubbingToolBar.cpp index 4fe092ec7..bca717598 100644 --- a/src/toolbars/ScrubbingToolBar.cpp +++ b/src/toolbars/ScrubbingToolBar.cpp @@ -219,9 +219,7 @@ void ScrubbingToolBar::OnButton(wxCommandEvent &event) void ScrubbingToolBar::EnableDisableButtons() { const auto scrubButton = mButtons[STBScrubID]; - scrubButton->SetEnabled(true); const auto seekButton = mButtons[STBSeekID]; - seekButton->SetEnabled(true); AudacityProject *p = &mProject; diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index 197077c05..4463c89b5 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -575,9 +575,11 @@ bool AButton::WasControlDown() void AButton::Enable() { - wxWindow::Enable(true); - mEnabled = true; - Refresh(false); + bool changed = wxWindow::Enable(true); + if ( !mEnabled ) { + mEnabled = true; + Refresh(false); + } } void AButton::Disable() @@ -589,10 +591,12 @@ void AButton::Disable() #ifndef __WXMSW__ wxWindow::Enable(false); #endif - mEnabled = false; if (GetCapture()==this) ReleaseMouse(); - Refresh(false); + if ( mEnabled ) { + mEnabled = false; + Refresh(false); + } } void AButton::PushDown()