diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index e6ee9c03de..14f6226a5c 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2427,9 +2427,6 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& if( aBackground ) return; - SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); - COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); - if( m_part ) { std::vector libPins; @@ -2465,7 +2462,8 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } } - TRANSFORM savedTransform = renderSettings->m_Transform; + SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); + TRANSFORM savedTransform = renderSettings->m_Transform; renderSettings->m_Transform = GetTransform(); aPlotter->StartBlock( nullptr ); @@ -2483,18 +2481,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } if( m_DNP ) - { - BOX2I bbox = GetBodyAndPinsBoundingBox(); - int strokeWidth = 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ); - - aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) ); - - aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr ); - - aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), - bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), - strokeWidth, FILLED, nullptr ); - } + PlotDNP( aPlotter ); SCH_SHEET_PATH* sheet = &Schematic()->CurrentSheet(); @@ -2533,6 +2520,22 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } +void SCH_SYMBOL::PlotDNP( PLOTTER* aPlotter ) const +{ + COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); + BOX2I bbox = GetBodyAndPinsBoundingBox(); + int strokeWidth = 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ); + + aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) ); + + aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr ); + + aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), + bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), + strokeWidth, 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 af397e1e5b..1704cbf49f 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -813,6 +813,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)