Make DNP more visible

Adds red cross to the DNP display.  Allows showing the DNP even when
plotting black/white

Fixes https://gitlab.com/kicad/code/kicad/issues/13456
This commit is contained in:
Seth Hillbrand 2023-01-09 15:30:58 -08:00
parent 507edc54b3
commit f99e374559
4 changed files with 73 additions and 0 deletions

View File

@ -470,6 +470,12 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM *aItem, int aLayer, bool aDr
if( aDimmed )
{
double hue;
double sat;
double light;
color.ToHSL( hue, sat, light );
color.FromHSL( hue, 0.0, light );
COLOR4D sheetColour = m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
color = color.Mix( sheetColour, 0.5f );
}
@ -737,6 +743,10 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer, bool aDimm
if( aDimmed )
{
double hue, sat, light;
fillColour.ToHSL( hue, sat, light );
fillColour.FromHSL( hue, 0.0, light );
fillColour = fillColour.Mix(
m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ), 0.5f );
}
@ -2254,6 +2264,22 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
symbolPin->SetFlags( tempPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED,
// IS_SHOWN_AS_BITMAP
}
if( aSymbol->GetDNP() )
{
BOX2I bbox = aSymbol->GetBodyAndPinsBoundingBox();
m_gal->SetIsStroke( true );
m_gal->SetIsFill( true );
m_gal->SetStrokeColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
m_gal->SetFillColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
m_gal->DrawSegment( bbox.GetOrigin(), bbox.GetEnd(),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
m_gal->DrawSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
}
}

View File

@ -1155,6 +1155,9 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
field.Plot( aPlotter, false );
sym->PlotPins( aPlotter );
if( sym->GetDNP() )
sym->PlotDNP( aPlotter );
}
for( const SCH_ITEM* item : junctions )

View File

@ -473,6 +473,21 @@ void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
for( SCH_FIELD& field : m_fields )
field.Print( aSettings, aOffset );
if( m_DNP )
{
BOX2I bbox = GetBodyAndPinsBoundingBox();
wxDC* DC = aSettings->GetPrintDC();
GRFilledSegment( DC, bbox.GetOrigin(), bbox.GetEnd(),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
GRFilledSegment( DC, bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
}
}
@ -2102,6 +2117,9 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
field.Plot( aPlotter, local_background );
}
if( m_DNP )
PlotDNP( aPlotter );
// Plot attributes to a hypertext menu
std::vector<wxString> properties;
@ -2122,6 +2140,8 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
aPlotter->HyperlinkMenu( GetBoundingBox(), properties );
aPlotter->EndBlock( nullptr );
if( !m_part->IsPower() )
@ -2130,6 +2150,22 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
}
void SCH_SYMBOL::PlotDNP( PLOTTER* aPlotter ) const
{
BOX2I bbox = GetBodyAndPinsBoundingBox();
aPlotter->SetColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
FILLED, nullptr );
aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
4.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
FILLED, nullptr );
}
void SCH_SYMBOL::PlotPins( PLOTTER* aPlotter ) const
{
if( m_part )

View File

@ -726,6 +726,14 @@ public:
*/
void PlotPins( PLOTTER* aPlotter ) const;
/**
* Plot the red 'X' over the symbol. This is separated to allow it being used from the
* screen plot function, overlapping the pins
*
* @param aPlotter the #PLOTTER object used to draw the X
*/
void PlotDNP( PLOTTER* aPlotter ) const;
EDA_ITEM* Clone() const override;
#if defined(DEBUG)