1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-04 14:39:08 +02:00

Add a check item to Tracks menu for the scrolling beyond zero preference

This commit is contained in:
Paul Licameli 2016-05-10 12:47:34 -04:00
parent 9f8e34ad0f
commit 4394ad1b70
6 changed files with 39 additions and 4 deletions

View File

@ -134,6 +134,7 @@ simplifies construction of menu items.
#endif /* EXPERIMENTAL_SCOREALIGN */ #endif /* EXPERIMENTAL_SCOREALIGN */
#include "tracks/ui/Scrubbing.h" #include "tracks/ui/Scrubbing.h"
#include "prefs/TracksPrefs.h"
enum { enum {
kAlignStartZero = 0, kAlignStartZero = 0,
@ -928,6 +929,16 @@ void AudacityProject::CreateMenusAndCommands()
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
c->AddSeparator();
c->AddCheck(wxT("ScrollLeftOfZero"), _("Scroll left of zero"),
FN(OnToggleScrollLeftOfZero),
gPrefs->ReadBool(
TracksPrefs::ScrollingPreferenceKey(),
TracksPrefs::ScrollingPreferenceDefault()),
AudioIONotBusyFlag, AudioIONotBusyFlag);
//////////////////////////////////////////////////////////////////////////
c->EndMenu(); c->EndMenu();
// All of this is a bit hacky until we can get more things connected into // All of this is a bit hacky until we can get more things connected into
@ -2511,6 +2522,15 @@ void AudacityProject::OnSortName()
mTrackPanel->Refresh(false); mTrackPanel->Refresh(false);
} }
void AudacityProject::OnToggleScrollLeftOfZero()
{
auto key = TracksPrefs::ScrollingPreferenceKey();
auto value = gPrefs->ReadBool(key, TracksPrefs::ScrollingPreferenceDefault());
gPrefs->Write(key, !value);
gPrefs->Flush();
UpdatePrefs();
}
void AudacityProject::OnSkipStart() void AudacityProject::OnSkipStart()
{ {
wxCommandEvent evt; wxCommandEvent evt;

View File

@ -179,6 +179,8 @@ double GetTime(const Track *t);
void OnSortTime(); void OnSortTime();
void OnSortName(); void OnSortName();
void OnToggleScrollLeftOfZero();
void OnSnapToOff(); void OnSnapToOff();
void OnSnapToNearest(); void OnSnapToNearest();
void OnSnapToPrior(); void OnSnapToPrior();

View File

@ -18,6 +18,7 @@ Paul Licameli
#include "prefs/GUISettings.h" #include "prefs/GUISettings.h"
#include "Prefs.h" #include "Prefs.h"
#include "xml/XMLWriter.h" #include "xml/XMLWriter.h"
#include "prefs/TracksPrefs.h"
namespace { namespace {
static const double gMaxZoom = 6000000; static const double gMaxZoom = 6000000;
@ -133,7 +134,8 @@ void ViewInfo::UpdatePrefs()
{ {
ZoomInfo::UpdatePrefs(); ZoomInfo::UpdatePrefs();
#ifdef EXPERIMENTAL_SCROLLING_LIMITS #ifdef EXPERIMENTAL_SCROLLING_LIMITS
gPrefs->Read(wxT("/GUI/ScrollBeyondZero"), &bScrollBeyondZero, false); gPrefs->Read(TracksPrefs::ScrollingPreferenceKey(), &bScrollBeyondZero,
TracksPrefs::ScrollingPreferenceDefault());
#endif #endif
} }

View File

@ -45,6 +45,12 @@ TracksPrefs::~TracksPrefs()
{ {
} }
const wxChar *TracksPrefs::ScrollingPreferenceKey()
{
static auto string = wxT("/GUI/ScrollBeyondZero");
return string;
}
void TracksPrefs::Populate() void TracksPrefs::Populate()
{ {
mSoloCodes.Add(wxT("Simple")); mSoloCodes.Add(wxT("Simple"));
@ -134,8 +140,8 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
true); true);
#ifdef EXPERIMENTAL_SCROLLING_LIMITS #ifdef EXPERIMENTAL_SCROLLING_LIMITS
S.TieCheckBox(_("Enable scrolling left of &zero"), S.TieCheckBox(_("Enable scrolling left of &zero"),
wxT("/GUI/ScrollBeyondZero"), ScrollingPreferenceKey(),
false); ScrollingPreferenceDefault());
#endif #endif
S.AddSpace(10); S.AddSpace(10);

View File

@ -29,6 +29,9 @@ class TracksPrefs final : public PrefsPanel
~TracksPrefs(); ~TracksPrefs();
bool Apply() override; bool Apply() override;
static const wxChar *ScrollingPreferenceKey();
static inline bool ScrollingPreferenceDefault() { return false; }
private: private:
void Populate(); void Populate();
void PopulateOrExchange(ShuttleGui & S); void PopulateOrExchange(ShuttleGui & S);

View File

@ -82,6 +82,7 @@ array of Ruler::Label.
#include "../Prefs.h" #include "../Prefs.h"
#include "../Snap.h" #include "../Snap.h"
#include "../tracks/ui/Scrubbing.h" #include "../tracks/ui/Scrubbing.h"
#include "../prefs/TracksPrefs.h"
//#define SCRUB_ABOVE //#define SCRUB_ABOVE
#define RULER_DOUBLE_CLICK #define RULER_DOUBLE_CLICK
@ -2044,7 +2045,8 @@ void AdornedRulerPanel::UpdatePrefs()
#ifdef EXPERIMENTAL_TWO_TONE_TIME_RULER #ifdef EXPERIMENTAL_TWO_TONE_TIME_RULER
{ {
bool scrollBeyondZero = false; bool scrollBeyondZero = false;
gPrefs->Read(wxT("/GUI/ScrollBeyondZero"), &scrollBeyondZero, false); gPrefs->Read(TracksPrefs::ScrollingPreferenceKey(), &scrollBeyondZero,
TracksPrefs::ScrollingPreferenceDefault());
mRuler.SetTwoTone(scrollBeyondZero); mRuler.SetTwoTone(scrollBeyondZero);
} }
#endif #endif