← Back to team overview

kicad-developers team mailing list archive

[PATCH] Allow editing locked modules in modedit

 

This patch makes it possible to edit locked modules in the module editor.

Since you have to explicitly launch modedit to be able to change the
module, and there is no change to pcbnew behaviour, editing locked
modules still required explicit effort to do so (just like moving
locked modules).

Fixes: LP 1591625

https://bugs.launchpad.net/kicad/+bug/1591625
From 317510c194c8e8c3829abb4cdabbeab773b087bc Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 22 Jan 2017 01:32:45 +0800
Subject: [PATCH] Allow editing locked modules in modedit

Since you have to explicitly enter the module editor with the menu or
hotkey, allowing editing of module sub-parts once in should not cause
any unexpected changes.

Fixes: lp:1591625
* https://bugs.launchpad.net/kicad/+bug/1591625
---
 pcbnew/tools/selection_tool.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index ce40ae634..a2220f856 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -867,12 +867,23 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const
     case PCB_MODULE_EDGE_T:
     case PCB_PAD_T:
     {
+        // Multiple selection is only allowed in modedit mode
+        // In pcbnew, you have to select subparts of modules
+        // one-by-one, rather than with a drag selection.
+        // This is so you can pick up items under an (unlocked)
+        // module without also moving the module's sub-parts.
         if( m_multiple && !m_editModules )
             return false;
 
-        MODULE* mod = static_cast<const D_PAD*>( aItem )->GetParent();
-        if( mod && mod->IsLocked() )
-            return false;
+        // When editing modules, it's allowed to select them, even when
+        // locked, since you already have to explicitly activate the
+        // module editor to get to this stage
+        if ( !m_editModules )
+        {
+            MODULE* mod = static_cast<const D_PAD*>( aItem )->GetParent();
+            if( mod && mod->IsLocked() )
+                return false;
+        }
 
         break;
     }
-- 
2.11.0


Follow ups