Audacity  3.0.3
Public Types | 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]

Public Types

using AttachedObjects = ::AttachedProjectObjects
 
using AttachedWindows = ::AttachedProjectWindows
 
- 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 ()
 
virtual ~AudacityProject ()
 
wxFrame * GetFrame ()
 
const wxFrame * GetFrame () const
 
void SetFrame (wxFrame *pFrame)
 
wxWindow * GetPanel ()
 
const wxWindow * GetPanel () const
 
void SetPanel (wxWindow *pPanel)
 
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 -> typename std::enable_if< std::is_const< Subclass >::value, Subclass & >::type
 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 -> typename std::enable_if< std::is_const< Subclass >::value, Subclass * >::type
 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...
 

Public Attributes

bool mbBusyImporting { false }
 
int mBatchMode { 0 }
 

Private Attributes

wxString mName
 
int mProjectNo
 
FilePath mInitialImportPath
 
wxWeakRef< wxFrame > mFrame {}
 
wxWeakRef< wxWindow > mPanel {}
 

Static Private Attributes

static int mProjectCounter =0
 

Additional Inherited Members

- Static Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
static size_t slots ()
 How many static factories have been registered with this specialization of Site. More...
 
- 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 >
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...
 
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 108 of file Project.h.

Member Typedef Documentation

◆ AttachedObjects

Definition at line 115 of file Project.h.

◆ AttachedWindows

Definition at line 116 of file Project.h.

Constructor & Destructor Documentation

◆ AudacityProject()

AudacityProject::AudacityProject ( )

Definition at line 124 of file Project.cpp.

125 {
126  mProjectNo = mProjectCounter++; // Bug 322
128  // But not for the attached windows. They get built only on demand, such as
129  // from menu items.
130 
131  // Make sure there is plenty of space for Sqlite files
132  wxLongLong freeSpace = 0;
133 
134  auto path = TempDirectory::TempDir();
135  if (wxGetDiskSpace(path, NULL, &freeSpace)) {
136  if (freeSpace < wxLongLong(wxLL(100 * 1048576))) {
137  auto volume = FileNames::AbbreviatePath( path );
138  /* i18n-hint: %s will be replaced by the drive letter (on Windows) */
140  XO("Warning"),
141  XO("There is very little free disk space left on %s\n"
142  "Please select a bigger temporary directory location in\n"
143  "Directories Preferences.").Format( volume ),
144  "Error:_Disk_full_or_not_writable"
145  );
146  }
147  }
148 
149 }

