Audacity 3.2.0
ProjectSettings.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5ProjectSettings.cpp
6
7Paul Licameli split from AudacityProject.cpp
8
9**********************************************************************/
10
11#include "ProjectSettings.h"
12
13
14
15#include "AudioIOBase.h"
16#include "Project.h"
17#include "QualitySettings.h"
19
23 auto result = std::make_shared< ProjectSettings >( project );
24 return result;
25 }
26};
27
29{
30 return project.AttachedObjects::Get< ProjectSettings >(
32}
33
35{
36 return Get( const_cast< AudacityProject & >( project ) );
37}
38
40 : mProject{ project }
41 , mCurrentBrushRadius ( 5 )
42{
43 bool multiToolActive = false;
44 gPrefs->Read(wxT("/GUI/ToolBars/Tools/MultiToolActive"), &multiToolActive);
45
46 if (multiToolActive)
48 else
50
52}
53
55{
56 gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true);
57 gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &mShowSplashScreen, true);
58 // gPrefs->Read(wxT("/GUI/UpdateSpectrogram"),
59 // &mViewInfo.bUpdateSpectrogram, true);
60
61 // This code to change an empty projects rate is currently disabled, after
62 // discussion. The rule 'Default sample rate' only affects newly created
63 // projects was felt to be simpler and better.
64#if 0
65 // The DefaultProjectSample rate is the rate for new projects.
66 // Do not change this project's rate, unless there are no tracks.
67 if( TrackList::Get( *this ).size() == 0){
68 mRate = QualityDefaultSampleRate.Read();
69 // If necessary, we change this rate in the selection toolbar too.
70 auto bar = SelectionBar::Get( *this );
71 bar.SetRate( mRate );
72 }
73#endif
74}
75
77 if (auto oldValue = mCurrentTool; tool != oldValue) {
78 mCurrentTool = tool;
79 Publish({ ProjectSettingsEvent::ChangedTool, oldValue, tool });
80 }
81}
82
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
static const AudacityProject::AttachedObjects::RegisteredFactory sProjectSettingsKey
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
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Definition: ClientData.h:275
CallbackReturn Publish(const ProjectSettingsEvent &message)
Send a message to connected callbacks.
Definition: Observer.h:207
Holds various per-project settings values, and sends events to the project when certain values change...
void SetTool(int tool)
static ProjectSettings & Get(AudacityProject &project)
ProjectSettings(AudacityProject &project)
void UpdatePrefs() override
static SelectionBar & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
virtual bool Read(const wxString &key, bool *value) const =0