From 6db7cb89372248f96b0ed138df1334f091a7efb5 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 23 May 2019 08:57:24 -0400 Subject: [PATCH] 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 (cherry picked from commit c52ff1ca23143b9ab7406bfb1e87927bdba466fb) --- eeschema/dialogs/dialog_edit_component_in_lib.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 5977aa26c7..4f4a708268 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -179,8 +179,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