netlist exporter: export only the field value, even if field name is shown.
Previously, when the field name was visible, the exported field value was prefixed by the field name, and this is incorrect. From master branch Fixes #14611 https://gitlab.com/kicad/code/kicad/issues/14611
This commit is contained in:
parent
b926d2f0bd
commit
2f51742311
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -137,8 +137,9 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
|
||||
footprint = candidate;
|
||||
|
||||
candidate = m_resolveTextVars ? symbol2->GetField( DATASHEET_FIELD )->GetShownText()
|
||||
: symbol2->GetField( DATASHEET_FIELD )->GetText();
|
||||
candidate = m_resolveTextVars
|
||||
? symbol2->GetField( DATASHEET_FIELD )->GetShownText( 0, false )
|
||||
: symbol2->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || datasheet.IsEmpty() ) )
|
||||
datasheet = candidate;
|
||||
|
@ -151,7 +152,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
&& ( unit < minUnit || userFields.count( f.GetName() ) == 0 ) )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
userFields[ f.GetName() ] = f.GetShownText();
|
||||
userFields[ f.GetName() ] = f.GetShownText( 0, false );
|
||||
else
|
||||
userFields[ f.GetName() ] = f.GetText();
|
||||
}
|
||||
|
@ -167,7 +168,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText();
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText( 0, false );
|
||||
else
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
|
@ -178,7 +179,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
if( f.GetText().size() )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
userFields[ f.GetName() ] = f.GetShownText();
|
||||
userFields[ f.GetName() ] = f.GetShownText( 0, false );
|
||||
else
|
||||
userFields[ f.GetName() ] = f.GetText();
|
||||
}
|
||||
|
@ -315,7 +316,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
xproperty->AddAttribute( wxT( "name" ), fields[jj].GetCanonicalName() );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText() );
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText( 0, false ) );
|
||||
else
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetText() );
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ wxString SCH_FIELD::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
if( IsNameShown() )
|
||||
if( IsNameShown() && aAllowExtraText )
|
||||
text = GetName() << wxS( ": " ) << text;
|
||||
|
||||
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
|
||||
|
|
Loading…
Reference in New Issue