From fb678c0eb86ba013b66e267833e40ef01638e565 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 21 Jul 2019 14:38:59 -0400 Subject: [PATCH] Remove EffectHostInterface::Apply so Effect doesn't use EffectManager --- include/audacity/EffectInterface.h | 1 - src/effects/Effect.cpp | 13 ------------- src/effects/Effect.h | 1 - src/effects/EffectUI.cpp | 14 +++++++++++--- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/audacity/EffectInterface.h b/include/audacity/EffectInterface.h index b6c38c031..92c2a1193 100755 --- a/include/audacity/EffectInterface.h +++ b/include/audacity/EffectInterface.h @@ -121,7 +121,6 @@ public: virtual NumericFormatSymbol GetDurationFormat() = 0; virtual void SetDuration(double seconds) = 0; - virtual bool Apply() = 0; virtual void Preview() = 0; // diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 037adbc1f..d8ab9eba6 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -33,7 +33,6 @@ greater use in future. #include #include -#include "EffectManager.h" #include "../AudioIO.h" #include "../LabelTrack.h" #include "../Mix.h" @@ -52,7 +51,6 @@ greater use in future. #include "../widgets/NumericTextCtrl.h" #include "../widgets/AudacityMessageBox.h" #include "../widgets/ErrorDialog.h" -#include "../commands/CommandContext.h" #include @@ -728,17 +726,6 @@ void Effect::SetDuration(double seconds) return; } -bool Effect::Apply() -{ - auto &project = *GetActiveProject(); - CommandContext context( project ); - // This is absolute hackage...but easy and I can't think of another way just now. - // - // It should callback to the EffectManager to kick off the processing - return EffectManager::DoEffect(GetID(), context, - EffectManager::kConfigured); -} - void Effect::Preview() { Preview(false); diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 06116168a..cf12264dc 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -177,7 +177,6 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, virtual NumericFormatSymbol GetSelectionFormat() /* not override? */; // time format in Selection toolbar void SetDuration(double duration) override; - bool Apply() override; void Preview() override; wxDialog *CreateUI(wxWindow *parent, EffectUIClientInterface *client) override; diff --git a/src/effects/EffectUI.cpp b/src/effects/EffectUI.cpp index 6dc349e83..be0459548 100644 --- a/src/effects/EffectUI.cpp +++ b/src/effects/EffectUI.cpp @@ -1186,9 +1186,17 @@ void EffectUIHost::OnApply(wxCommandEvent & evt) // for sure), but it is a nice visual cue that something is going on. mApplyBtn->Disable(); auto cleanup = finally( [&] { mApplyBtn->Enable(); } ); - - if( mEffect ) - mEffect->Apply(); + + if( mEffect ) { + auto &project = *GetActiveProject(); + CommandContext context( project ); + // This is absolute hackage...but easy and I can't think of another way just now. + // + // It should callback to the EffectManager to kick off the processing + EffectManager::DoEffect(mEffect->GetID(), context, + EffectManager::kConfigured); + } + if( mCommand ) // PRL: I don't like the global and would rather pass *mProject! // But I am preserving old behavior