mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Fix inconsistencies in default extension passed to SelectFile...
... It must be empty, or else one extension not including the leading dot; then correct the string passed to FileSelector in lib-src, which should be a filename pattern
This commit is contained in:
parent
ccefe8da5f
commit
3f88df06ec
@ -465,14 +465,17 @@ 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 wxString& default_extension,
|
const FileExtension& default_extension,
|
||||||
const wxString& wildcard,
|
const wxString& wildcard,
|
||||||
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;
|
||||||
|
if ( !default_extension.empty() )
|
||||||
|
filter = wxT("*.") + default_extension;
|
||||||
return FileSelector(
|
return FileSelector(
|
||||||
message.Translation(), path, default_filename, default_extension,
|
message.Translation(), path, default_filename, filter,
|
||||||
wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord);
|
wildcard, flags, parent, wxDefaultCoord, wxDefaultCoord);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -624,7 +627,7 @@ char *FileNames::VerifyFilename(const wxString &s, bool input)
|
|||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
name,
|
name,
|
||||||
ext,
|
ext,
|
||||||
wxT("*.") + ext,
|
ext.empty() ? wxT("*") : (wxT("*.") + ext),
|
||||||
wxFD_SAVE | wxRESIZE_BORDER,
|
wxFD_SAVE | wxRESIZE_BORDER,
|
||||||
wxGetTopLevelParent(NULL));
|
wxGetTopLevelParent(NULL));
|
||||||
}
|
}
|
||||||
|
@ -130,9 +130,7 @@ public:
|
|||||||
const TranslatableString& message,
|
const TranslatableString& message,
|
||||||
const FilePath& default_path,
|
const FilePath& default_path,
|
||||||
const FilePath& default_filename,
|
const FilePath& default_filename,
|
||||||
// empty, or one extension, or multiple extensions joined with
|
const FileExtension& default_extension,
|
||||||
// '|', extensions including the leading dot:
|
|
||||||
const wxString& default_extension,
|
|
||||||
const wxString& wildcard,
|
const wxString& wildcard,
|
||||||
int flags,
|
int flags,
|
||||||
wxWindow *parent);
|
wxWindow *parent);
|
||||||
|
@ -631,7 +631,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
|
|||||||
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|*"),
|
_("Text files (*.txt)|*.txt|All files|*"),
|
||||||
wxRESIZE_BORDER, // Flags
|
wxRESIZE_BORDER, // Flags
|
||||||
this); // Parent
|
this); // Parent
|
||||||
|
@ -178,7 +178,7 @@ void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxString ext;
|
wxString ext;
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
ext = wxT(".exe");
|
ext = wxT("exe");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path = FileNames::SelectFile(FileNames::Operation::Open,
|
path = FileNames::SelectFile(FileNames::Operation::Open,
|
||||||
@ -186,7 +186,7 @@ void ExportCLOptions::OnBrowse(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
ext,
|
ext,
|
||||||
wxT("*") + ext,
|
ext.empty() ? wxT("*") : (wxT("*.") + ext),
|
||||||
wxFD_OPEN | wxRESIZE_BORDER,
|
wxFD_OPEN | wxRESIZE_BORDER,
|
||||||
this);
|
this);
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
|
@ -318,7 +318,7 @@ void OnExportMIDI(const CommandContext &context)
|
|||||||
XO("Export MIDI As:"),
|
XO("Export MIDI As:"),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
fName,
|
fName,
|
||||||
wxT(".mid|.gro"),
|
wxT("mid"),
|
||||||
_("MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro"),
|
_("MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro"),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
|
||||||
&window);
|
&window);
|
||||||
@ -423,7 +423,7 @@ void OnImportLabels(const CommandContext &context)
|
|||||||
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|*"),
|
_("Text files (*.txt)|*.txt|All files|*"),
|
||||||
wxRESIZE_BORDER, // Flags
|
wxRESIZE_BORDER, // Flags
|
||||||
&window); // Parent
|
&window); // Parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user