Add do_not_autoplace to schematic parser and printer.

Fixes https://gitlab.com/kicad/code/kicad/issues/12657
This commit is contained in:
Jeff Young 2022-10-15 19:08:11 +01:00
parent d1fb32f26c
commit 254dff2813
3 changed files with 12 additions and 4 deletions

View File

@ -406,10 +406,10 @@ void SCH_SEXPR_PLUGIN_CACHE::saveField( LIB_FIELD* aField, OUTPUTFORMATTER& aFor
aField->GetTextAngle().AsDegrees() );
if( aField->IsNameShown() )
aFormatter.Print( aNestLevel, " (show_name)" );
aFormatter.Print( 0, " (show_name)" );
if( !aField->CanAutoplace() )
aFormatter.Print( aNestLevel, " (do_not_autoplace)" );
aFormatter.Print( 0, " (do_not_autoplace)" );
aFormatter.Print( 0, "\n" );
aField->Format( &aFormatter, aNestLevel, 0 );

View File

@ -1976,8 +1976,13 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
NeedRIGHT();
break;
case T_do_not_autoplace:
field->SetCanAutoplace( false );
NeedRIGHT();
break;
default:
Expecting( "id, show_name, at or effects" );
Expecting( "id, at, show_name, do_not_autoplace or effects" );
}
}

View File

@ -889,7 +889,10 @@ void SCH_SEXPR_PLUGIN::saveField( SCH_FIELD* aField, int aNestLevel )
EDA_UNIT_UTILS::FormatAngle( aField->GetTextAngle() ).c_str() );
if( aField->IsNameShown() )
m_out->Print( aNestLevel, " (show_name)" );
m_out->Print( 0, " (show_name)" );
if( !aField->CanAutoplace() )
m_out->Print( 0, " (do_not_autoplace)" );
if( !aField->IsDefaultFormatting()
|| ( aField->GetTextHeight() != schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) ) )