Honour m_resolveTextVars flag for properties as well as fields.

Fixes https://gitlab.com/kicad/code/kicad/issues/11937

(cherry picked from commit 5479514819)
This commit is contained in:
Jeff Young 2022-07-08 17:53:40 +01:00
parent e06e65cdde
commit 6e10a496ef
1 changed files with 19 additions and 10 deletions

View File

@ -317,16 +317,24 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
for( size_t jj = MANDATORY_FIELDS; jj < fields.size(); ++jj ) for( size_t jj = MANDATORY_FIELDS; jj < fields.size(); ++jj )
{ {
xcomp->AddChild( xproperty = node( "property" ) ); xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( "name", fields[jj].GetCanonicalName() ); xproperty->AddAttribute( wxT( "name" ), fields[jj].GetCanonicalName() );
xproperty->AddAttribute( "value", fields[jj].GetText() );
if( m_resolveTextVars )
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText() );
else
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetText() );
} }
for( const SCH_FIELD& sheetField : sheet.Last()->GetFields() ) for( const SCH_FIELD& sheetField : sheet.Last()->GetFields() )
{ {
xcomp->AddChild( xproperty = node( "property" ) ); xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( "name", sheetField.GetCanonicalName() ); xproperty->AddAttribute( wxT( "name" ), sheetField.GetCanonicalName() );
xproperty->AddAttribute( "value", sheetField.GetText() );
if( m_resolveTextVars )
xproperty->AddAttribute( wxT( "value" ), sheetField.GetShownText() );
else
xproperty->AddAttribute( wxT( "value" ), sheetField.GetText() );
} }
if( !symbol->GetIncludeInBom() ) if( !symbol->GetIncludeInBom() )
@ -351,11 +359,12 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
xcomp->AddChild( xunits = node( "tstamps" ) ); xcomp->AddChild( xunits = node( "tstamps" ) );
auto range = extra_units.equal_range( symbol ); auto range = extra_units.equal_range( symbol );
wxString uuid;
// Output a series of children with all UUIDs associated with the REFDES // Output a series of children with all UUIDs associated with the REFDES
for( auto it = range.first; it != range.second; ++it ) for( auto it = range.first; it != range.second; ++it )
{ {
wxString uuid = ( *it )->m_Uuid.AsString(); uuid = ( *it )->m_Uuid.AsString();
// Add a space between UUIDs, if not in KICAD mode (i.e. // Add a space between UUIDs, if not in KICAD mode (i.e.
// using wxXmlDocument::Save()). KICAD MODE has its own XNODE::Format function. // using wxXmlDocument::Save()). KICAD MODE has its own XNODE::Format function.
@ -366,8 +375,8 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
} }
// Output the primary UUID // Output the primary UUID
xunits->AddChild( uuid = symbol->m_Uuid.AsString();
new XNODE( wxXML_TEXT_NODE, wxEmptyString, symbol->m_Uuid.AsString() ) ); xunits->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
} }
} }