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.
This commit is contained in:
Chris Pavlina 2015-06-16 09:05:27 -04:00 committed by Wayne Stambaugh
parent 5c6ecb0491
commit ed0f17ef68
1 changed files with 18 additions and 0 deletions

View File

@ -258,6 +258,12 @@ bool SCH_BUS_ENTRY_BASE::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>&
// 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<DANGLING_END_ITEM>&
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);
}