Remove selection condition from conditional menu separators.

We don't allow duplicate separators anyway so all they really do
is complicate the code.
This commit is contained in:
Jeff Young 2019-06-15 17:40:14 +01:00
parent 5610261dce
commit 19aba615c2
22 changed files with 50 additions and 52 deletions

View File

@ -338,12 +338,13 @@ void EDA_DRAW_FRAME::AddStandardSubMenus( TOOL_MENU& aToolMenu )
COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>(); COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu(); CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
aMenu.AddSeparator( 1000 );
aMenu.AddItem( ACTIONS::zoomCenter, SELECTION_CONDITIONS::ShowAlways, 1000 ); aMenu.AddItem( ACTIONS::zoomCenter, SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 ); aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 ); aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways, 1000 ); aMenu.AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddSeparator(SELECTION_CONDITIONS::ShowAlways, 1000 ); aMenu.AddSeparator( 1000 );
auto zoomMenu = std::make_shared<ZOOM_MENU>( this ); auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
zoomMenu->SetTool( commonTools ); zoomMenu->SetTool( commonTools );

View File

@ -92,9 +92,9 @@ void CONDITIONAL_MENU::AddMenu( ACTION_MENU* aMenu, const SELECTION_CONDITION& a
} }
void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int aOrder ) void CONDITIONAL_MENU::AddSeparator( int aOrder )
{ {
addEntry( ENTRY( aCondition, aOrder ) ); addEntry( ENTRY( SELECTION_CONDITIONS::ShowAlways, aOrder ) );
} }

View File

@ -213,17 +213,17 @@ bool EE_SELECTION_TOOL::Init()
menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 ); menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 );
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 ); menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
menu.AddSeparator( EE_CONDITIONS::Empty, 100 ); menu.AddSeparator( 100 );
menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 ); menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 ); menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 ); menu.AddSeparator( 100 );
menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 ); menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 ); menu.AddSeparator( 100 );
menu.AddItem( EE_ACTIONS::finishBus, SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 ); menu.AddItem( EE_ACTIONS::finishBus, SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
menu.AddSeparator( EE_CONDITIONS::NotEmpty, 200 ); menu.AddSeparator( 200 );
menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 250 ); menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 ); menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 ); menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
@ -234,11 +234,11 @@ bool EE_SELECTION_TOOL::Init()
menu.AddItem( EE_ACTIONS::placeSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 ); menu.AddItem( EE_ACTIONS::placeSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 ); menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
menu.AddSeparator( havePartCondition && EE_CONDITIONS::Empty, 400 ); menu.AddSeparator( 400 );
menu.AddItem( EE_ACTIONS::symbolProperties, havePartCondition && EE_CONDITIONS::Empty, 400 ); menu.AddItem( EE_ACTIONS::symbolProperties, havePartCondition && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::pinTable, havePartCondition && EE_CONDITIONS::Empty, 400 ); menu.AddItem( EE_ACTIONS::pinTable, havePartCondition && EE_CONDITIONS::Empty, 400 );
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 ); menu.AddSeparator( 1000 );
m_frame->AddStandardSubMenus( m_menu ); m_frame->AddStandardSubMenus( m_menu );
return true; return true;

View File

@ -77,7 +77,7 @@ public:
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddSeparator( 1 );
// Finally, add the standard zoom/grid items // Finally, add the standard zoom/grid items
m_frame->AddStandardSubMenus( m_menu ); m_frame->AddStandardSubMenus( m_menu );

View File

@ -114,23 +114,23 @@ bool LIB_CONTROL::Init()
ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition ); ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition ); ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::newSymbol, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EE_ACTIONS::newSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EE_ACTIONS::editSymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::editSymbol, symbolSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition ); ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition );
ctxMenu.AddItem( ACTIONS::saveCopyAs, symbolSelectedCondition ); ctxMenu.AddItem( ACTIONS::saveCopyAs, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition ); ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator( symbolSelectedCondition ); ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::importSymbol, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( EE_ACTIONS::importSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
} }

