mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-04 14:39:08 +02:00
Restore separators after "Move Track to Bottom" in TCP menus
This commit is contained in:
parent
3d5b0d4dd0
commit
540f2c5e67
@ -123,6 +123,7 @@ void Visitor::Visit(SingleItem &, const Path &) {}
|
||||
void MenuVisitor::BeginGroup( Registry::GroupItem &item, const Path &path )
|
||||
{
|
||||
bool isMenu = false;
|
||||
bool isExtension = false;
|
||||
auto pItem = &item;
|
||||
if ( pItem->Transparent() ) {
|
||||
}
|
||||
@ -130,8 +131,9 @@ void MenuVisitor::BeginGroup( Registry::GroupItem &item, const Path &path )
|
||||
if ( !needSeparator.empty() )
|
||||
needSeparator.back() = true;
|
||||
}
|
||||
else {
|
||||
else if ( auto pWhole = dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
|
||||
isMenu = true;
|
||||
isExtension = pWhole->extension;
|
||||
MaybeDoSeparator();
|
||||
}
|
||||
|
||||
@ -139,7 +141,7 @@ void MenuVisitor::BeginGroup( Registry::GroupItem &item, const Path &path )
|
||||
|
||||
if ( isMenu ) {
|
||||
needSeparator.push_back( false );
|
||||
firstItem.push_back( true );
|
||||
firstItem.push_back( !isExtension );
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +154,7 @@ void MenuVisitor::EndGroup( Registry::GroupItem &item, const Path &path )
|
||||
if ( !needSeparator.empty() )
|
||||
needSeparator.back() = true;
|
||||
}
|
||||
else {
|
||||
else if ( dynamic_cast<MenuTable::WholeMenu*>( pItem ) ) {
|
||||
firstItem.pop_back();
|
||||
needSeparator.pop_back();
|
||||
}
|
||||
@ -241,6 +243,7 @@ CommandGroupItem::~CommandGroupItem() {}
|
||||
SpecialItem::~SpecialItem() {}
|
||||
|
||||
MenuSection::~MenuSection() {}
|
||||
WholeMenu::~WholeMenu() {}
|
||||
|
||||
CommandHandlerFinder FinderScope::sFinder =
|
||||
[](AudacityProject &project) -> CommandHandlerObject & {
|
||||
|
@ -695,8 +695,19 @@ struct ToolbarMenuVisitor : MenuVisitor
|
||||
namespace MenuTable {
|
||||
using namespace Registry;
|
||||
|
||||
// These are found by dynamic_cast
|
||||
struct MenuSection {
|
||||
virtual ~MenuSection();
|
||||
};
|
||||
struct WholeMenu {
|
||||
WholeMenu( bool extend = false ) : extension{ extend } {}
|
||||
virtual ~WholeMenu();
|
||||
bool extension;
|
||||
};
|
||||
|
||||
// Describes a main menu in the toolbar, or a sub-menu
|
||||
struct MenuItem final : ConcreteGroupItem< false, ToolbarMenuVisitor > {
|
||||
struct MenuItem final : ConcreteGroupItem< false, ToolbarMenuVisitor >
|
||||
, WholeMenu {
|
||||
// Construction from an internal name and a previously built-up
|
||||
// vector of pointers
|
||||
MenuItem( const Identifier &internalName,
|
||||
@ -842,11 +853,6 @@ namespace MenuTable {
|
||||
Appender fn;
|
||||
};
|
||||
|
||||
// This exists only so that dynamic_cast can find it
|
||||
struct MenuSection {
|
||||
virtual ~MenuSection();
|
||||
};
|
||||
|
||||
struct MenuPart : ConcreteGroupItem< false, ToolbarMenuVisitor >, MenuSection
|
||||
{
|
||||
template< typename... Args >
|
||||
|
@ -20,6 +20,7 @@ PopupSubMenu::~PopupSubMenu()
|
||||
PopupSubMenu::PopupSubMenu( const Identifier &stringId,
|
||||
const TranslatableString &caption_, PopupMenuTable &table )
|
||||
: ConcreteGroupItem< false >{ stringId }
|
||||
, WholeMenu{ caption_.empty() }
|
||||
, caption{ caption_ }
|
||||
{
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ struct PopupMenuTableEntry : Registry::SingleItem
|
||||
};
|
||||
|
||||
struct PopupSubMenu : Registry::ConcreteGroupItem< false >
|
||||
, MenuTable::WholeMenu
|
||||
{
|
||||
TranslatableString caption;
|
||||
|
||||
@ -103,8 +104,7 @@ public:
|
||||
// More items get added to the end of it
|
||||
static void ExtendMenu( wxMenu &menu, PopupMenuTable &otherTable );
|
||||
|
||||
using Entries = std::vector<PopupMenuTableEntry>;
|
||||
const std::shared_ptr< PopupSubMenu > &Get()
|
||||
const std::shared_ptr< Registry::GroupItem > &Get()
|
||||
{
|
||||
if (!mTop)
|
||||
Populate();
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
virtual void Populate() = 0;
|
||||
void Clear() { mTop.reset(); }
|
||||
|
||||
std::shared_ptr< PopupSubMenu > mTop;
|
||||
std::shared_ptr< Registry::GroupItem > mTop;
|
||||
std::vector< Registry::GroupItem* > mStack;
|
||||
Identifier mId;
|
||||
TranslatableString mCaption;
|
||||
|
Loading…
x
Reference in New Issue
Block a user