← Back to team overview

kicad-developers team mailing list archive

[PATCH] Correctly filter copyable objects for copy hotkey (Fixes lp:1571316)

 

Hi,

Minor patch to eeschema attached to fix reported issue with clarify menu.

-Jon
From 315b745a1db89c06240b42f544502a9cefaa2ad4 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sat, 11 Feb 2017 13:29:22 -0500
Subject: [PATCH] Correctly filter copyable objects for copy hotkey (Fixes
 lp:1571316)

---
 eeschema/hotkeys.cpp        |  2 +-
 eeschema/sch_collectors.cpp | 10 ++++++++++
 eeschema/sch_collectors.h   |  5 +++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp
index c25f68f..bd0d1b9 100644
--- a/eeschema/hotkeys.cpp
+++ b/eeschema/hotkeys.cpp
@@ -575,7 +575,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
 
         if( aItem == NULL )
         {
-            aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::MovableItems );
+            aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
 
             if( aItem == NULL )
                 break;
diff --git a/eeschema/sch_collectors.cpp b/eeschema/sch_collectors.cpp
index a467d24..671c611 100644
--- a/eeschema/sch_collectors.cpp
+++ b/eeschema/sch_collectors.cpp
@@ -199,6 +199,16 @@ const KICAD_T SCH_COLLECTOR::OrientableItems[] = {
 };
 
 
+const KICAD_T SCH_COLLECTOR::CopyableItems[] = {
+    SCH_TEXT_T,
+    SCH_LABEL_T,
+    SCH_GLOBAL_LABEL_T,
+    SCH_HIERARCHICAL_LABEL_T,
+    SCH_COMPONENT_T,
+    EOT
+};
+
+
 SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
 {
     if( aItem->Type() != LIB_PIN_T && !aItem->HitTest( m_RefPos ) )
diff --git a/eeschema/sch_collectors.h b/eeschema/sch_collectors.h
index 3485413..93f2efb 100644
--- a/eeschema/sch_collectors.h
+++ b/eeschema/sch_collectors.h
@@ -113,6 +113,11 @@ public:
     static const KICAD_T OrientableItems[];
 
     /**
+     * A scan list for schematic items that can be copied/duplicated.
+     */
+    static const KICAD_T CopyableItems[];
+
+    /**
      * Constructor SCH_COLLECTOR
      */
     SCH_COLLECTOR( const KICAD_T* aScanTypes = SCH_COLLECTOR::AllItems )
-- 
2.7.4


Follow ups