View File

@ -63,7 +63,7 @@ bool LIB_EDIT_TOOL::Init()
{ {
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu(); CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
moveMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty ); moveMenu.AddSeparator( 200 );
moveMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty, 200 ); moveMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty, 200 ); moveMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty, 200 ); moveMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty, 200 );
@ -72,7 +72,7 @@ bool LIB_EDIT_TOOL::Init()
moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 ); moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection, 300 ); moveMenu.AddSeparator( 300 );
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 ); moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 ); moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty, 300 ); moveMenu.AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty, 300 );
@ -82,7 +82,7 @@ bool LIB_EDIT_TOOL::Init()
// //
CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu(); CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
drawMenu.AddSeparator( EE_CONDITIONS::NotEmpty, 200 ); drawMenu.AddSeparator( 200 );
drawMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::IdleSelection, 200 ); drawMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::IdleSelection, 200 ); drawMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::IdleSelection, 200 ); drawMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::IdleSelection, 200 );
@ -102,7 +102,7 @@ bool LIB_EDIT_TOOL::Init()
selToolMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 ); selToolMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 300 ); selToolMenu.AddSeparator( 300 );
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 ); selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 ); selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 ); selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 );

View File

@ -103,7 +103,7 @@ bool LIB_PIN_TOOL::Init()
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu(); CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddSeparator( singlePinCondition, 400 ); selToolMenu.AddSeparator( 400 );
selToolMenu.AddItem( EE_ACTIONS::pushPinLength, singlePinCondition, 400 ); selToolMenu.AddItem( EE_ACTIONS::pushPinLength, singlePinCondition, 400 );
selToolMenu.AddItem( EE_ACTIONS::pushPinNameSize, singlePinCondition, 400 ); selToolMenu.AddItem( EE_ACTIONS::pushPinNameSize, singlePinCondition, 400 );
selToolMenu.AddItem( EE_ACTIONS::pushPinNumSize, singlePinCondition, 400 ); selToolMenu.AddItem( EE_ACTIONS::pushPinNumSize, singlePinCondition, 400 );

View File

@ -358,7 +358,7 @@ bool SCH_EDIT_TOOL::Init()
{ {
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu(); CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
moveMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty ); moveMenu.AddSeparator();
moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition ); moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition ); moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition ); moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition );
@ -376,7 +376,7 @@ bool SCH_EDIT_TOOL::Init()
m_menu.AddSubMenu( symUnitMenu ); m_menu.AddSubMenu( symUnitMenu );
moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 ); moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
moveMenu.AddSeparator( E_C::IdleSelection ); moveMenu.AddSeparator();
moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection ); moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection );
moveMenu.AddItem( ACTIONS::copy, E_C::IdleSelection ); moveMenu.AddItem( ACTIONS::copy, E_C::IdleSelection );
moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition ); moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
@ -447,7 +447,7 @@ bool SCH_EDIT_TOOL::Init()
selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 ); selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
selToolMenu.AddSeparator( E_C::Idle, 300 ); selToolMenu.AddSeparator( 300 );
selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 ); selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 ); selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 ); selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );

View File

