From bddadd1f42db12c1c20dd7332a868bc83f7f8eca Mon Sep 17 00:00:00 2001 From: Jan Wichmann Date: Wed, 27 Dec 2023 18:31:40 +0100 Subject: [PATCH] eeschema: CHANGED: Simplifying the context menu and moving all removed items to main menu. --- eeschema/menubar.cpp | 46 ++++++++++++ eeschema/tools/ee_actions.cpp | 1 + eeschema/tools/sch_edit_tool.cpp | 119 ++++--------------------------- 3 files changed, 60 insertions(+), 106 deletions(-) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 49c198115e..95ac46b5ba 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -171,6 +171,52 @@ void SCH_EDIT_FRAME::doReCreateMenuBar() editMenu->Add( EE_ACTIONS::changeSymbols ); editMenu->Add( EE_ACTIONS::editPageNumber ); + ACTION_MENU* submenuAttributes = new ACTION_MENU( false, selTool ); + submenuAttributes->SetTitle( _( "Attributes..." ) ); + { + { + ACTION_MENU *attribSimMoveSubMenu = new ACTION_MENU( false, selTool ); + attribSimMoveSubMenu->SetTitle( _( "Simulation" ) ); + submenuAttributes->Add( attribSimMoveSubMenu ); + + attribSimMoveSubMenu->Add( EE_ACTIONS::setExcludeFromSimulation ); + attribSimMoveSubMenu->Add( EE_ACTIONS::unsetExcludeFromSimulation ); + attribSimMoveSubMenu->Add( EE_ACTIONS::toggleExcludeFromSimulation ); + } + + { + ACTION_MENU *attribBOMMoveSubMenu = new ACTION_MENU( false, selTool ); + attribBOMMoveSubMenu->SetTitle( _( "Bill of Materials" ) ); + submenuAttributes->Add( attribBOMMoveSubMenu ); + + attribBOMMoveSubMenu->Add( EE_ACTIONS::setExcludeFromBOM ); + attribBOMMoveSubMenu->Add( EE_ACTIONS::unsetExcludeFromBOM ); + attribBOMMoveSubMenu->Add( EE_ACTIONS::toggleExcludeFromBOM ); + } + + { + ACTION_MENU *attribBoardMoveSubMenu = new ACTION_MENU( false, selTool ); + attribBoardMoveSubMenu->SetTitle( _( "Exclude from board" ) ); + submenuAttributes->Add( attribBoardMoveSubMenu ); + + attribBoardMoveSubMenu->Add( EE_ACTIONS::setExcludeFromBoard ); + attribBoardMoveSubMenu->Add( EE_ACTIONS::unsetExcludeFromBoard ); + attribBoardMoveSubMenu->Add( EE_ACTIONS::toggleExcludeFromBoard ); + } + + { + ACTION_MENU *attribDNPMoveSubMenu = new ACTION_MENU( false, selTool ); + attribDNPMoveSubMenu->SetTitle( _( "Do not populate" ) ); + submenuAttributes->Add( attribDNPMoveSubMenu ); + + attribDNPMoveSubMenu->Add( EE_ACTIONS::setDNP ); + attribDNPMoveSubMenu->Add( EE_ACTIONS::unsetDNP ); + attribDNPMoveSubMenu->Add( EE_ACTIONS::toggleDNP ); + } + } + + editMenu->Add( submenuAttributes ); + //-- View menu ----------------------------------------------------------- // ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 5ef2848dc5..a7bd94c654 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -951,6 +951,7 @@ TOOL_ACTION EE_ACTIONS::unsetDNP( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::toggleDNP( TOOL_ACTION_ARGS() .Name( "eeschema.EditorControl.toggleDNP" ) .Scope( AS_GLOBAL ) + .DefaultHotkey( MD_CTRL + MD_ALT + 'X' ) .FriendlyName( _( "Toggle Do Not Populate" ) ) .Tooltip( _( "Toggle the do not populate attribute" ) ) ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index bfa11715a4..ad21096bcb 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -466,49 +466,16 @@ bool SCH_EDIT_TOOL::Init() { CONDITIONAL_MENU *attribMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribMoveSubMenu->SetTitle( _( "Attributes" ) ); + attribMoveSubMenu->SetTitle( _( "Attributes..." ) ); moveMenu.AddMenu( attribMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ), 200 ); { - CONDITIONAL_MENU *attribSimMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribSimMoveSubMenu->SetTitle( _( "Simulation" ) ); - attribMoveSubMenu->AddMenu( attribSimMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromSimulation, + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromSimulation, + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, - E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBOMMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBOMMoveSubMenu->SetTitle( _( "Bill of Materials" ) ); - attribMoveSubMenu->AddMenu( attribBOMMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBoardMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBoardMoveSubMenu->SetTitle( _( "Exclude from board" ) ); - attribMoveSubMenu->AddMenu( attribBoardMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBoard, - E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBoard, - E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, - E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribDNPMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribDNPMoveSubMenu->SetTitle( _( "Do not populate" ) ); - attribMoveSubMenu->AddMenu( attribDNPMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::setDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::unsetDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); } } moveMenu.AddItem( EE_ACTIONS::swap, SELECTION_CONDITIONS::MoreThan( 1 ) ); @@ -562,41 +529,11 @@ bool SCH_EDIT_TOOL::Init() drawMenu.AddMenu( attribMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ), 200 ); { - CONDITIONAL_MENU *attribSimMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribSimMoveSubMenu->SetTitle( _( "Simulation" ) ); - attribMoveSubMenu->AddMenu( attribSimMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromSimulation, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromSimulation, + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, - E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBOMMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBOMMoveSubMenu->SetTitle( _( "Bill of Materials" ) ); - attribMoveSubMenu->AddMenu( attribBOMMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBoardMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBoardMoveSubMenu->SetTitle( _( "Exclude from board" ) ); - attribMoveSubMenu->AddMenu( attribBoardMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBoard, E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBoard, E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribDNPMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribDNPMoveSubMenu->SetTitle( _( "Do not populate" ) ); - attribMoveSubMenu->AddMenu( attribDNPMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::setDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::unsetDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); } } @@ -647,41 +584,11 @@ bool SCH_EDIT_TOOL::Init() selToolMenu.AddMenu( attribMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ), 200 ); { - CONDITIONAL_MENU *attribSimMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribSimMoveSubMenu->SetTitle( _( "Simulation" ) ); - attribMoveSubMenu->AddMenu( attribSimMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromSimulation, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromSimulation, + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, E_C::ShowAlways ); - attribSimMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromSimulation, - E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBOMMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBOMMoveSubMenu->SetTitle( _( "Bill of Materials" ) ); - attribMoveSubMenu->AddMenu( attribBOMMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBOM, E_C::ShowAlways ); - attribBOMMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribBoardMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribBoardMoveSubMenu->SetTitle( _( "Exclude from board" ) ); - attribMoveSubMenu->AddMenu( attribBoardMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::setExcludeFromBoard, E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::unsetExcludeFromBoard, E_C::ShowAlways ); - attribBoardMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, E_C::ShowAlways ); - } - - { - CONDITIONAL_MENU *attribDNPMoveSubMenu = new CONDITIONAL_MENU( moveTool ); - attribDNPMoveSubMenu->SetTitle( _( "Do not populate" ) ); - attribMoveSubMenu->AddMenu( attribDNPMoveSubMenu, E_C::HasType( SCH_SYMBOL_T ) ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::setDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::unsetDNP, E_C::ShowAlways ); - attribDNPMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBOM, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleExcludeFromBoard, E_C::ShowAlways ); + attribMoveSubMenu->AddItem( EE_ACTIONS::toggleDNP, E_C::ShowAlways ); } }