Browse Source

Fix missing part library broken by schematic I/O plugin changes.

The LIB_PART object stores a pointer to the PART_LIB that it belongs to.
Now that the PART_LIB is no long responsible for loading the library, add
the PART_LIB pointer after the library is loaded by the plugin.
pull/3/merge
Wayne Stambaugh 9 years ago
parent
commit
ebfbbcc1f5
  1. 14
      eeschema/class_library.cpp

14
eeschema/class_library.cpp

@ -302,10 +302,20 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, bo
wxArrayString tmp;
// This loads the library although we could probably do lazy loading.
lib->GetCount();
lib->GetAliasNames( tmp );
PART_LIB* ret = lib.release();
// This not them most efficient way to set the LIB_PART m_library member but it will
// only be used when loading legacy libraries in the future. Once the symbols in the
// schematic have a full #LIB_ID, this will not get called.
for( size_t i = 0; i < tmp.GetCount(); i++ )
{
LIB_ALIAS* alias = lib->FindAlias( tmp[i] );
if( alias && alias->GetPart() )
alias->GetPart()->SetLib( lib.get() );
}
PART_LIB* ret = lib.release();
return ret;
}

Loading…
Cancel
Save