diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 32145ca7f3..c43b96a00f 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -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 ) ); + } } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index ba0427d3d0..44ef16fb88 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -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 ) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 203b1e576f..db640daa71 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -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 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 ) diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 06c580aaf8..62db3d98c1 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -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)