mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Make Message command into an AudacityCommand.
This commit is contained in:
committed by
Paul Licameli
parent
edf90d6e2c
commit
f7fe295651
@@ -28,7 +28,7 @@ CommandDirectory::CommandDirectory()
|
||||
{
|
||||
// Create the command map.
|
||||
// First we have commands which return information
|
||||
AddCommand(make_movable<MessageCommandType>());
|
||||
//AddCommand(make_movable<MessageCommandType>());
|
||||
AddCommand(make_movable<BatchEvalCommandType>());
|
||||
|
||||
|
||||
|
@@ -15,8 +15,6 @@
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "HelpCommand.h"
|
||||
//#include "../Project.h"
|
||||
//#include "../Track.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "CommandContext.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
|
@@ -22,6 +22,7 @@ modelled on BuiltinEffectsModule
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "Demo.h"
|
||||
#include "../Experimental.h"
|
||||
#include "../commands/MessageCommand.h"
|
||||
#include "../commands/ScreenshotCommand.h"
|
||||
#include "../commands/CompareAudioCommand.h"
|
||||
#include "../commands/SetTrackInfoCommand.h"
|
||||
@@ -43,6 +44,7 @@ modelled on BuiltinEffectsModule
|
||||
//
|
||||
#define COMMAND_LIST \
|
||||
COMMAND( DEMO, DemoCommand, () ) \
|
||||
COMMAND( MESSAGE, MessageCommand, () ) \
|
||||
COMMAND( SCREENSHOT, ScreenshotCommand, () ) \
|
||||
COMMAND( COMPARE_AUDIO, CompareAudioCommand, () ) \
|
||||
COMMAND( SET_TRACK, SetTrackCommand, () ) \
|
||||
|
@@ -17,26 +17,25 @@
|
||||
#include "MessageCommand.h"
|
||||
#include "CommandType.h"
|
||||
#include "CommandContext.h"
|
||||
#include "../ShuttleGui.h"
|
||||
|
||||
wxString MessageCommandType::BuildName()
|
||||
{
|
||||
return wxT("Message");
|
||||
}
|
||||
|
||||
void MessageCommandType::BuildSignature(CommandSignature &signature)
|
||||
{
|
||||
auto stringValidator = make_movable<DefaultValidator>();
|
||||
signature.AddParameter(wxT("MessageString"), wxT("Connected"), std::move(stringValidator));
|
||||
}
|
||||
|
||||
OldStyleCommandPointer MessageCommandType::Create(std::unique_ptr<CommandOutputTargets> &&target)
|
||||
{
|
||||
return std::make_shared<MessageCommand>(*this);
|
||||
}
|
||||
|
||||
bool MessageCommand::Apply(const CommandContext & context)
|
||||
{
|
||||
wxString message = GetString(wxT("MessageString"));
|
||||
context.Status(message);
|
||||
bool MessageCommand::DefineParams( ShuttleParams & S ){
|
||||
S.Define( mMessage, wxT("Text"), "Some message" );
|
||||
return true;
|
||||
}
|
||||
|
||||
void MessageCommand::PopulateOrExchange(ShuttleGui & S)
|
||||
{
|
||||
S.AddSpace(0, 5);
|
||||
|
||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||
{
|
||||
S.TieTextBox(_("Text:"),mMessage,60);
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
|
||||
bool MessageCommand::Apply(const CommandContext & context){
|
||||
context.Status( mMessage );
|
||||
return true;
|
||||
}
|
||||
|
@@ -18,26 +18,29 @@
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __MESSAGECOMMAND__
|
||||
#define __MESSAGECOMMAND__
|
||||
#ifndef __MESSAGE_COMMAND__
|
||||
#define __MESSAGE_COMMAND__
|
||||
|
||||
#include "Command.h"
|
||||
#include "CommandType.h"
|
||||
#include "Command.h"
|
||||
|
||||
class MessageCommandType final : public OldStyleCommandType
|
||||
#define MESSAGE_PLUGIN_SYMBOL XO("Message")
|
||||
|
||||
class MessageCommand : public AudacityCommand
|
||||
{
|
||||
public:
|
||||
wxString BuildName() override;
|
||||
void BuildSignature(CommandSignature &signature) override;
|
||||
OldStyleCommandPointer Create(std::unique_ptr<CommandOutputTargets> &&target) override;
|
||||
// CommandDefinitionInterface overrides
|
||||
wxString GetSymbol() override {return MESSAGE_PLUGIN_SYMBOL;};
|
||||
wxString GetDescription() override {return _("Echos a message.");};
|
||||
bool DefineParams( ShuttleParams & S ) override;
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
bool Apply(const CommandContext & context) override;
|
||||
|
||||
// AudacityCommand overrides
|
||||
wxString ManualPage() override {return wxT("Message");};
|
||||
public:
|
||||
wxString mMessage;
|
||||
};
|
||||
|
||||
class MessageCommand final : public CommandImplementation
|
||||
{
|
||||
public:
|
||||
MessageCommand(OldStyleCommandType &type)
|
||||
: CommandImplementation(type) {}
|
||||
bool Apply(const CommandContext &context ) override;
|
||||
};
|
||||
|
||||
#endif /* End of include guard: __MESSAGECOMMAND__ */
|
||||
|
@@ -72,7 +72,6 @@ int ExecCommand(wxString *pIn, wxString *pOut)
|
||||
if (builder.WasValid())
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
//project->SafeDisplayStatusMessage(wxT("Received script command"));
|
||||
OldStyleCommandPointer cmd = builder.GetCommand();
|
||||
ScriptCommandRelay::PostCommand(project, cmd);
|
||||
|
||||
|
Reference in New Issue
Block a user