31 #ifndef SYMBOL_LIBRARY_H 32 #define SYMBOL_LIBRARY_H 36 #include <boost/ptr_container/ptr_vector.hpp> 37 #include <wx/filename.h> 55 #define LIB_VERSION_MAJOR 2 56 #define LIB_VERSION_MINOR 4 59 #define LIBFILE_IDENT "EESchema-LIBRARY Version" 61 #define LIB_VERSION( major, minor ) ( major * 100 + minor ) 63 #define IS_LIB_CURRENT_VERSION( major, minor ) \ 65 LIB_VERSION( major1, minor1 ) == \ 66 LIB_VERSION( LIB_VERSION_MAJOR, LIB_VERSION_MINOR) \ 75 #define USE_OLD_DOC_FILE_FORMAT( major, minor ) \ 76 ( LIB_VERSION( major, minor ) <= LIB_VERSION( 2, 4 ) ) 98 void AddLib(
const wxString& aLibName )
151 static wxString
dummy;
177 bool operator() (
const wxString& aItem1,
const wxString& aItem2 )
const 179 return aItem1 < aItem2;
255 wxString* aPaths, wxArrayString* aNames =
nullptr );
263 static const wxString
CacheName(
const wxString& aFullProjectFilename );
311 const wxString& aLibraryName = wxEmptyString );
327 SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
339 void Create(
const wxString& aFileName = wxEmptyString );
356 void Save(
bool aSaveDocFile =
true );
375 void GetSymbols( std::vector<LIB_SYMBOL*>& aSymbols )
const;
485 #endif // SYMBOL_LIBRARY_H bool m_filterPowerSymbols
true to filter (show only) power symbols
wxDateTime timeStamp
Library save time and date.
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP
Symbol map used by symbol library object.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Container for project specific data.
SYMBOL_LIB * AddLibrary(const wxString &aFileName)
Allocate and adds a symbol library to the library list.
const wxString & GetLibSource() const
LIB_SYMBOL * FindSymbol(const wxString &aName) const
Find LIB_SYMBOL by aName.
Object used to load, save, search, and otherwise manipulate symbol library files.
LIB_SYMBOL * FindLibSymbol(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Search all libraries in the list for a symbol.
void Save(bool aSaveDocFile=true)
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).
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.
void LoadFrom(const wxString &aLibName)
add a lib name to the allowed libraries
int GetModifyHash()
Return the modification hash for all libraries.
static const wxString CacheName(const wxString &aFullProjectFilename)
Return the name of the cache library after potentially fixing it from an older naming scheme.
int m_mod_hash
incremented each time library is changed.
bool operator!=(const SYMBOL_LIB &aLibrary, const wxString &aName)
const wxString GetLogicalName() const
Return the logical name of the library.
LIB_SYMBOL * RemoveSymbol(LIB_SYMBOL *aEntry)
Safely remove aEntry from the library and return the next entry.
SCH_IO_MGR::SCH_FILE_T m_pluginType
A logical library item identifier and consists of various portions much like a URI.
void EnableBuffering(bool aEnable=true)
Define a library symbol object.
int versionMajor
Library major version number.
static int GetModifyGeneration()
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
SYMBOL_LIB(SCH_LIB_TYPE aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY)
void LoadAllLibraries(PROJECT *aProject, bool aShowProgress=true)
Load all of the project's libraries into this container, which should be cleared before calling it.
wxString header
first line of loaded library.
void AddLib(const wxString &aLibName)
add a lib name to the allowed libraries
void Create(const wxString &aFileName=wxEmptyString)
void AddSymbol(LIB_SYMBOL *aSymbol)
Add aSymbol entry to library.
boost::ptr_vector< SYMBOL_LIB > SYMBOL_LIBS_BASE
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
std::unique_ptr< SCH_PLUGIN > m_plugin
void ClearLibList()
Clear the allowed libraries list (allows all libs)
Base class that schematic file and library loading and saving plugins should derive from.
bool operator==(const SYMBOL_LIB &aLibrary, const wxString &aName)
Case insensitive library name comparison.
const wxString GetName() const
Return the file name without path or extension.
wxString GetFullFileName() const
Return the full file library name with path and extension.
void SetFileName(const wxString &aFileName)
static void IncrementModifyGeneration()
wxFileName fileName
Library file name.
LIB_SYMBOL * ReplaceSymbol(LIB_SYMBOL *aOldSymbol, LIB_SYMBOL *aNewSymbol)
Replace an existing symbol entry in the library.
void SetPluginType(SCH_IO_MGR::SCH_FILE_T aPluginType)
wxArrayString m_allowedLibs
a list of lib names to list some libraries if empty: no filter
wxArrayString GetLibraryNames(bool aSorted=true)
Return the list of symbol library file names without path and extension.
static int s_modify_generation
helper for GetModifyHash()
SYMBOL_LIB * FindLibraryByFullFileName(const wxString &aFullFileName)
A SCH_PLUGIN derivation for loading schematic files created before the new s-expression file format.
A collection of SYMBOL_LIB objects.
void GetSymbolNames(wxArrayString &aNames) const
Load a string array with the names of all the entries in this library.
static std::mutex s_generationMutex
SYMBOL_LIB * GetCacheLibrary()
void GetSymbols(std::vector< LIB_SYMBOL * > &aSymbols) const
Load a vector with all the entries in this library.
static SYMBOL_LIB * LoadLibrary(const wxString &aFileName)
Allocate and load a symbol library file.
bool isModified
Library modification status.
int versionMinor
Library minor version number.
void FilterPowerSymbols(bool aFilterEnable)
Set the filtering of power symbols.
std::unique_ptr< PROPERTIES > m_properties
Library properties.
SCH_IO_MGR::SCH_FILE_T GetPluginType() const
SCH_LIB_TYPE type
Library type indicator.
const wxArrayString & GetAllowedLibList() const
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
SYMBOL_LIB * FindLibrary(const wxString &aName)
Find a symbol library by aName.
bool operator()(const wxString &aItem1, const wxString &aItem2) const
bool GetFilterPowerSymbols() const