Audacity  2.3.1
Go to the documentation of this file.
1 /**********************************************************************
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2018 Audacity Team
5  File License: wxWidgets
7  Dan Horgan
9 ******************************************************************//*******************************************************************/
19 #include "../Audacity.h"
20 #include "../MemoryX.h"
22 class CommandHandler;
23 class ResponseQueue;
24 class Response;
26 class AudacityProject;
27 class OldStyleCommand;
28 using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
29 class wxString;
31 typedef int (*tpExecScriptServerFunc)( wxString * pIn, wxString * pOut);
34 extern "C" {
35  AUDACITY_DLL_API int ExecCommand(wxString *pIn, wxString *pOut);
36 } // End 'extern C'
39 {
40  private:
41  // N.B. Static class members also have to be declared in the .cpp file
46  public:
49  static void SetCommandHandler(CommandHandler &ch);
51  static void Run();
52  static void PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd);
53  static void SendResponse(const wxString &response);
54  static Response ReceiveResponse();
55  static std::shared_ptr<ResponseQueueTarget> GetResponseTarget();
56 };
58 #endif /* End of include guard: __SCRIPT_COMMAND_RELAY__ */
int(* tpExecScriptServerFunc)(wxString *pIn, wxString *pOut)
static tpRegScriptServerFunc scriptFn
static void SetRegScriptServerFunc(tpRegScriptServerFunc scriptFn)
Adds messages to a response queue (to be sent back to a script)
static void Run()
Calls the script function, passing it the function for obeying commands.
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:175
static std::shared_ptr< ResponseQueueTarget > GetResponseTarget()
static CommandHandler * sCmdHandler
Contains methods for applying commands that are passed to it.
Allow messages to be sent from the main thread to the script thread.
Definition: ResponseQueue.h:60
static Response ReceiveResponse()
Gets a response from the queue (may block)
static void PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd)
Send a command to a project, to be applied in that context.
int(* tpRegScriptServerFunc)(tpExecScriptServerFunc pFn)
AUDACITY_DLL_API int ExecCommand(wxString *pIn, wxString *pOut)
Stores a command response string (and other response data if it becomes necessary) ...
Definition: ResponseQueue.h:46
ScriptCommandRelay is just a way to move some of the scripting-specific code out of ModuleManager...
static void SendResponse(const wxString &response)
Adds a response to the queue to be sent back to the script.
OldStyleCommandPointer is a unique_ptr to an OldStyleCommand.
static void SetCommandHandler(CommandHandler &ch)
static ResponseQueue sResponseQueue
static tpRegScriptServerFunc sScriptFn
Abstract base class for command interface. This is the version created by Dan Horgan. It was previously a factory for other command classes. It created a separation between the type of a command and the command itself, which is being removed. These Cmmands were managed by CommandDirectory.
Definition: Command.h:33