Disable positioning tools when a move is in progress.
Also fixes a typo in EDIT_TOOL::doMoveSelection(). Fixes https://gitlab.com/kicad/code/kicad/-/issues/15090
This commit is contained in:
parent
821f365758
commit
7ed5963b4f
|
@ -91,10 +91,16 @@ POSITIONING_TOOLS_MENU::POSITIONING_TOOLS_MENU( TOOL_INTERACTIVE* aTool ) :
|
|||
SetIcon( BITMAPS::special_tools );
|
||||
SetTitle( _( "Positioning Tools" ) );
|
||||
|
||||
AddItem( PCB_ACTIONS::moveExact, SELECTION_CONDITIONS::ShowAlways );
|
||||
AddItem( PCB_ACTIONS::moveWithReference, SELECTION_CONDITIONS::ShowAlways );
|
||||
AddItem( PCB_ACTIONS::copyWithReference, SELECTION_CONDITIONS::ShowAlways );
|
||||
AddItem( PCB_ACTIONS::positionRelative, SELECTION_CONDITIONS::ShowAlways );
|
||||
auto notMovingCondition =
|
||||
[ this ]( const SELECTION& aSelection )
|
||||
{
|
||||
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
||||
};
|
||||
|
||||
AddItem( PCB_ACTIONS::moveExact, SELECTION_CONDITIONS::NotEmpty && notMovingCondition );
|
||||
AddItem( PCB_ACTIONS::moveWithReference, SELECTION_CONDITIONS::NotEmpty && notMovingCondition );
|
||||
AddItem( PCB_ACTIONS::copyWithReference, SELECTION_CONDITIONS::NotEmpty && notMovingCondition );
|
||||
AddItem( PCB_ACTIONS::positionRelative, SELECTION_CONDITIONS::NotEmpty && notMovingCondition );
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,9 +171,7 @@ bool EDIT_TOOL::Init()
|
|||
auto notMovingCondition =
|
||||
[ this ]( const SELECTION& aSelection )
|
||||
{
|
||||
return !frame()->IsCurrentTool( PCB_ACTIONS::move )
|
||||
&& !frame()->IsCurrentTool( PCB_ACTIONS::moveWithReference )
|
||||
&& !frame()->IsCurrentTool( PCB_ACTIONS::moveIndividually );
|
||||
return aSelection.Empty() || !aSelection.Front()->IsMoving();
|
||||
};
|
||||
|
||||
auto noItemsCondition =
|
||||
|
|
|
@ -564,7 +564,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
if( item->GetParent() && item->GetParent()->IsSelected() )
|
||||
continue;
|
||||
|
||||
if( !item->IsNew() && item->IsMoving()
|
||||
if( !item->IsNew() && !item->IsMoving()
|
||||
&& ( !IsFootprintEditor() || aCommit->Empty() ) )
|
||||
{
|
||||
aCommit->Modify( item );
|
||||
|
@ -682,17 +682,6 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
eatFirstMouseUp = false;
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::moveExact ) )
|
||||
{
|
||||
// Reset positions so the Move Exactly is from the start.
|
||||
for( EDA_ITEM* item : selection )
|
||||
{
|
||||
BOARD_ITEM* i = static_cast<BOARD_ITEM*>( item );
|
||||
i->Move( -totalMovement );
|
||||
}
|
||||
|
||||
break; // finish -- we moved exactly, so we are finished
|
||||
}
|
||||
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) || isSkip )
|
||||
{
|
||||
// Eat mouse-up/-click events that leaked through from the lock dialog
|
||||
|
@ -747,7 +736,12 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
displayConstraintsMessage( hv45Mode );
|
||||
evt->SetPassEvent( false );
|
||||
}
|
||||
else if( ZONE_FILLER_TOOL::IsZoneFillAction( evt ) || evt->IsAction( &ACTIONS::redo ))
|
||||
else if( ZONE_FILLER_TOOL::IsZoneFillAction( evt )
|
||||
|| evt->IsAction( &PCB_ACTIONS::moveExact )
|
||||
|| evt->IsAction( &PCB_ACTIONS::moveWithReference )
|
||||
|| evt->IsAction( &PCB_ACTIONS::copyWithReference )
|
||||
|| evt->IsAction( &PCB_ACTIONS::positionRelative )
|
||||
|| evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue