mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 17:14:07 +01:00
Scrubber holds preference, AdornedRulerPanel updates in idle time...
... removing two uses of AdornedRulerPanel in Scrubbing
This commit is contained in:
@@ -233,6 +233,8 @@ Scrubber::Scrubber(AudacityProject *project)
|
||||
&Scrubber::OnActivateOrDeactivateApp, this);
|
||||
if (mWindow)
|
||||
mWindow->PushEventHandler(&mForwarder);
|
||||
|
||||
UpdatePrefs();
|
||||
}
|
||||
|
||||
Scrubber::~Scrubber()
|
||||
@@ -749,7 +751,7 @@ void Scrubber::StopScrubbing()
|
||||
|
||||
bool Scrubber::ShowsBar() const
|
||||
{
|
||||
return AdornedRulerPanel::Get( *mProject ).ShowingScrubRuler();
|
||||
return mShowScrubbing;
|
||||
}
|
||||
|
||||
bool Scrubber::IsScrubbing() const
|
||||
@@ -1113,10 +1115,35 @@ void Scrubber::OnSeek(const CommandContext&)
|
||||
CheckMenuItems();
|
||||
}
|
||||
|
||||
#if 1
|
||||
namespace {
|
||||
static const wxChar *scrubEnabledPrefName = wxT("/QuickPlay/ScrubbingEnabled");
|
||||
|
||||
bool ReadScrubEnabledPref()
|
||||
{
|
||||
bool result {};
|
||||
gPrefs->Read(scrubEnabledPrefName, &result, false);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void WriteScrubEnabledPref(bool value)
|
||||
{
|
||||
gPrefs->Write(scrubEnabledPrefName, value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Scrubber::UpdatePrefs()
|
||||
{
|
||||
mShowScrubbing = ReadScrubEnabledPref();
|
||||
}
|
||||
|
||||
void Scrubber::OnToggleScrubRuler(const CommandContext&)
|
||||
{
|
||||
auto &ruler = AdornedRulerPanel::Get( *mProject );
|
||||
ruler.OnToggleScrubRuler();
|
||||
mShowScrubbing = !mShowScrubbing;
|
||||
WriteScrubEnabledPref(mShowScrubbing);
|
||||
gPrefs->Flush();
|
||||
const auto toolbar =
|
||||
ToolManager::Get( *mProject ).GetToolBar( ScrubbingBarID );
|
||||
toolbar->EnableDisableButtons();
|
||||
|
||||
@@ -17,7 +17,8 @@ Paul Licameli split from TrackPanel.cpp
|
||||
#include <wx/longlong.h>
|
||||
|
||||
#include "../../AudioIOBase.h" // for ScrubbingOptions
|
||||
#include "../../ClientData.h"
|
||||
#include "../../ClientData.h" // to inherit
|
||||
#include "../../Prefs.h" // to inherit
|
||||
#include "../../widgets/Overlay.h" // to inherit
|
||||
#include "../../commands/CommandContext.h"
|
||||
#include "../../commands/CommandManager.h" // for MenuTable
|
||||
@@ -39,6 +40,7 @@ extern AudacityProject *GetActiveProject();
|
||||
class Scrubber final
|
||||
: public wxEvtHandler
|
||||
, public ClientData::Base
|
||||
, private PrefsListener
|
||||
{
|
||||
public:
|
||||
static Scrubber &Get( AudacityProject &project );
|
||||
@@ -130,6 +132,8 @@ public:
|
||||
bool IsTransportingPinned() const;
|
||||
|
||||
private:
|
||||
void UpdatePrefs() override;
|
||||
|
||||
void StartPolling();
|
||||
void StopPolling();
|
||||
void DoScrub(bool seek);
|
||||
@@ -185,6 +189,8 @@ private:
|
||||
|
||||
ScrubbingOptions mOptions;
|
||||
double mMaxSpeed { 1.0 };
|
||||
|
||||
bool mShowScrubbing { false };
|
||||
};
|
||||
|
||||
// Specialist in drawing the scrub speed, and listening for certain events
|
||||
|
||||
Reference in New Issue
Block a user