1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 16:48:44 +02:00

Rewrite FileNames::SelectFile using FileTypes...

... And more uniformity in the descriptions of file types used in more than
one place

Also fixes missing translations in VSTEffect.cpp
This commit is contained in:
Paul Licameli 2019-12-26 22:48:00 -05:00
parent 9204319b86
commit aa39f9ade2
18 changed files with 226 additions and 169 deletions

@ -251,13 +251,13 @@ void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
wxString fName = _("log.txt"); wxString fName = _("log.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export, fName = FileNames::SelectFile(FileNames::Operation::Export,
XO("Save log to:"), XO("Save log to:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
wxT("*.txt"), { FileNames::TextFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
mFrame.get()); mFrame.get());
if (fName.empty()) { if (fName.empty()) {
return; return;

@ -261,13 +261,13 @@ void BenchmarkDialog::OnSave( wxCommandEvent & WXUNUSED(event))
auto fName = XO("benchmark.txt").Translation(); auto fName = XO("benchmark.txt").Translation();
fName = FileNames::SelectFile(FileNames::Operation::Export, fName = FileNames::SelectFile(FileNames::Operation::Export,
XO("Export Benchmark Data as:"), XO("Export Benchmark Data as:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
wxT("*.txt"), { FileNames::TextFiles },
wxFD_SAVE | wxRESIZE_BORDER, wxFD_SAVE | wxRESIZE_BORDER,
this); this);
if (fName.empty()) if (fName.empty())
return; return;

@ -449,7 +449,8 @@ class FindFFmpegDialog final : public wxDialogWrapper
{ {
public: public:
FindFFmpegDialog(wxWindow *parent, const wxString &path, const wxString &name, const wxString &type) FindFFmpegDialog(wxWindow *parent, const wxString &path, const wxString &name,
FileNames::FileTypes types)
: wxDialogWrapper(parent, wxID_ANY, XO("Locate FFmpeg")) : wxDialogWrapper(parent, wxID_ANY, XO("Locate FFmpeg"))
{ {
SetName(); SetName();
@ -457,7 +458,7 @@ public:
mPath = path; mPath = path;
mName = name; mName = name;
mType = type; mTypes = std::move( types );
mLibPath.Assign(mPath, mName); mLibPath.Assign(mPath, mName);
@ -522,7 +523,7 @@ public:
mLibPath.GetPath(), mLibPath.GetPath(),
mLibPath.GetName(), mLibPath.GetName(),
wxT(""), wxT(""),
mType, mTypes,
wxFD_OPEN | wxRESIZE_BORDER, wxFD_OPEN | wxRESIZE_BORDER,
this); this);
if (!path.empty()) { if (!path.empty()) {
@ -547,7 +548,7 @@ private:
wxString mPath; wxString mPath;
wxString mName; wxString mName;
wxString mType; FileNames::FileTypes mTypes;
wxTextCtrl *mPathText; wxTextCtrl *mPathText;
@ -659,7 +660,7 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
FindFFmpegDialog fd(parent, FindFFmpegDialog fd(parent,
path, path,
name, name,
GetLibraryTypeString()); GetLibraryTypes());
if (fd.ShowModal() == wxID_CANCEL) { if (fd.ShowModal() == wxID_CANCEL) {
wxLogMessage(wxT("User canceled the dialog. Failed to find FFmpeg libraries.")); wxLogMessage(wxT("User canceled the dialog. Failed to find FFmpeg libraries."));

@ -242,10 +242,14 @@ public:
#if defined(__WXMSW__) #if defined(__WXMSW__)
/* Library names and file filters for Windows only */ /* Library names and file filters for Windows only */
wxString GetLibraryTypeString() FileNames::FileTypes GetLibraryTypes()
{ {
/* i18n-hint: do not translate avformat. Preserve the computer gibberish.*/ return {
return _("Only avformat.dll|*avformat*.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*"); /* i18n-hint: do not translate avformat. Preserve the computer gibberish.*/
{ XO("Only avformat.dll"), { wxT("avformat.dll") } },
FileNames::DynamicLibraries,
FileNames::AllFiles
};
} }
wxString GetLibAVFormatPath() wxString GetLibAVFormatPath()
@ -276,9 +280,12 @@ public:
} }
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
/* Library names and file filters for Mac OS only */ /* Library names and file filters for Mac OS only */
wxString GetLibraryTypeString() FileNames::FileTypes GetLibraryTypes()
{ {
return _("Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*"); return {
FileNames::DynamicLibraries,
FileNames::AllFiles
};
} }
wxString GetLibAVFormatPath() wxString GetLibAVFormatPath()
@ -309,9 +316,13 @@ public:
#else #else
/* Library names and file filters for other platforms, basically Linux and /* Library names and file filters for other platforms, basically Linux and
* other *nix platforms */ * other *nix platforms */
wxString GetLibraryTypeString() FileNames::FileTypes GetLibraryTypes()
{ {
return _("Only libavformat.so|libavformat*.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*"); return {
{ XO("Only libavformat.so"), { wxT("libavformat*.so*") } },
FileNames::DynamicLibraries,
FileNames::AllFiles
};
} }
wxString GetLibAVFormatPath() wxString GetLibAVFormatPath()

@ -558,13 +558,13 @@ void FileNames::UpdateDefaultPath(Operation op, const FilePath &path)
wxString wxString
FileNames::SelectFile(Operation op, FileNames::SelectFile(Operation op,
const TranslatableString& message, const TranslatableString& message,
const FilePath& default_path, const FilePath& default_path,
const FilePath& default_filename, const FilePath& default_filename,
const FileExtension& default_extension, const FileExtension& default_extension,
const wxString& wildcard, const FileTypes& fileTypes,
int flags, int flags,
wxWindow *parent) wxWindow *parent)
{ {
return WithDefaultPath(op, default_path, [&](const FilePath &path) { return WithDefaultPath(op, default_path, [&](const FilePath &path) {
wxString filter; wxString filter;
@ -572,7 +572,8 @@ FileNames::SelectFile(Operation op,
filter = wxT("*.") + default_extension; filter = wxT("*.") + default_extension;
return FileSelector( return FileSelector(
message.Translation(), path, default_filename, filter, message.Translation(), path, default_filename, filter,
wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord); FormatWildcard( fileTypes ),
flags, parent, wxDefaultCoord, wxDefaultCoord);
}); });
} }
@ -711,7 +712,7 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
} }
else { else {
wxFileName ff(name); wxFileName ff(name);
wxString ext; FileExtension ext;
while ((char *) (const char *)name.mb_str() == NULL) { while ((char *) (const char *)name.mb_str() == NULL) {
AudacityMessageBox( AudacityMessageBox(
XO( XO(
@ -719,13 +720,16 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
ext = ff.GetExt(); ext = ff.GetExt();
name = FileNames::SelectFile(FileNames::Operation::_None, name = FileNames::SelectFile(FileNames::Operation::_None,
XO("Specify New Filename:"), XO("Specify New Filename:"),
wxEmptyString, wxEmptyString,
name, name,
ext, ext,
ext.empty() ? wxT("*") : (wxT("*.") + ext), { ext.empty()
wxFD_SAVE | wxRESIZE_BORDER, ? FileNames::AllFiles
wxGetTopLevelParent(NULL)); : FileType{ {}, { ext } }
},
wxFD_SAVE | wxRESIZE_BORDER,
wxGetTopLevelParent(NULL));
} }
} }

@ -159,13 +159,13 @@ public:
static wxString static wxString
SelectFile(Operation op, // op matters only when default_path is empty SelectFile(Operation op, // op matters only when default_path is empty
const TranslatableString& message, const TranslatableString& message,
const FilePath& default_path, const FilePath& default_path,
const FilePath& default_filename, const FilePath& default_filename,
const FileExtension& default_extension, const FileExtension& default_extension,
const wxString& wildcard, const FileTypes& fileTypes,
int flags, int flags,
wxWindow *parent); wxWindow *parent);
// Useful functions for working with search paths // Useful functions for working with search paths
static void AddUniquePathToPathList(const FilePath &path, static void AddUniquePathToPathList(const FilePath &path,

@ -1066,13 +1066,13 @@ void FrequencyPlotDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxString fName = _("spectrum.txt"); wxString fName = _("spectrum.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export, fName = FileNames::SelectFile(FileNames::Operation::Export,
XO("Export Spectral Data As:"), XO("Export Spectral Data As:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
_("Text files (*.txt)|*.txt|All files|*"), { FileNames::TextFiles, FileNames::AllFiles },
wxFD_SAVE | wxRESIZE_BORDER, wxFD_SAVE | wxRESIZE_BORDER,
this); this);
if (fName.empty()) if (fName.empty())
return; return;

@ -628,13 +628,13 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
// Ask user for a filename // Ask user for a filename
wxString fileName = wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open, FileNames::SelectFile(FileNames::Operation::Open,
XO("Select a text file containing labels"), XO("Select a text file containing labels"),
wxEmptyString, // Path wxEmptyString, // Path
wxT(""), // Name wxT(""), // Name
wxT("txt"), // Extension wxT("txt"), // Extension
_("Text files (*.txt)|*.txt|All files|*"), { FileNames::TextFiles, FileNames::AllFiles },
wxRESIZE_BORDER, // Flags wxRESIZE_BORDER, // Flags
this); // Parent this); // Parent
// They gave us one... // They gave us one...
if (!fileName.empty()) { if (!fileName.empty()) {
@ -681,7 +681,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
wxT("*.txt"), { FileNames::TextFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
this); this);

@ -849,7 +849,7 @@ For an audio file that will open in other apps, use 'Export'.\n");
filename.GetPath(), filename.GetPath(),
filename.GetFullName(), filename.GetFullName(),
wxT("aup"), wxT("aup"),
_("Audacity projects") + wxT(" (*.aup)|*.aup"), { FileNames::AudacityProjects },
wxFD_SAVE | wxRESIZE_BORDER, wxFD_SAVE | wxRESIZE_BORDER,
&window); &window);

@ -1234,13 +1234,13 @@ void TagsEditorDialog::OnLoad(wxCommandEvent & WXUNUSED(event))
// Ask the user for the real name // Ask the user for the real name
fn = FileNames::SelectFile(FileNames::Operation::_None, fn = FileNames::SelectFile(FileNames::Operation::_None,
XO("Load Metadata As:"), XO("Load Metadata As:"),
FileNames::DataDir(), FileNames::DataDir(),
wxT("Tags.xml"), wxT("Tags.xml"),
wxT("xml"), wxT("xml"),
wxT("*.xml"), { FileNames::XMLFiles },
wxFD_OPEN | wxRESIZE_BORDER, wxFD_OPEN | wxRESIZE_BORDER,
this); this);
// User canceled... // User canceled...
if (fn.empty()) { if (fn.empty()) {
@ -1290,13 +1290,13 @@ void TagsEditorDialog::OnSave(wxCommandEvent & WXUNUSED(event))
// Ask the user for the real name // Ask the user for the real name
fn = FileNames::SelectFile(FileNames::Operation::_None, fn = FileNames::SelectFile(FileNames::Operation::_None,
XO("Save Metadata As:"), XO("Save Metadata As:"),
FileNames::DataDir(), FileNames::DataDir(),
wxT("Tags.xml"), wxT("Tags.xml"),
wxT("xml"), wxT("xml"),
wxT("*.xml"), { FileNames::XMLFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
this); this);
// User canceled... // User canceled...
if (fn.empty()) { if (fn.empty()) {

@ -322,7 +322,7 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even
m_fnAutoSaveFile.GetPath(), m_fnAutoSaveFile.GetPath(),
m_fnAutoSaveFile.GetFullName(), m_fnAutoSaveFile.GetFullName(),
wxT("aup"), wxT("aup"),
_("Audacity projects") + wxT(" (*.aup)|*.aup"), { FileNames::AudacityProjects },
wxFD_SAVE | wxRESIZE_BORDER, wxFD_SAVE | wxRESIZE_BORDER,
this); this);

@ -532,13 +532,13 @@ void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
wxString fName = wxT("contrast.txt"); wxString fName = wxT("contrast.txt");
fName = FileNames::SelectFile(FileNames::Operation::Export, fName = FileNames::SelectFile(FileNames::Operation::Export,
XO("Export Contrast Result As:"), XO("Export Contrast Result As:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
_("Text files (*.txt)|*.txt|All files|*"), { FileNames::TextFiles, FileNames::AllFiles },
wxFD_SAVE | wxRESIZE_BORDER, wxFD_SAVE | wxRESIZE_BORDER,
this); this);
if (fName.empty()) if (fName.empty())
return; return;

@ -1861,13 +1861,17 @@ void VSTEffect::ExportPresets()
// Passing a valid parent will cause some effects dialogs to malfunction // Passing a valid parent will cause some effects dialogs to malfunction
// upon returning from the FileNames::SelectFile(). // upon returning from the FileNames::SelectFile().
path = FileNames::SelectFile(FileNames::Operation::_None, path = FileNames::SelectFile(FileNames::Operation::_None,
XO("Save VST Preset As:"), XO("Save VST Preset As:"),
FileNames::DataDir(), FileNames::DataDir(),
wxEmptyString, wxEmptyString,
wxT("xml"), wxT("xml"),
wxT("Standard VST bank file (*.fxb)|*.fxb|Standard VST program file (*.fxp)|*.fxp|Audacity VST preset file (*.xml)|*.xml"), {
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, { XO("Standard VST bank file"), { wxT("fxb") }, true },
NULL); { XO("Standard VST program file"), { wxT("fxp") }, true },
{ XO("Audacity VST preset file"), { wxT("xml") }, true },
},
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
NULL);
// User canceled... // User canceled...
if (path.empty()) if (path.empty())
@ -1914,13 +1918,17 @@ void VSTEffect::ImportPresets()
// Ask the user for the real name // Ask the user for the real name
path = FileNames::SelectFile(FileNames::Operation::_None, path = FileNames::SelectFile(FileNames::Operation::_None,
XO("Load VST Preset:"), XO("Load VST Preset:"),
FileNames::DataDir(), FileNames::DataDir(),
wxEmptyString, wxEmptyString,
wxT("xml"), wxT("xml"),
wxT("VST preset files (*.fxb; *.fxp; *.xml)|*.fxb;*.fxp;*.xml"), { {
wxFD_OPEN | wxRESIZE_BORDER, XO("VST preset files"),
mParent); { wxT("fxb"), wxT("fxp"), wxT("xml") },
true
} },
wxFD_OPEN | wxRESIZE_BORDER,
mParent);
// User canceled... // User canceled...
if (path.empty()) if (path.empty())

@ -175,20 +175,23 @@ bool ExportCLOptions::TransferDataFromWindow()
void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event)) void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event))
{ {
wxString path; wxString path;
wxString ext; FileExtension ext;
FileNames::FileType type = FileNames::AllFiles;
#if defined(__WXMSW__) #if defined(__WXMSW__)
ext = wxT("exe"); ext = wxT("exe");
/* i18n-hint files that can be run as programs */
type = { XO("Executables"), { ext } };
#endif #endif
path = FileNames::SelectFile(FileNames::Operation::Open, path = FileNames::SelectFile(FileNames::Operation::Open,
XO("Find path to command"), XO("Find path to command"),
wxEmptyString, wxEmptyString,
wxEmptyString, wxEmptyString,
ext, ext,
ext.empty() ? wxT("*") : (wxT("*.") + ext), { type },
wxFD_OPEN | wxRESIZE_BORDER, wxFD_OPEN | wxRESIZE_BORDER,
this); this);
if (path.empty()) { if (path.empty()) {
return; return;
} }

@ -553,7 +553,8 @@ public:
#ifndef DISABLE_DYNAMIC_LOADING_LAME #ifndef DISABLE_DYNAMIC_LOADING_LAME
FindDialog(wxWindow *parent, wxString path, wxString name, wxString type) FindDialog(wxWindow *parent, wxString path, wxString name,
FileNames::FileTypes types)
: wxDialogWrapper(parent, wxID_ANY, : wxDialogWrapper(parent, wxID_ANY,
/* i18n-hint: LAME is the name of an MP3 converter and should not be translated*/ /* i18n-hint: LAME is the name of an MP3 converter and should not be translated*/
XO("Locate LAME")) XO("Locate LAME"))
@ -563,7 +564,7 @@ public:
mPath = path; mPath = path;
mName = name; mName = name;
mType = type; mTypes = std::move( types );
mLibPath.Assign(mPath, mName); mLibPath.Assign(mPath, mName);
@ -626,13 +627,13 @@ public:
auto question = XO("Where is %s?").Format( mName ); auto question = XO("Where is %s?").Format( mName );
wxString path = FileNames::SelectFile(FileNames::Operation::_None, wxString path = FileNames::SelectFile(FileNames::Operation::_None,
question, question,
mLibPath.GetPath(), mLibPath.GetPath(),
mLibPath.GetName(), mLibPath.GetName(),
wxT(""), wxT(""),
mType, mTypes,
wxFD_OPEN | wxRESIZE_BORDER, wxFD_OPEN | wxRESIZE_BORDER,
this); this);
if (!path.empty()) { if (!path.empty()) {
mLibPath = path; mLibPath = path;
mPathText->SetValue(path); mPathText->SetValue(path);
@ -658,7 +659,7 @@ private:
wxString mPath; wxString mPath;
wxString mName; wxString mName;
wxString mType; FileNames::FileTypes mTypes;
#endif // DISABLE_DYNAMIC_LOADING_LAME #endif // DISABLE_DYNAMIC_LOADING_LAME
wxTextCtrl *mPathText; wxTextCtrl *mPathText;
@ -800,7 +801,7 @@ public:
wxString GetLibraryVersion(); wxString GetLibraryVersion();
wxString GetLibraryName(); wxString GetLibraryName();
wxString GetLibraryPath(); wxString GetLibraryPath();
wxString GetLibraryTypeString(); FileNames::FileTypes GetLibraryTypes();
/* returns the number of samples PER CHANNEL to send for each call to EncodeBuffer */ /* returns the number of samples PER CHANNEL to send for each call to EncodeBuffer */
int InitializeStream(unsigned channels, int sampleRate); int InitializeStream(unsigned channels, int sampleRate);
@ -942,9 +943,9 @@ bool MP3Exporter::FindLibrary(wxWindow *parent)
} }
FindDialog fd(parent, FindDialog fd(parent,
path, path,
name, name,
GetLibraryTypeString()); GetLibraryTypes());
if (fd.ShowModal() == wxID_CANCEL) { if (fd.ShowModal() == wxID_CANCEL) {
return false; return false;
@ -1493,9 +1494,13 @@ wxString MP3Exporter::GetLibraryName()
return wxT("lame_enc.dll"); return wxT("lame_enc.dll");
} }
wxString MP3Exporter::GetLibraryTypeString() FileNames::FileTypes MP3Exporter::GetLibraryTypes()
{ {
return _("Only lame_enc.dll|lame_enc.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*"); return {
{ XO("Only lame_enc.dll"), { wxT("lame_enc.dll") } },
FileNames::DynamicLibraries,
FileNames::AllFiles
};
} }
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
@ -1527,11 +1532,20 @@ wxString MP3Exporter::GetLibraryName()
return wxT("libmp3lame.dylib"); return wxT("libmp3lame.dylib");
} }
wxString MP3Exporter::GetLibraryTypeString() FileNames::FileTypes MP3Exporter::GetLibraryTypes()
{ {
if (sizeof(void*) == 8) return {
return wxString(_("Only libmp3lame64bit.dylib|libmp3lame64bit.dylib|Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*")); (sizeof(void*) == 8)
return wxString(_("Only libmp3lame.dylib|libmp3lame.dylib|Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*")); ? FileNames::FileType{
XO("Only libmp3lame64bit.dylib"), { wxT("libmp3lame64bit.dylib") }
}
: FileNames::FileType{
XO("Only libmp3lame.dylib"), { wxT("libmp3lame.dylib") }
}
,
FileNames::DynamicLibraries,
FileNames::AllFiles
};
} }
#else //!__WXMAC__ #else //!__WXMAC__
@ -1547,9 +1561,14 @@ wxString MP3Exporter::GetLibraryName()
return wxT("libmp3lame.so.0"); return wxT("libmp3lame.so.0");
} }
wxString MP3Exporter::GetLibraryTypeString() FileNames::FileTypes MP3Exporter::GetLibraryTypes()
{ {
return wxString(_("Only libmp3lame.so.0|libmp3lame.so.0|Primary Shared Object files (*.so)|*.so|Extended Libraries (*.so*)|*.so*|All Files (*)|*")); return {
{ XO("Only libmp3lame.so.0"), { wxT("libmp3lame.so.0") } },
{ XO("Primary shared object files"), { wxT("so") }, true },
{ XO("Extended libraries"), { wxT("so*") }, true },
FileNames::AllFiles
};
} }
#endif #endif

@ -228,13 +228,13 @@ void OnExportLabels(const CommandContext &context)
fName = (*trackRange.rbegin())->GetName(); fName = (*trackRange.rbegin())->GetName();
fName = FileNames::SelectFile(FileNames::Operation::Export, fName = FileNames::SelectFile(FileNames::Operation::Export,
XO("Export Labels As:"), XO("Export Labels As:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
wxT("*.txt"), { FileNames::TextFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
&window); &window);
if (fName.empty()) if (fName.empty())
return; return;
@ -318,7 +318,10 @@ void OnExportMIDI(const CommandContext &context)
wxEmptyString, wxEmptyString,
fName, fName,
wxT("mid"), wxT("mid"),
_("MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro"), {
{ XO("MIDI file"), { wxT("mid") }, true },
{ XO("Allegro file"), { wxT("gro") }, true },
},
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
&window); &window);
@ -415,13 +418,13 @@ void OnImportLabels(const CommandContext &context)
wxString fileName = wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open, FileNames::SelectFile(FileNames::Operation::Open,
XO("Select a text file containing labels"), XO("Select a text file containing labels"),
wxEmptyString, // Path wxEmptyString, // Path
wxT(""), // Name wxT(""), // Name
wxT("txt"), // Extension wxT("txt"), // Extension
_("Text files (*.txt)|*.txt|All files|*"), { FileNames::TextFiles, FileNames::AllFiles },
wxRESIZE_BORDER, // Flags wxRESIZE_BORDER, // Flags
&window); // Parent &window); // Parent
if (!fileName.empty()) { if (!fileName.empty()) {
wxTextFile f; wxTextFile f;
@ -463,7 +466,15 @@ void OnImportMIDI(const CommandContext &context)
wxEmptyString, // Path wxEmptyString, // Path
wxT(""), // Name wxT(""), // Name
wxT(""), // Extension wxT(""), // Extension
_("MIDI and Allegro files (*.mid;*.midi;*.gro)|*.mid;*.midi;*.gro|MIDI files (*.mid;*.midi)|*.mid;*.midi|Allegro files (*.gro)|*.gro|All files|*"), {
{ XO("MIDI and Allegro files"),
{ wxT("mid"), wxT("midi"), wxT("gro"), }, true },
{ XO("MIDI files"),
{ wxT("mid"), wxT("midi"), }, true },
{ XO("Allegro files"),
{ wxT("gro"), }, true },
FileNames::AllFiles
},
wxRESIZE_BORDER, // Flags wxRESIZE_BORDER, // Flags
&window); // Parent &window); // Parent
@ -480,13 +491,13 @@ void OnImportRaw(const CommandContext &context)
wxString fileName = wxString fileName =
FileNames::SelectFile(FileNames::Operation::Open, FileNames::SelectFile(FileNames::Operation::Open,
XO("Select any uncompressed audio file"), XO("Select any uncompressed audio file"),
wxEmptyString, // Path wxEmptyString, // Path
wxT(""), // Name wxT(""), // Name
wxT(""), // Extension wxT(""), // Extension
_("All files|*"), { FileNames::AllFiles },
wxRESIZE_BORDER, // Flags wxRESIZE_BORDER, // Flags
&window); // Parent &window); // Parent
if (fileName.empty()) if (fileName.empty())
return; return;

@ -63,7 +63,7 @@ void ShowDiagnostics(
wxEmptyString, wxEmptyString,
defaultPath, defaultPath,
wxT("txt"), wxT("txt"),
wxT("*.txt"), { FileNames::TextFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
&window); &window);
if (!fName.empty()) if (!fName.empty())

@ -344,13 +344,13 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
wxString file = wxT("Audacity-keys.xml"); wxString file = wxT("Audacity-keys.xml");
file = FileNames::SelectFile(FileNames::Operation::Open, file = FileNames::SelectFile(FileNames::Operation::Open,
XO("Select an XML file containing Audacity keyboard shortcuts..."), XO("Select an XML file containing Audacity keyboard shortcuts..."),
wxEmptyString, wxEmptyString,
file, file,
wxT(""), wxT(""),
_("XML files (*.xml)|*.xml|All files|*"), { FileNames::XMLFiles, FileNames::AllFiles },
wxRESIZE_BORDER, wxRESIZE_BORDER,
this); this);
if (!file) { if (!file) {
return; return;
@ -373,13 +373,13 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
wxString file = wxT("Audacity-keys.xml"); wxString file = wxT("Audacity-keys.xml");
file = FileNames::SelectFile(FileNames::Operation::Export, file = FileNames::SelectFile(FileNames::Operation::Export,
XO("Export Keyboard Shortcuts As:"), XO("Export Keyboard Shortcuts As:"),
wxEmptyString, wxEmptyString,
file, file,
wxT("xml"), wxT("xml"),
_("XML files (*.xml)|*.xml|All files|*"), { FileNames::XMLFiles, FileNames::AllFiles },
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
this); this);
if (!file) { if (!file) {
return; return;