Don't use activate to move as the edit tool must activate for other ops.

Fixes: lp:1839534
* https://bugs.launchpad.net/kicad/+bug/1839534
This commit is contained in:
Jeff Young 2019-08-10 11:56:15 +01:00
parent 3a2c39b0f8
commit c836cc9cf8
5 changed files with 12 additions and 24 deletions

View File

@ -233,7 +233,7 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
return 0;
}
int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW_CONTROLS* controls = getViewControls();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
@ -241,7 +241,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
// Be sure that there is at least one item that we can modify. If nothing was selected before,
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
auto& selection = m_selectionTool->RequestSelection(
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
{
EditToolSelectionFilter( aCollector, EXCLUDE_TRANSIENTS );
@ -253,12 +253,13 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
LSET item_layers = static_cast<BOARD_ITEM*>( selection.Front() )->GetLayerSet();
bool unselect = selection.IsHover(); //N.B. This must be saved before the re-selection below
// Filter out locked pads here
// We cannot do this in the selection filter as we need the pad layers
// when it is the curr_item.
// Now filter out locked pads. We cannot do this in the first RequestSelection() as we need
// the item_layers when a pad is the selection front (ie: will become curr_tiem).
selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
{ EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS ); } );
{
EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED_PADS );
} );
if( selection.Empty() )
return 0;
@ -304,10 +305,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
controls->SetSnapping( !evt->Modifier( MD_ALT ) );
if( evt->IsAction( &PCB_ACTIONS::editActivate ) ||
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 ) )
{
if( m_dragging && evt->Category() == TC_MOUSE )
@ -1061,7 +1059,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// If items were duplicated, pick them up
// this works well for "dropping" copies around and pushes the commit
TOOL_EVENT evt = PCB_ACTIONS::move.MakeEvent();
Main( evt );
Move( evt );
}
return 0;
@ -1395,8 +1393,7 @@ int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent )
void EDIT_TOOL::setTransitions()
{
Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Move, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );

View File

@ -78,7 +78,7 @@ public:
* Function Main()
* Main loop in which events are handled.
*/
int Main( const TOOL_EVENT& aEvent );
int Move( const TOOL_EVENT& aEvent );
/**
* Function Drag()

View File

@ -180,11 +180,6 @@ TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.EditFp
_( "Opens the selected footprint in the Footprint Editor" ),
module_editor_xpm );
TOOL_ACTION PCB_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
AS_GLOBAL, 0, "",
_( "Edit Activate" ), "",
move_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveMove.move",
AS_GLOBAL,
'M', LEGACY_HK_NAME( "Move Item" ),

View File

@ -104,10 +104,6 @@ public:
/// Filters the items in the current selection (invokes dialog)
static TOOL_ACTION filterSelection;
// Edit Tool
/// Activation of the edit tool
static TOOL_ACTION editActivate;
/// move an item
static TOOL_ACTION move;

View File

@ -251,7 +251,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( selectionContains( evt->Position() ) )
{
// Yes -> run the move tool and wait till it finishes
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
m_toolMgr->RunAction( PCB_ACTIONS::move, true );
}
else
{