Audacity 3.2.0
Functions
CommandDispatch Namespace Reference

Functions

AUDACITY_DLL_API bool HandleTextualCommand (CommandManager &commandManager, 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 56 of file CommandDispatch.cpp.

58{
59 auto &project = context.project;
60 auto &window = ProjectWindow::Get( project );
62 if (!plug)
63 return false;
64
66 {
67 ProjectAudioManager::Get( project ).Stop();
68// SelectAllIfNone();
69 }
70
72 bool success = em.DoAudacityCommand(ID,
73 context,
74 &window,
75 (flags & EffectManager::kConfigured) == 0);
76
77 if (!success)
78 return false;
79
80/*
81 if (em.GetSkipStateFlag())
82 flags = flags | OnEffectFlags::kSkipState;
83
84 if (!(flags & OnEffectFlags::kSkipState))
85 {
86 wxString shortDesc = em.GetCommandName(ID);
87 wxString longDesc = em.GetCommandDescription(ID);
88 PushState(longDesc, shortDesc);
89 }
90*/
91 window.RedrawProject();
92 return true;
93}
AudacityProject & project
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:48
static EffectManager & Get()
bool DoAudacityCommand(const PluginID &ID, const CommandContext &, wxWindow *parent, bool shouldPrompt=true)
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
void Stop(bool stopStream=true)
static ProjectAudioManager & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)

References EffectManager::DoAudacityCommand(), PluginManager::Get(), EffectManager::Get(), ProjectAudioManager::Get(), ProjectWindow::Get(), PluginManager::GetPlugin(), EffectManager::kConfigured, CommandContext::project, 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 ( CommandManager commandManager,
const CommandID Str,
const CommandContext context,
CommandFlag  flags,
bool  alwaysEnabled 
)

Definition at line 24 of file CommandDispatch.cpp.

27{
28 switch ( commandManager.HandleTextualCommand(
29 Str, context, flags, alwaysEnabled) ) {
31 return true;
33 return false;
35 default:
36 break;
37 }
38
39 // Not one of the singleton commands.
40 // We could/should try all the list-style commands.
41 // instead we only try the effects.
43 for (auto &plug : PluginManager::Get().PluginsOfType(PluginTypeEffect))
44 if (em.GetCommandIdentifier(plug.GetID()) == Str)
45 return EffectUI::DoEffect(
46 plug.GetID(), context,
48
49 return false;
50}
@ PluginTypeEffect
TextualCommandResult HandleTextualCommand(const CommandID &Str, const CommandContext &context, CommandFlag flags, bool alwaysEnabled)
CommandID GetCommandIdentifier(const PluginID &ID)
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1263

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

Referenced by MacroCommands::ApplyCommand(), ScreenshotCommand::CapturePreferences(), 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 95 of file CommandDispatch.cpp.

96{
97 // using GET in a log message for devs' eyes only
98 wxLogDebug( "Command was: %s", ctx.parameter.GET());
99 // Not configured, so prompt user.
101 EffectManager::Get().GetEffectByIdentifier(ctx.parameter),
103}
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(), EffectManager::Get(), Identifier::GET(), EffectManager::kNone, and CommandContext::parameter.

Here is the call graph for this function: