70 while( !loader.
Done() )
87 msg.Replace(
"\n",
"<BR>" );
99 if( buffer.IsModified() )
112 hash += buffer.GetHash();
120 const auto libBufIt =
m_libs.find( aLibrary );
122 if( libBufIt !=
m_libs.end() )
123 return libBufIt->second.GetHash();
128 return row ? std::hash<std::string>{}( aLibrary.ToStdString() +
137 for(
const wxString& libName :
symTable()->GetLogicalLibs() )
140 if(
GetLibrary( libName )->SchLibType() == SCH_IO_MGR::SCH_DATABASE )
162 msg.Printf(
_(
"Library '%s' not found in the Symbol Library Table." ), aLibrary );
171 SCH_IO_MGR::SCH_FILE_T aFileType )
173 wxCHECK( aFileType != SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY,
false );
175 wxString::Format(
"Library missing: %s", aLibrary ) );
177 wxFileName fn( aFileName );
178 wxCHECK( !fn.FileExists() || fn.IsFileWritable(),
false );
182 std::map<std::string, UTF8> properties;
186 auto it =
m_libs.find( aLibrary );
193 const auto& symbolBuffers = libBuf.
GetBuffers();
195 for(
const std::shared_ptr<SYMBOL_BUFFER>& symbolBuf : symbolBuffers )
197 wxCHECK2( symbolBuf,
continue );
198 if( !libBuf.
SaveBuffer( *symbolBuf, aFileName, &*pi,
true ) )
206 wxFileName original, destination( aFileName );
217 if(
res && original == destination )
229 if( symbol->IsAlias() )
231 std::shared_ptr< LIB_SYMBOL > oldParent = symbol->
GetParent().lock();
233 wxCHECK_MSG( oldParent,
false,
234 wxString::Format( wxT(
"Derived symbol '%s' found with "
235 "undefined parent." ),
236 symbol->GetName() ) );
238 LIB_SYMBOL* libParent = pi->LoadSymbol( aLibrary, oldParent->GetName(),
243 libParent =
new LIB_SYMBOL( *oldParent.get() );
244 pi->SaveSymbol( aLibrary, libParent, &properties );
249 pi->SaveSymbol( aLibrary, newSymbol, &properties );
251 else if( !pi->LoadSymbol( aLibrary, symbol->GetName(), &properties ) )
253 pi->SaveSymbol( aLibrary,
new LIB_SYMBOL( *symbol ), &properties );
266 pi->SaveLibrary( aFileName );
281 auto it =
m_libs.find( aLibrary );
282 return it !=
m_libs.end() ? it->second.IsModified() :
false;
287 const wxString& aLibrary )
const
289 auto libIt =
m_libs.find( aLibrary );
291 if( libIt ==
m_libs.end() )
295 const std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.
GetBuffer( aAlias );
297 return symbolBuf ? symbolBuf->IsModified() :
false;
303 auto libIt =
m_libs.find( aLibrary );
305 if( libIt ==
m_libs.end() )
309 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.
GetBuffer( aAlias );
311 wxCHECK( symbolBuf, );
313 symbolBuf->GetScreen()->SetContentModified();
319 auto libIt =
m_libs.find( aLibrary );
321 if( libIt ==
m_libs.end() )
324 for(
auto& symbolBuf : libIt->second.GetBuffers() )
337 const wxString& aLibrary )
const
339 auto libIt =
m_libs.find( aLibrary );
341 if( libIt ==
m_libs.end() )
344 auto symbolBuf = libIt->second.GetBuffer( aAlias );
345 wxCHECK( symbolBuf,
false );
347 symbolBuf->GetScreen()->SetContentModified(
false );
355 wxString::Format(
"Library missing: %s", aLibrary ) );
364 wxString::Format(
"Library missing: %s", aLibrary ) );
372 std::list<LIB_SYMBOL*> ret;
374 wxString::Format(
"Library missing: %s", aLibrary ) );
376 auto libIt =
m_libs.find( aLibrary );
378 if( libIt !=
m_libs.end() )
380 for(
const std::shared_ptr<SYMBOL_BUFFER>& symbolBuf : libIt->second.GetBuffers() )
381 ret.push_back( &symbolBuf->GetSymbol() );
385 std::vector<LIB_SYMBOL*> aliases;
396 std::copy( aliases.begin(), aliases.end(), std::back_inserter( ret ) );
404 const wxString& aLibrary )
407 wxString::Format(
"Library missing: %s, for alias %s", aLibrary, aAlias ) );
413 if( !bufferedSymbol )
420 if( symbol ==
nullptr )
428 std::shared_ptr<LIB_SYMBOL> parent = symbol->
GetParent().lock();
429 wxCHECK_MSG( parent,
nullptr,
430 wxString::Format(
"Derived symbol '%s' found with undefined parent.",
434 bufferedParent = libBuf.
GetSymbol( parent->GetName() );
436 if( !bufferedParent )
438 auto newParent = std::make_unique<LIB_SYMBOL>( *parent.get() );
439 bufferedParent = newParent.get();
440 libBuf.
CreateBuffer( std::move( newParent ), std::make_unique<SCH_SCREEN>() );
444 auto newSymbol = std::make_unique<LIB_SYMBOL>( *symbol );
445 bufferedSymbol = newSymbol.get();
450 libBuf.
CreateBuffer( std::move( newSymbol ), std::make_unique<SCH_SCREEN>() );
456 msg.Printf(
_(
"Error loading symbol %s from library '%s'." ), aAlias, aLibrary );
458 bufferedSymbol =
nullptr;
462 return bufferedSymbol;
469 wxString::Format(
"Library missing: %s, for alias %s", aLibrary, aAlias ) );
470 wxCHECK_MSG( !aAlias.IsEmpty(),
nullptr,
471 wxString::Format(
"Alias missing in library: %s", aLibrary ) );
472 auto it =
m_libs.find( aLibrary );
473 wxCHECK( it !=
m_libs.end(),
nullptr );
476 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.
GetBuffer( aAlias );
478 return symbolBuf ? symbolBuf->GetScreen() :
nullptr;
484 wxCHECK_MSG( aSymbol,
false, wxString::Format(
"Null symbol in library: %s", aLibrary ) );
486 wxString::Format(
"Library missing: %s, for smybol %s", aLibrary,
490 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = libBuf.
GetBuffer( aSymbol->
GetName() );
494 LIB_SYMBOL& bufferedSymbol = symbolBuf->GetSymbol();
498 bufferedSymbol = *aSymbol;
501 symbolBuf->GetScreen()->SetContentModified();
505 auto symbolCopy = std::make_unique<LIB_SYMBOL>( *aSymbol,
nullptr );
509 auto newScreen = std::make_unique<SCH_SCREEN>();
511 libBuf.
CreateBuffer( std::move( symbolCopy ), std::move( newScreen ) );
520 const wxString& aLibrary )
523 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = libBuf.
GetBuffer( aOldName );
525 wxCHECK( symbolBuf && aSymbol,
false );
536 auto it =
m_libs.find( aLibrary );
539 return LIB_ID( aLibrary, aAlias );
541 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = it->second.GetBuffer( aAlias );
542 wxCHECK( symbolBuf,
LIB_ID( aLibrary, aAlias ) );
543 LIB_SYMBOL original( symbolBuf->GetOriginal() );
545 if( original.
GetName() != aAlias )
552 symbolBuf->GetSymbol() = original;
562 auto it =
m_libs.find( aLibrary );
582 for(
const auto& lib :
m_libs )
584 if( !lib.second.IsModified() )
587 for(
const std::shared_ptr<SYMBOL_BUFFER>& buffer : lib.second.GetBuffers() )
589 if( !buffer->IsModified() )
592 RevertSymbol( lib.first, buffer->GetOriginal().GetName() );
603 std::shared_ptr<SYMBOL_BUFFER> symbolBuf = libBuf.
GetBuffer( aAlias );
604 wxCHECK( symbolBuf,
false );
616 const wxString& aLibrary )
const
619 auto libIt =
m_libs.find( aLibrary );
621 if( libIt !=
m_libs.end() )
623 LIB_SYMBOL* symbol = libIt->second.GetSymbol( aAlias );
640 msg.Printf(
_(
"Cannot load symbol '%s' from library '%s'." ), aAlias, aLibrary );
650 auto libBufIt =
m_libs.find( aLibrary );
653 if( libBufIt !=
m_libs.end() )
654 return !!libBufIt->second.GetBuffer( aAlias );
665 return alias !=
nullptr;
671 if( aLibrary.IsEmpty() )
674 if(
m_libs.count( aLibrary ) > 0 )
683 wxString
name =
"New_Library";
690 for(
unsigned int i = 0; i < std::numeric_limits<unsigned int>::max(); ++i )
693 return name + wxString::Format(
"%u", i );
697 return wxEmptyString;
702 wxArrayString& aSymbolNames,
712 const wxString& aLibraryName )
728 wxFileName fn( aFilePath );
744 if( schFileType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
745 schFileType = SCH_IO_MGR::SCH_LEGACY;
753 wxCHECK( schFileType != SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY,
false );
780 std::set<LIB_SYMBOL*> symbols;
785 wxArrayString aliases;
788 for(
const auto& aliasName : aliases )
791 symbols.insert( alias );
798 msg.Printf(
_(
"Cannot enumerate library '%s'." ), aLibrary );
808 auto it =
m_libs.find( aLibrary );
819 if( symbol->IsAlias() )
821 std::shared_ptr<LIB_SYMBOL> oldParent = symbol->GetParent().lock();
823 wxCHECK_MSG( oldParent, buf,
824 wxString::Format(
"Derived symbol '%s' found with undefined parent.",
825 symbol->GetName() ) );
831 auto newParent = std::make_unique<LIB_SYMBOL>( *oldParent.get() );
832 libParent = newParent.get();
833 buf.
CreateBuffer( std::move( newParent ), std::make_unique<SCH_SCREEN>() );
836 auto newSymbol = std::make_unique<LIB_SYMBOL>( *symbol );
837 newSymbol->SetParent( libParent );
838 buf.
CreateBuffer( std::move( newSymbol ), std::make_unique<SCH_SCREEN>() );
840 else if( !buf.
GetSymbol( symbol->GetName() ) )
842 buf.
CreateBuffer( std::make_unique<LIB_SYMBOL>( *symbol ),
843 std::make_unique<SCH_SCREEN>() );
858 catch(
const std::exception& e)
860 wxLogError(
_(
"Error updating library buffer: %s" ), e.what() );
865 wxLogError(
_(
"Error updating library buffer: %s" ), e.What() );
870 wxLogError(
_(
"Error updating library buffer." ) );
881 std::unique_ptr<SCH_SCREEN> aScreen ) :
882 m_screen(
std::
move( aScreen ) ), m_symbol(
std::
move( aSymbol ) )
902 if(
m_original->GetLibId().GetLibNickname() !=
m_symbol->GetLibId().GetLibNickname() )
917 if(
m_original->GetLibId().GetLibNickname() !=
m_symbol->GetLibId().GetLibNickname() )
944 std::unique_ptr<SCH_SCREEN> aScreen )
947 wxASSERT( aCopy->GetLib() ==
nullptr );
951 LIB_ID libId = aCopy->GetLibId();
953 aCopy->SetLibId( libId );
955 auto symbolBuf = std::make_shared<SYMBOL_BUFFER>( std::move( aCopy ), std::move( aScreen ) );
968 bufferedSymbol = aCopy;
977 const auto sameBufferPredicate = [&](
const std::shared_ptr<SYMBOL_BUFFER>& aBuf )
979 return aBuf.get() == &aSymbolBuf;
982 auto symbolBufIt = std::find_if(
m_symbols.begin(),
m_symbols.end(), sameBufferPredicate );
983 wxCHECK( symbolBufIt !=
m_symbols.end(),
false );
1005 wxCHECK( !aFileName.IsEmpty(),
false );
1007 wxString errorMsg =
_(
"Error saving symbol %s to library '%s'." ) + wxS(
"\n%s" );
1010 std::map<std::string, UTF8> properties;
1017 const wxString originalName = originalSymbol.
GetName();
1024 if( aPlugin->
LoadSymbol( aFileName, originalName ) )
1025 aPlugin->
DeleteSymbol( aFileName, originalName, &properties );
1040 std::shared_ptr<LIB_SYMBOL> bufferedParent = libSymbol.
GetParent().lock();
1041 parentSymbol = newCachedSymbol;
1043 wxCHECK( bufferedParent,
false );
1049 cachedParent = aPlugin->
LoadSymbol( aFileName, bufferedParent->GetName() );
1058 cachedParent =
new LIB_SYMBOL( *bufferedParent.get() );
1059 newCachedSymbol->
SetParent( cachedParent );
1063 aPlugin->
SaveSymbol( aFileName, cachedParent, aBuffer ? &properties :
nullptr );
1074 aPlugin->
SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties :
nullptr );
1083 auto originalParent = std::make_unique<LIB_SYMBOL>( *bufferedParent.get() );
1085 aSymbolBuf.
SetOriginal( std::move( originalParent ) );
1087 auto newSymbol = std::make_unique<LIB_SYMBOL>( libSymbol );
1088 newSymbol->SetParent( &parentRef );
1093 newCachedSymbol->
SetParent( cachedParent );
1097 aPlugin->
SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties :
nullptr );
1106 auto originalBufferedParent =
GetBuffer( bufferedParent->GetName() );
1107 wxCHECK( originalBufferedParent,
false );
1109 auto newSymbol = std::make_unique<LIB_SYMBOL>( libSymbol );
1110 newSymbol->SetParent( &originalBufferedParent->GetSymbol() );
1120 aPlugin->
SaveSymbol( aFileName, parentSymbol, aBuffer ? &properties :
nullptr );
1128 aSymbolBuf.
SetOriginal( std::make_unique<LIB_SYMBOL>( libSymbol ) );
1131 wxArrayString derivedSymbols;
1137 for(
const wxString& entry : derivedSymbols )
1139 std::shared_ptr<SYMBOL_BUFFER> symbol =
GetBuffer( entry );
1141 wxCHECK2( symbol,
continue );
1144 derivedSymbol->
SetParent( parentSymbol );
1149 aBuffer ? &properties :
nullptr );
1167 for( std::shared_ptr<SYMBOL_BUFFER> entry :
m_symbols )
1169 if( entry->GetSymbol().GetName() == aAlias )
1173 return std::shared_ptr<SYMBOL_BUFFER>(
nullptr );
1179 for(
const std::shared_ptr<SYMBOL_BUFFER>& entry :
m_symbols )
1181 if( entry->GetSymbol().IsAlias() )
1186 wxCHECK( parent,
false );
1188 if( parent->GetName() == aParentName )
1199 for( std::shared_ptr<SYMBOL_BUFFER>& entry :
m_symbols )
1201 const LIB_SYMBOL& symbol = entry->GetSymbol();
1202 if( ( symbol.
IsAlias() && ( aFilter == SYMBOL_NAME_FILTER::ROOT_ONLY ) )
1203 || ( symbol.
IsRoot() && ( aFilter == SYMBOL_NAME_FILTER::DERIVED_ONLY ) ) )
1214 wxCHECK( !aSymbolName.IsEmpty(), 0 );
1216 for( std::shared_ptr<SYMBOL_BUFFER>& entry :
m_symbols )
1218 const LIB_SYMBOL& symbol = entry->GetSymbol();
1224 wxCHECK2( parent,
continue );
1226 if( parent->GetName() == aSymbolName )
1228 aList.Add( symbol.
GetName() );
1235 return aList.GetCount();
1242 wxArrayString derivedSymbolNames;
1243 std::deque<std::shared_ptr<SYMBOL_BUFFER>>::iterator it;
1247 for(
const wxString& symbolName : derivedSymbolNames )
1250 [symbolName]( std::shared_ptr<SYMBOL_BUFFER>& buf )
1252 return buf->GetSymbol().GetName() == symbolName;
1255 wxCHECK2( it !=
m_symbols.end(),
continue );
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.
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)
Update the buffered symbol with the contents of aCopy.
bool DeleteBuffer(const SYMBOL_BUFFER &aSymbolBuf)
Delete the given symbol buffer from the library buffer.
void ClearDeletedBuffer()
Save stored modifications using a plugin.
void GetSymbolNames(wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
Fetch a list of root symbols names from the library buffer.
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)
Return a symbol buffer with LIB_SYMBOL holding a symbolicular alias.
const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & GetBuffers() const
std::shared_ptr< SYMBOL_BUFFER > GetBuffer(const wxString &aAlias) const
Return all buffered symbols.
LIB_SYMBOL * GetSymbol(const wxString &aAlias) const
Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
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)
const wxString m_libName
Buffered library name.
A logical library item identifier and consists of various portions much like a URI.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
const UTF8 & GetLibItemName() const
Define a library symbol object.
const LIB_ID & GetLibId() const override
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
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 and frees the pointer.
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).
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
static const char * PropBuffering
The property used internally by the plugin to enable cache buffering which prevents the library file ...
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, int aCtl=0)
Return a plugin type given a symbol library using the file extension of aLibPath.
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 std::map< std::string, UTF8 > *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
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.
Store a working copy of a library.
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
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)
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 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).
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
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.
virtual void OnDataChanged() const
Extract library name basing on the file name.
bool addLibrary(const wxString &aFilePath, bool aCreate, SYMBOL_LIB_TABLE &aTable)
Return the current Symbol 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.
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
The library buffers.
bool UpdateLibraryBuffer(const wxString &aLibrary)
Update the library buffer with a new version of the library.
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_IO object i...
void LoadSymbolLib(std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
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.
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...
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
#define THROW_IO_ERROR(msg)
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
PGM_BASE & Pgm()
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().