From c9ce8da10ac01be5bae705cf9bfe32b86ced7611 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 21 Oct 2022 22:28:31 +0100 Subject: [PATCH] Dim DNP textbox borders. Fixes https://gitlab.com/kicad/code/kicad/issues/12709 --- eeschema/lib_symbol.cpp | 6 +++--- eeschema/lib_textbox.cpp | 17 ++++++++++------- eeschema/sch_symbol.cpp | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 07a1a84786..e8edb82165 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -705,7 +705,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, - const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed ) const + const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed ) const { wxASSERT( aPlotter != nullptr ); @@ -726,8 +726,8 @@ void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackgro if( item.IsPrivate() ) continue; - // Lib Fields are not plotted here, because this plot function - // is used to plot schematic items, which have they own fields + // LIB_FIELDs are not plotted here, because this plot function is used to plot schematic + // items which have their own SCH_FIELDs if( item.Type() == LIB_FIELD_T ) continue; diff --git a/eeschema/lib_textbox.cpp b/eeschema/lib_textbox.cpp index b943d29497..ad8484343f 100644 --- a/eeschema/lib_textbox.cpp +++ b/eeschema/lib_textbox.cpp @@ -382,8 +382,13 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf return; } - VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset; - VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset; + VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset; + VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset; + COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor(); + + if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() ) + bg = COLOR4D::WHITE; + int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() ); COLOR4D color = GetStroke().GetColor(); PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle(); @@ -396,6 +401,9 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf if( lineStyle == PLOT_DASH_TYPE::DEFAULT ) lineStyle = PLOT_DASH_TYPE::DASH; + if( aDimmed ) + color = color.Mix( bg, 0.5f ); + aPlotter->SetColor( color ); aPlotter->SetDash( penWidth, lineStyle ); aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth ); @@ -409,11 +417,6 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED ) color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ); - COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor(); - - if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() ) - bg = COLOR4D::WHITE; - if( aDimmed ) color = color.Mix( bg, 0.5f ); diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index d78a3b3339..f58caa884f 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2155,7 +2155,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const for( bool local_background : { true, false } ) { tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp, - GetDNP() ); + GetDNP() ); for( SCH_FIELD field : m_fields ) field.Plot( aPlotter, local_background );