Prioritize power symbols over hidden power pins on regular symbols

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8400
This commit is contained in:
Jon Evans 2022-10-27 22:54:36 -04:00
parent 141c1f020e
commit 3a9ed47bf0
1 changed files with 16 additions and 0 deletions

View File

@ -145,6 +145,22 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCheckMultipleDrivers )
if( ac->IsBus() && bc->IsBus() ) if( ac->IsBus() && bc->IsBus() )
return bc->IsSubsetOf( ac ); return bc->IsSubsetOf( ac );
// Ensure we don't pick a hidden power pin on a regular symbol over
// one on a power symbol
if( a->Type() == SCH_PIN_T && b->Type() == SCH_PIN_T )
{
SCH_PIN* pa = static_cast<SCH_PIN*>( a );
SCH_PIN* pb = static_cast<SCH_PIN*>( b );
bool aPower = pa->GetLibPin()->GetParent()->IsPower();
bool bPower = pb->GetLibPin()->GetParent()->IsPower();
if( aPower && !bPower )
return true;
else if( bPower && !aPower )
return false;
}
wxString a_name = GetNameForDriver( a ); wxString a_name = GetNameForDriver( a );
wxString b_name = GetNameForDriver( b ); wxString b_name = GetNameForDriver( b );
bool a_lowQualityName = a_name.Contains( "-Pad" ); bool a_lowQualityName = a_name.Contains( "-Pad" );