Audacity 3.2.0
|
CommandManager implements a system for organizing all user-callable commands. More...
#include <CommandManager.h>
Classes | |
struct | CommandListEntry |
struct | Factory |
struct | GlobalMenuHook |
struct | Populator |
Public Types | |
enum | { repeattypenone = 0 , repeattypeplugin = 1 , repeattypeunique = 2 , repeattypeapplymacro = 3 } |
enum | TextualCommandResult { CommandFailure , CommandSuccess , CommandNotFound } |
Public Types inherited from Observer::Publisher< MenuUpdateMessage > | |
using | message_type = MenuUpdateMessage |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const MenuUpdateMessage &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Member Functions | |
CommandManager (AudacityProject &project) | |
CommandManager (const CommandManager &)=delete | |
CommandManager & | operator= (const CommandManager &)=delete |
~CommandManager () override | |
CommandFlag | GetUpdateFlags (bool quick=false) const |
void | UpdatePrefs () override |
bool | ReportIfActionNotAllowed (const TranslatableString &Name, CommandFlag &flags, CommandFlag flagsRqd) |
bool | TryToMakeActionAllowed (CommandFlag &flags, CommandFlag flagsRqd) |
AudacityProject & | GetProject () |
size_t | NCommands () const |
void | PurgeData () |
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 | HandleMenuID (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 () |
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, TranslatableStrings &prefixes, bool includeMultis) |
CommandID | GetNameFromNumericID (int id) const |
TranslatableString | GetLabelFromName (const CommandID &name) const |
TranslatableString | GetPrefixedLabelFromName (const CommandID &name) const |
TranslatableString | GetCategoryFromName (const CommandID &name) const |
NormalizedKeyString | GetKeyFromName (const CommandID &name) const |
NormalizedKeyString | GetDefaultKeyFromName (const CommandID &name) const |
bool | GetEnabled (const CommandID &name) const |
int | GetNumberOfKeysRead () const |
TranslatableString | ReportDuplicateShortcuts () |
void | WriteXML (XMLWriter &xmlFile) const |
TranslatableString | DescribeCommandsAndShortcuts (const ComponentInterfaceSymbol commands[], size_t nCommands) const |
void | UpdateCheckmarks () |
wxString | FormatLabelForMenu (const CommandID &id, const TranslatableString *pLabel) const |
Format a string appropriate for insertion in a menu. More... | |
void | ModifyUndoMenuItems () |
void | UpdateMenus (bool checkActive=true) |
Public Member Functions inherited from XMLTagHandler | |
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) |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Public Member Functions inherited from Observer::Publisher< MenuUpdateMessage > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Static Public Member Functions | |
static CommandManager & | Get (AudacityProject &project) |
static const CommandManager & | Get (const AudacityProject &project) |
static const std::vector< NormalizedKeyString > & | ExcludedList () |
Public Attributes | |
CommandFlag | mLastFlags = AlwaysEnabledFlag |
PluginID | mLastGenerator {} |
PluginID | mLastEffect {} |
PluginID | mLastAnalyzer {} |
int | mLastAnalyzerRegistration = repeattypenone |
int | mLastAnalyzerRegisteredId = -1 |
PluginID | mLastTool {} |
int | mLastToolRegistration = repeattypenone |
int | mLastToolRegisteredId = -1 |
unsigned | mRepeatGeneratorFlags = 0 |
unsigned | mRepeatEffectFlags = 0 |
unsigned | mRepeatAnalyzerFlags = 0 |
unsigned | mRepeatToolFlags = 0 |
int | mWhatIfNoSelection |
bool | mStopIfWasPaused { true } |
Protected Types | |
using | CommandKeyHash = std::unordered_map< NormalizedKeyString, CommandListEntry * > |
Protected Member Functions | |
bool | HandleCommandEntry (const CommandListEntry *entry, CommandFlag flags, bool alwaysEnabled, const wxEvent *evt=nullptr, const CommandContext *pGivenContext=nullptr) |
virtual void | ExecuteCommand (const CommandContext &context, const wxEvent *evt, const CommandListEntry &entry) |
virtual bool | ReallyDoQuickCheck () |
Default implementation returns true. More... | |
Protected Member Functions inherited from Observer::Publisher< MenuUpdateMessage > | |
CallbackReturn | Publish (const MenuUpdateMessage &message) |
Send a message to connected callbacks. More... | |
Protected Attributes | |
AudacityProject & | mProject |
CommandKeyHash | mCommandKeyHash |
Static Protected Attributes | |
static const TranslatableString | COMMAND = XO("Command") |
Private Types | |
using | CommandList = std::vector< std::unique_ptr< CommandListEntry > > |
using | CommandNameHash = std::unordered_map< CommandID, CommandListEntry * > |
using | CommandNumericIDHash = std::unordered_map< int, CommandListEntry * > |
Private Member Functions | |
void | Enable (CommandListEntry &entry, bool enabled) |
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 |
void | TellUserWhyDisallowed (const TranslatableString &Name, CommandFlag flagsGot, CommandFlag flagsRequired) |
void | OnUndoRedo (struct UndoRedoMessage) |
Private Member Functions inherited from PrefsListener | |
PrefsListener () | |
virtual | ~PrefsListener () |
virtual void | UpdatePrefs ()=0 |
virtual void | UpdateSelectedPrefs (int id) |
Static Private Member Functions | |
static int | NextIdentifier (int ID) |
Static Private Member Functions inherited from PrefsListener | |
static void | Broadcast (int id=0) |
Call this static function to notify all PrefsListener objects. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from Observer::Publisher< MenuUpdateMessage > | |
static constexpr bool | notifies_all |
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 49 of file CommandManager.h.
|
protected |
Definition at line 431 of file CommandManager.h.
|
private |
Definition at line 441 of file CommandManager.h.
|
private |
Definition at line 445 of file CommandManager.h.
|
private |
Definition at line 450 of file CommandManager.h.
anonymous enum |
Enumerator | |
---|---|
repeattypenone | |
repeattypeplugin | |
repeattypeunique | |
repeattypeapplymacro |
Definition at line 100 of file CommandManager.h.
Enumerator | |
---|---|
CommandFailure | |
CommandSuccess | |
CommandNotFound |
Definition at line 244 of file CommandManager.h.
|
explicit |
Standard Constructor
Definition at line 123 of file CommandManager.cpp.
References mLastProcessId, and UpdatePrefs().
|
delete |
|
override |
Class Destructor. Includes PurgeData, which removes menubars
Definition at line 145 of file CommandManager.cpp.
References PurgeData().
void CommandManager::Check | ( | const CommandID & | name, |
bool | checked | ||
) |
Definition at line 720 of file CommandManager.cpp.
References mCommandNameHash, and name.
TranslatableString CommandManager::DescribeCommandsAndShortcuts | ( | const ComponentInterfaceSymbol | commands[], |
size_t | nCommands | ||
) | const |
Formatting summaries that include shortcut keys
Definition at line 763 of file CommandManager.cpp.
References TranslatableString::empty(), TranslatableString::Format(), anonymous_namespace{ExportPCM.cpp}::format, GetKeyFromName(), BasicUI::IsUsingRtlLayout(), name, Verbatim(), and wxT().
void CommandManager::DoRepeatProcess | ( | const CommandContext & | context, |
int | id | ||
) |
Definition at line 891 of file CommandManager.cpp.
References entry, anonymous_namespace{Scrubbing.cpp}::finder, audacity::cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, 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 634 of file CommandManager.cpp.
References entry, mCommandNumericIDHash, NextIdentifier(), and wxT().
void CommandManager::Enable | ( | const wxString & | name, |
bool | enabled | ||
) |
Definition at line 663 of file CommandManager.cpp.
References Enable(), mCommandNameHash, name, and wxT().
Referenced by Enable(), EnableUsingFlags(), and ModifyUndoMenuItems().
void CommandManager::EnableUsingFlags | ( | CommandFlag | flags, |
CommandFlag | strictFlags | ||
) |
Definition at line 673 of file CommandManager.cpp.
References Enable(), entry, mCommandList, and none.
Referenced by UpdateMenus().
|
static |
Definition at line 150 of file CommandManager.cpp.
References details::begin(), and details::end().
Referenced by KeyConfigPrefs::FilterKeys(), and CommandManager::Populator::SetMaxList().
|
protectedvirtual |
Reimplemented in MenuCreator.
Definition at line 853 of file CommandManager.cpp.
References entry, anonymous_namespace{Scrubbing.cpp}::finder, audacity::cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, mLastProcessId, and mProject.
Referenced by MenuCreator::ExecuteCommand(), and HandleCommandEntry().
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 598 of file CommandManager.cpp.
References CommandManager::CommandListEntry::FormatLabelForMenu(), and mCommandNameHash.
|
static |
Definition at line 110 of file CommandManager.cpp.
Referenced by SelectUtilities::ActivatePlayRegion(), CommandManager::Populator::AddItem(), anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), MacroCommands::ApplyCommandInBatchMode(), Scrubber::CheckMenuItems(), ToolManager::CreateWindows(), CommonTrackPanelCell::DoContextMenu(), AudacityApplicationLogic::DoEffect(), ProjectAudioManager::DoRecord(), anonymous_namespace{EditMenus.cpp}::EditMenu(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), GetInfoCommand::ExploreMenu(), ToolBarButtons::ForAllButtons(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), MenuCreator::Get(), Get(), CommandDispatch::HandleTextualCommand(), anonymous_namespace{PluginMenus.cpp}::HasLastAnalyzerFlag(), anonymous_namespace{PluginMenus.cpp}::HasLastEffectFlag(), anonymous_namespace{PluginMenus.cpp}::HasLastGeneratorFlag(), anonymous_namespace{BatchProcessDialog.cpp}::HasLastToolFlag(), SelectUtilities::InactivatePlayRegion(), MacroCommandsCatalog::MacroCommandsCatalog(), ToolManager::ModifyToolbarMenus(), CommandManager::Populator::NewIdentifier(), EffectUIHost::OnApply(), 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(), anonymous_namespace{BatchProcessDialog.cpp}::OnManageMacros(), ProjectWindow::OnMenu(), anonymous_namespace{FreqWindow.cpp}::OnPlotSpectrum(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastAnalyzer(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastEffect(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastGenerator(), anonymous_namespace{BatchProcessDialog.cpp}::OnRepeatLastTool(), anonymous_namespace{PluginMenus.cpp}::OnResetConfig(), anonymous_namespace{ViewMenus.cpp}::OnShowClipping(), anonymous_namespace{ViewMenus.cpp}::OnShowExtraMenus(), anonymous_namespace{PluginMenus.cpp}::OnSimulateRecordingErrors(), ProjectWindow::OnUpdateUI(), ProjectWindow::OnViewportMessage(), PluginMenuItems(), KeyConfigPrefs::Populate(), Scrubber::PopulatePopupMenu(), SelectHandle::Preview(), SelectUtilities::SelectAllIfNone(), SelectUtilities::SelectAllIfNoneAndAllowed(), ToolBar::SetButtonToolTip(), anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode(), MuteButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), and CloseButtonHandle::Tip().
|
static |
Definition at line 115 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, | ||
TranslatableStrings & | prefixes, | ||
bool | includeMultis | ||
) |
Definition at line 1037 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 1018 of file CommandManager.cpp.
References entry, mCommandList, and names.
void CommandManager::GetAllCommandNames | ( | CommandIDs & | names, |
bool | includeMultis | ||
) | const |
Definition at line 1005 of file CommandManager.cpp.
References entry, mCommandList, and names.
TranslatableStrings CommandManager::GetCategories | ( | ) |
Definition at line 973 of file CommandManager.cpp.
References COMMAND, entry, make_iterator_range(), mCommandList, name, and names.
TranslatableString CommandManager::GetCategoryFromName | ( | const CommandID & | name | ) | const |
Definition at line 1097 of file CommandManager.cpp.
References mCommandNameHash, and name.
Referenced by KeyConfigPrefs::OnSet().
NormalizedKeyString CommandManager::GetDefaultKeyFromName | ( | const CommandID & | name | ) | const |
Definition at line 1113 of file CommandManager.cpp.
References mCommandNameHash, and name.
Referenced by KeyConfigPrefs::OnSet().
bool CommandManager::GetEnabled | ( | const CommandID & | name | ) | const |
Definition at line 697 of file CommandManager.cpp.
References mCommandNameHash, name, and wxT().
Referenced by ToolBarButtons::ForAllButtons().
NormalizedKeyString CommandManager::GetKeyFromName | ( | const CommandID & | name | ) | const |
Definition at line 1105 of file CommandManager.cpp.
References mCommandNameHash, and name.
Referenced by DescribeCommandsAndShortcuts(), KeyConfigPrefs::MergeWithExistingKeys(), SelectHandle::Preview(), and KeyConfigPrefs::RefreshKeyInfo().
TranslatableString CommandManager::GetLabelFromName | ( | const CommandID & | name | ) | const |
Definition at line 1071 of file CommandManager.cpp.
References mCommandNameHash, and name.
CommandID CommandManager::GetNameFromNumericID | ( | int | id | ) | const |
Definition at line 1063 of file CommandManager.cpp.
References mCommandNumericIDHash.
int CommandManager::GetNumberOfKeysRead | ( | ) | const |
Definition at line 715 of file CommandManager.cpp.
References mXMLKeysRead.
Referenced by KeyConfigPrefs::OnImport().
TranslatableString CommandManager::GetPrefixedLabelFromName | ( | const CommandID & | name | ) | const |
Definition at line 1080 of file CommandManager.cpp.
References entry, TranslatableString::Format(), mCommandNameHash, name, TranslatableString::Stripped(), Verbatim(), and wxT().
Referenced by KeyConfigPrefs::ContainsIllegalDups(), KeyConfigPrefs::MergeWithExistingKeys(), and KeyConfigPrefs::OnSet().
|
inline |
Definition at line 117 of file CommandManager.h.
Referenced by HandleTextualCommand().
CommandFlag CommandManager::GetUpdateFlags | ( | bool | quick = false | ) | const |
Definition at line 1281 of file CommandManager.cpp.
References mProject, ReservedCommandFlag::Options(), and ReservedCommandFlag::RegisteredPredicates().
Referenced by ToolBarButtons::OnButton(), ProjectWindow::OnMenu(), SelectUtilities::SelectAllIfNone(), SelectUtilities::SelectAllIfNoneAndAllowed(), TryToMakeActionAllowed(), and UpdateMenus().
|
protected |
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 819 of file CommandManager.cpp.
References AlwaysEnabledFlag, TranslatableString::Ellipses, entry, ExecuteCommand(), TranslatableString::MenuCodes, mNiceName, mProject, ReportIfActionNotAllowed(), and CommandContext::temporarySelection.
Referenced by HandleMenuID(), and HandleTextualCommand().
bool CommandManager::HandleMenuID | ( | 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 914 of file CommandManager.cpp.
References GlobalHook< GlobalMenuHook, bool(const CommandID &) >::Call(), entry, HandleCommandEntry(), id, mCommandNumericIDHash, and mLastProcessId.
CommandManager::TextualCommandResult CommandManager::HandleTextualCommand | ( | const CommandID & | Str, |
const CommandContext & | context, | ||
CommandFlag | flags, | ||
bool | alwaysEnabled | ||
) |
&context.project == &GetProject()
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 934 of file CommandManager.cpp.
References CommandFailure, CommandNotFound, CommandSuccess, Identifier::empty(), entry, GetProject(), HandleCommandEntry(), mCommandList, and CommandContext::project.
|
overrideprivatevirtual |
Implements XMLTagHandler.
Definition at line 1173 of file CommandManager.cpp.
|
overrideprivate |
Definition at line 1160 of file CommandManager.cpp.
|
overrideprivatevirtual |
Implements XMLTagHandler.
Definition at line 1122 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 732 of file CommandManager.cpp.
References mCommandNameHash, and name.
Referenced by ModifyUndoMenuItems(), RegisterLastAnalyzer(), and RegisterLastTool().
void CommandManager::ModifyUndoMenuItems | ( | ) |
Definition at line 1438 of file CommandManager.cpp.
References anonymous_namespace{ExportPCM.cpp}::desc, Enable(), ProjectHistory::Get(), UndoManager::Get(), Modify(), mProject, project, wxT(), and XXO().
Referenced by anonymous_namespace{EditMenus.cpp}::EditMenu(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName(), and OnUndoRedo().
|
inline |
Definition at line 118 of file CommandManager.h.
Referenced by SetKeyFromIndex().
|
staticprivate |
Definition at line 429 of file CommandManager.cpp.
Referenced by Enable(), and CommandManager::Populator::NewIdentifier().
|
private |
Definition at line 1465 of file CommandManager.cpp.
References ModifyUndoMenuItems(), UndoRedoMessage::Pushed, UndoRedoMessage::Renamed, UndoRedoMessage::Reset, UndoRedoMessage::type, UndoRedoMessage::UndoOrRedo, and UpdateMenus().
|
delete |
void CommandManager::PurgeData | ( | ) |
Definition at line 238 of file CommandManager.cpp.
References mCommandKeyHash, mCommandList, mCommandNameHash, and mCommandNumericIDHash.
Referenced by MenuCreator::RebuildMenuBar(), and ~CommandManager().
|
protectedvirtual |
Default implementation returns true.
Reimplemented in MenuCreator.
Definition at line 1521 of file CommandManager.cpp.
Referenced by UpdateMenus().
void CommandManager::RegisterLastAnalyzer | ( | const CommandContext & | context | ) |
Definition at line 868 of file CommandManager.cpp.
References mLastAnalyzerRegisteredId, mLastAnalyzerRegistration, mLastProcessId, mNiceName, Modify(), 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 880 of file CommandManager.cpp.
References mLastProcessId, mLastToolRegisteredId, mLastToolRegistration, mNiceName, Modify(), repeattypeunique, wxT(), and XO().
Referenced by anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacrosPalette(), anonymous_namespace{PluginMenus.cpp}::OnBenchmark(), and anonymous_namespace{BatchProcessDialog.cpp}::OnManageMacros().
TranslatableString CommandManager::ReportDuplicateShortcuts | ( | ) |
Definition at line 1257 of file CommandManager.cpp.
References entry, gPrefs, mCommandList, name, audacity::BasicSettings::Write(), wxT(), and XO().
Referenced by MenuCreator::RemoveDuplicateShortcuts().
bool CommandManager::ReportIfActionNotAllowed | ( | const TranslatableString & | Name, |
CommandFlag & | flags, | ||
CommandFlag | flagsRqd | ||
) |
Definition at line 1321 of file CommandManager.cpp.
References mProject, project, TellUserWhyDisallowed(), and TryToMakeActionAllowed().
Referenced by HandleCommandEntry(), and EffectUIHost::OnApply().
void CommandManager::SetCommandFlags | ( | const CommandID & | name, |
CommandFlag | flags | ||
) |
Definition at line 1203 of file CommandManager.cpp.
References mCommandNameHash, and name.
Referenced by CommandManager::Populator::AddItem().
void CommandManager::SetKeyFromIndex | ( | int | i, |
const NormalizedKeyString & | key | ||
) |
0 <= i && i < NCommands()
Definition at line 753 of file CommandManager.cpp.
References entry, key, mCommandList, and NCommands().
Referenced by KeyConfigPrefs::Cancel(), KeyConfigPrefs::MergeWithExistingKeys(), and KeyConfigPrefs::OnImportDefaults().
void CommandManager::SetKeyFromName | ( | const CommandID & | name, |
const NormalizedKeyString & | key | ||
) |
Definition at line 745 of file CommandManager.cpp.
References key, mCommandNameHash, and name.
Referenced by KeyConfigPrefs::ClearAllKeys(), KeyConfigPrefs::OnImport(), KeyConfigPrefs::OnSet(), and KeyConfigPrefs::SetKeyForSelected().
|
private |
Definition at line 1366 of file CommandManager.cpp.
References ReservedCommandFlag::Options(), BasicUI::ShowErrorDialog(), and XO().
Referenced by ReportIfActionNotAllowed().
bool CommandManager::TryToMakeActionAllowed | ( | CommandFlag & | flags, |
CommandFlag | flagsRqd | ||
) |
Determines if flags for command are compatible with current state. If not, then try some recovery action to make it so.
Definition at line 1335 of file CommandManager.cpp.
References RegisteredMenuItemEnabler::Enablers(), details::end(), GetUpdateFlags(), mProject, and project.
Referenced by ProjectAudioManager::DoRecord(), and ReportIfActionNotAllowed().
void CommandManager::UpdateCheckmarks | ( | ) |
Definition at line 339 of file CommandManager.cpp.
References entry, mCommandList, and mProject.
Referenced by SelectUtilities::ActivatePlayRegion(), SelectUtilities::InactivatePlayRegion(), ToolManager::ModifyToolbarMenus(), and anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode().
void CommandManager::UpdateMenus | ( | bool | checkActive = true | ) |
Definition at line 1482 of file CommandManager.cpp.
References RegisteredMenuItemEnabler::Enablers(), EnableUsingFlags(), GetUpdateFlags(), mLastFlags, mProject, mWhatIfNoSelection, project, Observer::Publisher< MenuUpdateMessage >::Publish(), and ReallyDoQuickCheck().
Referenced by MacroCommands::ApplyCommandInBatchMode(), AudacityApplicationLogic::DoEffect(), OnUndoRedo(), ProjectWindow::OnUpdateUI(), and ProjectWindow::OnViewportMessage().
|
overridevirtual |
Implements PrefsListener.
Definition at line 133 of file CommandManager.cpp.
References gPrefs, mWhatIfNoSelection, audacity::BasicSettings::Read(), and wxT().
Referenced by CommandManager().
void CommandManager::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Definition at line 1178 of file CommandManager.cpp.
References entry, mCommandList, and wxT().
Referenced by KeyConfigPrefs::OnExport().
|
staticprotected |
Definition at line 56 of file CommandManager.h.
Referenced by GetCategories().
|
protected |
value == mCommandList[i].get()
Definition at line 435 of file CommandManager.h.
Referenced by PurgeData().
|
private |
mCommandList[i] != nullptr
Definition at line 443 of file CommandManager.h.
Referenced by EnableUsingFlags(), GetAllCommandData(), GetAllCommandLabels(), GetAllCommandNames(), GetCategories(), HandleTextualCommand(), PurgeData(), ReportDuplicateShortcuts(), SetKeyFromIndex(), UpdateCheckmarks(), and WriteXML().
|
private |
value == mCommandList[i].get()
Definition at line 448 of file CommandManager.h.
Referenced by Check(), Enable(), FormatLabelForMenu(), GetCategoryFromName(), GetDefaultKeyFromName(), GetEnabled(), GetKeyFromName(), GetLabelFromName(), GetPrefixedLabelFromName(), HandleXMLTag(), Modify(), PurgeData(), SetCommandFlags(), and SetKeyFromName().
|
private |
value == mCommandList[i].get()
Definition at line 453 of file CommandManager.h.
Referenced by DoRepeatProcess(), Enable(), GetNameFromNumericID(), HandleMenuID(), and PurgeData().
PluginID CommandManager::mLastAnalyzer {} |
Definition at line 94 of file CommandManager.h.
Referenced by anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), and anonymous_namespace{PluginMenus.cpp}::HasLastAnalyzerFlag().
int CommandManager::mLastAnalyzerRegisteredId = -1 |
Definition at line 96 of file CommandManager.h.
Referenced by RegisterLastAnalyzer().
int CommandManager::mLastAnalyzerRegistration = repeattypenone |
Definition at line 95 of file CommandManager.h.
Referenced by anonymous_namespace{PluginMenus.cpp}::HasLastAnalyzerFlag(), and RegisterLastAnalyzer().
PluginID CommandManager::mLastEffect {} |
Definition at line 93 of file CommandManager.h.
Referenced by anonymous_namespace{PluginMenus.cpp}::EffectMenu(), and anonymous_namespace{PluginMenus.cpp}::HasLastEffectFlag().
CommandFlag CommandManager::mLastFlags = AlwaysEnabledFlag |
Definition at line 89 of file CommandManager.h.
Referenced by MenuCreator::CreateMenusAndCommands(), and UpdateMenus().
PluginID CommandManager::mLastGenerator {} |
Definition at line 92 of file CommandManager.h.
Referenced by anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), and anonymous_namespace{PluginMenus.cpp}::HasLastGeneratorFlag().
|
private |
Definition at line 457 of file CommandManager.h.
Referenced by CommandManager(), DoRepeatProcess(), ExecuteCommand(), HandleMenuID(), RegisterLastAnalyzer(), and RegisterLastTool().
PluginID CommandManager::mLastTool {} |
Definition at line 97 of file CommandManager.h.
Referenced by PluginMenuItems().
int CommandManager::mLastToolRegisteredId = -1 |
Definition at line 99 of file CommandManager.h.
Referenced by RegisterLastTool().
int CommandManager::mLastToolRegistration = repeattypenone |
Definition at line 98 of file CommandManager.h.
Referenced by RegisterLastTool().
|
private |
Definition at line 456 of file CommandManager.h.
Referenced by HandleCommandEntry(), RegisterLastAnalyzer(), and RegisterLastTool().
|
protected |
Definition at line 371 of file CommandManager.h.
Referenced by CommandManager::Populator::AddItem(), MenuCreator::CreateMenusAndCommands(), ExecuteCommand(), GetUpdateFlags(), HandleCommandEntry(), ModifyUndoMenuItems(), CommandManager::Populator::NewIdentifier(), MenuCreator::ReallyDoQuickCheck(), MenuCreator::RebuildMenuBar(), ReportIfActionNotAllowed(), TryToMakeActionAllowed(), UpdateCheckmarks(), and UpdateMenus().
unsigned CommandManager::mRepeatAnalyzerFlags = 0 |
Definition at line 108 of file CommandManager.h.
unsigned CommandManager::mRepeatEffectFlags = 0 |
Definition at line 107 of file CommandManager.h.
unsigned CommandManager::mRepeatGeneratorFlags = 0 |
Definition at line 106 of file CommandManager.h.
unsigned CommandManager::mRepeatToolFlags = 0 |
Definition at line 109 of file CommandManager.h.
bool CommandManager::mStopIfWasPaused { true } |
Definition at line 115 of file CommandManager.h.
|
private |
Definition at line 459 of file CommandManager.h.
int CommandManager::mWhatIfNoSelection |
Definition at line 112 of file CommandManager.h.
Referenced by UpdateMenus(), and UpdatePrefs().
|
private |
Definition at line 454 of file CommandManager.h.
Referenced by GetNumberOfKeysRead(), and HandleXMLTag().