From af290d73c0d90e89a8624cf15081a9c357559484 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 12 Oct 2017 11:49:57 -0400 Subject: [PATCH] Define AudacityTextEntryDialog wrapper around wxTextEntryDialog... ... Prohibiting use of the default caption which is unlocalized. (But we didn't use it in fact anywhere.) --- src/AudacityApp.cpp | 2 +- src/BatchProcessDialog.cpp | 2 +- src/LabelDialog.cpp | 2 +- src/effects/Equalization.cpp | 2 +- src/export/ExportMultiple.cpp | 2 +- src/widgets/ErrorDialog.h | 19 +++++++++++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index aa4237a90..1962488b5 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1137,7 +1137,7 @@ void AudacityApp::GenerateCrashReport(wxDebugReport::Context ctx) if (ok && rpt.Process()) { - wxTextEntryDialog dlg(NULL, + AudacityTextEntryDialog dlg(NULL, _("Report generated to:"), _("Audacity Support Data"), rpt.GetCompressedFileName(), diff --git a/src/BatchProcessDialog.cpp b/src/BatchProcessDialog.cpp index 6a68f6872..5035048a8 100644 --- a/src/BatchProcessDialog.cpp +++ b/src/BatchProcessDialog.cpp @@ -779,7 +779,7 @@ void EditChainsDialog::OnChainsEndEdit(wxListEvent &event) void EditChainsDialog::OnAdd(wxCommandEvent & WXUNUSED(event)) { while (true) { - wxTextEntryDialog d(this, + AudacityTextEntryDialog d(this, _("Enter name of new chain"), _("Name of new chain")); d.SetName(d.GetTitle()); diff --git a/src/LabelDialog.cpp b/src/LabelDialog.cpp index 45ac7bb64..8ad348657 100644 --- a/src/LabelDialog.cpp +++ b/src/LabelDialog.cpp @@ -774,7 +774,7 @@ void LabelDialog::OnChangeTrack(wxGridEvent & WXUNUSED(event), int row, RowData // User selected the "New..." choice so ask for a NEW name if (mTrackNames.Index(val) == 0) { - wxTextEntryDialog d(this, + AudacityTextEntryDialog d(this, _("New Label Track"), _("Enter track name"), /* i18n-hint: (noun) it's the name of a kind of track.*/ diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 8495135e6..4441686f0 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -3315,7 +3315,7 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) { // Show the dialog and bail if the user cancels bad = false; // build the dialog - wxTextEntryDialog dlg( this, + AudacityTextEntryDialog dlg( this, _("Rename '") + mEditCurves[ item ].Name + _("' to..."), _("Rename...") ); dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST ); diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 06e145c49..56cf4cfd3 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -1006,7 +1006,7 @@ wxString ExportMultiple::MakeFileName(const wxString &input) excluded.c_str()); } - wxTextEntryDialog dlg( this, msg, _("Save As..."), newname ); + AudacityTextEntryDialog dlg( this, msg, _("Save As..."), newname ); // And tell the validator about excluded chars diff --git a/src/widgets/ErrorDialog.h b/src/widgets/ErrorDialog.h index 0515e9652..5f6e1150b 100644 --- a/src/widgets/ErrorDialog.h +++ b/src/widgets/ErrorDialog.h @@ -98,4 +98,23 @@ inline int AudacityMessageBox(const wxString& message, return ::wxMessageBox(message, caption, style, parent, x, y); } +// Similarly wrap wxTextEntryDialog, to prohibit the default, +// unlocalized caption +#include + +class AudacityTextEntryDialog : public wxTabTraversalWrapper< wxTextEntryDialog > +{ +public: + AudacityTextEntryDialog( + wxWindow *parent, + const wxString& message, + const wxString& caption, // don't use = wxGetTextFromUserPromptStr, + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition) + : wxTabTraversalWrapper< wxTextEntryDialog> + { parent, message, caption, value, style, pos } + {} +}; + #endif // __AUDACITY_ERRORDIALOG__