Audacity 3.2.0
CommandManager.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 CommandManager.h
6
7 Brian Gunlogson
8 Dominic Mazzoni
9
10**********************************************************************/
11
12#ifndef __AUDACITY_COMMAND_MANAGER__
13#define __AUDACITY_COMMAND_MANAGER__
14
15#include "Identifier.h"
16
17#include "Callable.h"
18#include "ClientData.h"
19#include "CommandFunctors.h"
20#include "CommandFlag.h"
21#include "GlobalVariable.h"
22
23#include "Keyboard.h"
24
25#include "Prefs.h"
26#include "Project.h"
27#include "Registry.h"
28
29#include <vector>
30
31#include "XMLTagHandler.h"
32
33#include <unordered_map>
34
35class wxEvent;
36class wxMenu;
37class wxMenuBar;
39
40class BoolSetting;
41
42struct MenuBarListEntry;
43struct SubMenuListEntry;
44struct CommandListEntry;
45
46using MenuBarList = std::vector < MenuBarListEntry >;
47using SubMenuList = std::vector < SubMenuListEntry >;
48
49// This is an array of pointers, not structures, because the hash maps also point to them,
50// so we don't want the structures to relocate with vector operations.
51using CommandList = std::vector<std::unique_ptr<CommandListEntry>>;
52
53using CommandKeyHash = std::unordered_map<NormalizedKeyString, CommandListEntry*>;
54using CommandNameHash = std::unordered_map<CommandID, CommandListEntry*>;
55using CommandNumericIDHash = std::unordered_map<int, CommandListEntry*>;
56
57class AudacityProject;
58class CommandContext;
59
60class AUDACITY_DLL_API CommandManager final
61 : public XMLTagHandler
62 , public ClientData::Base
63{
64 public:
66 static const CommandManager &Get( const AudacityProject &project );
67
68 // Interception of menu item handling.
69 // If it returns true, bypass the usual dispatch of commands.
70 struct AUDACITY_DLL_API GlobalMenuHook : GlobalHook<GlobalMenuHook,
71 bool(const CommandID&)
72 >{};
73
74 //
75 // Constructor / Destructor
76 //
77
79 virtual ~CommandManager();
80
82 CommandManager &operator= (const CommandManager&) = delete;
83
84 void SetMaxList();
85 void PurgeData();
86
87 //
88 // Creating menus and adding commands
89 //
90
91 std::unique_ptr<wxMenuBar> AddMenuBar(const wxString & sMenu);
92
93 wxMenu *BeginMenu(const TranslatableString & tName);
94 void EndMenu();
95
96 // type of a function that determines checkmark state
97 using CheckFn = std::function< bool(AudacityProject&) >;
98
99 // For specifying unusual arguments in AddItem
100 struct AUDACITY_DLL_API Options
101 {
103 // Allow implicit construction from an accelerator string, which is
104 // a very common case
105 Options( const wxChar *accel_ ) : accel{ accel_ } {}
106 // A two-argument constructor for another common case
108 const wxChar *accel_,
109 const TranslatableString &longName_ )
110 : accel{ accel_ }, longName{ longName_ } {}
111
112 Options &&Accel (const wxChar *value) &&
113 { accel = value; return std::move(*this); }
114 Options &&IsEffect (bool value = true) &&
115 { bIsEffect = value; return std::move(*this); }
117 { parameter = value; return std::move(*this); }
119 { longName = value; return std::move(*this); }
121 { global = true; return std::move(*this); }
123 { useStrictFlags = true; return std::move(*this); }
125 { wantKeyUp = true; return std::move(*this); }
127 { skipKeyDown = true; return std::move(*this); }
128
129 // This option affects debugging only:
131 { allowDup = true; return std::move(*this); }
132
133 Options &&AllowInMacros ( int value = 1 ) &&
134 { allowInMacros = value; return std::move(*this); }
135
136 // CheckTest is overloaded
137 // Take arbitrary predicate
139 { checker = fn; return std::move(*this); }
140 // Take a preference path
141 Options &&CheckTest (const wxChar *key, bool defaultValue) && {
142 checker = MakeCheckFn( key, defaultValue );
143 return std::move(*this);
144 }
145 // Take a BoolSetting
146 Options &&CheckTest ( const BoolSetting &setting ) && {
147 checker = MakeCheckFn( setting );
148 return std::move(*this);
149 }
150
151 const wxChar *accel{ wxT("") };
152 CheckFn checker; // default value means it's not a check item
153 bool bIsEffect{ false };
154 CommandParameter parameter{};
156 bool global{ false };
157 bool useStrictFlags{ false };
158 bool wantKeyUp{ false };
159 bool skipKeyDown{ false };
160 bool allowDup{ false };
161 int allowInMacros{ -1 }; // 0 = never, 1 = always, -1 = deduce from label
162
163 private:
164 static CheckFn
165 MakeCheckFn( const wxString key, bool defaultValue );
166 static CheckFn
167 MakeCheckFn( const BoolSetting &setting );
168 };
169
170 void AddItemList(const CommandID & name,
171 const ComponentInterfaceSymbol items[],
172 size_t nItems,
174 CommandFunctorPointer callback,
175 CommandFlag flags,
176 bool bIsEffect = false);
177
178 void AddItem(AudacityProject &project,
179 const CommandID & name,
180 const TranslatableString &label_in,
182 CommandFunctorPointer callback,
183 CommandFlag flags,
184 const Options &options = {});
185
186 void AddSeparator();
187
188 void PopMenuBar();
189 void BeginOccultCommands();
190 void EndOccultCommands();
191
192
193 void SetCommandFlags(const CommandID &name, CommandFlag flags);
194
195 //
196 // Modifying menus
197 //
198
199 void EnableUsingFlags(
200 CommandFlag flags, CommandFlag strictFlags);
201 void Enable(const wxString &name, bool enabled);
202 void Check(const CommandID &name, bool checked);
203 void Modify(const wxString &name, const TranslatableString &newLabel);
204
205 //
206 // Modifying accelerators
207 //
208
209 void SetKeyFromName(const CommandID &name, const NormalizedKeyString &key);
210 void SetKeyFromIndex(int i, const NormalizedKeyString &key);
211
212 //
213 // Executing commands
214 //
215
216 // "permit" allows filtering even if the active window isn't a child of the project.
217 // Lyrics and MixerTrackCluster classes use it.
218 bool FilterKeyEvent(AudacityProject *project, const wxKeyEvent & evt, bool permit = false);
219 bool HandleMenuID(AudacityProject &project, int id, CommandFlag flags, bool alwaysEnabled);
220 void RegisterLastAnalyzer(const CommandContext& context);
221 void RegisterLastTool(const CommandContext& context);
222 void DoRepeatProcess(const CommandContext& context, int);
223
227 CommandNotFound
228 };
229
230 TextualCommandResult
232 const CommandContext & context, CommandFlag flags, bool alwaysEnabled);
233
234 //
235 // Accessing
236 //
237
238 TranslatableStrings GetCategories( AudacityProject& );
239 void GetAllCommandNames(CommandIDs &names, bool includeMultis) const;
240 void GetAllCommandLabels(
241 TranslatableStrings &labels, std::vector<bool> &vExcludeFromMacros,
242 bool includeMultis) const;
243 void GetAllCommandData(
245 std::vector<NormalizedKeyString> &keys,
246 std::vector<NormalizedKeyString> &default_keys,
247 TranslatableStrings &labels, TranslatableStrings &categories,
248#if defined(EXPERIMENTAL_KEY_VIEW)
249 TranslatableStrings &prefixes,
250#endif
251 bool includeMultis);
252
253 // Each command is assigned a numerical ID for use in wxMenu and wxEvent,
254 // which need not be the same across platforms or sessions
255 CommandID GetNameFromNumericID( int id );
256
257 TranslatableString GetLabelFromName(const CommandID &name);
258 TranslatableString GetPrefixedLabelFromName(const CommandID &name);
259 TranslatableString GetCategoryFromName(const CommandID &name);
260 NormalizedKeyString GetKeyFromName(const CommandID &name) const;
261 NormalizedKeyString GetDefaultKeyFromName(const CommandID &name);
262
263 bool GetEnabled(const CommandID &name);
264 int GetNumberOfKeysRead() const;
265
266#if defined(_DEBUG)
267 void CheckDups();
268#endif
269 void RemoveDuplicateShortcuts();
270
271 //
272 // Loading/Saving
273 //
274
275 void WriteXML(XMLWriter &xmlFile) const /* not override */;
276
280 TranslatableString DescribeCommandsAndShortcuts(
281 // If a shortcut key is defined for the command, then it is appended,
282 // parenthesized, after the translated name.
283 const ComponentInterfaceSymbol commands[], size_t nCommands) const;
284
285 // Sorted list of the shortcut keys to be excluded from the standard defaults
286 static const std::vector<NormalizedKeyString> &ExcludedList();
287
288private:
289
290 //
291 // Creating menus and adding commands
292 //
293
294 int NextIdentifier(int ID);
295 CommandListEntry *NewIdentifier(const CommandID & name,
297 wxMenu *menu,
299 CommandFunctorPointer callback,
300 const CommandID &nameSuffix,
301 int index,
302 int count,
303 const Options &options);
304
305 void AddGlobalCommand(const CommandID &name,
308 CommandFunctorPointer callback,
309 const Options &options = {});
310
311 //
312 // Executing commands
313 //
314
315 bool HandleCommandEntry(AudacityProject &project,
316 const CommandListEntry * entry, CommandFlag flags,
317 bool alwaysEnabled, const wxEvent * evt = nullptr,
318 const CommandContext *pGivenContext = nullptr );
319
320 //
321 // Modifying
322 //
323
324 void Enable(CommandListEntry *entry, bool enabled);
325 wxMenu *BeginMainMenu(const TranslatableString & tName);
326 void EndMainMenu();
327 wxMenu* BeginSubMenu(const TranslatableString & tName);
328 void EndSubMenu();
329
330 //
331 // Accessing
332 //
333
334 wxMenuBar * CurrentMenuBar() const;
335 wxMenuBar * GetMenuBar(const wxString & sMenu) const;
336 wxMenu * CurrentSubMenu() const;
337public:
338 wxMenu * CurrentMenu() const;
339
340 void UpdateCheckmarks( AudacityProject &project );
341
343
347 wxString FormatLabelForMenu(
348 const CommandID &id, const TranslatableString *pLabel) const;
349
350private:
351 wxString FormatLabelForMenu(const CommandListEntry *entry) const;
352 wxString FormatLabelForMenu(
353 const TranslatableString &translatableLabel,
354 const NormalizedKeyString &keyStr) const;
355 wxString FormatLabelWithDisabledAccel(const CommandListEntry *entry) const;
356
357 //
358 // Loading/Saving
359 //
360
361 bool HandleXMLTag(const std::string_view& tag, const AttributesList &attrs) override;
362 void HandleXMLEndTag(const std::string_view& tag) override;
363 XMLTagHandler *HandleXMLChild(const std::string_view& tag) override;
364
365private:
366 // mMaxList only holds shortcuts that should not be added (by default)
367 // and is sorted.
368 std::vector<NormalizedKeyString> mMaxListOnly;
369
378
379 bool mbSeparatorAllowed; // false at the start of a menu and immediately after a separator.
380
384 std::unique_ptr<wxMenu> uCurrentMenu;
385 wxMenu *mCurrentMenu {};
386
388 std::unique_ptr< wxMenuBar > mTempMenuBar;
389};
390
391struct AUDACITY_DLL_API MenuVisitor : Registry::Visitor
392{
393 ~MenuVisitor() override;
394
395 // final overrides
396 void BeginGroup( Registry::GroupItemBase &item, const Path &path ) final;
397 void EndGroup( Registry::GroupItemBase &item, const Path& ) final;
398 void Visit( Registry::SingleItem &item, const Path &path ) final;
399
400 // added virtuals
402 virtual void DoBeginGroup( Registry::GroupItemBase &item, const Path &path );
404 virtual void DoEndGroup( Registry::GroupItemBase &item, const Path &path );
405 virtual void DoVisit( Registry::SingleItem &item, const Path &path );
406 virtual void DoSeparator();
407
408private:
409 void MaybeDoSeparator();
410 std::vector<bool> firstItem;
411 std::vector<bool> needSeparator;
412};
413
415{
418 virtual void *GetComputedItemContext() override;
420};
421
422// Define items that populate tables that specifically describe menu trees
423namespace MenuTable {
424 using namespace Registry;
425
428 };
429
430 // These are found by dynamic_cast
431 struct AUDACITY_DLL_API MenuSection {
432 virtual ~MenuSection();
433 };
434 struct AUDACITY_DLL_API WholeMenu {
435 WholeMenu( bool extend = false ) : extension{ extend } {}
436 virtual ~WholeMenu();
438 };
439
443 };
444
445 // Describes a main menu in the toolbar, or a sub-menu
446 struct AUDACITY_DLL_API MenuItem final
448 GroupItem<Traits>, MenuItemData, const Identifier&
449 >
450 , WholeMenu
451 {
452 using Extension::Extension;
453 ~MenuItem() override;
454 const auto &GetTitle() const { return mTitle; }
455 };
456
457 using Condition = std::function<bool()>;
458
459 // Collects other items that are conditionally shown or hidden, but are
460 // always available to macro programming
463 GroupItem<Traits>, Condition, const Identifier &
464 >
465 {
466 using Extension::Extension;
467 ~ConditionalGroupItem() override;
468 using Condition::operator();
469 };
470
471 // usage:
472 // auto scope = FinderScope( findCommandHandler );
473 // return Items( ... );
474 //
475 // or:
476 // return ( FinderScope( findCommandHandler ), Items( ... ) );
477 //
478 // where findCommandHandler names a function.
479 // This is used before a sequence of many calls to Command() and
480 // CommandGroup(), so that the finder argument need not be specified
481 // in each call.
482 class AUDACITY_DLL_API FinderScope : ValueRestorer< CommandHandlerFinder >
483 {
485
486 public:
488 static CommandHandlerFinder DefaultFinder() { return sFinder; }
489
491 explicit
493 : ValueRestorer( sFinder, finder )
494 { assert(finder); }
495 };
496
497 // Describes one command in a menu
498 struct AUDACITY_DLL_API CommandItem final : SingleItem {
499 CommandItem(const CommandID &name_,
500 const TranslatableString &label_in_,
501 CommandFunctorPointer callback_,
502 CommandFlag flags_,
503 const CommandManager::Options &options_,
504 CommandHandlerFinder finder_);
505
506 // Takes a pointer to member function directly, and delegates to the
507 // previous constructor; useful within the lifetime of a FinderScope
511 template< typename Handler >
513 const TranslatableString &label_in,
514 void (Handler::*pmf)(const CommandContext&),
515 CommandFlag flags,
516 const CommandManager::Options &options = {},
518 : CommandItem(name, label_in,
520 static_cast<CommandFunctorPointer::MemberFn>(pmf) },
521 flags, options, finder)
522 { assert(finder); }
523
524 // Takes a pointer to nonmember function and delegates to the first
525 // constructor
527 const TranslatableString &label_in,
529 CommandFlag flags,
530 const CommandManager::Options &options = {})
531 : CommandItem(name, label_in,
532 CommandFunctorPointer{ callback },
533 flags, options, nullptr)
534 {}
535
536 ~CommandItem() override;
537
543 };
544
545 // Describes several successive commands in a menu that are closely related
546 // and dispatch to one common callback, which will be passed a number
547 // in the CommandContext identifying the command
548 struct AUDACITY_DLL_API CommandGroupItem final : SingleItem {
549 CommandGroupItem(const Identifier &name_,
550 std::vector<ComponentInterfaceSymbol> items_,
551 CommandFunctorPointer callback_,
552 CommandFlag flags_,
553 bool isEffect_,
554 CommandHandlerFinder finder_);
555
556 // Takes a pointer to member function directly, and delegates to the
557 // previous constructor; useful within the lifetime of a FinderScope
561 template< typename Handler >
563 std::vector<ComponentInterfaceSymbol> items_,
564 void (Handler::*pmf)(const CommandContext&),
565 CommandFlag flags_,
566 bool isEffect_,
568 : CommandGroupItem(name_, move(items_),
570 static_cast<CommandFunctorPointer::MemberFn>(pmf) },
571 flags_, isEffect_, finder)
572 { assert(finder); }
573
574 // Takes a pointer to nonmember function and delegates to the first
575 // constructor
577 std::vector< ComponentInterfaceSymbol > items,
579 CommandFlag flags,
580 bool isEffect = false)
581 : CommandGroupItem(name, move(items),
583 flags, isEffect, nullptr)
584 {}
585
586 ~CommandGroupItem() override;
587
588 const std::vector<ComponentInterfaceSymbol> items;
593 };
594
595 // For manipulating the enclosing menu or sub-menu directly,
596 // adding any number of items, not using the CommandManager
597 struct SpecialItem final : SingleItem
598 {
599 using Appender = std::function< void( AudacityProject&, wxMenu& ) >;
600
601 explicit SpecialItem( const Identifier &internalName, const Appender &fn_ )
602 : SingleItem{ internalName }
603 , fn{ fn_ }
604 {}
605 ~SpecialItem() override;
606
608 };
609
615 GroupItem<Traits>, void, const Identifier &
616 >
617 {
618 using Extension::Extension;
619 ~MenuItems() override;
621 Ordering GetOrdering() const override;
622 };
623
624 struct MenuPart
626 GroupItem<Traits>, void, const Identifier &
627 >
629 {
630 using Extension::Extension;
631 ~MenuPart() override;
632 };
633
639
642
649 constexpr auto Items = Callable::UniqueMaker<MenuItems>();
650
654
658 constexpr auto Section = Callable::UniqueMaker<MenuPart>();
659
661
667 constexpr auto Menu = Callable::UniqueMaker<MenuItem>();
668
671
676 constexpr auto ConditionalItems = Callable::UniqueMaker<ConditionalGroupItem>();
677
678 constexpr auto Command = Callable::UniqueMaker<CommandItem>();
679
681 const Identifier &, std::vector<ComponentInterfaceSymbol>>();
682
683 constexpr auto Special = Callable::UniqueMaker<SpecialItem>();
684
686
688 static GroupItemBase &Registry();
689 };
690
691 // Typically you make a static object of this type in the .cpp file that
692 // also defines the added menu actions.
693 // pItem can be specified by an expression using the inline functions above.
694 struct AUDACITY_DLL_API AttachedItem final
695 : public RegisteredItem<BaseItem, ItemRegistry>
696 {
697 AttachedItem( const Placement &placement, BaseItemPtr pItem );
698
699 AttachedItem( const wxString &path, BaseItemPtr pItem )
700 // Delegating constructor
701 : AttachedItem( Placement{ path }, std::move( pItem ) )
702 {}
703 };
704}
705
706#endif
wxT("CloseDown"))
Functions and classes that generate callable objects.
Utility ClientData::Site to register hooks into a host class that attach client data.
std::bitset< NCommandFlags > CommandFlag
Definition: CommandFlag.h:30
std::function< CommandHandlerObject &(AudacityProject &) > CommandHandlerFinder
static const AudacityProject::AttachedObjects::RegisteredFactory key
std::unordered_map< CommandID, CommandListEntry * > CommandNameHash
std::unordered_map< int, CommandListEntry * > CommandNumericIDHash
std::unordered_map< NormalizedKeyString, CommandListEntry * > CommandKeyHash
const TranslatableString name
Definition: Distortion.cpp:76
std::vector< CommandID > CommandIDs
Definition: Identifier.h:233
TaggedIdentifier< CommandIdTag, false > CommandID
Identifies a menu command or macro. Case-insensitive comparison.
Definition: Identifier.h:232
static const auto title
static ProjectFileIORegistry::AttributeWriterEntry entry
TranslatableString label
Definition: TagsEditor.cpp:165
static TranslatableStrings names
Definition: TagsEditor.cpp:153
const auto project
std::vector< TranslatableString > TranslatableStrings
static const auto fn
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
This specialization of Setting for bool adds a Toggle method to negate the saved value.
Definition: Prefs.h:344
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
List of CommandListEntry.
CommandManager implements a system for organizing all user-callable commands.
CommandList mCommandList
CommandNameHash mCommandNameHash
std::unique_ptr< wxMenuBar > mTempMenuBar
TranslatableString mCurrentMenuName
MenuBarList mMenuBarList
SubMenuList mSubMenuList
std::vector< NormalizedKeyString > mMaxListOnly
std::unique_ptr< wxMenu > uCurrentMenu
bool bMakingOccultCommands
CommandKeyHash mCommandKeyHash
std::function< bool(AudacityProject &) > CheckFn
CommandManager(const CommandManager &)=delete
TranslatableString mNiceName
CommandNumericIDHash mCommandNumericIDHash
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Global function-valued variable, adding a convenient Call()
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
List of MenuBarListEntry.
static CommandHandlerFinder DefaultFinder()
FinderScope(CommandHandlerFinder finder)
static CommandHandlerFinder sFinder
Generates classes whose instances register items at construction.
Definition: Registry.h:287
std::vector< Identifier > Path
Definition: Registry.h:304
List of SubMenuListEntry.
Holds a msgid for the translation catalog; may also bind format arguments.
Set a variable temporarily in a scope.
Definition: MemoryX.h:212
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
virtual XMLTagHandler * HandleXMLChild(const std::string_view &tag)=0
virtual void HandleXMLEndTag(const std::string_view &WXUNUSED(tag))
Definition: XMLTagHandler.h:59
virtual bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs)=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:25
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196
constexpr auto UniqueMaker()
Generate variadic factory functions.
Definition: Callable.h:122
AUDACITY_DLL_API bool HandleTextualCommand(CommandManager &commandManager, const CommandID &Str, const CommandContext &context, CommandFlag flags, bool alwaysEnabled)
constexpr auto Special
constexpr auto Section
std::function< bool()> Condition
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
constexpr auto Items
constexpr auto CommandGroup
constexpr auto Command
constexpr auto ConditionalItems
Definition: Menus.h:35
std::unique_ptr< BaseItem > BaseItemPtr
Definition: Registry.h:77
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItemBase *pRegistry)
Definition: Registry.cpp:739
STL namespace.
A convenient default parameter for class template Site.
Definition: ClientData.h:28
CommandListEntry is a structure used by CommandManager.
Options && CheckTest(const BoolSetting &setting) &&
Options && CheckTest(const wxChar *key, bool defaultValue) &&
Options && UseStrictFlags() &&
Options && CheckTest(const CheckFn &fn) &&
Options(const wxChar *accel_)
Options && AllowDup() &&
Options(const wxChar *accel_, const TranslatableString &longName_)
Options && WantKeyUp() &&
Options && IsGlobal() &&
Options && Accel(const wxChar *value) &&
Options && IsEffect(bool value=true) &&
Options && SkipKeyDown() &&
Options && Parameter(const CommandParameter &value) &&
Options && LongName(const TranslatableString &value) &&
Options && AllowInMacros(int value=1) &&
Extend Base with extra fields, in a second, protected base class.
Definition: Composite.h:176
MenuBarListEntry is a structure used by CommandManager.
AttachedItem(const wxString &path, BaseItemPtr pItem)
const std::vector< ComponentInterfaceSymbol > items
CommandHandlerFinder finder
CommandFunctorPointer callback
CommandGroupItem(const CommandID &name, std::vector< ComponentInterfaceSymbol > items, CommandFunctorPointer::NonMemberFn fn, CommandFlag flags, bool isEffect=false)
CommandGroupItem(const Identifier &name_, std::vector< ComponentInterfaceSymbol > items_, void(Handler::*pmf)(const CommandContext &), CommandFlag flags_, bool isEffect_, CommandHandlerFinder finder=FinderScope::DefaultFinder())
const TranslatableString label_in
CommandHandlerFinder finder
CommandItem(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
CommandItem(const CommandID &name, const TranslatableString &label_in, CommandFunctorPointer::NonMemberFn callback, CommandFlag flags, const CommandManager::Options &options={})
CommandFunctorPointer callback
CommandManager::Options options
static GroupItemBase & Registry()
Definition: Menus.cpp:260
const TranslatableString mTitle
MenuItemData(TranslatableString title)
const auto & GetTitle() const
Ordering GetOrdering() const override
Anonymous if its name is empty, else weakly ordered.
Definition: Menus.cpp:230
~MenuItems() override
Definition: Menus.cpp:229
~MenuPart() override
Definition: Menus.cpp:227
~SpecialItem() override
Definition: Menus.cpp:226
SpecialItem(const Identifier &internalName, const Appender &fn_)
std::function< void(AudacityProject &, wxMenu &) > Appender
WholeMenu(bool extend=false)
std::vector< bool > firstItem
~MenuVisitor() override
std::vector< bool > needSeparator
~ProjectMenuVisitor() override
ProjectMenuVisitor(AudacityProject &p)
virtual void * GetComputedItemContext() override
Get context given to Computed items during visitation.
Definition: Menus.cpp:191
AudacityProject & mProject
Common abstract base class for items that group other items.
Definition: Registry.h:170
Common abstract base class for items that are not groups.
Definition: Registry.h:162
SubMenuListEntry is a structure used by CommandManager.
void(*)(const CommandContext &context) NonMemberFn
void(CommandHandlerObject::*)(const CommandContext &context) MemberFn