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

The top-level handle to an Audacity project. It serves as a source of events that other objects can bind to, and a container of associated sub-objects that it treats opaquely. It stores a filename and a status message and a few other things. There is very little in this class, most of the intelligence residing in the cooperating attached objects. More...

#include <Project.h>

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

Classes

struct  CreateToken
 

Public Types

using AttachedObjects = ::AttachedProjectObjects
 
- Public Types inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
using DataType = ClientData
 
using DataPointer = Pointer< ClientData >
 
using DataFactory = std::function< DataPointer(Host &) >
 Type of function from which RegisteredFactory is constructed; it builds attachments. More...
 

Public Member Functions

 AudacityProject (CreateToken)
 Don't use this constructor directly. More...
 
virtual ~AudacityProject ()
 
int GetProjectNumber ()
 
const wxString & GetProjectName () const
 
void SetProjectName (const wxString &name)
 
FilePath GetInitialImportPath () const
 
void SetInitialImportPath (const FilePath &path)
 
- Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
 ~Site ()
 
 Site ()
 
 Site (const Site &other)
 
Siteoperator= (const Site &other)
 
 Site (Site &&other)
 
Siteoperator= (Site &&other)
 
size_t size () const
 How many attachment pointers are in the Site. More...
 
template<typename Subclass = ClientData>
Subclass & Get (const RegisteredFactory &key)
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = const ClientData>
auto Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = ClientData>
Subclass * Find (const RegisteredFactory &key)
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename Subclass = const ClientData>
auto Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename ReplacementPointer >
void Assign (const RegisteredFactory &key, ReplacementPointer &&replacement)
 Reassign Site's pointer to ClientData. More...
 

Static Public Member Functions

static std::shared_ptr< AudacityProjectCreate ()
 Use this factory function. More...
 
- Static Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
static size_t numFactories ()
 How many static factories have been registered with this specialization of Site. More...
 

Public Attributes

bool mbBusyImporting { false }
 
int mBatchMode { 0 }
 

Private Attributes

wxString mName
 
int mProjectNo
 
FilePath mInitialImportPath
 

Static Private Attributes

static int mProjectCounter =0
 

Additional Inherited Members

- Protected Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
template<typename Function >
void ForEach (const Function &function)
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForEach (const Function &function) const
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForCorresponding (Site &other, const Function &function, bool create=true)
 
template<typename Function >
ClientData * FindIf (const Function &function)
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
const ClientData * FindIf (const Function &function) const
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
void EraseIf (const Function &function)
 Erase attached objects satisfying a predicate. More...
 
void BuildAll ()
 For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it. More...
 

Detailed Description

The top-level handle to an Audacity project. It serves as a source of events that other objects can bind to, and a container of associated sub-objects that it treats opaquely. It stores a filename and a status message and a few other things. There is very little in this class, most of the intelligence residing in the cooperating attached objects.

Definition at line 86 of file Project.h.

Member Typedef Documentation

◆ AttachedObjects

Definition at line 93 of file Project.h.

Constructor & Destructor Documentation

◆ AudacityProject()

AudacityProject::AudacityProject ( CreateToken  )

Don't use this constructor directly.

Definition at line 91 of file Project.cpp.

92{
93 mProjectNo = mProjectCounter++; // Bug 322
94}
static int mProjectCounter
Definition: Project.h:124

References mProjectCounter, and mProjectNo.

◆ ~AudacityProject()

AudacityProject::~AudacityProject ( )
virtual

Definition at line 96 of file Project.cpp.

97{
98}

Member Function Documentation

◆ Create()

std::shared_ptr< AudacityProject > AudacityProject::Create ( )
static

Use this factory function.

Definition at line 78 of file Project.cpp.

79{
80 // Must complete make_shared before using shared_from_this() or
81 // weak_from_this()
82 auto result = std::make_shared<AudacityProject>(CreateToken{});
83 // Only now build the attached objects, which also causes the project window
84 // to be built on demand
85 result->AttachedObjects::BuildAll();
86 // But not for all the attached windows. They get built on demand only
87 // later.
88 return result;
89}

Referenced by ProjectManager::New(), and TEST_CASE().

Here is the caller graph for this function:

◆ GetInitialImportPath()

FilePath AudacityProject::GetInitialImportPath ( ) const

Definition at line 110 of file Project.cpp.

111{
112 return mInitialImportPath;
113}
FilePath mInitialImportPath
Definition: Project.h:127

References mInitialImportPath.

◆ GetProjectName()

const wxString & AudacityProject::GetProjectName ( ) const

Definition at line 100 of file Project.cpp.

101{
102 return mName;
103}
wxString mName
Definition: Project.h:122

References mName.

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), and MixerBoardFrame::SetWindowTitle().

Here is the caller graph for this function:

◆ GetProjectNumber()

int AudacityProject::GetProjectNumber ( )
inline

Definition at line 101 of file Project.h.

101{ return mProjectNo;}

◆ SetInitialImportPath()

void AudacityProject::SetInitialImportPath ( const FilePath path)

Definition at line 115 of file Project.cpp.

116{
117 if (mInitialImportPath.empty())
118 {
119 mInitialImportPath = path;
120 }
121}

References mInitialImportPath.

◆ SetProjectName()

void AudacityProject::SetProjectName ( const wxString &  name)

Definition at line 105 of file Project.cpp.

106{
107 mName = name;
108}
const TranslatableString name
Definition: Distortion.cpp:76

References mName, and name.

Member Data Documentation

◆ mBatchMode

int AudacityProject::mBatchMode { 0 }

Definition at line 131 of file Project.h.

◆ mbBusyImporting

bool AudacityProject::mbBusyImporting { false }

Definition at line 130 of file Project.h.

Referenced by Importer::Import().

◆ mInitialImportPath

FilePath AudacityProject::mInitialImportPath
private

Definition at line 127 of file Project.h.

Referenced by GetInitialImportPath(), and SetInitialImportPath().

◆ mName

wxString AudacityProject::mName
private

Definition at line 122 of file Project.h.

Referenced by GetProjectName(), and SetProjectName().

◆ mProjectCounter

int AudacityProject::mProjectCounter =0
staticprivate

Definition at line 124 of file Project.h.

Referenced by AudacityProject().

◆ mProjectNo

int AudacityProject::mProjectNo
private

Definition at line 125 of file Project.h.

Referenced by AudacityProject().


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