PCB Tools: Move Individually
Allows moving a selection of components one by one.
This commit is contained in:
parent
838bd7292c
commit
e66393c4dd
|
@ -188,6 +188,8 @@ bool EDIT_TOOL::Init()
|
||||||
&& notMovingCondition );
|
&& notMovingCondition );
|
||||||
menu.AddItem( PCB_ACTIONS::unrouteSelected, SELECTION_CONDITIONS::NotEmpty
|
menu.AddItem( PCB_ACTIONS::unrouteSelected, SELECTION_CONDITIONS::NotEmpty
|
||||||
&& SELECTION_CONDITIONS::OnlyTypes( unroutableTypes ) );
|
&& SELECTION_CONDITIONS::OnlyTypes( unroutableTypes ) );
|
||||||
|
menu.AddItem( PCB_ACTIONS::moveIndividually, SELECTION_CONDITIONS::NotEmpty
|
||||||
|
&& notMovingCondition );
|
||||||
menu.AddItem( PCB_ACTIONS::breakTrack, SELECTION_CONDITIONS::Count( 1 )
|
menu.AddItem( PCB_ACTIONS::breakTrack, SELECTION_CONDITIONS::Count( 1 )
|
||||||
&& SELECTION_CONDITIONS::OnlyTypes( trackTypes ) );
|
&& SELECTION_CONDITIONS::OnlyTypes( trackTypes ) );
|
||||||
menu.AddItem( PCB_ACTIONS::drag45Degree, SELECTION_CONDITIONS::Count( 1 )
|
menu.AddItem( PCB_ACTIONS::drag45Degree, SELECTION_CONDITIONS::Count( 1 )
|
||||||
|
@ -2238,6 +2240,7 @@ void EDIT_TOOL::setTransitions()
|
||||||
{
|
{
|
||||||
Go( &EDIT_TOOL::GetAndPlace, PCB_ACTIONS::getAndPlace.MakeEvent() );
|
Go( &EDIT_TOOL::GetAndPlace, PCB_ACTIONS::getAndPlace.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Move, PCB_ACTIONS::move.MakeEvent() );
|
Go( &EDIT_TOOL::Move, PCB_ACTIONS::move.MakeEvent() );
|
||||||
|
Go( &EDIT_TOOL::MoveIndividually, PCB_ACTIONS::moveIndividually.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
|
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
|
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
|
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
|
||||||
|
|
|
@ -80,6 +80,11 @@ public:
|
||||||
*/
|
*/
|
||||||
int Move( const TOOL_EVENT& aEvent );
|
int Move( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move a selection of items one-at-a-time.
|
||||||
|
*/
|
||||||
|
int MoveIndividually( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke the PNS router to drag tracks or do an offline resizing of an arc track
|
* Invoke the PNS router to drag tracks or do an offline resizing of an arc track
|
||||||
* if a single arc track is selected.
|
* if a single arc track is selected.
|
||||||
|
|
|
@ -392,6 +392,34 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int EDIT_TOOL::MoveIndividually( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
||||||
|
|
||||||
|
if( isRouterActive() )
|
||||||
|
{
|
||||||
|
wxBell();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EDA_ITEMS sortedItems = selTool->GetSelection().GetItemsSortedBySelectionOrder();
|
||||||
|
|
||||||
|
if( sortedItems.size() == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for( EDA_ITEM* item : sortedItems )
|
||||||
|
{
|
||||||
|
selTool->ClearSelection();
|
||||||
|
selTool->AddItemToSel( item );
|
||||||
|
doMoveSelection( aEvent );
|
||||||
|
}
|
||||||
|
|
||||||
|
selTool->AddItemsToSel( &sortedItems );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIT_TOOL::MoveWithReference( const TOOL_EVENT& aEvent )
|
int EDIT_TOOL::MoveWithReference( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( isRouterActive() )
|
if( isRouterActive() )
|
||||||
|
@ -582,7 +610,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
|
||||||
|
|
||||||
if( evt->IsAction( &PCB_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
if( evt->IsAction( &PCB_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|
||||||
|| evt->IsAction( &ACTIONS::refreshPreview )
|
|| evt->IsAction( &ACTIONS::refreshPreview )
|
||||||
|| evt->IsAction( &PCB_ACTIONS::moveWithReference ) )
|
|| evt->IsAction( &PCB_ACTIONS::moveWithReference )
|
||||||
|
|| evt->IsAction( &PCB_ACTIONS::moveIndividually ) )
|
||||||
{
|
{
|
||||||
if( m_dragging && evt->Category() == TC_MOUSE )
|
if( m_dragging && evt->Category() == TC_MOUSE )
|
||||||
{
|
{
|
||||||
|
@ -703,7 +732,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
|
||||||
{
|
{
|
||||||
// Prepare to start dragging
|
// Prepare to start dragging
|
||||||
if( !( evt->IsAction( &PCB_ACTIONS::move )
|
if( !( evt->IsAction( &PCB_ACTIONS::move )
|
||||||
|| evt->IsAction( &PCB_ACTIONS::moveWithReference ) )
|
|| evt->IsAction( &PCB_ACTIONS::moveWithReference )
|
||||||
|
|| evt->IsAction( &PCB_ACTIONS::moveIndividually ) )
|
||||||
&& ( editFrame->GetPcbNewSettings()->m_TrackDragAction != TRACK_DRAG_ACTION::MOVE ) )
|
&& ( editFrame->GetPcbNewSettings()->m_TrackDragAction != TRACK_DRAG_ACTION::MOVE ) )
|
||||||
{
|
{
|
||||||
if( invokeInlineRouter( PNS::DM_ANY ) )
|
if( invokeInlineRouter( PNS::DM_ANY ) )
|
||||||
|
|
|
@ -270,6 +270,12 @@ TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveMove.move",
|
||||||
_( "Move" ), _( "Moves the selected item(s)" ),
|
_( "Move" ), _( "Moves the selected item(s)" ),
|
||||||
BITMAPS::move, AF_ACTIVATE );
|
BITMAPS::move, AF_ACTIVATE );
|
||||||
|
|
||||||
|
TOOL_ACTION PCB_ACTIONS::moveIndividually( "pcbnew.InteractiveMove.moveIndividually",
|
||||||
|
AS_GLOBAL,
|
||||||
|
MD_CTRL + 'M', "",
|
||||||
|
_( "Move Individually" ), _( "Moves the selected items one-by-one" ),
|
||||||
|
BITMAPS::move, AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::moveWithReference( "pcbnew.InteractiveMove.moveWithReference",
|
TOOL_ACTION PCB_ACTIONS::moveWithReference( "pcbnew.InteractiveMove.moveWithReference",
|
||||||
AS_GLOBAL, 0, "",
|
AS_GLOBAL, 0, "",
|
||||||
_( "Move with Reference" ),
|
_( "Move with Reference" ),
|
||||||
|
|
|
@ -103,6 +103,9 @@ public:
|
||||||
/// move or drag an item
|
/// move or drag an item
|
||||||
static TOOL_ACTION move;
|
static TOOL_ACTION move;
|
||||||
|
|
||||||
|
/// move items one-by-one
|
||||||
|
static TOOL_ACTION moveIndividually;
|
||||||
|
|
||||||
/// move with a reference point
|
/// move with a reference point
|
||||||
static TOOL_ACTION moveWithReference;
|
static TOOL_ACTION moveWithReference;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue