diff --git a/eeschema/lib_item.h b/eeschema/lib_item.h index 05c95b6e83..b1409683f8 100644 --- a/eeschema/lib_item.h +++ b/eeschema/lib_item.h @@ -149,8 +149,10 @@ public: // For historical reasons, a stored value of 0 means "default width" and negative // numbers meant "don't stroke". - if( GetPenWidth() <= 0 ) - return aSettings->GetDefaultPenWidth(); + if( GetPenWidth() < 0 ) + return 0; + else if( GetPenWidth() == 0 ) + return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() ); else return std::max( GetPenWidth(), aSettings->GetMinPenWidth() ); } diff --git a/eeschema/lib_shape.h b/eeschema/lib_shape.h index 5471de89b8..3194fc1e50 100644 --- a/eeschema/lib_shape.h +++ b/eeschema/lib_shape.h @@ -57,19 +57,6 @@ public: int GetPenWidth() const override; - int GetEffectivePenWidth( const RENDER_SETTINGS* aSettings ) const override - { - // For historical reasons, a stored value of 0 means "default width" and negative - // numbers meant "don't stroke". - - if( GetPenWidth() < 0 ) - return 0; - else if( GetPenWidth() == 0 ) - return aSettings->GetDefaultPenWidth(); - else - return std::max( GetPenWidth(), aSettings->GetMinPenWidth() ); - } - const EDA_RECT GetBoundingBox() const override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 430394f7d1..4d6964c784 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -378,36 +378,21 @@ float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) c { wxCHECK( aItem, static_cast( Mils2iu( DEFAULT_LINE_WIDTH_MILS ) ) ); - int pen; + int pen = 0; - if( aItem->Type() == LIB_TEXTBOX_T ) - { - pen = static_cast( aItem )->GetStroke().GetWidth(); - } - else if( aItem->Type() == SCH_TEXTBOX_T ) - { - pen = static_cast( aItem )->GetStroke().GetWidth(); - } - else if( dynamic_cast( aItem ) ) - { + if( dynamic_cast( aItem ) ) pen = static_cast( aItem )->GetEffectivePenWidth( &m_schSettings ); - } else if( dynamic_cast( aItem ) ) - { pen = static_cast( aItem )->GetPenWidth(); - } else - { - pen = 0; UNIMPLEMENTED_FOR( aItem->GetClass() ); - } float width = pen; if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows ) width += getShadowWidth( aItem->IsBrightened() ); - return std::max( width, 1.0f ); + return width; }