27#ifndef SYMBOL_LIBRARY_MANAGER_H 
   28#define SYMBOL_LIBRARY_MANAGER_H 
   60                   std::unique_ptr<SCH_SCREEN> aScreen = 
nullptr );
 
   64    void        SetSymbol( std::unique_ptr<LIB_SYMBOL> aSymbol );
 
   67    void        SetOriginal( std::unique_ptr<LIB_SYMBOL> aSymbol );
 
 
   93        for( 
const std::shared_ptr<SYMBOL_BUFFER>& symbolBuf : 
m_symbols )
 
   95            if( symbolBuf->IsModified() )
 
 
  108    bool CreateBuffer( std::unique_ptr<LIB_SYMBOL> aCopy, std::unique_ptr<SCH_SCREEN> aScreen );
 
  126    std::shared_ptr<SYMBOL_BUFFER> 
GetBuffer( 
const wxString& aAlias ) 
const;
 
 
  224        return addLibrary( aFilePath, 
false, aScope );
 
 
  242                                  const wxString& aLibrary );
 
  254    bool RemoveSymbol( 
const wxString& aSymbolName, 
const wxString& aLibrary );
 
  280    bool SymbolExists( 
const wxString& aSymbolName, 
const wxString& aLibrary ) 
const;
 
  285    bool SymbolNameInUse( 
const wxString& aName, 
const wxString& aLibrary );
 
  292    bool LibraryExists( 
const wxString& aLibrary, 
bool aCheckEnabled = 
false ) 
const;
 
  307    bool IsSymbolModified( 
const wxString& aSymbolName, 
const wxString& aLibrary ) 
const;
 
  335    bool SaveLibrary( 
const wxString& aLibrary, 
const wxString& aFileName,
 
  336                      SCH_IO_MGR::SCH_FILE_T aFileType = SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY );
 
  367    void GetSymbolNames( 
const wxString& aLibName, wxArrayString& aSymbolNames,
 
  373    size_t GetDerivedSymbolNames( 
const wxString& aSymbolName, 
const wxString& aLibraryName, wxArrayString& aList );
 
 
Object used to load, save, search, and otherwise manipulate symbol library files.
 
Store a working copy of a library.
 
size_t GetDerivedSymbolNames(const wxString &aSymbolName, wxArrayString &aList)
Fetch all of the symbols derived from a aSymbolName into aList.
 
bool CreateBuffer(std::unique_ptr< LIB_SYMBOL > aCopy, std::unique_ptr< SCH_SCREEN > aScreen)
Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
 
bool DeleteBuffer(const SYMBOL_BUFFER &aSymbolBuf)
Delete the given symbol buffer from the library buffer.
 
void ClearDeletedBuffer()
 
void GetSymbolNames(wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
Fetch a list of root symbols names from the library buffer.
 
LIB_BUFFER(const wxString &aLibrary)
 
std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_symbols
 
std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_deleted
Buffer for deleted symbols until library is saved.
 
bool SaveBuffer(SYMBOL_BUFFER &aSymbolBuf, const wxString &aFileName, SCH_IO *aPlugin, bool aBuffer)
Save stored modifications using a plugin.
 
const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & GetBuffers() const
Return all buffered symbols.
 
std::shared_ptr< SYMBOL_BUFFER > GetBuffer(const wxString &aAlias) const
Return a symbol buffer with LIB_SYMBOL holding a symbolic alias.
 
LIB_SYMBOL * GetSymbol(const wxString &aAlias) const
Return the working copy of a LIB_SYMBOL root object with specified alias.
 
int removeChildSymbols(const 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.
 
bool UpdateBuffer(SYMBOL_BUFFER &aSymbolBuf, const LIB_SYMBOL &aCopy)
Update the buffered symbol with the contents of aCopy.
 
const wxString m_libName
Buffered library name.
 
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::unique_ptr< LIB_SYMBOL > m_symbol
 
std::unique_ptr< SCH_SCREEN > m_screen
 
void SetSymbol(std::unique_ptr< LIB_SYMBOL > aSymbol)
 
LIB_SYMBOL & GetSymbol() const
 
SCH_SCREEN * GetScreen() const
 
SYMBOL_BUFFER(std::unique_ptr< LIB_SYMBOL > aSymbol=nullptr, std::unique_ptr< SCH_SCREEN > aScreen=nullptr)
 
std::unique_ptr< LIB_SYMBOL > m_original
 
LIB_SYMBOL & GetOriginal() const
 
void SetOriginal(std::unique_ptr< LIB_SYMBOL > aSymbol)
 
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
 
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 * GetBufferedSymbol(const wxString &aSymbolName, const wxString &aLibrary)
Return the symbol copy from the buffer.
 
bool CreateLibrary(const wxString &aFilePath, LIBRARY_TABLE_SCOPE aScope)
Create an empty library and adds it to the library table.
 
bool ClearSymbolModified(const wxString &aSymbolName, const wxString &aLibrary) const
Clear the modified flag for a symbol.
 
bool addLibrary(const wxString &aFilePath, bool aCreate, LIBRARY_TABLE_SCOPE aScope)
Helper function to add either existing or create new library.
 
bool AddLibrary(const wxString &aFilePath, LIBRARY_TABLE_SCOPE aScope)
Add an existing library.
 
SCH_SCREEN * GetScreen(const wxString &aSymbolName, const wxString &aLibrary)
Return the screen used to edit a specific symbol.
 
bool SymbolNameInUse(const wxString &aName, const wxString &aLibrary)
Return true if the symbol name is already in use in the specified library.
 
bool IsLibraryModified(const wxString &aLibrary) const
Return true if library has unsaved modifications.
 
LIB_SYMBOL * GetSymbol(const wxString &aSymbolName, 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...
 
bool RemoveSymbol(const wxString &aSymbolName, const wxString &aLibrary)
Remove the symbol from the symbol buffer.
 
wxArrayString GetLibraryNames() const
Return the array of library names.
 
LIB_BUFFER & getLibraryBuffer(const wxString &aLibrary)
Return an existing library buffer or creates one to using symbol library table to get the original da...
 
wxString GetUniqueLibraryName() const
Return a library name that is not currently in use.
 
bool HasModifications() const
 
static wxString getLibraryName(const wxString &aFilePath)
Extract library name basing on the file name.
 
bool UpdateSymbolAfterRename(LIB_SYMBOL *aSymbol, const wxString &aOldSymbolName, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol when the name has changed.
 
bool IsSymbolModified(const wxString &aSymbolName, const wxString &aLibrary) const
Return true if symbol has unsaved modifications.
 
virtual void OnDataChanged() const
 
bool IsLibraryLoaded(const wxString &aLibrary) const
Return true if the library was successfully loaded.
 
void SetSymbolModified(const wxString &aSymbolName, const wxString &aLibrary)
 
virtual ~SYMBOL_LIBRARY_MANAGER()
 
bool RevertLibrary(const wxString &aLibrary)
Revert unsaved changes for a symbol library.
 
LIB_ID RevertSymbol(const wxString &aSymbolName, const wxString &aLibrary)
Revert unsaved changes for a symbol.
 
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.
 
size_t GetDerivedSymbolNames(const wxString &aSymbolName, const wxString &aLibraryName, wxArrayString &aList)
Fetch all of the symbols derived from a aSymbolName into aList.
 
bool RevertAll()
Revert all pending changes.
 
SYMBOL_LIBRARY_MANAGER(SCH_BASE_FRAME &aFrame)
 
bool SymbolExists(const wxString &aSymbolName, const wxString &aLibrary) const
Return true if symbol with a specific alias exists in library (either original one or buffered).
 
SCH_BASE_FRAME & m_frame
Parent frame.
 
std::list< LIB_SYMBOL * > EnumerateSymbols(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.
 
std::map< wxString, LIB_BUFFER > m_libs
The library buffers.
 
bool UpdateLibraryBuffer(const wxString &aLibrary)
Update the library buffer with a new version of the library.