42#define PIN_TEXT_MARGIN 4
50 static const wxChar* msgPinElectricType[] =
54 wxT(
"bidirectional" ),
61 wxT(
"open_collector" ),
62 wxT(
"open_emitter" ),
66 return msgPinElectricType[
static_cast<int>( aType )];
101 m_position( { 0, 0 } ),
132 int aNameTextSize,
int aNumTextSize,
int aBodyStyle,
const VECTOR2I& aPos,
138 m_orientation( aOrientation ),
142 m_numTextSize( aNumTextSize ),
143 m_nameTextSize( aNameTextSize ),
161 wxASSERT( aParentSymbol );
176 const KIID& aUuid ) :
186 wxASSERT( aParentSymbol );
195 m_libPin( aPin.m_libPin ),
196 m_position( aPin.m_position ),
197 m_length( aPin.m_length ),
198 m_orientation( aPin.m_orientation ),
199 m_shape( aPin.m_shape ),
200 m_type( aPin.m_type ),
201 m_hidden( aPin.m_hidden ),
202 m_numTextSize( aPin.m_numTextSize ),
203 m_nameTextSize( aPin.m_nameTextSize ),
204 m_isDangling( aPin.m_isDangling )
238 return symbol->GetTransform().TransformCoordinate(
m_position ) + symbol->GetPosition();
247 wxCHECK_MSG(
m_libPin, PIN_ORIENTATION::PIN_RIGHT, wxS(
"Can't inherit without a libPin!" ) );
258 if( !
m_alt.IsEmpty() )
260 wxCHECK_MSG(
m_libPin, GRAPHIC_PINSHAPE::LINE, wxS(
"Can't specify alternate without a "
265 else if(
m_shape == GRAPHIC_PINSHAPE::INHERIT )
267 wxCHECK_MSG(
m_libPin, GRAPHIC_PINSHAPE::LINE, wxS(
"Can't inherit without a libPin!" ) );
280 wxCHECK_MSG(
m_libPin, 0, wxS(
"Can't inherit without a libPin!" ) );
291 if( !
m_alt.IsEmpty() )
293 wxCHECK_MSG(
m_libPin, ELECTRICAL_PINTYPE::PT_UNSPECIFIED, wxS(
"Can't specify alternate "
294 "without a libPin!" ) );
298 else if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
300 wxCHECK_MSG(
m_libPin, ELECTRICAL_PINTYPE::PT_UNSPECIFIED, wxS(
"Can't inherit without a "
312 if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
315 wxS(
"Can't inherit without a m_libPin!" ) );
326 if(
m_type == ELECTRICAL_PINTYPE::PT_INHERIT )
329 wxS(
"Can't inherit without a m_libPin!" ) );
342 wxCHECK_MSG(
m_libPin,
true, wxS(
"Can't inherit without a libPin!" ) );
353 if( !
m_alt.IsEmpty() )
367 m_name.Replace( wxT(
" " ), wxT(
"_" ) );
374 bool isConnectableType_a =
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
375 ||
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
376 bool isConnectableType_b = aPin->
GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE
377 || aPin->
GetType() == ELECTRICAL_PINTYPE::PT_NIC;
382 && (
GetType() == aPin->
GetType() || isConnectableType_a || isConnectableType_b );
401 bool isReplaced =
false;
417 aAccuracy = std::max( aAccuracy,
Schematic()->Settings().m_PinSymbolSize / 4 );
444 if( !
m_alt.IsEmpty() )
449 if(
m_name == wxS(
"~" ) )
450 return wxEmptyString;
459 return wxEmptyString;
470 m_number.Replace( wxT(
" " ), wxT(
"_" ) );
480 wxS(
"Can't inherit without a libPin!" ) );
502 wxS(
"Can't inherit without a libPin!" ) );
523 const TRANSFORM& t = symbol->GetTransform();
540 const VECTOR2I& aOffset,
bool aForceNoFill,
bool aDimmed )
544 wxCHECK( part && aSettings, );
565 &&
m_type != ELECTRICAL_PINTYPE::PT_NC
566 &&
m_type != ELECTRICAL_PINTYPE::PT_NIC )
592 int MapX1, MapY1, x1, y1;
616 switch( aOrientation )
618 case PIN_ORIENTATION::PIN_UP: y1 = posY - len; MapY1 = 1;
break;
619 case PIN_ORIENTATION::PIN_DOWN: y1 = posY + len; MapY1 = -1;
break;
620 case PIN_ORIENTATION::PIN_LEFT: x1 = posX - len; MapX1 = 1;
break;
621 case PIN_ORIENTATION::PIN_RIGHT: x1 = posX + len; MapX1 = -1;
break;
622 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
break;
625 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
630 GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
640 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
641 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
642 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
643 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
649 GRLineTo( DC, x1 - MapX1 * clock_size * 2, y1, width,
color );
655 GRLineTo( DC, x1, y1 - MapY1 * clock_size * 2, width,
color );
661 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
662 ||
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
663 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
668 GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
669 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width,
color );
674 GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
675 GRLineTo( DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width,
color );
680 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
686 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1, width,
color );
691 GRLineTo( DC, x1, y1 + MapY1 * deco_size * 2, width,
color );
694 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
697 GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
698 GRLineTo( DC, x1 + (MapX1 + MapY1) * deco_size, y1 + ( MapY1 - MapX1 ) * deco_size, width,
700 GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
701 GRLineTo( DC, x1 + (MapX1 - MapY1) * deco_size, y1 + ( MapY1 + MapX1 ) * deco_size, width,
705 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
708 GRLine( DC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width,
710 GRLine( DC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width,
718 bool aDrawPinName,
bool aDimmed )
720 if( !aDrawPinName && !aDrawPinNum )
746 nameColor = nameColor.
Mix( bg, 0.5f );
747 numColor = numColor.
Mix( bg, 0.5f );
755 case PIN_ORIENTATION::PIN_UP: y1 -=
GetLength();
break;
756 case PIN_ORIENTATION::PIN_DOWN: y1 +=
GetLength();
break;
757 case PIN_ORIENTATION::PIN_LEFT: x1 -=
GetLength();
break;
758 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
GetLength();
break;
759 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxT(
"aPinOrient must be resolved!" ) );
break;
763 aDrawPinName =
false;
773 nameSize, hAlign, vAlign, 0,
false,
false, font,
GetFontMetrics() );
781 numSize, hAlign, vAlign, 0,
false,
false, font,
GetFontMetrics() );
786 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
787 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
792 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
813 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
845 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
846 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
849 if( aDrawPinName && aDrawPinNum )
857 else if( aDrawPinName )
862 else if( aDrawPinNum )
870 if( aDrawPinName && aDrawPinNum )
878 else if( aDrawPinName )
883 else if( aDrawPinNum )
903 #define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
909 int pensize = textSize/6;
933 switch( aOrientation )
935 case PIN_ORIENTATION::PIN_UP:
941 case PIN_ORIENTATION::PIN_DOWN:
946 case PIN_ORIENTATION::PIN_LEFT:
950 case PIN_ORIENTATION::PIN_RIGHT:
955 case PIN_ORIENTATION::INHERIT:
956 wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
968 int MapX1, MapY1, x1, y1;
975 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
988 x1 = aPosition.
x; y1 = aPosition.
y;
990 switch( aOrientation )
992 case PIN_ORIENTATION::PIN_UP: y1 = aPosition.
y - pinLength; MapY1 = 1;
break;
993 case PIN_ORIENTATION::PIN_DOWN: y1 = aPosition.
y + pinLength; MapY1 = -1;
break;
994 case PIN_ORIENTATION::PIN_LEFT: x1 = aPosition.
x - pinLength; MapX1 = 1;
break;
995 case PIN_ORIENTATION::PIN_RIGHT: x1 = aPosition.
x + pinLength; MapX1 = -1;
break;
996 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aOrientation must be resolved!" ) );
break;
999 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
1002 aPlotter->
Circle(
VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
1003 FILL_T::NO_FILL, penWidth );
1005 aPlotter->
MoveTo(
VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
1008 else if(
m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
1024 aPlotter->
MoveTo(
VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
1033 if(
m_shape == GRAPHIC_PINSHAPE::CLOCK
1034 ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
1035 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
1052 if(
m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
1053 ||
m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
1060 aPlotter->
LineTo(
VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
1066 aPlotter->
LineTo(
VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
1071 if(
m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW )
1086 else if(
m_shape == GRAPHIC_PINSHAPE::NONLOGIC )
1090 y1 - ( MapY1 - MapX1 ) * deco_size ) );
1092 y1 + ( MapY1 - MapX1 ) * deco_size ) );
1094 y1 - ( MapY1 + MapX1 ) * deco_size ) );
1096 y1 + ( MapY1 + MapX1 ) * deco_size ) );
1099 if(
m_type == ELECTRICAL_PINTYPE::PT_NC )
1102 const int ex1 = aPosition.
x;
1103 const int ey1 = aPosition.
y;
1104 aPlotter->
MoveTo(
VECTOR2I( ex1 - deco_size, ey1 - deco_size ) );
1106 aPlotter->
MoveTo(
VECTOR2I( ex1 + deco_size, ey1 - deco_size ) );
1113 int aTextInside,
bool aDrawPinNum,
bool aDrawPinName,
1114 bool aDimmed )
const
1122 aDrawPinName =
false;
1125 aDrawPinNum =
false;
1127 if( !aDrawPinNum && !aDrawPinName )
1140 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
1141 bg = COLOR4D::WHITE;
1147 nameColor = nameColor.
Mix( bg, 0.5f );
1148 numColor = numColor.
Mix( bg, 0.5f );
1154 switch( aPinOrient )
1156 case PIN_ORIENTATION::PIN_UP: y1 -=
GetLength();
break;
1157 case PIN_ORIENTATION::PIN_DOWN: y1 +=
GetLength();
break;
1158 case PIN_ORIENTATION::PIN_LEFT: x1 -=
GetLength();
break;
1159 case PIN_ORIENTATION::PIN_RIGHT: x1 +=
GetLength();
break;
1160 case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS(
"aPinOrient must be resolved!" ) );
break;
1196 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
1197 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1201 if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
1221 if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
1253 if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
1254 || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
1257 if( aDrawPinName && aDrawPinNum )
1265 else if( aDrawPinName )
1270 else if( aDrawPinNum )
1279 if( aDrawPinName && aDrawPinNum )
1287 else if( aDrawPinName )
1292 else if( aDrawPinNum )
1310 case PIN_ORIENTATION::PIN_RIGHT: end.
x = 1;
break;
1311 case PIN_ORIENTATION::PIN_UP: end.
y = -1;
break;
1312 case PIN_ORIENTATION::PIN_DOWN: end.
y = 1;
break;
1313 case PIN_ORIENTATION::PIN_LEFT: end.
x = -1;
break;
1318 orient = PIN_ORIENTATION::PIN_UP;
1323 orient = PIN_ORIENTATION::PIN_DOWN;
1327 orient = PIN_ORIENTATION::PIN_RIGHT;
1330 orient = PIN_ORIENTATION::PIN_LEFT;
1375 return static_cast<int>(
m_shape ) -
static_cast<int>( tmp->
m_shape );
1378 return static_cast<int>(
m_type ) -
static_cast<int>( tmp->
m_type );
1397 const ALT& lhsAlt = lhsItem->second;
1398 const ALT& rhsAlt = rhsItem->second;
1406 return static_cast<int>( lhsAlt.
m_Type ) -
static_cast<int>( rhsAlt.
m_Type );
1409 return static_cast<int>( lhsAlt.
m_Shape ) -
static_cast<int>( rhsAlt.
m_Shape );
1420 int lengthChange =
GetLength() - aLength;
1427 case PIN_ORIENTATION::PIN_RIGHT:
1428 offsetX = lengthChange;
1430 case PIN_ORIENTATION::PIN_LEFT:
1431 offsetX = -1 * lengthChange;
1433 case PIN_ORIENTATION::PIN_UP:
1434 offsetY = lengthChange;
1436 case PIN_ORIENTATION::PIN_DOWN:
1437 offsetY = -1 * lengthChange;
1495 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1496 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1497 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1498 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1508 case PIN_ORIENTATION::PIN_RIGHT:
m_orientation = PIN_ORIENTATION::PIN_UP;
break;
1509 case PIN_ORIENTATION::PIN_UP:
m_orientation = PIN_ORIENTATION::PIN_LEFT;
break;
1510 case PIN_ORIENTATION::PIN_LEFT:
m_orientation = PIN_ORIENTATION::PIN_DOWN;
break;
1511 case PIN_ORIENTATION::PIN_DOWN:
m_orientation = PIN_ORIENTATION::PIN_RIGHT;
break;
1519 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
1550 aList.emplace_back(
_(
"Type" ),
_(
"Pin" ) );
1555 wxString(
"Undefined library pin." );
1556 aList.emplace_back(
_(
"Unit" ), msg );
1562 wxString(
"Undefined library pin." );
1563 aList.emplace_back(
_(
"Body Style" ), msg );
1572 aList.emplace_back(
_(
"Visible" ),
IsVisible() ?
_(
"Yes" ) :
_(
"No" ) );
1591 aList.emplace_back( symbol->
GetRef( currentSheet ),
1644 if( it->second.second == aForceNoConnect )
1645 return it->second.first;
1648 wxString
name =
"Net-(";
1649 bool unconnected =
false;
1651 if( aForceNoConnect ||
GetType() == ELECTRICAL_PINTYPE::PT_NC )
1654 name = (
"unconnected-(" );
1657 bool annotated =
true;
1659 std::vector<SCH_PIN*> pins = symbol->
GetPins( &aPath );
1660 bool has_multiple =
false;
1666 && unconnected == (
pin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) )
1668 has_multiple =
true;
1677 if( symbol->
GetRef( &aPath,
false ).Last() ==
'?' )
1682 name <<
"-Pad" << libPinNumber <<
")";
1685 else if( !libPinShownName.IsEmpty() && ( libPinShownName != libPinShownNumber ) )
1692 if( unconnected || has_multiple )
1732 if( aCache->
m_Font == aFont
1751 bool aIncludeElectricalType )
const
1758 aIncludeElectricalType );
1760 r = symbol->GetTransform().TransformCoordinate( r );
1761 r.
Offset( symbol->GetPosition() );
1773 int pinNameOffset = 0;
1774 int nameTextLength = 0;
1775 int nameTextHeight = 0;
1776 int numberTextLength = 0;
1777 int numberTextHeight = 0;
1778 int typeTextLength = 0;
1779 bool includeName = aIncludeNameAndNumber && !
GetShownName().IsEmpty();
1780 bool includeNumber = aIncludeNameAndNumber && !
GetShownNumber().IsEmpty();
1781 bool includeType = aIncludeElectricalType;
1784 if( !aIncludeLabelsOnInvisiblePins && !
IsVisible() )
1786 includeName =
false;
1787 includeNumber =
false;
1788 includeType =
false;
1793 if( parentSymbol->GetShowPinNames() )
1794 pinNameOffset = parentSymbol->GetPinNameOffset();
1796 includeName =
false;
1798 if( !parentSymbol->GetShowPinNumbers() )
1799 includeNumber =
false;
1819 double stroke = fontSize / 8.0;
1822 KiROUND( stroke ),
false,
false,
1826 minsizeV = std::max( minsizeV, typeTextSize.
y / 2 );
1830 if(
m_shape == GRAPHIC_PINSHAPE::INVERTED ||
m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
1834 if( pinNameOffset || !includeName )
1838 begin.
y = std::min( -minsizeV, -numberTextHeight );
1839 begin.
x = std::min( -typeTextLength,
GetLength() - ( numberTextLength / 2 ) );
1842 end.
y = std::max( minsizeV, nameTextHeight / 2 );
1848 begin.
y = std::min( -minsizeV, -nameTextHeight );
1849 begin.
x = -typeTextLength;
1850 begin.
x = std::min( begin.
x, (
GetLength() - numberTextLength ) / 2 );
1851 begin.
x = std::min( begin.
x, (
GetLength() - nameTextLength ) / 2 );
1854 end.
x = std::max( end.
x, (
GetLength() + nameTextLength ) / 2 );
1855 end.
x = std::max( end.
x, (
GetLength() + numberTextLength ) / 2 );
1856 end.
y = std::max( minsizeV, numberTextHeight );
1862 case PIN_ORIENTATION::PIN_UP:
1868 case PIN_ORIENTATION::PIN_DOWN:
1875 case PIN_ORIENTATION::PIN_LEFT:
1881 case PIN_ORIENTATION::PIN_RIGHT:
1907 wxCHECK(
pin,
false );
1947 if( !
m_alt.IsEmpty() )
1950 alt = &localStorage;
1954 : wxString( wxS(
"Undefined library pin." ) );
1958 return wxString::Format(
"Symbol %s %s",
1980 if ( !
name.IsEmpty() )
1982 return wxString::Format(
_(
"Pin %s [%s, %s, %s]" ),
1990 return wxString::Format(
_(
"Pin %s [%s, %s]" ),
1998 if( !
name.IsEmpty() )
2000 return wxString::Format(
_(
"Hidden pin %s [%s, %s, %s]" ),
2008 return wxString::Format(
_(
"Hidden pin %s [%s, %s]" ),
2076 const ALT& lhsAlt = lhsItem->second;
2077 const ALT& rhsAlt = rhsItem->second;
2162 aStream <<
"SCH_PIN:" << std::endl
2163 <<
" Name: \"" <<
m_name <<
"\"" << std::endl
2164 <<
" Number: \"" <<
m_number <<
"\"" << std::endl
2166 <<
" Length: " <<
GetLength() << std::endl
2179void SCH_PIN::Show(
int nestLevel, std::ostream& os )
const
2181 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
2203 if( pinTypeEnum.Choices().GetCount() == 0 )
2205 pinTypeEnum.Map( ELECTRICAL_PINTYPE::PT_INPUT,
_HKI(
"Input" ) )
2206 .Map( ELECTRICAL_PINTYPE::PT_OUTPUT,
_HKI(
"Output" ) )
2207 .Map( ELECTRICAL_PINTYPE::PT_BIDI,
_HKI(
"Bidirectional" ) )
2208 .Map( ELECTRICAL_PINTYPE::PT_TRISTATE,
_HKI(
"Tri-state" ) )
2209 .Map( ELECTRICAL_PINTYPE::PT_PASSIVE,
_HKI(
"Passive" ) )
2210 .Map( ELECTRICAL_PINTYPE::PT_NIC,
_HKI(
"Free" ) )
2211 .Map( ELECTRICAL_PINTYPE::PT_UNSPECIFIED,
_HKI(
"Unspecified" ) )
2212 .Map( ELECTRICAL_PINTYPE::PT_POWER_IN,
_HKI(
"Power input" ) )
2213 .Map( ELECTRICAL_PINTYPE::PT_POWER_OUT,
_HKI(
"Power output" ) )
2214 .Map( ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,
_HKI(
"Open collector" ) )
2215 .Map( ELECTRICAL_PINTYPE::PT_OPENEMITTER,
_HKI(
"Open emitter" ) )
2216 .Map( ELECTRICAL_PINTYPE::PT_NC,
_HKI(
"Unconnected" ) );
2221 if( pinShapeEnum.Choices().GetCount() == 0 )
2223 pinShapeEnum.Map( GRAPHIC_PINSHAPE::LINE,
_HKI(
"Line" ) )
2224 .Map( GRAPHIC_PINSHAPE::INVERTED,
_HKI(
"Inverted" ) )
2225 .Map( GRAPHIC_PINSHAPE::CLOCK,
_HKI(
"Clock" ) )
2226 .Map( GRAPHIC_PINSHAPE::INVERTED_CLOCK,
_HKI(
"Inverted clock" ) )
2227 .Map( GRAPHIC_PINSHAPE::INPUT_LOW,
_HKI(
"Input low" ) )
2228 .Map( GRAPHIC_PINSHAPE::CLOCK_LOW,
_HKI(
"Clock low" ) )
2229 .Map( GRAPHIC_PINSHAPE::OUTPUT_LOW,
_HKI(
"Output low" ) )
2230 .Map( GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK,
_HKI(
"Falling edge clock" ) )
2231 .Map( GRAPHIC_PINSHAPE::NONLOGIC,
_HKI(
"NonLogic" ) );
2236 if( orientationEnum.Choices().GetCount() == 0 )
2238 orientationEnum.Map( PIN_ORIENTATION::PIN_RIGHT,
_(
"Right" ) )
2239 .Map( PIN_ORIENTATION::PIN_LEFT,
_(
"Left" ) )
2240 .Map( PIN_ORIENTATION::PIN_UP,
_(
"Up" ) )
2241 .Map( PIN_ORIENTATION::PIN_DOWN,
_(
"Down" ) );
2244 auto isSymbolEditor =
2248 return dynamic_cast<LIB_SYMBOL*
>(
pin->GetParentSymbol() ) !=
nullptr;
2267 _HKI(
"Electrical Type" ),
2272 _HKI(
"Graphic Style" ),
2290 PROPERTY_DISPLAY::PT_SIZE ) )
2295 PROPERTY_DISPLAY::PT_SIZE ) )
2300 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 Offset(coord_type dx, coord_type dy)
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.
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)
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
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
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)
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.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
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.
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.
wxString GetElectricalTypeName() const
int GetPenWidth() const override
bool operator==(const SCH_ITEM &aOther) const override
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)
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
Mirror item horizontally about aCenter.
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)
VECTOR2I GetPosition() const override
EXTENTS_CACHE m_numExtentsCache
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
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
Provide the draw object specific comparison called by the == and < operators.
wxString GetShownName() const
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)
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)
EXTENTS_CACHE m_nameExtentsCache
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_ShowConnectionPoints
bool m_ShowPinElectricalTypes
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.
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)
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 & Pgm()
The global Program "get" accessor.
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.
#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.
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