Commit 160ab816 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix bug in Delete Connection (see bug 781604)

parent d76cd0cf
...@@ -1136,7 +1136,7 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis ...@@ -1136,7 +1136,7 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
continue; // Already seen continue; // Already seen
if( !(item->GetFlags() & CANDIDATE) ) if( !(item->GetFlags() & CANDIDATE) )
continue; // Already seen continue; // not a candidate
if( item->Type() != SCH_LINE_T ) if( item->Type() != SCH_LINE_T )
continue; continue;
...@@ -1145,41 +1145,51 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis ...@@ -1145,41 +1145,51 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
segment = (SCH_LINE*) item; segment = (SCH_LINE*) item;
/* If the wire start point is connected to a wire that has already been found /* If the wire start point is connected to a wire that was already found
* and now is not connected, add the wire to the list. */ * and now is not connected, add the wire to the list. */
SCH_LINE* testSegment = NULL;
for( tmp = GetDrawItems(); tmp != NULL; tmp = tmp->Next() ) for( tmp = GetDrawItems(); tmp != NULL; tmp = tmp->Next() )
{ {
// Ensure tmp is a previously deleted segment:
if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 ) if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 )
continue; continue;
if( tmp->Type() != SCH_LINE_T ) if( tmp->Type() != SCH_LINE_T )
continue; continue;
testSegment = (SCH_LINE*) tmp; SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->m_Start ) ) if( testSegment->IsEndPoint( segment->m_Start ) )
break; break;
} }
if( testSegment && !CountConnectedItems( segment->m_Start, true ) ) // when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the start point is not connected to an other item (like pin)
if( tmp && !CountConnectedItems( segment->m_Start, true ) )
noconnect = true; noconnect = true;
/* If the wire end point is connected to a wire that has already been found /* If the wire end point is connected to a wire that has already been found
* and now is not connected, add the wire to the list. */ * and now is not connected, add the wire to the list. */
for( tmp = GetDrawItems(); tmp != NULL; tmp = tmp->Next() ) for( tmp = GetDrawItems(); tmp != NULL; tmp = tmp->Next() )
{ {
// Ensure tmp is a previously deleted segment:
if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 ) if( ( tmp->GetFlags() & STRUCT_DELETED ) == 0 )
continue; continue;
if( tmp->Type() != SCH_LINE_T ) if( tmp->Type() != SCH_LINE_T )
continue; continue;
SCH_LINE* testSegment = (SCH_LINE*) tmp;
// Test for segment connected to the previously deleted segment:
if( testSegment->IsEndPoint( segment->m_End ) ) if( testSegment->IsEndPoint( segment->m_End ) )
break; break;
} }
// when tmp != NULL, segment is a new candidate:
// put it in deleted list if
// the end point is not connected to an other item (like pin)
if( tmp && !CountConnectedItems( segment->m_End, true ) ) if( tmp && !CountConnectedItems( segment->m_End, true ) )
noconnect = true; noconnect = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment