48 std::string ret =
TO_UTF8( txt );
50 for( std::string::iterator it = ret.begin(); it!=ret.end(); ++it )
52 if( (
unsigned char) *it <=
' ' )
82 square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
83 square->SetEnd( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
87 text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
88 text->SetText( wxString( wxT(
"??" ) ) );
106 const SCH_SHEET_PATH* aSheet,
int unit,
int convert,
const wxPoint& pos ) :
115 std::unique_ptr< LIB_SYMBOL > part;
153 for(
const std::pair<int, wxString>& i : aSel.
Fields )
187 field.SetParent(
this );
246 const int min_grid_size = Mils2iu( 25 );
248 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
250 if( ( (
pin->GetPosition().x -
m_pos.x ) % min_grid_size ) != 0 )
253 if( ( (
pin->GetPosition().y -
m_pos.y ) % min_grid_size ) != 0 )
282 wxCHECK2( ( aLibSymbol ==
nullptr ) || ( aLibSymbol->
IsRoot() ), aLibSymbol =
nullptr );
284 m_part.reset( aLibSymbol );
292 return m_part->GetDescription();
294 return wxEmptyString;
301 return m_part->GetDatasheetField().GetText();
303 return wxEmptyString;
309 std::map<wxString, wxString> altPinMap;
310 std::map<wxString, KIID> pinUuidMap;
312 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
314 pinUuidMap[
pin->GetNumber() ] =
pin->m_Uuid;
316 if( !
pin->GetAlt().IsEmpty() )
317 altPinMap[
pin->GetNumber() ] =
pin->GetAlt();
328 for(
LIB_PIN* libPin =
m_part->GetNextPin(); libPin; libPin =
m_part->GetNextPin( libPin ) )
335 m_pins.push_back( std::make_unique<SCH_PIN>( libPin,
this ) );
337 auto ii = pinUuidMap.find( libPin->GetNumber() );
339 if( ii != pinUuidMap.end() )
340 const_cast<KIID&>(
m_pins.back()->m_Uuid ) = ii->second;
342 auto iii = altPinMap.find( libPin->GetNumber() );
344 if( iii != altPinMap.end() )
345 m_pins.back()->SetAlt( iii->second );
396 return m_part->GetUnitCount();
419 field.Print( aSettings, aOffset );
424 int aUnit,
const wxString& aValue,
425 const wxString& aFootprint )
433 wxT(
" sheet path %s\n" )
434 wxT(
" reference %s, unit %d from symbol %s." ),
453 wxT(
" sheet path %s\n" )
454 wxT(
" reference %s, unit %d to symbol %s." ),
471 if( instance.m_Path ==
path )
473 ref = instance.m_Reference;
507 bool notInArray =
true;
512 if( instance.m_Path ==
path )
514 instance.m_Reference = ref;
522 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
523 pin->ClearDefaultNetName( sheet );
546 if( instance.m_Path ==
path )
547 return instance.m_Reference.Last() !=
'?';
560 if( instance.m_Path ==
path )
561 return instance.m_Unit;
577 if( instance.m_Path ==
path )
579 instance.m_Unit = aUnitSelection;
592 instance.m_Unit = aUnitSelection;
602 if( instance.m_Path ==
path && !instance.m_Value.IsEmpty() )
613 return instance.m_Value;
626 if( sheet ==
nullptr )
630 instance.m_Value = aValue;
641 if( instance.m_Path ==
path )
643 instance.m_Value = aValue;
650 aValue, wxEmptyString );
660 if( instance.m_Path ==
path && !instance.m_Footprint.IsEmpty() )
664 return instance.m_Footprint;
677 if( sheet ==
nullptr )
681 instance.m_Footprint = aFootprint;
692 if( instance.m_Path ==
path )
694 instance.m_Footprint = aFootprint;
701 wxEmptyString, aFootprint );
719 for(
size_t ii = 0; ii <
m_fields.size(); ++ii )
721 if(
m_fields[ii].GetId() == aFieldId )
733 if( aFieldName == field.GetName() || aFieldName == field.GetCanonicalName() )
734 return field.GetText();
737 return wxEmptyString;
745 if( !aVisibleOnly || ( field.IsVisible() && !field.IsVoid() ) )
746 aVector.push_back( &field );
764 if( aFieldName ==
m_fields[i].GetName(
false ) )
777 for(
unsigned i = start; i <
m_fields.size(); ++i )
779 if( aFieldName ==
m_fields[i].GetName(
false ) )
788 bool aUpdateOtherFields,
bool aResetRef,
bool aResetOtherFields )
793 std::vector<LIB_FIELD*> fields;
795 m_part->GetFields( fields );
797 for(
const LIB_FIELD* libField : fields )
799 int id = libField->GetId();
808 schField =
FindField( libField->GetCanonicalName() );
828 else if( aUpdateRef )
829 SetRef( aPath, libField->GetText() );
833 if( aResetOtherFields )
840 if( aResetOtherFields || aUpdateOtherFields )
845 if( aResetOtherFields )
847 else if( aUpdateOtherFields )
848 schField->
SetText( libField->GetText() );
852 if( aResetOtherFields || aUpdateOtherFields )
853 schField->
SetText( libField->GetText() );
862 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
863 aFunction(
pin.get() );
872 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
874 if(
pin->GetNumber() == aNumber )
891 wxASSERT(
m_pinMap.count( aLibPin ) );
898 std::vector<SCH_PIN*> pins;
900 if( aSheet ==
nullptr )
902 wxCHECK_MSG(
Schematic(), pins, wxT(
"Can't call GetPins on a symbol with no schematic" ) );
909 for(
const auto& p :
m_pins )
911 if( unit && p->GetLibPin()->GetUnit() && ( p->GetLibPin()->GetUnit() != unit ) )
914 pins.push_back( p.get() );
924 wxT(
"Cannot swap data with invalid symbol." ) );
928 std::swap(
m_lib_id, symbol->m_lib_id );
930 LIB_SYMBOL* libSymbol = symbol->m_part.release();
931 symbol->m_part.reset(
m_part.release() );
932 symbol->UpdatePins();
933 m_part.reset( libSymbol );
936 std::swap(
m_pos, symbol->m_pos );
937 std::swap(
m_unit, symbol->m_unit );
938 std::swap(
m_convert, symbol->m_convert );
942 for(
SCH_FIELD& field : symbol->m_fields )
951 symbol->m_transform = tmp;
961 aVars->push_back(
m_fields[i].GetCanonicalName().Upper() );
964 aVars->push_back(
m_fields[i].GetName() );
966 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
967 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
968 aVars->push_back( wxT(
"UNIT" ) );
977 wxCHECK( schematic,
false );
981 if( token->IsSameAs(
m_fields[ i ].GetCanonicalName().Upper() ) )
990 *token =
m_fields[ i ].GetShownText( aDepth + 1 );
998 if( token->IsSameAs(
m_fields[ i ].GetName() )
999 || token->IsSameAs(
m_fields[ i ].GetName().Upper() ) )
1001 *token =
m_fields[ i ].GetShownText( aDepth + 1 );
1009 if( token->IsSameAs( templateFieldname.m_Name )
1010 || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
1014 *token = wxEmptyString;
1019 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1025 wxArrayString parts = wxSplit( footprint,
':' );
1027 *token = parts[ 0 ];
1030 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1036 wxArrayString parts = wxSplit( footprint,
':' );
1038 *token = parts[ std::min( 1, (
int) parts.size() - 1 ) ];
1041 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
1066 if( instance.m_Path ==
path )
1067 instance.m_Reference = defRef;
1073 instance.m_Reference = defRef;
1076 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1077 pin->ClearDefaultNetName( aSheetPath );
1090 wxCHECK( aSheetPath.size() > 0, false );
1092 wxString reference_path;
1097 if( instance.m_Path == aSheetPath )
1113 return aOldSheetPath ==
r.m_Path;
1120 wxT(
"Replacing sheet path %s\n with sheet path %s\n for symbol %s." ),
1123 it->m_Path = aNewSheetPath;
1128 wxT(
"Could not find sheet path %s\n to replace with sheet path %s\n for symbol %s." ),
1138 bool transform =
false;
1140 switch( aOrientation )
1150 temp.
x1 = temp.
y2 = 0;
1157 temp.
x1 = temp.
y2 = 0;
1166 temp.
y1 = temp.
x2 = 0;
1173 temp.
y1 = temp.
x2 = 0;
1235 wxFAIL_MSG( wxT(
"Invalid schematic symbol orientation type." ) );
1264 int rotate_values[] =
1283 for(
int type_rotate : rotate_values )
1292 wxFAIL_MSG( wxT(
"Schematic symbol orientation matrix internal error." ) );
1301 void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const 1304 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1306 <<
'"' <<
" chipName=\"" 1314 const wxString& value =
GetFields()[i].GetText();
1316 if( !value.IsEmpty() )
1318 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\"" 1320 <<
'"' <<
" value=\"" 1321 <<
TO_UTF8( value ) <<
"\"/>\n";
1325 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
1340 int x0 = bBox.
GetX();
1346 int y0 = -bBox.
GetY();
1363 if( aIncludeFields )
1367 if( field.IsVisible() )
1368 bBox.
Merge( field.GetBoundingBox() );
1398 SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
1406 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
1408 msg =
m_part->IsPower() ?
_(
"Power symbol" ) :
_(
"Value" );
1409 aList.emplace_back( msg,
GetValue( currentSheet,
true ) );
1411 #if 0 // Display symbol flags, for debug only 1420 msg =
_(
"Missing parent" );
1422 std::shared_ptr< LIB_SYMBOL > parent =
m_part->GetParent().lock();
1425 msg = parent->GetName();
1435 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
1442 msg =
_(
"<Unknown>" );
1444 aList.emplace_back(
_(
"Footprint" ), msg );
1447 aList.emplace_back(
_(
"Description" ),
m_part->GetDescription() );
1448 aList.emplace_back(
_(
"Keywords" ),
m_part->GetKeyWords() );
1453 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
1455 aList.emplace_back(
_(
"Value" ),
GetValue( currentSheet,
true ) );
1456 aList.emplace_back(
_(
"Name" ),
GetLibId().GetLibItemName() );
1460 if( libNickname.empty() )
1461 msg =
_(
"No library defined!" );
1463 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
1465 aList.emplace_back(
_(
"Library" ), msg );
1487 wxPoint pos = field.GetTextPos();
1489 field.SetTextPos( pos );
1505 wxPoint pos = field.GetTextPos();
1507 field.SetTextPos( pos );
1514 wxPoint prev =
m_pos;
1523 wxPoint pos = field.GetTextPos();
1524 pos.x -= prev.x -
m_pos.x;
1525 pos.y -= prev.y -
m_pos.y;
1526 field.SetTextPos( pos );
1550 aItemList.push_back( item );
1558 bool changed =
false;
1560 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1562 bool previousState =
pin->IsDangling();
1563 pin->SetIsDangling(
true );
1573 if( each_item.GetParent() == this )
1576 switch( each_item.GetType() )
1585 if( pos == each_item.GetPosition() )
1586 pin->SetIsDangling(
false );
1594 if( !
pin->IsDangling() )
1598 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
1607 wxCHECK_MSG( Pin !=
nullptr && Pin->
Type() ==
LIB_PIN_T, wxPoint( 0, 0 ),
1608 wxT(
"Cannot get physical position of pin." ) );
1616 std::vector<wxPoint> retval;
1618 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1622 int pin_unit =
pin->GetLibPin()->GetUnit();
1623 int pin_convert =
pin->GetLibPin()->GetConvert();
1625 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1628 if( pin_convert > 0 && pin_convert !=
GetConvert() )
1643 wxPoint libPosition = aPosition -
m_pos;
1661 const KICAD_T aFilterTypes[] )
1665 for(
const KICAD_T* p = aFilterTypes; (stype = *p) !=
EOT; ++p )
1711 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1715 int pin_unit =
pin->GetLibPin()->GetUnit();
1716 int pin_convert =
pin->GetLibPin()->GetConvert();
1718 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1721 if( pin_convert > 0 && pin_convert !=
GetConvert() )
1739 auto symbol = static_cast<const SCH_SYMBOL*>( &aItem );
1743 if( rect.
GetArea() != symbol->GetBodyAndPinsBoundingBox().GetArea() )
1744 return rect.
GetArea() < symbol->GetBodyAndPinsBoundingBox().GetArea();
1746 if(
m_pos.x != symbol->m_pos.x )
1747 return m_pos.x < symbol->m_pos.x;
1749 if(
m_pos.y != symbol->m_pos.y )
1750 return m_pos.y < symbol->m_pos.y;
1773 return !( *
this == aSymbol );
1779 wxCHECK_MSG(
Type() == aItem.
Type(), *
this,
1780 wxT(
"Cannot assign object type " ) + aItem.
GetClass() + wxT(
" to type " ) +
1783 if( &aItem !=
this )
1793 m_part.reset( libSymbol );
1805 field.SetParent(
this );
1817 bBox.
Inflate( aAccuracy / 2 );
1833 rect.
Inflate( aAccuracy / 2 );
1853 int pin_unit =
pin->GetLibPin()->GetUnit();
1854 int pin_convert =
pin->GetLibPin()->GetConvert();
1856 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1859 if( pin_convert > 0 && pin_convert !=
GetConvert() )
1862 if(
pin->GetLocalPosition() == new_pos )
1889 for(
unsigned i = 0; i < tempPins.size(); ++ i )
1892 LIB_PIN* tempPin = tempPins[ i ];
1908 field.Plot( aPlotter );
1919 if(
pin->IsBrightened() )
1930 pin->ClearBrightened();
1936 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1938 int pin_unit =
pin->GetLibPin()->GetUnit();
1939 int pin_convert =
pin->GetLibPin()->GetConvert();
1941 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1944 if( pin_convert > 0 && pin_convert !=
GetConvert() )
1947 if(
pin->IsPointClickableAnchor( aPos ) )
bool m_isInNetlist
True if the symbol should appear in the netlist.
Field Reference of part, i.e. "IC21".
void UpdateFields(const SCH_SHEET_PATH *aPath, bool aUpdateStyle, bool aUpdateRef, bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields)
Restore fields to the original library values.
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
void Offset(int dx, int dy)
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
EDA_ITEM * m_parent
Linked list: Link (parent struct)
wxString GetRefDesUnannotated(const wxString &aSource)
Return an unannotated refdes from either a prefix or an existing refdes.
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
bool operator!=(const SCH_SYMBOL &aSymbol) const
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
const UTF8 & GetLibItemName() const
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
EDA_RECT doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SetUnit(int aUnit)
Change the unit number to aUnit.
Holds all the data relating to one schematic.
EDA_RECT GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
Define a symbol library graphical text item.
int GetUnitCount() const
Return the number of units per package of the symbol.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every LIB_PIN (all units)
void SetShape(GRAPHIC_PINSHAPE aShape)
void ImportValues(const LIB_FIELD &aSource)
Copy parameters from a LIB_FIELD source.
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
SCHEMATIC_SETTINGS & Settings() const
Field object used in symbol libraries.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
bool IsPointClickableAnchor(const wxPoint &aPos) const override
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
SCH_SYMBOL(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=nullptr)
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
TEMPLATES m_TemplateFieldNames
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
void SetTextPos(const wxPoint &aPoint)
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Collection of utility functions for component reference designators (refdes)
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
bool GetIncludeOnBoard() const
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
wxString AsString() const
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Schematic editor (Eeschema) main window.
void SetLibId(const LIB_ID &aName)
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const
static wxString SubReference(int aUnit, bool aAddSeparator=true)
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
void RotatePoint(int *pX, int *pY, double angle)
A logical library item identifier and consists of various portions much like a URI.
The base class for create windows for drawing purpose.
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Define a library symbol object.
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
wxString GetDatasheet() const
Return the documentation text for the given part alias.
TRANSFORM & GetTransform()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
bool IsDangling() const override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void Init(const wxPoint &pos=wxPoint(0, 0))
bool Contains(const wxPoint &aPoint) const
FIELDS_AUTOPLACED m_fieldsAutoplaced
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
int m_unit
The unit for multiple part per package symbols.
const INSPECTOR_FUNC & INSPECTOR
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
virtual void SetParent(EDA_ITEM *aParent)
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
wxString GetShownName() const
The base class for drawable items used by schematic library symbols.
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
const EDA_RECT GetBodyBoundingBox(int aUnit, int aConvert, bool aIncludePins) const
Get the symbol bounding box excluding fields.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
int m_convert
The alternate body style for symbols that have more than one body style defined.
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
void SetType(ELECTRICAL_PINTYPE aType)
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
#define IS_DANGLING
indicates a pin is dangling
Field Value of part, i.e. "3.3K".
virtual void SetText(const wxString &aText)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
wxString GetSchSymbolLibraryName() const
int GetFieldCount() const
Return the number of fields in this symbol.
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
A simple container for schematic symbol instance information.
#define STRUCT_DELETED
flag indication structures to be erased
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
wxLogTrace helper definitions.
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
GRAPHIC_PINSHAPE GetShape() const
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslate=true)
Return a default symbol field name for field aFieldNdx for all components.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_SYMBOL > m_part
a flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
EDA_ITEM_FLAGS GetEditFlags() const
double GetArea() const
Return the area of the rectangle.
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
bool m_onBoard
True to include in netlist when updating board.
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
wxString GetClass() const override
Return the class name.
wxString UnescapeString(const wxString &aSource)
wxString GetFieldText(const wxString &aFieldName, SCH_EDIT_FRAME *aFrame) const
Search for a field named aFieldName and returns text associated with this field.
void SetConvert(int aConvert)
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
wxPoint GetPosition() const override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
void Normalize()
Ensures that the height ant width are positive.
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts)
Print symbol.
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void ClearBrightenedPins()
Base plotter engine class.
bool m_inBom
True to include in bill of materials export.
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
library pin pointer : SCH_PIN's index
void SetName(const wxString &aName)
#define SKIP_STRUCT
flag indicating that the structure should be ignored
const wxChar *const traceFindItem
Flag to enable find debug tracing.
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
BITMAPS
A list of all bitmap identifiers.
bool operator<(const SCH_ITEM &aItem) const override
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
ELECTRICAL_PINTYPE GetType() const
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
wxString AsString() const
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Handle the component boundary box.
TRANSFORM m_transform
The rotation/mirror transformation.
A base class for most all the KiCad significant classes used in schematics and boards.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
virtual wxString GetClass() const override
Return the class name.
Hold a name of a symbol's field, field value, and default visibility.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
bool operator==(const SCH_SYMBOL &aSymbol) const
int GetOrientation()
Get the display symbol orientation.
SCH_SHEET_PATH & GetCurrentSheet() const
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
wxString GetDescription() const
Return information about the aliased parts.
const wxString GetFootprint(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific footprint assignment for the given sheet path.
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit, const wxString &aValue=wxEmptyString, const wxString &aFootprint=wxEmptyString)
Add a full hierarchical reference to this symbol.
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Helper class used to store the state of schematic items that can be connected to other schematic item...
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
LIB_ITEM * GetDrawItem(const wxPoint &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
SCH_SHEET_PATH & CurrentSheet() const override
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
not connected (must be left open)
Message panel definition file.
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
void Plot(PLOTTER *aPlotter, int aUnit, int aConvert, const wxPoint &aOffset, const TRANSFORM &aTransform) const
Plot lib symbol to plotter.
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
std::vector< std::pair< int, wxString > > Fields
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual const wxString & GetText() const
Return the string associated with the text object.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_ITEM & operator=(const SCH_ITEM &aPin)
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Returns the type of object.
bool GetIncludeInBom() const
const LIB_ID & GetLibId() const
void SetTransform(const TRANSFORM &aTransform)
Field Name Module PCB, i.e. "16DIP300".