mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 00:19:27 +02:00
New argument for ProjectManager::OpenProject, not yet implemented...
... It is false in exactly the cases where there is now also a check first for the safety of opening a project file. Those are the cases where a new project was made for imports, but this was not necessary for safety. Yet old behavior will be preserved in such cases.
This commit is contained in:
parent
97cf411dd5
commit
a1650771b1
@ -815,7 +815,8 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) {
|
||||
|
||||
if (proj && !ProjectManager::SafeToOpenProjectInto(*proj))
|
||||
proj = nullptr;
|
||||
( void ) ProjectManager::OpenProject( proj, fullPathStr );
|
||||
( void ) ProjectManager::OpenProject( proj, fullPathStr,
|
||||
true /* addtohistory */, false /* reuseNonemptyProject */ );
|
||||
}
|
||||
else {
|
||||
// File doesn't exist - remove file from history
|
||||
|
@ -430,7 +430,7 @@ static bool RecoverAllProjects(const FilePaths &files,
|
||||
std::swap(proj, pproj);
|
||||
|
||||
// Open project.
|
||||
if (ProjectManager::OpenProject(proj, file, false) == nullptr)
|
||||
if (ProjectManager::OpenProject(proj, file, false, true) == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -873,7 +873,8 @@ void ProjectManager::OpenFiles(AudacityProject *proj)
|
||||
|
||||
if (proj && !SafeToOpenProjectInto(*proj))
|
||||
proj = nullptr;
|
||||
proj = OpenProject( proj, fileName );
|
||||
proj = OpenProject( proj, fileName,
|
||||
true /* addtohistory */, false /* reuseNonemptyProject */ );
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,7 +902,8 @@ bool ProjectManager::SafeToOpenProjectInto(AudacityProject &proj)
|
||||
}
|
||||
|
||||
AudacityProject *ProjectManager::OpenProject(
|
||||
AudacityProject *pProject, const FilePath &fileNameArg, bool addtohistory)
|
||||
AudacityProject *pProject, const FilePath &fileNameArg,
|
||||
bool addtohistory, bool)
|
||||
{
|
||||
bool success = false;
|
||||
AudacityProject *pNewProject = nullptr;
|
||||
|
@ -48,12 +48,18 @@ public:
|
||||
//! False when it is unsafe to overwrite proj with contents of an .aup3 file
|
||||
static bool SafeToOpenProjectInto(AudacityProject &proj);
|
||||
|
||||
// Return the given project if that is not NULL, else create a project.
|
||||
// Then open the given project path.
|
||||
// But if an exception escapes this function, create no NEW project.
|
||||
//! Open a file into an AudacityProject, returning the project, or nullptr for failure
|
||||
/*!
|
||||
If an exception escapes this function, no projects are created.
|
||||
@param pProject if not null, a project that may be reused
|
||||
@param fileNameArg path to the file to open; not always an Audacity project file, may be an import
|
||||
@param addtohistory whether to add .aup3 files to the MRU list (but always done for imports)
|
||||
@param reuseNonemptyProject if true, may reuse the given project when nonempty,
|
||||
but only if importing (not for a project file)
|
||||
*/
|
||||
static AudacityProject *OpenProject(
|
||||
AudacityProject *pProject,
|
||||
const FilePath &fileNameArg, bool addtohistory = true);
|
||||
const FilePath &fileNameArg, bool addtohistory, bool reuseNonemptyProject);
|
||||
|
||||
void ResetProjectToEmpty();
|
||||
|
||||
|
@ -410,7 +410,8 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
||||
* audio file. TODO: Some sort of message here? */
|
||||
|
||||
#endif // USE_MIDI
|
||||
mProject = ProjectManager::OpenProject( mProject, targetfile );
|
||||
mProject = ProjectManager::OpenProject( mProject, targetfile,
|
||||
true /* addtohistory */, true /* reuseNonemptyProject */ );
|
||||
|
||||
// Set tok to right after filename
|
||||
temptok2.SetString(targettoken);
|
||||
|
Loading…
x
Reference in New Issue
Block a user