Speed up schematic libraries loading.
This commit is contained in:
parent
a72d32d3fd
commit
de30dc9f5d
|
@ -287,19 +287,18 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, bo
|
||||||
{
|
{
|
||||||
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
|
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
|
||||||
|
|
||||||
wxArrayString tmp;
|
std::vector<LIB_ALIAS*> aliases;
|
||||||
|
// This loads the library.
|
||||||
|
lib->GetAliases( aliases );
|
||||||
|
|
||||||
// This loads the library although we could probably do lazy loading.
|
// Now, set the LIB_PART m_library member but it will only be used
|
||||||
lib->GetAliasNames( tmp );
|
// when loading legacy libraries in the future. Once the symbols in the
|
||||||
|
|
||||||
// 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.
|
// schematic have a full #LIB_ID, this will not get called.
|
||||||
for( size_t i = 0; i < tmp.GetCount(); i++ )
|
for( size_t ii = 0; ii < aliases.size(); ii++ )
|
||||||
{
|
{
|
||||||
LIB_ALIAS* alias = lib->FindAlias( tmp[i] );
|
LIB_ALIAS* alias = aliases[ii];
|
||||||
|
|
||||||
if( alias && alias->GetPart() )
|
if( alias->GetPart() )
|
||||||
alias->GetPart()->SetLib( lib.get() );
|
alias->GetPart()->SetLib( lib.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue