Eeschema: fix datasheet field bug loading old symbol libraries.
This only applies to the root symbol when the datasheet field is not empty and the datasheet for root symbol alias in the document file is empty. Use the root symbol datasheet field value when adding a new symbol that meets this criteria. https://bugs.launchpad.net/kicad/+bug/1830083 Fixes lp:1830083
This commit is contained in:
parent
840e08fa78
commit
300f5cb082
|
@ -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,14 +946,27 @@ 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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number )
|
||||
|
|
Loading…
Reference in New Issue