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

Define AudacityMessageDialog wrapper around wxMessageDialog...

... Prohibiting use of the default caption which is unlocalized.  (But we
didn't use it in fact anywhere.)
This commit is contained in:
Paul Licameli 2017-10-12 12:21:52 -04:00
parent af290d73c0
commit e8b875ff81
9 changed files with 31 additions and 14 deletions

View File

@ -2754,7 +2754,7 @@ void AudioIO::StopStream()
// Bug 96: Only warn for the first track. // Bug 96: Only warn for the first track.
if( i==0 ) if( i==0 )
{ {
wxMessageDialog m(NULL, _( AudacityMessageDialog m(NULL, _(
"Latency Correction setting has caused the recorded audio to be hidden before zero.\nAudacity has brought it back to start at zero.\nYou may have to use the Time Shift Tool (<---> or F5) to drag the track to the right place."), "Latency Correction setting has caused the recorded audio to be hidden before zero.\nAudacity has brought it back to start at zero.\nYou may have to use the Time Shift Tool (<---> or F5) to drag the track to the right place."),
_("Latency problem"), wxOK); _("Latency problem"), wxOK);
m.ShowModal(); m.ShowModal();

View File

@ -831,7 +831,7 @@ void EditChainsDialog::OnRemove(wxCommandEvent & WXUNUSED(event))
} }
wxString name = mChains->GetItemText(item); wxString name = mChains->GetItemText(item);
wxMessageDialog m(this, AudacityMessageDialog m(this,
/*i18n-hint: %s will be replaced by the name of a file.*/ /*i18n-hint: %s will be replaced by the name of a file.*/
wxString::Format(_("Are you sure you want to delete %s?"), name.c_str()), wxString::Format(_("Are you sure you want to delete %s?"), name.c_str()),
GetTitle(), GetTitle(),

View File

@ -4300,7 +4300,7 @@ bool AudacityProject::SaveAs(const wxString & newFileName, bool bWantSaveCompres
//We should only overwrite it if this project already has the same name, where the user //We should only overwrite it if this project already has the same name, where the user
//simply chose to use the save as command although the save command would have the effect. //simply chose to use the save as command although the save command would have the effect.
if( !bOwnsNewAupName && wxFileExists(newFileName)) { if( !bOwnsNewAupName && wxFileExists(newFileName)) {
wxMessageDialog m( AudacityMessageDialog m(
NULL, NULL,
_("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
_("Error Saving Project"), _("Error Saving Project"),
@ -4401,7 +4401,7 @@ For an audio file that will open in other apps, use 'Export'.\n"),
//We should only overwrite it if this project already has the same name, where the user //We should only overwrite it if this project already has the same name, where the user
//simply chose to use the save as command although the save command would have the effect. //simply chose to use the save as command although the save command would have the effect.
if (!bOwnsNewAupName && filename.FileExists()) { if (!bOwnsNewAupName && filename.FileExists()) {
wxMessageDialog m( AudacityMessageDialog m(
NULL, NULL,
_("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
_("Error Saving Project"), _("Error Saving Project"),

View File

@ -309,7 +309,7 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even
// If project already exists then abort - we do not allow users to overwrite an existing project // If project already exists then abort - we do not allow users to overwrite an existing project
// unless it is the current project. // unless it is the current project.
if (wxFileExists(fName) && (pProject->GetFileName() != fName)) { if (wxFileExists(fName) && (pProject->GetFileName() != fName)) {
wxMessageDialog m( AudacityMessageDialog m(
NULL, NULL,
_("The selected file name could not be used\nfor Timer Recording because it \ _("The selected file name could not be used\nfor Timer Recording because it \
would overwrite another project.\nPlease try again and select an original name."), would overwrite another project.\nPlease try again and select an original name."),
@ -416,7 +416,7 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
sPlannedTime, sPlannedTime,
sRemainingTime); sRemainingTime);
wxMessageDialog dlgMessage(NULL, AudacityMessageDialog dlgMessage(NULL,
sMessage, sMessage,
_("Timer Recording Disk Space Warning"), _("Timer Recording Disk Space Warning"),
wxYES_NO | wxNO_DEFAULT | wxICON_WARNING); wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);

View File

@ -816,7 +816,7 @@ void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCoun
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD); text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD); text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);
text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD); text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD);
wxMessageDialog{ NULL, text, AudacityMessageDialog{ NULL, text,
_("Calibration Complete"), _("Calibration Complete"),
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
wxPoint(-1, -1) } wxPoint(-1, -1) }

View File

@ -54,7 +54,7 @@ bool ContrastDialog::GetDB(float &dB)
while (t) { while (t) {
numberSelecteTracks++; numberSelecteTracks++;
if (numberSelecteTracks > 1 && !isStereo) { if (numberSelecteTracks > 1 && !isStereo) {
wxMessageDialog m(NULL, _("You can only measure one track at a time."), _("Error"), wxOK); AudacityMessageDialog m(NULL, _("You can only measure one track at a time."), _("Error"), wxOK);
m.ShowModal(); m.ShowModal();
return false; return false;
} }
@ -73,14 +73,14 @@ bool ContrastDialog::GetDB(float &dB)
if(SelT0 > SelT1) if(SelT0 > SelT1)
{ {
wxMessageDialog m(NULL, _("Invalid audio selection.\nPlease ensure that audio is selected."), _("Error"), wxOK); AudacityMessageDialog m(NULL, _("Invalid audio selection.\nPlease ensure that audio is selected."), _("Error"), wxOK);
m.ShowModal(); m.ShowModal();
return false; return false;
} }
if(SelT0 == SelT1) if(SelT0 == SelT1)
{ {
wxMessageDialog m(NULL, _("Nothing to measure.\nPlease select a section of a track."), _("Error"), wxOK); AudacityMessageDialog m(NULL, _("Nothing to measure.\nPlease select a section of a track."), _("Error"), wxOK);
m.ShowModal(); m.ShowModal();
return false; return false;
} }
@ -95,7 +95,7 @@ bool ContrastDialog::GetDB(float &dB)
rms = (meanSq > 0.0)? sqrt(meanSq/(double)numberSelecteTracks) : 0.0; rms = (meanSq > 0.0)? sqrt(meanSq/(double)numberSelecteTracks) : 0.0;
if(numberSelecteTracks == 0) { if(numberSelecteTracks == 0) {
wxMessageDialog m(NULL, _("Please select an audio track."), _("Error"), wxOK); AudacityMessageDialog m(NULL, _("Please select an audio track."), _("Error"), wxOK);
m.ShowModal(); m.ShowModal();
return false; return false;
} }

View File

@ -3605,7 +3605,7 @@ void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
name = text->GetValue(); name = text->GetValue();
if (name.IsEmpty()) if (name.IsEmpty())
{ {
wxMessageDialog md(this, AudacityMessageDialog md(this,
_("You must specify a name"), _("You must specify a name"),
_("Save Preset")); _("Save Preset"));
md.Center(); md.Center();
@ -3615,7 +3615,7 @@ void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
if (mUserPresets.Index(name) != wxNOT_FOUND) if (mUserPresets.Index(name) != wxNOT_FOUND)
{ {
wxMessageDialog md(this, AudacityMessageDialog md(this,
_("Preset already exists.\n\nReplace?"), _("Preset already exists.\n\nReplace?"),
_("Save Preset"), _("Save Preset"),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION); wxYES_NO | wxCANCEL | wxICON_EXCLAMATION);

View File

@ -117,4 +117,20 @@ public:
{} {}
}; };
// Similarly wrap wxMessageDialog, to prohibit the default,
// unlocalized caption
class AudacityMessageDialog : public wxTabTraversalWrapper< wxMessageDialog >
{
public:
AudacityMessageDialog(
wxWindow *parent,
const wxString& message,
const wxString& caption, // don't use = wxMessageBoxCaptionStr,
long style = wxOK|wxCENTRE,
const wxPoint& pos = wxDefaultPosition)
: wxTabTraversalWrapper< wxMessageDialog>
{ parent, message, caption, style, pos }
{}
};
#endif // __AUDACITY_ERRORDIALOG__ #endif // __AUDACITY_ERRORDIALOG__

View File

@ -49,6 +49,7 @@
#include <wx/window.h> #include <wx/window.h>
#include "ProgressDialog.h" #include "ProgressDialog.h"
#include "ErrorDialog.h"
#include "../Prefs.h" #include "../Prefs.h"
// This really should be a Preferences setting // This really should be a Preferences setting
@ -1573,7 +1574,7 @@ bool ProgressDialog::ConfirmAction(const wxString & sPrompt,
return true; return true;
} }
wxMessageDialog dlgMessage(this, AudacityMessageDialog dlgMessage(this,
sPrompt, sPrompt,
sTitle, sTitle,
wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT | wxSTAY_ON_TOP); wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT | wxSTAY_ON_TOP);