1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Lift a call to GetActiveProject into ScriptCommandRelay...

... Don't do it at the low level of construction of a command object.  Do it
only at the highest possible level, where an external scripting module or
Nyquist calls into the command framework.  Pass the project pointer down where
it is needed.
This commit is contained in:
Paul Licameli
2019-05-21 21:20:58 -04:00
parent 1e3779c2f3
commit a1eeb528b7
6 changed files with 28 additions and 18 deletions

View File

@@ -24,6 +24,7 @@ code out of ModuleManager.
#include "CommandTargets.h"
#include "CommandBuilder.h"
#include "AppCommandEvent.h"
#include "../Project.h"
#include <wx/app.h>
#include <wx/window.h>
#include <wx/string.h>
@@ -70,7 +71,7 @@ void ScriptCommandRelay::PostCommand(
int ExecCommand(wxString *pIn, wxString *pOut)
{
{
CommandBuilder builder(*pIn);
CommandBuilder builder(::GetActiveProject(), *pIn);
if (builder.WasValid())
{
OldStyleCommandPointer cmd = builder.GetCommand();
@@ -105,7 +106,7 @@ int ExecCommand(wxString *pIn, wxString *pOut)
int ExecCommand2(wxString *pIn, wxString *pOut)
{
{
CommandBuilder builder(*pIn);
CommandBuilder builder(::GetActiveProject(), *pIn);
if (builder.WasValid())
{
OldStyleCommandPointer cmd = builder.GetCommand();