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 "Observer.h"
19#include "Prefs.h" // to inherit
20#include "audacity/Types.h"
21
22class AudacityProject;
23
24namespace ToolCodes {
25enum : int {
26 // The buttons that are in the Tools toolbar must be in correspondence
27 // with the first few
32
33#ifdef EXPERIMENTAL_BRUSH_TOOL
34 brushTool,
35#endif
36
39};
40}
41
43 const enum Type : int {
46 const int oldValue;
47 const int newValue;
48};
49
52class AUDACITY_DLL_API ProjectSettings final
53 : public ClientData::Base
54 , public Observer::Publisher<ProjectSettingsEvent>
55 , private PrefsListener
56{
57public:
59 static const ProjectSettings &Get( const AudacityProject &project );
60
62 ProjectSettings( const ProjectSettings & ) = delete;
64
65 // Current tool
66
67 void SetTool(int tool);
68 int GetTool() const { return mCurrentTool; }
69
70 // Current brush radius
71 void SetBrushRadius(int brushRadius) { mCurrentBrushRadius = brushRadius; }
72 int GetBrushRadius() const { return mCurrentBrushRadius; }
73
74 void SetSmartSelection(bool isSelected) { mbSmartSelection = isSelected; }
75 bool IsSmartSelection() const { return mbSmartSelection; }
76
77 void SetOvertones(bool isSelected) { mbOvertones = isSelected; }
78 bool IsOvertones() const { return mbOvertones; }
79
80 bool GetShowSplashScreen() const { return mShowSplashScreen; }
81
82private:
83 void UpdatePrefs() override;
84
86
90 bool mbSmartSelection { false };
91 bool mbOvertones { false };
92
94};
95
96#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
An object that sends messages to an open-ended list of subscribed callbacks.
Definition: Observer.h:108
A listener notified of changes in preferences.
Definition: Prefs.h:652
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:154
Holds various per-project settings values, and sends events to the project when certain values change...
bool IsOvertones() const
AudacityProject & mProject
int GetBrushRadius() const
void SetSmartSelection(bool isSelected)
void SetBrushRadius(int brushRadius)
void SetOvertones(bool isSelected)
ProjectSettings(const ProjectSettings &)=delete
ProjectSettings & operator=(const ProjectSettings &)=delete
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:202
void SetTool(AudacityProject &project, int tool)
Called by handlers that set tools.
A convenient default parameter for class template Site.
Definition: ClientData.h:29
enum ProjectSettingsEvent::Type type