PCB_PAINTER: draw PAD do not always replace netname by "x".

When a pad net is edited inside the board editor, its netname is no longer
its corresponding pin netname.
Fixes #9795
https://gitlab.com/kicad/code/kicad/issues/9795
This commit is contained in:
jean-pierre charras 2021-11-28 13:18:53 +01:00
parent 65dad31d48
commit f5246acf37
1 changed files with 11 additions and 4 deletions

View File

@ -977,10 +977,17 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
wxString netname = UnescapeString( aPad->GetShortNetname() );
wxString pinType = aPad->GetPinType();
if( pinType == wxT( "no_connect" ) || pinType.EndsWith( wxT( "+no_connect" ) ) )
netname = "x";
else if( pinType == wxT( "free" ) && netname.StartsWith( wxT( "unconnected-(" ) ) )
netname = "*";
// If the pad is actually not connected (unique pad in the net),
// shorten the displayed netname (actual name not useful)
// Can happen if the pad netname is edited inside the board editor, therefore
// having a netname not coming from schematic
if( netname.StartsWith( "unconnected-(" ) )
{
if( pinType == wxT( "no_connect" ) || pinType.EndsWith( wxT( "+no_connect" ) ) )
netname = "x";
else if( pinType == wxT( "free" ) )
netname = "*";
}
// approximate the size of net name text:
double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( netname ), 1 );