mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-10 00:51:13 +02:00
Define FileDialogWrapper, with localized default prompt and name
This commit is contained in:
parent
cf4b9eb5c8
commit
384300016d
@ -280,7 +280,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
auto path = FileNames::FindDefaultPath(FileNames::Operation::Open);
|
||||
FileDialog dlog(this,
|
||||
FileDialogWrapper dlog(this,
|
||||
prompt,
|
||||
path,
|
||||
wxT(""),
|
||||
|
@ -2815,7 +2815,7 @@ wxArrayString AudacityProject::ShowOpenDialog(const wxString &extraformat, const
|
||||
// Construct and display the file dialog
|
||||
wxArrayString selected;
|
||||
|
||||
FileDialog dlog(NULL,
|
||||
FileDialogWrapper dlog(NULL,
|
||||
_("Select one or more files"),
|
||||
path,
|
||||
wxT(""),
|
||||
|
@ -3482,7 +3482,7 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
FileDialog filePicker(this, _("Choose an EQ curve file"), FileNames::DataDir(), wxT(""), _("xml files (*.xml;*.XML)|*.xml;*.XML"));
|
||||
FileDialogWrapper filePicker(this, _("Choose an EQ curve file"), FileNames::DataDir(), wxT(""), _("xml files (*.xml;*.XML)|*.xml;*.XML"));
|
||||
wxString fileName = wxT("");
|
||||
if( filePicker.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
@ -3502,7 +3502,7 @@ void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
FileDialog filePicker(this, _("Export EQ curves as..."), FileNames::DataDir(), wxT(""), wxT("*.XML"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
|
||||
FileDialogWrapper filePicker(this, _("Export EQ curves as..."), FileNames::DataDir(), wxT(""), wxT("*.XML"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
|
||||
wxString fileName = wxT("");
|
||||
if( filePicker.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
@ -2307,7 +2307,7 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog dlog(mUIParent,
|
||||
FileDialogWrapper dlog(mUIParent,
|
||||
_("Load Nyquist script"),
|
||||
mFileName.GetPath(),
|
||||
wxEmptyString,
|
||||
@ -2329,7 +2329,7 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
|
||||
|
||||
void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
FileDialog dlog(mUIParent,
|
||||
FileDialogWrapper dlog(mUIParent,
|
||||
_("Save Nyquist script"),
|
||||
mFileName.GetPath(),
|
||||
mFileName.GetFullName(),
|
||||
|
@ -537,7 +537,7 @@ bool Exporter::GetFilename()
|
||||
auto useFileName = mFilename;
|
||||
if (!useFileName.HasExt())
|
||||
useFileName.SetExt(defext);
|
||||
FileDialog fd(mProject,
|
||||
FileDialogWrapper fd(mProject,
|
||||
mFileDialogTitle,
|
||||
mFilename.GetPath(),
|
||||
useFileName.GetFullName(),
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "../SampleFormat.h"
|
||||
#include "../widgets/wxPanelWrapper.h"
|
||||
|
||||
class FileDialog;
|
||||
class FileDialogWrapper;
|
||||
class wxFileCtrlEvent;
|
||||
class wxMemoryDC;
|
||||
class wxStaticText;
|
||||
@ -187,7 +187,7 @@ private:
|
||||
|
||||
private:
|
||||
wxString mFormatName;
|
||||
FileDialog *mDialog;
|
||||
FileDialogWrapper *mDialog;
|
||||
wxString mFileDialogTitle;
|
||||
AudacityProject *mProject;
|
||||
std::unique_ptr<MixerSpec> mMixerSpec;
|
||||
|
@ -1856,7 +1856,7 @@ void ExportFFmpegOptions::OnLoadPreset(wxCommandEvent& WXUNUSED(event))
|
||||
void ExportFFmpegOptions::OnImportPresets(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString path;
|
||||
FileDialog dlg(this,
|
||||
FileDialogWrapper dlg(this,
|
||||
_("Select xml file with presets to import"),
|
||||
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
||||
wxEmptyString,
|
||||
@ -1875,7 +1875,7 @@ void ExportFFmpegOptions::OnImportPresets(wxCommandEvent& WXUNUSED(event))
|
||||
void ExportFFmpegOptions::OnExportPresets(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString path;
|
||||
FileDialog dlg(this,
|
||||
FileDialogWrapper dlg(this,
|
||||
_("Select xml file to export presets into"),
|
||||
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
||||
wxEmptyString,
|
||||
|
@ -137,4 +137,45 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#include "../lib-src/FileDialog/FileDialog.h"
|
||||
|
||||
class FileDialogWrapper : public wxTabTraversalWrapper<FileDialog>
|
||||
{
|
||||
public:
|
||||
FileDialogWrapper() {}
|
||||
|
||||
// Constructor with no modal flag - the new convention.
|
||||
FileDialogWrapper(
|
||||
wxWindow *parent,
|
||||
const wxString& message = _("Select a file"),
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = wxFD_DEFAULT_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
// Important: default window name localizes!
|
||||
const wxString& name = _("File Dialog"))
|
||||
: wxTabTraversalWrapper<FileDialog>
|
||||
{ parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name }
|
||||
{}
|
||||
|
||||
void Create(
|
||||
wxWindow *parent,
|
||||
const wxString& message = _("Select a file"),
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = wxFD_DEFAULT_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
// Important: default window name localizes!
|
||||
const wxString& name = _("File Dialog"))
|
||||
{
|
||||
return wxTabTraversalWrapper<FileDialog>::Create(
|
||||
parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user