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 107 of file Project.h.

Member Typedef Documentation

◆ AttachedObjects

Definition at line 114 of file Project.h.

◆ AttachedWindows

Definition at line 115 of file Project.h.

Constructor & Destructor Documentation

◆ AudacityProject()

AudacityProject::AudacityProject ( )

Definition at line 122 of file Project.cpp.

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

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

Here is the call graph for this function:

◆ ~AudacityProject()

AudacityProject::~AudacityProject ( )
virtual

Definition at line 149 of file Project.cpp.

150 {
151 }

Member Function Documentation

◆ GetFrame() [1/2]

wxFrame* AudacityProject::GetFrame ( )
inline

Definition at line 120 of file Project.h.

120 { 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 121 of file Project.h.

121 { return mFrame; }

References mFrame.

◆ GetInitialImportPath()

FilePath AudacityProject::GetInitialImportPath ( ) const

Definition at line 173 of file Project.cpp.

174 {
175  return mInitialImportPath;
176 }

References mInitialImportPath.

◆ GetPanel() [1/2]

wxWindow* AudacityProject::GetPanel ( )
inline

Definition at line 124 of file Project.h.

124 { 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 125 of file Project.h.

125 { return mPanel; }

◆ GetProjectName()

const wxString & AudacityProject::GetProjectName ( ) const

Definition at line 163 of file Project.cpp.

164 {
165  return mName;
166 }

References mName.

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

Here is the caller graph for this function:

◆ GetProjectNumber()

int AudacityProject::GetProjectNumber ( )
inline

Definition at line 128 of file Project.h.

128 { return mProjectNo;}

Referenced by TitleRestorer::TitleRestorer().

Here is the caller graph for this function:

◆ SetFrame()

void AudacityProject::SetFrame ( wxFrame *  pFrame)

Definition at line 153 of file Project.cpp.

154 {
155  mFrame = pFrame;
156 }

References mFrame.

◆ SetInitialImportPath()

void AudacityProject::SetInitialImportPath ( const FilePath path)

Definition at line 178 of file Project.cpp.

179 {
180  if (mInitialImportPath.empty())
181  {
182  mInitialImportPath = path;
183  }
184 }

References mInitialImportPath.

Referenced by DoImportMIDI().

Here is the caller graph for this function:

◆ SetPanel()

void AudacityProject::SetPanel ( wxWindow *  pPanel)

Definition at line 158 of file Project.cpp.

159 {
160  mPanel = pPanel;
161 }

References mPanel.

◆ SetProjectName()

void AudacityProject::SetProjectName ( const wxString &  name)

Definition at line 168 of file Project.cpp.

169 {
170  mName = name;
171 }

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 157 of file Project.h.

Referenced by Importer::Import().

◆ mFrame

wxWeakRef< wxFrame > AudacityProject::mFrame {}
private

Definition at line 161 of file Project.h.

Referenced by SetFrame().

◆ mInitialImportPath

FilePath AudacityProject::mInitialImportPath
private

Definition at line 154 of file Project.h.

Referenced by GetInitialImportPath(), and SetInitialImportPath().

◆ mName

wxString AudacityProject::mName
private

Definition at line 149 of file Project.h.

Referenced by GetProjectName(), and SetProjectName().

◆ mPanel

wxWeakRef< wxWindow > AudacityProject::mPanel {}
private

Definition at line 162 of file Project.h.

Referenced by SetPanel().

◆ mProjectCounter

int AudacityProject::mProjectCounter =0
staticprivate

Definition at line 151 of file Project.h.

Referenced by AudacityProject().

◆ mProjectNo

int AudacityProject::mProjectNo
private

Definition at line 152 of file Project.h.

Referenced by AudacityProject().


The documentation for this class was generated from the following files:
Format
Abstract base class used in importing a file.
XO
#define XO(s)
Definition: Internat.h:32
AudacityProject::mProjectNo
int mProjectNo
Definition: Project.h:152
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:161
ShowErrorDialog
void ShowErrorDialog(wxWindow *parent, const TranslatableString &dlogTitle, const TranslatableString &message, const wxString &helpPage, const bool Close, const wxString &log)
Displays an error dialog with a button that offers help.
Definition: ErrorDialog.cpp:148
AudacityProject::mPanel
wxWeakRef< wxWindow > mPanel
Definition: Project.h:162
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:149
AudacityProject::mProjectCounter
static int mProjectCounter
Definition: Project.h:151
AudacityProject::mInitialImportPath
FilePath mInitialImportPath
Definition: Project.h:154
TempDirectory::TempDir
AUDACITY_DLL_API wxString TempDir()
Definition: TempDirectory.cpp:26