Eeschema: fix incorrect plot of SCH_TABLE items.

This commit is contained in:
jean-pierre charras 2025-02-27 13:59:24 +01:00
parent 9211136953
commit ba85c54f81
4 changed files with 19 additions and 6 deletions

View File

@ -143,6 +143,9 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
if( IsPrivate() ) if( IsPrivate() )
return; return;
// note: if aBodyStyle == -1 the outline shape is not plotted. Only the filled area
// is plotted (used to plot cells for SCH_TABLE items
SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
int pen_size = GetEffectivePenWidth( renderSettings ); int pen_size = GetEffectivePenWidth( renderSettings );
@ -221,7 +224,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
else else
fill = FILL_T::NO_FILL; fill = FILL_T::NO_FILL;
pen_size = GetEffectivePenWidth( renderSettings ); pen_size = aBodyStyle == -1 ? 0 : GetEffectivePenWidth( renderSettings );
} }
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() ) if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )

View File

@ -384,10 +384,14 @@ void SCH_TABLE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
for( int row = 0; row < GetRowCount(); ++row ) for( int row = 0; row < GetRowCount(); ++row )
{ {
SCH_TABLECELL* cell = GetCell( row, col ); SCH_TABLECELL* cell = GetCell( row, col );
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
if( !cell->GetTextAngle().IsHorizontal() )
topRight = VECTOR2I( cell->GetStartX(), cell->GetEndY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ {
aPlotter->MoveTo( VECTOR2I( cell->GetEndX(), cell->GetStartY() ) ); aPlotter->MoveTo( topRight );
aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) ); aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
} }
} }
@ -400,11 +404,15 @@ void SCH_TABLE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
{ {
for( int col = 0; col < GetColCount(); ++col ) for( int col = 0; col < GetColCount(); ++col )
{ {
SCH_TABLECELL* cell = GetCell( row, 0 ); SCH_TABLECELL* cell = GetCell( row, col );
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
if( !cell->GetTextAngle().IsHorizontal() )
botLeft = VECTOR2I( cell->GetEndX(), cell->GetStartY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ {
aPlotter->MoveTo( VECTOR2I( cell->GetStartX(), cell->GetEndY() ) ); aPlotter->MoveTo( botLeft );
aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) ); aPlotter->FinishTo( VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
} }
} }

View File

@ -98,8 +98,9 @@ wxString SCH_TABLECELL::GetAddr() const
void SCH_TABLECELL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts, void SCH_TABLECELL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{ {
const int cell_body_style = -1; // flage to disable box ouline plotting
if( m_colSpan >= 1 && m_rowSpan >= 1 ) if( m_colSpan >= 1 && m_rowSpan >= 1 )
SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed ); SCH_TEXTBOX::Plot( aPlotter, aBackground, aPlotOpts, aUnit, cell_body_style, aOffset, aDimmed );
} }

View File

@ -388,7 +388,8 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS
COLOR4D bg = renderSettings->GetBackgroundColor(); COLOR4D bg = renderSettings->GetBackgroundColor();
LINE_STYLE lineStyle = GetStroke().GetLineStyle(); LINE_STYLE lineStyle = GetStroke().GetLineStyle();
if( penWidth > 0 ) // Do not plot border for SCH_TABLECELL_T: borders are plotted separately.
if( penWidth > 0 && Type() != SCH_TABLECELL_T )
{ {
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED ) if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = renderSettings->GetLayerColor( m_layer ); color = renderSettings->GetLayerColor( m_layer );