57 std::string ret =
TO_UTF8( txt );
61 if( (
unsigned char) c <=
' ' )
116 std::unique_ptr< LIB_SYMBOL > part;
145 SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.
Convert, aPosition, aParent )
148 for(
const std::pair<int, wxString>& i : aSel.
Fields )
151 SetRef( aSheet, i.second );
153 field->SetText( i.second );
178 field.SetParent(
this );
183 for(
const std::unique_ptr<SCH_PIN>&
pin : aSymbol.
m_pins )
185 m_pins.emplace_back( std::make_unique<SCH_PIN>( *
pin ) );
186 m_pins.back()->SetParent(
this );
250 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
252 if( ( (
pin->GetPosition().x -
m_pos.
x ) % min_grid_size ) != 0 )
255 if( ( (
pin->GetPosition().y -
m_pos.
y ) % min_grid_size ) != 0 )
280 wxCHECK2( !aLibSymbol || aLibSymbol->
IsRoot(), aLibSymbol =
nullptr );
282 m_part.reset( aLibSymbol );
290 return m_part->GetDescription();
292 return wxEmptyString;
299 return m_part->GetKeyWords();
301 return wxEmptyString;
308 return m_part->GetDatasheetField().GetText();
310 return wxEmptyString;
316 std::map<wxString, wxString> altPinMap;
317 std::map<wxString, std::set<SCH_PIN*>> pinUuidMap;
318 std::set<SCH_PIN*> unassignedSchPins;
319 std::set<SCH_PIN*> unassignedLibPins;
321 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
323 pinUuidMap[
pin->GetNumber() ].insert(
pin.get() );
325 unassignedSchPins.insert(
pin.get() );
327 if( !
pin->GetAlt().IsEmpty() )
328 altPinMap[
pin->GetNumber() ] =
pin->GetAlt();
330 pin->SetLibPin(
nullptr );
347 auto ii = pinUuidMap.find( libPin->GetNumber() );
349 if( ii == pinUuidMap.end() || ii->second.empty() )
351 unassignedLibPins.insert( libPin );
355 auto it = ii->second.begin();
357 ii->second.erase( it );
358 pin->SetLibPin( libPin );
359 pin->SetPosition( libPin->GetPosition() );
361 unassignedSchPins.erase(
pin );
363 auto iii = altPinMap.find( libPin->GetNumber() );
365 if( iii != altPinMap.end() )
366 pin->SetAlt( iii->second );
372 for(
SCH_PIN* libPin : unassignedLibPins )
377 if( !unassignedSchPins.empty() )
379 auto it = unassignedSchPins.begin();
381 unassignedSchPins.erase( it );
386 pin =
m_pins.emplace_back( std::make_unique<SCH_PIN>(
SCH_PIN(
this, libPin ) ) ).get();
390 pin->SetLibPin( libPin );
391 pin->SetPosition( libPin->GetPosition() );
392 pin->SetNumber( libPin->GetNumber() );
394 auto iii = altPinMap.find( libPin->GetNumber() );
396 if( iii != altPinMap.end() )
397 pin->SetAlt( iii->second );
401 for(
auto it1 =
m_pins.begin(); it1 !=
m_pins.end() && !unassignedSchPins.empty(); )
403 auto it2 = unassignedSchPins.find( it1->get() );
405 if( it2 != unassignedSchPins.end() )
407 it1 =
m_pins.erase( it1 );
408 unassignedSchPins.erase( it2 );
419 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
455 return m_part->HasAlternateBodyStyle();
470 return m_part->GetUnitCount();
480 return m_part->GetUnitDisplayName( aUnit );
488 return m_part->HasUnitDisplayName( aUnit );
493 const VECTOR2I& aOffset,
bool aDimmed )
510 const VECTOR2I& aOffset,
bool aForceNoFill,
bool aDimmed )
527 for(
unsigned i = 0; i < tempPins.size(); ++ i )
530 SCH_PIN* tempPin = tempPins[ i ];
544 text->SetText(
dummy.GetShownText(
false ) );
553 dummy()->Print( &localRenderSettings, 0, 0,
m_pos + aOffset, aForceNoFill, aDimmed );
557 field.Print( &localRenderSettings,
m_unit,
m_bodyStyle, aOffset, aForceNoFill, aDimmed );
568 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
569 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
585 const KIID_PATH& aSheetPath,
bool aTestFromEnd )
const
591 if( instance.m_Path == aSheetPath )
593 aInstance = instance;
597 else if( instance.m_Path.EndsWith( aSheetPath ) )
599 aInstance = instance;
623 " reference %s, unit %d from symbol %s." ),
645 " reference %s, unit %d from symbol %s." ),
686 std::vector<SCH_SYMBOL_INSTANCE>::iterator resultIt;
691 [searchPath](
const auto& it )
693 return it.m_Path == searchPath;
700 " reference %s, unit %d from symbol %s." ),
702 resultIt->m_Reference,
744 if( instance.m_Path ==
path )
746 ref = instance.m_Reference;
783 if( instance.m_Path ==
path )
786 instance.m_Reference = ref;
794 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
795 pin->ClearDefaultNetName( sheet );
817 if( instance.m_Path ==
path )
818 return instance.m_Reference.Last() !=
'?';
829 refDesignator.Replace(
"~",
" " );
831 wxString prefix = refDesignator;
833 while( prefix.Length() )
835 wxUniCharRef last = prefix.Last();
837 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
845 prefix.Trim(
false );
847 if( !prefix.IsEmpty() )
855 return schematic->Settings().SubReference( aUnit, aAddSeparator );
867 if( instance.m_Path ==
path )
868 return instance.m_Unit;
884 if( instance.m_Path ==
path )
886 instance.m_Unit = aUnitSelection;
899 instance.m_Unit = aUnitSelection;
904 bool aAllowExtraText )
const
920 bool aAllowExtraText )
const
951 if( field.GetId() == aFieldId )
963 if( field.GetName() == aFieldName )
975 if( field.GetName() == aFieldName )
989 if( !field.IsVisible() || field.GetText().IsEmpty() )
993 aVector.push_back( &field );
1009 if( aFieldName ==
m_fields[i].GetName(
false ) )
1019 bool aCaseInsensitive )
1023 for(
unsigned i = start; i <
m_fields.size(); ++i )
1025 if( aCaseInsensitive )
1027 if( aFieldName.Upper() ==
m_fields[i].GetName(
false ).Upper() )
1032 if( aFieldName ==
m_fields[i].GetName(
false ) )
1042 bool aUpdateOtherFields,
bool aResetRef,
bool aResetOtherFields )
1046 std::vector<SCH_FIELD*> fields;
1047 m_part->GetFields( fields );
1049 for(
const SCH_FIELD* libField : fields )
1051 int id = libField->GetId();
1054 if( libField->IsMandatory() )
1060 schField =
FindField( libField->GetCanonicalName() );
1064 wxString fieldName = libField->GetCanonicalName();
1079 SetRef( aPath,
m_part->GetReferenceField().GetText() );
1080 else if( aUpdateRef )
1081 SetRef( aPath, libField->GetText() );
1089 if( aResetOtherFields || aUpdateOtherFields )
1094 if( aResetOtherFields )
1096 else if( aUpdateOtherFields )
1097 schField->
SetText( libField->GetText() );
1101 if( aResetOtherFields || aUpdateOtherFields )
1102 schField->
SetText( libField->GetText() );
1112 bool updateValue =
true;
1113 bool updateExclFromBOM =
true;
1114 bool updateExclFromBoard =
true;
1115 bool updateDNP =
true;
1116 bool updateOtherFields =
true;
1117 bool updatePins =
true;
1121 updateValue = aProperty->
Name() ==
_HKI(
"Value" );
1122 updateExclFromBoard = aProperty->
Name() ==
_HKI(
"Exclude From Board" );
1123 updateExclFromBOM = aProperty->
Name() ==
_HKI(
"Exclude From Bill of Materials" );
1124 updateDNP = aProperty->
Name() ==
_HKI(
"Do not Populate" );
1125 updateOtherFields =
false;
1130 && !updateExclFromBOM
1131 && !updateExclFromBoard
1133 && !updateOtherFields
1143 wxString ref =
GetRef( &aSourceSheet );
1148 std::vector<SCH_SYMBOL*> otherUnits;
1154 aCommit.
Modify( otherUnit, screen );
1159 if( updateOtherFields )
1177 newField.
Offset( otherUnit->GetPosition() );
1180 otherUnit->AddField( newField );
1184 for(
size_t ii = otherUnit->GetFields().size() - 1; ii >
DATASHEET_FIELD; ii-- )
1186 SCH_FIELD& otherField = otherUnit->GetFields().at( ii );
1189 otherUnit->GetFields().erase( otherUnit->GetFields().begin() + ii );
1193 if( updateExclFromBOM )
1196 if( updateExclFromBoard )
1200 otherUnit->SetDNP(
m_DNP );
1204 for(
const std::unique_ptr<SCH_PIN>& model_pin :
m_pins )
1206 SCH_PIN* src_pin = otherUnit->GetPin( model_pin->GetNumber() );
1209 src_pin->
SetAlt( model_pin->GetAlt() );
1220 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1221 aFunction(
pin.get() );
1224 aFunction( &field );
1230 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1232 if(
pin->GetNumber() == aNumber )
1242 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1244 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
1246 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
1249 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1252 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
1255 if(
pin->IsPointClickableAnchor( aPos ) )
1268 return std::vector<SCH_PIN*>();
1275 return m_part->GetAllLibPins();
1277 return std::vector<SCH_PIN*>();
1289 auto it =
m_pinMap.find( aLibPin );
1294 wxFAIL_MSG_AT(
"Pin not found", __FILE__, __LINE__, __FUNCTION__ );
1301 std::vector<SCH_PIN*> pins;
1303 if( aSheet ==
nullptr )
1305 wxCHECK_MSG(
Schematic(), pins,
"Can't call GetPins on a symbol with no schematic" );
1312 for(
const std::unique_ptr<SCH_PIN>& p :
m_pins )
1314 if( unit && p->GetLibPin() && p->GetLibPin()->GetUnit()
1315 && ( p->GetLibPin()->GetUnit() != unit ) )
1320 pins.push_back( p.get() );
1332 wxT(
"Cannot swap data with invalid symbol." ) );
1340 for( std::unique_ptr<SCH_PIN>&
pin : symbol->
m_pins )
1341 pin->SetParent( symbol );
1343 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1344 pin->SetParent(
this );
1349 m_part.reset( libSymbol );
1382 aVars->push_back(
m_fields[i].GetCanonicalName().Upper() );
1385 aVars->push_back(
m_fields[i].GetName() );
1387 aVars->push_back( wxT(
"OP" ) );
1388 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1389 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1390 aVars->push_back( wxT(
"UNIT" ) );
1391 aVars->push_back( wxT(
"SHORT_REFERENCE" ) );
1392 aVars->push_back( wxT(
"SYMBOL_LIBRARY" ) );
1393 aVars->push_back( wxT(
"SYMBOL_NAME" ) );
1394 aVars->push_back( wxT(
"SYMBOL_DESCRIPTION" ) );
1395 aVars->push_back( wxT(
"SYMBOL_KEYWORDS" ) );
1396 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1397 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1398 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1399 aVars->push_back( wxT(
"DNP" ) );
1400 aVars->push_back( wxT(
"SHORT_NET_NAME(<pin_number>)" ) );
1401 aVars->push_back( wxT(
"NET_NAME(<pin_number>)" ) );
1402 aVars->push_back( wxT(
"NET_CLASS(<pin_number>)" ) );
1403 aVars->push_back( wxT(
"PIN_NAME(<pin_number>)" ) );
1409 static wxRegEx operatingPoint( wxT(
"^"
1412 "(.([0-9])?([a-zA-Z]*))?"
1415 wxCHECK( aPath,
false );
1422 if( operatingPoint.Matches( *token ) )
1424 wxString
pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
1425 wxString precisionStr( operatingPoint.GetMatch( *token, 3 ) );
1426 wxString range( operatingPoint.GetMatch( *token, 4 ) );
1429 if( !precisionStr.IsEmpty() )
1430 precision = precisionStr[0] -
'0';
1432 if( range.IsEmpty() )
1433 range = wxS(
"~A" );
1443 spiceRef = spiceRef.Lower();
1450 else if(
pin == wxS(
":power" ) )
1452 if( range.IsEmpty() )
1453 range = wxS(
"~W" );
1455 *token = schematic->
GetOperatingPoint( spiceRef + wxS(
":power" ), precision, range );
1460 pin =
pin.SubString( 1, -1 );
1462 for(
const std::reference_wrapper<const SIM_MODEL_PIN>& modelPin : model.
GetPins() )
1464 SCH_PIN* symbolPin =
GetPin( modelPin.get().symbolPinNumber );
1468 if( model.
GetPins().size() == 2 )
1474 wxString signalName = spiceRef + wxS(
":" ) + modelPin.get().modelPinName;
1483 *token = wxS(
"?" );
1487 if( token->Contains(
':' ) )
1493 wxString upperToken = token->Upper();
1497 wxString field =
m_fields[i].GetCanonicalName();
1499 wxString textToken =
m_fields[i].GetText();
1500 textToken.Replace(
" ", wxEmptyString );
1501 wxString tokenString =
"${" + field +
"}";
1504 if( textToken.IsSameAs( tokenString,
false ) )
1507 if( token->IsSameAs( field,
false ) )
1510 *token =
GetRef( aPath,
true );
1512 *token =
m_fields[ i ].GetShownText( aPath,
false, aDepth + 1 );
1520 wxString field =
m_fields[ i ].GetName();
1522 wxString textToken =
m_fields[i].GetText();
1523 textToken.Replace(
" ", wxEmptyString );
1524 wxString tokenString =
"${" + field +
"}";
1526 if( textToken.IsSameAs( tokenString,
false ) )
1529 if( token->IsSameAs( field,
false ) )
1531 *token =
m_fields[ i ].GetShownText( aPath,
false, aDepth + 1 );
1537 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) )
1538 || token->IsSameAs( wxT(
"SIM.TYPE" ) )
1539 || token->IsSameAs( wxT(
"SIM.PINS" ) )
1540 || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
1541 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) )
1542 || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
1544 *token = wxEmptyString;
1551 if( token->IsSameAs( templateFieldname.m_Name )
1552 || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
1556 *token = wxEmptyString;
1561 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1565 wxArrayString parts = wxSplit( footprint,
':' );
1567 if( parts.Count() > 0 )
1568 *token = parts[ 0 ];
1570 *token = wxEmptyString;
1574 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1578 wxArrayString parts = wxSplit( footprint,
':' );
1580 if( parts.Count() > 1 )
1581 *token = parts[ std::min( 1, (
int) parts.size() - 1 ) ];
1583 *token = wxEmptyString;
1587 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
1592 else if( token->IsSameAs( wxT(
"SHORT_REFERENCE" ) ) )
1597 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
1602 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
1607 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
1612 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
1617 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1619 *token = wxEmptyString;
1622 *token =
_(
"Excluded from BOM" );
1626 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
1628 *token = wxEmptyString;
1631 *token =
_(
"Excluded from board" );
1635 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
1637 *token = wxEmptyString;
1640 *token =
_(
"Excluded from simulation" );
1644 else if( token->IsSameAs( wxT(
"DNP" ) ) )
1646 *token = wxEmptyString;
1648 if( aPath->
GetDNP() || this->GetDNP() )
1649 *token =
_(
"DNP" );
1653 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) )
1654 || token->StartsWith( wxT(
"NET_NAME(" ) )
1655 || token->StartsWith( wxT(
"NET_CLASS(" ) )
1656 || token->StartsWith( wxT(
"PIN_NAME(" ) ) )
1658 wxString pinNumber = token->AfterFirst(
'(' );
1659 pinNumber = pinNumber.BeforeLast(
')' );
1663 if(
pin->GetNumber() == pinNumber )
1665 if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
1667 *token =
pin->GetAlt().IsEmpty() ?
pin->GetName() :
pin->GetAlt();
1674 *token = wxEmptyString;
1675 else if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
1677 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
1678 *token = conn->
Name();
1679 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
1680 *token =
pin->GetEffectiveNetClass( aPath )->GetName();
1703 if( instance.m_Path ==
path )
1705 if( instance.m_Reference.IsEmpty() || aResetPrefix )
1716 if( instance.m_Reference.IsEmpty() || aResetPrefix)
1723 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1724 pin->ClearDefaultNetName( aSheetPath );
1732 if( currentReference.IsEmpty() || aResetPrefix )
1742 wxCHECK( aSheetPath.size() > 0,
false );
1747 if( instance.m_Path == aSheetPath )
1760 bool transform =
false;
1762 switch( aOrientation )
1883 wxFAIL_MSG(
"Invalid schematic symbol orientation type." );
1919 int rotate_values[] =
1939 for(
int type_rotate : rotate_values )
1951 wxFAIL_MSG(
"Schematic symbol orientation matrix internal error." );
1959void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const
1962 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1964 <<
'"' <<
" chipName=\""
1972 const wxString& value =
GetFields()[i].GetText();
1974 if( !value.IsEmpty() )
1976 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\""
1978 <<
'"' <<
" value=\""
1979 <<
TO_UTF8( value ) <<
"\"/>\n";
1983 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
2003 if( aIncludeFields )
2007 if( field.IsVisible() )
2008 bBox.
Merge( field.GetBoundingBox() );
2022 catch(
const boost::bad_pointer& e )
2024 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ), e.what() ) );
2055 msgs.Add(
_(
"Simulation" ) );
2058 msgs.Add(
_(
"BOM" ) );
2061 msgs.Add(
_(
"Board" ) );
2064 msgs.Add(
_(
"DNP" ) );
2066 msg = wxJoin( msgs,
'|' );
2067 msg.Replace(
'|', wxS(
", " ) );
2070 aList.emplace_back(
_(
"Exclude from" ), msg );
2081 aList.emplace_back(
_(
"Power symbol" ),
2086 aList.emplace_back(
_(
"Reference" ),
2090 aList.emplace_back(
_(
"Value" ),
2093 aList.emplace_back(
_(
"Name" ),
2098 aList.emplace_back(
_(
"flags" ), wxString::Format(
"%X",
GetEditFlags() ) );
2103 msg =
_(
"Missing parent" );
2105 std::shared_ptr< LIB_SYMBOL > parent =
m_part->GetParent().lock();
2108 msg = parent->GetName();
2118 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
2126 msg =
_(
"<Unknown>" );
2128 aList.emplace_back(
_(
"Footprint" ), msg );
2131 aList.emplace_back(
_(
"Description" ) + wxT(
": " )
2133 _(
"Keywords" ) + wxT(
": " ) +
m_part->GetKeyWords() );
2138 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
2140 aList.emplace_back(
_(
"Value" ),
2143 aList.emplace_back(
_(
"Name" ),
2148 if( libNickname.empty() )
2149 msg =
_(
"No library defined!" );
2151 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
2153 aList.emplace_back(
_(
"Library" ), msg );
2160 return BITMAPS::add_component;
2177 field.SetTextPos( pos );
2195 field.SetTextPos( pos );
2214 field.SetTextPos( pos );
2228 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2236 aItemList.push_back( item );
2242 std::vector<DANGLING_END_ITEM>& aItemListByPos,
2245 bool changed =
false;
2247 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2249 bool previousState =
pin->IsDangling();
2250 pin->SetIsDangling(
true );
2255 bool do_break =
false;
2257 for(
auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
2275 pin->SetIsDangling(
false );
2287 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
2297 wxT(
"Cannot get physical position of pin." ) );
2313 wxCHECK( symbol,
false );
2319 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2321 if(
pin->IsDangling() )
2334 if(
GetRef( aInstance ) != symbol->
GetRef( aInstance ) )
2339 && (
GetValue(
true, aInstance,
false ) != symbol->
GetValue(
true, aInstance,
false ) ) )
2345 for(
size_t i = 0; i <
m_pins.size(); i++ )
2357 std::vector<VECTOR2I> retval;
2359 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2363 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2365 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2368 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2371 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2397 return wxString::Format(
_(
"Symbol %s [%s]" ),
2404 const std::vector<KICAD_T>& aScanTypes )
2406 for(
KICAD_T scanType : aScanTypes )
2412 if( INSPECT_RESULT::QUIT == aInspector(
this, aTestData ) )
2413 return INSPECT_RESULT::QUIT;
2420 if( INSPECT_RESULT::QUIT == aInspector( &field, (
void*)
this ) )
2421 return INSPECT_RESULT::QUIT;
2428 return INSPECT_RESULT::QUIT;
2435 return INSPECT_RESULT::QUIT;
2441 return INSPECT_RESULT::QUIT;
2447 return INSPECT_RESULT::QUIT;
2452 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2456 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2458 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2461 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2464 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2467 if( INSPECT_RESULT::QUIT == aInspector(
pin.get(), (
void*)
this ) )
2468 return INSPECT_RESULT::QUIT;
2473 return INSPECT_RESULT::CONTINUE;
2516 return !( *
this == aSymbol );
2522 wxCHECK_MSG(
Type() == aSymbol.
Type(), *
this,
2523 wxT(
"Cannot assign object type " ) + aSymbol.
GetClass() + wxT(
" to type " ) +
2526 if( &aSymbol !=
this )
2543 field.SetParent(
this );
2555 bBox.
Inflate( aAccuracy / 2 );
2571 rect.
Inflate( aAccuracy / 2 );
2584 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2586 if(
pin->GetType() == ELECTRICAL_PINTYPE::PT_NC )
2591 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2593 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2596 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2599 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2602 if(
pin->GetLocalPosition() == new_pos )
2617 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
2631 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2634 SCH_PIN* tempPin = tempPins[ i ];
2651 text->SetText(
dummy.GetShownText(
false ) );
2660 for(
bool local_background : {
true,
false } )
2667 field.ClearRenderCache();
2681 std::vector<wxString> properties;
2685 wxString text_field = field.GetShownText( sheet,
false);
2687 if( text_field.IsEmpty() )
2690 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2691 field.GetName(), text_field ) );
2694 if( !
m_part->GetKeyWords().IsEmpty() )
2696 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2698 m_part->GetKeyWords() ) );
2720 std::max( bbox.
GetY() - pins.
GetY(),
2724 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2725 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2734 strokeWidth,
FILLED,
nullptr );
2754 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2757 SCH_PIN* tempPin = tempPins[ i ];
2772 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2774 if(
pin->IsBrightened() )
2784 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2785 pin->ClearBrightened();
2796 wxCHECK(
m_part,
false );
2797 return m_part->GetShowPinNames();
2803 m_part->SetShowPinNames( aShow );
2808 wxCHECK(
m_part,
false );
2809 return m_part->GetShowPinNumbers();
2815 m_part->SetShowPinNumbers( aShow );
2821 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2823 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2825 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2828 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2831 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2834 if(
pin->IsPointClickableAnchor( aPos ) )
2853 if( pin_list.size() != 1 )
2856 return pin_list[0]->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN;
2862 wxCHECK(
m_part,
false );
2864 return m_part->IsPower();
2870 wxCHECK(
m_part,
false );
2872 return m_part->IsNormal();
2878 std::unordered_set<wxString> componentClass;
2880 auto getComponentClassFields = [&](
const auto& fields )
2884 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
2886 if( field.GetShownText( aPath,
false ) != wxEmptyString )
2887 componentClass.insert( field.GetShownText( aPath,
false ) );
2893 getComponentClassFields(
m_fields );
2900 getComponentClassFields( label->GetFields() );
2904 return componentClass;
2936 for(
unsigned i = 0; i <
m_pins.size(); ++i )
2985 _HKI(
"Orientation" ),
2996 return symbol->GetLibSymbolRef() !=
nullptr;
3003 .SetAvailableFunc( hasLibPart );
3007 .SetAvailableFunc( hasLibPart );
3009 const wxString groupFields =
_HKI(
"Fields" );
3031 return symbol->IsMulti();
3036 auto multiBodyStyle =
3040 return symbol->HasAlternateBodyStyle();
3053 const wxString groupAttributes =
_HKI(
"Attributes" );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr ecoord_type GetArea() const
Return the area of the rectangle.
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
const EDA_ITEM * GetParent() 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.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Linked list: Link (parent struct)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void Offset(const VECTOR2I &aOffset)
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
A color representation with 4 components: red, green, blue, alpha.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
wxString AsString() const
wxString AsString() const
A logical library item identifier and consists of various portions much like a URI.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const wxString GetUniStringLibNickname() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
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.
static wxString LetterSubReference(int aUnit, int aFirstId)
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
A singleton reporter that reports to nowhere.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Base plotter engine class.
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual void SetColor(const COLOR4D &color)=0
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...
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
const wxString & Name() const
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.
TEMPLATES m_TemplateFieldNames
Holds all the data relating to one schematic.
SCH_SHEET_PATH & CurrentSheet() const override
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
SCHEMATIC_SETTINGS & Settings() const
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString LocalName() const
wxString Name(bool aIgnoreSheet=false) const
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void ImportValues(const SCH_FIELD &aSource)
Copy parameters from a SCH_FIELD source.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
FIELDS_AUTOPLACED m_fieldsAutoplaced
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
void SetAlt(const wxString &aAlt)
void SetName(const wxString &aName)
const wxString & GetName() const
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 SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
wxString GetShownName() const
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetNumber() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool GetExcludedFromBOM() const
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
bool GetExcludedFromSim() const
bool GetExcludedFromBoard() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
void SetValueProp(const wxString &aRef)
SCH_SYMBOL & operator=(const SCH_SYMBOL &aItem)
size_t GetFullPinCount() const
void UpdatePrefix()
Set the prefix based on the current reference designator.
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
SCH_FIELD * GetFieldByName(const wxString &aFieldName)
Return a field in this symbol.
wxString GetDescription() const override
std::unordered_map< SCH_PIN *, SCH_PIN * > m_pinMap
library pin pointer : SCH_PIN's index
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
void SetMirrorX(bool aMirror)
bool IsSymbolLikePowerGlobalLabel() const
wxString GetSymbolIDAsString() const
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool GetShowPinNumbers() const override
wxString GetDatasheet() const
Return the documentation text for the given part alias.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLibId(const LIB_ID &aName)
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
void SetRefProp(const wxString &aRef)
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print a symbol.
wxString GetUnitDisplayName(int aUnit) const
Return the display name for a given unit aUnit.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
SCH_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
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 PlotDNP(PLOTTER *aPlotter) const
Plot the red 'X' over the symbol.
bool operator!=(const SCH_SYMBOL &aSymbol) const
void SetShowPinNumbers(bool aShow) override
Set or clear the pin number visibility flag.
SYMBOL_ORIENTATION_PROP GetOrientationProp() const
int GetFieldCount() const
Return the number of fields in this symbol.
void SetBodyStyleUnconditional(int aBodyStyle)
Similar to SetBodyStyle(), but always set the body style, regardless the lib symbol properties (the L...
wxString SubReference(int aUnit, bool aAddSeparator=true) const
wxString GetClass() const override
Return the class name.
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
void SetMirrorY(bool aMirror)
void PlotPins(PLOTTER *aPlotter) const
Plot just the symbol pins.
void SetValueFieldText(const wxString &aValue)
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
void SetBodyStyle(int aBodyStyle) override
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void SetShowPinNames(bool aShow) override
Set or clear the pin name visibility flag.
wxString GetKeyWords() const override
wxString GetSchSymbolLibraryName() const
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true, bool aCaseInsensitive=false)
Search for a SCH_FIELD with aFieldName.
void SetBodyStyleProp(int aBodyStyle)
void ClearBrightenedPins()
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
wxString GetRefProp() const
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
std::vector< SCH_SYMBOL_INSTANCE > m_instanceReferences
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
void SyncOtherUnits(const SCH_SHEET_PATH &aSourceSheet, SCH_COMMIT &aCommit, PROPERTY_BASE *aProperty)
Keep fields other than the reference, include/exclude flags, and alternate pin assignements in sync i...
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
void UpdateFields(const SCH_SHEET_PATH *aPath, bool aUpdateStyle, bool aUpdateRef, bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields)
Restore fields to the original library values.
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
void SetOrientationProp(SYMBOL_ORIENTATION_PROP aAngle)
Orientation/mirroring access for property manager.
bool GetShowPinNames() 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 GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
int GetBodyStyleProp() const
std::vector< SCH_PIN * > GetAllLibPins() const
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetFootprintFieldText(const wxString &aFootprint)
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
VECTOR2I GetPosition() const override
void SetTransform(const TRANSFORM &aTransform)
std::unique_ptr< LIB_SYMBOL > m_part
A flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
bool HasAlternateBodyStyle() const override
Test if symbol has more than one body conversion type (DeMorgan).
const LIB_ID & GetLibId() const override
bool operator<(const SCH_ITEM &aItem) const override
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
void SetUnitProp(int aUnit)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
std::vector< SCH_PIN * > GetLibPins() const
Populate a vector with all the pins from the library object that match the current unit and bodyStyle...
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
TRANSFORM & GetTransform()
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
int GetOrientation() const
Get the display symbol orientation.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool m_isInNetlist
True if the symbol should appear in netlist.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
TRANSFORM m_transform
The rotation/mirror transformation.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
wxString GetValueProp() const
void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Print only the background parts of a symbol (if any)
int GetUnitCount() const override
Return the number of units per package of the symbol.
void SetPrefix(const wxString &aPrefix)
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 GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
bool IsNormal() const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
std::unordered_set< wxString > GetComponentClassNames(const SCH_SHEET_PATH *aPath) const
Returns the component classes this symbol belongs in.
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every SCH_PIN (all units)
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
bool HasUnitDisplayName(int aUnit) const
Return true if the given unit aUnit has a display name set.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
bool IsPower() const override
bool operator==(const SCH_SYMBOL &aSymbol) const
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
const SPICE_GENERATOR & SpiceGenerator() const
std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
virtual std::string ItemName(const SPICE_ITEM &aItem) const
A base class for LIB_SYMBOL and SCH_SYMBOL.
bool m_DNP
True if symbol is set to 'Do Not Populate'.
bool GetExcludedFromBoard() const
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
bool GetExcludedFromBOM() const
void SetExcludedFromSim(bool aExcludeFromSim) override
Set or clear the exclude from simulation flag.
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
virtual bool GetShowPinNames() const
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
SYMBOL & operator=(const SYMBOL &aItem)
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
virtual bool GetShowPinNumbers() const
bool GetExcludedFromSim() const override
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
const INSPECTOR_FUNC & INSPECTOR
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define IS_DANGLING
indicates a pin is dangling
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
void GRFilledSegment(wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Message panel definition file.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
wxString GetRefDesUnannotated(const wxString &aSource)
Return an unannotated refdes from either a prefix or an existing refdes.
PGM_BASE & Pgm()
The global Program "get" accessor.
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
Collection of utility functions for component reference designators (refdes)
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
static struct SCH_SYMBOL_DESC _SCH_SYMBOL_DESC
@ SYM_ROTATE_COUNTERCLOCKWISE
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
constexpr int MilsToIU(int mils) const
std::vector< std::pair< int, wxString > > Fields
A simple container for schematic symbol instance information.
Hold a name of a symbol's field, field value, and default visibility.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ DESCRIPTION_FIELD
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
wxLogTrace helper definitions.
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.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_FIELD_LOCATE_REFERENCE_T
@ SCH_FIELD_LOCATE_FOOTPRINT_T
@ SCH_FIELD_LOCATE_VALUE_T
@ SCH_FIELD_LOCATE_DATASHEET_T
@ SCH_SYMBOL_LOCATE_POWER_T
VECTOR2< int32_t > VECTOR2I