1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-21 06:40:08 +02:00

Bug1217: Export "other uncompressed files" now uses correct default extension...

... but there is this consequence:  If you do type an explicit extension,
which is one of the acceptable extensions though different from the
"Header:" chocie, then it is also corrected, silently.  This behavior is
different from other cases where the user types an inappropriate explicit
extension and is prompted to fix it.
This commit is contained in:
Paul Licameli 2016-01-26 13:48:37 -05:00
parent f7fba31319
commit 53a8b44f1d
3 changed files with 25 additions and 3 deletions

View File

@ -185,7 +185,7 @@ wxString ExportPlugin::GetMask(int index)
wxString mask = GetDescription(index) + wxT("|");
// Build the mask
wxString ext = GetExtension(index);
// wxString ext = GetExtension(index);
wxArrayString exts = GetExtensions(index);
for (size_t i = 0; i < exts.GetCount(); i++) {
mask += wxT("*.") + exts[i] + wxT(";");

View File

@ -38,7 +38,7 @@ class AUDACITY_DLL_API FormatInfo
~FormatInfo(){};
wxString mFormat;
wxString mDescription;
wxString mExtension;
// wxString mExtension;
wxArrayString mExtensions;
wxString mMask;
int mMaxChannels;

View File

@ -168,6 +168,7 @@ ExportPCMOptions::ExportPCMOptions(wxWindow *parent, int selformat)
PopulateOrExchange(S);
TransferDataToWindow();
TransferDataFromWindow();
}
ExportPCMOptions::~ExportPCMOptions()
@ -268,6 +269,8 @@ void ExportPCMOptions::OnHeaderChoice(wxCommandEvent & WXUNUSED(evt))
mEncodingFromChoice = sel;
mEncodingChoice->SetSelection(sel);
ValidatePair(GetFormat());
TransferDataFromWindow();
}
int ExportPCMOptions::GetFormat()
@ -320,7 +323,8 @@ public:
Tags *metadata = NULL,
int subformat = 0);
// optional
wxString GetExtension(int index = WXSIZEOF(kFormats));
wxString GetExtension(int index);
virtual bool CheckFileName(wxFileName &filename, int format);
private:
@ -894,6 +898,24 @@ wxString ExportPCM::GetExtension(int index)
}
}
bool ExportPCM::CheckFileName(wxFileName &filename, int format)
{
if (format == WXSIZEOF(kFormats) &&
IsExtension(filename.GetExt(), format)) {
// PRL: Bug1217
// If the user left the extension blank, then the
// file dialog will have defaulted the extension, beyond our control,
// to the first in the wildcard list or (Linux) the last-saved extension,
// ignoring what we try to do with the additional drop-down mHeaderChoice.
// Here we can intercept file name processing and impose the correct default.
// However this has the consequence that in case an explicit extension was typed,
// we override it without asking.
filename.SetExt(GetExtension(format));
}
return ExportPlugin::CheckFileName(filename, format);
}
ExportPlugin *New_ExportPCM()
{
return new ExportPCM();