CONDITIONAL_MENU supports separators and ordering.

This commit is contained in:
Maciej Suminski 2015-04-30 10:46:08 +02:00
parent 958046ddb2
commit 872259981a
3 changed files with 13 additions and 10 deletions

View File

@ -74,7 +74,7 @@ bool PCB_EDITOR_CONTROL::Init()
if( selTool )
{
selTool->GetMenu().AddMenu( new ZONE_CONTEXT_MENU, _( "Zones" ),
selTool->GetMenu().AddMenu( new ZONE_CONTEXT_MENU, _( "Zones" ), false,
SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );
}

View File

@ -63,7 +63,8 @@ bool PLACEMENT_TOOL::Init()
menu->AppendSeparator();
menu->Add( COMMON_ACTIONS::distributeHorizontally );
menu->Add( COMMON_ACTIONS::distributeVertically );
m_selectionTool->GetMenu().AddMenu( menu, _( "Align/distribute" ), SELECTION_CONDITIONS::MoreThan( 1 ) );
m_selectionTool->GetMenu().AddMenu( menu, _( "Align/distribute" ), false,
SELECTION_CONDITIONS::MoreThan( 1 ) );
return true;
}

View File

@ -85,19 +85,21 @@ bool SELECTION_TOOL::Init()
{
m_selection.group = new KIGFX::VIEW_GROUP;
m_menu.AddMenu( new SELECT_MENU, _( "Select..." ),
m_menu.AddMenu( new SELECT_MENU, _( "Select..." ), false,
(SELECTION_CONDITION) SELECTION_CONDITIONS::OnlyConnectedItems &&
SELECTION_CONDITIONS::Count( 1 ) );
m_menu.AddItem( COMMON_ACTIONS::zoomCenter );
m_menu.AddItem( COMMON_ACTIONS::zoomIn );
m_menu.AddItem( COMMON_ACTIONS::zoomOut );
m_menu.AddItem( COMMON_ACTIONS::zoomFitScreen );
m_menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddMenu( new ZOOM_MENU( getEditFrame<PCB_BASE_FRAME>() ), "Zoom" );
m_menu.AddMenu( new GRID_MENU( getEditFrame<PCB_BASE_FRAME>() ), "Grid" );
m_menu.AddItem( COMMON_ACTIONS::zoomCenter, SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddItem( COMMON_ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddItem( COMMON_ACTIONS::zoomOut , SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddItem( COMMON_ACTIONS::zoomFitScreen , SELECTION_CONDITIONS::ShowAlways, 1000 );
//m_menu.AddSeparator();
m_menu.AddMenu( new ZOOM_MENU( getEditFrame<PCB_BASE_FRAME>() ), "Zoom",
false, SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddMenu( new GRID_MENU( getEditFrame<PCB_BASE_FRAME>() ), "Grid",
false, SELECTION_CONDITIONS::ShowAlways, 1000 );
return true;
}