PCB: Add skip action to Move Individually
This commit is contained in:
parent
6d52601241
commit
ad6ef35c9f
|
@ -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<KICAD_T> 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 )
|
||||
|
|
|
@ -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<intptr_t>() != 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();
|
||||
|
|
|
@ -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" ) );
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue