mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Don't use net/netclass colors for label graphic shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19589
This commit is contained in:
parent
1b7f92f4c5
commit
59e77e977e
@ -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;
|
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
|
||||||
COLOR4D color = settings->GetLayerColor( layer );
|
COLOR4D color = settings->GetLayerColor( layer );
|
||||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||||
COLOR4D labelColor = GetLabelColor();
|
|
||||||
|
|
||||||
if( aPlotter->GetColorMode() && labelColor != COLOR4D::UNSPECIFIED )
|
if( aPlotter->GetColorMode() && GetLabelColor() != COLOR4D::UNSPECIFIED )
|
||||||
color = labelColor;
|
color = GetLabelColor();
|
||||||
|
|
||||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||||
aPlotter->SetCurrentLineWidth( penWidth );
|
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,
|
aPlotter->PlotText( textpos, color, GetShownText( sheet, true ), attrs, font,
|
||||||
GetFontMetrics() );
|
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 )
|
if( GetShape() == LABEL_FLAG_SHAPE::F_DOT )
|
||||||
{
|
{
|
||||||
aPlotter->MoveTo( s_poly[0] );
|
aPlotter->MoveTo( s_poly[0] );
|
||||||
|
@ -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 );
|
draw( static_cast<const SCH_TABLE*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case SCH_LABEL_T:
|
case SCH_LABEL_T:
|
||||||
draw( static_cast<const SCH_LABEL*>( aItem ), aLayer );
|
draw( static_cast<const SCH_LABEL*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case SCH_DIRECTIVE_LABEL_T:
|
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;
|
break;
|
||||||
case SCH_FIELD_T:
|
case SCH_FIELD_T:
|
||||||
draw( static_cast<const SCH_FIELD*>( aItem ), aLayer, aDimmed );
|
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 );
|
draw( static_cast<const SCH_HIERLABEL*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case SCH_GLOBAL_LABEL_T:
|
case SCH_GLOBAL_LABEL_T:
|
||||||
draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer );
|
draw( static_cast<const SCH_GLOBALLABEL*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case SCH_SHEET_T:
|
case SCH_SHEET_T:
|
||||||
draw( static_cast<const SCH_SHEET*>( aItem ), aLayer );
|
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,
|
COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
||||||
bool aDimmed ) const
|
bool aDimmed, bool aIgnoreNets ) const
|
||||||
{
|
{
|
||||||
auto isBackgroundLayer =
|
auto isBackgroundLayer =
|
||||||
[]( int layer )
|
[]( 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 } ) )
|
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 )
|
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;
|
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() ) )
|
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
|
COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows, aDimmed, true );
|
||||||
|
|
||||||
if( drawingDangling )
|
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;
|
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() ) )
|
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows );
|
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed, true );
|
||||||
|
|
||||||
if( drawingDangling )
|
if( drawingDangling )
|
||||||
{
|
{
|
||||||
@ -2617,7 +2624,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed )
|
|||||||
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed );
|
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows, aDimmed, true );
|
||||||
|
|
||||||
if( drawingDangling )
|
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() )
|
if( !eeconfig()->m_Appearance.show_directive_labels && !aLabel->IsSelected() )
|
||||||
return;
|
return;
|
||||||
@ -2672,7 +2679,7 @@ void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer )
|
|||||||
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COLOR4D color = getRenderColor( aLabel, LAYER_NETCLASS_REFS, drawingShadows );
|
COLOR4D color = getRenderColor( aLabel, LAYER_NETCLASS_REFS, drawingShadows, aDimmed, true );
|
||||||
|
|
||||||
if( aLayer == LAYER_DANGLING )
|
if( aLayer == LAYER_DANGLING )
|
||||||
{
|
{
|
||||||
|
@ -90,10 +90,10 @@ private:
|
|||||||
void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
|
void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
|
||||||
void draw( const SCH_TEXT* aText, 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_TABLE* aTable, int aLayer, bool aDimmed );
|
||||||
void draw( const SCH_LABEL* aLabel, int aLayer );
|
void draw( const SCH_LABEL* aLabel, int aLayer, bool aDimmed );
|
||||||
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
|
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_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_SHEET* aSheet, int aLayer );
|
||||||
void draw( const SCH_NO_CONNECT* aNC, int aLayer );
|
void draw( const SCH_NO_CONNECT* aNC, int aLayer );
|
||||||
void draw( const SCH_MARKER* aMarker, int aLayer );
|
void draw( const SCH_MARKER* aMarker, int aLayer );
|
||||||
@ -126,7 +126,7 @@ private:
|
|||||||
|
|
||||||
float getShadowWidth( bool aForHighlight ) const;
|
float getShadowWidth( bool aForHighlight ) const;
|
||||||
COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
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;
|
KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
|
||||||
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
|
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
|
||||||
bool aDrawingWireColorHighlights = false ) const;
|
bool aDrawingWireColorHighlights = false ) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user