diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index e4f7524f9d..c9af16b123 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @@ -88,6 +88,8 @@ std::vector SCH_PAINTER::g_ScaledSelectionTypes = { SCH_BITMAP_T, SCH_GLOBAL_LABEL_T, SCH_DIRECTIVE_LABEL_T, + SCH_HIER_LABEL_T, + SCH_SHEET_PIN_T, LIB_SYMBOL_T, SCH_SYMBOL_T, SCH_SHEET_T, LIB_PIN_T, SCH_PIN_T @@ -187,7 +189,7 @@ SCH_PAINTER::SCH_PAINTER( GAL* aGal ) : m_schematic( nullptr ) { } -bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer ) +bool SCH_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) { const EDA_ITEM* item = dynamic_cast( aItem ); @@ -199,7 +201,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer ) return false; } -void SCH_PAINTER::draw( const EDA_ITEM *aItem, int aLayer, bool aDimmed ) +void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed ) { #ifdef CONNECTIVITY_DEBUG @@ -370,7 +372,7 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const } -COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows, +COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows, bool aDimmed ) const { COLOR4D color = m_schSettings.GetLayerColor( aLayer ); @@ -667,7 +669,7 @@ void SCH_PAINTER::triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D } -void SCH_PAINTER::draw( const LIB_SYMBOL *aSymbol, int aLayer, bool aDrawFields, int aUnit, +void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields, int aUnit, int aConvert, bool aDimmed ) { if( !aUnit ) @@ -929,7 +931,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer, bool aDimmed ) } -void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer, bool aDimmed ) +void SCH_PAINTER::draw( const LIB_FIELD* aField, int aLayer, bool aDimmed ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -1705,7 +1707,7 @@ void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColo } -void SCH_PAINTER::draw( const SCH_JUNCTION *aJct, int aLayer ) +void SCH_PAINTER::draw( const SCH_JUNCTION* aJct, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -1937,7 +1939,6 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer ) void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; - bool drawingDangling = aLayer == LAYER_DANGLING; if( drawingShadows && !( aText->IsBrightened() || aText->IsSelected() ) ) return; @@ -1973,18 +1974,6 @@ void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer ) return; } - if( drawingDangling ) - { - if( aText->IsDangling() ) - { - drawDanglingSymbol( aText->GetTextPos(), color, - schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ), true, - drawingShadows, aText->IsBrightened() ); - } - - return; - } - m_gal->SetStrokeColor( color ); m_gal->SetFillColor( color ); @@ -2508,7 +2497,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed ) } -void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer ) +void SCH_PAINTER::draw( const SCH_GLOBALLABEL* aLabel, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingDangling = aLayer == LAYER_DANGLING; @@ -2527,6 +2516,18 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer ) COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows ); + if( drawingDangling ) + { + if( aLabel->IsDangling() ) + { + drawDanglingSymbol( aLabel->GetTextPos(), color, + schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ), true, + drawingShadows, aLabel->IsBrightened() ); + } + + return; + } + std::vector pts; std::deque pts2; @@ -2545,7 +2546,7 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer ) m_gal->SetFillColor( color ); m_gal->DrawPolygon( pts2 ); } - else if( !drawingDangling ) + else { m_gal->SetIsFill( false ); m_gal->DrawPolyline( pts2 ); @@ -2555,9 +2556,10 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer ) } -void SCH_PAINTER::draw( const SCH_LABEL *aLabel, int aLayer ) +void SCH_PAINTER::draw( const SCH_LABEL* aLabel, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; + bool drawingDangling = aLayer == LAYER_DANGLING; if( !drawingShadows || eeconfig()->m_Selection.draw_selected_children ) { @@ -2571,11 +2573,25 @@ void SCH_PAINTER::draw( const SCH_LABEL *aLabel, int aLayer ) if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) ) return; + COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows ); + + if( drawingDangling ) + { + if( aLabel->IsDangling() ) + { + drawDanglingSymbol( aLabel->GetTextPos(), color, + schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE / 2 ), true, + drawingShadows, aLabel->IsBrightened() ); + } + + return; + } + draw( static_cast( aLabel ), aLayer ); } -void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer ) +void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingDangling = aLayer == LAYER_DANGLING; @@ -2628,7 +2644,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer ) m_gal->SetIsFill( true ); m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); m_gal->SetIsStroke( true ); - m_gal->SetLineWidth( getTextThickness( aLabel ) ); + m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) ); m_gal->SetStrokeColor( color ); m_gal->DrawPolyline( pts2 ); @@ -2636,7 +2652,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer ) } -void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL *aLabel, int aLayer ) +void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -2738,7 +2754,7 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer ) } -void SCH_PAINTER::draw( const SCH_NO_CONNECT *aNC, int aLayer ) +void SCH_PAINTER::draw( const SCH_NO_CONNECT* aNC, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -2817,7 +2833,7 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer ) } -void SCH_PAINTER::draw( const SCH_BITMAP *aBitmap, int aLayer ) +void SCH_PAINTER::draw( const SCH_BITMAP* aBitmap, int aLayer ) { m_gal->Save(); m_gal->Translate( aBitmap->GetPosition() ); @@ -2862,7 +2878,7 @@ void SCH_PAINTER::draw( const SCH_BITMAP *aBitmap, int aLayer ) } -void SCH_PAINTER::draw( const SCH_MARKER *aMarker, int aLayer ) +void SCH_PAINTER::draw( const SCH_MARKER* aMarker, int aLayer ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;