← Back to team overview

kicad-developers team mailing list archive

Patch to prevent Junction and No-Connect duplicates.

 

Hi,

Ok, I carved out a little time and here is a small patch which prevents manual placement of junctions and no-connects on top of existing ones.

Is this the best place to send patches?

Thanks,
Moses
=== modified file 'eeschema/onleftclick.cpp'
--- eeschema/onleftclick.cpp	2012-06-03 11:16:08 +0000
+++ eeschema/onleftclick.cpp	2012-06-18 16:32:21 +0000
@@ -86,6 +86,7 @@
                 wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error.  Item type <" ) +
                             item->GetClass() + wxT( "> is already being edited." ) );
                 item->ClearFlags();
+                break;
             }
         }
         else
@@ -124,9 +125,12 @@
     case ID_NOCONN_BUTT:
         if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
         {
-            m_itemToRepeat = AddNoConnect( aDC, gridPosition );
-            GetScreen()->SetCurItem( m_itemToRepeat );
-            m_canvas->SetAutoPanRequest( true );
+            if( false == GetScreen()->GetItem( aPosition, 0, SCH_NO_CONNECT_T ) )
+            {
+                m_itemToRepeat = AddNoConnect( aDC, gridPosition );
+                GetScreen()->SetCurItem( m_itemToRepeat );
+                m_canvas->SetAutoPanRequest( true );
+            }
         }
         else
         {
@@ -138,9 +142,12 @@
     case ID_JUNCTION_BUTT:
         if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
         {
-            m_itemToRepeat = AddJunction( aDC, gridPosition, true );
-            GetScreen()->SetCurItem( m_itemToRepeat );
-            m_canvas->SetAutoPanRequest( true );
+            if( false == GetScreen()->GetItem( aPosition, 0, SCH_JUNCTION_T ) )
+            {
+                m_itemToRepeat = AddJunction( aDC, gridPosition, true );
+                GetScreen()->SetCurItem( m_itemToRepeat );
+                m_canvas->SetAutoPanRequest( true );
+            }
         }
         else
         {


Follow ups