References FileNames::AbbreviatePath(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll(), mProjectCounter, mProjectNo, BasicUI::ShowErrorDialog(), TempDirectory::TempDir(), and XO.

Here is the call graph for this function:

◆ ~AudacityProject()

AudacityProject::~AudacityProject ( )
virtual

Definition at line 151 of file Project.cpp.

152 {
153 }

Member Function Documentation

◆ GetFrame() [1/2]

wxFrame* AudacityProject::GetFrame ( )
inline

Definition at line 121 of file Project.h.

121 { return mFrame; }

References mFrame.

Referenced by GetProjectFrame(), and ProjectFileIO::SetProjectTitle().

Here is the caller graph for this function:

◆ GetFrame() [2/2]

const wxFrame* AudacityProject::GetFrame ( ) const
inline

Definition at line 122 of file Project.h.

122 { return mFrame; }

References mFrame.

◆ GetInitialImportPath()

FilePath AudacityProject::GetInitialImportPath ( ) const

Definition at line 175 of file Project.cpp.

176 {
177  return mInitialImportPath;
178 }

References mInitialImportPath.

◆ GetPanel() [1/2]

wxWindow* AudacityProject::GetPanel ( )
inline

Definition at line 125 of file Project.h.

125 { return mPanel; }

Referenced by GetProjectPanel().

Here is the caller graph for this function:

◆ GetPanel() [2/2]

const wxWindow* AudacityProject::GetPanel ( ) const
inline

Definition at line 126 of file Project.h.

126 { return mPanel; }

◆ GetProjectName()

const wxString & AudacityProject::GetProjectName ( ) const

Definition at line 165 of file Project.cpp.

166 {
167  return mName;
168 }

References mName.

Referenced by anonymous_namespace{FileMenus.cpp}::DoExport(), Exporter::GetFilename(), ExportMultipleDialog::PopulateOrExchange(), MixerBoardFrame::SetWindowTitle(), and TitleRestorer::TitleRestorer().

Here is the caller graph for this function:

◆ GetProjectNumber()

int AudacityProject::GetProjectNumber ( )
inline

Definition at line 129 of file Project.h.

129 { return mProjectNo;}

Referenced by TitleRestorer::TitleRestorer().

Here is the caller graph for this function:

◆ SetFrame()

void AudacityProject::SetFrame ( wxFrame *  pFrame)

Definition at line 155 of file Project.cpp.

156 {
157  mFrame = pFrame;
158 }

References mFrame.

◆ SetInitialImportPath()

void AudacityProject::SetInitialImportPath ( const FilePath path)

Definition at line 180 of file Project.cpp.

181 {
182  if (mInitialImportPath.empty())
183  {
184  mInitialImportPath = path;
185  }
186 }

References mInitialImportPath.

Referenced by DoImportMIDI().

Here is the caller graph for this function:

◆ SetPanel()

void AudacityProject::SetPanel ( wxWindow *  pPanel)

Definition at line 160 of file Project.cpp.

161 {
162  mPanel = pPanel;
163 }

References mPanel.

◆ SetProjectName()

void AudacityProject::SetProjectName ( const wxString &  name)

Definition at line 170 of file Project.cpp.

171 {
172  mName = name;
173 }

References mName, and name.

Referenced by DoImportMIDI().

Here is the caller graph for this function:

Member Data Documentation

◆ mBatchMode

int AudacityProject::mBatchMode { 0 }

◆ mbBusyImporting

bool AudacityProject::mbBusyImporting { false }

Definition at line 158 of file Project.h.

Referenced by Importer::Import().

◆ mFrame

wxWeakRef< wxFrame > AudacityProject::mFrame {}
private

Definition at line 162 of file Project.h.

Referenced by SetFrame().

◆ mInitialImportPath

FilePath AudacityProject::mInitialImportPath
private

Definition at line 155 of file Project.h.

Referenced by GetInitialImportPath(), and SetInitialImportPath().

◆ mName

wxString AudacityProject::mName
private

Definition at line 150 of file Project.h.

Referenced by GetProjectName(), and SetProjectName().

◆ mPanel

wxWeakRef< wxWindow > AudacityProject::mPanel {}
private

Definition at line 163 of file Project.h.

Referenced by SetPanel().

◆ mProjectCounter

int AudacityProject::mProjectCounter =0
staticprivate

Definition at line 152 of file Project.h.

Referenced by AudacityProject().

◆ mProjectNo

int AudacityProject::mProjectNo
private

Definition at line 153 of file Project.h.

Referenced by AudacityProject().


The documentation for this class was generated from the following files:
BasicUI::ShowErrorDialog
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
Definition: BasicUI.h:233
XO
#define XO(s)
Definition: Internat.h:31
AudacityProject::mProjectNo
int mProjectNo
Definition: Project.h:153
FileNames::AbbreviatePath
AUDACITY_DLL_API wxString AbbreviatePath(const wxFileName &fileName)
Give enough of the path to identify the device. (On Windows, drive letter plus ':')
name
const TranslatableString name
Definition: Distortion.cpp:98
AudacityProject::mFrame
wxWeakRef< wxFrame > mFrame
Definition: Project.h:162
AudacityProject::mPanel
wxWeakRef< wxWindow > mPanel
Definition: Project.h:163
ClientData::Site::BuildAll
void BuildAll()
For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.
Definition: ClientData.h:441
AudacityProject::mName
wxString mName
Definition: Project.h:150
AudacityProject::mProjectCounter
static int mProjectCounter
Definition: Project.h:152
AudacityProject::mInitialImportPath
FilePath mInitialImportPath
Definition: Project.h:155
TempDirectory::TempDir
AUDACITY_DLL_API wxString TempDir()
Definition: TempDirectory.cpp:26