Use getLineWidth() when drawing bus entries.

(Otherwise inheriting from the netclass or schematic doesn't work.)

Also fixes precedence order in GetPenWidth() for the two BUS_ENTRY
classes.

Fixes https://gitlab.com/kicad/code/kicad/issues/8601
This commit is contained in:
Jeff Young 2021-06-13 20:44:13 +01:00
parent a386d44134
commit 3763aca52c
2 changed files with 11 additions and 4 deletions

View File

@ -150,29 +150,35 @@ PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetStrokeStyle() const
int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
{
if( m_stroke.GetWidth() > 0 )
return m_stroke.GetWidth();
NETCLASSPTR netclass = NetClass();
if( netclass )
return netclass->GetWireWidth();
if( m_stroke.GetWidth() == 0 && Schematic() )
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
return DEFAULT_WIRE_THICKNESS;
}
int SCH_BUS_BUS_ENTRY::GetPenWidth() const
{
if( m_stroke.GetWidth() > 0 )
return m_stroke.GetWidth();
NETCLASSPTR netclass = NetClass();
if( netclass )
return netclass->GetBusWidth();
if( m_stroke.GetWidth() == 0 && Schematic() )
if( Schematic() )
return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
return DEFAULT_BUS_THICKNESS;
}

View File

@ -1773,6 +1773,7 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
line.SetStartPoint( aEntry->GetPosition() );
line.SetEndPoint( aEntry->GetEnd() );
line.SetStroke( aEntry->GetStroke() );
line.SetLineWidth( getLineWidth( aEntry, drawingShadows ) );
COLOR4D color = getRenderColor( aEntry, LAYER_WIRE, drawingShadows );