Rework >NAME and >VALUE special processing a bit.
Earlier commit moved variable substition earlier (in loadSymbolText()) so we didn't have the correct info later when we tried to do the special processing on it. Fixes https://gitlab.com/kicad/code/kicad/issues/13541
This commit is contained in:
parent
1edf84d756
commit
8d28cccfe2
|
@ -1968,8 +1968,8 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
|
||||||
|
|
||||||
wxXmlNode* currentNode = aSymbolNode->GetChildren();
|
wxXmlNode* currentNode = aSymbolNode->GetChildren();
|
||||||
|
|
||||||
bool foundName = false;
|
bool showRefDes = false;
|
||||||
bool foundValue = false;
|
bool showValue = false;
|
||||||
bool ispower = false;
|
bool ispower = false;
|
||||||
int pincount = 0;
|
int pincount = 0;
|
||||||
|
|
||||||
|
@ -2051,30 +2051,25 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
|
||||||
}
|
}
|
||||||
else if( nodeName == wxT( "text" ) )
|
else if( nodeName == wxT( "text" ) )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aSymbol, currentNode,
|
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aSymbol, currentNode, aGateNumber ) );
|
||||||
aGateNumber ) );
|
|
||||||
const wxString& text = libtext->GetText();
|
|
||||||
const wxString textUpper = text.Upper();
|
|
||||||
|
|
||||||
if( textUpper == wxT( ">NAME" ) )
|
if( libtext->GetText() == wxT( "${REFERENCE}" ) )
|
||||||
{
|
{
|
||||||
|
// Move text & attributes to Reference field and discard LIB_TEXT item
|
||||||
LIB_FIELD* field = aSymbol->GetFieldById( REFERENCE_FIELD );
|
LIB_FIELD* field = aSymbol->GetFieldById( REFERENCE_FIELD );
|
||||||
loadFieldAttributes( field, libtext.get() );
|
loadFieldAttributes( field, libtext.get() );
|
||||||
|
|
||||||
if( text != textUpper )
|
// Show Reference field if Eagle reference was uppercase
|
||||||
field->SetVisible( false );
|
showRefDes = currentNode->GetNodeContent() == wxT( ">NAME" );
|
||||||
|
|
||||||
foundName = true;
|
|
||||||
}
|
}
|
||||||
else if( textUpper == wxT( ">VALUE" ) )
|
else if( libtext->GetText() == wxT( "${VALUE}" ) )
|
||||||
{
|
{
|
||||||
|
// Move text & attributes to Value field and discard LIB_TEXT item
|
||||||
LIB_FIELD* field = aSymbol->GetFieldById( VALUE_FIELD );
|
LIB_FIELD* field = aSymbol->GetFieldById( VALUE_FIELD );
|
||||||
loadFieldAttributes( field, libtext.get() );
|
loadFieldAttributes( field, libtext.get() );
|
||||||
|
|
||||||
if( text != textUpper )
|
// Show Value field if Eagle reference was uppercase
|
||||||
field->SetVisible( false );
|
showValue = currentNode->GetNodeContent() == wxT( ">VALUE" );
|
||||||
|
|
||||||
foundValue = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2111,10 +2106,10 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
|
||||||
currentNode = currentNode->GetNext();
|
currentNode = currentNode->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( foundName == false )
|
if( !showRefDes )
|
||||||
aSymbol->GetFieldById( REFERENCE_FIELD )->SetVisible( false );
|
aSymbol->GetFieldById( REFERENCE_FIELD )->SetVisible( false );
|
||||||
|
|
||||||
if( foundValue == false )
|
if( !showValue )
|
||||||
aSymbol->GetFieldById( VALUE_FIELD )->SetVisible( false );
|
aSymbol->GetFieldById( VALUE_FIELD )->SetVisible( false );
|
||||||
|
|
||||||
return pincount == 1 ? ispower : false;
|
return pincount == 1 ? ispower : false;
|
||||||
|
|
Loading…
Reference in New Issue