diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index c44252f14..6d802f7b9 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -230,12 +230,12 @@ bool EffectAutoDuck::Init() } else { - wxMessageBox( + Effect::MessageBox( _("You selected a track which does not contain audio. AutoDuck can only process audio tracks."), /* i18n-hint: Auto duck is the name of an effect that 'ducks' (reduces the volume) * of the audio automatically when there is sound on another track. Not as * in 'Donald-Duck'!*/ - _("Auto Duck"), wxICON_ERROR, mUIParent); + wxICON_ERROR); return false; } } @@ -245,9 +245,9 @@ bool EffectAutoDuck::Init() if (!controlTrackCandidate) { - wxMessageBox( + Effect::MessageBox( _("Auto Duck needs a control track which must be placed below the selected track(s)."), - _("Auto Duck"), wxICON_ERROR, mUIParent); + wxICON_ERROR); return false; } diff --git a/src/effects/ClickRemoval.cpp b/src/effects/ClickRemoval.cpp index 19d1f73c0..68fc0d143 100644 --- a/src/effects/ClickRemoval.cpp +++ b/src/effects/ClickRemoval.cpp @@ -192,9 +192,8 @@ bool EffectClickRemoval::Process() count++; } if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective. - wxMessageBox( + Effect::MessageBox( wxString::Format(_("Algorithm not effective on this audio. Nothing changed.")), - GetName(), wxOK | wxICON_ERROR); this->ReplaceProcessedTracks(bGoodResult && mbDidSomething); @@ -205,10 +204,9 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st { if (len <= windowSize / 2) { - wxMessageBox( + Effect::MessageBox( wxString::Format(_("Selection must be larger than %d samples."), windowSize / 2), - GetName(), wxOK | wxICON_ERROR); return false; } diff --git a/src/effects/Echo.cpp b/src/effects/Echo.cpp index cff1e0b23..c0194d0b5 100644 --- a/src/effects/Echo.cpp +++ b/src/effects/Echo.cpp @@ -104,7 +104,7 @@ bool EffectEcho::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames history.reinit(histLen, true); } catch ( const std::bad_alloc& ) { - wxMessageBox(_("Requested value exceeds memory capacity.")); + Effect::MessageBox(_("Requested value exceeds memory capacity.")); return false; } diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index b75c581c8..ae86c4ef7 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -372,10 +372,9 @@ bool EffectEqualization::ValidateUI() // we offer to save it. while (mDisallowCustom && mCurveName.IsSameAs(wxT("unnamed"))) { - wxMessageBox(_("To use this EQ curve in a batch chain, please choose a new name for it.\nChoose the 'Save/Manage Curves...' button and rename the 'unnamed' curve, then use that one."), - _("EQ Curve needs a different name"), + Effect::MessageBox(_("To use this EQ curve in a batch chain, please choose a new name for it.\nChoose the 'Save/Manage Curves...' button and rename the 'unnamed' curve, then use that one."), wxOK | wxCENTRE, - mUIParent); + _("EQ Curve needs a different name")); return false; } @@ -484,7 +483,7 @@ bool EffectEqualization::Init() } else { if (track->GetRate() != rate) { - wxMessageBox(_("To apply Equalization, all selected tracks must have the same sample rate.")); + Effect::MessageBox(_("To apply Equalization, all selected tracks must have the same sample rate.")); return(false); } } @@ -496,9 +495,9 @@ bool EffectEqualization::Init() mHiFreq = rate / 2.0; // Unlikely, but better than crashing. if (mHiFreq <= loFreqI) { - wxMessageBox( _("Track sample rate is too low for this effect."), - _("Effect Unavailable"), - wxOK | wxCENTRE); + Effect::MessageBox( _("Track sample rate is too low for this effect."), + wxOK | wxCENTRE, + _("Effect Unavailable")); return(false); } @@ -1394,9 +1393,9 @@ void EffectEqualization::LoadCurves(const wxString &fileName, bool append) /* i18n-hint: EQ stands for 'Equalization'.*/ msg.Printf(_("Error Loading EQ Curves from file:\n%s\nError message says:\n%s"), fullPath.c_str(), reader.GetErrorStr().c_str()); // Inform user of load failure - wxMessageBox( msg, - _("Error Loading EQ Curves"), - wxOK | wxCENTRE); + Effect::MessageBox( msg, + wxOK | wxCENTRE, + _("Error Loading EQ Curves")); mCurves.Add( _("unnamed") ); // we always need a default curve to use return; } @@ -1790,7 +1789,9 @@ void EffectEqualization::setCurve(const wxString &curveName) break; if( i == mCurves.GetCount()) { - wxMessageBox( _("Requested curve not found, using 'unnamed'"), _("Curve not found"), wxOK|wxICON_ERROR ); + Effect::MessageBox( _("Requested curve not found, using 'unnamed'"), + wxOK|wxICON_ERROR, + _("Curve not found") ); setCurve((int) mCurves.GetCount()-1); } else @@ -3220,7 +3221,9 @@ void EditCurvesDialog::OnUp(wxCommandEvent & WXUNUSED(event)) { if ( item == mList->GetItemCount()-1) { // 'unnamed' always stays at the bottom - wxMessageBox(_("'unnamed' always stays at the bottom of the list"), _("'unnamed' is special")); // these could get tedious! + mEffect->Effect::MessageBox(_("'unnamed' always stays at the bottom of the list"), + Effect::DefaultMessageBoxStyle, + _("'unnamed' is special")); // these could get tedious! return; } state = mList->GetItemState(item-1, wxLIST_STATE_SELECTED); @@ -3338,11 +3341,11 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event)) bad = true; if( curve == item ) // trying to rename a curve with the same name { - wxMessageBox( _("Name is the same as the original one"), _("Same name"), wxOK ); + mEffect->Effect::MessageBox( _("Name is the same as the original one"), wxOK, _("Same name") ); break; } - int answer = wxMessageBox( _("Overwrite existing curve '") + name +_("'?"), - _("Curve exists"), wxYES_NO ); + int answer = mEffect->Effect::MessageBox( _("Overwrite existing curve '") + name +_("'?"), + wxYES_NO, _("Curve exists") ); if (answer == wxYES) { bad = false; @@ -3413,8 +3416,8 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event)) { if(item == mList->GetItemCount()-1) //unnamed { - wxMessageBox(_("You cannot delete the 'unnamed' curve."), - _("Can't delete 'unnamed'"), wxOK | wxCENTRE, this); + mEffect->Effect::MessageBox(_("You cannot delete the 'unnamed' curve."), + wxOK | wxCENTRE, _("Can't delete 'unnamed'")); } else { @@ -3423,7 +3426,7 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event)) quest = wxString(_("Delete '")) + mEditCurves[ item-deleted ].Name + _("' ?"); // Ask for confirmation before removal - int ans = wxMessageBox( quest, _("Confirm Deletion"), wxYES_NO | wxCENTRE, this ); + int ans = mEffect->Effect::MessageBox( quest, wxYES_NO | wxCENTRE, _("Confirm Deletion") ); if( ans == wxYES ) { // Remove the curve from the array mEditCurves.RemoveAt( item-deleted ); @@ -3453,7 +3456,7 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event)) else return; // Ask for confirmation before removal - int ans = wxMessageBox( quest, _("Confirm Deletion"), wxYES_NO | wxCENTRE, this ); + int ans = mEffect->Effect::MessageBox( quest, wxYES_NO | wxCENTRE, _("Confirm Deletion") ); if( ans == wxYES ) { // Remove the curve(s) from the array // Take care, mList and mEditCurves will get out of sync as curves are deleted @@ -3462,8 +3465,9 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event)) { if(item == mList->GetItemCount()-1) //unnamed { - wxMessageBox(_("You cannot delete the 'unnamed' curve, it is special."), - _("Can't delete 'unnamed'"), wxOK | wxCENTRE, this); + mEffect->Effect::MessageBox(_("You cannot delete the 'unnamed' curve, it is special."), + Effect::DefaultMessageBoxStyle, + _("Can't delete 'unnamed'")); } else { @@ -3521,7 +3525,9 @@ void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event)) i++; } else - wxMessageBox(_("You cannot export 'unnamed' curve, it is special."), _("Cannot Export 'unnamed'")); + mEffect->Effect::MessageBox(_("You cannot export 'unnamed' curve, it is special."), + Effect::DefaultMessageBoxStyle, + _("Cannot Export 'unnamed'")); // get next selected item item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } @@ -3532,10 +3538,14 @@ void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event)) mEffect->mCurves = temp; wxString message; message.Printf(_("%d curves exported to %s"), i, fileName.c_str()); - wxMessageBox(message, _("Curves exported")); + mEffect->Effect::MessageBox(message, + Effect::DefaultMessageBoxStyle, + _("Curves exported")); } else - wxMessageBox(_("No curves exported"), _("No curves exported")); + mEffect->Effect::MessageBox(_("No curves exported"), + Effect::DefaultMessageBoxStyle, + _("No curves exported")); } void EditCurvesDialog::OnLibrary( wxCommandEvent & WXUNUSED(event)) diff --git a/src/effects/Equalization48x.cpp b/src/effects/Equalization48x.cpp index 028d188da..76787f7ac 100644 --- a/src/effects/Equalization48x.cpp +++ b/src/effects/Equalization48x.cpp @@ -506,7 +506,7 @@ bool EffectEqualization48x::Benchmark(EffectEqualization* effectEqualization) wxTimeSpan tsDefaultThreaded(0, 0, 0, times[3]); wxTimeSpan tsDefault(0, 0, 0, times[4]); - wxMessageBox(wxString::Format(_("Benchmark times:\nOriginal: %s\nDefault Segmented: %s\nDefault Threaded: %s\nSSE: %s\nSSE Threaded: %s\n"),tsDefault.Format(wxT("%M:%S.%l")).c_str(), + Effect::MessageBox(wxString::Format(_("Benchmark times:\nOriginal: %s\nDefault Segmented: %s\nDefault Threaded: %s\nSSE: %s\nSSE Threaded: %s\n"),tsDefault.Format(wxT("%M:%S.%l")).c_str(), tsDefaultEnhanced.Format(wxT("%M:%S.%l")).c_str(), tsDefaultThreaded.Format(wxT("%M:%S.%l")).c_str(),tsSSE.Format(wxT("%M:%S.%l")).c_str(),tsSSEThreaded.Format(wxT("%M:%S.%l")).c_str())); return bBreakLoop; // return !bBreakLoop ? } diff --git a/src/effects/FindClipping.cpp b/src/effects/FindClipping.cpp index a52cd0a73..d17ffd177 100644 --- a/src/effects/FindClipping.cpp +++ b/src/effects/FindClipping.cpp @@ -172,7 +172,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * lt, buffer.reinit(blockSize); } catch( const std::bad_alloc & ) { - wxMessageBox(_("Requested value exceeds memory capacity.")); + Effect::MessageBox(_("Requested value exceeds memory capacity.")); return false; } diff --git a/src/effects/Generator.cpp b/src/effects/Generator.cpp index 48c025a2a..e7afe2765 100644 --- a/src/effects/Generator.cpp +++ b/src/effects/Generator.cpp @@ -54,9 +54,10 @@ bool Generator::Process() track->IsEmpty(mT0, mT1+1.0/track->GetRate()) && !track->IsEmpty(mT0, mT0+GetDuration()-(mT1-mT0)-1.0/track->GetRate())) { - wxMessageBox( + Effect::MessageBox( _("There is not enough room available to generate the audio"), - _("Error"), wxICON_STOP); + wxICON_STOP, + _("Error")); Failure(); return false; } diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index 7da7f9cc3..f12368be6 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -206,7 +206,7 @@ public: bool PromptUser(EffectNoiseReduction *effect, wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings); bool PrefsIO(bool read); - bool Validate() const; + bool Validate(EffectNoiseReduction *effect) const; size_t WindowSize() const { return 1u << (3 + mWindowSizeChoice); } unsigned StepsPerWindow() const { return 1u << (1 + mStepsPerWindowChoice); } @@ -576,20 +576,20 @@ bool EffectNoiseReduction::Settings::PrefsIO(bool read) } } -bool EffectNoiseReduction::Settings::Validate() const +bool EffectNoiseReduction::Settings::Validate(EffectNoiseReduction *effect) const { if (StepsPerWindow() < windowTypesInfo[mWindowTypes].minSteps) { - ::wxMessageBox(_("Steps per block are too few for the window types.")); + effect->Effect::MessageBox(_("Steps per block are too few for the window types.")); return false; } if (StepsPerWindow() > WindowSize()) { - ::wxMessageBox(_("Steps per block cannot exceed the window size.")); + effect->Effect::MessageBox(_("Steps per block cannot exceed the window size.")); return false; } if (mMethod == DM_MEDIAN && StepsPerWindow() > 4) { - ::wxMessageBox(_("Median method is not implemented for more than four steps per window.")); + effect->Effect::MessageBox(_("Median method is not implemented for more than four steps per window.")); return false; } @@ -616,12 +616,12 @@ bool EffectNoiseReduction::Process() } else if (mStatistics->mWindowSize != mSettings->WindowSize()) { // possible only with advanced settings - ::wxMessageBox(_("You must specify the same window size for steps 1 and 2.")); + ::Effect::MessageBox(_("You must specify the same window size for steps 1 and 2.")); return false; } else if (mStatistics->mWindowTypes != mSettings->mWindowTypes) { // A warning only - ::wxMessageBox(_("Warning: window types are not the same as for profiling.")); + ::Effect::MessageBox(_("Warning: window types are not the same as for profiling.")); } Worker worker(*mSettings, mStatistics->mRate @@ -653,9 +653,9 @@ bool EffectNoiseReduction::Worker::Process while (track) { if (track->GetRate() != mSampleRate) { if (mDoProfile) - ::wxMessageBox(_("All noise profile data must have the same sample rate.")); + effect.Effect::MessageBox(_("All noise profile data must have the same sample rate.")); else - ::wxMessageBox(_("The sample rate of the noise profile must match that of the sound to be processed.")); + effect.Effect::MessageBox(_("The sample rate of the noise profile must match that of the sound to be processed.")); return false; } @@ -679,7 +679,7 @@ bool EffectNoiseReduction::Worker::Process if (mDoProfile) { if (statistics.mTotalWindows == 0) { - ::wxMessageBox(_("Selected noise profile is too short.")); + effect.Effect::MessageBox(_("Selected noise profile is too short.")); return false; } } @@ -1851,7 +1851,7 @@ bool EffectNoiseReduction::Dialog::TransferDataFromWindow() wxCommandEvent dummy; OnNoiseReductionChoice(dummy); - return mTempSettings.Validate(); + return mTempSettings.Validate(m_pEffect); } void EffectNoiseReduction::Dialog::OnText(wxCommandEvent &event) diff --git a/src/effects/Paulstretch.cpp b/src/effects/Paulstretch.cpp index 7eff06e9e..8e6645142 100644 --- a/src/effects/Paulstretch.cpp +++ b/src/effects/Paulstretch.cpp @@ -255,7 +255,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun const auto stretch_buf_size = GetBufferSize(track->GetRate()); if (stretch_buf_size == 0) { - ::wxMessageBox( badAllocMessage ); + ::Effect::MessageBox( badAllocMessage ); return false; } @@ -268,7 +268,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun const auto minDuration = stretch_buf_size * 2 + 1; if (minDuration < stretch_buf_size) { // overflow! - ::wxMessageBox( badAllocMessage ); + ::Effect::MessageBox( badAllocMessage ); return false; } @@ -284,30 +284,30 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/ if ((minDuration / mProjectRate) < defaultPreviewLen) { - ::wxMessageBox (wxString::Format(_("Audio selection too short to preview.\n\n" + ::Effect::MessageBox (wxString::Format(_("Audio selection too short to preview.\n\n" "Try increasing the audio selection to at least %.1f seconds,\n" "or reducing the 'Time Resolution' to less than %.1f seconds."), (minDuration / track->GetRate()) + 0.05, // round up to 1/10 s. floor(maxTimeRes * 10.0) / 10.0), - GetName(), wxOK | wxICON_EXCLAMATION); + wxOK | wxICON_EXCLAMATION); } else { /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/ - ::wxMessageBox (wxString::Format(_("Unable to Preview.\n\n" + ::Effect::MessageBox (wxString::Format(_("Unable to Preview.\n\n" "For the current audio selection, the maximum\n" "'Time Resolution' is %.1f seconds."), floor(maxTimeRes * 10.0) / 10.0), - GetName(), wxOK | wxICON_EXCLAMATION); + wxOK | wxICON_EXCLAMATION); } } else { /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/ - ::wxMessageBox (wxString::Format(_("The 'Time Resolution' is too long for the selection.\n\n" + ::Effect::MessageBox (wxString::Format(_("The 'Time Resolution' is too long for the selection.\n\n" "Try increasing the audio selection to at least %.1f seconds,\n" "or reducing the 'Time Resolution' to less than %.1f seconds."), (minDuration / track->GetRate()) + 0.05, // round up to 1/10 s. floor(maxTimeRes * 10.0) / 10.0), - GetName(), wxOK | wxICON_EXCLAMATION); + wxOK | wxICON_EXCLAMATION); } return false; @@ -394,7 +394,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun return !cancelled; } catch ( const std::bad_alloc& ) { - ::wxMessageBox( badAllocMessage ); + ::Effect::MessageBox( badAllocMessage ); return false; } }; diff --git a/src/effects/Repair.cpp b/src/effects/Repair.cpp index 03d3cea76..afd82e6fe 100644 --- a/src/effects/Repair.cpp +++ b/src/effects/Repair.cpp @@ -91,7 +91,7 @@ bool EffectRepair::Process() const auto repair1 = track->TimeToLongSamples(repair_t1); const auto repairLen = repair1 - repair0; if (repairLen > 128) { - ::wxMessageBox(_("The Repair effect is intended to be used on very short sections of damaged audio (up to 128 samples).\n\nZoom in and select a tiny fraction of a second to repair.")); + ::Effect::MessageBox(_("The Repair effect is intended to be used on very short sections of damaged audio (up to 128 samples).\n\nZoom in and select a tiny fraction of a second to repair.")); bGoodResult = false; break; } @@ -108,7 +108,7 @@ bool EffectRepair::Process() const auto len = s1 - s0; if (s0 == repair0 && s1 == repair1) { - ::wxMessageBox(_("Repair works by using audio data outside the selection region.\n\nPlease select a region that has audio touching at least one side of it.\n\nThe more surrounding audio, the better it performs.")); + ::Effect::MessageBox(_("Repair works by using audio data outside the selection region.\n\nPlease select a region that has audio touching at least one side of it.\n\nThe more surrounding audio, the better it performs.")); /// The Repair effect needs some data to go on.\n\nPlease select an area to repair with some audio on at least one side (the more the better).")); bGoodResult = false; break; diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index f32be322a..36f1231ac 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -348,7 +348,7 @@ bool EffectScienFilter::Init() { if (t->GetRate() != rate) { - wxMessageBox(_("To apply a filter, all selected tracks must have the same sample rate.")); + Effect::MessageBox(_("To apply a filter, all selected tracks must have the same sample rate.")); return false; } } diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 04d0aeecd..21e34db96 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -288,7 +288,7 @@ bool EffectTruncSilence::ProcessIndependently() if (track2->GetKind() == Track::Wave && !(track2 == track || track2 == link) && track2->GetSelected()) { - ::wxMessageBox(_("When truncating independently, there may only be one selected audio track in each Sync-Locked Track Group.")); + ::Effect::MessageBox(_("When truncating independently, there may only be one selected audio track in each Sync-Locked Track Group.")); return false; } } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index af4f842c4..21d233b39 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -451,10 +451,10 @@ bool NyquistEffect::Init() } if (!bAllowSpectralEditing || ((mF0 < 0.0) && (mF1 < 0.0))) { - wxMessageBox(_("To use 'Spectral effects', enable 'Spectral Selection'\n" + Effect::MessageBox(_("To use 'Spectral effects', enable 'Spectral Selection'\n" "in the track Spectrogram settings and select the\n" "frequency range for the effect to act on."), - _("Error"), wxOK | wxICON_EXCLAMATION | wxCENTRE); + wxOK | wxICON_EXCLAMATION | wxCENTRE, _("Error")); return false; } @@ -665,9 +665,8 @@ bool NyquistEffect::Process() mCurTrack[1] = (WaveTrack *)iter.Next(); if (mCurTrack[1]->GetRate() != mCurTrack[0]->GetRate()) { - wxMessageBox(_("Sorry, cannot apply effect on stereo tracks where the tracks don't match."), - wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(_("Sorry, cannot apply effect on stereo tracks where the tracks don't match."), + wxOK | wxCENTRE); success = false; goto finish; } @@ -690,7 +689,7 @@ bool NyquistEffect::Process() _("Selection too long for Nyquist code.\nMaximum allowed selection is %ld samples\n(about %.1f hours at 44100 Hz sample rate)."), (long)NYQ_MAX_LEN, hours ); - wxMessageBox(message, _("Nyquist Error"), wxOK | wxCENTRE); + Effect::MessageBox(message, wxOK | wxCENTRE, _("Nyquist Error")); if (!mProjectChanged) em.SetSkipStateFlag(true); return false; @@ -1213,7 +1212,7 @@ bool NyquistEffect::ProcessOne() if (rval == nyx_string) { wxString msg = NyquistToWxString(nyx_get_string()); if (!msg.IsEmpty()) // Not currently a documented feature, but could be useful as a No-Op. - wxMessageBox(msg, mName, wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(msg); // True if not process type. // If not returning audio from process effect, @@ -1226,8 +1225,7 @@ bool NyquistEffect::ProcessOne() wxString str; str.Printf(_("Nyquist returned the value:") + wxString(wxT(" %f")), nyx_get_double()); - wxMessageBox(str, wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(str); return (GetType() != EffectTypeProcess || mIsPrompt); } @@ -1235,8 +1233,7 @@ bool NyquistEffect::ProcessOne() wxString str; str.Printf(_("Nyquist returned the value:") + wxString(wxT(" %d")), nyx_get_int()); - wxMessageBox(str, wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(str); return (GetType() != EffectTypeProcess || mIsPrompt); } @@ -1275,23 +1272,17 @@ bool NyquistEffect::ProcessOne() int outChannels = nyx_get_audio_num_channels(); if (outChannels > (int)mCurNumChannels) { - wxMessageBox(_("Nyquist returned too many audio channels.\n"), - wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(_("Nyquist returned too many audio channels.\n")); return false; } if (outChannels == -1) { - wxMessageBox(_("Nyquist returned one audio channel as an array.\n"), - wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(_("Nyquist returned one audio channel as an array.\n")); return false; } if (outChannels == 0) { - wxMessageBox(_("Nyquist returned an empty array.\n"), - wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(_("Nyquist returned an empty array.\n")); return false; } @@ -1340,9 +1331,7 @@ bool NyquistEffect::ProcessOne() mOutputTime = outputTrack[i]->GetEndTime(); if (mOutputTime <= 0) { - wxMessageBox(_("Nyquist returned nil audio.\n"), - wxT("Nyquist"), - wxOK | wxCENTRE, mUIParent); + Effect::MessageBox(_("Nyquist returned nil audio.\n")); return true; } } @@ -1740,7 +1729,7 @@ void NyquistEffect::Parse(const wxString &line) tokens[3].c_str(), mFileName.GetFullPath().c_str()); // Too disturbing to show alert before Audacity frame is up. - // wxMessageBox(str, wxT("Nyquist Warning"), wxOK | wxICON_EXCLAMATION); + // Effect::MessageBox(str, wxT("Nyquist Warning"), wxOK | wxICON_EXCLAMATION); // Note that the AudacityApp's mLogger has not yet been created, // so this brings up an alert box, but after the Audacity frame is up. @@ -1854,11 +1843,11 @@ bool NyquistEffect::ParseProgram(wxInputStream & stream) { /* i1n-hint: SAL and LISP are names for variant syntaxes for the Nyquist programming language. Leave them, and 'return', untranslated. */ - wxMessageBox(_("Your code looks like SAL syntax, but there is no \'return\' statement.\n\ + Effect::MessageBox(_("Your code looks like SAL syntax, but there is no \'return\' statement.\n\ For SAL, use a return statement such as:\n\treturn *track* * 0.1\n\ or for LISP, begin with an open parenthesis such as:\n\t(mult *track* 0.1)\n ."), - _("Error in Nyquist code"), - wxOK | wxCENTRE); + Effect::DefaultMessageBoxStyle, + _("Error in Nyquist code")); /* i18n-hint: refers to programming "languages" */ mInitError = _("Could not determine language"); return false; @@ -2311,8 +2300,7 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt)) { if (mCommandText->IsModified()) { - if (wxMessageBox(_("Current program has been modified.\nDiscard changes?"), - GetName(), + if (Effect::MessageBox(_("Current program has been modified.\nDiscard changes?"), wxYES_NO) == wxNO) { return; @@ -2335,7 +2323,7 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt)) if (!mCommandText->LoadFile(mFileName.GetFullPath())) { - wxMessageBox(_("File could not be loaded"), GetName()); + Effect::MessageBox(_("File could not be loaded")); } } @@ -2357,7 +2345,7 @@ void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt)) if (!mCommandText->SaveFile(mFileName.GetFullPath())) { - wxMessageBox(_("File could not be saved"), GetName()); + Effect::MessageBox(_("File could not be saved")); } } diff --git a/src/effects/vamp/VampEffect.cpp b/src/effects/vamp/VampEffect.cpp index 996ee9ea1..9f9ff0756 100644 --- a/src/effects/vamp/VampEffect.cpp +++ b/src/effects/vamp/VampEffect.cpp @@ -324,7 +324,7 @@ bool VampEffect::Init() if (left->GetRate() != right->GetRate()) { - wxMessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.")); + Effect::MessageBox(_("Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.")); return false; } } @@ -343,7 +343,7 @@ bool VampEffect::Init() mPlugin.reset(loader->loadPlugin(mKey, mRate, Vamp::HostExt::PluginLoader::ADAPT_ALL)); if (!mPlugin) { - wxMessageBox(_("Sorry, failed to load Vamp Plug-in.")); + Effect::MessageBox(_("Sorry, failed to load Vamp Plug-in.")); return false; } @@ -437,7 +437,7 @@ bool VampEffect::Process() { if (!mPlugin->initialise(channels, step, block)) { - wxMessageBox(_("Sorry, Vamp Plug-in failed to initialize.")); + Effect::MessageBox(_("Sorry, Vamp Plug-in failed to initialize.")); return false; } }