46 if( aUseCurrentSheetFilename )
51 fn.SetName( fn.GetName() + wxS(
"-cache" ) );
72 std::unique_ptr<SYMBOL_LIB> archLib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
76 archLib->EnableBuffering();
93 if( archLib->FindSymbol( symbol->
GetLibId() ) )
101 tmp.Printf(
_(
"Failed to add symbol %s to library file '%s'." ),
110 tmp =
_(
"Unexpected exception occurred." );
115 std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->
Flatten();
121 archLib->AddSymbol( flattenedSymbol.get() );
125 tmp.Printf(
_(
"Symbol %s not found in any library or cache." ),
131 if( errorMsg.empty() )
134 errorMsg += wxS(
"\n" ) + tmp;
139 if( !errorMsg.empty() )
141 tmp.Printf(
_(
"Errors occurred creating symbol library %s." ), aFileName );
145 archLib->EnableBuffering(
false );
149 archLib->Save(
false );
153 errorMsg.Printf(
_(
"Failed to save symbol library file '%s'." ), aFileName );
157 catch( std::exception& error )
159 errorMsg.Printf(
_(
"Failed to save symbol library file '%s'." ), aFileName );
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()
wxString GetUniStringLibId() const
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Define a library symbol object.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all symbols used in the current schematic.
bool CreateArchiveLibraryCacheFile(bool aUseCurrentSheetFilename=false)
Create a symbol library file with the name of the root document plus the '-cache' suffix,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void UpdateSymbolLinks(REPORTER *aReporter=nullptr)
Initialize the LIB_SYMBOL reference for each SCH_SYMBOL found in the full schematic.
const wxString & GetFileName() const
const LIB_ID & GetLibId() const
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
const std::string LegacySymbolLibFileExtension
Definition for symbol library class.
Definition of file extensions used in Kicad.