Pcbnew: PCB_TEXT: save the Locked flag in file.

Previously, one could lock a graphic text on a board, but the lock state was not saved.
This commit is contained in:
jean-pierre charras 2022-03-08 17:35:26 +01:00
parent bafd8ac9d5
commit b6aa5bd1ed
3 changed files with 21 additions and 7 deletions

View File

@ -2698,7 +2698,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
}
default:
Expecting( "gr_arc, gr_circle, gr_curve, gr_line, gr_poly, or gp_rect" );
Expecting( "gr_arc, gr_circle, gr_curve, gr_line, gr_poly, or gr_rect" );
}
bool foundFill = false;
@ -2834,11 +2834,19 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
wxCHECK_MSG( CurTok() == T_gr_text, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXT." ) );
T token;
std::unique_ptr<PCB_TEXT> text = std::make_unique<PCB_TEXT>( m_board );
NeedSYMBOLorNUMBER();
T token = NextTok();
if( token == T_locked )
{
text->SetLocked( true );
token = NextTok();
}
if( !IsSymbol( token ) && (int) token != DSN_NUMBER )
Expecting( "text value" );
text->SetText( FromUTF8() );
NeedLEFT();
@ -2906,7 +2914,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
break;
default:
Expecting( "layer, effects, render_cache or tstamp" );
Expecting( "layer, effects, locked, render_cache or tstamp" );
}
}

View File

@ -1722,10 +1722,16 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
void PCB_PLUGIN::format( const PCB_TEXT* aText, int aNestLevel ) const
{
m_out->Print( aNestLevel, "(gr_text %s (at %s",
m_out->Print( aNestLevel, "(gr_text" );
if( aText->IsLocked() )
m_out->Print( 0, " locked" );
m_out->Print( 0, " %s (at %s",
m_out->Quotew( aText->GetText() ).c_str(),
FormatInternalUnits( aText->GetTextPos() ).c_str() );
if( !aText->GetTextAngle().IsZero() )
m_out->Print( 0, " %s", FormatAngle( aText->GetTextAngle() ).c_str() );

View File

@ -118,7 +118,7 @@ class SHAPE_LINE_CHAIN;
//#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
//#define SEXPR_BOARD_FILE_VERSION 20220211 // End support for V5 zone fill strategy
//#define SEXPR_BOARD_FILE_VERSION 20220225 // Remove TEDIT
#define SEXPR_BOARD_FILE_VERSION 20220308 // Knockout text
#define SEXPR_BOARD_FILE_VERSION 20220308 // Knockout text and Locked graphic text property saved
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting