From 769611b79edd8269a0ec95dc51eacd17cbc9fa6c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 28 Nov 2017 17:32:12 +0100 Subject: [PATCH] Do not ask for confirmation to open Properties dialog for a locked footprint Opening Properties dialog normally does not ask the user to confirm the action, even for locked items. The exception was a case when there was nothing selected and Properties dialog was invoked via its hot key - then SELECTION_TOOL::RequestSelection() tried to get the item under the cursor, verifying the lock flag. Fixes: lp:1734537 * https://bugs.launchpad.net/kicad/+bug/1734537 --- include/tool/selection.h | 3 +++ pcbnew/tools/edit_tool.cpp | 3 ++- pcbnew/tools/selection_tool.cpp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/tool/selection.h b/include/tool/selection.h index 0916f98481..28e7d8d0e1 100644 --- a/include/tool/selection.h +++ b/include/tool/selection.h @@ -222,6 +222,9 @@ enum SELECTION_TYPE_FLAGS SELECTION_SANITIZE_PADS = 4, // Request a hover-only selection SELECTION_HOVER = 8, + // Select locked parts without asking the user + SELECTION_FORCE_UNLOCK = 16, + SELECTION_DEFAULT = 0x7 }; diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 4218d9ec28..4cab7c1e6e 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -612,7 +612,8 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); - const auto& selection = m_selectionTool->RequestSelection( SELECTION_EDITABLE | SELECTION_DELETABLE ); + const auto& selection = m_selectionTool->RequestSelection( + SELECTION_EDITABLE | SELECTION_DELETABLE | SELECTION_FORCE_UNLOCK ); if( selection.Empty() ) return 0; diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 5a423ba32a..db8ce73ce0 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -356,6 +356,9 @@ SELECTION& SELECTION_TOOL::RequestSelection( int aFlags ) { if( m_selection.Empty() ) { + if( aFlags & SELECTION_FORCE_UNLOCK ) + m_locked = false; + m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, 0 ); m_selection.SetIsHover( true ); m_selection.ClearReferencePoint();