Browse Source

Fix several issue with bus entry connectivity.

When dragging a bus the entry is connected to the bus so the wire
connected to the entry (if any) needs to stretch.

While an entry can connect in the middle of bus, it cannot connect
in the middle of a wire.

Fixes: lp:1849973
* https://bugs.launchpad.net/kicad/+bug/1849973
merge-requests/1/head
Jeff Young 6 years ago
parent
commit
fb52124426
  1. 22
      eeschema/sch_bus_entry.cpp
  2. 21
      eeschema/tools/sch_move_tool.cpp

22
eeschema/sch_bus_entry.cpp

@ -211,24 +211,22 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aI
switch( each_item.GetType() )
{
case WIRE_START_END:
case BUS_START_END:
seg_start = each_item.GetPosition();
break;
case WIRE_END_END:
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
if( m_pos == each_item.GetPosition() )
has_wire[0] = true;
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) )
else if( m_End() == each_item.GetPosition() )
has_wire[1] = true;
break;
case BUS_START_END:
seg_start = each_item.GetPosition();
break;
case BUS_END_END:
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) )
has_bus[0] = true;
if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) )
else if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) )
has_bus[1] = true;
break;
@ -238,10 +236,8 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aI
}
}
/**
* A bus-wire entry is connected at both ends if it has a bus and a wire on its
* ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
*/
// A bus-wire entry is connected at both ends if it has a bus and a wire on its
// ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus)
if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) )
m_isDanglingEnd = m_isDanglingStart = false;
else if( has_wire[0] || has_bus[0] )

21
eeschema/tools/sch_move_tool.cpp

@ -473,7 +473,9 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
if( test->IsSelected() || !test->IsConnectable() || !test->CanConnect( aOriginalItem ) )
continue;
switch( test->Type() )
KICAD_T testType = test->Type();
switch( testType )
{
case SCH_LINE_T:
{
@ -548,10 +550,27 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
{
test->SetFlags( TEMP_SELECTED );
aList.push_back( test );
// A bus entry needs its wire & label as well
if( testType == SCH_BUS_WIRE_ENTRY_T || testType == SCH_BUS_BUS_ENTRY_T )
{
std::vector<wxPoint> ends;
wxPoint otherEnd;
test->GetConnectionPoints( ends );
if( ends[0] == point )
otherEnd = ends[1];
else
otherEnd = ends[0];
getConnectedDragItems( (SCH_ITEM*) test, otherEnd, m_dragAdditions );
}
break;
}
}
}
break;
default:

Loading…
Cancel
Save