diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index 8ef2e55d81..fdd83a5138 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -1283,10 +1283,9 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer; COLOR4D color = settings->GetLayerColor( layer ); int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() ); - COLOR4D labelColor = GetLabelColor(); - if( aPlotter->GetColorMode() && labelColor != COLOR4D::UNSPECIFIED ) - color = labelColor; + if( aPlotter->GetColorMode() && GetLabelColor() != COLOR4D::UNSPECIFIED ) + color = GetLabelColor(); penWidth = std::max( penWidth, settings->GetMinPenWidth() ); aPlotter->SetCurrentLineWidth( penWidth ); @@ -1312,6 +1311,16 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O aPlotter->PlotText( textpos, color, GetShownText( sheet, true ), attrs, font, GetFontMetrics() ); + if( aPlotter->GetColorMode() ) + { + // For the graphic shape use the override color or the layer color, but not the + // net/netclass color. + if( GetTextColor() != COLOR4D::UNSPECIFIED ) + aPlotter->SetColor( GetTextColor() ); + else + aPlotter->SetColor( settings->GetLayerColor( m_layer ) ); + } + if( GetShape() == LABEL_FLAG_SHAPE::F_DOT ) { aPlotter->MoveTo( s_poly[0] ); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 9fdb4a2e6a..983c8501ec 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -176,10 +176,10 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed ) draw( static_cast<const SCH_TABLE*>( aItem ), aLayer, aDimmed ); break; case SCH_LABEL_T: - draw( static_cast<const SCH_LABEL*>( aItem ), aLayer ); + draw( static_cast<const SCH_LABEL*>( aItem ), aLayer, aDimmed ); break; case SCH_DIRECTIVE_LABEL_T: - draw( static_cast<const SCH_DIRECTIVE_LABEL*>( aItem ), aLayer ); + draw( static_cast<const SCH_DIRECTIVE_LABEL*>( aItem ), aLayer, aDimmed ); break; case SCH_FIELD_T: draw( static_cast<const SCH_FIELD*>( aItem ), aLayer, aDimmed ); @@ -188,7 +188,7 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed ) draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer, aDimmed ); break; case SCH_GLOBAL_LABEL_T: - draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer ); + draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer, aDimmed ); break; case SCH_SHEET_T: draw( static_cast<const SCH_SHEET*>( aItem ), aLayer ); @@ -294,7 +294,7 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows, - bool aDimmed ) const + bool aDimmed, bool aIgnoreNets ) const { auto isBackgroundLayer = []( int layer ) @@ -381,7 +381,14 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr } else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) ) { - color = static_cast<const SCH_LABEL_BASE*>( aItem )->GetLabelColor(); + const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( aItem ); + + if( label->GetTextColor() != COLOR4D::UNSPECIFIED ) + color = label->GetTextColor(); // override color + else if( aIgnoreNets ) + color = m_schSettings.GetLayerColor( aLayer ); // layer color + else + color = label->GetLabelColor(); // net/netclass color } else if( aItem->Type() == SCH_FIELD_T ) { @@ -2494,7 +2501,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 aDimmed ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -2515,7 +2522,7 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL* aLabel, int aLayer ) if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) ) return; - COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows ); + COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows, aDimmed, true ); if( drawingDangling ) { @@ -2557,7 +2564,7 @@ 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 aDimmed ) { bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; @@ -2578,7 +2585,7 @@ void SCH_PAINTER::draw( const SCH_LABEL* aLabel, int aLayer ) if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) ) return; - COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows ); + COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed, true ); if( drawingDangling ) { @@ -2617,7 +2624,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed ) if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) ) return; - COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed ); + COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed, true ); if( drawingDangling ) { @@ -2650,7 +2657,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed ) } -void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer ) +void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer, bool aDimmed ) { if( !eeconfig()->m_Appearance.show_directive_labels && !aLabel->IsSelected() ) return; @@ -2672,7 +2679,7 @@ void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer ) if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) ) return; - COLOR4D color = getRenderColor( aLabel, LAYER_NETCLASS_REFS, drawingShadows ); + COLOR4D color = getRenderColor( aLabel, LAYER_NETCLASS_REFS, drawingShadows, aDimmed, true ); if( aLayer == LAYER_DANGLING ) { diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index adc1507819..2b8f3ace10 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -90,10 +90,10 @@ private: void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed ); void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed ); void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed ); - void draw( const SCH_LABEL* aLabel, int aLayer ); - void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer ); + void draw( const SCH_LABEL* aLabel, int aLayer, bool aDimmed ); + void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer, bool aDimmed ); void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed ); - void draw( const SCH_GLOBALLABEL* aLabel, int aLayer ); + void draw( const SCH_GLOBALLABEL* aLabel, int aLayer, bool aDimmed ); void draw( const SCH_SHEET* aSheet, int aLayer ); void draw( const SCH_NO_CONNECT* aNC, int aLayer ); void draw( const SCH_MARKER* aMarker, int aLayer ); @@ -126,7 +126,7 @@ private: float getShadowWidth( bool aForHighlight ) const; COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows, - bool aDimmed = false ) const; + bool aDimmed = false, bool aIgnoreNets = false ) const; KIFONT::FONT* getFont( const EDA_TEXT* aText ) const; float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows, bool aDrawingWireColorHighlights = false ) const;