Remove nullary overload of AudacityCommand::Apply...

... which by default used GetActiveProject(); do that call instead at a
higher level; so that AudacityCommand.cpp does not depend on Project.cpp.

We lose the override of that for CompareAudioCommand which just did nothing.

But in fact this overload of the base class method could only be used
by EffectUIHost constructed from a command, which never happened: it was only
ever constructed from effects.

This frees two files from dependency cycles
This commit is contained in:
Paul Licameli 2019-05-11 18:10:21 -04:00
parent d81ca99643
commit 13713aab67
5 changed files with 4 additions and 15 deletions

View File

@ -37,7 +37,6 @@ ShuttleGui.
#include "audacity/ConfigInterface.h"
#include "../Project.h"
#include "../Shuttle.h"
#include "../ShuttleGui.h"
#include "../widgets/ProgressDialog.h"
@ -87,12 +86,6 @@ VendorSymbol AudacityCommand::GetVendor(){ return XO("Audacity");}
wxString AudacityCommand::GetVersion(){ return AUDACITY_VERSION_STRING;}
bool AudacityCommand::Apply() {
AudacityProject * pProj = GetActiveProject();
const CommandContext context( *pProj );
return Apply( context );
};
bool AudacityCommand::Init(){
if( !mNeedsInit )
return true;

View File

@ -69,8 +69,7 @@ class AUDACITY_DLL_API AudacityCommand /* not final */ : public wxEvtHandler,
virtual bool IsBatchProcessing(){ return mIsBatch;}
virtual void SetBatchProcessing(bool start){ mIsBatch = start;};
virtual bool Apply(const CommandContext & WXUNUSED(context) ) {return false;};
virtual bool Apply(); // redirects to the command context version.
virtual bool Apply(const CommandContext & WXUNUSED(context) ) {return false;};
bool ShowInterface(wxWindow *parent, bool forceModal = false);
virtual void SetHostUI(EffectUIHostInterface * WXUNUSED(host)){;};

View File

@ -46,10 +46,6 @@ bool CompareAudioCommand::DefineParams( ShuttleParams & S ){
return true;
}
bool CompareAudioCommand::Apply(){
return true;
}
void CompareAudioCommand::PopulateOrExchange(ShuttleGui & S)
{
S.AddSpace(0, 5);

View File

@ -33,7 +33,6 @@ public:
wxString GetDescription() override {return _("Compares a range on two tracks.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply() override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Extra_Menu:_Scriptables_II#compare_Audio");};

View File

@ -3322,7 +3322,9 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
if( mEffect )
mEffect->Apply();
if( mCommand )
mCommand->Apply();
// PRL: I don't like the global and would rather pass *mProject!
// But I am preserving old behavior
mCommand->Apply( CommandContext{ *GetActiveProject() } );
}
void EffectUIHost::DoCancel()