Set sheet pins to bus color if they are a bus in the child sheet

As a visual aid, we can peek into the child to see if a pin
represents a bus in the child (in the case of aliases etc
we might not be able to tell by the name of the pin).

Only do this if there isn't anything else driving a connection
onto the sheet pin in the parent sheet.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2619
This commit is contained in:
Jon Evans 2020-05-23 23:57:10 -04:00
parent e934f8b459
commit 48ab1d1a93
1 changed files with 39 additions and 0 deletions

View File

@ -1429,7 +1429,46 @@ void CONNECTION_GRAPH::buildConnectionGraph()
}
if( subgraph->m_driver_connection->IsBus() )
{
// No other processing to do on buses
continue;
}
else
{
// As a visual aid, we can check sheet pins that are driven by themselves to see
// if they should be promoted to buses
if( subgraph->m_driver->Type() == SCH_SHEET_PIN_T )
{
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( subgraph->m_driver );
if( SCH_SHEET* sheet = pin->GetParent() )
{
wxString pinText = pin->GetText();
for( auto item : sheet->GetScreen()->Items().OfType( SCH_HIER_LABEL_T ) )
{
auto label = static_cast<SCH_HIERLABEL*>( item );
if( label->GetText() == pinText )
{
SCH_SHEET_PATH path = subgraph->m_sheet;
path.push_back( sheet );
SCH_CONNECTION* parent_conn = label->Connection( path );
if( parent_conn && parent_conn->IsBus() )
subgraph->m_driver_connection->SetType( CONNECTION_TYPE::BUS );
break;
}
}
if( subgraph->m_driver_connection->IsBus() )
continue;
}
}
}
auto key = std::make_pair( subgraph->GetNetName(),
subgraph->m_driver_connection->NetCode() );