Correctly handle locked token for PCB_TEXTBOX and PCB_TABLECELL.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17439
(cherry picked from commit d17151ac1b
)
This commit is contained in:
parent
c07604bb03
commit
8589bd3773
|
@ -3336,6 +3336,7 @@ PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
|
|||
STROKE_PARAMS stroke( -1, LINE_STYLE::SOLID );
|
||||
T token = NextTok();
|
||||
|
||||
// Legacy locked
|
||||
if( token == T_locked )
|
||||
{
|
||||
textbox->SetLocked( true );
|
||||
|
@ -3347,10 +3348,20 @@ PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
|
|||
|
||||
textbox->SetText( FromUTF8() );
|
||||
|
||||
NeedLEFT();
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_start )
|
||||
switch( token )
|
||||
{
|
||||
case T_locked:
|
||||
textbox->SetLocked( parseMaybeAbsentBool( true ) );
|
||||
break;
|
||||
|
||||
case T_start:
|
||||
{
|
||||
int x = parseBoardUnits( "X coordinate" );
|
||||
int y = parseBoardUnits( "Y coordinate" );
|
||||
|
@ -3367,8 +3378,10 @@ PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
|
|||
y = parseBoardUnits( "Y coordinate" );
|
||||
textbox->SetEnd( VECTOR2I( x, y ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
}
|
||||
else if( token == T_pts )
|
||||
|
||||
case T_pts:
|
||||
{
|
||||
textbox->SetShape( SHAPE_T::POLY );
|
||||
textbox->GetPolyShape().RemoveAllContours();
|
||||
|
@ -3376,21 +3389,11 @@ PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
|
|||
|
||||
while( (token = NextTok() ) != T_RIGHT )
|
||||
parseOutlinePoints( textbox->GetPolyShape().Outline( 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Expecting( "start or pts" );
|
||||
|
||||
NeedRIGHT();
|
||||
break;
|
||||
}
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
switch( token )
|
||||
{
|
||||
case T_angle:
|
||||
// Set the angle of the text only, the coordinates of the box (a polygon) are
|
||||
// already at the right position, and must not be rotated
|
||||
|
@ -3434,7 +3437,7 @@ PCB_TEXTBOX* PCB_IO_KICAD_SEXPR_PARSER::parsePCB_TEXTBOX( BOARD_ITEM* aParent )
|
|||
break;
|
||||
|
||||
default:
|
||||
Expecting( "angle, width, layer, effects, render_cache, uuid or tstamp" );
|
||||
Expecting( "locked, start, pts, angle, width, layer, effects, render_cache, uuid or tstamp" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue