From 872259981a299700a82ef7936082039f2d736247 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 30 Apr 2015 10:46:08 +0200 Subject: [PATCH] CONDITIONAL_MENU supports separators and ordering. --- pcbnew/tools/pcb_editor_control.cpp | 2 +- pcbnew/tools/placement_tool.cpp | 3 ++- pcbnew/tools/selection_tool.cpp | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index cdf4042f3f..84b0833b58 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -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 ) ); } diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 79a42d78ef..435e4d352e 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -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; } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 15ff1e7299..51c3c43df6 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -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() ), "Zoom" ); - m_menu.AddMenu( new GRID_MENU( getEditFrame() ), "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() ), "Zoom", + false, SELECTION_CONDITIONS::ShowAlways, 1000 ); + m_menu.AddMenu( new GRID_MENU( getEditFrame() ), "Grid", + false, SELECTION_CONDITIONS::ShowAlways, 1000 ); return true; }