mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-26 22:51:21 +01:00
Bug1315 fix suggested by Bobby Kent (export file dialog problem)
This commit is contained in:
@@ -521,6 +521,7 @@ bool Exporter::GetFilename()
|
|||||||
mFilterIndex = 0;
|
mFilterIndex = 0;
|
||||||
}
|
}
|
||||||
maskString.RemoveLast();
|
maskString.RemoveLast();
|
||||||
|
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
|
||||||
|
|
||||||
//Bug 1304: Set a default path if none was given. For Export.
|
//Bug 1304: Set a default path if none was given. For Export.
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
@@ -536,38 +537,45 @@ bool Exporter::GetFilename()
|
|||||||
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents")));
|
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents")));
|
||||||
#endif
|
#endif
|
||||||
mFilename.SetName(mProject->GetName());
|
mFilename.SetName(mProject->GetName());
|
||||||
|
if (mFilename.GetName().empty())
|
||||||
|
mFilename.SetName(_("untitled"));
|
||||||
while (true) {
|
while (true) {
|
||||||
// Must reset each iteration
|
// Must reset each iteration
|
||||||
mBook = NULL;
|
mBook = NULL;
|
||||||
|
|
||||||
FileDialog fd(mProject,
|
{
|
||||||
mFileDialogTitle,
|
auto useFileName = mFilename;
|
||||||
mFilename.GetPath(),
|
if (!useFileName.HasExt())
|
||||||
mFilename.GetFullName(),
|
useFileName.SetExt(defext);
|
||||||
maskString,
|
FileDialog fd(mProject,
|
||||||
wxFD_SAVE | wxRESIZE_BORDER);
|
mFileDialogTitle,
|
||||||
mDialog = &fd;
|
mFilename.GetPath(),
|
||||||
mDialog->PushEventHandler(this);
|
useFileName.GetFullName(),
|
||||||
|
maskString,
|
||||||
|
wxFD_SAVE | wxRESIZE_BORDER);
|
||||||
|
mDialog = &fd;
|
||||||
|
mDialog->PushEventHandler(this);
|
||||||
|
|
||||||
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this);
|
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this);
|
||||||
fd.SetFilterIndex(mFilterIndex);
|
fd.SetFilterIndex(mFilterIndex);
|
||||||
|
|
||||||
int result = fd.ShowModal();
|
int result = fd.ShowModal();
|
||||||
|
|
||||||
mDialog->PopEventHandler();
|
mDialog->PopEventHandler();
|
||||||
|
|
||||||
if (result == wxID_CANCEL) {
|
if (result == wxID_CANCEL) {
|
||||||
return false;
|
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 c = 0;
|
||||||
int i = -1;
|
int i = -1;
|
||||||
for (const auto &pPlugin : mPlugins)
|
for (const auto &pPlugin : mPlugins)
|
||||||
@@ -585,7 +593,7 @@ bool Exporter::GetFilename()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString ext = mFilename.GetExt();
|
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,
|
// Check the extension - add the default if it's not there,
|
||||||
|
|||||||
Reference in New Issue
Block a user