41#define PIN_TEXT_MARGIN 4
49 static const wxChar* msgPinElectricType[] =
53 wxT(
"bidirectional" ),
60 wxT(
"open_collector" ),
61 wxT(
"open_emitter" ),
65 return msgPinElectricType[
static_cast<int>( aType )];
126 int aNameTextSize,
int aNumTextSize,
int aConvert,
const VECTOR2I& aPos,
131 m_orientation( aOrientation ),
135 m_numTextSize( aNumTextSize ),
136 m_nameTextSize( aNameTextSize )
178 if(
m_name == wxS(
"~" ) )
179 return wxEmptyString;
199 const TRANSFORM& aTransform,
bool aDimmed )
208 wxCHECK( part && opts, );
228 if( show_connect_point
229 &&
m_type != ELECTRICAL_PINTYPE::PT_NC
230 &&
m_type != ELECTRICAL_PINTYPE::PT_NIC )
256 int MapX1, MapY1, x1, y1;
258 int posX = aPos.
x, posY = aPos.
y, len =
m_length;
280 case PIN_ORIENTATION::PIN_UP: y1 = posY - len; MapY1 = 1;
break;
281 case PIN_ORIENTATION::PIN_DOWN: y1 = posY + len; MapY1 = -1;
break;
282 case PIN_ORIENTATION::PIN_LEFT: x1 = posX - len; MapX1 = 1;
break;
283 case PIN_ORIENTATION::PIN_RIGHT: x1 = posX + len; MapX1 = -1;
break;
286 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
291 GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
301 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
302 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
303 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
304 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
310 GRLineTo( DC, x1 - MapX1 * clock_size * 2, y1, width,
color );
316 GRLineTo( DC, x1, y1 - MapY1 * clock_size * 2, width,
color );
322 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
323 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
324 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
329 GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
330 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width,
color );
335 GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
336 GRLineTo( DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width,
color );
341 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
347 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1, width,
color );
352 GRLineTo( DC, x1, y1 + MapY1 * deco_size * 2, width,
color );
355 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
358 GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
359 GRLineTo( DC, x1 + (MapX1 + MapY1) * deco_size, y1 + ( MapY1 - MapX1 ) * deco_size, width,
361 GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
362 GRLineTo( DC, x1 + (MapX1 - MapY1) * deco_size, y1 + ( MapY1 + MapX1 ) * deco_size, width,
366 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
369 GRLine( DC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width,
371 GRLine( DC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width,
379 bool aDrawPinName,
bool aDimmed )
381 if( !aDrawPinName && !aDrawPinNum )
411 nameColor = nameColor.
Mix( bg, 0.5f );
412 numColor = numColor.
Mix( bg, 0.5f );
420 case PIN_ORIENTATION::PIN_UP: y1 -=
m_length;
break;
421 case PIN_ORIENTATION::PIN_DOWN: y1 +=
m_length;
break;
422 case PIN_ORIENTATION::PIN_LEFT: x1 -=
m_length;
break;
423 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
m_length;
break;
427 aDrawPinName =
false;
437 nameSize, hAlign, vAlign, nameWidth,
false,
false, font,
GetFontMetrics() );
445 numSize, hAlign, vAlign, numWidth,
false,
false, font,
GetFontMetrics() );
450 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
451 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
456 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
477 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
509 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
510 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
513 if( aDrawPinName && aDrawPinNum )
521 else if( aDrawPinName )
526 else if( aDrawPinNum )
534 if( aDrawPinName && aDrawPinNum )
542 else if( aDrawPinName )
547 else if( aDrawPinNum )
566 #define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
572 int pensize = textSize/6;
596 switch( aOrientation )
598 case PIN_ORIENTATION::PIN_UP:
604 case PIN_ORIENTATION::PIN_DOWN:
609 case PIN_ORIENTATION::PIN_LEFT:
613 case PIN_ORIENTATION::PIN_RIGHT:
627 int MapX1, MapY1, x1, y1;
632 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
645 x1 = aPosition.
x; y1 = aPosition.
y;
647 switch( aOrientation )
649 case PIN_ORIENTATION::PIN_UP: y1 = aPosition.
y -
m_length; MapY1 = 1;
break;
650 case PIN_ORIENTATION::PIN_DOWN: y1 = aPosition.
y +
m_length; MapY1 = -1;
break;
651 case PIN_ORIENTATION::PIN_LEFT: x1 = aPosition.
x -
m_length; MapX1 = 1;
break;
652 case PIN_ORIENTATION::PIN_RIGHT: x1 = aPosition.
x +
m_length; MapX1 = -1;
break;
655 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
658 aPlotter->
Circle(
VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
659 FILL_T::NO_FILL, penWidth );
661 aPlotter->
MoveTo(
VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
664 else if(
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
680 aPlotter->
MoveTo(
VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
689 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
690 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
691 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
708 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
709 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
716 aPlotter->
LineTo(
VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
722 aPlotter->
LineTo(
VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
727 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
742 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
746 y1 - ( MapY1 - MapX1 ) * deco_size ) );
748 y1 + ( MapY1 - MapX1 ) * deco_size ) );
750 y1 - ( MapY1 + MapX1 ) * deco_size ) );
752 y1 + ( MapY1 + MapX1 ) * deco_size ) );
755 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
758 const int ex1 = aPosition.
x;
759 const int ey1 = aPosition.
y;
769 int aTextInside,
bool aDrawPinNum,
bool aDrawPinName,
778 aDrawPinName =
false;
783 if( !aDrawPinNum && !aDrawPinName )
798 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
805 nameColor = nameColor.
Mix( bg, 0.5f );
806 numColor = numColor.
Mix( bg, 0.5f );
814 case PIN_ORIENTATION::PIN_UP: y1 -=
m_length;
break;
815 case PIN_ORIENTATION::PIN_DOWN: y1 +=
m_length;
break;
816 case PIN_ORIENTATION::PIN_LEFT: x1 -=
m_length;
break;
817 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
m_length;
break;
853 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
854 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
858 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
878 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
910 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
911 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
914 if( aDrawPinName && aDrawPinNum )
922 else if( aDrawPinName )
927 else if( aDrawPinNum )
936 if( aDrawPinName && aDrawPinNum )
944 else if( aDrawPinName )
949 else if( aDrawPinNum )
966 case PIN_ORIENTATION::PIN_UP: end.
y = 1;
break;
967 case PIN_ORIENTATION::PIN_DOWN: end.
y = -1;
break;
968 case PIN_ORIENTATION::PIN_LEFT: end.
x = -1;
break;
969 case PIN_ORIENTATION::PIN_RIGHT: end.
x = 1;
break;
974 orient = PIN_ORIENTATION::PIN_UP;
979 orient = PIN_ORIENTATION::PIN_DOWN;
983 orient = PIN_ORIENTATION::PIN_RIGHT;
986 orient = PIN_ORIENTATION::PIN_LEFT;
1033 return static_cast<int>(
m_shape ) -
static_cast<int>( tmp->
m_shape );
1036 return static_cast<int>(
m_type ) -
static_cast<int>( tmp->
m_type );
1055 const ALT& lhsAlt = lhsItem->second;
1056 const ALT& rhsAlt = rhsItem->second;
1064 return static_cast<int>( lhsAlt.
m_Type ) -
static_cast<int>( rhsAlt.
m_Type );
1067 return static_cast<int>( lhsAlt.
m_Shape ) -
static_cast<int>( rhsAlt.
m_Shape );
1078 int lengthChange =
m_length - aLength;
1084 case PIN_ORIENTATION::PIN_RIGHT:
1085 offsetX = lengthChange;
1087 case PIN_ORIENTATION::PIN_LEFT:
1088 offsetX = -1 * lengthChange;
1090 case PIN_ORIENTATION::PIN_UP:
1091 offsetY = lengthChange;
1093 case PIN_ORIENTATION::PIN_DOWN:
1094 offsetY = -1 * lengthChange;
1152 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1153 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1154 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1155 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1162 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1163 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1164 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1165 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1172 const TRANSFORM& aTransform,
bool aDimmed )
const
1180 PlotSymbol( aPlotter, pos, orient, aDimmed );
1196 aList.emplace_back(
_(
"Style" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
1204 pinpos.
y = -pinpos.
y;
1210 aList.emplace_back(
_(
"Flags" ), wxString::Format(
"%8.8X", (
long)
GetFlags() ) );
1238 if( aCache->
m_Font == aFont
1249 static wxString hText = wxT(
"Xg" );
1262 bool aIncludeElectricalType )
const
1270 int pinNameOffset = 0;
1271 int nameTextLength = 0;
1272 int nameTextHeight = 0;
1273 int numberTextLength = 0;
1274 int numberTextHeight = 0;
1275 int typeTextLength = 0;
1276 bool includeName = aIncludeNameAndNumber && !
GetShownName().IsEmpty();
1277 bool includeNumber = aIncludeNameAndNumber && !
GetShownNumber().IsEmpty();
1278 bool includeType = aIncludeElectricalType;
1281 if( !aIncludeInvisiblePins && !
IsVisible() )
1283 includeName =
false;
1284 includeType =
false;
1292 includeName =
false;
1295 includeNumber =
false;
1315 double stroke = fontSize / 8.0;
1318 KiROUND( stroke ),
false,
false,
1322 minsizeV = std::max( minsizeV, typeTextSize.
y / 2 );
1326 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
1334 if( pinNameOffset || !includeName )
1338 begin.
y = std::max( minsizeV, numberTextHeight + PIN_TEXT_OFFSET );
1339 begin.
x = std::min( -typeTextLength,
m_length - ( numberTextLength / 2 ) );
1342 end.
y = std::min( -minsizeV, -nameTextHeight / 2 );
1348 begin.
y = std::max( minsizeV, nameTextHeight + PIN_TEXT_OFFSET );
1349 begin.
x = -typeTextLength;
1350 begin.
x = std::min( begin.
x, (
m_length - numberTextLength ) / 2 );
1351 begin.
x = std::min( begin.
x, (
m_length - nameTextLength ) / 2 );
1354 end.
x = std::max( end.
x, (
m_length + nameTextLength ) / 2 );
1355 end.
x = std::max( end.
x, (
m_length + numberTextLength ) / 2 );
1356 end.
y = std::min( -minsizeV, -numberTextHeight - PIN_TEXT_OFFSET );
1365 case PIN_ORIENTATION::PIN_UP:
1371 case PIN_ORIENTATION::PIN_DOWN:
1378 case PIN_ORIENTATION::PIN_LEFT:
1383 case PIN_ORIENTATION::PIN_RIGHT:
1419 if ( !shownName.IsEmpty() )
1421 return wxString::Format(
_(
"Pin %s [%s, %s, %s]" ),
1429 return wxString::Format(
_(
"Pin %s [%s, %s]" ),
1437 if( !shownName.IsEmpty() )
1439 return wxString::Format(
_(
"Hidden pin %s [%s, %s, %s]" ),
1447 return wxString::Format(
_(
"Hidden pin %s [%s, %s]" ),
1458 aStream <<
"LIB_PIN:" << std::endl
1459 <<
" Name: \"" <<
m_name <<
"\"" << std::endl
1460 <<
" Number: \"" <<
m_number <<
"\"" << std::endl
1462 <<
" Length: " <<
m_length << std::endl
1475void LIB_PIN::Show(
int nestLevel, std::ostream& os )
const
1477 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1499 if( pinTypeEnum.Choices().GetCount() == 0 )
1501 pinTypeEnum.Map( ELECTRICAL_PINTYPE::PT_INPUT,
_HKI(
"Input" ) )
1502 .Map( ELECTRICAL_PINTYPE::PT_OUTPUT,
_HKI(
"Output" ) )
1503 .Map( ELECTRICAL_PINTYPE::PT_BIDI,
_HKI(
"Bidirectional" ) )
1504 .Map( ELECTRICAL_PINTYPE::PT_TRISTATE,
_HKI(
"Tri-state" ) )
1505 .Map( ELECTRICAL_PINTYPE::PT_PASSIVE,
_HKI(
"Passive" ) )
1506 .Map( ELECTRICAL_PINTYPE::PT_NIC,
_HKI(
"Free" ) )
1507 .Map( ELECTRICAL_PINTYPE::PT_UNSPECIFIED,
_HKI(
"Unspecified" ) )
1508 .Map( ELECTRICAL_PINTYPE::PT_POWER_IN,
_HKI(
"Power input" ) )
1509 .Map( ELECTRICAL_PINTYPE::PT_POWER_OUT,
_HKI(
"Power output" ) )
1510 .Map( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,
_HKI(
"Open collector" ) )
1511 .Map( ELECTRICAL_PINTYPE::PT_OPENEMITTER,
_HKI(
"Open emitter" ) )
1512 .Map( ELECTRICAL_PINTYPE::PT_NC,
_HKI(
"Unconnected" ) );
1517 if( pinShapeEnum.Choices().GetCount() == 0 )
1519 pinShapeEnum.Map( GRAPHIC_PINSHAPE::LINE,
_HKI(
"Line" ) )
1520 .Map( GRAPHIC_PINSHAPE::INVERTED,
_HKI(
"Inverted" ) )
1521 .Map( GRAPHIC_PINSHAPE::CLOCK,
_HKI(
"Clock" ) )
1522 .Map( GRAPHIC_PINSHAPE::INVERTED_CLOCK,
_HKI(
"Inverted clock" ) )
1523 .Map( GRAPHIC_PINSHAPE::INPUT_LOW,
_HKI(
"Input low" ) )
1524 .Map( GRAPHIC_PINSHAPE::CLOCK_LOW,
_HKI(
"Clock low" ) )
1525 .Map( GRAPHIC_PINSHAPE::OUTPUT_LOW,
_HKI(
"Output low" ) )
1526 .Map( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK,
_HKI(
"Falling edge clock" ) )
1527 .Map( GRAPHIC_PINSHAPE::NONLOGIC,
_HKI(
"NonLogic" ) );
1532 if( orientationEnum.Choices().GetCount() == 0 )
1534 orientationEnum.Map( PIN_ORIENTATION::PIN_RIGHT,
_(
"Right" ) )
1535 .Map( PIN_ORIENTATION::PIN_LEFT,
_(
"Left" ) )
1536 .Map( PIN_ORIENTATION::PIN_UP,
_(
"Up" ) )
1537 .Map( PIN_ORIENTATION::PIN_DOWN,
_(
"Down" ) );
1555 PROPERTY_DISPLAY::PT_SIZE ) );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
void SetOrigin(const Vec &pos)
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
bool Intersects(const BOX2< Vec > &aRect) const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
void SetEnd(coord_type x, coord_type y)
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.
EDA_ITEM_FLAGS GetFlags() const
static ENUM_MAP< T > & Instance()
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)
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
Store schematic specific render settings.
The base class for drawable items used by schematic library symbols.
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
const KIFONT::METRICS & GetFontMetrics() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
LIB_SYMBOL * GetParent() const
void SetConvert(int aConvert)
void printPinElectricalTypeName(const RENDER_SETTINGS *aSettings, VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed)
Draw the electrical type text of the pin (only for the footprint editor)
void SetShape(GRAPHIC_PINSHAPE aShape)
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void MirrorHorizontal(const VECTOR2I &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
ELECTRICAL_PINTYPE GetType() const
const BOX2I GetBoundingBox() const override
void SetName(const wxString &aName)
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
void SetNameTextSize(int aSize)
void validateExtentsCache(KIFONT::FONT *aFont, int aSize, const wxString &aText, EXTENTS_CACHE *aCache) const
void PlotPinTexts(PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
Plot the pin number and pin text info, given the pin line coordinates.
void SetType(ELECTRICAL_PINTYPE aType)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
PIN_ORIENTATION GetOrientation() const
std::ostream & operator<<(std::ostream &aStream)
wxString GetShownNumber() const
LIB_PIN(LIB_SYMBOL *aParent)
int GetNumberTextSize() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
wxString GetShownName() const
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
wxString const GetCanonicalElectricalTypeName() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void MoveTo(const VECTOR2I &aNewPosition) override
Move a draw object to aPosition.
wxString GetClass() const override
Return the class name.
EXTENTS_CACHE m_nameExtentsCache
VECTOR2I GetPosition() const override
void CalcEdit(const VECTOR2I &aPosition) override
Calculate the attributes of an item at aPosition when it is being edited.
const wxString & GetNumber() const
PIN_ORIENTATION PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
wxString const GetElectricalTypeName() const
std::map< wxString, ALT > m_alternates
void SetOrientation(PIN_ORIENTATION aOrientation)
EXTENTS_CACHE m_numExtentsCache
GRAPHIC_PINSHAPE GetShape() const
void SetNumber(const wxString &aNumber)
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print a pin, with or without the pin texts.
void printPinSymbol(const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, PIN_ORIENTATION aOrientation, bool aDimmed)
Print the pin symbol without text.
PIN_ORIENTATION m_orientation
void printPinTexts(const RENDER_SETTINGS *aSettings, 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.
ELECTRICAL_PINTYPE m_type
const wxString & GetName() const
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
void SetLength(int aLength)
void PlotSymbol(PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation, bool aDimmed) const
int GetNameTextSize() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
VECTOR2I GetPinRoot() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
int GetPenWidth() const override
void SetNumberTextSize(int aSize)
Define a library symbol object.
int GetPinNameOffset() const
bool ShowPinNames() const
bool ShowPinNumbers() const
Container for data for KiCad programs.
virtual SETTINGS_MANAGER & GetSettingsManager() const
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, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
virtual void SetColor(const COLOR4D &color)=0
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.
Base class for any item which can be embedded within the SCHEMATIC container class,...
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
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)
A lower-precision version of StringFromValue().
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
#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_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & ANGLE_90
#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.
TRANSFORM DefaultTransform
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)
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
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
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static struct LIB_PIN_DESC _LIB_PIN_DESC
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
#define TARGET_PIN_RADIUS
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.
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
wxString UnescapeString(const wxString &aSource)
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
ELECTRICAL_PINTYPE m_Type
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< double > VECTOR2D