Persist fields_autoplaced information.
Fixes https://gitlab.com/kicad/code/kicad/issues/8086
This commit is contained in:
parent
d3bf20e80b
commit
ebfbe14185
|
@ -432,9 +432,7 @@ public:
|
||||||
*/
|
*/
|
||||||
FIELDS_AUTOPLACED GetFieldsAutoplaced() const { return m_fieldsAutoplaced; }
|
FIELDS_AUTOPLACED GetFieldsAutoplaced() const { return m_fieldsAutoplaced; }
|
||||||
|
|
||||||
/**
|
void SetFieldsAutoplaced() { m_fieldsAutoplaced = FIELDS_AUTOPLACED_AUTO; }
|
||||||
* Set fields automatically placed flag false.
|
|
||||||
*/
|
|
||||||
void ClearFieldsAutoplaced() { m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO; }
|
void ClearFieldsAutoplaced() { m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2200,6 +2200,9 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
||||||
TRANSFORM transform;
|
TRANSFORM transform;
|
||||||
std::set<int> fieldIDsRead;
|
std::set<int> fieldIDsRead;
|
||||||
|
|
||||||
|
// We'll reset this if we find a fields_autoplaced token
|
||||||
|
symbol->ClearFieldsAutoplaced();
|
||||||
|
|
||||||
m_fieldId = MANDATORY_FIELDS;
|
m_fieldId = MANDATORY_FIELDS;
|
||||||
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||||
|
@ -2301,6 +2304,11 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_fields_autoplaced:
|
||||||
|
symbol->SetFieldsAutoplaced();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
case T_uuid:
|
case T_uuid:
|
||||||
NeedSYMBOL();
|
NeedSYMBOL();
|
||||||
const_cast<KIID&>( symbol->m_Uuid ) = KIID( FromUTF8() );
|
const_cast<KIID&>( symbol->m_Uuid ) = KIID( FromUTF8() );
|
||||||
|
@ -2510,6 +2518,9 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
|
||||||
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>();
|
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>();
|
||||||
std::set<int> fieldIDsRead;
|
std::set<int> fieldIDsRead;
|
||||||
|
|
||||||
|
// We'll reset this if we find a fields_autoplaced token
|
||||||
|
sheet->ClearFieldsAutoplaced();
|
||||||
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||||
{
|
{
|
||||||
if( token != T_LEFT )
|
if( token != T_LEFT )
|
||||||
|
@ -2534,6 +2545,11 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case T_fields_autoplaced:
|
||||||
|
sheet->SetFieldsAutoplaced();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
case T_stroke:
|
case T_stroke:
|
||||||
parseStroke( stroke );
|
parseStroke( stroke );
|
||||||
sheet->SetBorderWidth( stroke.GetWidth() );
|
sheet->SetBorderWidth( stroke.GetWidth() );
|
||||||
|
@ -2817,6 +2833,9 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
||||||
wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as text." );
|
wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as text." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We'll reset this if we find a fields_autoplaced token
|
||||||
|
text->ClearFieldsAutoplaced();
|
||||||
|
|
||||||
NeedSYMBOL();
|
NeedSYMBOL();
|
||||||
|
|
||||||
text->SetText( FromUTF8() );
|
text->SetText( FromUTF8() );
|
||||||
|
@ -2868,6 +2887,11 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_fields_autoplaced:
|
||||||
|
text->SetFieldsAutoplaced();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
case T_effects:
|
case T_effects:
|
||||||
parseEDA_TEXT( static_cast<EDA_TEXT*>( text.get() ) );
|
parseEDA_TEXT( static_cast<EDA_TEXT*>( text.get() ) );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -951,6 +951,9 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aShee
|
||||||
m_out->Print( aNestLevel + 1, "(in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
|
m_out->Print( aNestLevel + 1, "(in_bom %s)", ( aSymbol->GetIncludeInBom() ) ? "yes" : "no" );
|
||||||
m_out->Print( 0, " (on_board %s)", ( aSymbol->GetIncludeOnBoard() ) ? "yes" : "no" );
|
m_out->Print( 0, " (on_board %s)", ( aSymbol->GetIncludeOnBoard() ) ? "yes" : "no" );
|
||||||
|
|
||||||
|
if( aSymbol->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
|
||||||
|
m_out->Print( 0, " (fields_autoplaced)" );
|
||||||
|
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aSymbol->m_Uuid.AsString() ) );
|
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aSymbol->m_Uuid.AsString() ) );
|
||||||
|
@ -1086,12 +1089,17 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aSheet != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(sheet (at %s %s) (size %s %s)\n",
|
m_out->Print( aNestLevel, "(sheet (at %s %s) (size %s %s)",
|
||||||
FormatInternalUnits( aSheet->GetPosition().x ).c_str(),
|
FormatInternalUnits( aSheet->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetPosition().y ).c_str(),
|
FormatInternalUnits( aSheet->GetPosition().y ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetSize().GetWidth() ).c_str(),
|
FormatInternalUnits( aSheet->GetSize().GetWidth() ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetSize().GetHeight() ).c_str() );
|
FormatInternalUnits( aSheet->GetSize().GetHeight() ).c_str() );
|
||||||
|
|
||||||
|
if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
|
||||||
|
m_out->Print( 0, " (fields_autoplaced)" );
|
||||||
|
|
||||||
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
STROKE_PARAMS stroke( aSheet->GetBorderWidth(), PLOT_DASH_TYPE::SOLID,
|
STROKE_PARAMS stroke( aSheet->GetBorderWidth(), PLOT_DASH_TYPE::SOLID,
|
||||||
aSheet->GetBorderColor() );
|
aSheet->GetBorderColor() );
|
||||||
|
|
||||||
|
@ -1270,6 +1278,9 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
||||||
FormatAngle( aText->GetTextAngle() ).c_str() );
|
FormatAngle( aText->GetTextAngle() ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( aText->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
|
||||||
|
m_out->Print( 0, " (fields_autoplaced)" );
|
||||||
|
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
aText->Format( m_out, aNestLevel, 0 );
|
aText->Format( m_out, aNestLevel, 0 );
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ edge_clock_high
|
||||||
effects
|
effects
|
||||||
end
|
end
|
||||||
extends
|
extends
|
||||||
|
fields_autoplaced
|
||||||
fill
|
fill
|
||||||
font
|
font
|
||||||
footprint
|
footprint
|
||||||
|
|
Loading…
Reference in New Issue