Pcbnew, EDIT_TOOL::GetAndPlace(): fix and issue, and allows execution only if

called inside the board editor.
Fix also a broken behavior: the current action was not cancelled, and if it is
called during a move items (when typing the 'T' key), items were broken.
The actual bug is the fact it is called also in fp editor and footprint wizard frame,
because it is part of EDIT_TOOL action list, common to fp editor, and should not.
But a full change is much more costly than just a filter.
This commit is contained in:
jean-pierre charras 2021-05-08 21:08:18 +02:00
parent 1c6f291bcd
commit a5ff27cae7
2 changed files with 6 additions and 1 deletions

View File

@ -211,6 +211,11 @@ bool EDIT_TOOL::Init()
int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent ) int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent )
{ {
// GetAndPlace makes sense only in board editor, although it is also called
// in fpeditor, that shares the same EDIT_TOOL list
if( !getEditFrame<PCB_BASE_FRAME>()->IsType( FRAME_PCB_EDITOR ) )
return 0;
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference(); FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference();

View File

@ -245,7 +245,7 @@ TOOL_ACTION PCB_ACTIONS::getAndPlace( "pcbnew.InteractiveEdit.FindMove",
'T', LEGACY_HK_NAME( "Get and Move Footprint" ), 'T', LEGACY_HK_NAME( "Get and Move Footprint" ),
_( "Get and Move Footprint" ), _( "Get and Move Footprint" ),
_( "Selects a footprint by reference designator and places it under the cursor for moving"), _( "Selects a footprint by reference designator and places it under the cursor for moving"),
BITMAPS::move ); BITMAPS::move, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveMove.move", TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveMove.move",
AS_GLOBAL, AS_GLOBAL,