44#define PIN_TEXT_MARGIN 4
52 static const wxChar* msgPinElectricType[] =
56 wxT(
"bidirectional" ),
63 wxT(
"open_collector" ),
64 wxT(
"open_emitter" ),
68 return msgPinElectricType[
static_cast<int>( aType )];
103 m_position( { 0, 0 } ),
108 m_isDangling(
true ),
109 m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *
this ) )
135 int aNameTextSize,
int aNumTextSize,
int aBodyStyle,
const VECTOR2I& aPos,
141 m_orientation( aOrientation ),
145 m_numTextSize( aNumTextSize ),
146 m_nameTextSize( aNameTextSize ),
147 m_isDangling( true ),
163 m_isDangling( true ),
166 wxASSERT( aParentSymbol );
181 const KIID& aUuid ) :
189 m_isDangling( true ),
192 wxASSERT( aParentSymbol );
201 m_libPin( aPin.m_libPin ),
202 m_alternates( aPin.m_alternates ),
203 m_position( aPin.m_position ),
204 m_length( aPin.m_length ),
205 m_orientation( aPin.m_orientation ),
206 m_shape( aPin.m_shape ),
207 m_type( aPin.m_type ),
208 m_hidden( aPin.m_hidden ),
209 m_numTextSize( aPin.m_numTextSize ),
210 m_nameTextSize( aPin.m_nameTextSize ),
212 m_isDangling( aPin.m_isDangling ),
253 return symbol->GetTransform().TransformCoordinate(
m_position ) + symbol->GetPosition();
262 wxCHECK_MSG(
m_libPin, PIN_ORIENTATION::PIN_RIGHT, wxS(
"Can't inherit without a libPin!" ) );
273 if( !
m_alt.IsEmpty() )
275 wxCHECK_MSG(
m_libPin, GRAPHIC_PINSHAPE::LINE, wxS(
"Can't specify alternate without a "
280 else if(
m_shape == GRAPHIC_PINSHAPE::INHERIT )
282 wxCHECK_MSG(
m_libPin, GRAPHIC_PINSHAPE::LINE, wxS(
"Can't inherit without a libPin!" ) );
295 wxCHECK_MSG(
m_libPin, 0, wxS(
"Can't inherit without a libPin!" ) );
306 if( !
m_alt.IsEmpty() )
308 wxCHECK_MSG(
m_libPin, ELECTRICAL_PINTYPE::PT_UNSPECIFIED, wxS(
"Can't specify alternate "
309 "without a libPin!" ) );
313 else if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
315 wxCHECK_MSG(
m_libPin, ELECTRICAL_PINTYPE::PT_UNSPECIFIED, wxS(
"Can't inherit without a "
336 if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
339 wxS(
"Can't inherit without a m_libPin!" ) );
350 if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
353 wxS(
"Can't inherit without a m_libPin!" ) );
366 wxCHECK_MSG(
m_libPin,
true, wxS(
"Can't inherit without a libPin!" ) );
377 if( !
m_alt.IsEmpty() )
400 m_name.Replace( wxT(
" " ), wxT(
"_" ) );
408 if(
GetType() == ELECTRICAL_PINTYPE::PT_NC ||
GetType() == ELECTRICAL_PINTYPE::PT_NIC )
423 bool isConnectableType_a =
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
424 ||
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
425 bool isConnectableType_b = aPin->
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
426 || aPin->
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
431 && (
GetType() == aPin->
GetType() || isConnectableType_a || isConnectableType_b );
450 bool isReplaced =
false;
466 aAccuracy = std::max( aAccuracy,
Schematic()->Settings().m_PinSymbolSize / 4 );
493 if( !
m_alt.IsEmpty() )
498 if(
m_name == wxS(
"~" ) )
499 return wxEmptyString;
508 return wxEmptyString;
521 m_number.Replace( wxT(
" " ), wxT(
"_" ) );
532 wxS(
"Can't inherit without a libPin!" ) );
557 wxS(
"Can't inherit without a libPin!" ) );
581 const TRANSFORM& t = symbol->GetTransform();
598 const VECTOR2I& aOffset,
bool aForceNoFill,
bool aDimmed )
602 wxCHECK( part && aSettings, );
623 &&
m_type != ELECTRICAL_PINTYPE::PT_NC
624 &&
m_type != ELECTRICAL_PINTYPE::PT_NIC )
650 int MapX1, MapY1, x1, y1;
674 switch( aOrientation )
676 case PIN_ORIENTATION::PIN_UP: y1 = posY - len; MapY1 = 1;
break;
677 case PIN_ORIENTATION::PIN_DOWN: y1 = posY + len; MapY1 = -1;
break;
678 case PIN_ORIENTATION::PIN_LEFT: x1 = posX - len; MapX1 = 1;
break;
679 case PIN_ORIENTATION::PIN_RIGHT: x1 = posX + len; MapX1 = -1;
break;
680 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
break;
683 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
688 GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
698 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
699 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
700 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
701 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
707 GRLineTo( DC, x1 - MapX1 * clock_size * 2, y1, width,
color );
713 GRLineTo( DC, x1, y1 - MapY1 * clock_size * 2, width,
color );
719 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
720 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
721 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
726 GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
727 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width,
color );
732 GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
733 GRLineTo( DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width,
color );
738 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
744 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1, width,
color );
749 GRLineTo( DC, x1, y1 + MapY1 * deco_size * 2, width,
color );
752 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
755 GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
756 GRLineTo( DC, x1 + (MapX1 + MapY1) * deco_size, y1 + ( MapY1 - MapX1 ) * deco_size, width,
758 GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
759 GRLineTo( DC, x1 + (MapX1 - MapY1) * deco_size, y1 + ( MapY1 + MapX1 ) * deco_size, width,
763 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
766 GRLine( DC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width,
768 GRLine( DC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width,
776 bool aDrawPinName,
bool aDimmed )
778 if( !aDrawPinName && !aDrawPinNum )
804 nameColor = nameColor.
Mix( bg, 0.5f );
805 numColor = numColor.
Mix( bg, 0.5f );
813 case PIN_ORIENTATION::PIN_UP: y1 -=
GetLength();
break;
814 case PIN_ORIENTATION::PIN_DOWN: y1 +=
GetLength();
break;
815 case PIN_ORIENTATION::PIN_LEFT: x1 -=
GetLength();
break;
816 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
GetLength();
break;
817 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxT(
"aPinOrient must be resolved!" ) );
break;
821 aDrawPinName =
false;
831 nameSize, hAlign, vAlign, 0,
false,
false, font,
GetFontMetrics() );
839 numSize, hAlign, vAlign, 0,
false,
false, font,
GetFontMetrics() );
844 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
845 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
850 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
871 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
903 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
904 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
907 if( aDrawPinName && aDrawPinNum )
915 else if( aDrawPinName )
920 else if( aDrawPinNum )
928 if( aDrawPinName && aDrawPinNum )
936 else if( aDrawPinName )
941 else if( aDrawPinNum )
961 #define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
967 int pensize = textSize/6;
991 switch( aOrientation )
993 case PIN_ORIENTATION::PIN_UP:
999 case PIN_ORIENTATION::PIN_DOWN:
1004 case PIN_ORIENTATION::PIN_LEFT:
1008 case PIN_ORIENTATION::PIN_RIGHT:
1013 case PIN_ORIENTATION::INHERIT:
1014 wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
1026 int MapX1, MapY1, x1, y1;
1033 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
1034 bg = COLOR4D::WHITE;
1038 color.Desaturate( );
1046 x1 = aPosition.
x; y1 = aPosition.
y;
1048 switch( aOrientation )
1050 case PIN_ORIENTATION::PIN_UP: y1 = aPosition.
y - pinLength; MapY1 = 1;
break;
1051 case PIN_ORIENTATION::PIN_DOWN: y1 = aPosition.
y + pinLength; MapY1 = -1;
break;
1052 case PIN_ORIENTATION::PIN_LEFT: x1 = aPosition.
x - pinLength; MapX1 = 1;
break;
1053 case PIN_ORIENTATION::PIN_RIGHT: x1 = aPosition.
x + pinLength; MapX1 = -1;
break;
1054 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
break;
1057 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
1060 aPlotter->
Circle(
VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
1061 FILL_T::NO_FILL, penWidth );
1063 aPlotter->
MoveTo(
VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
1066 else if(
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
1082 aPlotter->
MoveTo(
VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
1091 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
1092 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
1093 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
1110 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
1111 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
1118 aPlotter->
LineTo(
VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
1124 aPlotter->
LineTo(
VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
1129 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
1144 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
1148 y1 - ( MapY1 - MapX1 ) * deco_size ) );
1150 y1 + ( MapY1 - MapX1 ) * deco_size ) );
1152 y1 - ( MapY1 + MapX1 ) * deco_size ) );
1154 y1 + ( MapY1 + MapX1 ) * deco_size ) );
1157 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
1160 const int ex1 = aPosition.
x;
1161 const int ey1 = aPosition.
y;
1162 aPlotter->
MoveTo(
VECTOR2I( ex1 - deco_size, ey1 - deco_size ) );
1164 aPlotter->
MoveTo(
VECTOR2I( ex1 + deco_size, ey1 - deco_size ) );
1171 int aTextInside,
bool aDrawPinNum,
bool aDrawPinName,
1172 bool aDimmed )
const
1180 aDrawPinName =
false;
1183 aDrawPinNum =
false;
1185 if( !aDrawPinNum && !aDrawPinName )
1198 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
1199 bg = COLOR4D::WHITE;
1205 nameColor = nameColor.
Mix( bg, 0.5f );
1206 numColor = numColor.
Mix( bg, 0.5f );
1212 switch( aPinOrient )
1214 case PIN_ORIENTATION::PIN_UP: y1 -=
GetLength();
break;
1215 case PIN_ORIENTATION::PIN_DOWN: y1 +=
GetLength();
break;
1216 case PIN_ORIENTATION::PIN_LEFT: x1 -=
GetLength();
break;
1217 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
GetLength();
break;
1218 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aPinOrient must be resolved!" ) );
break;
1254 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
1255 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1259 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
1279 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
1311 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
1312 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1315 if( aDrawPinName && aDrawPinNum )
1323 else if( aDrawPinName )
1328 else if( aDrawPinNum )
1337 if( aDrawPinName && aDrawPinNum )
1345 else if( aDrawPinName )
1350 else if( aDrawPinNum )
1368 case PIN_ORIENTATION::PIN_RIGHT: end.
x = 1;
break;
1369 case PIN_ORIENTATION::PIN_UP: end.
y = -1;
break;
1370 case PIN_ORIENTATION::PIN_DOWN: end.
y = 1;
break;
1371 case PIN_ORIENTATION::PIN_LEFT: end.
x = -1;
break;
1376 orient = PIN_ORIENTATION::PIN_UP;
1381 orient = PIN_ORIENTATION::PIN_DOWN;
1385 orient = PIN_ORIENTATION::PIN_RIGHT;
1388 orient = PIN_ORIENTATION::PIN_LEFT;
1406 int lengthChange =
GetLength() - aLength;
1413 case PIN_ORIENTATION::PIN_RIGHT:
1414 offsetX = lengthChange;
1416 case PIN_ORIENTATION::PIN_LEFT:
1417 offsetX = -1 * lengthChange;
1419 case PIN_ORIENTATION::PIN_UP:
1420 offsetY = lengthChange;
1422 case PIN_ORIENTATION::PIN_DOWN:
1423 offsetY = -1 * lengthChange;
1487 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1488 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1489 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1490 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1500 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1501 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1502 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1503 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1517 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
1548 aList.emplace_back(
_(
"Type" ),
_(
"Pin" ) );
1553 wxString(
"Undefined library pin." );
1554 aList.emplace_back(
_(
"Unit" ), msg );
1560 wxString(
"Undefined library pin." );
1561 aList.emplace_back(
_(
"Body Style" ), msg );
1570 aList.emplace_back(
_(
"Visible" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
1589 aList.emplace_back( symbol->
GetRef( currentSheet ),
1642 if( it->second.second == aForceNoConnect )
1643 return it->second.first;
1646 wxString
name =
"Net-(";
1647 bool unconnected =
false;
1649 if( aForceNoConnect ||
GetType() == ELECTRICAL_PINTYPE::PT_NC )
1652 name = (
"unconnected-(" );
1655 bool annotated =
true;
1657 std::vector<SCH_PIN*> pins = symbol->
GetPins( &aPath );
1658 bool has_multiple =
false;
1664 && unconnected == (
pin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) )
1666 has_multiple =
true;
1675 if( symbol->
GetRef( &aPath,
false ).Last() ==
'?' )
1680 name <<
"-Pad" << libPinNumber <<
")";
1683 else if( !libPinShownName.IsEmpty() && ( libPinShownName != libPinShownNumber ) )
1690 if( unconnected || has_multiple )
1730 if( aCache->
m_Font == aFont
1749 bool aIncludeElectricalType )
const
1752 return m_layoutCache->GetPinBoundingBox( aIncludeLabelsOnInvisiblePins, aIncludeNameAndNumber,
1753 aIncludeElectricalType );
1767 wxCHECK(
pin,
false );
1807 if( !
m_alt.IsEmpty() )
1810 alt = &localStorage;
1814 : wxString( wxS(
"Undefined library pin." ) );
1818 return wxString::Format(
"Symbol %s %s",
1840 if ( !
name.IsEmpty() )
1842 return wxString::Format(
_(
"Pin %s [%s, %s, %s]" ),
1850 return wxString::Format(
_(
"Pin %s [%s, %s]" ),
1858 if( !
name.IsEmpty() )
1860 return wxString::Format(
_(
"Hidden pin %s [%s, %s, %s]" ),
1868 return wxString::Format(
_(
"Hidden pin %s [%s, %s]" ),
1987 return static_cast<int>(
m_shape ) -
static_cast<int>( tmp->
m_shape );
1990 return static_cast<int>(
m_type ) -
static_cast<int>( tmp->
m_type );
2009 const ALT& lhsAlt = lhsItem->second;
2010 const ALT& rhsAlt = rhsItem->second;
2018 return static_cast<int>( lhsAlt.
m_Type ) -
static_cast<int>( rhsAlt.
m_Type );
2021 return static_cast<int>( lhsAlt.
m_Shape ) -
static_cast<int>( rhsAlt.
m_Shape );
2094 aStream <<
"SCH_PIN:" << std::endl
2095 <<
" Name: \"" <<
m_name <<
"\"" << std::endl
2096 <<
" Number: \"" <<
m_number <<
"\"" << std::endl
2098 <<
" Length: " <<
GetLength() << std::endl
2111void SCH_PIN::Show(
int nestLevel, std::ostream& os )
const
2113 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
2135 if( pinTypeEnum.Choices().GetCount() == 0 )
2137 pinTypeEnum.Map( ELECTRICAL_PINTYPE::PT_INPUT,
_HKI(
"Input" ) )
2138 .Map( ELECTRICAL_PINTYPE::PT_OUTPUT,
_HKI(
"Output" ) )
2139 .Map( ELECTRICAL_PINTYPE::PT_BIDI,
_HKI(
"Bidirectional" ) )
2140 .Map( ELECTRICAL_PINTYPE::PT_TRISTATE,
_HKI(
"Tri-state" ) )
2141 .Map( ELECTRICAL_PINTYPE::PT_PASSIVE,
_HKI(
"Passive" ) )
2142 .Map( ELECTRICAL_PINTYPE::PT_NIC,
_HKI(
"Free" ) )
2143 .Map( ELECTRICAL_PINTYPE::PT_UNSPECIFIED,
_HKI(
"Unspecified" ) )
2144 .Map( ELECTRICAL_PINTYPE::PT_POWER_IN,
_HKI(
"Power input" ) )
2145 .Map( ELECTRICAL_PINTYPE::PT_POWER_OUT,
_HKI(
"Power output" ) )
2146 .Map( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,
_HKI(
"Open collector" ) )
2147 .Map( ELECTRICAL_PINTYPE::PT_OPENEMITTER,
_HKI(
"Open emitter" ) )
2148 .Map( ELECTRICAL_PINTYPE::PT_NC,
_HKI(
"Unconnected" ) );
2153 if( pinShapeEnum.Choices().GetCount() == 0 )
2155 pinShapeEnum.Map( GRAPHIC_PINSHAPE::LINE,
_HKI(
"Line" ) )
2156 .Map( GRAPHIC_PINSHAPE::INVERTED,
_HKI(
"Inverted" ) )
2157 .Map( GRAPHIC_PINSHAPE::CLOCK,
_HKI(
"Clock" ) )
2158 .Map( GRAPHIC_PINSHAPE::INVERTED_CLOCK,
_HKI(
"Inverted clock" ) )
2159 .Map( GRAPHIC_PINSHAPE::INPUT_LOW,
_HKI(
"Input low" ) )
2160 .Map( GRAPHIC_PINSHAPE::CLOCK_LOW,
_HKI(
"Clock low" ) )
2161 .Map( GRAPHIC_PINSHAPE::OUTPUT_LOW,
_HKI(
"Output low" ) )
2162 .Map( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK,
_HKI(
"Falling edge clock" ) )
2163 .Map( GRAPHIC_PINSHAPE::NONLOGIC,
_HKI(
"NonLogic" ) );
2168 if( orientationEnum.Choices().GetCount() == 0 )
2170 orientationEnum.Map( PIN_ORIENTATION::PIN_RIGHT,
_(
"Right" ) )
2171 .Map( PIN_ORIENTATION::PIN_LEFT,
_(
"Left" ) )
2172 .Map( PIN_ORIENTATION::PIN_UP,
_(
"Up" ) )
2173 .Map( PIN_ORIENTATION::PIN_DOWN,
_(
"Down" ) );
2176 auto isSymbolEditor =
2180 return dynamic_cast<LIB_SYMBOL*
>(
pin->GetParentSymbol() ) !=
nullptr;
2199 _HKI(
"Electrical Type" ),
2204 _HKI(
"Graphic Style" ),
2222 PROPERTY_DISPLAY::PT_SIZE ) )
2227 PROPERTY_DISPLAY::PT_SIZE ) )
2232 PROPERTY_DISPLAY::PT_SIZE ) )
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr bool Contains(const Vec &aPoint) const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
EDA_ITEM * GetParent() const
EDA_ITEM * m_parent
Linked list: Link (parent struct)
virtual const wxString & GetText() const
Return the string associated with the text object.
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxDC * GetPrintDC() const
wxString AsString() const
Define a library symbol object.
Container for data for KiCad programs.
virtual SETTINGS_MANAGER & GetSettingsManager() const
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
Base plotter engine class.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void MoveTo(const VECTOR2I &pos)
void FinishTo(const VECTOR2I &pos)
RENDER_SETTINGS * RenderSettings()
bool GetColorMode() const
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
virtual void SetColor(const COLOR4D &color)=0
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetWriteableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM & operator=(const SCH_ITEM &aPin)
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
static wxString GetUnitDescription(int aUnit)
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
bool IsConnectivityDirty() const
static wxString GetBodyStyleDescription(int aBodyStyle)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
const KIFONT::METRICS & GetFontMetrics() const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
std::ostream & operator<<(std::ostream &aStream)
void PlotPinTexts(PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
Plot the pin name and number.
int GetNumberTextSize() const
std::optional< bool > m_hidden
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
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.
std::unique_ptr< PIN_LAYOUT_CACHE > m_layoutCache
The layout cache for this pin.
void MirrorVerticallyPin(int aCenter)
void validateExtentsCache(KIFONT::FONT *aFont, int aSize, const wxString &aText, EXTENTS_CACHE *aCache) const
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
void SetNumber(const wxString &aNumber)
std::optional< int > m_nameTextSize
PIN_ORIENTATION PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
void SetVisible(bool aVisible)
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
ALT GetAlt(const wxString &aAlt)
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
SCH_PIN & operator=(const SCH_PIN &aPin)
wxString GetShownNumber() const
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
std::map< const SCH_SHEET_PATH, std::pair< wxString, bool > > m_net_name_map
PIN_ORIENTATION m_orientation
void SetOrientation(PIN_ORIENTATION aOrientation)
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
wxString getItemDescription(ALT *aAlt) const
bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const override
Return true if this item should propagate connection info to aItem.
std::optional< int > m_numTextSize
VECTOR2I GetPinRoot() const
ELECTRICAL_PINTYPE m_type
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
SCH_PIN * GetLibPin() const
void SetPosition(const VECTOR2I &aPos) override
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetIsDangling(bool aIsDangling)
wxString GetElectricalTypeName() const
std::map< wxString, ALT > m_alternates
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
const wxString & GetName() const
void SetLength(int aLength)
bool IsDangling() const override
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void MirrorHorizontally(int aCenter) override
these transforms have effect only if the pin has a LIB_SYMBOL as parent
std::recursive_mutex m_netmap_mutex
The name that this pin connection will drive onto a net.
PIN_ORIENTATION GetOrientation() const
wxString GetClass() const override
Return the class name.
void SetNumberTextSize(int aSize)
void printPinTexts(const RENDER_SETTINGS *aSettings, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed)
Put the pin number and pin text info, given the pin line coordinates.
void SetShape(GRAPHIC_PINSHAPE aShape)
void RotatePin(const VECTOR2I &aCenter, bool aRotateCCW=true)
VECTOR2I GetPosition() const override
wxString GetCanonicalElectricalTypeName() const
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
int GetNameTextSize() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void printPinSymbol(const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, PIN_ORIENTATION aOrientation, bool aDimmed)
Print the pin symbol without text.
int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const override
The pin specific sort order is as follows:
wxString GetShownName() const
void MirrorHorizontallyPin(int aCenter)
these transforms have always effects
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetBaseName() const
Get the name without any alternates.
void ClearDefaultNetName(const SCH_SHEET_PATH *aPath)
void printPinElectricalTypeName(const RENDER_SETTINGS *aSettings, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed)
Draw the electrical type text of the pin (only for the footprint editor)
SCH_PIN(LIB_SYMBOL *aParentSymbol)
bool IsStacked(const SCH_PIN *aPin) const
const wxString & GetNumber() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
wxString GetDefaultNetName(const SCH_SHEET_PATH &aPath, bool aForceNoConnect=false)
std::optional< int > m_length
GRAPHIC_PINSHAPE GetShape() const
void PlotPinType(PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed) const
ELECTRICAL_PINTYPE GetType() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SetNameTextSize(int aSize)
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
bool m_ShowPinsElectricalType
bool m_ShowConnectionPoints
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
A base class for LIB_SYMBOL and SCH_SYMBOL.
virtual int GetUnitCount() const =0
virtual const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const =0
virtual bool IsPower() const =0
int GetPinNameOffset() const
virtual bool GetShowPinNames() const
virtual bool GetShowPinNumbers() const
virtual bool HasAlternateBodyStyle() const =0
Test if symbol has more than one body conversion type (DeMorgan).
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_PIN_LENGTH
The default pin number size when creating pins(can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define SHOW_ELEC_TYPE
Show pin electrical type. Shared with IS_ROLLOVER.
void GRLineTo(wxDC *DC, int x, int y, int width, const COLOR4D &Color)
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
void GRMoveTo(int x, int y)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
bool GetGRForceBlackPenState(void)
int GetPenSizeForNormal(int aTextSize)
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics)
Print a graphic text through wxDC.
@ LAYER_SELECTION_SHADOWS
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE aType)
BITMAPS ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE aType)
wxString PinShapeGetText(GRAPHIC_PINSHAPE aShape)
wxString PinOrientationName(PIN_ORIENTATION aOrientation)
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
static struct SCH_PIN_DESC _SCH_PIN_DESC
#define TARGET_PIN_RADIUS
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
ELECTRICAL_PINTYPE m_Type
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I