From 203c8df909b10678f2ffbce2d61e1547d47ba27a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 30 Oct 2020 17:40:07 +0000 Subject: [PATCH] Respect locked flag when inline dragging. Fixes https://gitlab.com/kicad/code/kicad/issues/6117 --- pcbnew/tools/edit_tool.cpp | 18 ++++++++++++------ pcbnew/tools/selection_tool.cpp | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 0fa4bfd3a0..61d4b40e50 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -299,6 +299,12 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent ) if( aEvent.IsAction( &PCB_ACTIONS::dragFreeAngle ) ) mode |= PNS::DM_FREE_ANGLE; + // deal with locked items (override lock or abort the operation) + SELECTION_LOCK_FLAGS lockFlags = m_selectionTool->CheckLock(); + + if( lockFlags == SELECTION_LOCKED ) + return 0; + invokeInlineRouter( mode ); return 0; @@ -467,6 +473,12 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) { // Prepare to start dragging + // deal with locked items (override lock or abort the operation) + SELECTION_LOCK_FLAGS lockFlags = m_selectionTool->CheckLock(); + + if( lockFlags == SELECTION_LOCKED ) + break; + if( !( evt->IsAction( &PCB_ACTIONS::move ) || evt->IsAction( &PCB_ACTIONS::moveWithReference ) ) && isInteractiveDragEnabled() ) @@ -475,12 +487,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) break; } - // deal with locked items (override lock or abort the operation) - SELECTION_LOCK_FLAGS lockFlags = m_selectionTool->CheckLock(); - - if( lockFlags == SELECTION_LOCKED ) - break; - m_dragging = true; // When editing footprints, all items have the same parent diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 4c2bc75645..156726ce35 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -27,6 +27,7 @@ #include #include using namespace std::placeholders; +#include #include #include #include @@ -45,7 +46,7 @@ using namespace std::placeholders; #include #include #include -#include +//#include #include #include #include