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 193 of file MenuRegistry.cpp.

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

◆ Section

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