27#ifndef SYMBOL_LIBRARY_MANAGER_H
28#define SYMBOL_LIBRARY_MANAGER_H
96 std::list<LIB_SYMBOL*>
GetAliases(
const wxString& aLibrary )
const;
111 return addLibrary( aFilePath,
false, aTable );
126 const wxString& aLibrary );
137 bool RemoveSymbol(
const wxString& aName,
const wxString& aLibrary );
161 bool SymbolExists(
const wxString& aAlias,
const wxString& aLibrary )
const;
167 bool LibraryExists(
const wxString& aLibrary,
bool aCheckEnabled =
false )
const;
182 bool IsSymbolModified(
const wxString& aAlias,
const wxString& aLibrary )
const;
209 bool FlushSymbol(
const wxString& aAlias,
const wxString& aLibrary );
218 bool SaveLibrary(
const wxString& aLibrary,
const wxString& aFileName,
219 SCH_IO_MGR::SCH_FILE_T aFileType = SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY );
249 void GetSymbolNames(
const wxString& aLibName, wxArrayString& aSymbolNames,
258 bool HasDerivedSymbols(
const wxString& aSymbolName,
const wxString& aLibraryName );
280 std::unique_ptr<SCH_SCREEN> aScreen =
nullptr );
327 for(
const std::shared_ptr<SYMBOL_BUFFER>& symbolBuf :
m_symbols )
329 if( symbolBuf->IsModified() )
347 bool DeleteBuffer( std::shared_ptr<SYMBOL_BUFFER> aSymbolBuf );
360 bool SaveBuffer( std::shared_ptr<SYMBOL_BUFFER> aSymbolBuf,
const wxString& aFileName,
364 std::shared_ptr<SYMBOL_BUFFER>
GetBuffer(
const wxString& aAlias )
const;
A logical library item identifier and consists of various portions much like a URI.
Define a library symbol object.
A progress reporter interface for use in multi-threaded environments.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Base class that schematic file and library loading and saving plugins should derive from.
std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_deleted
LIB_BUFFER(const wxString &aLibrary)
LIB_SYMBOL * GetSymbol(const wxString &aAlias) const
Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
void ClearDeletedBuffer()
Save stored modifications to Symbol Lib Table.
int removeChildSymbols(std::shared_ptr< SYMBOL_BUFFER > &aSymbolBuf)
Remove all symbols derived from aParent from the library buffer.
bool HasDerivedSymbols(const wxString &aParentName) const
Check to see any symbols in the buffer are derived from a parent named aParentName.
std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_symbols
Buffer for deleted symbols until library is saved.
bool SaveBuffer(std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf, SYMBOL_LIB_TABLE *aLibTable)
Save stored modifications using a plugin.
const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & GetBuffers() const
int GetHash() const
Return the working copy of a LIB_SYMBOL root object with specified alias.
std::shared_ptr< SYMBOL_BUFFER > GetBuffer(const wxString &aAlias) const
Return all buffered symbols.
bool UpdateBuffer(std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf, LIB_SYMBOL *aCopy)
bool DeleteBuffer(std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf)
void GetSymbolNames(wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
Fetch a list of root symbols names from the library buffer.
bool CreateBuffer(LIB_SYMBOL *aCopy, SCH_SCREEN *aScreen)
Update the buffered symbol with the contents of aCopy.
size_t GetDerivedSymbolNames(const wxString &aSymbolName, wxArrayString &aList)
Fetch all of the symbols derived from a aSymbolName into aList.
Store a working copy of a library.
bool SetScreen(std::unique_ptr< SCH_SCREEN > aScreen)
LIB_SYMBOL * GetSymbol() const
std::unique_ptr< SCH_SCREEN > RemoveScreen()
void SetOriginal(LIB_SYMBOL *aSymbol)
LIB_SYMBOL * GetOriginal() const
void SetSymbol(LIB_SYMBOL *aSymbol)
SCH_SCREEN * GetScreen() const
Transfer the screen ownership.
std::unique_ptr< SCH_SCREEN > m_screen
Class to handle modifications to the symbol libraries.
LIB_SYMBOL * GetBufferedSymbol(const wxString &aAlias, const wxString &aLibrary)
Return the symbol copy from the buffer.
bool UpdateSymbolAfterRename(LIB_SYMBOL *aSymbol, const wxString &oldAlias, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol when the name has changed.
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
bool addLibrary(const wxString &aFilePath, bool aCreate, SYMBOL_LIB_TABLE *aTable)
Return the current Symbol Library Table.
bool ClearSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Clear the modified flag for a symbol.
bool LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Return true if library exists.
size_t GetLibraryCount() const
bool ClearLibraryModified(const wxString &aLibrary) const
Clear the modified flag for all symbols in a library.
LIB_SYMBOL * GetAlias(const wxString &aAlias, const wxString &aLibrary) const
Return either an alias of a working LIB_SYMBOL copy, or alias of the original symbol if there is no w...
SCH_SCREEN * GetScreen(const wxString &aAlias, const wxString &aLibrary)
Return the screen used to edit a specific symbol.
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
wxArrayString GetLibraryNames() const
Return the array of library names.
void SetSymbolModified(const wxString &aAlias, const wxString &aLibrary)
bool SymbolExists(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol with a specific alias exists in library (either original one or buffered).
wxString GetUniqueLibraryName() const
Return a library name that is not currently in use.
bool HasModifications() const
bool RemoveSymbol(const wxString &aName, const wxString &aLibrary)
Remove the symbol from the symbol buffer.
static wxString getLibraryName(const wxString &aFilePath)
Helper function to add either existing or create new library.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Add an existing library.
LIB_BUFFER & getLibraryBuffer(const wxString &aLibrary)
Return an existing library buffer or creates one to using Symbol Library Table to get the original da...
virtual void OnDataChanged() const
Extract library name basing on the file name.
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Create an empty library and adds it to the library table.
bool IsSymbolModified(const wxString &aAlias, const wxString &aLibrary) const
Return true if symbol has unsaved modifications.
bool IsLibraryLoaded(const wxString &aLibrary) const
Return true if the library was successfully loaded.
SYMBOL_LIB_TABLE * symTable() const
Class to store a working copy of a LIB_SYMBOL object and editor context.
virtual ~SYMBOL_LIBRARY_MANAGER()
bool RevertLibrary(const wxString &aLibrary)
Revert unsaved changes for a symbolicular library.
void GetSymbolNames(const wxString &aLibName, wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
std::set< LIB_SYMBOL * > getOriginalSymbols(const wxString &aLibrary)
Return a set of LIB_SYMBOL objects belonging to the original library.
int GetLibraryHash(const wxString &aLibrary) const
Return a library hash value to determine if it has changed.
void Preload(PROGRESS_REPORTER &aReporter)
Preloads all symbol libraries in the symbol library table using SYMBOL_ASYNC_LOADER.
bool RevertAll()
Revert all pending changes.
LIB_ID RevertSymbol(const wxString &aAlias, const wxString &aLibrary)
Revert unsaved changes for a symbolicular symbol.
SYMBOL_LIB_TABLE_ROW * GetLibrary(const wxString &aLibrary) const
Find a single library within the (aggregate) library table.
SCH_BASE_FRAME & m_frame
Parent frame.
std::list< LIB_SYMBOL * > GetAliases(const wxString &aLibrary) const
bool UpdateSymbol(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol.
bool SaveLibrary(const wxString &aLibrary, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aFileType=SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY)
Save library to a file, including unsaved changes.
bool HasDerivedSymbols(const wxString &aSymbolName, const wxString &aLibraryName)
Check if symbol aSymbolName in library aLibraryName is a root symbol that has derived symbols.
std::map< wxString, LIB_BUFFER > m_libs
bool UpdateLibraryBuffer(const wxString &aLibrary)
Update the library buffer with a new version of the library.
bool FlushSymbol(const wxString &aAlias, const wxString &aLibrary)
Save symbol changes to the library copy used by the schematic editor.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
Object used to load, save, search, and otherwise manipulate symbol library files.