1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

Changes as per James's advice, allow Timer Recording to be used when project is empty if user has disabled warnings in prefs. Also resolved a further message whitespace issue.

This commit is contained in:
tip2tail 2016-03-31 22:26:26 +01:00
parent 758eae6b3a
commit 4956ce3e68
3 changed files with 15 additions and 7 deletions

View File

@ -6336,9 +6336,8 @@ void AudacityProject::OnTimerRecord()
// to Timer Recording. This decision has been taken as the safest approach // to Timer Recording. This decision has been taken as the safest approach
// preventing issues surrounding "dirty" projects when Automatic Save/Export // preventing issues surrounding "dirty" projects when Automatic Save/Export
// is used in Timer Recording. // is used in Timer Recording.
if (GetUndoManager()->UnsavedChanges()) { if ((GetUndoManager()->UnsavedChanges()) && (ProjectHasTracks() || mEmptyCanBeDirty)) {
wxMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\n\ wxMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
Please save or close this project and try again."),
_("Timer Recording"), _("Timer Recording"),
wxICON_INFORMATION | wxOK); wxICON_INFORMATION | wxOK);
return; return;

View File

@ -2168,10 +2168,8 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
gAudioIO->StopStream(); gAudioIO->StopStream();
} }
// These two lines test for an 'empty' project. // MY: Use routine here so other processes can make same check
// of course it could still have a history at this stage. bool bHasTracks = ProjectHasTracks();
TrackListIterator iter2(mTracks);
bool bHasTracks = (iter2.First() != NULL);
// We may not bother to prompt the user to save, if the // We may not bother to prompt the user to save, if the
// project is now empty. // project is now empty.
@ -5247,3 +5245,12 @@ bool AudacityProject::SaveFromTimerRecording(wxFileName fnFile) {
return bSuccess; return bSuccess;
} }
// MY: Does the project have any tracks?
bool AudacityProject::ProjectHasTracks() {
// These two lines test for an 'empty' project.
// of course it could still have a history at this stage.
TrackListIterator iter2(mTracks);
bool bHasTracks = (iter2.First() != NULL);
return bHasTracks;
}

View File

@ -281,6 +281,8 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
int GetOpenProjectCount(); int GetOpenProjectCount();
bool IsProjectSaved(); bool IsProjectSaved();
bool ProjectHasTracks();
#include "Menus.h" #include "Menus.h"
CommandManager *GetCommandManager() { return &mCommandManager; } CommandManager *GetCommandManager() { return &mCommandManager; }