@ -221,7 +221,7 @@ bool SCH_WIRE_BUS_TOOL::Init()
// //
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 ); ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
ctxMenu.AddSeparator( E_C::ShowAlways, 10 ); ctxMenu.AddSeparator( 10 );
ctxMenu.AddItem( EE_ACTIONS::drawWire, wireOrBusTool && E_C::Idle, 10 ); ctxMenu.AddItem( EE_ACTIONS::drawWire, wireOrBusTool && E_C::Idle, 10 );
ctxMenu.AddItem( EE_ACTIONS::drawBus, wireOrBusTool && E_C::Idle, 10 ); ctxMenu.AddItem( EE_ACTIONS::drawBus, wireOrBusTool && E_C::Idle, 10 );
ctxMenu.AddItem( EE_ACTIONS::drawLines, lineTool && E_C::Idle, 10 ); ctxMenu.AddItem( EE_ACTIONS::drawLines, lineTool && E_C::Idle, 10 );
@ -234,7 +234,7 @@ bool SCH_WIRE_BUS_TOOL::Init()
m_menu.AddSubMenu( busUnfoldMenu ); m_menu.AddSubMenu( busUnfoldMenu );
ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 ); ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 100 ); ctxMenu.AddSeparator( 100 );
ctxMenu.AddItem( EE_ACTIONS::placeJunction, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddItem( EE_ACTIONS::placeJunction, wireOrBusTool && E_C::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeLabel, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddItem( EE_ACTIONS::placeLabel, wireOrBusTool && E_C::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusTool && E_C::Idle, 100 );
@ -242,7 +242,7 @@ bool SCH_WIRE_BUS_TOOL::Init()
ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && E_C::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && E_C::Idle, 100 ); ctxMenu.AddItem( EE_ACTIONS::breakBus, wireOrBusTool && E_C::Idle, 100 );
ctxMenu.AddSeparator( wireOrBusTool && EE_CONDITIONS::Idle, 200 ); ctxMenu.AddSeparator( 200 );
ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && E_C::Idle, 200 ); ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && E_C::Idle, 200 );
ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && E_C::Idle, 200 ); ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && E_C::Idle, 200 );

View File

@ -164,7 +164,7 @@ bool GERBVIEW_SELECTION_TOOL::Init()
auto& menu = m_menu.GetMenu(); auto& menu = m_menu.GetMenu();
menu.AddMenu( selectMenu.get() ); menu.AddMenu( selectMenu.get() );
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 ); menu.AddSeparator( 1000 );
getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu ); getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu );

View File

