diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index dd2dda53be..e1a7672086 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -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 text = std::make_unique( 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" ); } } diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 6fc1a7bd85..318d29a883 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -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() ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index 3ed85948a4..61f214328a 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -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