1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 06:40:12 +01:00

Remove EffectHostInterface::Apply so Effect doesn't use EffectManager

This commit is contained in:
Paul Licameli
2019-07-21 14:38:59 -04:00
parent 8c4d8db133
commit fb678c0eb8
4 changed files with 11 additions and 18 deletions

View File

@@ -121,7 +121,6 @@ public:
virtual NumericFormatSymbol GetDurationFormat() = 0;
virtual void SetDuration(double seconds) = 0;
virtual bool Apply() = 0;
virtual void Preview() = 0;
//

View File

@@ -33,7 +33,6 @@ greater use in future.
#include <wx/listbox.h>
#include <wx/sizer.h>
#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 <unordered_map>
@@ -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);

View File

@@ -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;

View File

@@ -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