1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Bug1315 fix suggested by Bobby Kent (export file dialog problem)

This commit is contained in:
Paul Licameli 2017-07-22 14:25:08 -04:00
parent cdc32e2311
commit 7ced70c210

View File

@ -521,6 +521,7 @@ bool Exporter::GetFilename()
mFilterIndex = 0;
}
maskString.RemoveLast();
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
//Bug 1304: Set a default path if none was given. For Export.
#ifdef __WIN32__
@ -536,38 +537,45 @@ bool Exporter::GetFilename()
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents")));
#endif
mFilename.SetName(mProject->GetName());
if (mFilename.GetName().empty())
mFilename.SetName(_("untitled"));
while (true) {
// Must reset each iteration
mBook = NULL;
FileDialog fd(mProject,
mFileDialogTitle,
mFilename.GetPath(),
mFilename.GetFullName(),
maskString,
wxFD_SAVE | wxRESIZE_BORDER);
mDialog = &fd;
mDialog->PushEventHandler(this);
{
auto useFileName = mFilename;
if (!useFileName.HasExt())
useFileName.SetExt(defext);
FileDialog fd(mProject,
mFileDialogTitle,
mFilename.GetPath(),
useFileName.GetFullName(),
maskString,
wxFD_SAVE | wxRESIZE_BORDER);
mDialog = &fd;
mDialog->PushEventHandler(this);
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this);
fd.SetFilterIndex(mFilterIndex);
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this);
fd.SetFilterIndex(mFilterIndex);
int result = fd.ShowModal();
int result = fd.ShowModal();
mDialog->PopEventHandler();
mDialog->PopEventHandler();
if (result == wxID_CANCEL) {
return false;
if (result == wxID_CANCEL) {
return false;
}
mFilename = fd.GetPath();
if (mFilename == wxT("")) {
return false;
}
mFormat = fd.GetFilterIndex();
mFilterIndex = fd.GetFilterIndex();
}
mFilename = fd.GetPath();
if (mFilename == wxT("")) {
return false;
}
mFormat = fd.GetFilterIndex();
mFilterIndex = fd.GetFilterIndex();
int c = 0;
int i = -1;
for (const auto &pPlugin : mPlugins)
@ -585,7 +593,7 @@ bool Exporter::GetFilename()
}
wxString ext = mFilename.GetExt();
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
//
// Check the extension - add the default if it's not there,