46 if( aUseCurrentSheetFilename )
51 fn.SetName( fn.GetName() + wxT(
"-cache" ) );
59 schematic.UpdateSymbolLinks();
76 archLib->EnableBuffering();
89 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
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 += wxT(
"\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 );
const wxString & GetFileName() 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
Define a library symbol object.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual const wxString What() const
A composite of Problem() and Where()
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
bool CreateArchiveLibraryCacheFile(bool aUseCurrentSheetFilename=false)
Create a symbol library file with the name of the root document plus the '-cache' suffix,...
Definition for symbol library class.
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
wxString GetUniStringLibId() const
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all symbols used in the current schematic.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Base class for any item which can be embedded within the SCHEMATIC container class,...
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
const LIB_ID & GetLibId() const