1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-20 06:37:42 +02:00

Merge remote-tracking branch 'audmain/master' into sbsms

This commit is contained in:
Steve Daulton 2016-01-26 19:47:08 +00:00
commit 8ce18979c8
3 changed files with 27 additions and 5 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(";");
@ -204,7 +204,7 @@ bool ExportPlugin::GetCanMetaData(int index)
return mFormatInfos[index].mCanMetaData;
}
bool ExportPlugin::IsExtension(wxString & ext, int index)
bool ExportPlugin::IsExtension(const wxString & ext, int index)
{
bool isext = false;
for (int i = index; i < GetFormatCount(); i = GetFormatCount())

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;
@ -80,7 +80,7 @@ public:
virtual int GetMaxChannels(int index);
virtual bool GetCanMetaData(int index);
virtual bool IsExtension(wxString & ext, int index);
virtual bool IsExtension(const wxString & ext, int index);
virtual bool DisplayOptions(wxWindow *parent, int format = 0);

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();