Fix value field visibility issues when importing Eagle schematics.

Eagle schematics do not show the value field when it's not defined or
when not package (footprint) is defined for the symbol which is the
case for power symbols.  Don't show the value field in KiCad to bring
the view more in line with what Eagle displays.

Inspired by Stefan's merge request #13433.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13433
This commit is contained in:
Wayne Stambaugh 2023-01-09 10:41:23 -05:00
parent c43050b91b
commit 4c5203fabf
1 changed files with 6 additions and 1 deletions

View File

@ -1491,10 +1491,15 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
symbol->GetField( VALUE_FIELD )->SetText( value );
// Hide the value field if the Eagle "package" element is empty which is the case for most
// power symbols which Eagle hides by default or no Eagle "value" element is defined.
bool showValueField = !( package.IsEmpty() || !epart->value ||
!part->GetFieldById( VALUE_FIELD )->IsVisible() );
// Set the visibility of fields.
symbol->GetField( REFERENCE_FIELD )->SetVisible(
part->GetFieldById( REFERENCE_FIELD )->IsVisible() );
symbol->GetField( VALUE_FIELD )->SetVisible( part->GetFieldById( VALUE_FIELD )->IsVisible() );
symbol->GetField( VALUE_FIELD )->SetVisible( showValueField );
for( const auto& a : epart->attribute )
{