Audacity 3.2.0
Menus.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Menus.cpp
6
7 Dominic Mazzoni
8 Brian Gunlogson
9 et al.
10
11*******************************************************************//****************************************************************//****************************************************************//*******************************************************************/
27
28
29#include "Menus.h"
30
31
32
33#include <wx/frame.h>
34
35#include "Project.h"
36#include "ProjectHistory.h"
37#include "ProjectWindows.h"
38#include "UndoManager.h"
40#include "AudacityMessageBox.h"
41#include "BasicUI.h"
42
43#include <unordered_set>
44
45#include <wx/menu.h>
46#include <wx/windowptr.h>
47#include <wx/log.h>
48
50{
53
58}
59
61{
62}
63
66 return std::make_shared< MenuManager >( project ); }
67};
68
70{
71 return project.AttachedObjects::Get< MenuManager >( key );
72}
73
75{
76 return Get( const_cast< AudacityProject & >( project ) );
77}
78
80 : mProject{ project }
81{
85}
86
88{
89}
90
92{
93 bool bSelectAllIfNone;
94 gPrefs->Read(wxT("/GUI/SelectAllOnNone"), &bSelectAllIfNone, false);
95 // 0 is grey out, 1 is Autoselect, 2 is Give warnings.
96#ifdef EXPERIMENTAL_DA
97 // DA warns or greys out.
98 mWhatIfNoSelection = bSelectAllIfNone ? 2 : 0;
99#else
100 // Audacity autoselects or warns.
101 mWhatIfNoSelection = bSelectAllIfNone ? 1 : 2;
102#endif
103 mStopIfWasPaused = true; // not configurable for now, but could be later.
104}
105
107 const MenuItemProperties *pProperties)
108{
109 const auto properties =
110 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
111
112 bool inlined = false;
113 bool shouldDoSeparator = false;
114
115 switch (properties) {
117 inlined = true;
118 break;
119 }
121 if (!needSeparator.empty())
122 needSeparator.back() = true;
123 break;
124 }
127 shouldDoSeparator = ShouldDoSeparator();
128 break;
129 }
130 default:
131 break;
132 }
133
134 return { !inlined, shouldDoSeparator };
135}
136
138 const MenuItemProperties *pProperties)
139{
140 const auto properties =
141 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
142
143 bool isMenu = false;
144 bool isExtension = false;
145
146 switch (properties) {
149 isMenu = true;
150 isExtension = (properties == MenuItemProperties::Extension);
151 break;
152 }
153 default:
154 break;
155 }
156
157 if (isMenu) {
158 needSeparator.push_back(false);
159 firstItem.push_back(!isExtension);
160 }
161}
162
164 const MenuItemProperties *pProperties)
165{
166 const auto properties =
167 pProperties ? pProperties->GetProperties() : MenuItemProperties::None;
168
169 bool inlined = false;
170
171 switch (properties) {
173 inlined = true;
174 break;
175 }
177 if ( !needSeparator.empty() )
178 needSeparator.back() = true;
179 break;
180 }
183 firstItem.pop_back();
184 needSeparator.pop_back();
185 break;
186 }
187 default:
188 break;
189 }
190
191 return !inlined;
192}
193
195{
196 bool separate = false;
197 if (!needSeparator.empty()) {
198 separate = needSeparator.back() && !firstItem.back();
199 needSeparator.back() = false;
200 firstItem.back() = false;
201 }
202 return separate;
203}
204
205namespace MenuTable {
206
208auto MenuItem::GetProperties() const -> Properties { return Whole; }
209
211
213 const TranslatableString &label_in_,
214 CommandFunctorPointer callback_,
215 CommandFlag flags_,
216 const CommandManager::Options &options_,
217 CommandHandlerFinder finder_)
218: SingleItem{ name_ }, label_in{ label_in_ }
219, finder{ finder_ }, callback{ callback_ }
220, flags{ flags_ }, options{ options_ }
221{}
223
225 std::vector< ComponentInterfaceSymbol > items_,
226 CommandFunctorPointer callback_,
227 CommandFlag flags_,
228 bool isEffect_,
229 CommandHandlerFinder finder_)
230: SingleItem{ name_ }, items{ std::move(items_) }
231, finder{ finder_ }, callback{ callback_ }
232, flags{ flags_ }, isEffect{ isEffect_ }
233{}
235
238auto MenuPart::GetProperties() const -> Properties { return Section; }
239
241auto MenuItems::GetOrdering() const -> Ordering {
242 return name.empty() ? Anonymous : Weak;
243}
244auto MenuItems::GetProperties() const -> Properties { return Inline; }
245
247
250 // If this default finder function is reached, then FinderScope should
251 // have been used somewhere but was not, or an explicit
252 // CommandHandlerFinder was not passed to menu item constructors
253 wxASSERT( false );
254 return project;
255 };
256
257}
258
262
263namespace {
264
265using namespace Registry;
266
267const auto MenuPathStart = wxT("MenuBar");
268
269}
270
272{
273 static GroupItem<Traits> registry{ MenuPathStart };
274 return registry;
275}
276
277namespace {
278
279using namespace MenuTable;
280
281struct MenuItemVisitor : Visitor<Traits> {
283 : Visitor<Traits> { std::tuple{
284 // pre-visit
285 std::tuple {
286 [this](const MenuItem &menu, auto&) {
287 manager.BeginMenu(menu.GetTitle());
288 },
289 [this](const ConditionalGroupItem &conditionalGroup, auto&) {
290 const auto flag = conditionalGroup();
291 if (!flag)
292 manager.BeginOccultCommands();
293 // to avoid repeated call of condition predicate in EndGroup():
294 flags.push_back(flag);
295 },
296 [this](auto &item, auto&) {
297 assert(IsSection(item));
298 }
299 },
300
301 // leaf visit
302 [this](const auto &item, const auto&) {
303 const auto pCurrentMenu = manager.CurrentMenu();
304 if (!pCurrentMenu) {
305 // There may have been a mistake in the placement hint that registered
306 // this single item. It's not within any menu.
307 assert(false);
308 }
309 else TypeSwitch::VDispatch<void, LeafTypes>(item,
310 [&](const CommandItem &command) {
311 manager.AddItem(mProject,
312 command.name, command.label_in,
313 command.finder, command.callback,
314 command.flags, command.options);
315 },
316 [&](const CommandGroupItem &commandList) {
317 manager.AddItemList(commandList.name,
318 commandList.items.data(), commandList.items.size(),
319 commandList.finder, commandList.callback,
320 commandList.flags, commandList.isEffect);
321 },
322 [&](const SpecialItem &special) {
323 special.fn(mProject, *pCurrentMenu);
324 }
325 );
326 },
327
328 // post-visit
329 std::tuple {
330 [this](const MenuItem &, const auto&) {
331 manager.EndMenu();
332 },
333 [this](const ConditionalGroupItem &, const auto&) {
334 const bool flag = flags.back();
335 if (!flag)
336 manager.EndOccultCommands();
337 flags.pop_back();
338 },
339 [this](auto &item, auto&) {
340 assert(IsSection(item));
341 }
342 }},
343
344 [this]() {
345 manager.AddSeparator();
346 }
347 }
348 , mProject{ proj }
349 , manager{ man }
350 {}
351
354 std::vector<bool> flags;
355};
356}
357
359{
360 // Once only, cause initial population of preferences for the ordering
361 // of some menu items that used to be given in tables but are now separately
362 // registered in several .cpp files; the sequence of registration depends
363 // on unspecified accidents of static initialization order across
364 // compilation units, so we need something specific here to preserve old
365 // default appearance of menus.
366 // But this needs only to mention some strings -- there is no compilation or
367 // link dependency of this source file on those other implementation files.
370 {
371 {wxT(""), wxT(
372"File,Edit,Select,View,Transport,Tracks,Generate,Effect,Analyze,Tools,Window,Optional,Help"
373 )},
374 {wxT("/Optional/Extra/Part1"), wxT(
375"Transport,Tools,Mixer,Edit,PlayAtSpeed,Seek,Device,Select"
376 )},
377 {wxT("/Optional/Extra/Part2"), wxT(
378"Navigation,Focus,Cursor,Track,Scriptables1,Scriptables2"
379 )},
380 {wxT("/View/Windows"), wxT("UndoHistory,Karaoke,MixerBoard")},
381 {wxT("/Analyze/Analyzers/Windows"), wxT("ContrastAnalyser,PlotSpectrum")},
382 {wxT("/Transport/Basic"), wxT("Play,Record,Scrubbing,Cursor")},
383 {wxT("/View/Other/Toolbars/Toolbars/Other"), wxT(
384"ShowTransportTB,ShowToolsTB,ShowRecordMeterTB,ShowPlayMeterTB,"
385//"ShowMeterTB,"
386"ShowMixerTB,"
387"ShowEditTB,ShowTranscriptionTB,ShowScrubbingTB,ShowDeviceTB,ShowSelectionTB,"
388"ShowSpectralSelectionTB") },
389 {wxT("/Tracks/Add/Add"), wxT(
390"NewMonoTrack,NewStereoTrack,NewLabelTrack,NewTimeTrack")},
391 {wxT("/Optional/Extra/Part2/Scriptables1"), wxT(
392"SelectTime,SelectFrequencies,SelectTracks,SetTrackStatus,SetTrackAudio,"
393"SetTrackVisuals,GetPreference,SetPreference,SetClip,SetEnvelope,SetLabel"
394"SetProject") },
395 {wxT("/Optional/Extra/Part2/Scriptables2"), wxT(
396"Select,SetTrack,GetInfo,Message,Help,Import2,Export2,OpenProject2,"
397"SaveProject2,Drag,CompareAudio,Screenshot") },
398 }
399 };
400
401 auto &commandManager = CommandManager::Get( project );
402
403 // The list of defaults to exclude depends on
404 // preference wxT("/GUI/Shortcuts/FullDefaults"), which may have changed.
405 commandManager.SetMaxList();
406
407 auto menubar = commandManager.AddMenuBar(wxT("appmenu"));
408 wxASSERT(menubar);
409
410 MenuItemVisitor visitor{ project, commandManager };
411 MenuManager::Visit(visitor, project);
412
413 GetProjectFrame( project ).SetMenuBar(menubar.release());
414
416
417#if defined(_DEBUG)
418// c->CheckDups();
419#endif
420}
421
424{
425 static const auto menuTree = MenuTable::Items( MenuPathStart );
426
427 wxLogNull nolog;
428 Registry::VisitWithFunctions(visitor, menuTree.get(),
430}
431
432// TODO: This surely belongs in CommandManager?
434{
436 auto &undoManager = UndoManager::Get( project );
437 auto &commandManager = CommandManager::Get( project );
438 int cur = undoManager.GetCurrentState();
439
440 if (undoManager.UndoAvailable()) {
441 undoManager.GetShortDescription(cur, &desc);
442 commandManager.Modify(wxT("Undo"),
443 XXO("&Undo %s")
444 .Format( desc ));
445 commandManager.Enable(wxT("Undo"),
446 ProjectHistory::Get( project ).UndoAvailable());
447 }
448 else {
449 commandManager.Modify(wxT("Undo"),
450 XXO("&Undo"));
451 }
452
453 if (undoManager.RedoAvailable()) {
454 undoManager.GetShortDescription(cur+1, &desc);
455 commandManager.Modify(wxT("Redo"),
456 XXO("&Redo %s")
457 .Format( desc ));
458 commandManager.Enable(wxT("Redo"),
459 ProjectHistory::Get( project ).RedoAvailable());
460 }
461 else {
462 commandManager.Modify(wxT("Redo"),
463 XXO("&Redo"));
464 commandManager.Enable(wxT("Redo"), false);
465 }
466}
467
468// Get hackcess to a protected method
469class wxFrameEx : public wxFrame
470{
471public:
472 using wxFrame::DetachMenuBar;
473};
474
476{
477 // On OSX, we can't rebuild the menus while a modal dialog is being shown
478 // since the enabled state for menus like Quit and Preference gets out of
479 // sync with wxWidgets idea of what it should be.
480#if defined(__WXMAC__) && defined(_DEBUG)
481 {
482 wxDialog *dlg =
483 wxDynamicCast(wxGetTopLevelParent(wxWindow::FindFocus()), wxDialog);
484 wxASSERT((!dlg || !dlg->IsModal()));
485 }
486#endif
487
488 // Delete the menus, since we will soon recreate them.
489 // Rather oddly, the menus don't vanish as a result of doing this.
490 {
491 auto &window = static_cast<wxFrameEx&>( GetProjectFrame( project ) );
492 wxWindowPtr<wxMenuBar> menuBar{ window.GetMenuBar() };
493 window.DetachMenuBar();
494 // menuBar gets deleted here
495 }
496
498
500}
501
503{
504 switch (message.type) {
509 break;
510 default:
511 return;
512 }
514 UpdateMenus();
515}
516
518{
519 // This method determines all of the flags that determine whether
520 // certain menu items and commands should be enabled or disabled,
521 // and returns them in a bitfield. Note that if none of the flags
522 // have changed, it's not necessary to even check for updates.
523
524 // static variable, used to remember flags for next time.
525 static CommandFlag lastFlags;
526
527 CommandFlag flags, quickFlags;
528
529 const auto &options = ReservedCommandFlag::Options();
530 size_t ii = 0;
531 for ( const auto &predicate : ReservedCommandFlag::RegisteredPredicates() ) {
532 if ( options[ii].quickTest ) {
533 quickFlags[ii] = true;
534 if( predicate( mProject ) )
535 flags[ii] = true;
536 }
537 ++ii;
538 }
539
540 if ( checkActive && !GetProjectFrame( mProject ).IsActive() )
541 // quick 'short-circuit' return.
542 flags = (lastFlags & ~quickFlags) | flags;
543 else {
544 ii = 0;
545 for ( const auto &predicate
547 if ( !options[ii].quickTest && predicate( mProject ) )
548 flags[ii] = true;
549 ++ii;
550 }
551 }
552
553 lastFlags = flags;
554 return flags;
555}
556
557// checkActive is a temporary hack that should be removed as soon as we
558// get multiple effect preview working
559void MenuManager::UpdateMenus( bool checkActive )
560{
561 auto &project = mProject;
562
563 auto flags = GetUpdateFlags(checkActive);
564 // Return from this function if nothing's changed since
565 // the last time we were here.
566 if (flags == mLastFlags)
567 return;
568 mLastFlags = flags;
569
570 auto flags2 = flags;
571
572 // We can enable some extra items if we have select-all-on-none.
573 //EXPLAIN-ME: Why is this here rather than in GetUpdateFlags()?
574 //ANSWER: Because flags2 is used in the menu enable/disable.
575 //The effect still needs flags to determine whether it will need
576 //to actually do the 'select all' to make the command valid.
577
578 for ( const auto &enabler : RegisteredMenuItemEnabler::Enablers() ) {
579 auto actual = enabler.actualFlags();
580 if (
581 enabler.applicable( project ) && (flags & actual) == actual
582 )
583 flags2 |= enabler.possibleFlags();
584 }
585
586 auto &commandManager = CommandManager::Get( project );
587
588 // With select-all-on-none, some items that we don't want enabled may have
589 // been enabled, since we changed the flags. Here we manually disable them.
590 // 0 is grey out, 1 is Autoselect, 2 is Give warnings.
591 commandManager.EnableUsingFlags(
592 flags2, // the "lax" flags
593 (mWhatIfNoSelection == 0 ? flags2 : flags) // the "strict" flags
594 );
595
596 Publish({});
597}
598
602
604{
605 for( auto p : AllProjects{} ) {
607#if defined(__WXGTK__)
608 // Workaround for:
609 //
610 // http://bugzilla.audacityteam.org/show_bug.cgi?id=458
611 //
612 // This workaround should be removed when Audacity updates to wxWidgets 3.x which has a fix.
613 auto &window = GetProjectFrame( *p );
614 wxRect r = window.GetRect();
615 window.SetSize(wxSize(1,1));
616 window.SetSize(r.GetSize());
617#endif
618 }
619}
620
622 const TranslatableString & Name, CommandFlag & flags, CommandFlag flagsRqd )
623{
624 auto &project = mProject;
625 bool bAllowed = TryToMakeActionAllowed( flags, flagsRqd );
626 if( bAllowed )
627 return true;
628 auto &cm = CommandManager::Get( project );
629 TellUserWhyDisallowed( Name, flags & flagsRqd, flagsRqd);
630 return false;
631}
632
637 CommandFlag & flags, CommandFlag flagsRqd )
638{
639 auto &project = mProject;
640
641 if( flags.none() )
642 flags = GetUpdateFlags();
643
644 // Visit the table of recovery actions
645 auto &enablers = RegisteredMenuItemEnabler::Enablers();
646 auto iter = enablers.begin(), end = enablers.end();
647 while ((flags & flagsRqd) != flagsRqd && iter != end) {
648 const auto &enabler = *iter;
649 auto actual = enabler.actualFlags();
650 auto MissingFlags = (~flags & flagsRqd);
651 if (
652 // Do we have the right precondition?
653 (flags & actual) == actual
654 &&
655 // Can we get the condition we need?
656 (MissingFlags & enabler.possibleFlags()).any()
657 ) {
658 // Then try the function
659 enabler.tryEnable( project, flagsRqd );
660 flags = GetUpdateFlags();
661 }
662 ++iter;
663 }
664 return (flags & flagsRqd) == flagsRqd;
665}
666
668 const TranslatableString & Name, CommandFlag flagsGot, CommandFlag flagsRequired )
669{
670 // The default string for 'reason' is a catch all. I hope it won't ever be seen
671 // and that we will get something more specific.
672 auto reason = XO("There was a problem with your last action. If you think\nthis is a bug, please tell us exactly where it occurred.");
673 // The default title string is 'Disallowed'.
674 auto untranslatedTitle = XO("Disallowed");
675 wxString helpPage;
676
677 bool enableDefaultMessage = true;
678 bool defaultMessage = true;
679
680 auto doOption = [&](const CommandFlagOptions &options) {
681 if ( options.message ) {
682 reason = options.message( Name );
683 defaultMessage = false;
684 if ( !options.title.empty() )
685 untranslatedTitle = options.title;
686 helpPage = options.helpPage;
687 return true;
688 }
689 else {
690 enableDefaultMessage =
691 enableDefaultMessage && options.enableDefaultMessage;
692 return false;
693 }
694 };
695
696 const auto &alloptions = ReservedCommandFlag::Options();
697 auto missingFlags = flagsRequired & ~flagsGot;
698
699 // Find greatest priority
700 unsigned priority = 0;
701 for ( const auto &options : alloptions )
702 priority = std::max( priority, options.priority );
703
704 // Visit all unsatisfied conditions' options, by descending priority,
705 // stopping when we find a message
706 ++priority;
707 while( priority-- ) {
708 size_t ii = 0;
709 for ( const auto &options : alloptions ) {
710 if (
711 priority == options.priority
712 &&
713 missingFlags[ii]
714 &&
715 doOption( options ) )
716 goto done;
717
718 ++ii;
719 }
720 }
721 done:
722
723 if (
724 // didn't find a message
725 defaultMessage
726 &&
727 // did find a condition that suppresses the default message
728 !enableDefaultMessage
729 )
730 return;
731
732 // Does not have the warning icon...
734 untranslatedTitle,
735 reason,
736 helpPage);
737}
wxT("CloseDown"))
Toolkit-neutral facade for basic user interface services.
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
std::bitset< NCommandFlags > CommandFlag
Definition: CommandFlag.h:30
std::function< CommandHandlerObject &(AudacityProject &) > CommandHandlerFinder
wxEvtHandler CommandHandlerObject
const TranslatableString name
Definition: Distortion.cpp:76
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: Menus.cpp:64
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
accessors for certain important windows associated with each project
static const AttachedProjectObjects::RegisteredFactory manager
const auto project
static const auto MenuPathStart
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Definition: ClientData.h:266
CommandManager implements a system for organizing all user-callable commands.
static CommandManager & Get(AudacityProject &project)
Abstract base class used in importing a file.
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
CommandFlag mLastFlags
Definition: Menus.h:51
static void RebuildAllMenuBars()
Definition: Menus.cpp:603
unsigned mRepeatAnalyzerFlags
Definition: Menus.h:70
unsigned mRepeatEffectFlags
Definition: Menus.h:69
unsigned mRepeatGeneratorFlags
Definition: Menus.h:68
int mLastToolRegistration
Definition: Menus.h:60
unsigned mRepeatToolFlags
Definition: Menus.h:71
int mLastAnalyzerRegistration
Definition: Menus.h:57
@ repeattypenone
Definition: Menus.h:63
void RebuildMenuBar(AudacityProject &project)
Definition: Menus.cpp:475
~MenuCreator()
Definition: Menus.cpp:60
void CreateMenusAndCommands(AudacityProject &project)
Definition: Menus.cpp:358
MenuCreator()
Definition: Menus.cpp:49
MenuManager handles updates to menu state.
Definition: Menus.h:82
int mWhatIfNoSelection
Definition: Menus.h:126
void OnUndoRedo(struct UndoRedoMessage)
Definition: Menus.cpp:502
bool TryToMakeActionAllowed(CommandFlag &flags, CommandFlag flagsRqd)
Definition: Menus.cpp:636
static void Visit(MenuTable::Visitor< MenuTable::Traits > &visitor, AudacityProject &project)
Definition: Menus.cpp:422
void UpdatePrefs() override
Definition: Menus.cpp:91
static MenuManager & Get(AudacityProject &project)
Definition: Menus.cpp:69
~MenuManager()
Definition: Menus.cpp:87
MenuManager(AudacityProject &project)
Definition: Menus.cpp:79
bool ReportIfActionNotAllowed(const TranslatableString &Name, CommandFlag &flags, CommandFlag flagsRqd)
Definition: Menus.cpp:621
static void ModifyUndoMenuItems(AudacityProject &project)
Definition: Menus.cpp:433
bool mStopIfWasPaused
Definition: Menus.h:127
void UpdateMenus(bool checkActive=true)
Definition: Menus.cpp:559
CommandFlag GetUpdateFlags(bool checkActive=false) const
Definition: Menus.cpp:517
Observer::Subscription mUndoSubscription
Definition: Menus.h:121
AudacityProject & mProject
Definition: Menus.h:122
void TellUserWhyDisallowed(const TranslatableString &Name, CommandFlag flagsGot, CommandFlag flagsRequired)
Definition: Menus.cpp:667
static CommandHandlerFinder sFinder
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
CallbackReturn Publish(const MenuUpdateMessage &message)
Send a message to connected callbacks.
Definition: Observer.h:207
static ProjectHistory & Get(AudacityProject &project)
static const Predicates & RegisteredPredicates()
Definition: CommandFlag.cpp:27
static const std::vector< CommandFlagOptions > & Options()
Definition: CommandFlag.cpp:32
Holds a msgid for the translation catalog; may also bind format arguments.
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71
virtual bool Read(const wxString &key, bool *value) const =0
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
Definition: BasicUI.h:260
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
Definition: BasicUI.h:371
static bool IsSection(const GroupItem< RegistryTraits > &item)
constexpr auto Items
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
void VisitWithFunctions(const VisitorFunctions< RegistryTraits > &visitors, const GroupItem< RegistryTraits > *pTopItem, const GroupItem< RegistryTraits > *pRegistry={}, typename RegistryTraits::ComputedItemContextType &computedItemContext=RegistryTraits::ComputedItemContextType::Instance)
Definition: Registry.h:623
const TranslatableString desc
Definition: ExportPCM.cpp:51
STL namespace.
~CommandGroupItem() override
Definition: Menus.cpp:234
CommandGroupItem(const Identifier &name_, std::vector< ComponentInterfaceSymbol > items_, CommandFunctorPointer callback_, CommandFlag flags_, bool isEffect_, CommandHandlerFinder finder_)
Definition: Menus.cpp:224
const TranslatableString label_in
CommandHandlerFinder finder
~CommandItem() override
Definition: Menus.cpp:222
CommandFunctorPointer callback
CommandManager::Options options
CommandItem(const CommandID &name_, const TranslatableString &label_in_, CommandFunctorPointer callback_, CommandFlag flags_, const CommandManager::Options &options_, CommandHandlerFinder finder_)
Definition: Menus.cpp:212
static GroupItem< Traits > & Registry()
Definition: Menus.cpp:271
Properties GetProperties() const override
Definition: Menus.cpp:208
~MenuItem() override
Definition: Menus.cpp:207
const auto & GetTitle() const
A mix-in discovered by dynamic_cast; independent of the Traits.
virtual Properties GetProperties() const =0
Ordering GetOrdering() const override
Anonymous if its name is empty, else weakly ordered.
Definition: Menus.cpp:241
Properties GetProperties() const override
Definition: Menus.cpp:244
~MenuItems() override
Definition: Menus.cpp:240
Properties GetProperties() const override
Definition: Menus.cpp:238
~MenuPart() override
Definition: Menus.cpp:237
~SpecialItem() override
Definition: Menus.cpp:236
void AfterBeginGroup(const MenuItemProperties *pProperties)
Definition: Menus.cpp:137
bool ShouldEndGroup(const MenuItemProperties *pProperties)
Definition: Menus.cpp:163
std::vector< bool > needSeparator
std::pair< bool, bool > ShouldBeginGroup(const MenuItemProperties *pProperties)
Definition: Menus.cpp:106
static const MenuItemEnablers & Enablers()
Definition: CommandFlag.cpp:56
Common abstract base class for items that are not groups.
Definition: Registry.h:224
const Identifier name
Definition: Registry.h:86
Type of message published by UndoManager.
Definition: UndoManager.h:55
enum UndoRedoMessage::Type type
MenuItemVisitor(AudacityProject &proj, CommandManager &man)
Definition: Menus.cpp:282