/********************************************************************** Audacity - A Digital Audio Editor Copyright 1999-2009 Audacity Team License: wxWidgets Dan Horgan ******************************************************************//** \file CommandDirectory.cpp \brief A dictionary of supported scripting commands, including functions to look up a command by name. *//*******************************************************************/ #include "../Audacity.h" #include "CommandDirectory.h" #include "CommandMisc.h" #include "HelpCommand.h" #include "MessageCommand.h" #include "BatchEvalCommand.h" std::unique_ptr CommandDirectory::mInstance; CommandDirectory::CommandDirectory() { // Create the command map. // First we have commands which return information //AddCommand(make_movable()); AddCommand(make_movable()); // Legacy adapter commands that previously was needed to // access menu items. //AddCommand(make_movable()); // Not needed. Sets selected/solo/mute on multiple tracks. //AddCommand(make_movable()); // Moved to AudacityCommand // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable("GetAll")); // AddCommand(make_movable("GetCommands")); // AddCommand(make_movable("GetMenus")); // AddCommand(make_movable("GetMenusPlus")); // AddCommand(make_movable("GetBoxes")); // AddCommand(make_movable("GetClips")); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); // AddCommand(make_movable()); } CommandDirectory::~CommandDirectory() { } OldStyleCommandType *CommandDirectory::LookUp(const wxString &cmdName) const { CommandMap::const_iterator iter = mCmdMap.find(cmdName); if (iter == mCmdMap.end()) { return NULL; } return iter->second.get(); } void CommandDirectory::AddCommand(movable_ptr &&type) { wxASSERT(type != NULL); wxString cmdName = type->GetName(); wxASSERT_MSG(mCmdMap.find(cmdName) == mCmdMap.end() , wxT("A command named ") + cmdName + wxT(" already exists.")); mCmdMap[cmdName] = std::move(type); } CommandDirectory *CommandDirectory::Get() { if (!mInstance) mInstance.reset(safenew CommandDirectory()); return mInstance.get(); }