KiCad PCB EDA Suite
|
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format. More...
#include <sch_sexpr_plugin.h>
Public Member Functions | |
SCH_SEXPR_PLUGIN () | |
virtual | ~SCH_SEXPR_PLUGIN () |
const wxString | GetName () const override |
Return a brief hard coded name for this SCH_PLUGIN. More... | |
const wxString | GetFileExtension () const override |
Return the file extension for the SCH_PLUGIN. More... | |
const wxString | GetLibraryFileExtension () const override |
Return the library file extension for the SCH_PLUGIN object. More... | |
void | SetProgressReporter (PROGRESS_REPORTER *aReporter) override |
Set an optional progress reporter. More... | |
int | GetModifyHash () const override |
Return the modification hash from the library cache. More... | |
SCH_SHEET * | Load (const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr) override |
Load information from some input file format that this SCH_PLUGIN implementation knows about, into either a new SCH_SHEET or an existing one. More... | |
void | LoadContent (LINE_READER &aReader, SCH_SHEET *aSheet, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION) |
void | Save (const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr) override |
Write aSchematic to a storage file in a format that this SCH_PLUGIN implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file. More... | |
void | Format (SCH_SHEET *aSheet) |
void | Format (EE_SELECTION *aSelection, SCH_SHEET_PATH *aSelectionPath, SCHEMATIC &aSchematic, OUTPUTFORMATTER *aFormatter, bool aForClipboard) |
void | EnumerateSymbolLib (wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override |
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath. More... | |
void | EnumerateSymbolLib (std::vector< LIB_SYMBOL * > &aSymbolList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override |
Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath. More... | |
LIB_SYMBOL * | LoadSymbol (const wxString &aLibraryPath, const wxString &aAliasName, const STRING_UTF8_MAP *aProperties=nullptr) override |
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_PLUGIN knows about. More... | |
void | SaveSymbol (const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr) override |
Write aSymbol to an existing library located at aLibraryPath. More... | |
void | DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr) override |
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath. More... | |
void | CreateSymbolLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override |
Create a new empty symbol library at aLibraryPath. More... | |
bool | DeleteSymbolLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override |
Delete an existing symbol library and returns true if successful, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason. More... | |
void | SaveLibrary (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override |
bool | CheckHeader (const wxString &aFileName) override |
Return true if the first line in aFileName begins with the expected header. More... | |
bool | IsSymbolLibWritable (const wxString &aLibraryPath) override |
Return true if the library at aLibraryPath is writable. More... | |
void | GetAvailableSymbolFields (std::vector< wxString > &aNames) override |
Retrieves a list of (custom) field names that are present on symbols in this library. More... | |
void | GetDefaultSymbolFields (std::vector< wxString > &aNames) override |
Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser. More... | |
const wxString & | GetError () const override |
Return an error string to the caller. More... | |
virtual void | SetReporter (REPORTER *aReporter) |
Set an optional reporter for warnings/errors. More... | |
virtual void | SymbolLibOptions (STRING_UTF8_MAP *aListToAppendTo) const |
Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions. More... | |
virtual bool | SupportsSubLibraries () const |
virtual void | GetSubLibraryNames (std::vector< wxString > &aNames) |
Retrieves a list of sub-libraries in this library. More... | |
virtual void | SetLibTable (SYMBOL_LIB_TABLE *aTable) |
Some library plugins need to have access to their parent library table. More... | |
Static Public Member Functions | |
static LIB_SYMBOL * | ParseLibSymbol (LINE_READER &aReader, int aVersion=SEXPR_SCHEMATIC_FILE_VERSION) |
static void | FormatLibSymbol (LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter) |
Static Public Attributes | |
static const char * | PropBuffering = "buffering" |
The property used internally by the plugin to enable cache buffering which prevents the library file from being written every time the cache is changed. More... | |
Protected Member Functions | |
void | init (SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr) |
initialize PLUGIN like a constructor would. More... | |
Protected Attributes | |
int | m_version |
Version of file being loaded. More... | |
int | m_nextFreeFieldId |
bool | m_appending |
Schematic load append status. More... | |
wxString | m_error |
For throwing exceptions or errors on partial loads. More... | |
PROGRESS_REPORTER * | m_progressReporter |
wxString | m_path |
Root project path for loading child sheets. More... | |
std::stack< wxString > | m_currentPath |
Stack to maintain nested sheet paths. More... | |
SCH_SHEET * | m_rootSheet |
The root sheet of the schematic being loaded. More... | |
SCH_SHEET_PATH | m_currentSheetPath |
SCHEMATIC * | m_schematic |
OUTPUTFORMATTER * | m_out |
The formatter for saving SCH_SCREEN objects. More... | |
SCH_SEXPR_PLUGIN_CACHE * | m_cache |
Private Member Functions | |
void | loadHierarchy (const SCH_SHEET_PATH &aParentSheetPath, SCH_SHEET *aSheet) |
void | loadFile (const wxString &aFileName, SCH_SHEET *aSheet) |
void | saveSymbol (SCH_SYMBOL *aSymbol, const SCHEMATIC &aSchematic, int aNestLevel, bool aForClipboard) |
void | saveField (SCH_FIELD *aField, int aNestLevel) |
void | saveBitmap (SCH_BITMAP *aBitmap, int aNestLevel) |
void | saveSheet (SCH_SHEET *aSheet, int aNestLevel) |
void | saveJunction (SCH_JUNCTION *aJunction, int aNestLevel) |
void | saveNoConnect (SCH_NO_CONNECT *aNoConnect, int aNestLevel) |
void | saveBusEntry (SCH_BUS_ENTRY_BASE *aBusEntry, int aNestLevel) |
void | saveLine (SCH_LINE *aLine, int aNestLevel) |
void | saveShape (SCH_SHAPE *aShape, int aNestLevel) |
void | saveText (SCH_TEXT *aText, int aNestLevel) |
void | saveTextBox (SCH_TEXTBOX *aText, int aNestLevel) |
void | saveBusAlias (std::shared_ptr< BUS_ALIAS > aAlias, int aNestLevel) |
void | saveInstances (const std::vector< SCH_SHEET_INSTANCE > &aSheets, int aNestLevel) |
void | cacheLib (const wxString &aLibraryFileName, const STRING_UTF8_MAP *aProperties) |
bool | isBuffering (const STRING_UTF8_MAP *aProperties) |
A SCH_PLUGIN derivation for loading schematic files using the new s-expression file format.
As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.
Definition at line 62 of file sch_sexpr_plugin.h.
SCH_SEXPR_PLUGIN::SCH_SEXPR_PLUGIN | ( | ) |
Definition at line 75 of file sch_sexpr_plugin.cpp.
References init().
|
virtual |
|
private |
Definition at line 1408 of file sch_sexpr_plugin.cpp.
References isBuffering(), SCH_LIB_PLUGIN_CACHE::IsFile(), SCH_LIB_PLUGIN_CACHE::IsFileChanged(), SCH_SEXPR_PLUGIN_CACHE::Load(), and m_cache.
Referenced by DeleteSymbol(), EnumerateSymbolLib(), LoadSymbol(), and SaveSymbol().
|
overridevirtual |
Return true if the first line in aFileName begins with the expected header.
aFileName | is the name of the file to use as input |
Reimplemented from SCH_PLUGIN.
Definition at line 1589 of file sch_sexpr_plugin.cpp.
|
overridevirtual |
Create a new empty symbol library at aLibraryPath.
It is an error to attempt to create an existing library or to attempt to create on a "read only" location.
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing several footprints. |
aProperties | is an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem finding the library, or creating it. |
Reimplemented from SCH_PLUGIN.
Definition at line 1525 of file sch_sexpr_plugin.cpp.
References _, Format(), SCH_SEXPR_PLUGIN_CACHE::Load(), m_cache, SCH_SEXPR_PLUGIN_CACHE::Save(), SCH_LIB_PLUGIN_CACHE::SetModified(), and THROW_IO_ERROR.
|
overridevirtual |
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing several symbols. |
aSymbolName | is the name of a LIB_SYMBOL associated with it's root LIB_SYMBOL object to delete from the specified library. |
aProperties | is an associative array that can be used to tell the library delete function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem finding the alias or the library or deleting it. |
Reimplemented from SCH_PLUGIN.
Definition at line 1511 of file sch_sexpr_plugin.cpp.
References cacheLib(), SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol(), isBuffering(), m_cache, and SCH_SEXPR_PLUGIN_CACHE::Save().
|
overridevirtual |
Delete an existing symbol library and returns true if successful, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
aLibraryPath | is a locator for the "library", usually a directory or file which will contain symbols. |
aProperties | is an associative array that can be used to tell the library delete implementation function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem deleting an existing library. |
Reimplemented from SCH_PLUGIN.
Definition at line 1544 of file sch_sexpr_plugin.cpp.
References _, Format(), SCH_LIB_PLUGIN_CACHE::IsFile(), m_cache, and THROW_IO_ERROR.
|
overridevirtual |
Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.
aSymbolList | is an array to populate with the LIB_SYMBOL pointers associated with the library. |
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects. |
aProperties | is an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if the library cannot be found, the part library cannot be loaded. |
Reimplemented from SCH_PLUGIN.
Definition at line 1460 of file sch_sexpr_plugin.cpp.
References cacheLib(), m_cache, SCH_LIB_PLUGIN_CACHE::m_symbols, and SYMBOL_LIB_TABLE::PropPowerSymsOnly.
|
overridevirtual |
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
aSymbolNameList | is an array to populate with the LIB_SYMBOL names associated with the library. |
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects. |
aProperties | is an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if the library cannot be found, the part library cannot be loaded. |
Reimplemented from SCH_PLUGIN.
Definition at line 1439 of file sch_sexpr_plugin.cpp.
References cacheLib(), m_cache, SCH_LIB_PLUGIN_CACHE::m_symbols, and SYMBOL_LIB_TABLE::PropPowerSymsOnly.
void SCH_SEXPR_PLUGIN::Format | ( | EE_SELECTION * | aSelection, |
SCH_SHEET_PATH * | aSelectionPath, | ||
SCHEMATIC & | aSchematic, | ||
OUTPUTFORMATTER * | aFormatter, | ||
bool | aForClipboard | ||
) |
Definition at line 498 of file sch_sexpr_plugin.cpp.
References SCH_SHEET_PATH::AppendSymbol(), LIB_ID::Format(), SELECTION::GetItem(), SCH_SYMBOL::GetLibId(), SCH_SCREEN::GetLibSymbols(), SCH_SYMBOL::GetSchSymbolLibraryName(), EE_SELECTION::GetScreen(), SCH_SHEET_LIST::GetSheetInstances(), SCHEMATIC::GetSheets(), SCH_SHEET_LIST::GetSheetsWithinPath(), SELECTION::GetSize(), SCH_REFERENCE_LIST::GetSymbolInstances(), SCH_SHEET_LIST::GetSymbolsWithinPath(), m_out, m_schematic, SCH_SHEET_PATH::Path(), OUTPUTFORMATTER::Print(), SCH_SHEET_PATH::push_back(), saveBitmap(), saveBusEntry(), saveJunction(), saveLine(), saveNoConnect(), saveShape(), saveSheet(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), saveSymbol(), saveText(), saveTextBox(), SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHAPE_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_TEXTBOX_T, SCH_SHEET_LIST::SortByPageNumbers(), SCH_REFERENCE_LIST::SortByReferenceOnly(), EDA_ITEM::Type(), SCH_SYMBOL::UseLibIdLookup(), and UTF8::wx_str().
void SCH_SEXPR_PLUGIN::Format | ( | SCH_SHEET * | aSheet | ) |
Definition at line 358 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), PAGE_INFO::Format(), TITLE_BLOCK::Format(), SCH_SCREEN::GetBusAliases(), SCH_SCREEN::GetLibSymbols(), SCH_SCREEN::GetPageSettings(), SCH_SHEET::GetRootInstance(), SCH_SHEET::GetScreen(), SCH_SCREEN::GetTitleBlock(), SCH_SHEET::HasRootInstance(), SCH_SCREEN::Items(), m_out, m_schematic, SCH_SCREEN::m_uuid, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), saveBitmap(), saveBusAlias(), saveBusEntry(), saveInstances(), saveJunction(), saveLine(), saveNoConnect(), saveShape(), saveSheet(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), saveSymbol(), saveText(), saveTextBox(), SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LAYER_ID_START, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_SHAPE_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_TEXTBOX_T, SEXPR_SCHEMATIC_FILE_VERSION, TO_UTF8, EDA_ITEM::Type(), and TYPE_NOT_INIT.
Referenced by SCH_EDITOR_CONTROL::doCopy(), and Save().
|
static |
Definition at line 1660 of file sch_sexpr_plugin.cpp.
References SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().
Referenced by SYMBOL_EDITOR_EDIT_TOOL::Copy(), and SYMBOL_EDIT_FRAME::CopySymbolToClipboard().
|
overridevirtual |
Retrieves a list of (custom) field names that are present on symbols in this library.
The plugin is responsible for guaranteeing that this list contains the set of unique custom field names present on any symbols contained in the library.
The required KiCad fields are not included in this list.
aNames | will be filled with any custom fields present in this library. |
Reimplemented from SCH_PLUGIN.
Definition at line 1612 of file sch_sexpr_plugin.cpp.
References m_cache, and SCH_LIB_PLUGIN_CACHE::m_symbols.
Referenced by GetDefaultSymbolFields().
|
overridevirtual |
Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.
This list should be a subset of the result returned by GetAvailableSymbolFields().
The preference for which fields to hide and show for a given library is stored on a per-library basis in a user's preferences (or in the project local settings for a project- local library). The set of fields returned by GetDefaultSymbolFields() will be used if this preference is missing.
aNames | will be filled with the custom field names that should be shown by default |
Reimplemented from SCH_PLUGIN.
Definition at line 1641 of file sch_sexpr_plugin.cpp.
References GetAvailableSymbolFields().
|
inlineoverridevirtual |
Return an error string to the caller.
This is useful for schematic loaders that can load partial schematics where throwing an exception would be problematic such as the KiCad legacy plugin.
Reimplemented from SCH_PLUGIN.
Definition at line 138 of file sch_sexpr_plugin.h.
References m_error.
|
inlineoverridevirtual |
Return the file extension for the SCH_PLUGIN.
Implements SCH_PLUGIN.
Definition at line 74 of file sch_sexpr_plugin.h.
|
inlineoverridevirtual |
Return the library file extension for the SCH_PLUGIN object.
Implements SCH_PLUGIN.
Definition at line 79 of file sch_sexpr_plugin.h.
|
overridevirtual |
Return the modification hash from the library cache.
Implements SCH_PLUGIN.
Definition at line 1429 of file sch_sexpr_plugin.cpp.
References SCH_LIB_PLUGIN_CACHE::GetModifyHash(), and m_cache.
|
inlineoverridevirtual |
Return a brief hard coded name for this SCH_PLUGIN.
Implements SCH_PLUGIN.
Definition at line 69 of file sch_sexpr_plugin.h.
|
inlinevirtualinherited |
Retrieves a list of sub-libraries in this library.
Some types of symbol library support sub-libraries, which are a single-level organizational hierarchy that is implementation-defined per plugin. Most of KiCad ignores sub-libraries and treats the hierarchy between library and symbol as flat, but the sub-libraries are used for sorting and grouping symbols in the symbol chooser.
Has no effect if SupportsSubLibraries() returns false.
aNames | will be filled with a list of sub-libraries within this symbol library |
Reimplemented in SCH_DATABASE_PLUGIN.
Definition at line 463 of file sch_io_mgr.h.
Referenced by SYMBOL_LIB_TABLE_ROW::GetSubLibraryNames().
|
protected |
initialize PLUGIN like a constructor would.
Definition at line 88 of file sch_sexpr_plugin.cpp.
References m_appending, m_cache, m_nextFreeFieldId, m_out, m_rootSheet, m_schematic, and m_version.
Referenced by Load(), Save(), and SCH_SEXPR_PLUGIN().
|
private |
Definition at line 1423 of file sch_sexpr_plugin.cpp.
References STRING_UTF8_MAP::Exists(), and PropBuffering.
Referenced by cacheLib(), DeleteSymbol(), and SaveSymbol().
|
overridevirtual |
Return true if the library at aLibraryPath is writable.
(Often system libraries are read only because of where they are installed.)
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing several symbols. |
IO_ERROR | if no library at aLibraryPath exists. |
Reimplemented from SCH_PLUGIN.
Definition at line 1604 of file sch_sexpr_plugin.cpp.
|
overridevirtual |
Load information from some input file format that this SCH_PLUGIN implementation knows about, into either a new SCH_SHEET or an existing one.
This may be used to load an entire new SCH_SHEET, or to augment an existing one if aAppendToMe is not NULL.
aFileName | is the name of the file to use as input and may be foreign in nature or native in nature. |
aKiway | is the KIWAY object used to access the symbol libraries loaded by the project. |
aAppendToMe | is an existing SCH_SHEET to append to, but if NULL then this means "do not append, rather load anew". |
aProperties | is an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible. |
Reimplemented from SCH_PLUGIN.
Definition at line 100 of file sch_sexpr_plugin.cpp.
References SCH_SHEET::GetFileName(), PROJECT::GetProjectPath(), init(), SCHEMATIC::IsValid(), loadHierarchy(), m_appending, m_currentPath, m_path, m_rootSheet, SCHEMATIC::Prj(), SCHEMATIC::Root(), and traceSchPlugin.
void SCH_SEXPR_PLUGIN::LoadContent | ( | LINE_READER & | aReader, |
SCH_SHEET * | aSheet, | ||
int | aVersion = SEXPR_SCHEMATIC_FILE_VERSION |
||
) |
Definition at line 320 of file sch_sexpr_plugin.cpp.
References SCH_SEXPR_PARSER::ParseSchematic().
Referenced by SCH_EDITOR_CONTROL::Paste().
|
private |
Definition at line 295 of file sch_sexpr_plugin.cpp.
References _, Format(), PROGRESS_REPORTER::KeepRefreshing(), m_appending, m_progressReporter, m_rootSheet, SCH_SEXPR_PARSER::ParseSchematic(), FILE_LINE_READER::ReadLine(), PROGRESS_REPORTER::Report(), FILE_LINE_READER::Rewind(), and THROW_IO_ERROR.
Referenced by loadHierarchy().
|
private |
Definition at line 179 of file sch_sexpr_plugin.cpp.
References _, SCH_SHEET_PATH::at(), SCH_SHEET_PATH::empty(), Format(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), SCH_SHEET::GetScreen(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), loadFile(), loadHierarchy(), m_currentPath, m_currentSheetPath, m_error, m_rootSheet, m_schematic, EE_RTREE::OfType(), SCH_SHEET_PATH::pop_back(), SCH_SHEET_PATH::push_back(), SCH_SHEET_T, SCH_SHEET::SearchHierarchy(), SCH_SCREEN::SetFileExists(), SCH_SCREEN::SetFileName(), SCH_SCREEN::SetFileReadOnly(), EDA_ITEM::SetParent(), SCH_SHEET::SetScreen(), traceSchPlugin, and IO_ERROR::What().
Referenced by Load(), and loadHierarchy().
|
overridevirtual |
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_PLUGIN knows about.
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing several symbols. |
aPartName | is the name of the LIB_SYMBOL to load. |
aProperties | is an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if the library cannot be found or read. No exception is thrown in the case where aAliasName cannot be found. |
Reimplemented from SCH_PLUGIN.
Definition at line 1481 of file sch_sexpr_plugin.cpp.
References cacheLib(), m_cache, and SCH_LIB_PLUGIN_CACHE::m_symbols.
|
static |
Definition at line 1647 of file sch_sexpr_plugin.cpp.
References SCH_SEXPR_PARSER::ParseSymbol().
Referenced by SYMBOL_EDIT_FRAME::DuplicateSymbol(), and SYMBOL_EDITOR_EDIT_TOOL::Paste().
|
overridevirtual |
Write aSchematic to a storage file in a format that this SCH_PLUGIN implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.
aFileName | is the name of a file to save to on disk. |
aSheet | is the class SCH_SHEET in memory document tree from which to extract information when writing to aFileName. The caller continues to own the SCHEMATIC, and the plugin should refrain from modifying the SCHEMATIC if possible. |
aSchematic | is the SCHEMATIC object used to access any schematic-wide or project information needed to save the document. |
aProperties | is an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. Set the #PropSaveCurrentSheetOnly property to only save the current sheet. Otherwise, all hierarchical sheets are saved. |
IO_ERROR | if there is a problem saving or exporting. |
Reimplemented from SCH_PLUGIN.
Definition at line 331 of file sch_sexpr_plugin.cpp.
References Format(), SCH_SHEET::GetScreen(), init(), m_out, and SCH_SCREEN::SetFileExists().
Referenced by KI_TEST::DumpSchematicToFile().
|
private |
Definition at line 909 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_BITMAP::GetImage(), BITMAP_BASE::GetImageData(), SCH_BITMAP::GetPosition(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), image, m_out, EDA_ITEM::m_Uuid, MIME_BASE64_LENGTH, OUTPUTFORMATTER::Print(), scale, schIUScale, SEXPR_SCHEMATIC_FILE_VERSION, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
private |
Definition at line 1363 of file sch_sexpr_plugin.cpp.
References m_out, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), and TO_UTF8.
Referenced by Format().
|
private |
Definition at line 1142 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_ITEM::GetClass(), SCH_BUS_ENTRY_BASE::GetEnd(), SCH_BUS_ENTRY_BASE::GetPosition(), SCH_BUS_ENTRY_BASE::GetSize(), SCH_BUS_ENTRY_BASE::GetStroke(), LAYER_BUS, m_out, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), saveLine(), schIUScale, SCH_LINE::SetEndPoint(), TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
private |
Definition at line 862 of file sch_sexpr_plugin.cpp.
References SCH_FIELD::CanAutoplace(), DEFAULT_SIZE_TEXT, EDA_TEXT::Format(), EDA_UNIT_UTILS::FormatAngle(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_FIELD::GetCanonicalName(), SCH_FIELD::GetId(), SCH_FIELD::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextHeight(), EDA_TEXT::IsDefaultFormatting(), SCH_FIELD::IsNameShown(), m_nextFreeFieldId, m_out, EDA_IU_SCALE::MilsToIU(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, SCH_FIELD::SetId(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSheet(), saveSymbol(), and saveText().
|
private |
Definition at line 1383 of file sch_sexpr_plugin.cpp.
References m_out, path, OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().
Referenced by Format().
|
private |
Definition at line 1107 of file sch_sexpr_plugin.cpp.
References KIGFX::COLOR4D::a, KIID::AsString(), KIGFX::COLOR4D::b, FormatDouble2Str(), EDA_UNIT_UTILS::FormatInternalUnits(), KIGFX::COLOR4D::g, SCH_JUNCTION::GetColor(), SCH_JUNCTION::GetDiameter(), SCH_JUNCTION::GetPosition(), KiROUND(), m_out, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), KIGFX::COLOR4D::r, schIUScale, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
overridevirtual |
Reimplemented from SCH_PLUGIN.
Definition at line 1570 of file sch_sexpr_plugin.cpp.
References SCH_LIB_PLUGIN_CACHE::GetFileName(), SCH_LIB_PLUGIN_CACHE::IsFile(), m_cache, SCH_SEXPR_PLUGIN_CACHE::Save(), SCH_LIB_PLUGIN_CACHE::SetFileName(), and SCH_LIB_PLUGIN_CACHE::SetModified().
|
private |
Definition at line 1214 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_LINE::GetEndPoint(), SCH_ITEM::GetLayer(), SCH_LINE::GetStartPoint(), SCH_LINE::GetStroke(), LAYER_BUS, LAYER_NOTES, LAYER_WIRE, LayerName(), m_out, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), schIUScale, TO_UTF8, UNIMPLEMENTED_FOR, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format(), and saveBusEntry().
|
private |
Definition at line 1129 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_NO_CONNECT::GetPosition(), m_out, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), schIUScale, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
private |
Definition at line 1177 of file sch_sexpr_plugin.cpp.
References ARC, BEZIER, CIRCLE, formatArc(), formatBezier(), formatCircle(), formatPoly(), formatRect(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_SHAPE::GetShape(), SCH_SHAPE::GetStroke(), m_out, EDA_ITEM::m_Uuid, POLY, RECT, EDA_SHAPE::SHAPE_T_asString(), and UNIMPLEMENTED_FOR.
Referenced by Format().
|
private |
Definition at line 969 of file sch_sexpr_plugin.cpp.
References KIGFX::COLOR4D::a, KIID::AsString(), KIGFX::COLOR4D::b, EscapedUTF8(), FIELDS_AUTOPLACED_NO, STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatAngle(), EDA_UNIT_UTILS::FormatInternalUnits(), KIGFX::COLOR4D::g, SCH_SHEET::GetBackgroundColor(), SCH_SHEET::GetBorderColor(), SCH_SHEET::GetBorderWidth(), SCH_SHEET::GetFields(), SCH_ITEM::GetFieldsAutoplaced(), SCH_SHEET::GetInstances(), SCH_SHEET::GetPins(), SCH_SHEET::GetPosition(), PROJECT::GetProjectName(), SCH_SHEET_LIST::GetSheetPathByKIIDPath(), getSheetPinAngle(), getSheetPinShapeToken(), SCHEMATIC::GetSheets(), SCH_SHEET::GetSize(), KiROUND(), m_nextFreeFieldId, m_out, m_schematic, EDA_ITEM::m_Uuid, path, pin, OUTPUTFORMATTER::Print(), SCHEMATIC::Prj(), OUTPUTFORMATTER::Quotew(), KIGFX::COLOR4D::r, SCHEMATIC::Root(), saveField(), schIUScale, STROKE_PARAMS::SetWidth(), SHEET_MANDATORY_FIELDS, SOLID, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
overridevirtual |
Write aSymbol to an existing library located at aLibraryPath.
If a LIB_SYMBOL by the same name already exists or there are any conflicting alias names, the new LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries cannot have duplicate alias names. It is the responsibility of the caller to check the library for conflicts before saving.
aLibraryPath | is a locator for the "library", usually a directory, file, or URL containing several symbols. |
aSymbol | is what to store in the library. The library is refreshed and the caller must update any LIB_SYMBOL pointers that may have changed. |
aProperties | is an associative array that can be used to tell the saver how to save the symbol, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem saving. |
Reimplemented from SCH_PLUGIN.
Definition at line 1497 of file sch_sexpr_plugin.cpp.
References SCH_LIB_PLUGIN_CACHE::AddSymbol(), cacheLib(), isBuffering(), m_cache, and SCH_SEXPR_PLUGIN_CACHE::Save().
|
private |
Definition at line 645 of file sch_sexpr_plugin.cpp.
References PNS::angle(), ANGLE_0, ANGLE_180, ANGLE_270, ANGLE_90, KIID::AsString(), FIELDS_AUTOPLACED_NO, FOOTPRINT_FIELD, LIB_ID::Format(), EDA_UNIT_UTILS::FormatAngle(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_SYMBOL::GetConvert(), SCH_SYMBOL::GetDNP(), SCH_SYMBOL::GetFields(), SCH_ITEM::GetFieldsAutoplaced(), SCH_SYMBOL::GetFootprintFieldText(), SCH_SYMBOL::GetIncludeInBom(), SCH_SYMBOL::GetIncludeOnBoard(), SCH_SYMBOL::GetInstanceReferences(), SCH_SYMBOL::GetLibId(), SCH_SYMBOL::GetOrientation(), SCH_SYMBOL::GetPosition(), PROJECT::GetProjectName(), SCH_SYMBOL::GetRawPins(), SCH_SYMBOL::GetSchSymbolLibraryName(), SCH_SHEET_LIST::GetSheetPathByKIIDPath(), SCHEMATIC::GetSheets(), SCH_SYMBOL::GetUnit(), SCH_SYMBOL::GetValueFieldText(), m_nextFreeFieldId, m_out, EDA_ITEM::m_Uuid, MANDATORY_FIELDS, path, pin, OUTPUTFORMATTER::Print(), SCHEMATIC::Prj(), OUTPUTFORMATTER::Quotew(), REFERENCE_FIELD, SCHEMATIC::Root(), saveField(), schIUScale, SCH_SYMBOL::SortInstances(), SortSymbolInstancesByProjectUuid(), SYM_MIRROR_X, SYM_MIRROR_Y, SYM_ORIENT_180, SYM_ORIENT_270, SYM_ORIENT_90, TO_UTF8, toUTFTildaText(), SCH_SYMBOL::UseLibIdLookup(), VALUE_FIELD, UTF8::wx_str(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
private |
Definition at line 1251 of file sch_sexpr_plugin.cpp.
References PNS::angle(), ANGLE_180, KIID::AsString(), TEXT_SPIN_STYLE::BOTTOM, FIELDS_AUTOPLACED_NO, flag, EDA_UNIT_UTILS::FormatAngle(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_LABEL_BASE::GetFields(), SCH_ITEM::GetFieldsAutoplaced(), SCH_TEXT::GetPosition(), SCH_LABEL_BASE::GetShape(), getSheetPinShapeToken(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), SCH_TEXT::GetTextSpinStyle(), getTextTypeToken(), TEXT_SPIN_STYLE::LEFT, m_out, EDA_ITEM::m_Uuid, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), TEXT_SPIN_STYLE::RIGHT, saveField(), SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, schIUScale, TO_UTF8, EDA_ITEM::Type(), TEXT_SPIN_STYLE::UP, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
private |
Definition at line 1332 of file sch_sexpr_plugin.cpp.
References KIID::AsString(), STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatAngle(), formatFill(), EDA_UNIT_UTILS::FormatInternalUnits(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_SHAPE::GetStart(), SCH_SHAPE::GetStroke(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), m_out, EDA_ITEM::m_Uuid, niluuid, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Format().
|
inlinevirtualinherited |
Some library plugins need to have access to their parent library table.
aTable | is the table this plugin is registered within. |
Reimplemented in SCH_DATABASE_PLUGIN.
Definition at line 515 of file sch_io_mgr.h.
Referenced by SYMBOL_LIB_TABLE::FindRow(), SYMBOL_LIB_TABLE::LoadSymbolLib(), and SYMBOL_LIB_TABLE_ROW::Refresh().
|
inlineoverridevirtual |
Set an optional progress reporter.
Reimplemented from SCH_PLUGIN.
Definition at line 84 of file sch_sexpr_plugin.h.
References m_progressReporter.
|
inlinevirtualinherited |
Set an optional reporter for warnings/errors.
Reimplemented in SCH_ALTIUM_PLUGIN, CADSTAR_SCH_ARCHIVE_PLUGIN, and SCH_EAGLE_PLUGIN.
Definition at line 168 of file sch_io_mgr.h.
Referenced by SCH_EDIT_FRAME::importFile().
|
inlinevirtualinherited |
Reimplemented in SCH_DATABASE_PLUGIN.
Definition at line 449 of file sch_io_mgr.h.
Referenced by SYMBOL_LIB_TABLE_ROW::SupportsSubLibraries().
|
virtualinherited |
Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions.
Options are typically appended so that a derived SCH_PLUGIN can call its base class function by the same name first, thus inheriting options declared there. (Some base class options could pertain to all Symbol*() functions in all derived SCH_PLUGINs.) Note that since aListToAppendTo is a PROPERTIES object, all options will be unique and last guy wins.
aListToAppendTo | holds a tuple of
In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to SCH_PLUGIN, which has been avoided to date. |
Definition at line 133 of file sch_plugin.cpp.
References _.
|
protected |
Schematic load append status.
Definition at line 169 of file sch_sexpr_plugin.h.
Referenced by init(), Load(), and loadFile().
|
protected |
Definition at line 180 of file sch_sexpr_plugin.h.
Referenced by cacheLib(), CreateSymbolLib(), DeleteSymbol(), DeleteSymbolLib(), EnumerateSymbolLib(), GetAvailableSymbolFields(), GetModifyHash(), init(), LoadSymbol(), SaveLibrary(), SaveSymbol(), and ~SCH_SEXPR_PLUGIN().
|
protected |
Stack to maintain nested sheet paths.
Definition at line 175 of file sch_sexpr_plugin.h.
Referenced by Load(), and loadHierarchy().
|
protected |
Definition at line 177 of file sch_sexpr_plugin.h.
Referenced by loadHierarchy().
|
protected |
For throwing exceptions or errors on partial loads.
Definition at line 170 of file sch_sexpr_plugin.h.
Referenced by GetError(), and loadHierarchy().
|
protected |
Definition at line 168 of file sch_sexpr_plugin.h.
Referenced by init(), saveField(), saveSheet(), and saveSymbol().
|
protected |
The formatter for saving SCH_SCREEN objects.
Definition at line 179 of file sch_sexpr_plugin.h.
Referenced by Format(), init(), Save(), saveBitmap(), saveBusAlias(), saveBusEntry(), saveField(), saveInstances(), saveJunction(), saveLine(), saveNoConnect(), saveShape(), saveSheet(), saveSymbol(), saveText(), and saveTextBox().
|
protected |
Root project path for loading child sheets.
Definition at line 174 of file sch_sexpr_plugin.h.
Referenced by Load().
|
protected |
Definition at line 172 of file sch_sexpr_plugin.h.
Referenced by loadFile(), and SetProgressReporter().
|
protected |
The root sheet of the schematic being loaded.
Definition at line 176 of file sch_sexpr_plugin.h.
Referenced by init(), Load(), loadFile(), and loadHierarchy().
|
protected |
Definition at line 178 of file sch_sexpr_plugin.h.
Referenced by Format(), init(), loadHierarchy(), and saveSheet().
|
protected |
Version of file being loaded.
Definition at line 167 of file sch_sexpr_plugin.h.
Referenced by init().
|
static |
The property used internally by the plugin to enable cache buffering which prevents the library file from being written every time the cache is changed.
This is useful when writing the schematic cache library file or saving a library to a new file name.
Definition at line 94 of file sch_sexpr_plugin.h.
Referenced by isBuffering().