![]() |
KiCad PCB EDA Suite
|
A collection of SYMBOL_LIB objects. More...
#include <symbol_library.h>
Public Member Functions | |
KICAD_T | Type () override |
SYMBOL_LIBS () | |
int | GetModifyHash () |
Return the modification hash for all libraries. More... | |
SYMBOL_LIB * | AddLibrary (const wxString &aFileName) |
Allocate and adds a symbol library to the library list. More... | |
SYMBOL_LIB * | AddLibrary (const wxString &aFileName, SYMBOL_LIBS::iterator &aIterator) |
Insert a symbol library into the library list. More... | |
void | LoadAllLibraries (PROJECT *aProject, bool aShowProgress=true) |
Load all of the project's libraries into this container, which should be cleared before calling it. More... | |
SYMBOL_LIB * | FindLibrary (const wxString &aName) |
Find a symbol library by aName. More... | |
SYMBOL_LIB * | FindLibraryByFullFileName (const wxString &aFullFileName) |
SYMBOL_LIB * | GetCacheLibrary () |
wxArrayString | GetLibraryNames (bool aSorted=true) |
Return the list of symbol library file names without path and extension. More... | |
LIB_SYMBOL * | FindLibSymbol (const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString) |
Search all libraries in the list for a symbol. More... | |
void | FindLibraryNearEntries (std::vector< LIB_SYMBOL * > &aCandidates, const wxString &aEntryName, const wxString &aLibraryName=wxEmptyString) |
Search all libraries in the list for a LIB_SYMBOL using a case insensitive comparison. More... | |
int | GetLibraryCount () |
Static Public Member Functions | |
static void | IncrementModifyGeneration () |
static int | GetModifyGeneration () |
static void | LibNamesAndPaths (PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=nullptr) |
Save or load the names of the currently configured symbol libraries (without paths). More... | |
static const wxString | CacheName (const wxString &aFullProjectFilename) |
Return the name of the cache library after potentially fixing it from an older naming scheme. More... | |
Static Public Attributes | |
static int | s_modify_generation = 1 |
helper for GetModifyHash() More... | |
static std::mutex | s_generationMutex |
A collection of SYMBOL_LIB objects.
It extends from PROJECT::_ELEM so it can be hung in the PROJECT. It does not use any UI calls, but rather simply throws an IO_ERROR when there is a problem.
Definition at line 195 of file symbol_library.h.
|
inline |
Definition at line 203 of file symbol_library.h.
References IncrementModifyGeneration().
SYMBOL_LIB * SYMBOL_LIBS::AddLibrary | ( | const wxString & | aFileName | ) |
Allocate and adds a symbol library to the library list.
aFileName | is the file name object of symbol library. |
IO_ERROR | if there's any problem loading. |
Definition at line 254 of file symbol_library.cpp.
References FindLibrary(), and SYMBOL_LIB::LoadLibrary().
Referenced by LoadAllLibraries().
SYMBOL_LIB * SYMBOL_LIBS::AddLibrary | ( | const wxString & | aFileName, |
SYMBOL_LIBS::iterator & | aIterator | ||
) |
Insert a symbol library into the library list.
aFileName | is the file name object of symbol library. |
aIterator | is an iterator to insert library in front of. |
IO_ERROR | if there's any problem loading. |
Definition at line 279 of file symbol_library.cpp.
References FindLibrary(), and SYMBOL_LIB::LoadLibrary().
|
static |
Return the name of the cache library after potentially fixing it from an older naming scheme.
That is, the old file is renamed if needed.
aFullProjectFilename | is the *.pro filename with absolute path. |
Definition at line 458 of file symbol_library.cpp.
References LegacySymbolLibFileExtension, and name.
Referenced by LoadAllLibraries().
SYMBOL_LIB * SYMBOL_LIBS::FindLibrary | ( | const wxString & | aName | ) |
Find a symbol library by aName.
aName | is the library file name without path or extension to find. |
Definition at line 306 of file symbol_library.cpp.
Referenced by AddLibrary().
SYMBOL_LIB * SYMBOL_LIBS::FindLibraryByFullFileName | ( | const wxString & | aFullFileName | ) |
Definition at line 330 of file symbol_library.cpp.
void SYMBOL_LIBS::FindLibraryNearEntries | ( | std::vector< LIB_SYMBOL * > & | aCandidates, |
const wxString & | aEntryName, | ||
const wxString & | aLibraryName = wxEmptyString |
||
) |
Search all libraries in the list for a LIB_SYMBOL using a case insensitive comparison.
Helper function used in dialog to find all candidates. During a long time, eeschema was using a case insensitive search. Therefore, for old schematics (<= 2013), or libs, for some symbols, the chip name (name of alias in lib) can be broken. This function can be used to display a list of candidates, in symbol properties dialog.
aEntryName | is the name of entries to search for (case insensitive). |
aLibraryName | is the name of the library to search. |
aCandidates | is a std::vector to store candidates. |
Definition at line 385 of file symbol_library.cpp.
References SYMBOL_LIB::FindSymbol(), SYMBOL_LIB::GetName(), and SYMBOL_LIB::GetSymbolNames().
LIB_SYMBOL * SYMBOL_LIBS::FindLibSymbol | ( | const LIB_ID & | aLibId, |
const wxString & | aLibraryName = wxEmptyString |
||
) |
Search all libraries in the list for a symbol.
A symbol object will always be returned. If the entry found is an alias. The root symbol will be found and returned.
aLibId | is the LIB_ID of the symbol to search for. |
aLibraryName | is the name of the library to search for symbol. |
Definition at line 366 of file symbol_library.cpp.
References SYMBOL_LIB::FindSymbol(), LIB_ID::GetLibItemName(), SYMBOL_LIB::GetName(), and UTF8::wx_str().
SYMBOL_LIB * SYMBOL_LIBS::GetCacheLibrary | ( | ) |
Definition at line 318 of file symbol_library.cpp.
|
inline |
Definition at line 313 of file symbol_library.h.
Referenced by SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_SCREEN::UpdateSymbolLinks().
wxArrayString SYMBOL_LIBS::GetLibraryNames | ( | bool | aSorted = true | ) |
Return the list of symbol library file names without path and extension.
aSorted | sort the list of name if true. Otherwise use the library load order. |
Definition at line 342 of file symbol_library.cpp.
References SYMBOL_LIB::GetName(), and SYMBOL_LIB::IsCache().
|
inlinestatic |
Definition at line 214 of file symbol_library.h.
References s_generationMutex, and s_modify_generation.
Referenced by GetModifyHash().
int SYMBOL_LIBS::GetModifyHash | ( | ) |
Return the modification hash for all libraries.
The value returned changes on every library modification.
Definition at line 414 of file symbol_library.cpp.
References GetModifyGeneration().
|
inlinestatic |
Definition at line 208 of file symbol_library.h.
References s_generationMutex, and s_modify_generation.
Referenced by SCH_SEXPR_PLUGIN::cacheLib(), SCH_LEGACY_PLUGIN::cacheLib(), and SYMBOL_LIBS().
|
static |
Save or load the names of the currently configured symbol libraries (without paths).
Definition at line 432 of file symbol_library.cpp.
References PROJECT::GetProjectFile(), and project.
Referenced by LoadAllLibraries(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OpenProjectFiles(), and LEGACY_RESCUER::WriteRescueLibrary().
void SYMBOL_LIBS::LoadAllLibraries | ( | PROJECT * | aProject, |
bool | aShowProgress = true |
||
) |
Load all of the project's libraries into this container, which should be cleared before calling it.
Definition at line 472 of file symbol_library.cpp.
References _, AddLibrary(), CacheName(), Format(), PROJECT::GetProjectFullName(), PROJECT::IsNullProject(), LegacySymbolLibFileExtension, LibNamesAndPaths(), THROW_IO_ERROR, THROW_PARSE_ERROR, TO_UTF8, APP_PROGRESS_DIALOG::Update(), and IO_ERROR::What().
Referenced by LEGACY_RESCUER::WriteRescueLibrary().
|
inlineoverridevirtual |
Implements PROJECT::_ELEM.
Definition at line 198 of file symbol_library.h.
References SYMBOL_LIBS_T.
|
static |
Definition at line 201 of file symbol_library.h.
Referenced by GetModifyGeneration(), and IncrementModifyGeneration().
|
static |
helper for GetModifyHash()
Definition at line 200 of file symbol_library.h.
Referenced by GetModifyGeneration(), and IncrementModifyGeneration().