2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity - A Digital Audio Editor
|
|
|
|
Copyright 1999-2009 Audacity Team
|
|
|
|
License: wxWidgets
|
|
|
|
|
|
|
|
Dan Horgan
|
|
|
|
|
|
|
|
******************************************************************//**
|
|
|
|
|
|
|
|
\file CommandDirectory.cpp
|
2017-12-20 21:19:23 +00:00
|
|
|
\brief A dictionary of supported scripting commands, including
|
|
|
|
functions to look up a command by name.
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
*//*******************************************************************/
|
|
|
|
|
2021-05-09 15:16:56 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "CommandDirectory.h"
|
2018-11-11 02:40:37 +00:00
|
|
|
|
2016-03-31 17:20:25 +00:00
|
|
|
std::unique_ptr<CommandDirectory> CommandDirectory::mInstance;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
CommandDirectory::CommandDirectory()
|
|
|
|
{
|
|
|
|
// Create the command map.
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
// First we have commands which return information
|
2018-04-16 17:31:17 +00:00
|
|
|
//AddCommand(std::make_unique<MessageCommandType>());
|
2019-05-18 17:20:19 +00:00
|
|
|
|
|
|
|
// AddCommand(std::make_unique<BatchEvalCommandType>());
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Legacy adapter commands that previously was needed to
|
|
|
|
// access menu items.
|
2018-04-16 17:31:17 +00:00
|
|
|
//AddCommand(std::make_unique<ExecMenuCommandType>());
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
|
|
|
|
// Not needed. Sets selected/solo/mute on multiple tracks.
|
2018-04-16 17:31:17 +00:00
|
|
|
//AddCommand(std::make_unique<SetProjectInfoCommandType>());
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
|
|
|
|
// Moved to AudacityCommand
|
2018-04-16 17:31:17 +00:00
|
|
|
// AddCommand(std::make_unique<OpenProjectCommandType>());
|
|
|
|
// AddCommand(std::make_unique<SaveProjectCommandType>());
|
|
|
|
// AddCommand(std::make_unique<ImportCommandType>());
|
|
|
|
// AddCommand(std::make_unique<ExportCommandType>());
|
|
|
|
// AddCommand(std::make_unique<HelpCommandType>());
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetAll"));
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetCommands"));
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetMenus"));
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetMenusPlus"));
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetBoxes"));
|
|
|
|
// AddCommand(std::make_unique<GetInfoCommandType>("GetClips"));
|
|
|
|
|
|
|
|
// AddCommand(std::make_unique<GetTrackInfoCommandType>());
|
|
|
|
// AddCommand(std::make_unique<GetProjectInfoCommandType>());
|
|
|
|
// AddCommand(std::make_unique<CompareAudioCommandType>());
|
|
|
|
// AddCommand(std::make_unique<GetPreferenceCommandType>());
|
|
|
|
// AddCommand(std::make_unique<SetPreferenceCommandType>());
|
|
|
|
// AddCommand(std::make_unique<ScreenshotCommandType>());
|
|
|
|
// AddCommand(std::make_unique<SelectCommandType>());
|
|
|
|
// AddCommand(std::make_unique<SetTrackInfoCommandType>());
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CommandDirectory::~CommandDirectory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-02-07 21:50:55 +00:00
|
|
|
OldStyleCommandType *CommandDirectory::LookUp(const wxString &cmdName) const
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2019-05-18 17:20:19 +00:00
|
|
|
auto iter = sCmdMap().find(cmdName);
|
|
|
|
if (iter == sCmdMap().end())
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2019-05-18 17:20:19 +00:00
|
|
|
return nullptr;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2016-08-07 18:56:54 +00:00
|
|
|
return iter->second.get();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-05-18 17:20:19 +00:00
|
|
|
CommandMap &CommandDirectory::sCmdMap()
|
|
|
|
{
|
|
|
|
static CommandMap theMap;
|
|
|
|
return theMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CommandDirectory::AddCommand(std::unique_ptr<OldStyleCommandType> type)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
wxASSERT(type != NULL);
|
2018-03-15 22:01:06 +00:00
|
|
|
// Internal string is shown but only in assertion message
|
2018-03-09 18:11:20 +00:00
|
|
|
auto cmdName = type->GetSymbol().Internal();
|
2019-05-18 17:20:19 +00:00
|
|
|
wxASSERT_MSG(sCmdMap().find(cmdName) == sCmdMap().end()
|
2010-01-23 19:44:49 +00:00
|
|
|
, wxT("A command named ") + cmdName
|
|
|
|
+ wxT(" already exists."));
|
|
|
|
|
2019-05-18 17:20:19 +00:00
|
|
|
sCmdMap()[cmdName] = std::move(type);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CommandDirectory *CommandDirectory::Get()
|
|
|
|
{
|
2016-03-31 17:20:25 +00:00
|
|
|
if (!mInstance)
|
|
|
|
mInstance.reset(safenew CommandDirectory());
|
|
|
|
return mInstance.get();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|