From 7766d9a192a9d28f8207c95cdd7ce08464116525 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 1 Feb 2018 21:37:34 -0500 Subject: [PATCH] AddCheckBox takes a bool for initial state, not string --- src/Benchmark.cpp | 4 ++-- src/FFmpeg.cpp | 2 +- src/FreqWindow.cpp | 3 +-- src/Screenshot.cpp | 2 +- src/ShuttleGui.cpp | 15 ++++++++------- src/ShuttleGui.h | 4 ++-- src/SplashDialog.cpp | 2 +- src/TimerRecordDialog.cpp | 4 ++-- src/effects/Amplify.cpp | 2 +- src/effects/BassTreble.cpp | 2 +- src/effects/ChangePitch.cpp | 2 +- src/effects/ChangeTempo.cpp | 2 +- src/effects/Compressor.cpp | 4 ++-- src/effects/Distortion.cpp | 2 +- src/effects/Equalization.cpp | 4 ++-- src/effects/Normalize.cpp | 8 ++++---- src/effects/Reverb.cpp | 2 +- src/effects/ScoreAlignDialog.cpp | 4 ++-- src/effects/TruncSilence.cpp | 2 +- src/effects/nyquist/Nyquist.cpp | 2 +- src/effects/vamp/VampEffect.cpp | 2 +- src/export/ExportMP3.cpp | 2 +- src/export/ExportMultiple.cpp | 2 +- src/widgets/Warning.cpp | 2 +- 24 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Benchmark.cpp b/src/Benchmark.cpp index 64d2d6682..4a6c3e5f1 100644 --- a/src/Benchmark.cpp +++ b/src/Benchmark.cpp @@ -202,12 +202,12 @@ void BenchmarkDialog::MakeBenchmarkDialog() // item = S.AddCheckBox(_("Show detailed info about each block file"), - wxT("false")); + false); item->SetValidator(wxGenericValidator(&mBlockDetail)); // item = S.AddCheckBox(_("Show detailed info about each editing operation"), - wxT("false")); + false); item->SetValidator(wxGenericValidator(&mEditDetail)); // diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 145965353..843e0441e 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -586,7 +586,7 @@ to download or locate the FFmpeg libraries." int dontShowDlg = 0; gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0); - mDontShow = S.AddCheckBox(_("Do not show this warning again"),dontShowDlg ? wxT("true") : wxT("false")); + mDontShow = S.AddCheckBox(_("Do not show this warning again"),dontShowDlg); S.AddStandardButtons(eOkButton); } diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 4e773414c..2f25cd240 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -417,8 +417,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, mPeakText = S.AddTextBox( {}, wxT(""), 10); S.AddSpace(5); - mGridOnOff = S.Id(GridOnOffID).AddCheckBox(_("&Grids"), wxT("false")); - mGridOnOff->SetValue(mDrawGrid); + mGridOnOff = S.Id(GridOnOffID).AddCheckBox(_("&Grids"), mDrawGrid); } S.EndMultiColumn(); } diff --git a/src/Screenshot.cpp b/src/Screenshot.cpp index 4fe1816cc..ef9f0b09a 100644 --- a/src/Screenshot.cpp +++ b/src/Screenshot.cpp @@ -369,7 +369,7 @@ void ScreenFrame::PopulateOrExchange(ShuttleGui & S) { mDelayCheckBox = S.Id(IdDelayCheckBox).AddCheckBox (_("Wait 5 seconds and capture frontmost window/dialog"), - _("false")); + false); } S.EndHorizontalLay(); } diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 6dd3ec7fe..28a8dce7d 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -298,7 +298,7 @@ wxWindow * ShuttleGuiBase::AddWindow(wxWindow * pWindow, int Flags ) return pWindow; } -wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, const wxString &Selected) +wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, bool Selected) { HandleOptionality( Prompt ); wxString realPrompt = Prompt; @@ -315,7 +315,7 @@ wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, const wxString miProp=0; mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, realPrompt, wxDefaultPosition, wxDefaultSize, Style( 0 )); - pCheckBox->SetValue(Selected == wxT("true")); + pCheckBox->SetValue(Selected); if (realPrompt.empty()) { // NVDA 2018.3 does not read controls which are buttons, check boxes or radio buttons which have // an accessibility name which is empty. Bug 1980. @@ -332,7 +332,7 @@ wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, const wxString /// For a consistant two-column layout we want labels on the left and /// controls on the right. CheckBoxes break that rule, so we fake it by /// placing a static text label and then a tick box with an empty label. -wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight( const wxString &Prompt, const wxString &Selected) +wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight( const wxString &Prompt, bool Selected) { HandleOptionality( Prompt ); AddPrompt( Prompt ); @@ -343,7 +343,7 @@ wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight( const wxString &Prompt, const w miProp=0; mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, wxT(""), wxDefaultPosition, wxDefaultSize, Style( 0 )); - pCheckBox->SetValue(Selected==wxT("true")); + pCheckBox->SetValue(Selected); pCheckBox->SetName(wxStripMenuCodes(Prompt)); UpdateSizers(); return pCheckBox; @@ -1111,7 +1111,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & W HandleOptionality( Prompt ); // The Add function does a UseUpId(), so don't do it here in that case. if( mShuttleMode == eIsCreating ) - return AddCheckBox( Prompt, WrappedRef.ReadAsString()); + return AddCheckBox( Prompt, WrappedRef.ReadAsString() == wxT("true")); UseUpId(); @@ -1153,7 +1153,8 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, WrappedT HandleOptionality( Prompt ); // The Add function does a UseUpId(), so don't do it here in that case. if( mShuttleMode == eIsCreating ) - return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString()); + return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() == wxT("true")); + UseUpId(); wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg); @@ -1505,7 +1506,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, bool &Va // Only does anything different if it's creating. WrappedType WrappedRef( Var ); if( mShuttleMode == eIsCreating ) - return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() ); + return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() == wxT("true") ); return TieCheckBox( Prompt, WrappedRef ); } diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index c8d1aca6b..b74cc2f06 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -108,8 +108,8 @@ public: wxListCtrl * AddListControl(); wxListCtrl * AddListControlReportMode(); wxGrid * AddGrid(); - wxCheckBox * AddCheckBox( const wxString &Prompt, const wxString &Selected); - wxCheckBox * AddCheckBoxOnRight( const wxString &Prompt, const wxString &Selected); + wxCheckBox * AddCheckBox( const wxString &Prompt, bool Selected); + wxCheckBox * AddCheckBoxOnRight( const wxString &Prompt, bool Selected); wxComboBox * AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayStringEx & choices, long style = 0 ); wxChoice * AddChoice( const wxString &Prompt, const wxArrayStringEx &choices, int Selected = -1 ); wxMenuBar * AddMenuBar( ); diff --git a/src/SplashDialog.cpp b/src/SplashDialog.cpp index fbb3ea411..1c3babd3d 100644 --- a/src/SplashDialog.cpp +++ b/src/SplashDialog.cpp @@ -134,7 +134,7 @@ void SplashDialog::Populate( ShuttleGui & S ) S.SetStretchyCol( 1 );// Column 1 is stretchy... { S.SetBorder( 5 ); - S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), bShow ? wxT("false") : wxT("true") ); + S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), !bShow ); wxButton *ok = safenew wxButton(S.GetParent(), wxID_OK); ok->SetDefault(); S.SetBorder( 5 ); diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index ff5a20814..be444856d 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -891,7 +891,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) { // If checked, the project will be saved when the recording is completed m_pTimerAutoSaveCheckBoxCtrl = S.Id(ID_AUTOSAVE_CHECKBOX).AddCheckBox(_("Enable &Automatic Save?"), - (bAutoSave ? "true" : "false")); + bAutoSave); S.StartMultiColumn(3, wxEXPAND); { wxString sInitialValue; @@ -914,7 +914,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S) S.StartStatic(_("Automatic Export"), true); { - m_pTimerAutoExportCheckBoxCtrl = S.Id(ID_AUTOEXPORT_CHECKBOX).AddCheckBox(_("Enable Automatic &Export?"), (bAutoExport ? "true" : "false")); + m_pTimerAutoExportCheckBoxCtrl = S.Id(ID_AUTOEXPORT_CHECKBOX).AddCheckBox(_("Enable Automatic &Export?"), bAutoExport); S.StartMultiColumn(3, wxEXPAND); { S.AddPrompt(_("Export Project As:")); diff --git a/src/effects/Amplify.cpp b/src/effects/Amplify.cpp index 0e20a2ed2..0289023e6 100644 --- a/src/effects/Amplify.cpp +++ b/src/effects/Amplify.cpp @@ -269,7 +269,7 @@ void EffectAmplify::PopulateOrExchange(ShuttleGui & S) // Clipping S.StartHorizontalLay(wxCENTER); { - mClip = S.Id(ID_Clip).AddCheckBox(_("Allow clipping"), wxT("false")); + mClip = S.Id(ID_Clip).AddCheckBox(_("Allow clipping"), false); if (IsBatchProcessing()) { mClip->Enable(false); diff --git a/src/effects/BassTreble.cpp b/src/effects/BassTreble.cpp index 49ec98a1d..37c443127 100644 --- a/src/effects/BassTreble.cpp +++ b/src/effects/BassTreble.cpp @@ -272,7 +272,7 @@ void EffectBassTreble::PopulateOrExchange(ShuttleGui & S) { // Link checkbox mLinkCheckBox = S.Id(ID_Link).AddCheckBox(_("&Link Volume control to Tone controls"), - DEF_Link ? wxT("true") : wxT("false")); + DEF_Link); } S.EndMultiColumn(); } diff --git a/src/effects/ChangePitch.cpp b/src/effects/ChangePitch.cpp index a48c8e084..b1b356e24 100644 --- a/src/effects/ChangePitch.cpp +++ b/src/effects/ChangePitch.cpp @@ -347,7 +347,7 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2); { mUseSBSMSCheckBox = S.AddCheckBox(_("Use high quality stretching (slow)"), - mUseSBSMS? wxT("true") : wxT("false")); + mUseSBSMS); mUseSBSMSCheckBox->SetValidator(wxGenericValidator(&mUseSBSMS)); } S.EndMultiColumn(); diff --git a/src/effects/ChangeTempo.cpp b/src/effects/ChangeTempo.cpp index 336fe003d..f77b959d9 100644 --- a/src/effects/ChangeTempo.cpp +++ b/src/effects/ChangeTempo.cpp @@ -300,7 +300,7 @@ void EffectChangeTempo::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2); { mUseSBSMSCheckBox = S.AddCheckBox(_("Use high quality stretching (slow)"), - mUseSBSMS? wxT("true") : wxT("false")); + mUseSBSMS); mUseSBSMSCheckBox->SetValidator(wxGenericValidator(&mUseSBSMS)); } S.EndMultiColumn(); diff --git a/src/effects/Compressor.cpp b/src/effects/Compressor.cpp index ba793e1e6..a18caeabd 100644 --- a/src/effects/Compressor.cpp +++ b/src/effects/Compressor.cpp @@ -290,9 +290,9 @@ void EffectCompressor::PopulateOrExchange(ShuttleGui & S) { /* i18n-hint: Make-up, i.e. correct for any reduction, rather than fabricate it.*/ mGainCheckBox = S.AddCheckBox(_("Make-up gain for 0 dB after compressing"), - DEF_Normalize ? wxT("true") : wxT("false")); + DEF_Normalize); mPeakCheckBox = S.AddCheckBox(_("Compress based on Peaks"), - DEF_UsePeak ? wxT("true") : wxT("false")); + DEF_UsePeak); } S.EndHorizontalLay(); } diff --git a/src/effects/Distortion.cpp b/src/effects/Distortion.cpp index b273e7b8f..150cfa1b5 100644 --- a/src/effects/Distortion.cpp +++ b/src/effects/Distortion.cpp @@ -376,7 +376,7 @@ void EffectDistortion::PopulateOrExchange(ShuttleGui & S) S.SetSizeHints(-1, -1); mDCBlockCheckBox = S.Id(ID_DCBlock).AddCheckBox(_("DC blocking filter"), - DEF_DCBlock ? wxT("true") : wxT("false")); + DEF_DCBlock); } S.EndMultiColumn(); S.AddSpace(0, 10); diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 26c6fe829..ec2ec6295 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -802,7 +802,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) { szrL = S.GetSizer(); - mLinFreq = S.Id(ID_Linear).AddCheckBox(_("Li&near Frequency Scale"), wxT("false")); + mLinFreq = S.Id(ID_Linear).AddCheckBox(_("Li&near Frequency Scale"), false); mLinFreq->SetName(_("Linear Frequency Scale")); } S.EndHorizontalLay(); @@ -881,7 +881,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S) S.Id(ID_Clear).AddButton(_("Fla&tten")); S.Id(ID_Invert).AddButton(_("&Invert")); - mGridOnOff = S.Id(ID_Grid).AddCheckBox(_("Show g&rid lines"), wxT("false")); + mGridOnOff = S.Id(ID_Grid).AddCheckBox(_("Show g&rid lines"), false); mGridOnOff->SetName(_("Show grid lines")); } S.EndHorizontalLay(); diff --git a/src/effects/Normalize.cpp b/src/effects/Normalize.cpp index b83c265ff..85ee2cb3c 100644 --- a/src/effects/Normalize.cpp +++ b/src/effects/Normalize.cpp @@ -361,7 +361,7 @@ void EffectNormalize::PopulateOrExchange(ShuttleGui & S) S.StartVerticalLay(false); { mDCCheckBox = S.AddCheckBox(_("Remove DC offset (center on 0.0 vertically)"), - mDC ? wxT("true") : wxT("false")); + mDC); mDCCheckBox->SetValidator(wxGenericValidator(&mDC)); S.StartHorizontalLay(wxALIGN_LEFT, false); @@ -378,7 +378,7 @@ void EffectNormalize::PopulateOrExchange(ShuttleGui & S) #endif // Now make the checkbox. mGainCheckBox = S.AddCheckBox(longerPrompt, - mGain ? wxT("true") : wxT("false")); + mGain); mGainCheckBox->SetValidator(wxGenericValidator(&mGain)); mGainCheckBox->SetMinSize( mGainCheckBox->GetSize()); @@ -397,11 +397,11 @@ void EffectNormalize::PopulateOrExchange(ShuttleGui & S) S.EndHorizontalLay(); #ifdef EXPERIMENTAL_R128_NORM mUseLoudnessCheckBox = S.AddCheckBox(_("Use loudness instead of peak amplitude"), - mUseLoudness ? wxT("true") : wxT("false")); + mUseLoudness); mUseLoudnessCheckBox->SetValidator(wxGenericValidator(&mGUIUseLoudness)); #endif mStereoIndCheckBox = S.AddCheckBox(_("Normalize stereo channels independently"), - mStereoInd ? wxT("true") : wxT("false")); + mStereoInd); mStereoIndCheckBox->SetValidator(wxGenericValidator(&mStereoInd)); } S.EndVerticalLay(); diff --git a/src/effects/Reverb.cpp b/src/effects/Reverb.cpp index 04ec74705..7ba8c0a1d 100644 --- a/src/effects/Reverb.cpp +++ b/src/effects/Reverb.cpp @@ -459,7 +459,7 @@ void EffectReverb::PopulateOrExchange(ShuttleGui & S) S.StartHorizontalLay(wxCENTER, false); { mWetOnlyC = S.Id(ID_WetOnly). - AddCheckBox(_("Wet O&nly"), DEF_WetOnly ? wxT("true") : wxT("false")); + AddCheckBox(_("Wet O&nly"), DEF_WetOnly); } S.EndHorizontalLay(); diff --git a/src/effects/ScoreAlignDialog.cpp b/src/effects/ScoreAlignDialog.cpp index d7627ac9a..6c7fa1efb 100644 --- a/src/effects/ScoreAlignDialog.cpp +++ b/src/effects/ScoreAlignDialog.cpp @@ -117,11 +117,11 @@ ScoreAlignDialog::ScoreAlignDialog(ScoreAlignParams ¶ms) mForceFinalAlignmentCheckBox = S.Id(ID_FORCEFINALALIGNMENT).AddCheckBox( wxT("Force Final Alignment"), - (p.mForceFinalAlignment ? wxT("true") : wxT("false"))); + p.mForceFinalAlignment); mForceFinalAlignmentCheckBox->SetName(_("Force Final Alignment")); mIgnoreSilenceCheckBox = S.Id(ID_IGNORESILENCE).AddCheckBox( wxT("Ignore Silence at Beginnings and Endings"), - (p.mIgnoreSilence ? wxT("true") : wxT("false"))); + p.mIgnoreSilence); mIgnoreSilenceCheckBox->SetName( _("Ignore Silence at Beginnings and Endings")); // need a third column after checkboxes: diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 5d4010083..47969fbef 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -802,7 +802,7 @@ void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2, wxALIGN_CENTER_HORIZONTAL); { mIndependent = S.AddCheckBox(_("Truncate tracks independently"), - mbIndependent ? wxT("true") : wxT("false")); + mbIndependent); } S.EndMultiColumn(); } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index ce639a220..d023d6326 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -2548,7 +2548,7 @@ void NyquistEffect::BuildPromptWindow(ShuttleGui & S) S.AddSpace(1, 1); mVersionCheckBox = S.AddCheckBox(_("&Use legacy (version 3) syntax."), - (mVersion == 3) ? wxT("true") : wxT("false")); + (mVersion == 3)); } S.EndMultiColumn(); diff --git a/src/effects/vamp/VampEffect.cpp b/src/effects/vamp/VampEffect.cpp index ff456fb23..c9b12f187 100644 --- a/src/effects/vamp/VampEffect.cpp +++ b/src/effects/vamp/VampEffect.cpp @@ -609,7 +609,7 @@ void VampEffect::PopulateOrExchange(ShuttleGui & S) { S.Id(ID_Toggles + p); mToggles[p] = S.AddCheckBox( {}, - value > 0.5 ? wxT("true") : wxT("false")); + value > 0.5); mToggles[p]->SetName(labelText); if (!tip.empty()) { diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index baac43832..ec1875b6f 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -414,7 +414,7 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S) } S.EndRadioButtonGroup(); - mMono = S.Id(ID_MONO).AddCheckBox(_("Force export to mono"), mono? wxT("true") : wxT("false")); + mMono = S.Id(ID_MONO).AddCheckBox(_("Force export to mono"), mono); } S.EndTwoColumn(); } diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index 13cefe44e..6be0bd111 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -297,7 +297,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S) // Row 3 (indented) S.AddVariableText(wxT(" "), false); mFirst = S.Id(FirstID) - .AddCheckBox(_("Include audio before first label"), wxT("false")); + .AddCheckBox(_("Include audio before first label"), false); // Row 4 S.AddVariableText( {}, false); diff --git a/src/widgets/Warning.cpp b/src/widgets/Warning.cpp index 6562619e5..485bde063 100644 --- a/src/widgets/Warning.cpp +++ b/src/widgets/Warning.cpp @@ -73,7 +73,7 @@ WarningDialog::WarningDialog(wxWindow *parent, const wxString &message, S.StartVerticalLay(false); { S.AddFixedText(message); - mCheckBox = S.AddCheckBox(footer, wxT("false")); + mCheckBox = S.AddCheckBox(footer, false); } S.EndVerticalLay();