From 3763aca52c931696cd0d076941d55b639ae08208 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 13 Jun 2021 20:44:13 +0100 Subject: [PATCH] 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 --- eeschema/sch_bus_entry.cpp | 14 ++++++++++---- eeschema/sch_painter.cpp | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index b9134f468b..a94a9a8bfa 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -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; } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 412fd96e53..7d1cb29b3c 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -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 );