← Back to team overview

kicad-developers team mailing list archive

Fixed Patch to prevent Junction and No-Connect duplicates.

 

I just noticed that I used aPosition for the hit testing, but I should have used gridPosition instead. So I've attached an updated patch.

On 06/18/2012 12:06 PM, Moses McKnight wrote:
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


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp
=== modified file 'eeschema/onleftclick.cpp'
--- eeschema/onleftclick.cpp	2012-06-03 11:16:08 +0000
+++ eeschema/onleftclick.cpp	2012-06-18 20:10:03 +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( gridPosition, 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( gridPosition, 0, SCH_JUNCTION_T ) )
+            {
+                m_itemToRepeat = AddJunction( aDC, gridPosition, true );
+                GetScreen()->SetCurItem( m_itemToRepeat );
+                m_canvas->SetAutoPanRequest( true );
+            }
         }
         else
         {


Follow ups

References