1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-09 16:41:14 +02:00

Some steps of ResetProjectToEmpty into a new function

This commit is contained in:
Paul Licameli 2019-05-02 06:24:29 -04:00
parent 582b0ee40c
commit 0bd9bb3b90
2 changed files with 11 additions and 3 deletions

View File

@ -5335,6 +5335,7 @@ bool AudacityProject::IsProjectSaved() {
// This is done to empty out the tracks, but without creating a new project.
void AudacityProject::ResetProjectToEmpty() {
auto &project = *this;
auto &projectFileIO = project;
SelectActions::DoSelectAll( project );
TrackActions::DoRemoveTracks( project );
@ -5342,20 +5343,26 @@ void AudacityProject::ResetProjectToEmpty() {
mDirManager = DirManager::Create();
mTrackFactory.reset(safenew TrackFactory{ mDirManager, &mViewInfo });
projectFileIO.ResetProjectFileIO();
mDirty = false;
GetUndoManager()->ClearStates();
}
void AudacityProject::ResetProjectFileIO()
{
// mLastSavedTrack code copied from OnCloseWindow.
// Lock all blocks in all tracks of the last saved version, so that
// the blockfiles aren't deleted on disk when we DELETE the blockfiles
// in memory. After it's locked, DELETE the data structure so that
// there's no memory leak.
project.CloseLock();
CloseLock();
//mLastSavedTracks = TrackList::Create();
mFileName = "";
mIsRecovered = false;
mbLoadedFromAup = false;
SetProjectTitle();
mDirty = false;
GetUndoManager()->ClearStates();
}
bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) {

View File

@ -352,6 +352,7 @@ public:
static int GetOpenProjectCount();
bool IsProjectSaved();
void ResetProjectToEmpty();
void ResetProjectFileIO();
// Routine to estimate how many minutes of recording time are left on disk
int GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels = 0);