Save and load fill color of SHAPE_T objects properly

This commit is contained in:
Jonathan Haas 2021-12-15 11:16:14 +01:00 committed by Jeff Young
parent 09b7e0b72b
commit 80e7b6eb1f
2 changed files with 12 additions and 5 deletions

View File

@ -959,6 +959,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
case T_fill: case T_fill:
parseFill( fill ); parseFill( fill );
arc->SetFillMode( fill.m_FillType ); arc->SetFillMode( fill.m_FillType );
arc->SetFillColor( fill.m_Color );
break; break;
default: default:
@ -1058,6 +1059,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
case T_fill: case T_fill:
parseFill( fill ); parseFill( fill );
bezier->SetFillMode( fill.m_FillType ); bezier->SetFillMode( fill.m_FillType );
bezier->SetFillColor( fill.m_Color );
break; break;
default: default:
@ -1114,6 +1116,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
case T_fill: case T_fill:
parseFill( fill ); parseFill( fill );
circle->SetFillMode( fill.m_FillType ); circle->SetFillMode( fill.m_FillType );
circle->SetFillColor( fill.m_Color );
break; break;
default: default:
@ -1386,6 +1389,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parsePolyLine()
case T_fill: case T_fill:
parseFill( fill ); parseFill( fill );
poly->SetFillMode( fill.m_FillType ); poly->SetFillMode( fill.m_FillType );
poly->SetFillColor( fill.m_Color );
break; break;
default: default:
@ -1437,6 +1441,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseRectangle()
case T_fill: case T_fill:
parseFill( fill ); parseFill( fill );
rectangle->SetFillMode( fill.m_FillType ); rectangle->SetFillMode( fill.m_FillType );
rectangle->SetFillColor( fill.m_Color );
break; break;
default: default:

View File

@ -1976,6 +1976,8 @@ void SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTE
stroke.SetWidth( shape->GetWidth() ); stroke.SetWidth( shape->GetWidth() );
COLOR4D fillColor = shape->GetFillColor();
switch( shape->GetShape() ) switch( shape->GetShape() )
{ {
case SHAPE_T::ARC: case SHAPE_T::ARC:
@ -1984,23 +1986,23 @@ void SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTE
shape->CalcArcAngles( x1, x2 ); shape->CalcArcAngles( x1, x2 );
formatArc( &aFormatter, aNestLevel, shape, x1, x2, stroke, fillMode, COLOR4D() ); formatArc( &aFormatter, aNestLevel, shape, x1, x2, stroke, fillMode, fillColor );
break; break;
case SHAPE_T::CIRCLE: case SHAPE_T::CIRCLE:
formatCircle( &aFormatter, aNestLevel, shape, stroke, fillMode, COLOR4D() ); formatCircle( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
break; break;
case SHAPE_T::RECT: case SHAPE_T::RECT:
formatRect( &aFormatter, aNestLevel, shape, stroke, fillMode, COLOR4D() ); formatRect( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
break; break;
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
formatBezier(&aFormatter, aNestLevel, shape, stroke, fillMode, COLOR4D() ); formatBezier(&aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
break; break;
case SHAPE_T::POLY: case SHAPE_T::POLY:
formatPoly( &aFormatter, aNestLevel, shape, stroke, fillMode, COLOR4D() ); formatPoly( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
break; break;
default: default: