Audacity 3.2.0
ProjectSettings.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5ProjectSettings.h
6
7Paul Licameli split from AudacityProject.h
8
9**********************************************************************/
10
11#ifndef __AUDACITY_PROJECT_SETTINGS__
12#define __AUDACITY_PROJECT_SETTINGS__
13
14#include <atomic>
15#include <wx/event.h> // to declare custom event type
16
17#include "ClientData.h" // to inherit
18#include "Prefs.h" // to inherit
19#include "audacity/Types.h"
20
21class AudacityProject;
22
23// Sent to the project when certain settings change
24// See enum EventCode below for values of GetInt() identifying changed setting
25// The previous value of that setting can also be found using GetExtraLong()
26wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API,
27 EVT_PROJECT_SETTINGS_CHANGE, wxCommandEvent);
28
29enum
30{
34};
35
36namespace ToolCodes {
37enum {
38 // The buttons that are in the Tools toolbar must be in correspondence
39 // with the first few
44
45#ifdef EXPERIMENTAL_BRUSH_TOOL
46 brushTool,
47#endif
48
51};
52}
53
56class AUDACITY_DLL_API ProjectSettings final
57 : public ClientData::Base
58 , private PrefsListener
59{
60public:
61 static ProjectSettings &Get( AudacityProject &project );
62 static const ProjectSettings &Get( const AudacityProject &project );
63
64 // Values retrievable from GetInt() of the event for settings change
65 enum EventCode : int {
68 };
69
70 explicit ProjectSettings( AudacityProject &project );
71 ProjectSettings( const ProjectSettings & ) PROHIBITED;
73
74
75 bool GetTracksFitVerticallyZoomed() const { return mTracksFitVerticallyZoomed; } //lda
76 void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
77
78 bool GetShowId3Dialog() const { return mShowId3Dialog; } //lda
79 void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
80
81 bool IsSyncLocked() const;
82 void SetSyncLock(bool flag);
83
84 // Snap To
85
86 void SetSnapTo(int snap);
87 int GetSnapTo() const;
88
89 // Current tool
90
91 void SetTool(int tool);
92 int GetTool() const { return mCurrentTool; }
93
94 // Current brush radius
95 void SetBrushRadius(int brushRadius) { mCurrentBrushRadius = brushRadius; }
96 int GetBrushRadius() const { return mCurrentBrushRadius; }
97
98 void SetSmartSelection(bool isSelected) { mbSmartSelection = isSelected; }
99 bool IsSmartSelection() const { return mbSmartSelection; }
100
101 void SetOvertones(bool isSelected) { mbOvertones = isSelected; }
102 bool IsOvertones() const { return mbOvertones; }
103
104 // Selection Format
105 void SetSelectionFormat(const NumericFormatSymbol & format);
106 const NumericFormatSymbol & GetSelectionFormat() const;
107
108 // AudioTime format
109 void SetAudioTimeFormat(const NumericFormatSymbol & format);
110 const NumericFormatSymbol & GetAudioTimeFormat() const;
111
112 // Spectral Selection Formats
113 void SetFrequencySelectionFormatName(const NumericFormatSymbol & format);
114 const NumericFormatSymbol & GetFrequencySelectionFormatName() const;
115
116 void SetBandwidthSelectionFormatName(const NumericFormatSymbol & format);
117 const NumericFormatSymbol & GetBandwidthSelectionFormatName() const;
118
119 bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
120 bool IsSoloNone() const { return mSoloPref == wxT("None"); }
121
122 bool EmptyCanBeDirty() const { return mEmptyCanBeDirty; }
123
124 bool GetShowSplashScreen() const { return mShowSplashScreen; }
125
126private:
127 void UpdatePrefs() override;
128
130
135
136 wxString mSoloPref;
137
139
143 bool mbSmartSelection { false };
144 bool mbOvertones { false };
145
146 bool mTracksFitVerticallyZoomed{ false }; //lda
147 bool mShowId3Dialog{ true }; //lda
148 bool mIsSyncLocked{ false };
151};
152
153#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
int format
Definition: ExportPCM.cpp:56
wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_PROJECT_SETTINGS_CHANGE, wxCommandEvent)
@ SNAP_NEAREST
@ SNAP_PRIOR
@ SNAP_OFF
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A listener notified of changes in preferences.
Definition: Prefs.h:474
Holds various per-project settings values, and sends events to the project when certain values change...
bool IsOvertones() const
bool EmptyCanBeDirty() const
NumericFormatSymbol mBandwidthSelectionFormatName
bool GetShowId3Dialog() const
bool IsSoloNone() const
AudacityProject & mProject
int GetBrushRadius() const
ProjectSettings(const ProjectSettings &) PROHIBITED
bool IsSoloSimple() const
void SetSmartSelection(bool isSelected)
bool GetTracksFitVerticallyZoomed() const
void SetBrushRadius(int brushRadius)
void SetOvertones(bool isSelected)
NumericFormatSymbol mAudioTimeFormat
NumericFormatSymbol mSelectionFormat
void SetTracksFitVerticallyZoomed(bool flag)
ProjectSettings & operator=(const ProjectSettings &) PROHIBITED
void SetShowId3Dialog(bool flag)
bool GetShowSplashScreen() const
bool IsSmartSelection() const
int GetTool() const
NumericFormatSymbol mFrequencySelectionFormatName
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
AUDACITY_DLL_API void UpdatePrefs(wxWindow *pParent)
void SetTool(AudacityProject &project, int tool)
Called by handlers that set tools.
A convenient default parameter for class template Site.
Definition: ClientData.h:28