Audacity 3.2.0
Namespaces | Classes | Typedefs | Functions
MenuRegistry Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  CommandGroupItem
 
struct  CommandItem
 
struct  ConditionalGroupItem
 
class  FinderScope
 
struct  ItemProperties
 A mix-in discovered by dynamic_cast; independent of the Traits. More...
 
struct  ItemRegistry
 
struct  MenuItem
 
struct  MenuItemData
 
struct  MenuItems
 
struct  MenuPart
 
struct  Options
 
struct  SpecialItem
 
struct  Traits
 
struct  Visitor
 

Typedefs

using CheckFn = std::function< bool(AudacityProject &) >
 
using Condition = std::function< bool()>
 
using AttachedItem = RegisteredItem< ItemRegistry >
 

Functions

template<typename RegistryTraits >
static bool IsSection (const GroupItem< RegistryTraits > &item)
 
MENUS_API void Visit (Visitor< Traits > &visitor, AudacityProject &project)
 

Variables

Factories

The following, and Registry::Indirect(), are the functions to use directly to specify elements of menu groupings.

constexpr auto Items = Callable::UniqueMaker<MenuItems>()
 
constexpr auto Section = Callable::UniqueMaker<MenuPart>()
 
constexpr auto Menu = Callable::UniqueMaker<MenuItem>()
 Items will appear in a main toolbar menu or in a sub-menu. More...
 
constexpr auto ConditionalItems = Callable::UniqueMaker<ConditionalGroupItem>()
 
constexpr auto Command = Callable::UniqueMaker<CommandItem>()
 
constexpr auto CommandGroup
 

Typedef Documentation

◆ AttachedItem

Definition at line 470 of file MenuRegistry.h.

◆ CheckFn

using MenuRegistry::CheckFn = typedef std::function< bool(AudacityProject&) >

Definition at line 34 of file MenuRegistry.h.

◆ Condition

using MenuRegistry::Condition = typedef std::function<bool()>

Definition at line 230 of file MenuRegistry.h.

Function Documentation

◆ IsSection()

template<typename RegistryTraits >
static bool MenuRegistry::IsSection ( const GroupItem< RegistryTraits > &  item)
inlinestatic

Definition at line 197 of file MenuRegistry.h.

197 {
198 auto pProperties = dynamic_cast<const ItemProperties *>(&item);
199 return pProperties && pProperties->GetProperties() ==
201 }
constexpr auto Section
Definition: MenuRegistry.h:436
A mix-in discovered by dynamic_cast; independent of the Traits.
Definition: MenuRegistry.h:106
virtual Properties GetProperties() const =0

References MenuRegistry::ItemProperties::GetProperties(), and MenuRegistry::ItemProperties::Section.

Referenced by CommandManager::Populator::DoBeginGroup(), and CommandManager::Populator::DoEndGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Visit()

void MenuRegistry::Visit ( Visitor< Traits > &  visitor,
AudacityProject project 
)

Definition at line 195 of file MenuRegistry.cpp.

196{
197 // Once only, cause initial population of preferences for the ordering
198 // of some menu items that used to be given in tables but are now separately
199 // registered in several .cpp files; the sequence of registration depends
200 // on unspecified accidents of static initialization order across
201 // compilation units, so we need something specific here to preserve old
202 // default appearance of menus.
203 // But this needs only to mention some strings -- there is no compilation or
204 // link dependency of this source file on those other implementation files.
205
208 {
209 {wxT(""), wxT(
210"File,Edit,Select,View,Transport,Tracks,Generate,Effect,Analyze,Tools,Window,Optional,Help"
211 )},
212 {wxT("/Optional/Extra/Part1"), wxT(
213"Transport,Tools,Mixer,Edit,PlayAtSpeed,Seek,Device,Select"
214 )},
215 {wxT("/Optional/Extra/Part2"), wxT(
216"Navigation,Focus,Cursor,Track,Scriptables1,Scriptables2"
217 )},
218 {wxT("/View/Windows"), wxT("UndoHistory,MixerBoard")},
219 {wxT("/Analyze/Analyzers/Windows"), wxT("ContrastAnalyser,PlotSpectrum")},
220 {wxT("/Transport/Basic"), wxT("Play,Record,Scrubbing,Cursor")},
221 {wxT("/View/Other/Toolbars/Toolbars/Other"), wxT(
222"ShowTransportTB,ShowToolsTB,ShowRecordMeterTB,ShowPlayMeterTB,"
223//"ShowMeterTB,"
224"ShowMixerTB,"
225"ShowEditTB,ShowTranscriptionTB,ShowScrubbingTB,ShowDeviceTB,ShowSelectionTB,"
226"ShowSpectralSelectionTB") },
227 {wxT("/Tracks/Add/Add"), wxT(
228"NewMonoTrack,NewStereoTrack,NewLabelTrack,NewTimeTrack")},
229 {wxT("/Optional/Extra/Part2/Scriptables1"), wxT(
230"SelectTime,SelectFrequencies,SelectTracks,SetTrackStatus,SetTrackAudio,"
231"SetTrackVisuals,GetPreference,SetPreference,SetClip,SetEnvelope,SetLabel"
232"SetProject") },
233 {wxT("/Optional/Extra/Part2/Scriptables2"), wxT(
234"Select,SetTrack,GetInfo,Message,Help,Import2,Export2,OpenProject2,"
235"SaveProject2,Drag,CompareAudio") },
236 }
237 };
238
239 static const auto menuTree = MenuRegistry::Items( MenuPathStart );
240
241 wxLogNull nolog;
242 Registry::VisitWithFunctions(visitor, menuTree.get(),
244}
wxT("CloseDown"))
const auto project
static const auto MenuPathStart
constexpr auto Items
Definition: MenuRegistry.h:427
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
static GroupItem< Traits > & Registry()

References Items, MenuPathStart, project, MenuRegistry::ItemRegistry::Registry(), Registry::VisitWithFunctions(), and wxT().

Referenced by compileTest(), PluginManager::GetConfigValue(), ToolDock::LayoutToolBars(), anonymous_namespace{EditMenus.cpp}::OnCut(), anonymous_namespace{HelpMenus.cpp}::OnMenuTree(), ToolDock::PositionBar(), PluginManager::SetConfigValue(), and Tester< Const, ref >::testCase().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ Command

constexpr auto MenuRegistry::Command = Callable::UniqueMaker<CommandItem>()
constexpr

Definition at line 456 of file MenuRegistry.h.

Referenced by anonymous_namespace{MenuHelper.cpp}::AddEffectMenuItemGroup(), anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), anonymous_namespace{ClipMenus.cpp}::ClipCursorItems(), anonymous_namespace{ClipMenus.cpp}::ClipSelectMenu(), anonymous_namespace{SelectMenus.cpp}::CursorMenu(), BuiltinCommandsModule::DiscoverPluginsAtPath(), anonymous_namespace{EditMenus.cpp}::EditMenu(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), anonymous_namespace{SelectMenus.cpp}::ExtraCursorMenu(), anonymous_namespace{DeviceToolBar.cpp}::ExtraDeviceMenu(), anonymous_namespace{EditMenus.cpp}::ExtraEditMenu(), anonymous_namespace{FileMenus.cpp}::ExtraExportMenu(), anonymous_namespace{NavigationMenus.cpp}::ExtraFocusMenu(), anonymous_namespace{NavigationMenus.cpp}::ExtraGlobalCommands(), anonymous_namespace{ExtraMenus.cpp}::ExtraMiscItems(), anonymous_namespace{MeterToolBar.cpp}::ExtraMixerMenu(), anonymous_namespace{TranscriptionToolBar.cpp}::ExtraPlayAtSpeedItems(), anonymous_namespace{SelectMenus.cpp}::ExtraSeekMenu(), anonymous_namespace{TransportMenus.cpp}::ExtraSelectionItems(), anonymous_namespace{SelectMenus.cpp}::ExtraSelectionMenu(), anonymous_namespace{TimelineMenus.cpp}::ExtraSelectionMenu(), anonymous_namespace{ClipMenus.cpp}::ExtraTimeShiftItems(), anonymous_namespace{ToolsToolBar.cpp}::ExtraToolsMenu(), anonymous_namespace{TrackMenus.cpp}::ExtraTrackMenu(), anonymous_namespace{TransportMenus.cpp}::ExtraTransportMenu(), anonymous_namespace{FileMenus.cpp}::FileMenu(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), anonymous_namespace{HelpMenus.cpp}::HelpMenu(), anonymous_namespace{LabelMenus.cpp}::LabelEditMenus(), TrackMenuTable::OnSetName(), PluginMenuItems(), anonymous_namespace{BatchProcessDialog.cpp}::PopulateMacrosMenu(), DEFINE_VERSION_CHECK::RegisterMenuItems(), anonymous_namespace{NyqBench.cpp}::RegisterMenuItems(), anonymous_namespace{SelectMenus.cpp}::SelectMenu(), MacroCommandDialog::SetCommandAndParams(), WaveTrackAffordanceControls::StartEditClipName(), anonymous_namespace{ToolbarMenus.cpp}::ToolbarsMenu(), anonymous_namespace{PluginMenus.cpp}::ToolsMenu(), anonymous_namespace{TrackMenus.cpp}::TracksMenu(), anonymous_namespace{TransportMenus.cpp}::TransportMenu(), and anonymous_namespace{ViewMenus.cpp}::ViewMenu().

◆ CommandGroup

constexpr auto MenuRegistry::CommandGroup
constexpr
Initial value:
const Identifier &, std::vector<ComponentInterfaceSymbol>>()
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
constexpr auto UniqueMaker()
Generate variadic factory functions.
Definition: Callable.h:122

Definition at line 458 of file MenuRegistry.h.

Referenced by anonymous_namespace{TrackMenus.cpp}::TracksMenu().

◆ ConditionalItems

constexpr auto MenuRegistry::ConditionalItems = Callable::UniqueMaker<ConditionalGroupItem>()
constexpr

These items register in the CommandManager but are not shown in menus if the condition evaluates false.

The name is untranslated. Try to keep the name stable across Audacity versions. Name for conditional group must be non-empty.

Definition at line 454 of file MenuRegistry.h.

Referenced by anonymous_namespace{ExtraMenus.cpp}::ExtraMenu().

◆ Items

constexpr auto MenuRegistry::Items = Callable::UniqueMaker<MenuItems>()
constexpr

◆ Menu

constexpr auto MenuRegistry::Menu = Callable::UniqueMaker<MenuItem>()
constexpr

Items will appear in a main toolbar menu or in a sub-menu.

The name is untranslated. Try to keep the name stable across Audacity versions. If the name of a menu is empty, then subordinate items cannot be located by path.

Definition at line 445 of file MenuRegistry.h.

Referenced by anonymous_namespace{MenuHelper.cpp}::AddEffectMenuItemGroup(), anonymous_namespace{MenuHelper.cpp}::AddGroupedEffectMenuItems(), anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), anonymous_namespace{ClipMenus.cpp}::ClipSelectMenu(), anonymous_namespace{SelectMenus.cpp}::CursorMenu(), anonymous_namespace{EditMenus.cpp}::EditMenu(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), anonymous_namespace{SelectMenus.cpp}::ExtraCursorMenu(), anonymous_namespace{DeviceToolBar.cpp}::ExtraDeviceMenu(), anonymous_namespace{EditMenus.cpp}::ExtraEditMenu(), anonymous_namespace{FileMenus.cpp}::ExtraExportMenu(), anonymous_namespace{NavigationMenus.cpp}::ExtraFocusMenu(), anonymous_namespace{ExtraMenus.cpp}::ExtraMenu(), anonymous_namespace{MeterToolBar.cpp}::ExtraMixerMenu(), anonymous_namespace{TranscriptionToolBar.cpp}::ExtraPlayAtSpeedMenu(), ExtraScriptablesIIMenu(), ExtraScriptablesIMenu(), anonymous_namespace{SelectMenus.cpp}::ExtraSeekMenu(), anonymous_namespace{SelectMenus.cpp}::ExtraSelectionMenu(), anonymous_namespace{TimelineMenus.cpp}::ExtraSelectionMenu(), anonymous_namespace{ToolsToolBar.cpp}::ExtraToolsMenu(), anonymous_namespace{TrackMenus.cpp}::ExtraTrackMenu(), anonymous_namespace{TransportMenus.cpp}::ExtraTransportMenu(), anonymous_namespace{FileMenus.cpp}::FileMenu(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), anonymous_namespace{HelpMenus.cpp}::HelpMenu(), anonymous_namespace{LabelMenus.cpp}::LabelEditMenus(), anonymous_namespace{MenuHelper.cpp}::MakeAddGroupItems(), KeyConfigPrefs::OnDefaults(), PluginMenuItems(), anonymous_namespace{SelectMenus.cpp}::SelectMenu(), anonymous_namespace{ToolbarMenus.cpp}::ToolbarsMenu(), anonymous_namespace{PluginMenus.cpp}::ToolsMenu(), anonymous_namespace{TrackMenus.cpp}::TracksMenu(), anonymous_namespace{TransportMenus.cpp}::TransportMenu(), RealtimeEffectListWindow::UpdateEffectMenuItems(), and anonymous_namespace{ViewMenus.cpp}::ViewMenu().

◆ Section

constexpr auto MenuRegistry::Section = Callable::UniqueMaker<MenuPart>()
constexpr