59 std::string ret =
TO_UTF8( txt );
63 if( (
unsigned char) c <=
' ' )
89 std::unique_ptr< LIB_SYMBOL > part;
118 SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.
Convert, aPosition, aParent )
121 for(
const auto& [fieldId, fieldValue] : aSel.
Fields )
123 if( fieldId == FIELD_T::REFERENCE )
124 SetRef( aSheet, fieldValue );
125 else if( SCH_FIELD* field = GetField( fieldId ) )
126 field->SetText( fieldValue );
151 field.SetParent(
this );
156 for(
const std::unique_ptr<SCH_PIN>&
pin : aSymbol.
m_pins )
158 m_pins.emplace_back( std::make_unique<SCH_PIN>( *pin ) );
159 m_pins.back()->SetParent( this );
223 const int min_grid_size =
schIUScale.MilsToIU( 25 );
225 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
227 if( ( (
pin->GetPosition().x -
m_pos.x ) % min_grid_size ) != 0 )
230 if( ( (
pin->GetPosition().y -
m_pos.y ) % min_grid_size ) != 0 )
255 wxCHECK2( !aLibSymbol || aLibSymbol->
IsRoot(), aLibSymbol =
nullptr );
257 m_part.reset( aLibSymbol );
262 pin->SetLibPin(
nullptr );
271 return m_part->GetDescription();
273 return wxEmptyString;
280 return m_part->GetKeyWords();
282 return wxEmptyString;
289 return m_part->GetDatasheetField().GetText();
291 return wxEmptyString;
297 std::map<wxString, wxString> altPinMap;
298 std::map<wxString, SCH_PIN::ALT> altPinDefs;
299 std::map<wxString, std::set<SCH_PIN*>> pinUuidMap;
300 std::set<SCH_PIN*> unassignedSchPins;
301 std::set<SCH_PIN*> unassignedLibPins;
303 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
305 pinUuidMap[
pin->GetNumber() ].insert(
pin.get() );
307 unassignedSchPins.insert(
pin.get() );
309 if( !
pin->GetAlt().IsEmpty() )
311 altPinMap[
pin->GetNumber() ] =
pin->GetAlt();
312 auto altDefIt =
pin->GetAlternates().find(
pin->GetAlt() );
314 if( altDefIt !=
pin->GetAlternates().end() )
315 altPinDefs[
pin->GetNumber() ] = altDefIt->second;
318 pin->SetLibPin(
nullptr );
335 auto ii = pinUuidMap.find( libPin->GetNumber() );
337 if( ii == pinUuidMap.end() || ii->second.empty() )
339 unassignedLibPins.insert( libPin );
343 auto it = ii->second.begin();
345 ii->second.erase( it );
346 pin->GetAlternates() = libPin->GetAlternates();
347 pin->SetLibPin( libPin );
348 pin->SetPosition( libPin->GetPosition() );
350 unassignedSchPins.erase(
pin );
352 auto iii = altPinMap.find( libPin->GetNumber() );
354 if( iii != altPinMap.end() )
356 wxString altName = iii->second;
358 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
360 auto defIt = altPinDefs.find( libPin->GetNumber() );
362 if( defIt != altPinDefs.end() )
364 for(
const auto& [
name, alt ] :
pin->GetAlternates() )
366 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
375 pin->SetAlt( altName );
382 for(
SCH_PIN* libPin : unassignedLibPins )
387 if( !unassignedSchPins.empty() )
389 auto it = unassignedSchPins.begin();
391 unassignedSchPins.erase( it );
396 pin =
m_pins.emplace_back( std::make_unique<SCH_PIN>(
SCH_PIN(
this, libPin ) ) ).get();
400 pin->GetAlternates() = libPin->GetAlternates();
401 pin->SetLibPin( libPin );
402 pin->SetPosition( libPin->GetPosition() );
403 pin->SetNumber( libPin->GetNumber() );
405 auto iii = altPinMap.find( libPin->GetNumber() );
407 if( iii != altPinMap.end() )
409 wxString altName = iii->second;
411 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
413 auto defIt = altPinDefs.find( libPin->GetNumber() );
415 if( defIt != altPinDefs.end() )
417 for(
const auto& [
name, alt ] :
pin->GetAlternates() )
419 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
428 pin->SetAlt( altName );
433 for(
auto it1 =
m_pins.begin(); it1 !=
m_pins.end() && !unassignedSchPins.empty(); )
435 auto it2 = unassignedSchPins.find( it1->get() );
437 if( it2 != unassignedSchPins.end() )
439 it1 =
m_pins.erase( it1 );
440 unassignedSchPins.erase( it2 );
451 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
473 return m_part->GetUnitCount();
482 return m_part->GetBodyStyleCount();
491 return m_part->HasDeMorganBodyStyles();
500 return m_part->GetUnitDisplayName( aUnit, aLabel );
502 return wxString::Format(
_(
"Unit %s" ),
SubReference( aUnit ) );
511 return m_part->GetBodyStyleDescription( aBodyStyle, aLabel );
518 bool aTestFromEnd )
const
524 if( instance.m_Path == aSheetPath )
526 aInstance = instance;
530 else if( instance.m_Path.EndsWith( aSheetPath ) )
532 aInstance = instance;
557 " reference %s, unit %d from symbol %s." ),
615 if( instance.m_Path ==
path )
617 ref = instance.m_Reference;
657 if( instance.m_Path ==
path )
660 instance.m_Reference = ref;
668 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
669 pin->ClearDefaultNetName( sheet );
691 if( instance.m_Path ==
path )
692 return !instance.m_Reference.IsEmpty() && instance.m_Reference.Last() !=
'?';
703 refDesignator.Replace(
"~",
" " );
705 wxString prefix = refDesignator;
707 while( prefix.Length() )
709 wxUniCharRef last = prefix.Last();
711 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
719 prefix.Trim(
false );
721 if( !prefix.IsEmpty() )
729 return schematic->Settings().SubReference( aUnit, aAddSeparator );
741 if( instance.m_Path ==
path )
742 return instance.m_Unit;
758 if( instance.m_Path ==
path )
760 instance.m_Unit = aUnitSelection;
773 instance.m_Unit = aUnitSelection;
778 bool aAllowExtraText )
const
794 bool aAllowExtraText )
const
814 m_fields.emplace_back(
this, aFieldType );
843 if( !field.IsVisible() || field.GetText().IsEmpty() )
847 aVector.push_back(
const_cast<SCH_FIELD*
>( &field ) );
850 std::sort( aVector.begin(), aVector.end(),
853 return lhs->GetOrdinal() < rhs->GetOrdinal();
873 for(
unsigned ii = 0; ii <
m_fields.size(); ++ii )
878 if( aFieldName ==
m_fields[ii].GetName(
false ) )
891 if( field.GetName().IsSameAs( aFieldName,
false ) )
900 bool aUpdateOtherFields,
bool aResetRef,
bool aResetOtherFields )
904 std::vector<SCH_FIELD*> fields;
905 m_part->GetFields( fields );
907 for(
const SCH_FIELD* libField : fields )
912 if( libField->IsMandatory() )
914 fieldType = libField->GetId();
919 schField =
GetField( libField->GetCanonicalName() );
929 schField->
SetPrivate( libField->IsPrivate() );
941 else if( aUpdateRef )
942 SetRef( aPath, libField->GetText() );
950 if( aResetOtherFields )
952 else if( aUpdateOtherFields )
953 schField->
SetText( libField->GetText() );
957 if( aResetOtherFields || aUpdateOtherFields )
958 schField->
SetText( libField->GetText() );
968 bool updateValue =
true;
969 bool updateExclFromBOM =
true;
970 bool updateExclFromBoard =
true;
971 bool updateDNP =
true;
972 bool updateOtherFields =
true;
973 bool updatePins =
true;
977 updateValue = aProperty->
Name() ==
_HKI(
"Value" );
978 updateExclFromBoard = aProperty->
Name() ==
_HKI(
"Exclude From Board" );
979 updateExclFromBOM = aProperty->
Name() ==
_HKI(
"Exclude From Bill of Materials" );
980 updateDNP = aProperty->
Name() ==
_HKI(
"Do not Populate" );
981 updateOtherFields =
false;
986 && !updateExclFromBOM
987 && !updateExclFromBoard
989 && !updateOtherFields
999 wxString ref =
GetRef( &aSourceSheet );
1004 std::vector<SCH_SYMBOL*> otherUnits;
1010 aCommit.
Modify( otherUnit, screen );
1015 if( updateOtherFields )
1027 if( field.IsMandatory() )
1028 otherField = otherUnit->GetField( field.GetId() );
1030 otherField = otherUnit->GetField( field.GetName() );
1034 otherField->
SetText( field.GetText() );
1042 newField.
Offset( otherUnit->GetPosition() );
1045 otherUnit->AddField( newField );
1049 for(
int ii = (
int) otherUnit->GetFields().size() - 1; ii >= 0; ii-- )
1051 SCH_FIELD& otherField = otherUnit->GetFields()[ii];
1054 otherUnit->GetFields().erase( otherUnit->GetFields().begin() + ii );
1058 if( updateExclFromBOM )
1061 if( updateExclFromBoard )
1065 otherUnit->SetDNP(
m_DNP );
1069 for(
const std::unique_ptr<SCH_PIN>& model_pin :
m_pins )
1071 SCH_PIN* src_pin = otherUnit->GetPin( model_pin->GetNumber() );
1074 src_pin->
SetAlt( model_pin->GetAlt() );
1085 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1086 aFunction(
pin.get() );
1089 aFunction( &field );
1095 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1097 if(
pin->GetNumber() == aNumber )
1107 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1109 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
1111 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
1114 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1117 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
1120 if(
pin->GetPosition() == aPos )
1133 return std::vector<SCH_PIN*>();
1140 return m_part->GetPins();
1142 return std::vector<SCH_PIN*>();
1154 auto it =
m_pinMap.find( aLibPin );
1159 wxFAIL_MSG_AT(
"Pin not found", __FILE__, __LINE__, __FUNCTION__ );
1166 std::vector<SCH_PIN*> pins;
1175 for(
const std::unique_ptr<SCH_PIN>& p :
m_pins )
1177 if( unit && p->GetLibPin() && p->GetLibPin()->GetUnit()
1178 && ( p->GetLibPin()->GetUnit() != unit ) )
1183 pins.push_back( p.get() );
1199 wxT(
"Cannot swap data with invalid symbol." ) );
1207 for( std::unique_ptr<SCH_PIN>&
pin : symbol->
m_pins )
1208 pin->SetParent( symbol );
1210 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1211 pin->SetParent(
this );
1216 m_part.reset( libSymbol );
1250 if( field.IsPrivate() )
1253 if( field.IsMandatory() )
1254 aVars->push_back( field.GetCanonicalName().Upper() );
1256 aVars->push_back( field.GetName() );
1259 aVars->push_back( wxT(
"OP" ) );
1260 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1261 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1262 aVars->push_back( wxT(
"UNIT" ) );
1263 aVars->push_back( wxT(
"SHORT_REFERENCE" ) );
1264 aVars->push_back( wxT(
"SYMBOL_LIBRARY" ) );
1265 aVars->push_back( wxT(
"SYMBOL_NAME" ) );
1266 aVars->push_back( wxT(
"SYMBOL_DESCRIPTION" ) );
1267 aVars->push_back( wxT(
"SYMBOL_KEYWORDS" ) );
1268 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1269 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1270 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1271 aVars->push_back( wxT(
"DNP" ) );
1272 aVars->push_back( wxT(
"SHORT_NET_NAME(<pin_number>)" ) );
1273 aVars->push_back( wxT(
"NET_NAME(<pin_number>)" ) );
1274 aVars->push_back( wxT(
"NET_CLASS(<pin_number>)" ) );
1275 aVars->push_back( wxT(
"PIN_NAME(<pin_number>)" ) );
1281 static wxRegEx operatingPoint( wxT(
"^"
1288 wxCHECK( aPath,
false );
1295 if( operatingPoint.Matches( *token ) )
1297 wxString
pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
1298 wxString precisionStr( operatingPoint.GetMatch( *token, 3 ) );
1299 wxString rangeStr( operatingPoint.GetMatch( *token, 4 ) );
1301 int precision = precisionStr.IsEmpty() ? 3 : precisionStr[0] -
'0';
1302 wxString range = rangeStr.IsEmpty() ? wxString( wxS(
"~A" ) ) : rangeStr;
1306 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1310 embeddedFilesStack.push_back(
m_part->GetEmbeddedFiles() );
1316 true, aDepth + 1, devnull ).model;
1321 spiceRef = spiceRef.Lower();
1328 else if(
pin == wxS(
":power" ) )
1330 if( rangeStr.IsEmpty() )
1331 range = wxS(
"~W" );
1333 *token = schematic->
GetOperatingPoint( spiceRef + wxS(
":power" ), precision, range );
1338 pin =
pin.SubString( 1, -1 );
1340 for(
const std::reference_wrapper<const SIM_MODEL_PIN>& modelPin : model.
GetPins() )
1342 SCH_PIN* symbolPin =
GetPin( modelPin.get().symbolPinNumber );
1346 if( model.
GetPins().size() == 2 )
1352 wxString signalName = spiceRef + wxS(
":" ) + modelPin.get().modelPinName;
1361 *token = wxS(
"?" );
1365 if( token->Contains(
':' ) )
1373 wxString fieldName = field.IsMandatory() ? field.GetCanonicalName()
1376 wxString textToken = field.GetText();
1377 textToken.Replace(
" ", wxEmptyString );
1378 wxString tokenString =
"${" + fieldName +
"}";
1381 if( textToken.IsSameAs( tokenString,
false ) )
1384 if( token->IsSameAs( fieldName,
false ) )
1387 *token =
GetRef( aPath,
true );
1389 *token = field.GetShownText( aPath,
false, aDepth + 1 );
1396 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) )
1397 || token->IsSameAs( wxT(
"SIM.TYPE" ) )
1398 || token->IsSameAs( wxT(
"SIM.PINS" ) )
1399 || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
1400 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) )
1401 || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
1403 *token = wxEmptyString;
1410 if( token->IsSameAs( templateFieldname.m_Name )
1411 || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
1415 *token = wxEmptyString;
1420 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1424 wxArrayString parts = wxSplit( footprint,
':' );
1426 if( parts.Count() > 0 )
1427 *token = parts[ 0 ];
1429 *token = wxEmptyString;
1433 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1437 wxArrayString parts = wxSplit( footprint,
':' );
1439 if( parts.Count() > 1 )
1440 *token = parts[ std::min( 1, (
int) parts.size() - 1 ) ];
1442 *token = wxEmptyString;
1446 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
1451 else if( token->IsSameAs( wxT(
"SHORT_REFERENCE" ) ) )
1453 *token =
GetRef( aPath,
false );
1456 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
1458 *token =
m_lib_id.GetUniStringLibNickname();
1461 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
1463 *token =
m_lib_id.GetUniStringLibItemName();
1466 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
1471 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
1476 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1478 *token = wxEmptyString;
1481 *token =
_(
"Excluded from BOM" );
1485 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
1487 *token = wxEmptyString;
1490 *token =
_(
"Excluded from board" );
1494 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
1496 *token = wxEmptyString;
1499 *token =
_(
"Excluded from simulation" );
1503 else if( token->IsSameAs( wxT(
"DNP" ) ) )
1505 *token = wxEmptyString;
1507 if( aPath->
GetDNP() || this->ResolveDNP() )
1508 *token =
_(
"DNP" );
1512 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) )
1513 || token->StartsWith( wxT(
"NET_NAME(" ) )
1514 || token->StartsWith( wxT(
"NET_CLASS(" ) )
1515 || token->StartsWith( wxT(
"PIN_NAME(" ) ) )
1517 wxString pinNumber = token->AfterFirst(
'(' );
1518 pinNumber = pinNumber.BeforeLast(
')' );
1522 if(
pin->GetNumber() == pinNumber )
1524 if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
1526 *token =
pin->GetAlt().IsEmpty() ?
pin->GetName() :
pin->GetAlt();
1533 *token = wxEmptyString;
1534 else if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
1536 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
1537 *token = conn->
Name();
1538 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
1539 *token =
pin->GetEffectiveNetClass( aPath )->GetName();
1562 if( instance.m_Path ==
path )
1564 if( instance.m_Reference.IsEmpty() || aResetPrefix )
1575 if( instance.m_Reference.IsEmpty() || aResetPrefix)
1582 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1583 pin->ClearDefaultNetName( aSheetPath );
1591 if( currentReference.IsEmpty() || aResetPrefix )
1601 wxCHECK( aSheetPath.size() > 0,
false );
1606 if( instance.m_Path == aSheetPath )
1619 bool transform =
false;
1621 switch( aOrientation )
1742 wxFAIL_MSG(
"Invalid schematic symbol orientation type." );
1778 int rotate_values[] =
1799 for(
int type_rotate : rotate_values )
1811 wxFAIL_MSG(
"Schematic symbol orientation matrix internal error." );
1819void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const
1822 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1824 <<
'"' <<
" chipName=\""
1830 for(
int i = 1; i < (int)
GetFields().size(); ++i )
1832 const wxString& value =
GetFields()[i].GetText();
1834 if( !value.IsEmpty() )
1836 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\""
1838 <<
'"' <<
" value=\""
1839 <<
TO_UTF8( value ) <<
"\"/>\n";
1843 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
1864 if( aIncludeFields )
1868 if( field.IsVisible() )
1869 bBox.
Merge( field.GetBoundingBox() );
1883 catch(
const boost::bad_pointer& e )
1885 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ), e.what() ) );
1916 msgs.Add(
_(
"Simulation" ) );
1919 msgs.Add(
_(
"BOM" ) );
1922 msgs.Add(
_(
"Board" ) );
1925 msgs.Add(
_(
"DNP" ) );
1927 msg = wxJoin( msgs,
'|' );
1928 msg.Replace(
'|', wxS(
", " ) );
1931 aList.emplace_back(
_(
"Exclude from" ), msg );
1942 aList.emplace_back(
_(
"Power symbol" ),
1947 aList.emplace_back(
_(
"Reference" ),
1951 aList.emplace_back(
_(
"Value" ),
1954 aList.emplace_back(
_(
"Name" ),
1960 aList.emplace_back(
_(
"flags" ), wxString::Format(
"%X",
GetEditFlags() ) );
1965 msg =
_(
"Missing parent" );
1967 std::shared_ptr< LIB_SYMBOL > parent =
m_part->GetParent().lock();
1974 else if( !
m_lib_id.GetLibNickname().empty() )
1976 aList.emplace_back(
_(
"Library" ),
m_lib_id.GetLibNickname() );
1980 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
1988 msg =
_(
"<Unknown>" );
1990 aList.emplace_back(
_(
"Footprint" ), msg );
1993 aList.emplace_back(
_(
"Description" ) + wxT(
": " )
1995 _(
"Keywords" ) + wxT(
": " ) +
m_part->GetKeyWords() );
2000 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
2003 aList.emplace_back(
_(
"Value" ),
2006 aList.emplace_back(
_(
"Name" ),
2011 if( libNickname.empty() )
2012 msg =
_(
"No library defined!" );
2014 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
2016 aList.emplace_back(
_(
"Library" ), msg );
2051 field.SetTextPos( pos );
2069 field.SetTextPos( pos );
2088 field.SetTextPos( pos );
2109 if( drawItem.Matches( aSearchData, aAuxData ) )
2120 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2128 aItemList.push_back( item );
2134 std::vector<DANGLING_END_ITEM>& aItemListByPos,
2137 bool changed =
false;
2139 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2141 bool previousState =
pin->IsDangling();
2142 pin->SetIsDangling(
true );
2147 bool do_break =
false;
2149 for(
auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
2168 pin->SetIsDangling(
false );
2180 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
2206 wxCHECK( symbol,
false );
2212 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2214 if(
pin->IsDangling() )
2227 if(
GetRef( aInstance ) != symbol->
GetRef( aInstance ) )
2232 && (
GetValue(
true, aInstance,
false ) != symbol->
GetValue(
true, aInstance,
false ) ) )
2238 for(
size_t i = 0; i <
m_pins.size(); i++ )
2250 std::vector<VECTOR2I> retval;
2252 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2256 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2258 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2261 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2264 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2290 return wxString::Format(
_(
"Symbol %s [%s]" ),
2297 const std::vector<KICAD_T>& aScanTypes )
2299 for(
KICAD_T scanType : aScanTypes )
2344 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2348 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2350 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2353 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2356 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2393 std::vector<SCH_FIELD*> fields, otherFields;
2396 aSymbol.
GetFields( otherFields,
false );
2398 if( fields.size() != otherFields.size() )
2401 for(
int ii = 0; ii < (int) fields.size(); ii++ )
2406 if( fields[ii]->GetText().Cmp( otherFields[ii]->GetText() ) != 0 )
2416 return !( *
this == aSymbol );
2422 wxCHECK_MSG(
Type() == aSymbol.
Type(), *
this,
2423 wxT(
"Cannot assign object type " ) + aSymbol.
GetClass() + wxT(
" to type " ) +
2426 if( &aSymbol !=
this )
2443 field.SetParent(
this );
2455 bBox.
Inflate( aAccuracy / 2 );
2471 rect.
Inflate( aAccuracy / 2 );
2493 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2500 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2502 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2505 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2508 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2511 if(
pin->GetLocalPosition() == new_pos )
2526 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
2540 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2543 SCH_PIN* tempPin = tempPins[ i ];
2560 text->SetText(
dummy.GetShownText(
false ) );
2569 for(
bool local_background : {
true,
false } )
2576 field.ClearRenderCache();
2590 std::vector<wxString> properties;
2594 wxString text_field = field.GetShownText( sheet,
false);
2596 if( text_field.IsEmpty() )
2599 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2600 field.GetName(), text_field ) );
2603 if( !
m_part->GetKeyWords().IsEmpty() )
2605 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2607 m_part->GetKeyWords() ) );
2628 std::max( bbox.
GetY() - pins.
GetY(),
2632 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2633 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2643 strokeWidth,
nullptr );
2663 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2666 SCH_PIN* tempPin = tempPins[ i ];
2681 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2683 if(
pin->IsBrightened() )
2693 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2694 pin->ClearBrightened();
2712 m_part->SetShowPinNames( aShow );
2725 m_part->SetShowPinNumbers( aShow );
2731 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2733 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2735 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2738 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2741 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2744 if(
pin->IsPointClickableAnchor( aPos ) )
2763 if( pin_list.size() != 1 )
2781 if( pin_list.size() != 1 )
2793 return m_part->IsLocalPower();
2802 return m_part->IsGlobalPower();
2814 wxCHECK(
m_part,
false );
2816 return m_part->IsNormal();
2822 std::unordered_set<wxString> componentClass;
2824 auto getComponentClassFields =
2825 [&](
const std::vector<SCH_FIELD>& fields )
2829 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
2831 if( field.GetShownText( aPath,
false ) != wxEmptyString )
2832 componentClass.insert( field.GetShownText( aPath,
false ) );
2838 getComponentClassFields(
m_fields );
2845 getComponentClassFields( label->GetFields() );
2849 return componentClass;
2881 for(
unsigned i = 0; i <
m_pins.size(); ++i )
2940 return symbol->GetLibSymbolRef() !=
nullptr;
2953 const wxString groupFields =
_HKI(
"Fields" );
2975 return symbol->IsMultiUnit();
2980 auto multiBodyStyle =
2984 return symbol->IsMultiBodyStyle();
2994 wxPGChoices choices;
2998 for(
int ii = 1; ii <= symbol->GetUnitCount(); ii++ )
2999 choices.Add( symbol->GetUnitDisplayName( ii,
false ), ii );
3010 wxPGChoices choices;
3014 for(
int ii = 1; ii <= symbol->GetBodyStyleCount(); ii++ )
3015 choices.Add( symbol->GetBodyStyleDescription( ii,
false ) );
3021 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
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
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.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
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.
virtual void SetParentGroup(EDA_GROUP *aGroup)
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Owner.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
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()
A text control validator used for validating the text allowed in fields.
bool DoValidate(const wxString &aValue, wxWindow *aParent)
Class that other classes need to inherit from, in order to be inspectable.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxString AsString() const
A logical library item identifier and consists of various portions much like a URI.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
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, wxChar aInitialLetter)
static LIB_SYMBOL * GetDummy()
Returns a dummy LIB_SYMBOL, used when one is missing in the schematic.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
const BOX2I GetBodyBoundingBox(int aUnit, int aBodyStyle, bool aIncludePins, bool aIncludePrivateItems) const
Get the symbol bounding box excluding fields.
EMBEDDED_FILES * GetEmbeddedFiles() override
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
A singleton reporter that reports to nowhere.
Base plotter engine class.
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 ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
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 & SetChoicesFunc(std::function< wxPGChoices(INSPECTABLE *)> aFunc)
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.
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
SCHEMATIC_SETTINGS & Settings() const
PROJECT & Project() const
Return a reference to the project this schematic is part of.
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SHEET_PATH & CurrentSheet() const
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
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
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
AUTOPLACE_ALGO m_fieldsAutoplaced
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
void SetAlt(const wxString &aAlt)
Set the name of the alternate pin.
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.
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the display name for a given unit aUnit.
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.
wxString GetDescription() const override
std::unordered_map< SCH_PIN *, SCH_PIN * > m_pinMap
Library pin pointer : SCH_PIN indices.
void SetMirrorX(bool aMirror)
bool IsSymbolLikePowerGlobalLabel() const
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
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 reference to the vector holding the symbol's fields.
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
wxString GetBodyStyleProp() const override
void SetRefProp(const wxString &aRef)
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
wxString SubReference(int aUnit, bool aAddSeparator=true) const
wxString GetClass() const override
Return the class name.
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
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 SetBodyStyleProp(const wxString &aBodyStyle) override
void SetValueFieldText(const wxString &aValue)
std::vector< SCH_PIN * > GetPins() const override
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
void SetBodyStyle(int aBodyStyle) override
void SetShowPinNames(bool aShow) override
Set or clear the pin name visibility flag.
wxString GetKeyWords() const override
wxString GetSchSymbolLibraryName() const
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.
bool IsGlobalPower() const override
wxString GetRefProp() const
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
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
Define the hierarchical path and reference of the symbol.
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 assignments in sync in...
SCH_FIELD * FindFieldCaseInsensitive(const wxString &aFieldName)
Search for a SCH_FIELD with aFieldName.
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
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
bool HasDeMorganBodyStyles() const override
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
std::vector< SCH_PIN * > GetAllLibPins() const
int GetBodyStyleCount() const override
Return the number of body styles of the symbol.
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
std::unique_ptr< LIB_SYMBOL > m_part
A flattened copy of the LIB_SYMBOL from the PROJECT object's libraries.
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this symbol.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
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))
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.
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
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.
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.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
wxString GetValueProp() const
bool IsLocalPower() const override
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
int GetUnitCount() const override
Return the number of units per package of the symbol.
void SetPrefix(const wxString &aPrefix)
int GetOrientation() const override
Get the display symbol orientation.
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.
bool IsSymbolLikePowerLocalLabel() const
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
Return the component classes this symbol belongs in.
std::vector< std::unique_ptr< SCH_PIN > > m_pins
A SCH_PIN for every #LIB_PIN.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
BOX2I GetBodyBoundingBox() const override
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
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
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
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'.
void SetExcludedFromBoard(bool aExcludeFromBoard) override
Set or clear exclude from board netlist flag.
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
void SetDNP(bool aDNP) override
const TRANSFORM & GetTransform() 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 GetExcludedFromBoard() const override
void SetExcludedFromBOM(bool aExcludeFromBOM) override
Set or clear the exclude from schematic bill of materials flag.
virtual bool GetShowPinNames() const
bool GetDNP() const override
Set or clear the 'Do Not Populate' flag.
SYMBOL & operator=(const SYMBOL &aItem)
virtual bool GetShowPinNumbers() const
TRANSFORM m_transform
The rotation/mirror transformation.
bool GetExcludedFromBOM() const override
bool GetExcludedFromSim() const override
const std::vector< TEMPLATE_FIELDNAME > & 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
std::function passed to nested users by ref, avoids copying std::function.
#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
a few functions useful in geometry calculations.
const wxChar *const traceSchSheetPaths
Flag to enable debug output of schematic symbol sheet path manipulation code.
SCH_LAYER_ID
Eeschema drawing layers.
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Message panel definition file.
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
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.
@ PT_NC
not connected (must be left open)
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
Collection of utility functions for component reference designators (refdes)
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
const SCH_FIELD * FindField(const std::vector< SCH_FIELD > &aFields, FIELD_T aFieldId)
int NextFieldOrdinal(const std::vector< SCH_FIELD > &aFields)
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
static struct SCH_SYMBOL_DESC _SCH_SYMBOL_DESC
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.
std::vector< std::pair< FIELD_T, wxString > > Fields
A simple container for schematic symbol instance information.
Hold a name of a symbol's field, field value, and default visibility.
@ SYM_ROTATE_COUNTERCLOCKWISE
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
wxString GetCanonicalFieldName(FIELD_T aFieldType)
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
Custom text control validator definitions.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D