mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Undo confusing tangle of Save and SaveAs each calling the other...
Now Save may call SaveAs, which does not call back; each calls DoSave.
This commit is contained in:
parent
e066c4f38d
commit
1d9b8b7bad
@ -3769,16 +3769,27 @@ private:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool AudacityProject::Save(bool overwrite /* = true */ ,
|
bool AudacityProject::Save()
|
||||||
bool fromSaveAs /* = false */,
|
{
|
||||||
bool bWantSaveCompressed /*= false*/)
|
if (mDirManager->GetProjectName() == wxT(""))
|
||||||
|
return SaveAs();
|
||||||
|
|
||||||
|
return DoSave(true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Assumes AudacityProject::mFileName has been set to the desired path.
|
||||||
|
bool AudacityProject::DoSave
|
||||||
|
(const bool overwrite, const bool fromSaveAs, const bool bWantSaveCompressed)
|
||||||
{
|
{
|
||||||
// See explanation above
|
// See explanation above
|
||||||
// ProjectDisabler disabler(this);
|
// ProjectDisabler disabler(this);
|
||||||
|
|
||||||
if (bWantSaveCompressed)
|
if (bWantSaveCompressed)
|
||||||
wxASSERT(fromSaveAs);
|
wxASSERT(fromSaveAs);
|
||||||
else
|
|
||||||
|
// Some confirmation dialogs
|
||||||
|
if (!bWantSaveCompressed)
|
||||||
{
|
{
|
||||||
TrackListIterator iter(GetTracks());
|
TrackListIterator iter(GetTracks());
|
||||||
bool bHasTracks = (iter.First() != NULL);
|
bool bHasTracks = (iter.First() != NULL);
|
||||||
@ -3793,9 +3804,6 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fromSaveAs && mDirManager->GetProjectName() == wxT(""))
|
|
||||||
return SaveAs();
|
|
||||||
|
|
||||||
// If the user has recently imported dependencies, show
|
// If the user has recently imported dependencies, show
|
||||||
// a dialog where the user can see audio files that are
|
// a dialog where the user can see audio files that are
|
||||||
// aliased by this project. The user may make the project
|
// aliased by this project. The user may make the project
|
||||||
@ -3808,6 +3816,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
mImportedDependencies = false; // do not show again
|
mImportedDependencies = false; // do not show again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// End of confirmations
|
||||||
|
|
||||||
//
|
//
|
||||||
// Always save a backup of the original project file
|
// Always save a backup of the original project file
|
||||||
@ -4331,7 +4340,7 @@ bool AudacityProject::SaveAs(const wxString & newFileName, bool bWantSaveCompres
|
|||||||
//Don't change the title, unless we succeed.
|
//Don't change the title, unless we succeed.
|
||||||
//SetProjectTitle();
|
//SetProjectTitle();
|
||||||
|
|
||||||
success = Save(false, true, bWantSaveCompressed);
|
success = DoSave(false, true, bWantSaveCompressed);
|
||||||
|
|
||||||
if (success && addToHistory) {
|
if (success && addToHistory) {
|
||||||
wxGetApp().AddFileToHistory(mFileName);
|
wxGetApp().AddFileToHistory(mFileName);
|
||||||
@ -4430,7 +4439,7 @@ For an audio file that will open in other apps, use 'Export'.\n"),
|
|||||||
mFileName = oldFileName;
|
mFileName = oldFileName;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
success = Save(false, true, bWantSaveCompressed);
|
success = DoSave(false, true, bWantSaveCompressed);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
wxGetApp().AddFileToHistory(mFileName);
|
wxGetApp().AddFileToHistory(mFileName);
|
||||||
@ -5817,7 +5826,7 @@ bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) {
|
|||||||
mFileName = sOldFilename;
|
mFileName = sOldFilename;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
bSuccess = Save(false, true, false);
|
bSuccess = DoSave(false, true, false);
|
||||||
|
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
wxGetApp().AddFileToHistory(mFileName);
|
wxGetApp().AddFileToHistory(mFileName);
|
||||||
|
@ -272,12 +272,16 @@ public:
|
|||||||
AddImportedTracks(const wxString &fileName,
|
AddImportedTracks(const wxString &fileName,
|
||||||
TrackHolders &&newTracks);
|
TrackHolders &&newTracks);
|
||||||
|
|
||||||
bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false);
|
bool Save();
|
||||||
bool SaveAs(bool bWantSaveCompressed = false);
|
bool SaveAs(bool bWantSaveCompressed = false);
|
||||||
bool SaveAs(const wxString & newFileName, bool bWantSaveCompressed = false, bool addToHistory = true);
|
bool SaveAs(const wxString & newFileName, bool bWantSaveCompressed = false, bool addToHistory = true);
|
||||||
#ifdef USE_LIBVORBIS
|
#ifdef USE_LIBVORBIS
|
||||||
bool SaveCompressedWaveTracks(const wxString & strProjectPathName); // full path for aup except extension
|
bool SaveCompressedWaveTracks(const wxString & strProjectPathName); // full path for aup except extension
|
||||||
#endif
|
#endif
|
||||||
|
private:
|
||||||
|
bool DoSave(bool overwrite, bool fromSaveAs, bool bWantSaveCompressed);
|
||||||
|
public:
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
const wxString &GetFileName() { return mFileName; }
|
const wxString &GetFileName() { return mFileName; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user