mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-08 16:11:14 +02:00
Free ScrubbingToolBar from cycles...
... by having it update itself in idle time, not needing a push from Scrubber Shrinking that remnant of the big strongly connected component to 6
This commit is contained in:
parent
3e3cf24c01
commit
192530d8a5
@ -52,6 +52,7 @@ EVT_COMMAND_RANGE( STBFirstButton,
|
|||||||
STBFirstButton + STBNumButtons - 1,
|
STBFirstButton + STBNumButtons - 1,
|
||||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||||
ScrubbingToolBar::OnButton )
|
ScrubbingToolBar::OnButton )
|
||||||
|
EVT_IDLE( ScrubbingToolBar::OnIdle )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
//Standard contructor
|
//Standard contructor
|
||||||
@ -223,7 +224,6 @@ void ScrubbingToolBar::EnableDisableButtons()
|
|||||||
seekButton->SetEnabled(true);
|
seekButton->SetEnabled(true);
|
||||||
|
|
||||||
AudacityProject *p = &mProject;
|
AudacityProject *p = &mProject;
|
||||||
if (!p) return;
|
|
||||||
|
|
||||||
auto &scrubber = Scrubber::Get( *p );
|
auto &scrubber = Scrubber::Get( *p );
|
||||||
const auto canScrub = scrubber.CanScrub();
|
const auto canScrub = scrubber.CanScrub();
|
||||||
@ -262,6 +262,12 @@ void ScrubbingToolBar::EnableDisableButtons()
|
|||||||
scrubber.CheckMenuItems();
|
scrubber.CheckMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScrubbingToolBar::OnIdle( wxIdleEvent &evt )
|
||||||
|
{
|
||||||
|
evt.Skip();
|
||||||
|
EnableDisableButtons();
|
||||||
|
}
|
||||||
|
|
||||||
static RegisteredToolbarFactory factory{ ScrubbingBarID,
|
static RegisteredToolbarFactory factory{ ScrubbingBarID,
|
||||||
[]( AudacityProject &project ){
|
[]( AudacityProject &project ){
|
||||||
return ToolBar::Holder{ safenew ScrubbingToolBar{ project } }; }
|
return ToolBar::Holder{ safenew ScrubbingToolBar{ project } }; }
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
wxImage *downImage;
|
wxImage *downImage;
|
||||||
wxImage *hiliteImage;
|
wxImage *hiliteImage;
|
||||||
|
|
||||||
|
void OnIdle( wxIdleEvent &evt );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DECLARE_CLASS(ScrubbingToolBar)
|
DECLARE_CLASS(ScrubbingToolBar)
|
||||||
|
@ -30,7 +30,6 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../prefs/PlaybackPrefs.h"
|
#include "../../prefs/PlaybackPrefs.h"
|
||||||
#include "../../prefs/TracksPrefs.h"
|
#include "../../prefs/TracksPrefs.h"
|
||||||
#include "../../toolbars/ControlToolBar.h"
|
#include "../../toolbars/ControlToolBar.h"
|
||||||
#include "../../toolbars/ScrubbingToolBar.h"
|
|
||||||
#include "../../toolbars/ToolManager.h"
|
#include "../../toolbars/ToolManager.h"
|
||||||
|
|
||||||
#undef USE_TRANSCRIPTION_TOOLBAR
|
#undef USE_TRANSCRIPTION_TOOLBAR
|
||||||
@ -1120,10 +1119,6 @@ void Scrubber::OnScrubOrSeek(bool seek)
|
|||||||
auto &ruler = AdornedRulerPanel::Get( *mProject );
|
auto &ruler = AdornedRulerPanel::Get( *mProject );
|
||||||
// Update button images
|
// Update button images
|
||||||
ruler.UpdateButtonStates();
|
ruler.UpdateButtonStates();
|
||||||
|
|
||||||
auto scrubbingToolBar = &ScrubbingToolBar::Get( *mProject );
|
|
||||||
scrubbingToolBar->EnableDisableButtons();
|
|
||||||
scrubbingToolBar->RegenerateTooltips();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::OnScrub(const CommandContext&)
|
void Scrubber::OnScrub(const CommandContext&)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user