Audacity 3.2.0
|
Object associated with a project for high-level management of the project's lifetime, including creation, destruction, opening from file, importing, pushing undo states, and reverting to saved states. More...
#include <ProjectManager.h>
Classes | |
class | ProjectChooser |
Callable object that supplies the chooser argument of ProjectFileManager::OpenFile. More... | |
Public Member Functions | |
ProjectManager (AudacityProject &project) | |
ProjectManager (const ProjectManager &)=delete | |
ProjectManager & | operator= (const ProjectManager &)=delete |
~ProjectManager () override | |
void | ResetProjectToEmpty () |
int | GetEstimatedRecordingMinsLeftOnDisk (long lCaptureChannels=0) |
TranslatableString | GetHoursMinsString (int iMinutes) |
void | SetStatusText (const TranslatableString &text, const StatusBarField &field) |
void | SetStatusText (const TranslatableString &text, int number) |
void | SetSkipSavePrompt (bool bSkip) |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Static Public Member Functions | |
static ProjectManager & | Get (AudacityProject &project) |
static const ProjectManager & | Get (const AudacityProject &project) |
static AudacityProject * | New () |
static void | OpenFiles (AudacityProject *proj) |
static bool | SafeToOpenProjectInto (AudacityProject &proj) |
False when it is unsafe to overwrite proj with contents of an .aup3 file. More... | |
static AudacityProject * | OpenProject (AudacityProject *pGivenProject, const FilePath &fileNameArg, bool addtohistory, bool reuseNonemptyProject) |
Open a file into an AudacityProject, returning the project, or nullptr for failure. More... | |
static void | SaveWindowSize () |
static void | SetClosingAll (bool closing) |
Private Member Functions | |
void | OnReconnectionFailure (ProjectFileIOMessage) |
void | OnCloseWindow (wxCloseEvent &event) |
void | OnTimer (wxTimerEvent &event) |
void | OnStatusChange (StatusBarField field) |
void | RestartTimer () |
Private Attributes | |
AudacityProject & | mProject |
std::unique_ptr< wxTimer > | mTimer |
Observer::Subscription | mProjectStatusSubscription |
Observer::Subscription | mProjectFileIOSubscription |
Static Private Attributes | |
static bool | sbWindowRectAlreadySaved = false |
static bool | sbSkipPromptingForSave = false |
Object associated with a project for high-level management of the project's lifetime, including creation, destruction, opening from file, importing, pushing undo states, and reverting to saved states.
Definition at line 33 of file ProjectManager.h.
|
explicit |
Definition at line 89 of file ProjectManager.cpp.
References ProjectFileIO::Get(), ProjectStatus::Get(), ProjectWindow::Get(), mProject, mProjectFileIOSubscription, mProjectStatusSubscription, OnCloseWindow(), OnReconnectionFailure(), OnStatusChange(), and Observer::Publisher< Message, NotifyAll >::Subscribe().
|
delete |
|
overridedefault |
|
static |
Definition at line 79 of file ProjectManager.cpp.
References project, and sProjectManagerKey.
Referenced by Get(), InitProjectWindow(), New(), ApplyMacroDialog::OnApplyToFiles(), TimerRecordDialog::OnOK(), anonymous_namespace{FileMenus.cpp}::OnProjectReset(), and anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord().
|
static |
Definition at line 84 of file ProjectManager.cpp.
References Get(), and project.
int ProjectManager::GetEstimatedRecordingMinsLeftOnDisk | ( | long | lCaptureChannels = 0 | ) |
Definition at line 855 of file ProjectManager.cpp.
References AudioIORecordChannels, ProjectFileIO::Get(), ProjectRate::Get(), ProjectFileIO::GetFreeDiskSpace(), ProjectRate::GetRate(), mProject, project, Setting< T >::Read(), fast_float::round(), SAMPLE_SIZE_DISK, and QualitySettings::SampleFormatChoice().
Referenced by OnTimer().
TranslatableString ProjectManager::GetHoursMinsString | ( | int | iMinutes | ) |
Definition at line 833 of file ProjectManager.cpp.
Referenced by OnTimer().
|
static |
Definition at line 303 of file ProjectManager.cpp.
References AllProjects::Add(), AudacityProject::Create(), MenuCreator::CreateMenusAndCommands(), ModuleManager::Dispatch(), AudioIO::Get(), ModuleManager::Get(), ProjectHistory::Get(), MenuCreator::Get(), ProjectAudioManager::Get(), ProjectFileManager::Get(), Get(), ProjectWindow::Get(), ToolManager::Get(), GetNextWindowPlacement(), InitProjectWindow(), project, ProjectInitialized, ToolManager::RegenerateTooltips(), and SetActiveProject().
Referenced by AudacityApp::InitPart2(), AudacityApp::MacNewFile(), OnCloseWindow(), AudacityApp::OnMenuNew(), anonymous_namespace{FileMenus.cpp}::OnNew(), audacity::cloud::audiocom::sync::OpenProjectFromCloud(), and ProjectManager::ProjectChooser::operator()().
|
private |
Definition at line 380 of file ProjectManager.cpp.
References AudacityMessageBox(), AllProjects::begin(), ToolManager::Destroy(), WaveTrackFactory::Destroy(), AdornedRulerPanel::Destroy(), TrackPanel::Destroy(), ModuleManager::Dispatch(), AllProjects::empty(), AudioIO::Get(), ModuleManager::Get(), Clipboard::Get(), ProjectAudioIO::Get(), ProjectFileIO::Get(), ProjectHistory::Get(), UndoManager::Get(), TrackList::Get(), Viewport::Get(), ProjectAudioManager::Get(), ProjectFileManager::Get(), ProjectSettings::Get(), ProjectWindow::Get(), ToolManager::Get(), GetActiveProject(), anonymous_namespace{TrackSelectHandle.cpp}::Message(), mProject, mTimer, New(), ProjectFileIOExtensionRegistry::OnClose(), project, ProjectClosing, AllProjects::Remove(), SaveWindowSize(), sbClosingAll, sbSkipPromptingForSave, sbWindowRectAlreadySaved, SetActiveProject(), ProjectHistory::SetStateTo(), settings(), AllProjects::size(), TitleRestorer::sProjName, TitleRestorer::sProjNumber, ProjectAudioManager::Stop(), tracks, Veto, and XO().
Referenced by ProjectManager().
|
private |
Definition at line 367 of file ProjectManager.cpp.
References ProjectWindow::Get(), mProject, and ReconnectionFailure.
Referenced by ProjectManager().
|
private |
Definition at line 790 of file ProjectManager.cpp.
References field, ProjectWindow::Find(), ProjectStatus::Get(), MainStatusBarField(), mProject, project, RestartTimer(), and SetStatusText().
Referenced by ProjectManager().
|
private |
Definition at line 760 of file ProjectManager.cpp.
References AudioIO::Get(), ProjectAudioIO::Get(), ProjectFileIO::Get(), GetEstimatedRecordingMinsLeftOnDisk(), ProjectFileIO::GetFreeDiskSpace(), GetHoursMinsString(), MeterToolBar::GetToolBars(), MainStatusBarField(), mProject, project, RestartTimer(), SetStatusText(), and XO().
|
static |
Definition at line 626 of file ProjectManager.cpp.
References FileNames::CompareNoCase(), ProjectFileManager::IsAlreadyOpen(), OpenProject(), Importer::SetLastOpenType(), and ProjectFileManager::ShowOpenDialog().
Referenced by OpenProjectCommand::Apply(), AudacityApp::OnMenuOpen(), and anonymous_namespace{FileMenus.cpp}::OnOpen().
|
static |
Open a file into an AudacityProject, returning the project, or nullptr for failure.
If an exception escapes this function, no projects are created.
pGivenProject | if not null, a project that may be reused |
fileNameArg | path to the file to open; not always an Audacity project file, may be an import |
addtohistory | whether to add .aup3 files to the MRU list (but always done for imports) |
reuseNonemptyProject | if true, may reuse the given project when nonempty, but only if importing (not for a project file) |
Definition at line 709 of file ProjectManager.cpp.
References ProjectFileIO::Get(), UndoManager::Get(), Viewport::Get(), and ProjectFileManager::OpenFile().
Referenced by EVT_MENU_RANGE(), LOFImportFileHandle::lofOpenFiles(), OpenFiles(), audacity::cloud::audiocom::sync::OpenProjectFromCloud(), and RecoverAllProjects().
|
delete |
void ProjectManager::ResetProjectToEmpty | ( | ) |
Definition at line 732 of file ProjectManager.cpp.
References TrackUtilities::DoRemoveTracks(), SelectUtilities::DoSelectAll(), ProjectFileIO::Get(), ProjectHistory::Get(), ViewInfo::Get(), ProjectFileManager::Get(), mProject, project, and WaveTrackFactory::Reset().
Referenced by ApplyMacroDialog::OnApplyToFiles(), and anonymous_namespace{FileMenus.cpp}::OnProjectReset().
|
private |
Definition at line 752 of file ProjectManager.cpp.
References mTimer.
Referenced by OnStatusChange(), and OnTimer().
|
static |
False when it is unsafe to overwrite proj with contents of an .aup3 file.
Definition at line 652 of file ProjectManager.cpp.
References ProjectHistory::Get(), and TrackList::Get().
Referenced by ProjectManager::ProjectChooser::operator()().
|
static |
Definition at line 110 of file ProjectManager.cpp.
References AllProjects::begin(), ProjectWindow::Get(), GetDefaultWindowRect(), ProjectWindow::GetNormalizedWindowState(), and anonymous_namespace{ProjectManager.cpp}::SaveWindowPreferences().
Referenced by OnCloseWindow(), AudacityApp::OnEndSession(), and QuitAudacity().
|
static |
Definition at line 375 of file ProjectManager.cpp.
References sbClosingAll.
Referenced by CloseAllProjects().
|
inline |
Definition at line 115 of file ProjectManager.h.
Referenced by anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord().
void ProjectManager::SetStatusText | ( | const TranslatableString & | text, |
const StatusBarField & | field | ||
) |
Definition at line 814 of file ProjectManager.cpp.
References field, ProjectStatusFieldsRegistry::GetFieldIndex(), mProject, and SetStatusText().
Referenced by InitProjectWindow(), OnStatusChange(), OnTimer(), and SetStatusText().
void ProjectManager::SetStatusText | ( | const TranslatableString & | text, |
int | number | ||
) |
Definition at line 823 of file ProjectManager.cpp.
References ProjectWindow::Find(), mProject, project, and TranslatableString::Translation().
|
private |
Definition at line 128 of file ProjectManager.h.
Referenced by GetEstimatedRecordingMinsLeftOnDisk(), OnCloseWindow(), OnReconnectionFailure(), OnStatusChange(), OnTimer(), ProjectManager(), ResetProjectToEmpty(), and SetStatusText().
|
private |
Definition at line 133 of file ProjectManager.h.
Referenced by ProjectManager().
|
private |
Definition at line 132 of file ProjectManager.h.
Referenced by ProjectManager().
|
private |
Definition at line 130 of file ProjectManager.h.
Referenced by OnCloseWindow(), and RestartTimer().
|
staticprivate |
Definition at line 138 of file ProjectManager.h.
Referenced by OnCloseWindow().
|
staticprivate |
Definition at line 137 of file ProjectManager.h.
Referenced by OnCloseWindow().