Load each symbol library atomically for better performance.
This commit is contained in:
parent
888a9e7371
commit
eb7ecf1dfd
|
@ -47,11 +47,11 @@ void CMP_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
|
||||||
{
|
{
|
||||||
bool onlyPowerSymbols = ( GetFilter() == CMP_FILTER_POWER );
|
bool onlyPowerSymbols = ( GetFilter() == CMP_FILTER_POWER );
|
||||||
|
|
||||||
wxArrayString aliases;
|
std::vector<LIB_ALIAS*> alias_list;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_libs->EnumerateSymbolLib( aLibNickname, aliases, onlyPowerSymbols );
|
m_libs->LoadSymbolLib( alias_list, aLibNickname, onlyPowerSymbols );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
@ -60,9 +60,9 @@ void CMP_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aliases.size() > 0 )
|
if( alias_list.size() > 0 )
|
||||||
{
|
{
|
||||||
AddAliasList( aLibNickname, aliases );
|
AddAliasList( aLibNickname, alias_list );
|
||||||
m_tree.AssignIntrinsicRanks();
|
m_tree.AssignIntrinsicRanks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,6 +310,37 @@ SYMBOL_LIB_TABLE_ROW* SYMBOL_LIB_TABLE::FindRow( const wxString& aNickname )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SYMBOL_LIB_TABLE::LoadSymbolLib( std::vector<LIB_ALIAS*>& aAliasList,
|
||||||
|
const wxString& aNickname, bool aPowerSymbolsOnly )
|
||||||
|
{
|
||||||
|
SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
|
||||||
|
wxCHECK( row && row->plugin, /* void */ );
|
||||||
|
|
||||||
|
wxString options = row->GetOptions();
|
||||||
|
|
||||||
|
if( aPowerSymbolsOnly )
|
||||||
|
row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
|
||||||
|
|
||||||
|
row->plugin->EnumerateSymbolLib( aAliasList, row->GetFullURI( true ), row->GetProperties() );
|
||||||
|
|
||||||
|
if( aPowerSymbolsOnly )
|
||||||
|
row->SetOptions( options );
|
||||||
|
|
||||||
|
// The library cannot know its own name, because it might have been renamed or moved.
|
||||||
|
// Therefore footprints cannot know their own library nickname when residing in
|
||||||
|
// a symbol library.
|
||||||
|
// Only at this API layer can we tell the symbol about its actual library nickname.
|
||||||
|
for( LIB_ALIAS* alias : aAliasList )
|
||||||
|
{
|
||||||
|
// remove "const"-ness, I really do want to set nickname without
|
||||||
|
// having to copy the LIB_ID and its two strings, twice each.
|
||||||
|
LIB_ID& id = (LIB_ID&) alias->GetPart()->GetLibId();
|
||||||
|
|
||||||
|
id.SetLibNickname( row->GetNickName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aAliasName )
|
LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aAliasName )
|
||||||
{
|
{
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
|
||||||
|
|
|
@ -160,6 +160,9 @@ public:
|
||||||
void EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
|
void EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
|
||||||
bool aPowerSymbolsOnly = false );
|
bool aPowerSymbolsOnly = false );
|
||||||
|
|
||||||
|
void LoadSymbolLib( std::vector<LIB_ALIAS*>& aAliasList, const wxString& aNickname,
|
||||||
|
bool aPowerSymbolsOnly = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a #LIB_ALIAS having @a aAliasName from the library given by @a aNickname.
|
* Load a #LIB_ALIAS having @a aAliasName from the library given by @a aNickname.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue