Read/write lock status for fp text.

Fixes https://gitlab.com/kicad/code/kicad/issues/9325
This commit is contained in:
Jeff Young 2021-09-25 20:37:34 +01:00
parent c6bcb85562
commit 6b25099df7
3 changed files with 18 additions and 5 deletions

View File

@ -1799,8 +1799,11 @@ void PCB_IO::format( const FP_TEXT* aText, int aNestLevel ) const
case FP_TEXT::TEXT_is_DIVERS: type = "user";
}
m_out->Print( aNestLevel, "(fp_text %s %s (at %s",
std::string locked = aText->IsLocked() ? " locked" : "";
m_out->Print( aNestLevel, "(fp_text %s%s %s (at %s",
type.c_str(),
locked.c_str(),
m_out->Quotew( aText->GetText() ).c_str(),
FormatInternalUnits( aText->GetPos0() ).c_str() );

View File

@ -100,7 +100,8 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20210606 // Change overbar syntax from `~...~` to `~{...}`.
//#define SEXPR_BOARD_FILE_VERSION 20210623 // Add support for reading/writing arcs in polygons
//#define SEXPR_BOARD_FILE_VERSION 20210722 // Reading/writing group locked flags
#define SEXPR_BOARD_FILE_VERSION 20210824 // Opacity in 3D colors
//#define SEXPR_BOARD_FILE_VERSION 20210824 // Opacity in 3D colors
#define SEXPR_BOARD_FILE_VERSION 20210925 // Locked flag for fp_text
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag

View File

@ -3533,11 +3533,20 @@ FP_TEXT* PCB_PARSER::parseFP_TEXT()
break; // Default type is user text.
default:
THROW_IO_ERROR(
wxString::Format( _( "Cannot handle footprint text type %s" ), FromUTF8() ) );
THROW_IO_ERROR( wxString::Format( _( "Cannot handle footprint text type %s" ),
FromUTF8() ) );
}
NeedSYMBOLorNUMBER();
token = NextTok();
if( token == T_locked )
{
text->SetLocked( true );
token = NextTok();
}
if( !IsSymbol( token ) && (int) token != DSN_NUMBER )
Expecting( "text value" );
wxString value = FromUTF8();
value.Replace( "%V", "${VALUE}" );