69 while( !loader.
Done() )
86 msg.Replace(
"\n",
"<BR>" );
96 for(
const std::pair<const wxString, LIB_BUFFER>& lib :
m_libs )
98 if( lib.second.IsModified() )
110 for(
const std::pair<const wxString, LIB_BUFFER>& lib :
m_libs )
111 hash += lib.second.GetHash();
119 const auto libBufIt =
m_libs.find( aLibrary );
121 if( libBufIt !=
m_libs.end() )
122 return libBufIt->second.GetHash();
127 return row ? std::hash<std::string>{}( aLibrary.ToStdString() +
136 for(
const wxString& libName :
symTable()->GetLogicalLibs() )
139 if(
GetLibrary( libName )->SchLibType() == SCH_IO_MGR::SCH_DATABASE )
159 wxLogMessage(
_(
"Library '%s' not found in the Symbol Library Table." ) + e.
What(),
168 SCH_IO_MGR::SCH_FILE_T aFileType )
170 wxCHECK( aFileType != SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY &&
LibraryExists( aLibrary ),
false );
171 wxFileName fn( aFileName );
172 wxCHECK( !fn.FileExists() || fn.IsFileWritable(),
false );
179 auto it =
m_libs.find( aLibrary );
186 const auto& symbolBuffers = libBuf.
GetBuffers();
188 for(
const auto& symbolBuf : symbolBuffers )
190 if( !libBuf.
SaveBuffer( symbolBuf, aFileName, &*pi,
true ) )
198 wxFileName original, destination( aFileName );
209 if(
res && original == destination )
221 if( symbol->IsAlias() )
223 std::shared_ptr< LIB_SYMBOL > oldParent = symbol->
GetParent().lock();
225 wxCHECK_MSG( oldParent,
false,
226 wxString::Format( wxT(
"Derived symbol '%s' found with undefined parent." ),
227 symbol->GetName() ) );
234 libParent =
new LIB_SYMBOL( *oldParent.get() );
235 pi->
SaveSymbol( aLibrary, libParent, &properties );
240 pi->
SaveSymbol( aLibrary, newSymbol, &properties );
242 else if( !pi->
LoadSymbol( aLibrary, symbol->GetName(), &properties ) )
272 auto it =
m_libs.find( aLibrary );
273 return it !=
m_libs.end() ? it->second.IsModified() :
false;
278 const wxString& aLibrary )
const
280 auto libIt =
m_libs.find( aLibrary );
282 if( libIt ==
m_libs.end() )
286 const std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER> symbolBuf = buf.
GetBuffer( aAlias );
287 return symbolBuf ? symbolBuf->IsModified() :
false;
292 const wxString& aLibrary )
294 auto libIt =
m_libs.find( aLibrary );
296 if( libIt ==
m_libs.end() )
300 std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER> symbolBuf = buf.
GetBuffer( aAlias );
302 wxCHECK( symbolBuf, );
304 symbolBuf->GetScreen()->SetContentModified();
310 auto libIt =
m_libs.find( aLibrary );
312 if( libIt ==
m_libs.end() )
315 for(
auto& symbolBuf : libIt->second.GetBuffers() )
328 const wxString& aLibrary )
const
330 auto libI =
m_libs.find( aLibrary );
332 if( libI ==
m_libs.end() )
335 auto symbolBuf = libI->second.GetBuffer( aAlias );
336 wxCHECK( symbolBuf,
false );
338 symbolBuf->GetScreen()->SetContentModified(
false );
361 std::list<LIB_SYMBOL*> ret;
364 auto libIt =
m_libs.find( aLibrary );
366 if( libIt !=
m_libs.end() )
368 for(
auto& symbolBuf : libIt->second.GetBuffers() )
370 ret.push_back( symbolBuf->GetSymbol() );
375 std::vector<LIB_SYMBOL*> aliases;
386 std::copy( aliases.begin(), aliases.end(), std::back_inserter( ret ) );
394 const wxString& aLibrary )
402 if( !bufferedSymbol )
409 if( symbol ==
nullptr )
417 std::shared_ptr< LIB_SYMBOL > parent = symbol->
GetParent().lock();
418 wxCHECK_MSG( parent,
nullptr,
419 wxString::Format(
"Derived symbol '%s' found with undefined parent.",
423 bufferedParent = libBuf.
GetSymbol( parent->GetName() );
425 if( !bufferedParent )
427 bufferedParent =
new LIB_SYMBOL( *parent.get() );
435 bufferedSymbol->
SetParent( bufferedParent );
441 wxLogMessage(
_(
"Error loading symbol %s from library '%s'. (%s)" ),
442 aAlias, aLibrary, e.
What() );
443 bufferedSymbol =
nullptr;
447 return bufferedSymbol;
454 wxCHECK( !aAlias.IsEmpty(),
nullptr );
455 auto it =
m_libs.find( aLibrary );
456 wxCHECK( it !=
m_libs.end(),
nullptr );
459 auto symbolBuf = buf.
GetBuffer( aAlias );
460 return symbolBuf ? symbolBuf->GetScreen() :
nullptr;
467 wxCHECK( aSymbol,
false );
475 wxCHECK( bufferedSymbol,
false );
477 *bufferedSymbol = *aSymbol;
478 symbolBuf->GetScreen()->SetContentModified();
496 const wxString& aLibrary )
499 auto symbolBuf = libBuf.
GetBuffer( aOldName );
501 wxCHECK( symbolBuf,
false );
512 auto it =
m_libs.find( aLibrary );
517 auto symbolBuf = it->second.GetBuffer( aAlias );
518 wxCHECK( symbolBuf,
false );
520 return it->second.SaveBuffer( symbolBuf,
symTable() );
526 auto it =
m_libs.find( aLibrary );
529 return LIB_ID( aLibrary, aAlias );
531 auto symbolBuf = it->second.GetBuffer( aAlias );
532 wxCHECK( symbolBuf,
LIB_ID( aLibrary, aAlias ) );
533 LIB_SYMBOL original( *symbolBuf->GetOriginal() );
535 if( original.
GetName() != aAlias )
542 *symbolBuf->GetSymbol() = original;
552 auto it =
m_libs.find( aLibrary );
572 for(
const auto& lib :
m_libs )
574 if( !lib.second.IsModified() )
577 for(
const auto& buffer : lib.second.GetBuffers() )
579 if( !buffer->IsModified() )
582 RevertSymbol( lib.first, buffer->GetOriginal()->GetName() );
593 auto symbolBuf = libBuf.
GetBuffer( aAlias );
594 wxCHECK( symbolBuf,
false );
606 const wxString& aLibrary )
const
609 auto libIt =
m_libs.find( aLibrary );
611 if( libIt !=
m_libs.end() )
613 LIB_SYMBOL* symbol = libIt->second.GetSymbol( aAlias );
628 wxLogMessage(
_(
"Cannot load symbol '%s' from library '%s'." ) + e.
What(),
639 auto libBufIt =
m_libs.find( aLibrary );
642 if( libBufIt !=
m_libs.end() )
643 return !!libBufIt->second.GetBuffer( aAlias );
654 return alias !=
nullptr;
660 if( aLibrary.IsEmpty() )
663 if(
m_libs.count( aLibrary ) > 0 )
672 wxString
name =
"New_Library";
679 for(
unsigned int i = 0; i < std::numeric_limits<unsigned int>::max(); ++i )
682 return name + wxString::Format(
"%u", i );
686 return wxEmptyString;
691 wxArrayString& aRootSymbolNames )
700 const wxString& aLibraryName )
716 wxFileName fn( aFilePath );
724 wxCHECK( aTable,
false );
738 wxCHECK( schFileType != SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY,
false );
765 std::set<LIB_SYMBOL*> symbols;
770 wxArrayString aliases;
773 for(
const auto& aliasName : aliases )
776 symbols.insert( alias );
781 wxLogMessage(
_(
"Cannot enumerate library '%s'." ) + e.
What(), aLibrary );
789 const wxString& aLibrary )
791 auto it =
m_libs.find( aLibrary );
804 if( symbol->IsAlias() )
806 std::shared_ptr< LIB_SYMBOL > oldParent = symbol->
GetParent().lock();
808 wxCHECK_MSG( oldParent, buf,
809 wxString::Format(
"Derived symbol '%s' found with undefined parent.",
810 symbol->GetName() ) );
816 libParent =
new LIB_SYMBOL( *oldParent.get() );
824 else if( !buf.
GetSymbol( symbol->GetName() ) )
841 catch(
const std::exception& e)
843 wxLogError(
_(
"Error updating library buffer: %s" ), e.what() );
848 wxLogError(
_(
"Error updating library buffer: %s" ), e.What() );
853 wxLogError(
_(
"Error updating library buffer." ) );
864 std::unique_ptr<SCH_SCREEN> aScreen ) :
865 m_screen(
std::
move( aScreen ) ),
881 wxCHECK( m_symbol != aSymbol, );
887 if( m_original->GetLibId().GetLibNickname() != m_symbol->GetLibId().GetLibNickname() )
889 m_original->
SetLibId(
LIB_ID( m_symbol->GetLibId().GetLibNickname(),
890 m_original->GetLibId().GetLibItemName() ) );
897 wxCHECK( m_original != aSymbol, );
900 m_original = aSymbol;
903 if( m_original->GetLibId().GetLibNickname() != m_symbol->GetLibId().GetLibNickname() )
905 m_original->
SetLibId(
LIB_ID( m_symbol->GetLibId().GetLibNickname(),
906 m_original->GetLibId().GetLibItemName() ) );
913 return m_screen && m_screen->IsContentModified();
919 auto buf = GetBuffer( aAlias );
926 wxCHECK( symbol,
nullptr );
935 wxASSERT( aCopy->
GetLib() ==
nullptr );
936 std::unique_ptr<SCH_SCREEN> screen( aScreen );
937 auto symbolBuf = std::make_shared<SYMBOL_BUFFER>( aCopy, std::move( screen ) );
938 m_symbols.push_back( symbolBuf );
954 wxCHECK( aCopy && aSymbolBuf,
false );
956 LIB_SYMBOL* bufferedSymbol = aSymbolBuf->GetSymbol();
958 wxCHECK( bufferedSymbol,
false );
960 *bufferedSymbol = *aCopy;
969 auto symbolBufIt = std::find( m_symbols.begin(), m_symbols.end(), aSymbolBuf );
970 wxCHECK( symbolBufIt != m_symbols.end(),
false );
975 if( aSymbolBuf->GetSymbol()->IsRoot() &&
HasDerivedSymbols( aSymbolBuf->GetSymbol()->GetName() )
976 && removeChildSymbols( aSymbolBuf ) == 0 )
981 m_deleted.emplace_back( *symbolBufIt );
982 m_symbols.erase( symbolBufIt );
992 wxCHECK( aSymbolBuf,
false );
993 LIB_SYMBOL* libSymbol = aSymbolBuf->GetSymbol();
994 LIB_SYMBOL* originalSymbol = aSymbolBuf->GetOriginal();
995 wxCHECK( libSymbol && originalSymbol,
false );
1000 wxString errorMsg =
_(
"Error saving symbol %s to library '%s'." ) + wxS(
"\n%s" );
1022 std::shared_ptr< LIB_SYMBOL > bufferedParent = libSymbol->
GetParent().lock();
1024 wxCHECK( bufferedParent,
false );
1030 cachedParent =
new LIB_SYMBOL( *bufferedParent.get() );
1031 newCachedSymbol->
SetParent( cachedParent );
1032 result = aLibTable->
SaveSymbol( m_libName, cachedParent );
1034 result = aLibTable->
SaveSymbol( m_libName, newCachedSymbol );
1038 aSymbolBuf->SetOriginal( originalParent );
1039 originalSymbol =
new LIB_SYMBOL( *libSymbol );
1040 originalSymbol->
SetParent( originalParent );
1041 aSymbolBuf->SetOriginal( originalSymbol );
1045 newCachedSymbol->
SetParent( cachedParent );
1046 result = aLibTable->
SaveSymbol( m_libName, newCachedSymbol );
1049 auto originalBufferedParent = GetBuffer( bufferedParent->GetName() );
1050 wxCHECK( originalBufferedParent,
false );
1051 originalSymbol =
new LIB_SYMBOL( *libSymbol );
1052 originalSymbol->
SetParent( originalBufferedParent->GetSymbol() );
1053 aSymbolBuf->SetOriginal( originalSymbol );
1058 wxArrayString derivedSymbols;
1060 if( GetDerivedSymbolNames( libSymbol->
GetName(), derivedSymbols ) == 0 )
1064 aSymbolBuf->SetOriginal(
new LIB_SYMBOL( *libSymbol ) );
1070 aLibTable->
SaveSymbol( m_libName, parentSymbol );
1072 for(
auto& entry : derivedSymbols )
1074 std::shared_ptr<SYMBOL_BUFFER> symbol = GetBuffer( entry );
1076 wxCHECK2( symbol,
continue );
1079 derivedSymbol->
SetParent( parentSymbol );
1080 result = aLibTable->
SaveSymbol( m_libName, derivedSymbol );
1092 const wxString& aFileName,
1095 wxCHECK( aSymbolBuf,
false );
1096 LIB_SYMBOL* libSymbol = aSymbolBuf->GetSymbol();
1097 LIB_SYMBOL* originalSymbol = aSymbolBuf->GetOriginal();
1098 wxCHECK( libSymbol && originalSymbol,
false );
1099 wxCHECK( !aFileName.IsEmpty(),
false );
1101 wxString errorMsg =
_(
"Error saving symbol %s to library '%s'." ) + wxS(
"\n%s" );
1126 std::shared_ptr< LIB_SYMBOL > bufferedParent = libSymbol->
GetParent().lock();
1128 wxCHECK( bufferedParent,
false );
1134 cachedParent = aPlugin->
LoadSymbol( aFileName, bufferedParent->GetName() );
1143 cachedParent =
new LIB_SYMBOL( *bufferedParent.get() );
1144 newCachedSymbol->
SetParent( cachedParent );
1148 aPlugin->
SaveSymbol( aFileName, cachedParent, aBuffer ? &properties :
nullptr );
1159 aPlugin->
SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties :
nullptr );
1169 aSymbolBuf->SetOriginal( originalParent );
1170 originalSymbol =
new LIB_SYMBOL( *libSymbol );
1171 originalSymbol->
SetParent( originalParent );
1172 aSymbolBuf->SetOriginal( originalSymbol );
1176 newCachedSymbol->
SetParent( cachedParent );
1180 aPlugin->
SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties :
nullptr );
1189 auto originalBufferedParent = GetBuffer( bufferedParent->GetName() );
1190 wxCHECK( originalBufferedParent,
false );
1191 originalSymbol =
new LIB_SYMBOL( *libSymbol );
1192 originalSymbol->
SetParent( originalBufferedParent->GetSymbol() );
1193 aSymbolBuf->SetOriginal( originalSymbol );
1198 wxArrayString derivedSymbols;
1200 if( GetDerivedSymbolNames( libSymbol->
GetName(), derivedSymbols ) == 0 )
1205 aBuffer ? &properties :
nullptr );
1214 aSymbolBuf->SetOriginal(
new LIB_SYMBOL( *libSymbol ) );
1223 aPlugin->
SaveSymbol( aFileName, parentSymbol, aBuffer ? &properties :
nullptr );
1232 aSymbolBuf->SetOriginal(
new LIB_SYMBOL( *libSymbol ) );
1235 for(
const wxString& entry : derivedSymbols )
1237 std::shared_ptr<SYMBOL_BUFFER> symbol = GetBuffer( entry );
1239 wxCHECK2( symbol,
continue );
1242 derivedSymbol->
SetParent( parentSymbol );
1247 aBuffer ? &properties :
nullptr );
1264std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER>
1267 for( std::shared_ptr<SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER> entry : m_symbols )
1269 if( entry->GetSymbol()->GetName() == aAlias )
1273 return std::shared_ptr<SYMBOL_BUFFER>(
nullptr );
1279 for(
auto& entry : m_symbols )
1281 if( entry->GetSymbol()->IsAlias() )
1286 wxCHECK( parent,
false );
1288 if( parent->GetName() == aParentName )
1299 for(
auto& entry : m_symbols )
1301 if( entry->GetSymbol()->IsAlias() )
1304 aRootSymbolNames.Add(
UnescapeString( entry->GetSymbol()->GetName() ) );
1310 wxArrayString& aList )
1312 wxCHECK( !aSymbolName.IsEmpty(), 0 );
1314 for(
auto& entry : m_symbols )
1316 if( entry->GetSymbol()->IsAlias() )
1321 wxCHECK( parent,
false );
1323 if( parent->GetName() == aSymbolName )
1324 aList.Add( entry->GetSymbol()->GetName() );
1328 return aList.GetCount();
1334 wxCHECK( aSymbolBuf && aSymbolBuf->GetSymbol()->IsRoot(), 0 );
1337 std::deque< std::shared_ptr<SYMBOL_BUFFER> >::iterator it = m_symbols.begin();
1339 while( it != m_symbols.end() )
1342 if( (*it)->GetSymbol()->IsRoot() )
1350 wxCHECK2( parent, ++it; continue );
1352 if( parent->GetName() == aSymbolBuf->GetSymbol()->GetName() )
1354 wxCHECK2( parent == aSymbolBuf->GetSymbol()->SharedPtr(), ++it;
continue );
1356 m_deleted.emplace_back( *it );
1357 it = m_symbols.erase( it );
void SetContentModified(bool aModified=true)
void MessageSet(const wxString &message)
Add a message (in bold) to message list.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
const UTF8 & GetLibItemName() const
Define a library symbol object.
LIB_ID GetLibId() const override
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
SYMBOL_LIB * GetLib() const
void SetLibId(const LIB_ID &aLibId)
LIB_SYMBOL_REF & GetParent()
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
bool RemoveRow(const LIB_TABLE_ROW *aRow)
Removes a row from the table.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A progress reporter interface for use in multi-threaded environments.
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a symbol library using the file extension of aLibPath.
static const char * PropBuffering
The property used internally by the plugin to enable cache buffering which prevents the library file ...
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Base class that schematic file and library loading and saving plugins should derive from.
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
virtual void SaveLibrary(const wxString &aFileName, const STRING_UTF8_MAP *aProperties=nullptr)
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const STRING_UTF8_MAP *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
A name/value tuple with unique names and optional values.
bool Done()
Returns a string containing any errors generated during the load.
const wxString & GetErrors() const
Represents a pair of <nickname, loaded parts list>
void Start()
Spins up threads to load all the libraries in m_nicknames.
bool Join()
Finalizes the threads and combines the output into the target output map.
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.
bool HasDerivedSymbols(const wxString &aParentName) const
Check to see any symbols in the buffer are derived from a parent named aParentName.
bool SaveBuffer(std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf, SYMBOL_LIB_TABLE *aLibTable)
Save stored modifications using a plugin.
void GetRootSymbolNames(wxArrayString &aRootSymbolNames)
Fetch a list of root symbols names from the library buffer.
const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & GetBuffers() const
int removeChildSymbols(std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf)
Remove all symbols derived from aParent from the library buffer.
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)
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.
SYMBOL_BUFFER(LIB_SYMBOL *aSymbol=nullptr, std::unique_ptr< SCH_SCREEN > aScreen=nullptr)
void SetOriginal(LIB_SYMBOL *aSymbol)
void SetSymbol(LIB_SYMBOL *aSymbol)
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)
void GetRootSymbolNames(const wxString &aLibName, wxArrayString &aRootSymbolNames)
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.
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 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.
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.
SYMBOL_LIBRARY_MANAGER(SCH_BASE_FRAME &aFrame)
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...
void LoadSymbolLib(std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
void DeleteSymbol(const wxString &aNickname, const wxString &aSymbolName)
Deletes the aSymbolName from the library given by aNickname.
bool IsSymbolLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
bool IsSymbolLibLoaded(const wxString &aNickname)
Return true if the library given by aNickname was successfully loaded.
void CreateSymbolLib(const wxString &aNickname)
void EnumerateSymbolLib(const wxString &aNickname, wxArrayString &aAliasNames, bool aPowerSymbolsOnly=false)
Return a list of symbol alias names contained within the library given by aNickname.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
SAVE_T SaveSymbol(const wxString &aNickname, const LIB_SYMBOL *aSymbol, bool aOverwrite=true)
Write aSymbol to an existing library given by aNickname.
SAVE_T
The set of return values from SaveSymbol() below.
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
#define THROW_IO_ERROR(msg)
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
wxString UnescapeString(const wxString &aSource)
Definition for symbol library class.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().