Audacity 3.2.0
Functions
CommandDispatch Namespace Reference

Functions

AUDACITY_DLL_API bool HandleTextualCommand (const CommandID &Str, const CommandContext &context, CommandFlag flags, bool alwaysEnabled)
 
AUDACITY_DLL_API bool DoAudacityCommand (const PluginID &ID, const CommandContext &context, unsigned flags)
 
AUDACITY_DLL_API void OnAudacityCommand (const CommandContext &ctx)
 

Function Documentation

◆ DoAudacityCommand()

bool CommandDispatch::DoAudacityCommand ( const PluginID ID,
const CommandContext context,
unsigned  flags 
)

DoAudacityCommand() takes a PluginID and executes the associated command.

At the moment flags are used only to indicate whether to prompt for parameters

Definition at line 60 of file CommandDispatch.cpp.

62{
63 auto &project = context.project;
65 if (!plug)
66 return false;
67
69 {
71// SelectAllIfNone();
72 }
73
75 context,
76 (flags & EffectManager::kConfigured) == 0);
77
78 if (!success)
79 return false;
80
81/*
82 if (em.GetSkipStateFlag())
83 flags = flags | OnEffectFlags::kSkipState;
84
85 if (!(flags & OnEffectFlags::kSkipState))
86 {
87 wxString shortDesc = em.GetCommandName(ID);
88 wxString longDesc = em.GetCommandDescription(ID);
89 PushState(longDesc, shortDesc);
90 }
91*/
93 return true;
94}
const auto project
AudacityProject & project
static EffectAndCommandPluginManager & Get()
bool DoAudacityCommand(const PluginID &ID, const CommandContext &, bool shouldPrompt=true)
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
void Stop(bool stopStream=true)
static ProjectAudioManager & Get(AudacityProject &project)
void Redraw()
Definition: Viewport.cpp:753
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33

References EffectAndCommandPluginManager::DoAudacityCommand(), PluginManager::Get(), EffectAndCommandPluginManager::Get(), Viewport::Get(), ProjectAudioManager::Get(), PluginManager::GetPlugin(), EffectManager::kConfigured, CommandContext::project, project, Viewport::Redraw(), and ProjectAudioManager::Stop().

Referenced by MacroCommands::ApplyEffectCommand(), and OnAudacityCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleTextualCommand()

bool CommandDispatch::HandleTextualCommand ( const CommandID Str,
const CommandContext context,
CommandFlag  flags,
bool  alwaysEnabled 
)

Definition at line 28 of file CommandDispatch.cpp.

31{
32 auto &commandManager = CommandManager::Get(context.project);
33 switch ( commandManager.HandleTextualCommand(
34 Str, context, flags, alwaysEnabled) ) {
36 return true;
38 return false;
40 default:
41 break;
42 }
43
44 // Not one of the singleton commands.
45 // We could/should try all the list-style commands.
46 // instead we only try the effects.
47 auto& pm = PluginManager::Get();
48 for (auto &plug : PluginManager::Get().PluginsOfType(PluginTypeEffect))
49 if (pm.GetCommandIdentifier(plug.GetID()) == Str)
50 return EffectUI::DoEffect(
51 plug.GetID(), context.project, EffectManager::kConfigured);
52
53 return false;
54}
@ PluginTypeEffect
static CommandManager & Get(AudacityProject &project)
bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags)
Definition: DoEffect.cpp:30

References CommandManager::CommandFailure, CommandManager::CommandNotFound, CommandManager::CommandSuccess, EffectUI::DoEffect(), PluginManager::Get(), CommandManager::Get(), EffectManager::kConfigured, PluginTypeEffect, and CommandContext::project.

Referenced by MacroCommands::ApplyCommand(), and ToolBarButtons::OnButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnAudacityCommand()

void CommandDispatch::OnAudacityCommand ( const CommandContext ctx)

Definition at line 96 of file CommandDispatch.cpp.

97{
98 // using GET in a log message for devs' eyes only
99 wxLogDebug( "Command was: %s", ctx.parameter.GET());
100 // Not configured, so prompt user.
102 PluginManager::Get().GetByCommandIdentifier(ctx.parameter), ctx,
104}
CommandParameter parameter
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
AUDACITY_DLL_API bool DoAudacityCommand(const PluginID &ID, const CommandContext &context, unsigned flags)

References DoAudacityCommand(), PluginManager::Get(), Identifier::GET(), EffectManager::kNone, and CommandContext::parameter.

Here is the call graph for this function: