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/ShowSplashScreen"), &mShowSplashScreen, true);
57 // gPrefs->Read(wxT("/GUI/UpdateSpectrogram"),
58 // &mViewInfo.bUpdateSpectrogram, true);
59
60 // This code to change an empty projects rate is currently disabled, after
61 // discussion. The rule 'Default sample rate' only affects newly created
62 // projects was felt to be simpler and better.
63#if 0
64 // The DefaultProjectSample rate is the rate for new projects.
65 // Do not change this project's rate, unless there are no tracks.
66 if( TrackList::Get( *this ).size() == 0){
67 mRate = QualityDefaultSampleRate.Read();
68 // If necessary, we change this rate in the selection toolbar too.
69 auto bar = SelectionBar::Get( *this );
70 bar.SetRate( mRate );
71 }
72#endif
73}
74
76 if (auto oldValue = mCurrentTool; tool != oldValue) {
77 mCurrentTool = tool;
78 Publish({ ProjectSettingsEvent::ChangedTool, oldValue, tool });
79 }
80}
81
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