From a5ff27cae722b3d657229d52e21564104dd1fdb1 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 8 May 2021 21:08:18 +0200 Subject: [PATCH] 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. --- pcbnew/tools/edit_tool.cpp | 5 +++++ pcbnew/tools/pcb_actions.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 84eb674e1a..3463179e16 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -211,6 +211,11 @@ bool EDIT_TOOL::Init() 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()->IsType( FRAME_PCB_EDITOR ) ) + return 0; + PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); FOOTPRINT* fp = getEditFrame()->GetFootprintFromBoardByReference(); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index d92fb647b8..16a57d6f37 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -245,7 +245,7 @@ TOOL_ACTION PCB_ACTIONS::getAndPlace( "pcbnew.InteractiveEdit.FindMove", 'T', LEGACY_HK_NAME( "Get and Move Footprint" ), _( "Get and Move Footprint" ), _( "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", AS_GLOBAL,