diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index e8a37f3cfb..3610184908 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -906,6 +906,7 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef ) { if( PART_SPTR part = m_part.lock() ) { + wxString symbolName; LIB_FIELDS fields; part->GetFields( fields ); @@ -926,6 +927,7 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef ) if( idx == REFERENCE && !aResetRef ) continue; + if( (unsigned) idx < MANDATORY_FIELDS ) schField = GetField( idx ); else @@ -944,11 +946,24 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef ) } if( idx == VALUE ) + { schField->SetText( m_lib_id.GetLibItemName() ); // fetch alias-specific value + symbolName = m_lib_id.GetLibItemName(); + } else if( idx == DATASHEET ) + { schField->SetText( GetDatasheet() ); // fetch alias-specific value + + // Some older libraries may be broken and the alias datasheet information + // in the document file for the root part may have been dropped. This only + // happens for the root part. + if( schField->GetText().IsEmpty() && symbolName == part->GetName() ) + schField->SetText( part->GetField( DATASHEET )->GetText() ); + } else + { schField->SetText( field.GetText() ); + } } } }