From ed0f17ef68b89ea49b4d5026bb1e2bc9b18b2c08 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Tue, 16 Jun 2015 09:05:27 -0400 Subject: [PATCH] Eeschema: bus entry connection indication improvements. * If a bus entry is drawn between two WIRES (not a wire and a bus, or two buses), it looks like it's connecting the wires together, but doesn't actually represent a connection. Display them as dangling in that case, to make it clear to the user that a connection has not actually been made. --- eeschema/sch_bus_entry.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index c655750aaa..1819cae51d 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -258,6 +258,12 @@ bool SCH_BUS_ENTRY_BASE::IsDanglingStateChanged( std::vector& // when the end position is found. wxPoint seg_start; + // Special case: if both items are wires, show as dangling. This is because + // a bus entry between two wires will look like a connection, but does NOT + // actually represent one. We need to clarify this for the user. + bool start_is_wire = false; + bool end_is_wire = false; + BOOST_FOREACH( DANGLING_END_ITEM& each_item, aItemList ) { if( each_item.GetItem() == this ) @@ -269,17 +275,29 @@ bool SCH_BUS_ENTRY_BASE::IsDanglingStateChanged( std::vector& case BUS_START_END: seg_start = each_item.GetPosition(); break; + case WIRE_END_END: + if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) ) + start_is_wire = true; + if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) ) + end_is_wire = true; + // Fall through + case BUS_END_END: if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) ) m_isDanglingStart = false; if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) ) m_isDanglingEnd = false; + break; default: break; } } + // See above: show as dangling if joining two wires + if( start_is_wire && end_is_wire ) + m_isDanglingStart = m_isDanglingEnd = true; + return (previousStateStart != m_isDanglingStart) || (previousStateEnd != m_isDanglingEnd); }