Audacity 3.2.0
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 Member Functions

 ProjectSettings (AudacityProject &project)
 
 ProjectSettings (const ProjectSettings &)=delete
 
ProjectSettingsoperator= (const ProjectSettings &)=delete
 
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
 
bool GetShowSplashScreen () const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- Public Member Functions inherited from Observer::Publisher< ProjectSettingsEvent >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

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
 
int mCurrentTool
 
int mCurrentBrushRadius
 
int mCurrentBrushHop
 
bool mbSmartSelection { false }
 
bool mbOvertones { false }
 
bool mShowSplashScreen
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< ProjectSettingsEvent >
using message_type = ProjectSettingsEvent
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const ProjectSettingsEvent &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Attributes inherited from Observer::Publisher< ProjectSettingsEvent >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from Observer::Publisher< ProjectSettingsEvent >
CallbackReturn Publish (const ProjectSettingsEvent &message)
 Send a message to connected callbacks. More...
 
- 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 52 of file ProjectSettings.h.

Constructor & Destructor Documentation

◆ ProjectSettings() [1/2]

ProjectSettings::ProjectSettings ( AudacityProject project)
explicit

Definition at line 39 of file ProjectSettings.cpp.

40 : mProject{ project }
42{
43 bool multiToolActive = false;
44 gPrefs->Read(wxT("/GUI/ToolBars/Tools/MultiToolActive"), &multiToolActive);
45
46 if (multiToolActive)
48 else
50
52}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
const auto project
AudacityProject & mProject
void UpdatePrefs() override
virtual bool Read(const wxString &key, bool *value) const =0

References gPrefs, mCurrentTool, ToolCodes::multiTool, audacity::BasicSettings::Read(), ToolCodes::selectTool, UpdatePrefs(), and wxT().

Here is the call graph for this function:

◆ ProjectSettings() [2/2]

ProjectSettings::ProjectSettings ( const ProjectSettings )
delete

Member Function Documentation

◆ Get() [1/2]

ProjectSettings & ProjectSettings::Get ( AudacityProject project)
static

◆ Get() [2/2]

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

Definition at line 34 of file ProjectSettings.cpp.

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

References Get(), and project.

Here is the call graph for this function:

◆ GetBrushRadius()

int ProjectSettings::GetBrushRadius ( ) const
inline

Definition at line 72 of file ProjectSettings.h.

72{ return mCurrentBrushRadius; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ GetShowSplashScreen()

bool ProjectSettings::GetShowSplashScreen ( ) const
inline

Definition at line 80 of file ProjectSettings.h.

80{ return mShowSplashScreen; }

Referenced by AudacityApp::InitPart2().

Here is the caller graph for this function:

◆ GetTool()

int ProjectSettings::GetTool ( ) const
inline

Definition at line 68 of file ProjectSettings.h.

68{ return mCurrentTool; }

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

Here is the caller graph for this function:

◆ IsOvertones()

bool ProjectSettings::IsOvertones ( ) const
inline

Definition at line 78 of file ProjectSettings.h.

78{ return mbOvertones; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ IsSmartSelection()

bool ProjectSettings::IsSmartSelection ( ) const
inline

Definition at line 75 of file ProjectSettings.h.

75{ return mbSmartSelection; }

Referenced by BrushHandle::BrushHandle().

Here is the caller graph for this function:

◆ operator=()

ProjectSettings & ProjectSettings::operator= ( const ProjectSettings )
delete

◆ SetBrushRadius()

void ProjectSettings::SetBrushRadius ( int  brushRadius)
inline

Definition at line 71 of file ProjectSettings.h.

71{ mCurrentBrushRadius = brushRadius; }

◆ SetOvertones()

void ProjectSettings::SetOvertones ( bool  isSelected)
inline

Definition at line 77 of file ProjectSettings.h.

77{ mbOvertones = isSelected; }

◆ SetSmartSelection()

void ProjectSettings::SetSmartSelection ( bool  isSelected)
inline

Definition at line 74 of file ProjectSettings.h.

74{ mbSmartSelection = isSelected; }

◆ SetTool()

void ProjectSettings::SetTool ( int  tool)

Definition at line 75 of file ProjectSettings.cpp.

75 {
76 if (auto oldValue = mCurrentTool; tool != oldValue) {
77 mCurrentTool = tool;
78 Publish({ ProjectSettingsEvent::ChangedTool, oldValue, tool });
79 }
80}
CallbackReturn Publish(const ProjectSettingsEvent &message)
Send a message to connected callbacks.
Definition: Observer.h:207

References ProjectSettingsEvent::ChangedTool, mCurrentTool, and Observer::Publisher< ProjectSettingsEvent >::Publish().

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:

◆ UpdatePrefs()

void ProjectSettings::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

Definition at line 54 of file ProjectSettings.cpp.

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}
static SelectionBar & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314

References TrackList::Get(), SelectionBar::Get(), gPrefs, mShowSplashScreen, audacity::BasicSettings::Read(), and wxT().

Referenced by ProjectSettings().

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

Member Data Documentation

◆ mbOvertones

bool ProjectSettings::mbOvertones { false }
private

Definition at line 91 of file ProjectSettings.h.

◆ mbSmartSelection

bool ProjectSettings::mbSmartSelection { false }
private

Definition at line 90 of file ProjectSettings.h.

◆ mCurrentBrushHop

int ProjectSettings::mCurrentBrushHop
private

Definition at line 89 of file ProjectSettings.h.

◆ mCurrentBrushRadius

int ProjectSettings::mCurrentBrushRadius
private

Definition at line 88 of file ProjectSettings.h.

◆ mCurrentTool

int ProjectSettings::mCurrentTool
private

Definition at line 87 of file ProjectSettings.h.

Referenced by ProjectSettings(), and SetTool().

◆ mProject

AudacityProject& ProjectSettings::mProject
private

Definition at line 85 of file ProjectSettings.h.

◆ mShowSplashScreen

bool ProjectSettings::mShowSplashScreen
private

Definition at line 93 of file ProjectSettings.h.

Referenced by UpdatePrefs().


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