mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-09 16:05:39 +01:00
Store a string identifier in each menu item...
... which is not yet used for anything. It could be used to describe textual paths for attaching plug-in menu items. Strings are only path local, not necessarily globally unique, and may be left empty for separators and for groups that should be transparent to path identification. It may also be empty for certain sub-menus, such as those that group effects according to the changeable criteria in Preferences.
This commit is contained in:
@@ -110,8 +110,8 @@ ComputedItem::~ComputedItem() {}
|
||||
|
||||
SingleItem::~SingleItem() {}
|
||||
|
||||
GroupItem::GroupItem( BaseItemPtrs &&items_ )
|
||||
: items{ std::move( items_ ) }
|
||||
GroupItem::GroupItem( const wxString &internalName, BaseItemPtrs &&items_ )
|
||||
: BaseItem{ internalName }, items{ std::move( items_ ) }
|
||||
{
|
||||
}
|
||||
void GroupItem::AppendOne( BaseItemPtr&& ptr )
|
||||
@@ -125,16 +125,17 @@ TransparentGroupItem::~TransparentGroupItem() {}
|
||||
|
||||
namespace MenuTable {
|
||||
|
||||
MenuItem::MenuItem( const TranslatableString &title_, BaseItemPtrs &&items_ )
|
||||
: GroupItem{ std::move( items_ ) }, title{ title_ }
|
||||
MenuItem::MenuItem( const wxString &internalName,
|
||||
const TranslatableString &title_, BaseItemPtrs &&items_ )
|
||||
: GroupItem{ internalName, std::move( items_ ) }, title{ title_ }
|
||||
{
|
||||
wxASSERT( !title.empty() );
|
||||
}
|
||||
MenuItem::~MenuItem() {}
|
||||
|
||||
ConditionalGroupItem::ConditionalGroupItem(
|
||||
Condition condition_, BaseItemPtrs &&items_ )
|
||||
: GroupItem{ std::move( items_ ) }, condition{ condition_ }
|
||||
const wxString &internalName, Condition condition_, BaseItemPtrs &&items_ )
|
||||
: GroupItem{ internalName, std::move( items_ ) }, condition{ condition_ }
|
||||
{
|
||||
}
|
||||
ConditionalGroupItem::~ConditionalGroupItem() {}
|
||||
@@ -147,7 +148,7 @@ CommandItem::CommandItem(const CommandID &name_,
|
||||
CommandFlag flags_,
|
||||
const CommandManager::Options &options_,
|
||||
CommandHandlerFinder finder_)
|
||||
: name{ name_ }, label_in{ label_in_ }
|
||||
: SingleItem{ name_ }, label_in{ label_in_ }
|
||||
, finder{ finder_ }, callback{ callback_ }
|
||||
, flags{ flags_ }, options{ options_ }
|
||||
{}
|
||||
@@ -159,7 +160,7 @@ CommandGroupItem::CommandGroupItem(const wxString &name_,
|
||||
CommandFlag flags_,
|
||||
bool isEffect_,
|
||||
CommandHandlerFinder finder_)
|
||||
: name{ name_ }, items{ items_ }
|
||||
: SingleItem{ name_ }, items{ items_ }
|
||||
, finder{ finder_ }, callback{ callback_ }
|
||||
, flags{ flags_ }, isEffect{ isEffect_ }
|
||||
{}
|
||||
@@ -180,6 +181,8 @@ CommandHandlerFinder FinderScope::sFinder =
|
||||
|
||||
namespace {
|
||||
|
||||
const auto MenuPathStart = wxT("MenuBar");
|
||||
|
||||
void VisitItem( AudacityProject &project, MenuTable::BaseItem *pItem );
|
||||
|
||||
void VisitItems(
|
||||
@@ -300,8 +303,8 @@ MenuTable::BaseItemSharedPtr HelpMenu();
|
||||
|
||||
// Table of menu factories.
|
||||
// TODO: devise a registration system instead.
|
||||
static const auto menuTree = MenuTable::Items(
|
||||
FileMenu()
|
||||
static const auto menuTree = MenuTable::Items( MenuPathStart
|
||||
, FileMenu()
|
||||
, EditMenu()
|
||||
, SelectMenu()
|
||||
, ViewMenu()
|
||||
|
||||
Reference in New Issue
Block a user