Symbol Editor: 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.

The root symbol datasheet field gets copied to the root symbol alias
datasheet member variable so if the symbol is modified and saved, the
datasheet information is saved in the .dcm file.

https://bugs.launchpad.net/kicad/+bug/1830078

Fixes lp:1830078
This commit is contained in:
Wayne Stambaugh 2019-05-23 08:57:24 -04:00
parent a045642b7e
commit c52ff1ca23
1 changed files with 12 additions and 2 deletions

View File

@ -175,8 +175,18 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow()
// Push a copy of each field into m_fields
m_libEntry->GetFields( *m_fields );
// Datasheet field is special; grab its value from the docfilename
m_fields->at( DATASHEET ).SetText( rootAlias->GetDocFileName() );
// The datasheet field is special. Grab its value from the LIB_ALIAS document file
// member except for old libraries that saved the root alias document file in the
// datasheet field in the LIB_PART object.
if( rootAlias->GetDocFileName().IsEmpty() )
{
m_fields->at( DATASHEET ).SetText( m_libEntry->GetField( DATASHEET )->GetText() );
rootAlias->SetDocFileName( m_libEntry->GetField( DATASHEET )->GetText() );
}
else
{
m_fields->at( DATASHEET ).SetText( rootAlias->GetDocFileName() );
}
// The Y axis for components in lib is from bottom to top while the screen axis is top
// to bottom: we must change the y coord sign for editing