26#include <wx/mstream.h>
30#include <schematic_lexer.h>
32using namespace TSCHEMATIC_T;
92 aFormatter->
Print(
"(fill (type %s) (color %d %d %d %s))", fillType,
KiROUND( aFillColor.
r * 255.0 ),
98 aFormatter->
Print(
"(fill (type %s))", fillType );
147 default: wxFAIL_MSG(
"Missing symbol library pin connection type" );
176 default: wxFAIL_MSG(
"Missing symbol library pin shape type" );
185 switch( aOrientation )
191 default: wxFAIL_MSG(
"Missing symbol library pin orientation type" );
return ANGLE_0;
209 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_passive );
223 default: wxFAIL;
return ANGLE_0;
232 case SCH_TEXT_T:
return SCHEMATIC_LEXER::TokenName( T_text );
233 case SCH_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_label );
235 case SCH_HIER_LABEL_T:
return SCHEMATIC_LEXER::TokenName( T_hierarchical_label );
237 default: wxFAIL;
return SCHEMATIC_LEXER::TokenName( T_text );
258 aFormatter->
Print(
"(arc %s (start %s) (mid %s) (end %s)", aIsPrivate ?
"private" :
"",
263 formatFill( aFormatter, aFillMode, aFillColor );
268 aFormatter->
Print(
")" );
276 aFormatter->
Print(
"(circle %s (center %s) (radius %s)", aIsPrivate ?
"private" :
"",
280 formatFill( aFormatter, aFillMode, aFillColor );
285 aFormatter->
Print(
")" );
292 aFormatter->
Print(
"(rectangle %s (start %s) (end %s)", aIsPrivate ?
"private" :
"",
295 formatFill( aFormatter, aFillMode, aFillColor );
300 aFormatter->
Print(
")" );
308 aFormatter->
Print(
"(bezier %s (pts ", aIsPrivate ?
"private" :
"" );
313 aFormatter->
Print(
"(xy %s)",
formatIU( pt, aInvertY ).c_str() );
316 aFormatter->
Print(
")" );
319 formatFill( aFormatter, aFillMode, aFillColor );
324 aFormatter->
Print(
")" );
332 aFormatter->
Print(
"(polyline %s (pts ", aIsPrivate ?
"private" :
"" );
340 wxFAIL_MSG(
"Polyline has no outlines" );
347 aFormatter->
Print(
"(xy %s)",
formatIU( pt, aInvertY ).c_str() );
353 aFormatter->
Print(
")" );
356 formatFill( aFormatter, aFillMode, aFillColor );
361 aFormatter->
Print(
")" );
366 bool aIncludeData =
true );
378 wxCHECK_RET( aSymbol,
"Invalid LIB_SYMBOL pointer." );
389 std::vector<SCH_FIELD*> fields;
393 if( !aLibName.IsEmpty() )
399 wxCHECK2( unitId.
Parse( aLibName ) < 0, );
406 aFormatter.
Print(
"(symbol %s",
name.c_str() );
409 aFormatter.
Print(
"(power)" );
412 aFormatter.
Print(
"(pin_numbers (hide yes))" );
417 aFormatter.
Print(
"(pin_names" );
429 aFormatter.
Print(
")" );
454 std::sort( units.begin(), units.end(),
457 if( a.m_unit == b.m_unit )
458 return a.m_bodyStyle < b.m_bodyStyle;
460 return a.m_unit < b.m_unit;
469 aFormatter.
Print(
"(symbol %s_%d_%d\"",
name.c_str(), unit.m_unit, unit.m_bodyStyle );
475 aFormatter.
Print(
"(unit_name %s)", aFormatter.
Quotes(
name ).c_str() );
484 std::multiset<
SCH_ITEM*,
decltype( cmp )> save_map( cmp );
486 for(
SCH_ITEM* item : unit.m_items )
487 save_map.insert( item );
492 aFormatter.
Print(
")" );
502 std::shared_ptr<LIB_SYMBOL> parent = aSymbol->
GetParent().lock();
506 aFormatter.
Print(
"(symbol %s (extends %s)",
name.c_str(), aFormatter.
Quotew( parent->GetName() ).c_str() );
521 aFormatter.
Print(
")" );
527 wxCHECK_RET( aSymbol,
"Invalid LIB_SYMBOL pointer." );
539 if( !fpFilters.IsEmpty() )
543 for(
const wxString&
filter : fpFilters )
551 tmp +=
" " + curr_filter;
564 wxCHECK_RET( aItem,
"Invalid SCH_ITEM pointer." );
566 switch( aItem->
Type() )
578 case SHAPE_T::ARC:
formatArc( &aFormatter, shape, isPrivate, stroke, fillMode, fillColor,
true );
break;
607 wxCHECK_RET( aField && aField->
Type() ==
SCH_FIELD_T,
"Invalid SCH_FIELD object." );
609 wxString fieldName = aField->
GetName();
614 aFormatter.
Print(
"(property %s %s %s (at %s %s %g)", aField->
IsPrivate() ?
"private" :
"",
621 aFormatter.
Print(
"(show_name)" );
624 aFormatter.
Print(
"(do_not_autoplace)" );
627 aFormatter.
Print(
")" );
633 wxCHECK_RET( aPin && aPin->
Type() ==
SCH_PIN_T,
"Invalid SCH_PIN object." );
648 aFormatter.
Print(
"(name %s (effects (font (size %s %s))))", aFormatter.
Quotew( aPin->
GetName() ).c_str(),
652 aFormatter.
Print(
"(number %s (effects (font (size %s %s))))", aFormatter.
Quotew( aPin->
GetNumber() ).c_str(),
657 for(
const std::pair<const wxString, SCH_PIN::ALT>& alt : aPin->
GetAlternates() )
659 aFormatter.
Print(
"(alternate %s %s %s)", aFormatter.
Quotew( alt.second.m_Name ).c_str(),
663 aFormatter.
Print(
")" );
669 wxCHECK_RET( aText && aText->
Type() ==
SCH_TEXT_T,
"Invalid SCH_TEXT object." );
671 aFormatter.
Print(
"(text %s %s (at %s %s %g)", aText->
IsPrivate() ?
"private" :
"",
678 aFormatter.
Print(
")" );
684 wxCHECK_RET( aTextBox && aTextBox->
Type() ==
SCH_TEXTBOX_T,
"Invalid SCH_TEXTBOX object." );
686 aFormatter.
Print(
"(text_box %s %s", aTextBox->
IsPrivate() ?
"private" :
"",
692 aFormatter.
Print(
"(at %s %s %s) (size %s %s) (margins %s %s %s %s)",
706 aFormatter.
Print(
")" );
731 formatter.
Print(
"(kicad_symbol_lib (version %d) (generator \"kicad_symbol_editor\") "
732 "(generator_version \"%s\")",
738 formatter.
Print(
")" );
745 wxCHECK_RET( aSheet !=
nullptr,
"NULL SCH_SHEET* object." );
746 wxCHECK_RET(
m_schematic !=
nullptr,
"NULL SCHEMATIC* object." );
759 m_schematic->GetEmbeddedFiles()->ClearEmbeddedFonts();
761 m_out->Print(
"(kicad_sch (version %d) (generator \"eeschema\") (generator_version %s)",
770 m_out->Print(
"(lib_symbols" );
772 for(
const auto& [libItemName, libSymbol] : screen->
GetLibSymbols() )
779 for(
const std::shared_ptr<BUS_ALIAS>& alias :
m_schematic->GetAllBusAliases() )
785 if( a->
Type() != b->Type() )
786 return a->
Type() < b->Type();
788 return a->
m_Uuid < b->m_Uuid;
791 std::multiset<
SCH_ITEM*,
decltype( cmp )> save_map( cmp );
797 save_map.insert( item );
802 switch( item->Type() )
833 default: wxASSERT(
"Unexpected schematic object type in SCH_WRITER_V9::Format()" );
839 std::vector<SCH_SHEET_INSTANCE> instances;
868 if( topLevelSheets.size() == 1 )
869 return topLevelSheets[0]->m_Uuid;
879 wxCHECK_RET( aSymbol !=
nullptr &&
m_out !=
nullptr,
"" );
885 if( symbol_name.size() )
891 libName =
"_NONAME_";
906 m_out->Print(
"(symbol" );
913 m_out->Print(
"(lib_id %s) (at %s %s %s)",
922 if( mirrorX || mirrorY )
924 m_out->Print(
"(mirror %s %s)", mirrorX ?
"x" :
"", mirrorY ?
"y" :
"" );
935 wxASSERT( parentScreen );
939 std::optional<SCH_SHEET_PATH> ordinalPath =
m_schematic->Hierarchy().GetOrdinalPath( parentScreen );
946 aSymbol->
GetInstance( ordinalInstance, ordinalPath->Path() );
951 int unit = ordinalInstance.
m_Unit;
953 if( aForClipboard && aRelativePath )
958 unit = unitInstance.
m_Unit;
961 m_out->Print(
"(unit %d)", unit );
982 wxString value = field.GetText();
1017 field.SetText( value );
1023 field.SetText( value );
1026 for(
const std::unique_ptr<SCH_PIN>&
pin : aSymbol->
GetRawPins() )
1028 if(
pin->GetAlt().IsEmpty() )
1030 m_out->Print(
"(pin %s",
m_out->Quotew(
pin->GetNumber() ).c_str() );
1032 m_out->Print(
")" );
1036 m_out->Print(
"(pin %s",
m_out->Quotew(
pin->GetNumber() ).c_str() );
1038 m_out->Print(
"(alternate %s))",
m_out->Quotew(
pin->GetAlt() ).c_str() );
1044 std::map<KIID, std::vector<SCH_SYMBOL_INSTANCE>> projectInstances;
1046 m_out->Print(
"(instances" );
1048 wxString projectName;
1054 wxCHECK2( inst.m_Path.size(),
continue );
1059 bool isOrphaned = ( inst.m_Path[0] == rootSheetUuid ) && !aSheetList.
GetSheetPathByKIIDPath( inst.m_Path );
1062 if( !aForClipboard && isOrphaned )
1065 auto it = projectInstances.find( inst.m_Path[0] );
1067 if( it == projectInstances.end() )
1068 projectInstances[inst.m_Path[0]] = { inst };
1070 it->second.emplace_back( inst );
1073 for(
auto& [uuid, instances] : projectInstances )
1075 wxCHECK2( instances.size(),
continue );
1078 std::sort( instances.begin(), instances.end(),
1081 return aLhs.m_Path < aRhs.m_Path;
1084 projectName = instances[0].m_ProjectName;
1086 m_out->Print(
"(project %s",
m_out->Quotew( projectName ).c_str() );
1093 if( aForClipboard && aRelativePath )
1098 m_out->Print(
"(path %s (reference %s) (unit %d))",
m_out->Quotew(
path ).c_str(),
1099 m_out->Quotew( instance.m_Reference ).c_str(), instance.m_Unit );
1102 m_out->Print(
")" );
1105 m_out->Print(
")" );
1108 m_out->Print(
")" );
1114 wxCHECK_RET( aField !=
nullptr &&
m_out !=
nullptr,
"" );
1121 fieldName = aField->
GetName();
1123 m_out->Print(
"(property %s %s %s (at %s %s %s)", aField->
IsPrivate() ?
"private" :
"",
1140 m_out->Print(
")" );
1146 wxCHECK_RET(
m_out !=
nullptr,
"" );
1153 wxCHECK_RET(
image !=
nullptr,
"wxImage* is NULL" );
1155 m_out->Print(
"(image (at %s %s)",
1171 wxMemoryOutputStream stream;
1176 m_out->Print(
")" );
1182 wxCHECK_RET( aSheet !=
nullptr &&
m_out !=
nullptr,
"" );
1184 m_out->Print(
"(sheet (at %s %s) (size %s %s)",
1227 m_out->Print(
")" );
1231 std::vector<SCH_SHEET_INSTANCE> sheetInstances = aSheet->
GetInstances();
1233 auto it = sheetInstances.begin();
1235 while( it != sheetInstances.end() )
1237 if( it->m_Path.size() == 0 )
1238 it = sheetInstances.erase( it );
1243 if( !sheetInstances.empty() )
1245 m_out->Print(
"(instances" );
1247 KIID lastProjectUuid;
1249 bool inProjectClause =
false;
1251 for(
size_t i = 0; i < sheetInstances.size(); i++ )
1258 if( ( sheetInstances[i].m_Path[0] == rootSheetUuid )
1262 && ( ( i + 1 == sheetInstances.size() ) || lastProjectUuid != sheetInstances[i + 1].m_Path[0] ) )
1264 m_out->Print(
")" );
1265 inProjectClause =
false;
1271 if( lastProjectUuid != sheetInstances[i].m_Path[0] )
1273 wxString projectName;
1275 if( sheetInstances[i].m_Path[0] == rootSheetUuid )
1276 projectName =
m_schematic->Project().GetProjectName();
1278 projectName = sheetInstances[i].m_ProjectName;
1280 lastProjectUuid = sheetInstances[i].m_Path[0];
1281 m_out->Print(
"(project %s",
m_out->Quotew( projectName ).c_str() );
1282 inProjectClause =
true;
1285 wxString
path = sheetInstances[i].m_Path.AsString();
1287 m_out->Print(
"(path %s (page %s))",
m_out->Quotew(
path ).c_str(),
1288 m_out->Quotew( sheetInstances[i].m_PageNumber ).c_str() );
1291 && ( ( i + 1 == sheetInstances.size() ) || lastProjectUuid != sheetInstances[i + 1].m_Path[0] ) )
1293 m_out->Print(
")" );
1294 inProjectClause =
false;
1298 m_out->Print(
")" );
1301 m_out->Print(
")" );
1307 wxCHECK_RET( aJunction !=
nullptr &&
m_out !=
nullptr,
"" );
1309 m_out->Print(
"(junction (at %s %s) (diameter %s) (color %d %d %d %s)",
1317 m_out->Print(
")" );
1323 wxCHECK_RET( aNoConnect !=
nullptr &&
m_out !=
nullptr,
"" );
1325 m_out->Print(
"(no_connect (at %s %s)",
1330 m_out->Print(
")" );
1336 wxCHECK_RET( aBusEntry !=
nullptr &&
m_out !=
nullptr,
"" );
1339 if( aBusEntry->
GetClass() ==
"SCH_BUS_BUS_ENTRY" )
1348 m_out->Print(
"(bus_entry (at %s %s) (size %s %s)",
1356 m_out->Print(
")" );
1362 wxCHECK_RET( aShape !=
nullptr &&
m_out !=
nullptr,
"" );
1398 wxCHECK_RET( aRuleArea !=
nullptr &&
m_out !=
nullptr,
"" );
1400 m_out->Print(
"(rule_area " );
1402 m_out->Print(
")" );
1408 wxCHECK_RET( aLine !=
nullptr &&
m_out !=
nullptr,
"" );
1416 case LAYER_BUS: lineType =
"bus";
break;
1422 m_out->Print(
"(%s (pts (xy %s %s) (xy %s %s))",
TO_UTF8( lineType ),
1430 m_out->Print(
")" );
1436 wxCHECK_RET( aText !=
nullptr &&
m_out !=
nullptr,
"" );
1479 if( label && !label->
GetFields().empty() )
1496 m_out->Print(
")" );
1502 wxCHECK_RET( aTextBox !=
nullptr &&
m_out !=
nullptr,
"" );
1512 m_out->Print(
"(at %s %s %s) (size %s %s) (margins %s %s %s %s)",
1524 m_out->Print(
"(span %d %d)", cell->GetColSpan(), cell->GetRowSpan() );
1532 m_out->Print(
")" );
1547 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
1549 for(
int col = 0; col < aTable->
GetColCount(); ++col )
1555 minRow = std::min( minRow, row );
1556 maxRow = std::max( maxRow, row );
1557 minCol = std::min( minCol, col );
1558 maxCol = std::max( maxCol, col );
1567 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, , wxT(
"No selected cells!" ) );
1571 for(
int row = minRow; row <= maxRow; row++ )
1576 for(
int col = minCol; col <= maxCol; col++ )
1583 wxCHECK_RET( aTable !=
nullptr &&
m_out !=
nullptr,
"" );
1587 m_out->Print(
"(border" );
1594 m_out->Print(
")" );
1596 m_out->Print(
"(separators" );
1603 m_out->Print(
")" );
1605 m_out->Print(
"(column_widths" );
1607 for(
int col = 0; col < aTable->
GetColCount(); ++col )
1612 m_out->Print(
")" );
1614 m_out->Print(
"(row_heights" );
1616 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
1621 m_out->Print(
")" );
1623 m_out->Print(
"(cells" );
1628 m_out->Print(
")" );
1629 m_out->Print(
")" );
1638 wxCHECK_RET( aAlias !=
nullptr,
"BUS_ALIAS* is NULL" );
1642 for(
const wxString& member : aAlias->Members() )
1644 if( !members.IsEmpty() )
1645 members += wxS(
" " );
1647 members +=
m_out->Quotew( member );
1650 m_out->Print(
"(bus_alias %s (members %s))",
m_out->Quotew( aAlias->GetName() ).c_str(),
TO_UTF8( members ) );
1656 if( aInstances.size() )
1658 m_out->Print(
"(sheet_instances" );
1662 wxString
path = instance.m_Path.AsString();
1664 if(
path.IsEmpty() )
1667 m_out->Print(
"(path %s (page %s))",
m_out->Quotew(
path ).c_str(),
1668 m_out->Quotew( instance.m_PageNumber ).c_str() );
1671 m_out->Print(
")" );
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
This class handle bitmap images in KiCad.
bool SaveImageData(wxOutputStream &aOutStream) const
Write the bitmap data to aOutStream.
int AsTenthsOfADegree() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
EDA_ITEM_FLAGS GetFlags() const
const VECTOR2I & GetBezierC2() const
FILL_T GetFillMode() const
SHAPE_POLY_SET & GetPolyShape()
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
COLOR4D GetFillColor() const
wxString SHAPE_T_asString() const
const VECTOR2I & GetBezierC1() const
VECTOR2I GetArcMid() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
wxString GetFontName() const
bool IsMultilineAllowed() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
virtual int GetTextHeight() const
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
virtual EDA_ANGLE GetTextAngle() const
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual int GetTextThickness() const
void ClearEmbeddedFonts()
Remove all embedded fonts from the collection.
const std::map< wxString, std::shared_ptr< EMBEDDED_FILE > > & EmbeddedFileMap() const
Provide an iterable view of the file collection.
bool GetAreFontsEmbedded() const
A color representation with 4 components: red, green, blue, alpha.
bool MakeRelativeTo(const KIID_PATH &aPath)
wxString AsString() const
wxString AsString() const
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
const UTF8 & GetLibItemName() const
Define a library symbol object.
const wxString & GetRawKeyWords() const
Return only this symbol's keywords, without inheriting from its parent.
const LIB_ID & GetLibId() const override
std::weak_ptr< LIB_SYMBOL > & GetParent()
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
bool IsPower() const override
bool UnitsLocked() const
Check whether symbol units are interchangeable.
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of SCH_ITEM objects separated by unit and convert number.
std::map< int, wxString > & GetUnitDisplayNames()
wxArrayString GetFPFilters() const
EMBEDDED_FILES * GetEmbeddedFiles() override
void EmbedFonts() override
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
VECTOR2I GetPosition() const
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
Holds all the data relating to one schematic.
std::vector< SCH_SHEET * > GetTopLevelSheets() const
Get the list of top-level sheets.
Object to handle a bitmap image that can be inserted in a schematic.
REFERENCE_IMAGE & GetReferenceImage()
Base class for a bus or wire entry.
VECTOR2I GetPosition() const override
virtual STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
bool CanAutoplace() const
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
wxString GetClass() const override
Return the class name.
VECTOR2I GetPosition() const override
KIGFX::COLOR4D GetColor() const
SPIN_STYLE GetSpinStyle() const
LABEL_FLAG_SHAPE GetShape() const
std::vector< SCH_FIELD > & GetFields()
Segment description base class to describe items which have 2 end points (track, wire,...
virtual STROKE_PARAMS GetStroke() const override
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
void SetEndPoint(const VECTOR2I &aPosition)
VECTOR2I GetPosition() const override
int GetNumberTextSize() const
const std::map< wxString, ALT > & GetAlternates() const
const wxString & GetName() const
PIN_ORIENTATION GetOrientation() const
VECTOR2I GetPosition() const override
int GetNameTextSize() const
const wxString & GetNumber() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
const PAGE_INFO & GetPageSettings() const
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const KIID & GetUuid() const
TITLE_BLOCK & GetTitleBlock()
STROKE_PARAMS GetStroke() const override
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
std::optional< SCH_SHEET_PATH > GetSheetPathByKIIDPath(const KIID_PATH &aPath, bool aIncludeLastSheet=true) const
Finds a SCH_SHEET_PATH that matches the provided KIID_PATH.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
bool HasRootInstance() const
Check to see if this sheet has a root sheet instance.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
SCH_SCREEN * GetScreen() const
VECTOR2I GetPosition() const override
const SCH_SHEET_INSTANCE & GetRootInstance() const
Return the root sheet instance data.
KIGFX::COLOR4D GetBorderColor() const
bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flags.
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
int GetBorderWidth() const
std::vector< SCH_SHEET_PIN * > & GetPins()
const std::vector< SCH_SHEET_INSTANCE > & GetInstances() const
KIGFX::COLOR4D GetBackgroundColor() const
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstances() const
bool UseLibIdLookup() const
wxString GetSchSymbolLibraryName() const
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
const LIB_ID & GetLibId() const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
int GetOrientation() const override
Get the display symbol orientation.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
wxString GetPrefix() const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SetRowHeight(int aRow, int aHeight)
const STROKE_PARAMS & GetSeparatorsStroke() const
void SetColCount(int aCount)
bool StrokeExternal() const
int GetRowHeight(int aRow) const
void SetColWidth(int aCol, int aWidth)
std::vector< SCH_TABLECELL * > GetCells() const
int GetColWidth(int aCol) const
const STROKE_PARAMS & GetBorderStroke() const
bool StrokeHeaderSeparator() const
SCH_TABLECELL * GetCell(int aRow, int aCol) const
bool StrokeColumns() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
int GetMarginBottom() const
int GetMarginLeft() const
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
int GetMarginRight() const
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
VECTOR2I GetPosition() const override
void Format(SCH_SHEET *aSheet)
void SaveSymbolLibrary(const wxString &aFileName, const std::vector< LIB_SYMBOL * > &aSymbols)
void saveRuleArea(SCH_RULE_AREA *aRuleArea)
void saveTable(SCH_TABLE *aTable)
void saveInstances(const std::vector< SCH_SHEET_INSTANCE > &aInstances)
void saveJunction(SCH_JUNCTION *aJunction)
void saveLine(SCH_LINE *aLine)
static constexpr int FORMAT_VERSION
void saveSheet(SCH_SHEET *aSheet, const SCH_SHEET_LIST &aSheetList)
void saveBitmap(const SCH_BITMAP &aBitmap)
void saveShape(SCH_SHAPE *aShape)
void SaveSchematicFile(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic)
void saveField(SCH_FIELD *aField)
void saveBusEntry(SCH_BUS_ENTRY_BASE *aBusEntry)
void saveSymbol(SCH_SYMBOL *aSymbol, const SCHEMATIC &aSchematic, const SCH_SHEET_LIST &aSheetList, bool aForClipboard, const SCH_SHEET_PATH *aRelativePath=nullptr)
void saveBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
void saveTextBox(SCH_TEXTBOX *aTextBox)
static constexpr int SYMBOL_LIB_VERSION
void saveText(SCH_TEXT *aText)
void saveNoConnect(SCH_NO_CONNECT *aNoConnect)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
bool IsClosed() const override
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const std::vector< VECTOR2I > & CPoints() const
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
int GetPinNameOffset() const
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
virtual bool GetShowPinNames() const
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
virtual bool GetShowPinNumbers() const
#define DEFAULT_PIN_NAME_OFFSET
The offset of the pin name string from the end of the pin in mils.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
@ FILLED_WITH_BG_BODYCOLOR
@ FILLED_SHAPE
Fill with object color.
#define IS_CHANGED
Item was edited, and modified.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
#define UNIMPLEMENTED_FOR(type)
KICOMMON_API std::string FormatAngle(const EDA_ANGLE &aAngle)
Convert aAngle from board units to a string appropriate for writing to file.
KICOMMON_API std::string FormatInternalUnits(const EDA_IU_SCALE &aIuScale, int aValue, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
Converts aValue from internal units to a string appropriate for writing to file.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
@ PT_NC
not connected (must be left open)
@ PT_TRISTATE
tri state bus pin
@ PT_NIC
not internally connected (may be connected to anything)
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_POWER_OUT
output of a regulator: intended to be connected to power input pins
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
EDA_ANGLE getPinAngle(PIN_ORIENTATION aOrientation)
void formatArc(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aArc, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid, bool aLocked)
void formatCircle(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aCircle, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid, bool aLocked)
const char * getSheetPinShapeToken(LABEL_FLAG_SHAPE aShape)
void formatRect(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aRect, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid, bool aLocked)
const char * getPinElectricalTypeToken(ELECTRICAL_PINTYPE aType)
const char * getTextTypeToken(KICAD_T aType)
void formatBezier(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aBezier, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid, bool aLocked)
std::string formatIU(const int &aValue)
void formatPoly(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aPolyLine, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid, bool aLocked)
EDA_ANGLE getSheetPinAngle(SHEET_SIDE aSide)
void formatFill(OUTPUTFORMATTER *aFormatter, FILL_T aFillMode, const COLOR4D &aFillColor)
Fill token formatting helper.
const char * getPinShapeToken(GRAPHIC_PINSHAPE aShape)
static const char * emptyString
LABEL_FLAG_SHAPE
Label and flag shapes used with text objects.
SHEET_SIDE
Define the edge of the sheet that the sheet pin is positioned.
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
static void libSaveSymbol(LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, const wxString &aLibName=wxEmptyString, bool aIncludeData=true)
static const char * getTextTypeToken(KICAD_T aType)
static void formatEdaTextV9(OUTPUTFORMATTER *aFormatter, const EDA_TEXT &aText, int aControlBits)
static EDA_ANGLE getSheetPinAngle(SHEET_SIDE aSide)
static void formatFill(OUTPUTFORMATTER *aFormatter, FILL_T aFillMode, const COLOR4D &aFillColor)
static void formatArc(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aArc, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid=niluuid)
static bool isDefaultFormattingV9(const EDA_TEXT &aText)
static void formatPoly(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aPolyLine, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid=niluuid)
static EDA_ANGLE getPinAngle(PIN_ORIENTATION aOrientation)
static void formatCircle(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aCircle, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid=niluuid)
static void libSaveField(SCH_FIELD *aField, OUTPUTFORMATTER &aFormatter)
static void libSaveSymbol(LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, const wxString &aLibName=wxEmptyString, bool aIncludeData=true)
static const char * getPinShapeToken(GRAPHIC_PINSHAPE aShape)
static void formatBezier(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aBezier, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid=niluuid)
static std::string formatIU(const int &aValue)
static void libSaveText(SCH_TEXT *aText, OUTPUTFORMATTER &aFormatter)
static void formatRect(OUTPUTFORMATTER *aFormatter, EDA_SHAPE *aRect, bool aIsPrivate, const STROKE_PARAMS &aStroke, FILL_T aFillMode, const COLOR4D &aFillColor, bool aInvertY, const KIID &aUuid=niluuid)
static void libSaveTextBox(SCH_TEXTBOX *aTextBox, OUTPUTFORMATTER &aFormatter)
static void libSaveDcmInfoAsFields(LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter)
static const char * getPinElectricalTypeToken(ELECTRICAL_PINTYPE aType)
static KIID effectiveRootUuid(const SCHEMATIC &aSchematic)
static void libSavePin(SCH_PIN *aPin, OUTPUTFORMATTER &aFormatter)
static void libSaveSymbolDrawItem(SCH_ITEM *aItem, OUTPUTFORMATTER &aFormatter)
static const char * getSheetPinShapeToken(LABEL_FLAG_SHAPE aShape)
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
std::string EscapedUTF8(const wxString &aString)
Return an 8 bit UTF8 string given aString in Unicode form.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
A simple container for sheet instance information.
A simple container for schematic symbol instance information.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I