diff --git a/src/FileNames.cpp b/src/FileNames.cpp index 7add4970c..82adcfa4a 100644 --- a/src/FileNames.cpp +++ b/src/FileNames.cpp @@ -465,14 +465,17 @@ FileNames::SelectFile(Operation op, const TranslatableString& message, const FilePath& default_path, const FilePath& default_filename, - const wxString& default_extension, + const FileExtension& default_extension, const wxString& wildcard, int flags, wxWindow *parent) { return WithDefaultPath(op, default_path, [&](const FilePath &path) { + wxString filter; + if ( !default_extension.empty() ) + filter = wxT("*.") + default_extension; return FileSelector( - message.Translation(), path, default_filename, default_extension, + message.Translation(), path, default_filename, filter, wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord); }); } @@ -624,7 +627,7 @@ char *FileNames::VerifyFilename(const wxString &s, bool input) wxEmptyString, name, ext, - wxT("*.") + ext, + ext.empty() ? wxT("*") : (wxT("*.") + ext), wxFD_SAVE | wxRESIZE_BORDER, wxGetTopLevelParent(NULL)); } diff --git a/src/FileNames.h b/src/FileNames.h index 05d4556c3..bdb3b597b 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -130,9 +130,7 @@ public: const TranslatableString& message, const FilePath& default_path, const FilePath& default_filename, - // empty, or one extension, or multiple extensions joined with - // '|', extensions including the leading dot: - const wxString& default_extension, + const FileExtension& default_extension, const wxString& wildcard, int flags, wxWindow *parent); diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index f012d815f..f2228ae31 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -631,7 +631,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event)) XO("Select a text file containing labels"), wxEmptyString, // Path wxT(""), // Name - wxT(".txt"), // Extension + wxT("txt"), // Extension _("Text files (*.txt)|*.txt|All files|*"), wxRESIZE_BORDER, // Flags this); // Parent diff --git a/src/export/ExportCL.cpp b/src/export/ExportCL.cpp index 29761eef4..61ae2c079 100644 --- a/src/export/ExportCL.cpp +++ b/src/export/ExportCL.cpp @@ -178,7 +178,7 @@ void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event)) wxString ext; #if defined(__WXMSW__) - ext = wxT(".exe"); + ext = wxT("exe"); #endif path = FileNames::SelectFile(FileNames::Operation::Open, @@ -186,7 +186,7 @@ void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event)) wxEmptyString, wxEmptyString, ext, - wxT("*") + ext, + ext.empty() ? wxT("*") : (wxT("*.") + ext), wxFD_OPEN | wxRESIZE_BORDER, this); if (path.empty()) { diff --git a/src/menus/FileMenus.cpp b/src/menus/FileMenus.cpp index ebcead43a..06c12fb8f 100644 --- a/src/menus/FileMenus.cpp +++ b/src/menus/FileMenus.cpp @@ -318,7 +318,7 @@ void OnExportMIDI(const CommandContext &context) XO("Export MIDI As:"), wxEmptyString, fName, - wxT(".mid|.gro"), + wxT("mid"), _("MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, &window); @@ -423,7 +423,7 @@ void OnImportLabels(const CommandContext &context) XO("Select a text file containing labels"), wxEmptyString, // Path wxT(""), // Name - wxT(".txt"), // Extension + wxT("txt"), // Extension _("Text files (*.txt)|*.txt|All files|*"), wxRESIZE_BORDER, // Flags &window); // Parent