mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 23:00:06 +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:
parent
f7fba31319
commit
53a8b44f1d
@ -185,7 +185,7 @@ wxString ExportPlugin::GetMask(int index)
|
|||||||
wxString mask = GetDescription(index) + wxT("|");
|
wxString mask = GetDescription(index) + wxT("|");
|
||||||
|
|
||||||
// Build the mask
|
// Build the mask
|
||||||
wxString ext = GetExtension(index);
|
// wxString ext = GetExtension(index);
|
||||||
wxArrayString exts = GetExtensions(index);
|
wxArrayString exts = GetExtensions(index);
|
||||||
for (size_t i = 0; i < exts.GetCount(); i++) {
|
for (size_t i = 0; i < exts.GetCount(); i++) {
|
||||||
mask += wxT("*.") + exts[i] + wxT(";");
|
mask += wxT("*.") + exts[i] + wxT(";");
|
||||||
|
@ -38,7 +38,7 @@ class AUDACITY_DLL_API FormatInfo
|
|||||||
~FormatInfo(){};
|
~FormatInfo(){};
|
||||||
wxString mFormat;
|
wxString mFormat;
|
||||||
wxString mDescription;
|
wxString mDescription;
|
||||||
wxString mExtension;
|
// wxString mExtension;
|
||||||
wxArrayString mExtensions;
|
wxArrayString mExtensions;
|
||||||
wxString mMask;
|
wxString mMask;
|
||||||
int mMaxChannels;
|
int mMaxChannels;
|
||||||
|
@ -168,6 +168,7 @@ ExportPCMOptions::ExportPCMOptions(wxWindow *parent, int selformat)
|
|||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
|
|
||||||
TransferDataToWindow();
|
TransferDataToWindow();
|
||||||
|
TransferDataFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportPCMOptions::~ExportPCMOptions()
|
ExportPCMOptions::~ExportPCMOptions()
|
||||||
@ -268,6 +269,8 @@ void ExportPCMOptions::OnHeaderChoice(wxCommandEvent & WXUNUSED(evt))
|
|||||||
mEncodingFromChoice = sel;
|
mEncodingFromChoice = sel;
|
||||||
mEncodingChoice->SetSelection(sel);
|
mEncodingChoice->SetSelection(sel);
|
||||||
ValidatePair(GetFormat());
|
ValidatePair(GetFormat());
|
||||||
|
|
||||||
|
TransferDataFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExportPCMOptions::GetFormat()
|
int ExportPCMOptions::GetFormat()
|
||||||
@ -320,7 +323,8 @@ public:
|
|||||||
Tags *metadata = NULL,
|
Tags *metadata = NULL,
|
||||||
int subformat = 0);
|
int subformat = 0);
|
||||||
// optional
|
// optional
|
||||||
wxString GetExtension(int index = WXSIZEOF(kFormats));
|
wxString GetExtension(int index);
|
||||||
|
virtual bool CheckFileName(wxFileName &filename, int format);
|
||||||
|
|
||||||
private:
|
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()
|
ExportPlugin *New_ExportPCM()
|
||||||
{
|
{
|
||||||
return new ExportPCM();
|
return new ExportPCM();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user