![]() |
Audacity 3.2.0
|
CommandManager implements a system for organizing all user-callable commands. More...
#include <CommandManager.h>
Classes | |
struct | GlobalMenuHook |
struct | Options |
Public Types | |
enum | TextualCommandResult { CommandFailure , CommandSuccess , CommandNotFound } |
using | CheckFn = std::function< bool(AudacityProject &) > |
Public Member Functions | |
CommandManager () | |
virtual | ~CommandManager () |
CommandManager (const CommandManager &)=delete | |
CommandManager & | operator= (const CommandManager &)=delete |
void | SetMaxList () |
void | PurgeData () |
std::unique_ptr< wxMenuBar > | AddMenuBar (const wxString &sMenu) |
wxMenu * | BeginMenu (const TranslatableString &tName) |
void | EndMenu () |
This attaches a menu, if it's main, to the menubar. More... | |
void | AddItemList (const CommandID &name, const ComponentInterfaceSymbol items[], size_t nItems, CommandHandlerFinder finder, CommandFunctorPointer callback, CommandFlag flags, bool bIsEffect=false) |
void | AddItem (AudacityProject &project, const CommandID &name, const TranslatableString &label_in, CommandHandlerFinder finder, CommandFunctorPointer callback, CommandFlag flags, const Options &options={}) |
void | AddSeparator () |
void | PopMenuBar () |
void | BeginOccultCommands () |
void | EndOccultCommands () |
void | SetCommandFlags (const CommandID &name, CommandFlag flags) |
void | EnableUsingFlags (CommandFlag flags, CommandFlag strictFlags) |
void | Enable (const wxString &name, bool enabled) |
void | Check (const CommandID &name, bool checked) |
void | Modify (const wxString &name, const TranslatableString &newLabel) |
Changes the label text of a menu item. More... | |
void | SetKeyFromName (const CommandID &name, const NormalizedKeyString &key) |
void | SetKeyFromIndex (int i, const NormalizedKeyString &key) |
bool | FilterKeyEvent (AudacityProject *project, const wxKeyEvent &evt, bool permit=false) |
bool | HandleMenuID (AudacityProject &project, int id, CommandFlag flags, bool alwaysEnabled) |
void | RegisterLastAnalyzer (const CommandContext &context) |
void | RegisterLastTool (const CommandContext &context) |
void | DoRepeatProcess (const CommandContext &context, int) |
TextualCommandResult | HandleTextualCommand (const CommandID &Str, const CommandContext &context, CommandFlag flags, bool alwaysEnabled) |
TranslatableStrings | GetCategories (AudacityProject &) |
void | GetAllCommandNames (CommandIDs &names, bool includeMultis) const |
void | GetAllCommandLabels (TranslatableStrings &labels, std::vector< bool > &vExcludeFromMacros, bool includeMultis) const |
void | GetAllCommandData (CommandIDs &names, std::vector< NormalizedKeyString > &keys, std::vector< NormalizedKeyString > &default_keys, TranslatableStrings &labels, TranslatableStrings &categories, bool includeMultis) |
CommandID | GetNameFromNumericID (int id) |
TranslatableString | GetLabelFromName (const CommandID &name) |
TranslatableString | GetPrefixedLabelFromName (const CommandID &name) |
TranslatableString | GetCategoryFromName (const CommandID &name) |
NormalizedKeyString | GetKeyFromName (const CommandID &name) const |
NormalizedKeyString | GetDefaultKeyFromName (const CommandID &name) |
bool | GetEnabled (const CommandID &name) |
int | GetNumberOfKeysRead () const |
void | RemoveDuplicateShortcuts () |
void | WriteXML (XMLWriter &xmlFile) const |
TranslatableString | DescribeCommandsAndShortcuts (const ComponentInterfaceSymbol commands[], size_t nCommands) const |
wxMenu * | CurrentMenu () const |
void | UpdateCheckmarks (AudacityProject &project) |
wxString | FormatLabelForMenu (const CommandID &id, const TranslatableString *pLabel) const |
Format a string appropriate for insertion in a menu. More... | |
![]() | |
XMLTagHandler () | |
virtual | ~XMLTagHandler () |
virtual bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0 |
virtual void | HandleXMLEndTag (const std::string_view &WXUNUSED(tag)) |
virtual void | HandleXMLContent (const std::string_view &WXUNUSED(content)) |
virtual XMLTagHandler * | HandleXMLChild (const std::string_view &tag)=0 |
void | ReadXMLEndTag (const char *tag) |
void | ReadXMLContent (const char *s, int len) |
XMLTagHandler * | ReadXMLChild (const char *tag) |
![]() | |
virtual | ~Base () |
Static Public Member Functions | |
static CommandManager & | Get (AudacityProject &project) |
static const CommandManager & | Get (const AudacityProject &project) |
static const std::vector< NormalizedKeyString > & | ExcludedList () |
Private Member Functions | |
int | NextIdentifier (int ID) |
CommandListEntry * | NewIdentifier (const CommandID &name, const TranslatableString &label, wxMenu *menu, CommandHandlerFinder finder, CommandFunctorPointer callback, const CommandID &nameSuffix, int index, int count, const Options &options) |
void | AddGlobalCommand (const CommandID &name, const TranslatableString &label, CommandHandlerFinder finder, CommandFunctorPointer callback, const Options &options={}) |
bool | HandleCommandEntry (AudacityProject &project, const CommandListEntry *entry, CommandFlag flags, bool alwaysEnabled, const wxEvent *evt=nullptr, const CommandContext *pGivenContext=nullptr) |
void | Enable (CommandListEntry *entry, bool enabled) |
wxMenu * | BeginMainMenu (const TranslatableString &tName) |
void | EndMainMenu () |
wxMenu * | BeginSubMenu (const TranslatableString &tName) |
void | EndSubMenu () |
wxMenuBar * | CurrentMenuBar () const |
wxMenuBar * | GetMenuBar (const wxString &sMenu) const |
wxMenu * | CurrentSubMenu () const |
wxString | FormatLabelForMenu (const CommandListEntry *entry) const |
wxString | FormatLabelForMenu (const TranslatableString &translatableLabel, const NormalizedKeyString &keyStr) const |
wxString | FormatLabelWithDisabledAccel (const CommandListEntry *entry) const |
bool | HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override |
void | HandleXMLEndTag (const std::string_view &tag) override |
XMLTagHandler * | HandleXMLChild (const std::string_view &tag) override |
Private Attributes | |
std::vector< NormalizedKeyString > | mMaxListOnly |
MenuBarList | mMenuBarList |
SubMenuList | mSubMenuList |
CommandList | mCommandList |
CommandNameHash | mCommandNameHash |
CommandKeyHash | mCommandKeyHash |
CommandNumericIDHash | mCommandNumericIDHash |
int | mCurrentID |
int | mXMLKeysRead |
bool | mbSeparatorAllowed |
TranslatableString | mCurrentMenuName |
TranslatableString | mNiceName |
int | mLastProcessId |
std::unique_ptr< wxMenu > | uCurrentMenu |
wxMenu * | mCurrentMenu {} |
bool | bMakingOccultCommands |
std::unique_ptr< wxMenuBar > | mTempMenuBar |
CommandManager implements a system for organizing all user-callable commands.
It creates and manages a menu bar with a command associated with each item, and managing other commands callable by keyboard shortcuts.
Commands are implemented by overriding an abstract functor class. See Menus.cpp for an example use.
Menus or submenus containing lists of items can be added at once, with a single function (functor) to be called when any of the items is selected, with the index number of the selection as the parameter. This is useful for dynamic menus (effects) and submenus containing a list of choices (selection formats).
Menu items can be enabled or disabled individually, groups of "multi-items" can be enabled or disabled all at once, or entire sets of commands can be enabled or disabled all at once using flags. The flags should be a bitfield stored in a 32-bit integer but can be whatever you want. You specify both the desired values of the flags, and the set of flags relevant to a particular command, by using a combination of a flags parameter and a mask parameter. Any flag set to 0 in the mask parameter is the same as "don't care". Any command whose mask is set to zero will not be affected by enabling/disabling by flags.
Definition at line 60 of file CommandManager.h.
using CommandManager::CheckFn = std::function< bool(AudacityProject&) > |
Definition at line 97 of file CommandManager.h.
Enumerator | |
---|---|
CommandFailure | |
CommandSuccess | |
CommandNotFound |
Definition at line 224 of file CommandManager.h.
CommandManager::CommandManager | ( | ) |
Standard Constructor
Definition at line 219 of file CommandManager.cpp.
References mbSeparatorAllowed, mLastProcessId, and SetMaxList().
|
virtual |
Class Destructor. Includes PurgeData, which removes menubars
Definition at line 232 of file CommandManager.cpp.
References PurgeData().
|
delete |
|
private |
Definition at line 617 of file CommandManager.cpp.
References AlwaysEnabledFlag, entry, name, and NewIdentifier().
Referenced by AddItem().
void CommandManager::AddItem | ( | AudacityProject & | project, |
const CommandID & | name, | ||
const TranslatableString & | label_in, | ||
CommandHandlerFinder | finder, | ||
CommandFunctorPointer | callback, | ||
CommandFlag | flags, | ||
const Options & | options = {} |
||
) |
Definition at line 531 of file CommandManager.cpp.
References AddGlobalCommand(), CommandManager::Options::checker, CurrentMenu(), entry, FormatLabelWithDisabledAccel(), CommandManager::Options::global, label, mbSeparatorAllowed, name, NewIdentifier(), NoFlagsSpecified, project, SetCommandFlags(), and CommandManager::Options::useStrictFlags.
void CommandManager::AddItemList | ( | const CommandID & | name, |
const ComponentInterfaceSymbol | items[], | ||
size_t | nItems, | ||
CommandHandlerFinder | finder, | ||
CommandFunctorPointer | callback, | ||
CommandFlag | flags, | ||
bool | bIsEffect = false |
||
) |
Add a list of menu items to the current menu. When the user selects any one of these, the given functor will be called with its position in the list as the index number. When you call Enable on this command name, it will enable or disable all of the items at once.
Definition at line 591 of file CommandManager.cpp.
References CurrentMenu(), entry, FormatLabelForMenu(), Internal, CommandManager::Options::IsEffect(), mbSeparatorAllowed, name, and NewIdentifier().
std::unique_ptr< wxMenuBar > CommandManager::AddMenuBar | ( | const wxString & | sMenu | ) |
Makes a NEW menubar for placement on the top of a project Names it according to the passed-in string argument.
If the menubar already exists, that's unexpected.
Definition at line 350 of file CommandManager.cpp.
References GetMenuBar(), and mMenuBarList.
Referenced by BeginOccultCommands().
void CommandManager::AddSeparator | ( | ) |
Definition at line 632 of file CommandManager.cpp.
References CurrentMenu(), and mbSeparatorAllowed.
|
private |
This starts a NEW menu
Definition at line 434 of file CommandManager.cpp.
References mCurrentMenu, mCurrentMenuName, and uCurrentMenu.
Referenced by BeginMenu().
wxMenu * CommandManager::BeginMenu | ( | const TranslatableString & | tName | ) |
This starts a NEW menu
Definition at line 409 of file CommandManager.cpp.
References BeginMainMenu(), BeginSubMenu(), and mCurrentMenu.
void CommandManager::BeginOccultCommands | ( | ) |
Definition at line 1612 of file CommandManager.cpp.
References AddMenuBar(), bMakingOccultCommands, CurrentMenu(), mTempMenuBar, and wxT().
|
private |
This starts a NEW submenu, and names it according to the function's argument.
Definition at line 462 of file CommandManager.cpp.
References mbSeparatorAllowed, and mSubMenuList.
Referenced by BeginMenu().
void CommandManager::Check | ( | const CommandID & | name, |
bool | checked | ||
) |
Definition at line 1009 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
wxMenu * CommandManager::CurrentMenu | ( | ) | const |
This returns the current menu that we're appending to - note that it could be a submenu if BeginSubMenu was called and we haven't reached EndSubMenu yet.
Definition at line 505 of file CommandManager.cpp.
References CurrentSubMenu(), and mCurrentMenu.
Referenced by AddItem(), AddItemList(), AddSeparator(), BeginOccultCommands(), and EndSubMenu().
|
private |
Retrieve the 'current' menubar; either NULL or the last on in the mMenuBarList.
Definition at line 383 of file CommandManager.cpp.
References mMenuBarList.
Referenced by EndMainMenu().
|
private |
This returns the 'Current' Submenu, which is the one at the end of the mSubMenuList (or NULL, if it doesn't exist).
Definition at line 493 of file CommandManager.cpp.
References mSubMenuList.
Referenced by CurrentMenu().
TranslatableString CommandManager::DescribeCommandsAndShortcuts | ( | const ComponentInterfaceSymbol | commands[], |
size_t | nCommands | ||
) | const |
Formatting summaries that include shortcut keys
Definition at line 1043 of file CommandManager.cpp.
References TranslatableString::empty(), TranslatableString::Format(), anonymous_namespace{ExportPCM.cpp}::format, GetKeyFromName(), name, Verbatim(), and wxT().
void CommandManager::DoRepeatProcess | ( | const CommandContext & | context, |
int | id | ||
) |
Definition at line 1315 of file CommandManager.cpp.
References entry, cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, id, mCommandNumericIDHash, mLastProcessId, and CommandContext::project.
Referenced by anonymous_namespace{PluginMenus.cpp}::OnRepeatLastAnalyzer(), and anonymous_namespace{BatchProcessDialog.cpp}::OnRepeatLastTool().
|
private |
Enables or disables a menu item based on its name (not the label in the menu bar, but the name of the command.) If you give it the name of a multi-item (one that was added using AddItemList(), it will enable or disable all of them at once
Definition at line 911 of file CommandManager.cpp.
References entry, mCommandNumericIDHash, CommandListEntry::menu, NextIdentifier(), and wxT().
void CommandManager::Enable | ( | const wxString & | name, |
bool | enabled | ||
) |
Definition at line 956 of file CommandManager.cpp.
References Enable(), entry, mCommandNameHash, name, and wxT().
Referenced by Enable(), and EnableUsingFlags().
void CommandManager::EnableUsingFlags | ( | CommandFlag | flags, |
CommandFlag | strictFlags | ||
) |
Definition at line 968 of file CommandManager.cpp.
References Enable(), entry, mCommandList, and none.
|
private |
This attaches a menu to the menubar and ends the menu
Definition at line 446 of file CommandManager.cpp.
References COMMAND, CurrentMenuBar(), mCurrentMenu, mCurrentMenuName, TranslatableString::Translation(), and uCurrentMenu.
Referenced by EndMenu().
void CommandManager::EndMenu | ( | ) |
This attaches a menu, if it's main, to the menubar.
Definition at line 422 of file CommandManager.cpp.
References EndMainMenu(), EndSubMenu(), and mSubMenuList.
void CommandManager::EndOccultCommands | ( | ) |
Definition at line 1625 of file CommandManager.cpp.
References bMakingOccultCommands, mTempMenuBar, and PopMenuBar().
|
private |
This function is called after the final item of a SUBmenu is added. Submenu items are added just like regular menu items; they just happen after BeginSubMenu() is called but before EndSubMenu() is called.
Definition at line 474 of file CommandManager.cpp.
References CurrentMenu(), mbSeparatorAllowed, mSubMenuList, name, and TranslatableString::Translation().
Referenced by EndMenu().
|
static |
Definition at line 238 of file CommandManager.cpp.
References PackedArray::begin(), and PackedArray::end().
Referenced by KeyConfigPrefs::FilterKeys(), and SetMaxList().
bool CommandManager::FilterKeyEvent | ( | AudacityProject * | project, |
const wxKeyEvent & | evt, | ||
bool | permit = false |
||
) |
Definition at line 1099 of file CommandManager.cpp.
References entry, BasicUI::FindFocus(), FindProjectFrame(), MenuManager::Get(), MenuManager::GetUpdateFlags(), HandleCommandEntry(), KeyEventToKeyString(), mCommandKeyHash, NoFlagsSpecified, project, and valueRestorer().
wxString CommandManager::FormatLabelForMenu | ( | const CommandID & | id, |
const TranslatableString * | pLabel | ||
) | const |
Format a string appropriate for insertion in a menu.
pLabel | if not null, use this instead of the manager's stored label |
Definition at line 808 of file CommandManager.cpp.
References FormatLabelForMenu(), and mCommandNameHash.
Referenced by AddItemList(), FormatLabelForMenu(), and Modify().
|
private |
Definition at line 824 of file CommandManager.cpp.
References entry, and FormatLabelForMenu().
|
private |
Definition at line 829 of file CommandManager.cpp.
References Identifier::GET(), key, label, TranslatableString::Translation(), and wxT().
|
private |
Definition at line 849 of file CommandManager.cpp.
References entry, key, and label.
Referenced by AddItem().
|
static |
Definition at line 206 of file CommandManager.cpp.
Referenced by SelectUtilities::ActivatePlayRegion(), MacroCommands::ApplyCommand(), ScreenshotCommand::CaptureCommands(), ScreenshotCommand::CapturePreferences(), MenuCreator::CreateMenusAndCommands(), CommonTrackPanelCell::DoContextMenu(), EffectUI::DoEffect(), GetInfoCommand::ExploreMenu(), ToolBarButtons::ForAllButtons(), Get(), SelectUtilities::InactivatePlayRegion(), AudacityApp::InitPart2(), MacroCommandsCatalog::MacroCommandsCatalog(), ToolManager::ModifyToolbarMenus(), MenuManager::ModifyUndoMenuItems(), ViewActions::Handler::OnAdvancedVZoom(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacrosPalette(), anonymous_namespace{PluginMenus.cpp}::OnBenchmark(), ToolBarButtons::OnButton(), anonymous_namespace{Contrast.cpp}::anonymous_namespace{Contrast.cpp}::OnContrast(), anonymous_namespace{PluginMenus.cpp}::OnDetectUpstreamDropouts(), LyricsPanel::OnKeyEvent(), MixerBoardFrame::OnKeyEvent(), anonymous_namespace{BatchProcessDialog.cpp}::OnManageMacros(), ProjectWindow::OnMenu(), anonymous_namespace{FreqWindow.cpp}::OnPlotSpectrum(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastAnalyzer(), anonymous_namespace{BatchProcessDialog.cpp}::OnRepeatLastTool(), anonymous_namespace{Screenshot.cpp}::OnScreenshot(), ViewActions::Handler::OnShowClipping(), ViewActions::Handler::OnShowExtraMenus(), ViewActions::Handler::OnShowNameOverlay(), anonymous_namespace{PluginMenus.cpp}::OnSimulateRecordingErrors(), KeyConfigPrefs::Populate(), SelectHandle::Preview(), MenuCreator::RebuildMenuBar(), MenuManager::ReportIfActionNotAllowed(), ToolBar::SetButtonToolTip(), anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode(), MuteButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), CloseButtonHandle::Tip(), and MenuManager::UpdateMenus().
|
static |
Definition at line 211 of file CommandManager.cpp.
References Get(), and project.
void CommandManager::GetAllCommandData | ( | CommandIDs & | names, |
std::vector< NormalizedKeyString > & | keys, | ||
std::vector< NormalizedKeyString > & | default_keys, | ||
TranslatableStrings & | labels, | ||
TranslatableStrings & | categories, | ||
bool | includeMultis | ||
) |
Definition at line 1451 of file CommandManager.cpp.
References entry, mCommandList, and names.
Referenced by KeyConfigPrefs::RefreshBindings().
void CommandManager::GetAllCommandLabels | ( | TranslatableStrings & | labels, |
std::vector< bool > & | vExcludeFromMacros, | ||
bool | includeMultis | ||
) | const |
Definition at line 1432 of file CommandManager.cpp.
References entry, mCommandList, and names.
void CommandManager::GetAllCommandNames | ( | CommandIDs & | names, |
bool | includeMultis | ||
) | const |
Definition at line 1419 of file CommandManager.cpp.
References entry, mCommandList, and names.
TranslatableStrings CommandManager::GetCategories | ( | AudacityProject & | ) |
Definition at line 1387 of file CommandManager.cpp.
References COMMAND, entry, make_iterator_range(), mCommandList, name, and names.
TranslatableString CommandManager::GetCategoryFromName | ( | const CommandID & | name | ) |
Definition at line 1512 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
Referenced by KeyConfigPrefs::OnSet().
NormalizedKeyString CommandManager::GetDefaultKeyFromName | ( | const CommandID & | name | ) |
Definition at line 1532 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
Referenced by KeyConfigPrefs::OnSet().
bool CommandManager::GetEnabled | ( | const CommandID & | name | ) |
Definition at line 992 of file CommandManager.cpp.
References entry, mCommandNameHash, name, and wxT().
Referenced by ToolBarButtons::ForAllButtons().
NormalizedKeyString CommandManager::GetKeyFromName | ( | const CommandID & | name | ) | const |
Definition at line 1521 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
Referenced by DescribeCommandsAndShortcuts(), KeyConfigPrefs::MergeWithExistingKeys(), SelectHandle::Preview(), and KeyConfigPrefs::RefreshKeyInfo().
TranslatableString CommandManager::GetLabelFromName | ( | const CommandID & | name | ) |
Definition at line 1489 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
|
private |
Retrieves the menubar based on the name given in AddMenuBar(name)
Definition at line 368 of file CommandManager.cpp.
References entry, and mMenuBarList.
Referenced by AddMenuBar().
CommandID CommandManager::GetNameFromNumericID | ( | int | id | ) |
Definition at line 1481 of file CommandManager.cpp.
References entry, id, and mCommandNumericIDHash.
int CommandManager::GetNumberOfKeysRead | ( | ) | const |
Definition at line 1004 of file CommandManager.cpp.
References mXMLKeysRead.
Referenced by KeyConfigPrefs::OnImport().
TranslatableString CommandManager::GetPrefixedLabelFromName | ( | const CommandID & | name | ) |
Definition at line 1498 of file CommandManager.cpp.
References entry, TranslatableString::Format(), mCommandNameHash, name, TranslatableString::Stripped(), Verbatim(), and wxT().
Referenced by KeyConfigPrefs::ContainsIllegalDups(), KeyConfigPrefs::MergeWithExistingKeys(), and KeyConfigPrefs::OnSet().
|
private |
HandleCommandEntry() takes a CommandListEntry and executes it returning true iff successful. If you pass any flags, the command won't be executed unless the flags are compatible with the command's flags.
Definition at line 1242 of file CommandManager.cpp.
References AlwaysEnabledFlag, TranslatableString::Ellipses, entry, MenuManager::Get(), cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, anonymous_namespace{CommandManager.cpp}::JournalCode, TranslatableString::MenuCodes, mLastProcessId, mNiceName, Journal::Output(), project, MenuManager::ReportIfActionNotAllowed(), and CommandContext::temporarySelection.
Referenced by FilterKeyEvent(), HandleMenuID(), and HandleTextualCommand().
bool CommandManager::HandleMenuID | ( | AudacityProject & | project, |
int | id, | ||
CommandFlag | flags, | ||
bool | alwaysEnabled | ||
) |
Call this when a menu event is received. If it matches a command, it will call the appropriate CommandManagerListener function. If you pass any flags, the command won't be executed unless the flags are compatible with the command's flags.
Definition at line 1333 of file CommandManager.cpp.
References GlobalHook< GlobalMenuHook, bool(const CommandID &) >::Call(), entry, HandleCommandEntry(), id, mCommandNumericIDHash, mLastProcessId, and project.
CommandManager::TextualCommandResult CommandManager::HandleTextualCommand | ( | const CommandID & | Str, |
const CommandContext & | context, | ||
CommandFlag | flags, | ||
bool | alwaysEnabled | ||
) |
HandleTextualCommand() allows us a limited version of script/batch behavior, since we can get from a string command name to the actual code to run.
Definition at line 1349 of file CommandManager.cpp.
References CommandFailure, CommandNotFound, CommandSuccess, Identifier::empty(), entry, HandleCommandEntry(), mCommandList, and CommandContext::project.
Referenced by CommandDispatch::HandleTextualCommand().
|
overrideprivatevirtual |
Implements XMLTagHandler.
Definition at line 1590 of file CommandManager.cpp.
|
overrideprivate |
Definition at line 1577 of file CommandManager.cpp.
|
overrideprivatevirtual |
Implements XMLTagHandler.
Definition at line 1541 of file CommandManager.cpp.
References key, mCommandNameHash, mXMLKeysRead, and name.
void CommandManager::Modify | ( | const wxString & | name, |
const TranslatableString & | newLabel | ||
) |
Changes the label text of a menu item.
Definition at line 1019 of file CommandManager.cpp.
References entry, FormatLabelForMenu(), mCommandNameHash, and name.
Referenced by RegisterLastAnalyzer(), and RegisterLastTool().
|
private |
Given all of the information for a command, comes up with a NEW unique ID, adds it to a list, and returns the ID. WARNING: Does this conflict with the identifiers set for controls/windows? If it does, a workaround may be to keep controls below wxID_LOWEST and keep menus above wxID_HIGHEST
Definition at line 655 of file CommandManager.cpp.
References CommandManager::Options::accel, CommandManager::Options::allowDup, CommandManager::Options::allowInMacros, AlwaysEnabledFlag, audacity::BasicSettings::BeginGroup(), CommandManager::Options::bIsEffect, bMakingOccultCommands, CommandManager::Options::checker, TranslatableString::Debug(), Identifier::empty(), entry, Identifier::GET(), gPrefs, audacity::BasicSettings::HasEntry(), CommandListEntry::label, label, CommandManager::Options::longName, mCommandKeyHash, mCommandList, mCommandNameHash, mCommandNumericIDHash, mCurrentID, mCurrentMenuName, mMaxListOnly, TranslatableString::MSGID(), mSubMenuList, name, NextIdentifier(), CommandManager::Options::parameter, audacity::BasicSettings::Read(), CommandManager::Options::skipKeyDown, TranslatableString::Stripped(), CommandManager::Options::wantKeyUp, and wxT().
Referenced by AddGlobalCommand(), AddItem(), and AddItemList().
|
private |
Definition at line 639 of file CommandManager.cpp.
Referenced by Enable(), and NewIdentifier().
|
delete |
void CommandManager::PopMenuBar | ( | ) |
Typically used to switch back and forth between adding to a hidden menu bar and adding to one that is visible
Definition at line 396 of file CommandManager.cpp.
References mMenuBarList.
Referenced by EndOccultCommands().
void CommandManager::PurgeData | ( | ) |
Definition at line 327 of file CommandManager.cpp.
References COMMAND, mCommandKeyHash, mCommandList, mCommandNameHash, mCommandNumericIDHash, mCurrentID, mCurrentMenuName, mMenuBarList, and mSubMenuList.
Referenced by MenuCreator::RebuildMenuBar(), and ~CommandManager().
void CommandManager::RegisterLastAnalyzer | ( | const CommandContext & | context | ) |
Definition at line 1290 of file CommandManager.cpp.
References MenuManager::Get(), mLastProcessId, mNiceName, Modify(), CommandContext::project, MenuCreator::repeattypeunique, wxT(), and XO().
Referenced by anonymous_namespace{Contrast.cpp}::anonymous_namespace{Contrast.cpp}::OnContrast(), and anonymous_namespace{FreqWindow.cpp}::OnPlotSpectrum().
void CommandManager::RegisterLastTool | ( | const CommandContext & | context | ) |
Definition at line 1303 of file CommandManager.cpp.
References MenuManager::Get(), mLastProcessId, mNiceName, Modify(), CommandContext::project, MenuCreator::repeattypeunique, wxT(), and XO().
Referenced by anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacrosPalette(), anonymous_namespace{PluginMenus.cpp}::OnBenchmark(), anonymous_namespace{BatchProcessDialog.cpp}::OnManageMacros(), and anonymous_namespace{Screenshot.cpp}::OnScreenshot().
void CommandManager::RemoveDuplicateShortcuts | ( | ) |
Definition at line 1686 of file CommandManager.cpp.
References AudacityMessageBox(), entry, audacity::BasicSettings::Flush(), gPrefs, mCommandList, name, MenuCreator::RebuildAllMenuBars(), TranslatableString::Translation(), audacity::BasicSettings::Write(), wxT(), and XO().
Referenced by AudacityApp::InitPart2().
void CommandManager::SetCommandFlags | ( | const CommandID & | name, |
CommandFlag | flags | ||
) |
Definition at line 1632 of file CommandManager.cpp.
References entry, mCommandNameHash, and name.
Referenced by AddItem().
void CommandManager::SetKeyFromIndex | ( | int | i, |
const NormalizedKeyString & | key | ||
) |
Definition at line 1037 of file CommandManager.cpp.
References entry, key, and mCommandList.
Referenced by KeyConfigPrefs::Cancel(), KeyConfigPrefs::MergeWithExistingKeys(), and KeyConfigPrefs::OnImportDefaults().
void CommandManager::SetKeyFromName | ( | const CommandID & | name, |
const NormalizedKeyString & | key | ||
) |
Definition at line 1028 of file CommandManager.cpp.
References entry, key, mCommandNameHash, and name.
Referenced by KeyConfigPrefs::ClearAllKeys(), KeyConfigPrefs::OnImport(), KeyConfigPrefs::OnSet(), and KeyConfigPrefs::SetKeyForSelected().
void CommandManager::SetMaxList | ( | ) |
Definition at line 306 of file CommandManager.cpp.
References ExcludedList(), gPrefs, mMaxListOnly, audacity::BasicSettings::ReadBool(), and wxT().
Referenced by CommandManager().
void CommandManager::UpdateCheckmarks | ( | AudacityProject & | project | ) |
Definition at line 520 of file CommandManager.cpp.
References entry, mCommandList, and project.
Referenced by SelectUtilities::ActivatePlayRegion(), SelectUtilities::InactivatePlayRegion(), ToolManager::ModifyToolbarMenus(), and anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode().
void CommandManager::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Definition at line 1595 of file CommandManager.cpp.
Referenced by KeyConfigPrefs::OnExport().
|
private |
Definition at line 387 of file CommandManager.h.
Referenced by BeginOccultCommands(), EndOccultCommands(), and NewIdentifier().
|
private |
Definition at line 379 of file CommandManager.h.
Referenced by AddItem(), AddItemList(), AddSeparator(), BeginSubMenu(), CommandManager(), and EndSubMenu().
|
private |
Definition at line 374 of file CommandManager.h.
Referenced by FilterKeyEvent(), NewIdentifier(), and PurgeData().
|
private |
Definition at line 372 of file CommandManager.h.
Referenced by EnableUsingFlags(), GetAllCommandData(), GetAllCommandLabels(), GetAllCommandNames(), GetCategories(), HandleTextualCommand(), NewIdentifier(), PurgeData(), RemoveDuplicateShortcuts(), SetKeyFromIndex(), and UpdateCheckmarks().
|
private |
Definition at line 373 of file CommandManager.h.
Referenced by Check(), Enable(), FormatLabelForMenu(), GetCategoryFromName(), GetDefaultKeyFromName(), GetEnabled(), GetKeyFromName(), GetLabelFromName(), GetPrefixedLabelFromName(), HandleXMLTag(), Modify(), NewIdentifier(), PurgeData(), SetCommandFlags(), and SetKeyFromName().
|
private |
Definition at line 375 of file CommandManager.h.
Referenced by DoRepeatProcess(), Enable(), GetNameFromNumericID(), HandleMenuID(), NewIdentifier(), and PurgeData().
|
private |
Definition at line 376 of file CommandManager.h.
Referenced by NewIdentifier(), and PurgeData().
|
private |
Definition at line 385 of file CommandManager.h.
Referenced by BeginMainMenu(), BeginMenu(), CurrentMenu(), and EndMainMenu().
|
private |
Definition at line 381 of file CommandManager.h.
Referenced by BeginMainMenu(), EndMainMenu(), NewIdentifier(), and PurgeData().
|
private |
Definition at line 383 of file CommandManager.h.
Referenced by CommandManager(), DoRepeatProcess(), HandleCommandEntry(), HandleMenuID(), RegisterLastAnalyzer(), and RegisterLastTool().
|
private |
Definition at line 368 of file CommandManager.h.
Referenced by NewIdentifier(), and SetMaxList().
|
private |
Definition at line 370 of file CommandManager.h.
Referenced by AddMenuBar(), CurrentMenuBar(), GetMenuBar(), PopMenuBar(), and PurgeData().
|
private |
Definition at line 382 of file CommandManager.h.
Referenced by HandleCommandEntry(), RegisterLastAnalyzer(), and RegisterLastTool().
|
private |
Definition at line 371 of file CommandManager.h.
Referenced by BeginSubMenu(), CurrentSubMenu(), EndMenu(), EndSubMenu(), NewIdentifier(), and PurgeData().
|
private |
Definition at line 388 of file CommandManager.h.
Referenced by BeginOccultCommands(), and EndOccultCommands().
|
private |
Definition at line 377 of file CommandManager.h.
Referenced by GetNumberOfKeysRead(), and HandleXMLTag().
|
private |
Definition at line 384 of file CommandManager.h.
Referenced by BeginMainMenu(), and EndMainMenu().