From 738c5c5e90f5ffe6293d7b6f97ca58e6b51fba4b Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 24 Jul 2019 15:08:59 -0400 Subject: [PATCH] Remove Effect::PromptUser... ... it was only a thin wrapper of ShowInterface when not overridden, not clearly serving a distinct purpose. --- src/effects/Effect.cpp | 10 +++------- src/effects/Effect.h | 6 ------ src/effects/EffectManager.cpp | 2 +- src/effects/EffectUI.cpp | 3 ++- src/effects/NoiseReduction.cpp | 4 +++- src/effects/NoiseReduction.h | 2 +- src/effects/NoiseRemoval.cpp | 3 ++- src/effects/NoiseRemoval.h | 2 +- 8 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index d8ab9eba6..716965e41 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -1200,7 +1200,9 @@ bool Effect::DoEffect(wxWindow *parent, // Prompting will be bypassed when applying an effect that has already // been configured, e.g. repeating the last effect on a different selection. // Prompting may call Effect::Preview - if (shouldPrompt && IsInteractive() && !PromptUser(parent)) + if ( shouldPrompt && + IsInteractive() && + !ShowInterface(parent, IsBatchProcessing()) ) { return false; } @@ -1244,12 +1246,6 @@ bool Effect::Init() return true; } -// Remove this method once NoiseReduction gets migrated -bool Effect::PromptUser(wxWindow *parent) -{ - return ShowInterface(parent, IsBatchProcessing()); -} - int Effect::GetPass() { return mPass; diff --git a/src/effects/Effect.h b/src/effects/Effect.h index cf12264dc..57396ae73 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -287,12 +287,6 @@ protected: // return false otherwise virtual bool Init(); - // If necessary, open a dialog to get parameters from the user. - // This method will not always be called (for example if a user - // repeats an effect) but if it is called, it will be called - // after Init. - virtual bool PromptUser(wxWindow *parent); - // Check whether effect should be skipped // Typically this is only useful in automation, for example // detecting that zero noise reduction is to be done, diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 3072732dd..27487e476 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -523,7 +523,7 @@ bool EffectManager::PromptUser(const PluginID & ID, wxWindow *parent) if (effect) { - result = effect->PromptUser(parent); + result = effect->ShowInterface( parent, effect->IsBatchProcessing() ); return result; } diff --git a/src/effects/EffectUI.cpp b/src/effects/EffectUI.cpp index be0459548..5c12336ba 100644 --- a/src/effects/EffectUI.cpp +++ b/src/effects/EffectUI.cpp @@ -375,7 +375,8 @@ void EffectRack::OnEditor(wxCommandEvent & evt) return; } - mEffects[index]->PromptUser(GetParent()); + auto pEffect = mEffects[index]; + pEffect->ShowInterface( GetParent(), pEffect->IsBatchProcessing() ); } void EffectRack::OnUp(wxCommandEvent & evt) diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index f51524df8..669695f68 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -459,8 +459,10 @@ bool EffectNoiseReduction::CheckWhetherSkipEffect() return false; } -bool EffectNoiseReduction::PromptUser(wxWindow *parent) +bool EffectNoiseReduction::ShowInterface( wxWindow *parent, bool ) { + // to do: use forceModal correctly + // We may want to twiddle the levels if we are setting // from an automation dialog, the only case in which we can // get here without any wavetracks. diff --git a/src/effects/NoiseReduction.h b/src/effects/NoiseReduction.h index 9b26249a0..72206cade 100644 --- a/src/effects/NoiseReduction.h +++ b/src/effects/NoiseReduction.h @@ -38,7 +38,7 @@ public: // using Effect::TrackProgress; - bool PromptUser(wxWindow *parent) override; + bool ShowInterface( wxWindow *parent, bool forceModal ) override; bool Init() override; bool CheckWhetherSkipEffect() override; diff --git a/src/effects/NoiseRemoval.cpp b/src/effects/NoiseRemoval.cpp index 9a2afda69..543f4aee7 100644 --- a/src/effects/NoiseRemoval.cpp +++ b/src/effects/NoiseRemoval.cpp @@ -149,8 +149,9 @@ bool EffectNoiseRemoval::CheckWhetherSkipEffect() return (mLevel == 0); } -bool EffectNoiseRemoval::PromptUser(wxWindow *parent) +bool EffectNoiseRemoval::ShowInterface( wxWindow *parent, bool /* forceModal */ ) { + // to do: use forceModal correctly NoiseRemovalDialog dlog(this, parent); dlog.mSensitivity = mSensitivity; dlog.mGain = -mNoiseGain; diff --git a/src/effects/NoiseRemoval.h b/src/effects/NoiseRemoval.h index 7eff39e76..bc6b143d5 100644 --- a/src/effects/NoiseRemoval.h +++ b/src/effects/NoiseRemoval.h @@ -53,7 +53,7 @@ public: // Effect implementation - bool PromptUser(wxWindow *parent) override; + bool ShowInterface( wxWindow *parent, bool forceModal ) override; bool Init() override; bool CheckWhetherSkipEffect() override; bool Process() override;