eeschema: Re-add auto-wire removal

Somewhere during v5 rc cycle, the trimming of wires laid over simple
components was removed.  The wires were still removed as soon as the
user moved the component again.  This corrects the first behavior to
intended action for simple components.

Fixes: lp:1794019
* https://bugs.launchpad.net/kicad/+bug/1794019

(cherry picked from commit 9831a14ef3)
This commit is contained in:
Seth Hillbrand 2018-09-24 06:36:21 -07:00
parent 1253020a8b
commit 618374db88
1 changed files with 21 additions and 3 deletions

View File

@ -332,6 +332,25 @@ void SCH_EDIT_FRAME::EndSegment()
// Correct and remove segments that need to be merged. // Correct and remove segments that need to be merged.
SchematicCleanUp( true ); SchematicCleanUp( true );
for( auto item = GetScreen()->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
std::vector< wxPoint > pts;
item->GetConnectionPoints( pts );
std::remove_if( pts.begin(), pts.end(), [ segment ]( const wxPoint& aPt )
{ return segment->IsEndPoint( aPt ); } );
if( pts.size() > 2 )
continue;
for( auto i = pts.begin(); i != pts.end(); i++ )
for( auto j = i + 1; j != pts.end(); j++ )
TrimWire( *i, *j, true );
}
for( auto i : new_ends ) for( auto i : new_ends )
{ {
if( screen->IsJunctionNeeded( i, true ) ) if( screen->IsJunctionNeeded( i, true ) )
@ -486,10 +505,9 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
{ {
next_item = item->Next(); next_item = item->Next();
// Don't remove wires that are already deleted, are currently being // Don't remove wires that are already deleted or are currently being dragged
// dragged or are just created
if( item->GetFlags() & if( item->GetFlags() &
( STRUCT_DELETED | IS_DRAGGED | IS_NEW | IS_MOVED | SKIP_STRUCT ) ) ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
continue; continue;
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE ) if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )