diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 3e6374031a..c7188030d7 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -151,6 +151,51 @@ TOOL_ACTION ACTIONS::quit( TOOL_ACTION_ARGS() .Tooltip( _( "Close the current editor" ) ) .Icon( BITMAPS::exit ) ); +// Group actions +TOOL_ACTION ACTIONS::group( TOOL_ACTION_ARGS() + .Name( "common.Interactive.group" ) + .Scope( AS_GLOBAL ) + .FriendlyName( _( "Group Items" ) ) + .Tooltip( _( "Group the selected items so that they are treated as a single item" ) ) + .Icon( BITMAPS::group ) ); + +TOOL_ACTION ACTIONS::ungroup( TOOL_ACTION_ARGS() + .Name( "common.Interactive.ungroup" ) + .Scope( AS_GLOBAL ) + .FriendlyName( _( "Ungroup Items" ) ) + .Tooltip( _( "Ungroup any selected groups" ) ) + .Icon( BITMAPS::group_ungroup ) ); + +TOOL_ACTION ACTIONS::removeFromGroup( TOOL_ACTION_ARGS() + .Name( "common.Interactive.removeFromGroup" ) + .Scope( AS_GLOBAL ) + .FriendlyName( _( "Remove Items" ) ) + .Tooltip( _( "Remove items from group" ) ) + .Icon( BITMAPS::group_remove ) ); + +TOOL_ACTION ACTIONS::groupEnter( TOOL_ACTION_ARGS() + .Name( "common.Interactive.groupEnter" ) + .Scope( AS_GLOBAL ) + .FriendlyName( _( "Enter Group" ) ) + .Tooltip( _( "Enter the group to edit items" ) ) + .Icon( BITMAPS::group_enter ) ); + +TOOL_ACTION ACTIONS::groupLeave( TOOL_ACTION_ARGS() + .Name( "common.Interactive.groupLeave" ) + .Scope( AS_GLOBAL ) + .FriendlyName( _( "Leave Group" ) ) + .Tooltip( _( "Leave the current group" ) ) + .Icon( BITMAPS::group_leave ) ); + +// GROUP_TOOL +TOOL_ACTION ACTIONS::groupProperties( TOOL_ACTION_ARGS() + .Name( "common.Groups.groupProperties" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::pickNewGroupMember( TOOL_ACTION_ARGS() + .Name( "common.Groups.selectNewGroupMember" ) + .Scope( AS_GLOBAL ) ); + // Generic Edit Actions TOOL_ACTION ACTIONS::cancelInteractive( TOOL_ACTION_ARGS() .Name( "common.Interactive.cancel" ) diff --git a/include/tool/actions.h b/include/tool/actions.h index 6501717466..302da4c92a 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -202,6 +202,17 @@ public: static TOOL_ACTION togglePolarCoords; static TOOL_ACTION resetLocalCoords; + // Grouping + static TOOL_ACTION group; + static TOOL_ACTION ungroup; + static TOOL_ACTION removeFromGroup; + static TOOL_ACTION groupEnter; + static TOOL_ACTION groupLeave; + + // Group Tool + static TOOL_ACTION groupProperties; + static TOOL_ACTION pickNewGroupMember; + // Common Tools static TOOL_ACTION selectionTool; static TOOL_ACTION measureTool; diff --git a/pcbnew/dialogs/dialog_group_properties.cpp b/pcbnew/dialogs/dialog_group_properties.cpp index b8063bbb1b..43ebf4458e 100644 --- a/pcbnew/dialogs/dialog_group_properties.cpp +++ b/pcbnew/dialogs/dialog_group_properties.cpp @@ -135,7 +135,7 @@ void DIALOG_GROUP_PROPERTIES::OnMemberSelected( wxCommandEvent& aEvent ) void DIALOG_GROUP_PROPERTIES::OnAddMember( wxCommandEvent& event ) { - m_toolMgr->RunAction( PCB_ACTIONS::pickNewGroupMember ); + m_toolMgr->RunAction( ACTIONS::pickNewGroupMember ); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 6423e85a4d..16c5a596ec 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -155,7 +155,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) break; case PCB_GROUP_T: - m_toolManager->RunAction( PCB_ACTIONS::groupProperties, static_cast( aItem ) ); + m_toolManager->RunAction( ACTIONS::groupProperties, static_cast( aItem ) ); break; case PCB_GENERATOR_T: diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index bc043e2cdf..b8bcf3969b 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -1325,8 +1325,8 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions() mgr->SetConditions( PCB_ACTIONS::rotateCcw, ENABLE( cond.HasItems() ) ); mgr->SetConditions( PCB_ACTIONS::mirrorH, ENABLE( cond.HasItems() ) ); mgr->SetConditions( PCB_ACTIONS::mirrorV, ENABLE( cond.HasItems() ) ); - mgr->SetConditions( PCB_ACTIONS::group, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); - mgr->SetConditions( PCB_ACTIONS::ungroup, ENABLE( SELECTION_CONDITIONS::HasType( PCB_GROUP_T ) ) ); + mgr->SetConditions( ACTIONS::group, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); + mgr->SetConditions( ACTIONS::ungroup, ENABLE( SELECTION_CONDITIONS::HasType( PCB_GROUP_T ) ) ); mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) ); mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) ); diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index aa025bf016..e45657ac90 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -244,7 +244,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) } case PCB_GROUP_T: - m_toolManager->RunAction( PCB_ACTIONS::groupProperties, static_cast( aItem ) ); + m_toolManager->RunAction( ACTIONS::groupProperties, static_cast( aItem ) ); break; case PCB_MARKER_T: diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 7b1e7a857e..c189b52c58 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -847,8 +847,8 @@ void PCB_EDIT_FRAME::setupUIConditions() static const std::vector groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T }; - mgr->SetConditions( PCB_ACTIONS::group, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); - mgr->SetConditions( PCB_ACTIONS::ungroup, ENABLE( SELECTION_CONDITIONS::HasTypes( groupTypes ) ) ); + mgr->SetConditions( ACTIONS::group, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); + mgr->SetConditions( ACTIONS::ungroup, ENABLE( SELECTION_CONDITIONS::HasTypes( groupTypes ) ) ); mgr->SetConditions( PCB_ACTIONS::lock, ENABLE( PCB_SELECTION_CONDITIONS::HasUnlockedItems ) ); mgr->SetConditions( PCB_ACTIONS::unlock, ENABLE( PCB_SELECTION_CONDITIONS::HasLockedItems ) ); diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index 86207b2d12..d618386581 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -154,8 +154,8 @@ std::optional FOOTPRINT_EDIT_TOOLBAR_SETTINGS::DefaultToo .AppendAction( PCB_ACTIONS::rotateCw ) .AppendAction( PCB_ACTIONS::mirrorH ) .AppendAction( PCB_ACTIONS::mirrorV ) - .AppendAction( PCB_ACTIONS::group ) - .AppendAction( PCB_ACTIONS::ungroup ); + .AppendAction( ACTIONS::group ) + .AppendAction( ACTIONS::ungroup ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::footprintProperties ) diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 65e79ef0bd..2f7a83a96c 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -307,8 +307,8 @@ std::optional PCB_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo .AppendAction( PCB_ACTIONS::rotateCw ) .AppendAction( PCB_ACTIONS::mirrorV ) .AppendAction( PCB_ACTIONS::mirrorH ) - .AppendAction( PCB_ACTIONS::group ) - .AppendAction( PCB_ACTIONS::ungroup ) + .AppendAction( ACTIONS::group ) + .AppendAction( ACTIONS::ungroup ) .AppendAction( PCB_ACTIONS::lock ) .AppendAction( PCB_ACTIONS::unlock ); diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index 09dd7873e8..4014365377 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -43,9 +43,9 @@ public: SetIcon( BITMAPS::group ); // fixme SetTitle( _( "Grouping" ) ); - Add( PCB_ACTIONS::group ); - Add( PCB_ACTIONS::ungroup ); - Add( PCB_ACTIONS::removeFromGroup ); + Add( ACTIONS::group ); + Add( ACTIONS::ungroup ); + Add( ACTIONS::removeFromGroup ); } ACTION_MENU* create() const override @@ -66,9 +66,9 @@ private: BOARD::GroupLegalOpsField legalOps = board->GroupLegalOps( selection ); - Enable( PCB_ACTIONS::group.GetUIId(), legalOps.create ); - Enable( PCB_ACTIONS::ungroup.GetUIId(), legalOps.ungroup ); - Enable( PCB_ACTIONS::removeFromGroup.GetUIId(), legalOps.removeItems ); + Enable( ACTIONS::group.GetUIId(), legalOps.create ); + Enable( ACTIONS::ungroup.GetUIId(), legalOps.ungroup ); + Enable( ACTIONS::removeFromGroup.GetUIId(), legalOps.removeItems ); } }; @@ -375,12 +375,12 @@ int GROUP_TOOL::LeaveGroup( const TOOL_EVENT& aEvent ) void GROUP_TOOL::setTransitions() { - Go( &GROUP_TOOL::GroupProperties, PCB_ACTIONS::groupProperties.MakeEvent() ); - Go( &GROUP_TOOL::PickNewMember, PCB_ACTIONS::pickNewGroupMember.MakeEvent() ); - - Go( &GROUP_TOOL::Group, PCB_ACTIONS::group.MakeEvent() ); - Go( &GROUP_TOOL::Ungroup, PCB_ACTIONS::ungroup.MakeEvent() ); - Go( &GROUP_TOOL::RemoveFromGroup, PCB_ACTIONS::removeFromGroup.MakeEvent() ); - Go( &GROUP_TOOL::EnterGroup, PCB_ACTIONS::groupEnter.MakeEvent() ); - Go( &GROUP_TOOL::LeaveGroup, PCB_ACTIONS::groupLeave.MakeEvent() ); + Go( &GROUP_TOOL::GroupProperties, ACTIONS::groupProperties.MakeEvent() ); + Go( &GROUP_TOOL::PickNewMember, ACTIONS::pickNewGroupMember.MakeEvent() ); + + Go( &GROUP_TOOL::Group, ACTIONS::group.MakeEvent() ); + Go( &GROUP_TOOL::Ungroup, ACTIONS::ungroup.MakeEvent() ); + Go( &GROUP_TOOL::RemoveFromGroup, ACTIONS::removeFromGroup.MakeEvent() ); + Go( &GROUP_TOOL::EnterGroup, ACTIONS::groupEnter.MakeEvent() ); + Go( &GROUP_TOOL::LeaveGroup, ACTIONS::groupLeave.MakeEvent() ); } diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index ff02f62c76..2f7211db68 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -1311,41 +1311,6 @@ TOOL_ACTION PCB_ACTIONS::unlock( TOOL_ACTION_ARGS() .Tooltip( _( "Allow items to be moved and/or resized on the canvas" ) ) .Icon( BITMAPS::unlocked ) ); -TOOL_ACTION PCB_ACTIONS::group( TOOL_ACTION_ARGS() - .Name( "pcbnew.EditorControl.group" ) - .Scope( AS_GLOBAL ) - .FriendlyName( _( "Group Items" ) ) - .Tooltip( _( "Group the selected items so that they are treated as a single item" ) ) - .Icon( BITMAPS::group ) ); - -TOOL_ACTION PCB_ACTIONS::ungroup( TOOL_ACTION_ARGS() - .Name( "pcbnew.EditorControl.ungroup" ) - .Scope( AS_GLOBAL ) - .FriendlyName( _( "Ungroup Items" ) ) - .Tooltip( _( "Ungroup any selected groups" ) ) - .Icon( BITMAPS::group_ungroup ) ); - -TOOL_ACTION PCB_ACTIONS::removeFromGroup( TOOL_ACTION_ARGS() - .Name( "pcbnew.EditorControl.removeFromGroup" ) - .Scope( AS_GLOBAL ) - .FriendlyName( _( "Remove Items" ) ) - .Tooltip( _( "Remove items from group" ) ) - .Icon( BITMAPS::group_remove ) ); - -TOOL_ACTION PCB_ACTIONS::groupEnter( TOOL_ACTION_ARGS() - .Name( "pcbnew.EditorControl.groupEnter" ) - .Scope( AS_GLOBAL ) - .FriendlyName( _( "Enter Group" ) ) - .Tooltip( _( "Enter the group to edit items" ) ) - .Icon( BITMAPS::group_enter ) ); - -TOOL_ACTION PCB_ACTIONS::groupLeave( TOOL_ACTION_ARGS() - .Name( "pcbnew.EditorControl.groupLeave" ) - .Scope( AS_GLOBAL ) - .FriendlyName( _( "Leave Group" ) ) - .Tooltip( _( "Leave the current group" ) ) - .Icon( BITMAPS::group_leave ) ); - TOOL_ACTION PCB_ACTIONS::appendBoard( TOOL_ACTION_ARGS() .Name( "pcbnew.EditorControl.appendBoard" ) .Scope( AS_GLOBAL ) @@ -2154,19 +2119,6 @@ TOOL_ACTION PCB_ACTIONS::pointEditorArcKeepEndpoint( TOOL_ACTION_ARGS() .Tooltip( _( "Switch arc editing mode to keep endpoints, or to keep direction of the other point" ) ) .Parameter( ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION ) ); - -// GROUP_TOOL -// -TOOL_ACTION PCB_ACTIONS::groupProperties( TOOL_ACTION_ARGS() - .Name( "pcbnew.Groups.groupProperties" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::pickNewGroupMember( TOOL_ACTION_ARGS() - .Name( "pcbnew.Groups.selectNewGroupMember" ) - .Scope( AS_GLOBAL ) ); - - - // POSITION_RELATIVE_TOOL // TOOL_ACTION PCB_ACTIONS::positionRelative( TOOL_ACTION_ARGS() diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 44efb1ebdd..5a278f4910 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -306,12 +306,6 @@ public: static TOOL_ACTION pointEditorMoveCorner; static TOOL_ACTION pointEditorMoveMidpoint; - - // Group Tool - static TOOL_ACTION groupProperties; - static TOOL_ACTION pickNewGroupMember; - - // Placement Tool static TOOL_ACTION alignTop; static TOOL_ACTION alignBottom; @@ -548,13 +542,6 @@ public: static TOOL_ACTION lock; static TOOL_ACTION unlock; - // Grouping - static TOOL_ACTION group; - static TOOL_ACTION ungroup; - static TOOL_ACTION removeFromGroup; - static TOOL_ACTION groupEnter; - static TOOL_ACTION groupLeave; - // Miscellaneous static TOOL_ACTION selectionTool; static TOOL_ACTION pickerTool; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 8f885d8272..ff8ee2f67c 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -210,8 +210,8 @@ bool PCB_SELECTION_TOOL::Init() // "Cancel" goes at the top of the context menu when a tool is active menu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 ); - menu.AddItem( PCB_ACTIONS::groupEnter, groupEnterCondition, 1 ); - menu.AddItem( PCB_ACTIONS::groupLeave, inGroupCondition, 1 ); + menu.AddItem( ACTIONS::groupEnter, groupEnterCondition, 1 ); + menu.AddItem( ACTIONS::groupLeave, inGroupCondition, 1 ); menu.AddItem( PCB_ACTIONS::clearHighlight, haveHighlight, 1 ); menu.AddSeparator( haveHighlight, 1 );