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 {
67 };
68
69 explicit ProjectSettings( AudacityProject &project );
70 ProjectSettings( const ProjectSettings & ) PROHIBITED;
72
73
74 bool GetTracksFitVerticallyZoomed() const { return mTracksFitVerticallyZoomed; } //lda
75 void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
76
77 bool GetShowId3Dialog() const { return mShowId3Dialog; } //lda
78 void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
79
80 // Snap To
81
82 void SetSnapTo(int snap);
83 int GetSnapTo() const;
84
85 // Current tool
86
87 void SetTool(int tool);
88 int GetTool() const { return mCurrentTool; }
89
90 // Current brush radius
91 void SetBrushRadius(int brushRadius) { mCurrentBrushRadius = brushRadius; }
92 int GetBrushRadius() const { return mCurrentBrushRadius; }
93
94 void SetSmartSelection(bool isSelected) { mbSmartSelection = isSelected; }
95 bool IsSmartSelection() const { return mbSmartSelection; }
96
97 void SetOvertones(bool isSelected) { mbOvertones = isSelected; }
98 bool IsOvertones() const { return mbOvertones; }
99
100 bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
101 bool IsSoloNone() const { return mSoloPref == wxT("None"); }
102
103 bool EmptyCanBeDirty() const { return mEmptyCanBeDirty; }
104
105 bool GetShowSplashScreen() const { return mShowSplashScreen; }
106
107private:
108 void UpdatePrefs() override;
109
111
112 wxString mSoloPref;
113
115
119 bool mbSmartSelection { false };
120 bool mbOvertones { false };
121
122 bool mTracksFitVerticallyZoomed{ false }; //lda
123 bool mShowId3Dialog{ true }; //lda
126};
127
128#endif
wxT("CloseDown"))
Utility ClientData::Site to register hooks into a host class that attach client data.
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:90
A listener notified of changes in preferences.
Definition: Prefs.h:556
Holds various per-project settings values, and sends events to the project when certain values change...
bool IsOvertones() const
bool EmptyCanBeDirty() const
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)
void SetTracksFitVerticallyZoomed(bool flag)
ProjectSettings & operator=(const ProjectSettings &) PROHIBITED
void SetShowId3Dialog(bool flag)
bool GetShowSplashScreen() const
bool IsSmartSelection() const
int GetTool() const
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196
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