diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index f9edfe089c..af6be99c81 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -166,6 +166,12 @@ bool EDIT_TOOL::Init() return frame()->GetBoard() && !frame()->GetBoard()->IsEmpty(); }; + auto isSkippable = + [ this ]( const SELECTION& aSelection ) + { + return frame()->IsCurrentTool( PCB_ACTIONS::moveIndividually ); + }; + static std::vector connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, @@ -197,6 +203,7 @@ bool EDIT_TOOL::Init() && notMovingCondition ); menu.AddItem( PCB_ACTIONS::moveIndividually, SELECTION_CONDITIONS::MoreThan( 1 ) && notMovingCondition ); + menu.AddItem( PCB_ACTIONS::skip, isSkippable ); menu.AddItem( PCB_ACTIONS::breakTrack, SELECTION_CONDITIONS::Count( 1 ) && SELECTION_CONDITIONS::OnlyTypes( trackTypes ) ); menu.AddItem( PCB_ACTIONS::drag45Degree, SELECTION_CONDITIONS::Count( 1 ) diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 6ee7b35b50..886c728ac1 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -465,6 +465,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent ) grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); + bool isSkip = evt->IsAction( &PCB_ACTIONS::skip ) && moveIndividually; + if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) eatFirstMouseUp = false; @@ -726,7 +728,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent ) break; // finish -- we moved exactly, so we are finished } - else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) + else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) || isSkip ) { // Eat mouse-up/-click events that leaked through from the lock dialog if( eatFirstMouseUp && evt->Parameter() != ACTIONS::CURSOR_CLICK ) @@ -736,6 +738,10 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent ) } else if( moveIndividually && m_dragging ) { + // Put skipped items back where they started + if( isSkip ) + orig_items[itemIdx]->SetPosition( originalPos ); + if( ++itemIdx < orig_items.size() ) { m_selectionTool->ClearSelection(); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index a0212d6859..d00945fea4 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -343,12 +343,18 @@ TOOL_ACTION PCB_ACTIONS::swap( "pcbnew.InteractiveEdit.swap", BITMAPS::swap ); TOOL_ACTION PCB_ACTIONS::packAndMoveFootprints( "pcbnew.InteractiveEdit.packAndMoveFootprints", - AS_GLOBAL, + AS_GLOBAL, 'P', "", - _( "Pack and Move Footprints" ), + _( "Pack and Move Footprints" ), _( "Sorts selected footprints by reference, packs based on size and initiates movement" ), BITMAPS::pack_footprints ); +TOOL_ACTION PCB_ACTIONS::skip( "pcbnew.InteractiveEdit.skip", + AS_CONTEXT, + WXK_TAB, "", + _( "Skip" ), _( "Skip item" ), + BITMAPS::right ); + TOOL_ACTION PCB_ACTIONS::changeTrackWidth( "pcbnew.InteractiveEdit.changeTrackWidth", AS_GLOBAL, 0, "", _( "Change Track Width" ), _( "Updates selected track & via sizes" ) ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 229598b46c..b1fed46b95 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -135,6 +135,9 @@ public: /// Pack and start moving selected footprints static TOOL_ACTION packAndMoveFootprints; + // Compound Action Tool actions, e.g. Move Individually + static TOOL_ACTION skip; + /// Update selected tracks & vias to the current track & via dimensions static TOOL_ACTION changeTrackWidth;