mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-04 14:39:08 +02:00
Scripting Help Command now supports JSON, LISP, Brief.
This commit is contained in:
parent
7ff9f1b302
commit
371afa3ffa
@ -36,7 +36,6 @@ This class now lists
|
||||
#include "../WaveTrack.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../Envelope.h"
|
||||
#include "CommandContext.h"
|
||||
|
||||
#include "SelectCommand.h"
|
||||
#include "../ShuttleGui.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../Shuttle.h"
|
||||
#include "LoadCommands.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "CommandTargets.h"
|
||||
#include "CommandContext.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
|
||||
@ -28,8 +29,28 @@ const ComponentInterfaceSymbol HelpCommand::Symbol
|
||||
|
||||
namespace{ BuiltinCommandsModule::Registration< HelpCommand > reg; }
|
||||
|
||||
enum {
|
||||
kJson,
|
||||
kLisp,
|
||||
kBrief,
|
||||
nFormats
|
||||
};
|
||||
|
||||
static const EnumValueSymbol kFormats[nFormats] =
|
||||
{
|
||||
// These are acceptable dual purpose internal/visible names
|
||||
|
||||
/* i18n-hint JavaScript Object Notation */
|
||||
{ XO("JSON") },
|
||||
/* i18n-hint name of a computer programming language */
|
||||
{ XO("LISP") },
|
||||
{ XO("Brief") }
|
||||
};
|
||||
|
||||
|
||||
bool HelpCommand::DefineParams( ShuttleParams & S ){
|
||||
S.Define( mCommandName, wxT("Command"), "Help" );
|
||||
S.DefineEnum( mFormat, wxT("Format"), 0, kFormats, nFormats );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -40,11 +61,39 @@ void HelpCommand::PopulateOrExchange(ShuttleGui & S)
|
||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||
{
|
||||
S.TieTextBox(XO("Command:"),mCommandName);
|
||||
S.TieChoice( XO("Format:"),
|
||||
mFormat, Msgids( kFormats, nFormats ));
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
|
||||
bool HelpCommand::Apply(const CommandContext & context){
|
||||
bool HelpCommand::Apply(const CommandContext &context)
|
||||
{
|
||||
if( mFormat == kJson )
|
||||
return ApplyInner( context );
|
||||
|
||||
if( mFormat == kLisp )
|
||||
{
|
||||
CommandContext LispyContext(
|
||||
context.project,
|
||||
std::make_unique<LispifiedCommandOutputTargets>( *context.pOutput.get() )
|
||||
);
|
||||
return ApplyInner( LispyContext );
|
||||
}
|
||||
|
||||
if( mFormat == kBrief )
|
||||
{
|
||||
CommandContext BriefContext(
|
||||
context.project,
|
||||
std::make_unique<BriefCommandOutputTargets>( *context.pOutput.get() )
|
||||
);
|
||||
return ApplyInner( BriefContext );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HelpCommand::ApplyInner(const CommandContext & context){
|
||||
EffectManager & em = EffectManager::Get();
|
||||
PluginID ID = em.GetEffectByIdentifier( mCommandName );
|
||||
if( ID.empty() )
|
||||
|
@ -27,6 +27,7 @@ class HelpCommand : public AudacityCommand
|
||||
{
|
||||
public:
|
||||
static const ComponentInterfaceSymbol Symbol;
|
||||
int mFormat;
|
||||
|
||||
// ComponentInterface overrides
|
||||
ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
|
||||
@ -34,6 +35,7 @@ public:
|
||||
bool DefineParams( ShuttleParams & S ) override;
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
bool Apply(const CommandContext & context) override;
|
||||
bool ApplyInner(const CommandContext & context);
|
||||
|
||||
// AudacityCommand overrides
|
||||
wxString ManualPage() override {return wxT("Extra_Menu:_Scriptables_II#help");};
|
||||
|
Loading…
x
Reference in New Issue
Block a user