33#include <wx/filename.h>
48 return symbol->GetLibId();
57 m_frame->GetScreen()->SetContentModified( aModified );
77 if( libName.IsEmpty() )
85 return m_frame->SaveLibraryHeadless( libName );
115 m_frame->Revert( libId,
false );
121 return m_frame->LoadSymbol( aLibId, 1, 1 );
131 return std::make_shared<SYMBOL_EDIT_FRAME_CONTEXT>( aFrame );
137 wxFileName fn( aFileName );
140 if( !fn.IsOk() || !fn.IsDirWritable() )
143 if( fn.GetExt().IsEmpty() )
146 if( fn.FileExists() && ( !fn.IsFileWritable() || !aOverwrite ) )
151 if( pluginType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
152 pluginType = SCH_IO_MGR::SCH_KICAD;
161 if( !fn.FileExists() )
162 pi->CreateLibrary( fn.GetFullPath() );
164 pi->SaveSymbol( fn.GetFullPath(), std::make_unique<LIB_SYMBOL>( aSymbol ) );
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
A logical library item identifier and consists of various portions much like a URI.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Symbol library management helper that is specific to the symbol library editor frame.
Define a library symbol object.
const LIB_ID & GetLibId() const override
Container for project specific data.
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.
TOOL_MANAGER * GetToolManager() const override
SYMBOL_EDIT_FRAME * m_frame
bool SaveSymbolCopy(const wxString &aFileName, bool aOverwrite) override
Save a copy of the current symbol to the given library file, without user interaction.
LIB_SYMBOL * GetCurSymbol() const override
void SetContentModified(bool aModified=true) override
bool SaveSymbol() override
Save the current symbol to its library, without any user interaction.
SCH_SCREEN * GetScreen() const override
bool IsContentModified() const override
bool CanAcceptApiCommands() const override
SYMBOL_EDIT_FRAME_CONTEXT(SYMBOL_EDIT_FRAME *aFrame)
KIWAY * GetKiway() const override
LIB_ID GetLoadedLibId() const override
bool RevertSymbol() override
Reload the current symbol from its library, discarding unsaved changes.
PROJECT & Prj() const override
bool LoadSymbol(const LIB_ID &aLibId) override
Load a symbol into the editor (activating it for editing); false if not found.
The symbol library editor main window.
bool IsLibraryReadOnly(const wxString &aLibrary) const
Return true if the library is stored in a read-only file.
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).
static const std::string KiCadSymbolLibFileExtension
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
std::shared_ptr< SYMBOL_EDITOR_CONTEXT > CreateSymbolEditorFrameContext(SYMBOL_EDIT_FRAME *aFrame)
bool SaveSymbolCopyToFile(const LIB_SYMBOL &aSymbol, const wxString &aFileName, bool aOverwrite)
Shared implementation of SaveSymbolCopy for all contexts; writes the given symbol to a new library fi...
Definition of file extensions used in Kicad.