@ -96,12 +96,9 @@ public:
* Function AddSeparator() * Function AddSeparator()
* *
* Adds a separator to the menu. * Adds a separator to the menu.
* @param aCondition is a condition that has to be fulfilled to enable the submenu entry. * @param aOrder determines location of the separator, higher numbers are put on the bottom.
* @param aOrder determines location of the added menu, higher numbers are put on the bottom.
* You may use ANY_ORDER here if you think it does not matter.
*/ */
void AddSeparator( const SELECTION_CONDITION& aCondition = SELECTION_CONDITIONS::ShowAlways, void AddSeparator( int aOrder = ANY_ORDER );
int aOrder = ANY_ORDER );
/** /**
* Function Evaluate() * Function Evaluate()

View File

@ -97,7 +97,7 @@ bool PL_DRAWING_TOOLS::Init()
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddSeparator( 1 );
// Finally, add the standard zoom/grid items // Finally, add the standard zoom/grid items
m_frame->AddStandardSubMenus( m_menu ); m_frame->AddStandardSubMenus( m_menu );

View File

@ -76,7 +76,7 @@ bool PL_EDIT_TOOL::Init()
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty ); ctxMenu.AddSeparator( 200 );
ctxMenu.AddItem( PL_ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 200 ); ctxMenu.AddItem( PL_ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 200 );
// Finally, add the standard zoom/grid items // Finally, add the standard zoom/grid items

View File

@ -50,7 +50,7 @@ bool PL_PICKER_TOOL::Init()
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddSeparator( 1 );
// Finally, add the standard zoom/grid items // Finally, add the standard zoom/grid items
m_frame->AddStandardSubMenus( m_menu ); m_frame->AddStandardSubMenus( m_menu );

View File

@ -94,14 +94,14 @@ bool PL_SELECTION_TOOL::Init()
auto& menu = m_menu.GetMenu(); auto& menu = m_menu.GetMenu();
menu.AddSeparator( PL_CONDITIONS::Idle, 200 ); menu.AddSeparator( 200 );
menu.AddItem( PL_ACTIONS::addLine, PL_CONDITIONS::Idle, 250 ); menu.AddItem( PL_ACTIONS::addLine, PL_CONDITIONS::Idle, 250 );
menu.AddItem( PL_ACTIONS::addRectangle, PL_CONDITIONS::Idle, 250 ); menu.AddItem( PL_ACTIONS::addRectangle, PL_CONDITIONS::Idle, 250 );
menu.AddItem( PL_ACTIONS::addText, PL_CONDITIONS::Idle, 250 ); menu.AddItem( PL_ACTIONS::addText, PL_CONDITIONS::Idle, 250 );
menu.AddItem( PL_ACTIONS::addImage, PL_CONDITIONS::Idle, 250 ); menu.AddItem( PL_ACTIONS::addImage, PL_CONDITIONS::Idle, 250 );
menu.AddItem( PL_ACTIONS::appendImportedWorksheet, PL_CONDITIONS::Idle, 250 ); menu.AddItem( PL_ACTIONS::appendImportedWorksheet, PL_CONDITIONS::Idle, 250 );
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 ); menu.AddSeparator( 1000 );
m_frame->AddStandardSubMenus( m_menu ); m_frame->AddStandardSubMenus( m_menu );
return true; return true;

View File

@ -212,13 +212,13 @@ bool DRAWING_TOOL::Init()
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolFunctor, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolFunctor, 1 );
ctxMenu.AddSeparator( activeToolFunctor, 1 ); ctxMenu.AddSeparator( 1 );
// tool-specific actions // tool-specific actions
ctxMenu.AddItem( closeZoneOutline, zoneActiveFunctor, 200 ); ctxMenu.AddItem( closeZoneOutline, zoneActiveFunctor, 200 );
ctxMenu.AddItem( deleteLastPoint, canUndoPoint, 200 ); ctxMenu.AddItem( deleteLastPoint, canUndoPoint, 200 );
ctxMenu.AddSeparator( canUndoPoint, 500 ); ctxMenu.AddSeparator( 500 );
// Type-specific sub-menus will be added for us by other tools // Type-specific sub-menus will be added for us by other tools
// For example, zone fill/unfill is provided by the PCB control tool // For example, zone fill/unfill is provided by the PCB control tool

View File

@ -250,7 +250,7 @@ bool EDIT_TOOL::Init()
menu.AddItem( PCB_ACTIONS::createArray, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::createArray, SELECTION_CONDITIONS::NotEmpty );
menu.AddSeparator( SELECTION_CONDITIONS::NotEmpty ); menu.AddSeparator();
menu.AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
// Selection tool handles the context menu for some other tools, such as the Picker. // Selection tool handles the context menu for some other tools, such as the Picker.
@ -258,13 +258,13 @@ bool EDIT_TOOL::Init()
menu.AddItem( ACTIONS::paste, noActiveToolCondition ); menu.AddItem( ACTIONS::paste, noActiveToolCondition );
// Mirror only available in modedit // Mirror only available in modedit
menu.AddSeparator( editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddSeparator();
menu.AddItem( PCB_ACTIONS::mirror, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::mirror, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::createPadFromShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::createPadFromShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::explodePadToShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::explodePadToShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
// Footprint actions // Footprint actions
menu.AddSeparator( singleModuleCondition ); menu.AddSeparator();
menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition ); menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::updateFootprint, singleModuleCondition ); menu.AddItem( PCB_ACTIONS::updateFootprint, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::changeFootprint, singleModuleCondition ); menu.AddItem( PCB_ACTIONS::changeFootprint, singleModuleCondition );
@ -279,7 +279,7 @@ bool EDIT_TOOL::Init()
// "Cancel" goes at the top of the context menu when a tool is active // "Cancel" goes at the top of the context menu when a tool is active
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
ctxMenu.AddSeparator( activeToolCondition, 1 ); ctxMenu.AddSeparator( 1 );
if( frame ) if( frame )
frame->AddStandardSubMenus( m_menu ); frame->AddStandardSubMenus( m_menu );

View File

@ -183,25 +183,25 @@ bool MODULE_EDITOR_TOOLS::Init()
ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition ); ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition ); ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( PCB_ACTIONS::newFootprint, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( PCB_ACTIONS::newFootprint, SELECTION_CONDITIONS::ShowAlways );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
ctxMenu.AddItem( PCB_ACTIONS::createFootprint, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( PCB_ACTIONS::createFootprint, SELECTION_CONDITIONS::ShowAlways );
#endif #endif
ctxMenu.AddItem( PCB_ACTIONS::editFootprint, fpSelectedCondition ); ctxMenu.AddItem( PCB_ACTIONS::editFootprint, fpSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( ACTIONS::save, fpSelectedCondition ); ctxMenu.AddItem( ACTIONS::save, fpSelectedCondition );
ctxMenu.AddItem( ACTIONS::saveCopyAs, fpSelectedCondition ); ctxMenu.AddItem( ACTIONS::saveCopyAs, fpSelectedCondition );
ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition ); ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, fpSelectedCondition ); ctxMenu.AddItem( ACTIONS::revert, fpSelectedCondition );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddSeparator();
ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition ); ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition ); ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator( fpSelectedCondition ); ctxMenu.AddSeparator();
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways ); ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition ); ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );

View File

@ -199,7 +199,7 @@ bool PAD_TOOL::Init()
// we need a separator only when the selection is empty // we need a separator only when the selection is empty
auto separatorCond = canShowMenuCond && SELECTION_CONDITIONS::Count( 0 ); auto separatorCond = canShowMenuCond && SELECTION_CONDITIONS::Count( 0 );
menu.AddSeparator( separatorCond, 1000 ); menu.AddSeparator( 1000 );
} }
return true; return true;

View File

@ -383,11 +383,11 @@ bool PCB_EDITOR_CONTROL::Init()
// "Cancel" goes at the top of the context menu when a tool is active // "Cancel" goes at the top of the context menu when a tool is active
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
ctxMenu.AddSeparator( activeToolCondition, 1 ); ctxMenu.AddSeparator( 1 );
// "Get and Place Footprint" should be available for Place Footprint tool // "Get and Place Footprint" should be available for Place Footprint tool
ctxMenu.AddItem( PCB_ACTIONS::findMove, placeModuleCondition, 1000 ); ctxMenu.AddItem( PCB_ACTIONS::findMove, placeModuleCondition, 1000 );
ctxMenu.AddSeparator( placeModuleCondition, 1000 ); ctxMenu.AddSeparator( 1000 );
// Finally, add the standard zoom & grid items // Finally, add the standard zoom & grid items
getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu ); getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
@ -409,7 +409,7 @@ bool PCB_EDITOR_CONTROL::Init()
// Add "Get and Place Footprint" when Selection tool is in an inactive state // Add "Get and Place Footprint" when Selection tool is in an inactive state
menu.AddItem( PCB_ACTIONS::findMove, inactiveStateCondition ); menu.AddItem( PCB_ACTIONS::findMove, inactiveStateCondition );
menu.AddSeparator( inactiveStateCondition ); menu.AddSeparator();
toolMenu.AddSubMenu( zoneMenu ); toolMenu.AddSubMenu( zoneMenu );
toolMenu.AddSubMenu( lockMenu ); toolMenu.AddSubMenu( lockMenu );

View File

@ -216,7 +216,7 @@ bool PCB_TOOL_BASE::Init()
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddSeparator( 1 );
// Finally, add the standard zoom/grid items // Finally, add the standard zoom/grid items
getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu ); getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );

View File

@ -223,7 +223,7 @@ bool SELECTION_TOOL::Init()
auto& menu = m_menu.GetMenu(); auto& menu = m_menu.GetMenu();
menu.AddMenu( selectMenu.get(), SELECTION_CONDITIONS::NotEmpty ); menu.AddMenu( selectMenu.get(), SELECTION_CONDITIONS::NotEmpty );
menu.AddSeparator( SELECTION_CONDITIONS::NotEmpty, 1000 ); menu.AddSeparator( 1000 );
if( frame ) if( frame )
frame->AddStandardSubMenus( m_menu ); frame->AddStandardSubMenus( m_menu );