Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProjectSettings Class Referencefinal

Holds various per-project settings values, and sends events to the project when certain values change. More...

#include <ProjectSettings.h>

Inheritance diagram for ProjectSettings:
[legend]
Collaboration diagram for ProjectSettings:
[legend]

Public Types

enum  EventCode : int { ChangedSyncLock , ChangedTool }
 

Public Member Functions

 ProjectSettings (AudacityProject &project)
 
 ProjectSettings (const ProjectSettings &) PROHIBITED
 
ProjectSettingsoperator= (const ProjectSettings &) PROHIBITED
 
bool GetTracksFitVerticallyZoomed () const
 
void SetTracksFitVerticallyZoomed (bool flag)
 
bool GetShowId3Dialog () const
 
void SetShowId3Dialog (bool flag)
 
bool IsSyncLocked () const
 
void SetSyncLock (bool flag)
 
void SetSnapTo (int snap)
 
int GetSnapTo () const
 
void SetTool (int tool)
 
int GetTool () const
 
void SetBrushRadius (int brushRadius)
 
int GetBrushRadius () const
 
void SetSmartSelection (bool isSelected)
 
bool IsSmartSelection () const
 
void SetOvertones (bool isSelected)
 
bool IsOvertones () const
 
void SetSelectionFormat (const NumericFormatSymbol &format)
 
const NumericFormatSymbolGetSelectionFormat () const
 
void SetAudioTimeFormat (const NumericFormatSymbol &format)
 
const NumericFormatSymbolGetAudioTimeFormat () const
 
void SetFrequencySelectionFormatName (const NumericFormatSymbol &format)
 
const NumericFormatSymbolGetFrequencySelectionFormatName () const
 
void SetBandwidthSelectionFormatName (const NumericFormatSymbol &format)
 
const NumericFormatSymbolGetBandwidthSelectionFormatName () const
 
bool IsSoloSimple () const
 
bool IsSoloNone () const
 
bool EmptyCanBeDirty () const
 
bool GetShowSplashScreen () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ProjectSettingsGet (AudacityProject &project)
 
static const ProjectSettingsGet (const AudacityProject &project)
 

Private Member Functions

void UpdatePrefs () override
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

AudacityProjectmProject
 
NumericFormatSymbol mSelectionFormat
 
NumericFormatSymbol mFrequencySelectionFormatName
 
NumericFormatSymbol mBandwidthSelectionFormatName
 
NumericFormatSymbol mAudioTimeFormat
 
wxString mSoloPref
 
int mSnapTo
 
int mCurrentTool
 
int mCurrentBrushRadius
 
int mCurrentBrushHop
 
bool mbSmartSelection { false }
 
bool mbOvertones { false }
 
bool mTracksFitVerticallyZoomed { false }
 
bool mShowId3Dialog { true }
 
bool mIsSyncLocked { false }
 
bool mEmptyCanBeDirty
 
bool mShowSplashScreen
 

Additional Inherited Members

- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Holds various per-project settings values, and sends events to the project when certain values change.

Definition at line 56 of file ProjectSettings.h.

Member Enumeration Documentation

◆ EventCode

Enumerator
ChangedSyncLock 
ChangedTool 

Definition at line 65 of file ProjectSettings.h.

65 : int {
68 };

Constructor & Destructor Documentation

◆ ProjectSettings() [1/2]

ProjectSettings::ProjectSettings ( AudacityProject project)
explicit

Definition at line 56 of file ProjectSettings.cpp.

57 : mProject{ project }
60 gPrefs->Read(wxT("/SelectionFormat"), wxT("")))
61}
64 gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT("")) )
65}
68 gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) )
69}
72 gPrefs->Read(wxT("/AudioTimeFormat"), wxT("hh:mm:ss")))
73}
74, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
76{
77 gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
78
79 bool multiToolActive = false;
80 gPrefs->Read(wxT("/GUI/ToolBars/Tools/MultiToolActive"), &multiToolActive);
81
82 if (multiToolActive)
84 else
86
88}
wxT("CloseDown"))
FileConfig * gPrefs
Definition: Prefs.cpp:71
@ SNAP_OFF
static NumericFormatSymbol LookupFormat(Type type, const wxString &id)
NumericFormatSymbol mBandwidthSelectionFormatName
AudacityProject & mProject
NumericFormatSymbol mAudioTimeFormat
NumericFormatSymbol mSelectionFormat
void UpdatePrefs() override
NumericFormatSymbol mFrequencySelectionFormatName

References gPrefs, mCurrentTool, mIsSyncLocked, ToolCodes::multiTool, ToolCodes::selectTool, UpdatePrefs(), and wxT().

Here is the call graph for this function:

◆ ProjectSettings() [2/2]

ProjectSettings::ProjectSettings ( const ProjectSettings )

Member Function Documentation

◆ EmptyCanBeDirty()

bool ProjectSettings::EmptyCanBeDirty ( ) const
inline

Definition at line 122 of file ProjectSettings.h.

122{ return mEmptyCanBeDirty; }

◆ Get() [1/2]

ProjectSettings & ProjectSettings::Get ( AudacityProject project)
static

Definition at line 45 of file ProjectSettings.cpp.

46{
47 return project.AttachedObjects::Get< ProjectSettings >(
49}
static const AudacityProject::AttachedObjects::RegisteredFactory sProjectSettingsKey
Holds various per-project settings values, and sends events to the project when certain values change...

References sProjectSettingsKey.

Referenced by MacroCommands::ApplyCommandInBatchMode(), ProjectSelectionManager::AS_GetSelectionFormat(), ProjectSelectionManager::AS_GetSnapTo(), ProjectSelectionManager::AS_SetSelectionFormat(), ProjectSelectionManager::AS_SetSnapTo(), BrushHandleHitTest(), SelectHandle::Click(), TimeShiftHandle::Click(), anonymous_namespace{ClipMenus.cpp}::DoClipLeftOrRight(), LabelTrackView::DoEditLabels(), Exporter::DoEditMetadata(), SelectUtilities::DoListSelection(), ProjectAudioManager::DoRecord(), ProjectFileManager::DoSave(), ToolsToolBar::DoToolChanged(), TrackUtilities::DoTrackMute(), TrackUtilities::DoTrackSolo(), TrackPanel::DrawTracks(), anonymous_namespace{LabelMenus.cpp}::EditByLabel(), anonymous_namespace{LabelMenus.cpp}::EditClipboardByLabel(), ExportMultipleDialog::ExportMultipleByLabel(), ExportMultipleDialog::ExportMultipleByTrack(), Get(), Effect::GetSelectionFormat(), anonymous_namespace{SelectMenus.cpp}::GridMove(), MixerTrackCluster::HandleResize(), CommonTrackView::HitTest(), NoteTrackAffordanceControls::HitTest(), WaveTrackAffordanceControls::HitTest(), MuteButtonHandle::HitTest(), SoloButtonHandle::HitTest(), AUPImportFileHandle::Import(), ExportFFmpeg::InitCodecs(), AudacityApp::InitPart2(), IsNotSyncLockedFlag(), IsSyncLockedFlag(), SyncLock::IsSyncLockSelected(), MenuManager::ModifyToolbarMenus(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), TrackActions::Handler::MuteTracks(), MixerTrackCluster::OnButton_Mute(), ProjectManager::OnCloseWindow(), ToolActions::Handler::OnNextTool(), EditActions::Handler::OnPaste(), ToolActions::Handler::OnPrevTool(), SelectUtilities::OnSetRegion(), TransportActions::Handler::OnTimerRecord(), ToolsToolBar::OnTool(), ViewActions::Handler::OnUndoPushed(), ProjectFileManager::OpenProjectFile(), TimeToolBar::Populate(), SelectHandle::Preview(), Exporter::Process(), EffectTruncSilence::ProcessIndependently(), SnapManager::Reinit(), StretchHandle::Release(), anonymous_namespace{SelectMenus.cpp}::SeekWhenAudioInactive(), NoteTrackAffordanceHandle::SelectAt(), Exporter::SetAutoExportOptions(), anonymous_namespace{ToolsToolBar.cpp}::SetTool(), SnapManager::Snap(), ProjectSelectionManager::SnapSelection(), ProjectSelectionManager::SSBL_GetBandwidthSelectionFormatName(), ProjectSelectionManager::SSBL_GetFrequencySelectionFormatName(), ProjectSelectionManager::SSBL_SetBandwidthSelectionFormatName(), ProjectSelectionManager::SSBL_SetFrequencySelectionFormatName(), ProjectSelectionManager::TT_GetAudioTimeFormat(), and ProjectSelectionManager::TT_SetAudioTimeFormat().

◆ Get() [2/2]

const ProjectSettings & ProjectSettings::Get ( const AudacityProject project)
static

Definition at line 51 of file ProjectSettings.cpp.

52{
53 return Get( const_cast< AudacityProject & >( project ) );
54}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static ProjectSettings & Get(AudacityProject &project)

References Get().

Here is the call graph for this function:

◆ GetAudioTimeFormat()

const NumericFormatSymbol & ProjectSettings::GetAudioTimeFormat ( ) const

Definition at line 158 of file ProjectSettings.cpp.

159{
160 return mAudioTimeFormat;
161}

References mAudioTimeFormat.

◆ GetBandwidthSelectionFormatName()

const NumericFormatSymbol & ProjectSettings::GetBandwidthSelectionFormatName ( ) const

Definition at line 132 of file ProjectSettings.cpp.

133{
135}

References mBandwidthSelectionFormatName.

◆ GetBrushRadius()

int ProjectSettings::GetBrushRadius ( ) const
inline

Definition at line 96 of file ProjectSettings.h.

96{ return mCurrentBrushRadius; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ GetFrequencySelectionFormatName()

const NumericFormatSymbol & ProjectSettings::GetFrequencySelectionFormatName ( ) const

Definition at line 120 of file ProjectSettings.cpp.

121{
123}

References mFrequencySelectionFormatName.

◆ GetSelectionFormat()

const NumericFormatSymbol & ProjectSettings::GetSelectionFormat ( ) const

Definition at line 148 of file ProjectSettings.cpp.

149{
150 return mSelectionFormat;
151}

References mSelectionFormat.

Referenced by Effect::GetSelectionFormat().

Here is the caller graph for this function:

◆ GetShowId3Dialog()

bool ProjectSettings::GetShowId3Dialog ( ) const
inline

Definition at line 78 of file ProjectSettings.h.

78{ return mShowId3Dialog; } //lda

Referenced by Exporter::Process(), and Exporter::SetAutoExportOptions().

Here is the caller graph for this function:

◆ GetShowSplashScreen()

bool ProjectSettings::GetShowSplashScreen ( ) const
inline

Definition at line 124 of file ProjectSettings.h.

124{ return mShowSplashScreen; }

Referenced by AudacityApp::InitPart2().

Here is the caller graph for this function:

◆ GetSnapTo()

int ProjectSettings::GetSnapTo ( ) const

Definition at line 168 of file ProjectSettings.cpp.

169{
170 return mSnapTo;
171}

References mSnapTo.

Referenced by SnapManager::Snap().

Here is the caller graph for this function:

◆ GetTool()

int ProjectSettings::GetTool ( ) const
inline

Definition at line 92 of file ProjectSettings.h.

92{ return mCurrentTool; }

Referenced by TimeShiftHandle::Click(), and SelectHandle::Preview().

Here is the caller graph for this function:

◆ GetTracksFitVerticallyZoomed()

bool ProjectSettings::GetTracksFitVerticallyZoomed ( ) const
inline

Definition at line 75 of file ProjectSettings.h.

75{ return mTracksFitVerticallyZoomed; } //lda
bool mTracksFitVerticallyZoomed

Referenced by ProjectAudioManager::DoRecord().

Here is the caller graph for this function:

◆ IsOvertones()

bool ProjectSettings::IsOvertones ( ) const
inline

Definition at line 102 of file ProjectSettings.h.

102{ return mbOvertones; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ IsSmartSelection()

bool ProjectSettings::IsSmartSelection ( ) const
inline

Definition at line 99 of file ProjectSettings.h.

99{ return mbSmartSelection; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ IsSoloNone()

bool ProjectSettings::IsSoloNone ( ) const
inline

Definition at line 120 of file ProjectSettings.h.

120{ return mSoloPref == wxT("None"); }

References wxT().

Referenced by MixerTrackCluster::HandleResize(), MuteButtonHandle::HitTest(), and SoloButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSoloSimple()

bool ProjectSettings::IsSoloSimple ( ) const
inline

Definition at line 119 of file ProjectSettings.h.

119{ return mSoloPref == wxT("Simple"); }

References wxT().

Referenced by MixerTrackCluster::OnButton_Mute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSyncLocked()

bool ProjectSettings::IsSyncLocked ( ) const

Definition at line 180 of file ProjectSettings.cpp.

181{
182#ifdef EXPERIMENTAL_SYNC_LOCK
183 return mIsSyncLocked;
184#else
185 return false;
186#endif
187}

References mIsSyncLocked.

Referenced by TimeShiftHandle::Click(), anonymous_namespace{LabelMenus.cpp}::EditByLabel(), anonymous_namespace{LabelMenus.cpp}::EditClipboardByLabel(), IsNotSyncLockedFlag(), IsSyncLockedFlag(), and SyncLock::IsSyncLockSelected().

Here is the caller graph for this function:

◆ operator=()

ProjectSettings & ProjectSettings::operator= ( const ProjectSettings )

◆ SetAudioTimeFormat()

void ProjectSettings::SetAudioTimeFormat ( const NumericFormatSymbol format)

Definition at line 153 of file ProjectSettings.cpp.

154{
156}
int format
Definition: ExportPCM.cpp:56

References format, and mAudioTimeFormat.

◆ SetBandwidthSelectionFormatName()

void ProjectSettings::SetBandwidthSelectionFormatName ( const NumericFormatSymbol format)

Definition at line 137 of file ProjectSettings.cpp.

139{
141}

References mBandwidthSelectionFormatName.

◆ SetBrushRadius()

void ProjectSettings::SetBrushRadius ( int  brushRadius)
inline

Definition at line 95 of file ProjectSettings.h.

95{ mCurrentBrushRadius = brushRadius; }

◆ SetFrequencySelectionFormatName()

void ProjectSettings::SetFrequencySelectionFormatName ( const NumericFormatSymbol format)

Definition at line 125 of file ProjectSettings.cpp.

127{
129}

References mFrequencySelectionFormatName.

◆ SetOvertones()

void ProjectSettings::SetOvertones ( bool  isSelected)
inline

Definition at line 101 of file ProjectSettings.h.

101{ mbOvertones = isSelected; }

◆ SetSelectionFormat()

void ProjectSettings::SetSelectionFormat ( const NumericFormatSymbol format)

Definition at line 143 of file ProjectSettings.cpp.

144{
146}

References format, and mSelectionFormat.

◆ SetShowId3Dialog()

void ProjectSettings::SetShowId3Dialog ( bool  flag)
inline

Definition at line 79 of file ProjectSettings.h.

79{ mShowId3Dialog = flag; } //lda
static std::once_flag flag

References flag.

◆ SetSmartSelection()

void ProjectSettings::SetSmartSelection ( bool  isSelected)
inline

Definition at line 98 of file ProjectSettings.h.

98{ mbSmartSelection = isSelected; }

◆ SetSnapTo()

void ProjectSettings::SetSnapTo ( int  snap)

Definition at line 163 of file ProjectSettings.cpp.

164{
165 mSnapTo = snap;
166}

References mSnapTo.

◆ SetSyncLock()

void ProjectSettings::SetSyncLock ( bool  flag)

Definition at line 189 of file ProjectSettings.cpp.

190{
191 auto &project = mProject;
192 if (auto oldValue = mIsSyncLocked; flag != oldValue) {
194 Notify( project, ChangedSyncLock, oldValue );
195 }
196}
void Notify(AudacityProject &project, ProjectSettings::EventCode code, long previousValue)

References ChangedSyncLock, flag, mIsSyncLocked, mProject, and anonymous_namespace{ProjectSettings.cpp}::Notify().

Here is the call graph for this function:

◆ SetTool()

void ProjectSettings::SetTool ( int  tool)

Definition at line 173 of file ProjectSettings.cpp.

173 {
174 if (auto oldValue = mCurrentTool; oldValue != tool) {
175 mCurrentTool = tool;
176 Notify( mProject, ChangedTool, oldValue );
177 }
178}

References ChangedTool, mCurrentTool, mProject, and anonymous_namespace{ProjectSettings.cpp}::Notify().

Referenced by ToolsToolBar::OnTool(), and anonymous_namespace{ToolsToolBar.cpp}::SetTool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTracksFitVerticallyZoomed()

void ProjectSettings::SetTracksFitVerticallyZoomed ( bool  flag)
inline

Definition at line 76 of file ProjectSettings.h.

References flag.

◆ UpdatePrefs()

void ProjectSettings::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

Definition at line 90 of file ProjectSettings.cpp.

91{
92 gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
93 gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true);
94 gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &mShowSplashScreen, true);
96 // Update the old default to the NEW default.
97 if (mSoloPref == wxT("Standard"))
98 mSoloPref = wxT("Simple");
99 gPrefs->Read(wxT("/GUI/TracksFitVerticallyZoomed"),
101 // gPrefs->Read(wxT("/GUI/UpdateSpectrogram"),
102 // &mViewInfo.bUpdateSpectrogram, true);
103
104 // This code to change an empty projects rate is currently disabled, after
105 // discussion. The rule 'Default sample rate' only affects newly created
106 // projects was felt to be simpler and better.
107#if 0
108 // The DefaultProjectSample rate is the rate for new projects.
109 // Do not change this project's rate, unless there are no tracks.
110 if( TrackList::Get( *this ).size() == 0){
111 mRate = QualityDefaultSampleRate.Read();
112 // If necessary, we change this rate in the selection toolbar too.
113 auto bar = SelectionBar::Get( *this );
114 bar.SetRate( mRate );
115 }
116#endif
117}
ChoiceSetting TracksBehaviorsSolo
wxString Read() const
Definition: Prefs.cpp:354
static SelectionBar & Get(AudacityProject &project)
size_t size() const
Definition: Track.cpp:1014
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486

References TrackList::Get(), SelectionBar::Get(), gPrefs, mEmptyCanBeDirty, mShowId3Dialog, mShowSplashScreen, mSoloPref, mTracksFitVerticallyZoomed, ChoiceSetting::Read(), TrackList::size(), TracksBehaviorsSolo, and wxT().

Referenced by ProjectSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mAudioTimeFormat

NumericFormatSymbol ProjectSettings::mAudioTimeFormat
private

Definition at line 134 of file ProjectSettings.h.

Referenced by GetAudioTimeFormat(), and SetAudioTimeFormat().

◆ mBandwidthSelectionFormatName

NumericFormatSymbol ProjectSettings::mBandwidthSelectionFormatName
private

◆ mbOvertones

bool ProjectSettings::mbOvertones { false }
private

Definition at line 144 of file ProjectSettings.h.

◆ mbSmartSelection

bool ProjectSettings::mbSmartSelection { false }
private

Definition at line 143 of file ProjectSettings.h.

◆ mCurrentBrushHop

int ProjectSettings::mCurrentBrushHop
private

Definition at line 142 of file ProjectSettings.h.

◆ mCurrentBrushRadius

int ProjectSettings::mCurrentBrushRadius
private

Definition at line 141 of file ProjectSettings.h.

◆ mCurrentTool

int ProjectSettings::mCurrentTool
private

Definition at line 140 of file ProjectSettings.h.

Referenced by ProjectSettings(), and SetTool().

◆ mEmptyCanBeDirty

bool ProjectSettings::mEmptyCanBeDirty
private

Definition at line 149 of file ProjectSettings.h.

Referenced by UpdatePrefs().

◆ mFrequencySelectionFormatName

NumericFormatSymbol ProjectSettings::mFrequencySelectionFormatName
private

◆ mIsSyncLocked

bool ProjectSettings::mIsSyncLocked { false }
private

Definition at line 148 of file ProjectSettings.h.

Referenced by IsSyncLocked(), ProjectSettings(), and SetSyncLock().

◆ mProject

AudacityProject& ProjectSettings::mProject
private

Definition at line 129 of file ProjectSettings.h.

Referenced by SetSyncLock(), and SetTool().

◆ mSelectionFormat

NumericFormatSymbol ProjectSettings::mSelectionFormat
private

Definition at line 131 of file ProjectSettings.h.

Referenced by GetSelectionFormat(), and SetSelectionFormat().

◆ mShowId3Dialog

bool ProjectSettings::mShowId3Dialog { true }
private

Definition at line 147 of file ProjectSettings.h.

Referenced by UpdatePrefs().

◆ mShowSplashScreen

bool ProjectSettings::mShowSplashScreen
private

Definition at line 150 of file ProjectSettings.h.

Referenced by UpdatePrefs().

◆ mSnapTo

int ProjectSettings::mSnapTo
private

Definition at line 138 of file ProjectSettings.h.

Referenced by GetSnapTo(), and SetSnapTo().

◆ mSoloPref

wxString ProjectSettings::mSoloPref
private

Definition at line 136 of file ProjectSettings.h.

Referenced by UpdatePrefs().

◆ mTracksFitVerticallyZoomed

bool ProjectSettings::mTracksFitVerticallyZoomed { false }
private

Definition at line 146 of file ProjectSettings.h.

Referenced by UpdatePrefs().


The documentation for this class was generated from the following files: