KiCad PCB EDA Suite
|
A collection of SYMBOL_LIB objects. More...
#include <symbol_library.h>
Public Member Functions | |
PROJECT::ELEM | ProjectElementType () override |
SYMBOL_LIBS () | |
SYMBOL_LIB * | AddLibrary (const wxString &aFileName) |
Allocate and adds a symbol library to the library list. | |
SYMBOL_LIB * | AddLibrary (const wxString &aFileName, SYMBOL_LIBS::iterator &aIterator) |
Insert a symbol library into the library list. | |
bool | ReloadLibrary (const wxString &aFileName) |
Refreshes the library from the (possibly updated) contents on disk. | |
void | LoadAllLibraries (PROJECT *aProject, bool aShowProgress=true) |
Load all of the project's libraries into this container, which should be cleared before calling it. | |
SYMBOL_LIB * | FindLibrary (const wxString &aName) |
Find a symbol library by aName. | |
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. | |
LIB_SYMBOL * | FindLibSymbol (const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString) |
Search all libraries in the list for a symbol. | |
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. | |
int | GetLibraryCount () |
Static Public Member Functions | |
static void | GetLibNamesAndPaths (PROJECT *aProject, wxString *aPaths, wxArrayString *aNames=nullptr) |
static void | SetLibNamesAndPaths (PROJECT *aProject, const wxString &aPaths, const wxArrayString &aNames) |
static const wxString | CacheName (const wxString &aFullProjectFilename) |
Return the name of the cache library after potentially fixing it from an older naming scheme. | |
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 61 of file symbol_library.h.
|
inline |
Definition at line 66 of file symbol_library.h.
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 260 of file symbol_library.cpp.
References FindLibrary(), and SYMBOL_LIB::LoadSymbolLibrary().
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 285 of file symbol_library.cpp.
References FindLibrary(), and SYMBOL_LIB::LoadSymbolLibrary().
|
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 485 of file symbol_library.cpp.
References FILEEXT::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 355 of file symbol_library.cpp.
Referenced by AddLibrary(), LEGACY_RESCUER::OpenRescueLibrary(), and ReloadLibrary().
SYMBOL_LIB * SYMBOL_LIBS::FindLibraryByFullFileName | ( | const wxString & | aFullFileName | ) |
Definition at line 379 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 434 of file symbol_library.cpp.
References SYMBOL_LIB::FindSymbol(), SYMBOL_LIB::GetName(), and SYMBOL_LIB::GetSymbolNames().
Referenced by RESCUE_CASE_CANDIDATE::FindRescues().
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 415 of file symbol_library.cpp.
References SYMBOL_LIB::FindSymbol(), LIB_ID::GetLibItemName(), SYMBOL_LIB::GetName(), and UTF8::wx_str().
Referenced by RESCUE_CASE_CANDIDATE::FindRescues().
SYMBOL_LIB * SYMBOL_LIBS::GetCacheLibrary | ( | ) |
Definition at line 367 of file symbol_library.cpp.
Referenced by SCH_DRAWING_TOOLS::PlaceSymbol().
|
static |
Definition at line 459 of file symbol_library.cpp.
References PROJECT::GetProjectFile(), and project.
Referenced by LoadAllLibraries(), SCH_EDIT_FRAME::OpenProjectFiles(), PROJECT_SCH::SchSearchS(), and LEGACY_RESCUER::WriteRescueLibrary().
|
inline |
Definition at line 165 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 391 of file symbol_library.cpp.
References SYMBOL_LIB::GetName(), and SYMBOL_LIB::IsCache().
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 499 of file symbol_library.cpp.
References _, AddLibrary(), CacheName(), GetLibNamesAndPaths(), PROJECT::GetProjectFullName(), PROJECT::IsNullProject(), FILEEXT::LegacySymbolLibFileExtension, PROJECT_SCH::SchSearchS(), SYMBOL_LIB::SetCache(), THROW_IO_ERROR, THROW_PARSE_ERROR, TO_UTF8, APP_PROGRESS_DIALOG::Update(), and IO_ERROR::What().
Referenced by PROJECT_SCH::SchLibs(), and LEGACY_RESCUER::WriteRescueLibrary().
|
inlineoverridevirtual |
Implements PROJECT::_ELEM.
Definition at line 64 of file symbol_library.h.
References PROJECT::SCH_SYMBOL_LIBS.
Referenced by PROJECT_SCH::SchLibs().
bool SYMBOL_LIBS::ReloadLibrary | ( | const wxString & | aFileName | ) |
Refreshes the library from the (possibly updated) contents on disk.
aFileName | is the file name of the symbol library |
Definition at line 312 of file symbol_library.cpp.
References FindLibrary(), and SYMBOL_LIB::LoadSymbolLibrary().
|
static |
Definition at line 473 of file symbol_library.cpp.
References PROJECT::GetProjectFile(), and project.
Referenced by DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OpenProjectFiles(), and LEGACY_RESCUER::WriteRescueLibrary().