mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-18 17:47:41 +02:00
ScriptCommandRelay.cpp doesn't depend on AudacityProject.cpp ...
... This doesn't break any dependency cycles yet.
This commit is contained in:
parent
016e1949ae
commit
ae0cd061c6
@ -24,8 +24,8 @@ code out of ModuleManager.
|
|||||||
#include "CommandTargets.h"
|
#include "CommandTargets.h"
|
||||||
#include "CommandBuilder.h"
|
#include "CommandBuilder.h"
|
||||||
#include "AppCommandEvent.h"
|
#include "AppCommandEvent.h"
|
||||||
#include "../Project.h"
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
|
#include <wx/window.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
// Declare static class members
|
// Declare static class members
|
||||||
@ -52,13 +52,16 @@ void ScriptCommandRelay::Run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Send a command to a project, to be applied in that context.
|
/// Send a command to a project, to be applied in that context.
|
||||||
void ScriptCommandRelay::PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd)
|
void ScriptCommandRelay::PostCommand(
|
||||||
|
wxWindow *pWindow, const OldStyleCommandPointer &cmd)
|
||||||
{
|
{
|
||||||
wxASSERT(project != NULL);
|
wxASSERT( pWindow );
|
||||||
wxASSERT(cmd != NULL);
|
wxASSERT(cmd != NULL);
|
||||||
AppCommandEvent ev;
|
if ( pWindow ) {
|
||||||
ev.SetCommand(cmd);
|
AppCommandEvent ev;
|
||||||
project->GetEventHandler()->AddPendingEvent(ev);
|
ev.SetCommand(cmd);
|
||||||
|
pWindow->GetEventHandler()->AddPendingEvent(ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is the function which actually obeys one command. Rather than applying
|
/// This is the function which actually obeys one command. Rather than applying
|
||||||
@ -71,9 +74,8 @@ int ExecCommand(wxString *pIn, wxString *pOut)
|
|||||||
CommandBuilder builder(*pIn);
|
CommandBuilder builder(*pIn);
|
||||||
if (builder.WasValid())
|
if (builder.WasValid())
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
|
||||||
OldStyleCommandPointer cmd = builder.GetCommand();
|
OldStyleCommandPointer cmd = builder.GetCommand();
|
||||||
ScriptCommandRelay::PostCommand(project, cmd);
|
ScriptCommandRelay::PostCommand(wxTheApp->GetTopWindow(), cmd);
|
||||||
|
|
||||||
*pOut = wxEmptyString;
|
*pOut = wxEmptyString;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
#include "../MemoryX.h"
|
#include "../MemoryX.h"
|
||||||
|
|
||||||
|
class wxWindow;
|
||||||
class CommandHandler;
|
class CommandHandler;
|
||||||
class ResponseQueue;
|
class ResponseQueue;
|
||||||
class Response;
|
class Response;
|
||||||
class ResponseQueueTarget;
|
class ResponseQueueTarget;
|
||||||
class AudacityProject;
|
|
||||||
class OldStyleCommand;
|
class OldStyleCommand;
|
||||||
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
|
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
|
||||||
class wxString;
|
class wxString;
|
||||||
@ -50,7 +50,8 @@ class ScriptCommandRelay
|
|||||||
static void SetCommandHandler(CommandHandler &ch);
|
static void SetCommandHandler(CommandHandler &ch);
|
||||||
|
|
||||||
static void Run();
|
static void Run();
|
||||||
static void PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd);
|
static void PostCommand(
|
||||||
|
wxWindow *pWindow, const OldStyleCommandPointer &cmd);
|
||||||
static void SendResponse(const wxString &response);
|
static void SendResponse(const wxString &response);
|
||||||
static Response ReceiveResponse();
|
static Response ReceiveResponse();
|
||||||
static std::shared_ptr<ResponseQueueTarget> GetResponseTarget();
|
static std::shared_ptr<ResponseQueueTarget> GetResponseTarget();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user