mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 23:21:41 +00:00
groups: move actions to common actions
This commit is contained in:
parent
43e432f9ad
commit
f40b24d04a
@ -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" )
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<PCB_GROUP*>( aItem ) );
|
||||
m_toolManager->RunAction( ACTIONS::groupProperties, static_cast<PCB_GROUP*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_GENERATOR_T:
|
||||
|
@ -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() ) );
|
||||
|
@ -244,7 +244,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
||||
}
|
||||
|
||||
case PCB_GROUP_T:
|
||||
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, static_cast<PCB_GROUP*>( aItem ) );
|
||||
m_toolManager->RunAction( ACTIONS::groupProperties, static_cast<PCB_GROUP*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
|
@ -847,8 +847,8 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
||||
|
||||
static const std::vector<KICAD_T> 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 ) );
|
||||
|
||||
|
@ -154,8 +154,8 @@ std::optional<TOOLBAR_CONFIGURATION> 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 )
|
||||
|
@ -307,8 +307,8 @@ std::optional<TOOLBAR_CONFIGURATION> 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 );
|
||||
|
||||
|
@ -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::GroupProperties, ACTIONS::groupProperties.MakeEvent() );
|
||||
Go( &GROUP_TOOL::PickNewMember, 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::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() );
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user