61 std::string ret =
TO_UTF8( txt );
65 if( (
unsigned char) c <=
' ' )
90 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 );
222 const int min_grid_size =
schIUScale.MilsToIU( 25 );
224 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
226 if( ( (
pin->GetPosition().x -
m_pos.x ) % min_grid_size ) != 0 )
229 if( ( (
pin->GetPosition().y -
m_pos.y ) % min_grid_size ) != 0 )
254 wxCHECK2( !aLibSymbol || aLibSymbol->
IsRoot(), aLibSymbol =
nullptr );
256 m_part.reset( aLibSymbol );
261 pin->SetLibPin(
nullptr );
270 return m_part->GetDescription();
272 return wxEmptyString;
279 return m_part->GetShownDescription( aDepth );
281 return wxEmptyString;
288 return m_part->GetKeyWords();
290 return wxEmptyString;
297 return m_part->GetShownKeyWords( aDepth );
299 return wxEmptyString;
306 return m_part->GetDatasheetField().GetText();
308 return wxEmptyString;
314 std::map<wxString, wxString> altPinMap;
315 std::map<wxString, SCH_PIN::ALT> altPinDefs;
316 std::map<wxString, std::set<SCH_PIN*>> pinUuidMap;
317 std::set<SCH_PIN*> unassignedSchPins;
318 std::set<SCH_PIN*> unassignedLibPins;
320 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
322 pinUuidMap[
pin->GetNumber()].insert(
pin.get() );
324 unassignedSchPins.insert(
pin.get() );
326 if( !
pin->GetAlt().IsEmpty() )
328 altPinMap[
pin->GetNumber()] =
pin->GetAlt();
329 auto altDefIt =
pin->GetAlternates().find(
pin->GetAlt() );
331 if( altDefIt !=
pin->GetAlternates().end() )
332 altPinDefs[
pin->GetNumber()] = altDefIt->second;
335 pin->SetLibPin(
nullptr );
352 auto ii = pinUuidMap.find( libPin->GetNumber() );
354 if( ii == pinUuidMap.end() || ii->second.empty() )
356 unassignedLibPins.insert( libPin );
360 auto it = ii->second.begin();
362 ii->second.erase( it );
363 pin->GetAlternates() = libPin->GetAlternates();
364 pin->SetLibPin( libPin );
365 pin->SetPosition( libPin->GetPosition() );
366 pin->SetUnit( libPin->GetUnit() );
367 pin->SetBodyStyle( libPin->GetBodyStyle() );
369 unassignedSchPins.erase(
pin );
371 auto iii = altPinMap.find( libPin->GetNumber() );
373 if( iii != altPinMap.end() )
375 wxString altName = iii->second;
377 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
379 auto defIt = altPinDefs.find( libPin->GetNumber() );
381 if( defIt != altPinDefs.end() )
383 for(
const auto& [
name, alt] :
pin->GetAlternates() )
385 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
394 pin->SetAlt( altName );
401 for(
SCH_PIN* libPin : unassignedLibPins )
406 if( !unassignedSchPins.empty() )
408 auto it = unassignedSchPins.begin();
410 unassignedSchPins.erase( it );
415 pin =
m_pins.emplace_back( std::make_unique<SCH_PIN>(
SCH_PIN(
this, libPin ) ) ).get();
419 pin->GetAlternates() = libPin->GetAlternates();
420 pin->SetLibPin( libPin );
421 pin->SetPosition( libPin->GetPosition() );
422 pin->SetUnit( libPin->GetUnit() );
423 pin->SetBodyStyle( libPin->GetBodyStyle() );
424 pin->SetNumber( libPin->GetNumber() );
426 auto iii = altPinMap.find( libPin->GetNumber() );
428 if( iii != altPinMap.end() )
430 wxString altName = iii->second;
432 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
434 auto defIt = altPinDefs.find( libPin->GetNumber() );
436 if( defIt != altPinDefs.end() )
438 for(
const auto& [
name, alt] :
pin->GetAlternates() )
440 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
449 pin->SetAlt( altName );
454 for(
auto it1 =
m_pins.begin(); it1 !=
m_pins.end() && !unassignedSchPins.empty(); )
456 auto it2 = unassignedSchPins.find( it1->get() );
458 if( it2 != unassignedSchPins.end() )
460 it1 =
m_pins.erase( it1 );
461 unassignedSchPins.erase( it2 );
472 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
493 return m_part->GetUnitCount();
502 return m_part->GetBodyStyleCount();
511 return m_part->HasDeMorganBodyStyles();
520 return m_part->GetUnitDisplayName( aUnit, aLabel );
522 return wxString::Format(
_(
"Unit %s" ),
SubReference( aUnit ) );
531 return m_part->GetBodyStyleDescription( aBodyStyle, aLabel );
543 if( instance.m_Path == aSheetPath )
545 aInstance = instance;
549 else if( instance.m_Path.EndsWith( aSheetPath ) )
551 aInstance = instance;
570 for(
int ii =
m_instances.size() - 1; ii >= 0; --ii )
575 wxS(
"Removing symbol instance:\n"
577 " reference %s, unit %d from symbol %s." ),
605 wxS(
"Adding symbol '%s' instance:\n"
629 wxLogTrace(
traceSchSymbolRef,
"GetRef for symbol %s on path %s (sheet path has %zu sheets)",
m_Uuid.AsString(),
636 wxLogTrace(
traceSchSymbolRef,
" Instance: path=%s, ref=%s", instance.m_Path.AsString(),
637 instance.m_Reference );
639 if( instance.m_Path ==
path )
641 ref = instance.m_Reference;
655 wxLogTrace(
traceSchSymbolRef,
" Using fallback from REFERENCE field: %s", ref );
697 if( instance.m_Path ==
path )
700 instance.m_Reference = ref;
708 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
709 pin->ClearDefaultNetName( sheet );
726 const wxString& aVariantName )
728 wxCHECK( !aFieldName.IsEmpty(), );
734 switch( field->
GetId() )
738 SetRef( aPath, aFieldText );
743 wxString defaultText = field->
GetText( aPath );
745 if( aVariantName.IsEmpty() )
747 if( aFieldText != defaultText )
754 wxCHECK( instance, );
756 if( instance->
m_Variants.contains( aVariantName ) )
758 if( aFieldText != defaultText )
759 instance->
m_Variants[aVariantName].m_Fields[aFieldName] = aFieldText;
761 instance->
m_Variants[aVariantName].m_Fields.erase( aFieldName );
763 else if( aFieldText != defaultText )
768 newVariant.
m_Fields[aFieldName] = aFieldText;
769 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
780 const wxString& aVariantName )
const
782 wxCHECK( !aFieldName.IsEmpty(), wxEmptyString );
786 wxCHECK( field, wxEmptyString );
788 switch( field->
GetId() )
791 wxCHECK( aPath, field->
GetText() );
792 return GetRef( aPath,
false );
796 if( !aVariantName.IsEmpty() && aPath )
800 if( instance && instance->
m_Variants.contains( aVariantName )
801 && instance->
m_Variants.at( aVariantName ).m_Fields.contains( aFieldName ) )
803 return instance->
m_Variants.at( aVariantName ).m_Fields.at( aFieldName );
810 if( aVariantName.IsEmpty() )
818 if( instance->
m_Variants.contains( aVariantName )
819 && instance->
m_Variants.at( aVariantName ).m_Fields.contains( aFieldName ) )
820 return instance->
m_Variants.at( aVariantName ).m_Fields.at( aFieldName );
836 if( instance.m_Path ==
path )
837 return !instance.m_Reference.IsEmpty() && instance.m_Reference.Last() !=
'?';
848 refDesignator.Replace(
"~",
" " );
850 wxString prefix = refDesignator;
852 while( prefix.Length() )
854 wxUniCharRef last = prefix.Last();
856 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
864 prefix.Trim(
false );
866 if( !prefix.IsEmpty() )
874 return schematic->Settings().SubReference( aUnit, aAddSeparator );
886 if( instance.m_Path ==
path )
887 return instance.m_Unit;
903 if( instance.m_Path ==
path )
905 instance.m_Unit = aUnitSelection;
917 if( !aInstance || aVariantName.IsEmpty() )
925 wxCHECK_MSG( instance, ,
926 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
929 if( aVariantName.IsEmpty() )
935 if( instance->
m_Variants.contains( aVariantName ) && ( aEnable != instance->
m_Variants[aVariantName].m_DNP ) )
937 instance->
m_Variants[aVariantName].m_DNP = aEnable;
944 variant.
m_DNP = aEnable;
953 if( !aInstance || aVariantName.IsEmpty() )
961 if( aVariantName.IsEmpty() )
963 else if( instance.
m_Variants.contains( aVariantName ) )
964 return instance.
m_Variants[aVariantName].m_DNP;
972 if( !aInstance || aVariantName.IsEmpty() )
980 wxCHECK_MSG( instance, ,
981 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
984 if( aVariantName.IsEmpty() )
990 if( instance->
m_Variants.contains( aVariantName )
991 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromBOM ) )
993 instance->
m_Variants[aVariantName].m_ExcludedFromBOM = aEnable;
1009 if( !aInstance || aVariantName.IsEmpty() )
1017 if( aVariantName.IsEmpty() )
1019 else if( instance.
m_Variants.contains( aVariantName ) )
1020 return instance.
m_Variants[aVariantName].m_ExcludedFromBOM;
1029 if( !aInstance || aVariantName.IsEmpty() )
1037 wxCHECK_MSG( instance, ,
1038 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
1041 if( aVariantName.IsEmpty() )
1047 if( instance->
m_Variants.contains( aVariantName )
1048 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromSim ) )
1050 instance->
m_Variants[aVariantName].m_ExcludedFromSim = aEnable;
1066 if( !aInstance || aVariantName.IsEmpty() )
1074 if( aVariantName.IsEmpty() )
1076 else if ( instance.
m_Variants.contains( aVariantName ) )
1077 return instance.
m_Variants[aVariantName].m_ExcludedFromSim;
1085 const wxString& aVariantName )
1087 if( !aInstance || aVariantName.IsEmpty() )
1095 wxCHECK_MSG( instance, ,
1096 wxString::Format( wxS(
"Cannot set exclude from board for invalid sheet path '%s'." ),
1099 if( aVariantName.IsEmpty() )
1105 if( instance->
m_Variants.contains( aVariantName )
1106 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromBoard ) )
1108 instance->
m_Variants[aVariantName].m_ExcludedFromBoard = aEnable;
1123 const wxString& aVariantName )
const
1125 if( !aInstance || aVariantName.IsEmpty() )
1133 if( aVariantName.IsEmpty() )
1135 else if( instance.
m_Variants.contains( aVariantName ) )
1136 return instance.
m_Variants[aVariantName].m_ExcludedFromBoard;
1144 const wxString& aVariantName )
1146 if( !aInstance || aVariantName.IsEmpty() )
1154 wxCHECK_MSG( instance, ,
1155 wxString::Format( wxS(
"Cannot set exclude from pos files for invalid sheet path '%s'." ),
1158 if( aVariantName.IsEmpty() )
1164 if( instance->
m_Variants.contains( aVariantName )
1165 && ( aEnable != instance->
m_Variants[aVariantName].m_ExcludedFromPosFiles ) )
1167 instance->
m_Variants[aVariantName].m_ExcludedFromPosFiles = aEnable;
1182 const wxString& aVariantName )
const
1184 if( !aInstance || aVariantName.IsEmpty() )
1192 if( aVariantName.IsEmpty() )
1194 else if( instance.
m_Variants.contains( aVariantName ) )
1195 return instance.
m_Variants[aVariantName].m_ExcludedFromPosFiles;
1205 instance.m_Unit = aUnitSelection;
1210 bool aAllowExtraText,
const wxString& aVariantName )
const
1212 if( aVariantName.IsEmpty() )
1220 std::optional variant =
GetVariant( *aInstance, aVariantName );
1234 const wxString& aVariantName )
1236 if( !aInstance || aVariantName.IsEmpty() )
1244 wxCHECK( instance, );
1248 if( instance->
m_Variants.contains( aVariantName ) )
1250 instance->
m_Variants[aVariantName].m_Fields[fieldName] = aValue;
1257 newVariant.
m_Fields[fieldName] = aValue;
1258 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
1264 bool aAllowExtraText,
const wxString& aVariantName )
const
1284 m_fields.emplace_back(
this, aFieldType );
1313 if( !field.IsVisible() || field.GetText().IsEmpty() )
1317 aVector.push_back(
const_cast<SCH_FIELD*
>( &field ) );
1320 std::sort( aVector.begin(), aVector.end(),
1323 return lhs->GetOrdinal() < rhs->GetOrdinal();
1343 for(
unsigned ii = 0; ii <
m_fields.size(); ++ii )
1348 if( aFieldName ==
m_fields[ii].GetName(
false ) )
1361 if( field.GetName().IsSameAs( aFieldName,
false ) )
1370 bool aResetRef,
bool aResetOtherFields )
1374 std::vector<SCH_FIELD*> fields;
1375 m_part->GetFields( fields );
1377 for(
const SCH_FIELD* libField : fields )
1382 if( libField->IsMandatory() )
1384 fieldType = libField->GetId();
1389 schField =
GetField( libField->GetCanonicalName() );
1399 schField->
SetPrivate( libField->IsPrivate() );
1411 else if( aUpdateRef )
1412 SetRef( aPath, libField->GetText() );
1420 if( aResetOtherFields )
1422 else if( aUpdateOtherFields )
1423 schField->
SetText( libField->GetText() );
1427 if( aResetOtherFields || aUpdateOtherFields )
1428 schField->
SetText( libField->GetText() );
1438 bool updateValue =
true;
1439 bool updateExclFromBOM =
true;
1440 bool updateExclFromBoard =
true;
1441 bool updateDNP =
true;
1442 bool updateOtherFields =
true;
1443 bool updatePins =
true;
1447 updateValue = aProperty->
Name() ==
_HKI(
"Value" );
1448 updateExclFromBoard = aProperty->
Name() ==
_HKI(
"Exclude From Board" );
1449 updateExclFromBOM = aProperty->
Name() ==
_HKI(
"Exclude From Bill of Materials" );
1450 updateDNP = aProperty->
Name() ==
_HKI(
"Do not Populate" );
1451 updateOtherFields =
false;
1455 if( !updateValue && !updateExclFromBOM && !updateExclFromBoard && !updateDNP && !updateOtherFields && !updatePins )
1464 wxString ref =
GetRef( &aSourceSheet );
1469 std::vector<SCH_SYMBOL*> otherUnits;
1475 aCommit.
Modify( otherUnit, screen );
1480 if( updateOtherFields )
1492 if( field.IsMandatory() )
1493 otherField = otherUnit->GetField( field.GetId() );
1495 otherField = otherUnit->GetField( field.GetName() );
1499 otherField->
SetText( field.GetText() );
1507 newField.
Offset( otherUnit->GetPosition() );
1510 otherUnit->AddField( newField );
1514 for(
int ii = (
int) otherUnit->GetFields().size() - 1; ii >= 0; ii-- )
1516 SCH_FIELD& otherField = otherUnit->GetFields()[ii];
1519 otherUnit->GetFields().erase( otherUnit->GetFields().begin() + ii );
1523 if( updateExclFromBOM )
1526 if( updateExclFromBoard )
1530 otherUnit->SetDNP(
GetDNP( &aSourceSheet, aVariantName ), &sheet, aVariantName );
1534 for(
const std::unique_ptr<SCH_PIN>& model_pin :
m_pins )
1536 for(
SCH_PIN* src_pin : otherUnit->GetPinsByNumber( model_pin->GetNumber() ) )
1537 src_pin->SetAlt( model_pin->GetAlt() );
1548 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1549 aFunction(
pin.get() );
1552 aFunction( &field );
1558 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1560 if(
pin->GetNumber() == aNumber )
1570 std::vector<SCH_PIN*> pins;
1572 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1574 if(
pin->GetNumber() == aNumber )
1575 pins.push_back(
pin.get() );
1584 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1586 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
1587 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
1589 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1592 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
1595 if(
pin->GetPosition() == aPos )
1608 return std::vector<SCH_PIN*>();
1615 return m_part->GetPins();
1617 return std::vector<SCH_PIN*>();
1629 auto it =
m_pinMap.find( aLibPin );
1634 wxFAIL_MSG_AT(
"Pin not found", __FILE__, __LINE__, __FUNCTION__ );
1641 std::vector<const SCH_PIN*> pins;
1650 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1652 if( unit &&
pin->GetUnit() &&
pin->GetUnit() != unit )
1655 pins.push_back(
pin.get() );
1664 std::vector<SCH_PIN*> pins;
1673 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1675 if( unit &&
pin->GetUnit() &&
pin->GetUnit() != unit )
1678 pins.push_back(
pin.get() );
1694 wxCHECK_RET( aItem !=
nullptr && aItem->
Type() ==
SCH_SYMBOL_T, wxT(
"Cannot swap data with invalid symbol." ) );
1702 for( std::unique_ptr<SCH_PIN>&
pin : symbol->
m_pins )
1703 pin->SetParent( symbol );
1705 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1706 pin->SetParent(
this );
1711 m_part.reset( libSymbol );
1745 if( field.IsPrivate() )
1748 if( field.IsMandatory() )
1749 aVars->push_back( field.GetCanonicalName().Upper() );
1751 aVars->push_back( field.GetName() );
1754 aVars->push_back( wxT(
"OP" ) );
1755 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1756 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1757 aVars->push_back( wxT(
"UNIT" ) );
1758 aVars->push_back( wxT(
"SHORT_REFERENCE" ) );
1759 aVars->push_back( wxT(
"SYMBOL_LIBRARY" ) );
1760 aVars->push_back( wxT(
"SYMBOL_NAME" ) );
1761 aVars->push_back( wxT(
"SYMBOL_DESCRIPTION" ) );
1762 aVars->push_back( wxT(
"SYMBOL_KEYWORDS" ) );
1763 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1764 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1765 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1766 aVars->push_back( wxT(
"DNP" ) );
1767 aVars->push_back( wxT(
"SHORT_NET_NAME(<pin_number>)" ) );
1768 aVars->push_back( wxT(
"NET_NAME(<pin_number>)" ) );
1769 aVars->push_back( wxT(
"NET_CLASS(<pin_number>)" ) );
1770 aVars->push_back( wxT(
"PIN_NAME(<pin_number>)" ) );
1771 aVars->push_back( wxT(
"REFERENCE(<pin_number>)" ) );
1772 aVars->push_back( wxT(
"SHORT_REFERENCE(<pin_number>)" ) );
1773 aVars->push_back( wxT(
"UNIT(<pin_number>)" ) );
1784 const wxString& aVariantName,
int aDepth )
const
1786 static wxRegEx operatingPoint( wxT(
"^"
1793 wxCHECK( aPath,
false );
1800 wxString variant = aVariantName.IsEmpty() ? schematic->
GetCurrentVariant() : aVariantName;
1802 if( operatingPoint.Matches( *token ) )
1804 wxString
pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
1805 wxString precisionStr( operatingPoint.GetMatch( *token, 3 ) );
1806 wxString rangeStr( operatingPoint.GetMatch( *token, 4 ) );
1808 int precision = precisionStr.IsEmpty() ? 3 : precisionStr[0] -
'0';
1809 wxString range = rangeStr.IsEmpty() ? wxString( wxS(
"~A" ) ) : rangeStr;
1813 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1817 embeddedFilesStack.push_back(
m_part->GetEmbeddedFiles() );
1823 aVariantName, devnull ).model;
1827 wxString spiceRef =
model.SpiceGenerator().ItemName( spiceItem );
1828 spiceRef = spiceRef.Lower();
1835 else if(
pin == wxS(
":power" ) )
1837 if( rangeStr.IsEmpty() )
1838 range = wxS(
"~W" );
1840 *token = schematic->
GetOperatingPoint( spiceRef + wxS(
":power" ), precision, range );
1845 pin =
pin.SubString( 1, -1 );
1847 for(
const std::reference_wrapper<const SIM_MODEL_PIN>& modelPin :
model.GetPins() )
1849 SCH_PIN* symbolPin =
GetPin( modelPin.get().symbolPinNumber );
1853 if(
model.GetPins().size() == 2 )
1859 wxString signalName = spiceRef + wxS(
":" ) + modelPin.get().modelPinName;
1868 *token = wxS(
"?" );
1872 if( token->Contains(
':' ) )
1880 wxString fieldName = field.IsMandatory() ? field.GetCanonicalName() : field.GetName();
1882 wxString textToken = field.GetText();
1883 textToken.Replace(
" ", wxEmptyString );
1884 wxString tokenString =
"${" + fieldName +
"}";
1887 if( textToken.IsSameAs( tokenString,
false ) )
1890 if( token->IsSameAs( fieldName,
false ) )
1894 *token =
GetRef( aPath,
true );
1896 else if( !aVariantName.IsEmpty() )
1899 std::optional<SCH_SYMBOL_VARIANT> symVariant =
GetVariant( *aPath, aVariantName );
1901 if( symVariant && symVariant->m_Fields.contains( fieldName ) )
1902 *token = symVariant->m_Fields.at( fieldName );
1904 *token = field.GetShownText( aPath,
false, aDepth + 1 );
1908 *token = field.GetShownText( aPath,
false, aDepth + 1 );
1916 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) ) || token->IsSameAs( wxT(
"SIM.TYPE" ) )
1917 || token->IsSameAs( wxT(
"SIM.PINS" ) ) || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
1918 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) ) || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
1920 *token = wxEmptyString;
1927 if( token->IsSameAs( templateFieldname.m_Name ) || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
1931 *token = wxEmptyString;
1936 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1940 wxArrayString parts = wxSplit( footprint,
':' );
1942 if( parts.Count() > 0 )
1945 *token = wxEmptyString;
1949 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1953 wxArrayString parts = wxSplit( footprint,
':' );
1955 if( parts.Count() > 1 )
1956 *token = parts[std::min( 1, (
int) parts.size() - 1 )];
1958 *token = wxEmptyString;
1962 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
1967 else if( token->IsSameAs( wxT(
"SHORT_REFERENCE" ) ) )
1969 *token =
GetRef( aPath,
false );
1972 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
1974 *token =
m_lib_id.GetUniStringLibNickname();
1977 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
1979 *token =
m_lib_id.GetUniStringLibItemName();
1982 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
1987 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
1992 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1994 *token = wxEmptyString;
1996 if( aPath->
GetExcludedFromBOM( variant ) || this->ResolveExcludedFromBOM( aPath, variant ) )
1997 *token =
_(
"Excluded from BOM" );
2001 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
2003 *token = wxEmptyString;
2005 if( aPath->
GetExcludedFromBoard( variant ) || this->ResolveExcludedFromBoard( aPath, variant ) )
2006 *token =
_(
"Excluded from board" );
2010 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
2012 *token = wxEmptyString;
2014 if( aPath->
GetExcludedFromSim( variant ) || this->ResolveExcludedFromSim( aPath, variant ) )
2015 *token =
_(
"Excluded from simulation" );
2019 else if( token->IsSameAs( wxT(
"DNP" ) ) )
2021 *token = wxEmptyString;
2023 if( aPath->
GetDNP( variant ) || this->ResolveDNP( aPath, variant ) )
2024 *token =
_(
"DNP" );
2028 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) ) || token->StartsWith( wxT(
"NET_NAME(" ) )
2029 || token->StartsWith( wxT(
"NET_CLASS(" ) ) || token->StartsWith( wxT(
"PIN_NAME(" ) )
2030 || token->StartsWith( wxT(
"PIN_BASE_NAME(" ) ) || token->StartsWith( wxT(
"PIN_ALT_LIST(" ) )
2031 || token->StartsWith( wxT(
"REFERENCE(" ) ) || token->StartsWith( wxT(
"SHORT_REFERENCE(" ) )
2032 || token->StartsWith( wxT(
"UNIT(" ) ) )
2034 wxString pinNumber = token->AfterFirst(
'(' );
2035 pinNumber = pinNumber.BeforeLast(
')' );
2037 bool isReferenceFunction = token->StartsWith( wxT(
"REFERENCE(" ) );
2038 bool isShortReferenceFunction = token->StartsWith( wxT(
"SHORT_REFERENCE(" ) );
2039 bool isUnitFunction = token->StartsWith( wxT(
"UNIT(" ) );
2043 std::vector<const SCH_PIN*> pinsToSearch;
2044 std::vector<const SCH_PIN*> altPinsToSearch;
2046 if( isReferenceFunction || isShortReferenceFunction || isUnitFunction )
2049 pinsToSearch.push_back(
pin );
2054 pinsToSearch.push_back(
pin );
2057 altPinsToSearch.push_back(
pin );
2062 if(
pin->GetNumber() == pinNumber )
2064 if( isReferenceFunction || isShortReferenceFunction || isUnitFunction )
2066 int pinUnit =
pin->GetUnit();
2069 if( isReferenceFunction )
2077 else if( isShortReferenceFunction )
2082 else if( isUnitFunction )
2094 else if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
2096 *token =
pin->GetAlt().IsEmpty() ?
pin->GetName() :
pin->GetAlt();
2099 else if( token->StartsWith( wxT(
"PIN_BASE_NAME" ) ) )
2101 *token =
pin->GetBaseName();
2104 else if( token->StartsWith( wxT(
"PIN_ALT_LIST" ) ) )
2109 const std::map<wxString, SCH_PIN::ALT>& alts =
pin->GetAlternates();
2111 for(
const auto& [altName, altDef] : alts )
2113 if( !altList.IsEmpty() )
2114 altList += wxT(
", " );
2126 *token = wxEmptyString;
2128 else if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
2131 if( netName.Lower().StartsWith( wxT(
"unconnected" ) ) )
2132 *token = wxT(
"NC" );
2136 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
2138 *token = conn->
Name();
2140 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
2142 *token =
pin->GetEffectiveNetClass( aPath )->GetName();
2152 if(
pin->GetNumber() == pinNumber )
2155 if( token->StartsWith( wxT(
"PIN_BASE_NAME" ) ) )
2157 *token =
pin->GetBaseName();
2160 else if( token->StartsWith( wxT(
"PIN_ALT_LIST" ) ) )
2165 const std::map<wxString, SCH_PIN::ALT>& alts =
pin->GetAlternates();
2167 for(
const auto& [altName, altDef] : alts )
2169 if( !altList.IsEmpty() )
2170 altList += wxT(
", " );
2179 int pinUnit =
pin->GetUnit();
2195 if( symbol->
GetRef( &sheetPath,
false ) ==
GetRef( aPath,
false )
2198 targetPath = sheetPath;
2199 targetSymbol = symbol;
2212 *token = wxString::Format( wxT(
"<Unit %s not placed>" ),
SubReference( pinUnit,
false ) );
2218 SCH_PIN* instancePin =
nullptr;
2222 if( candidate->GetNumber() == pinNumber )
2224 instancePin = candidate;
2231 *token = wxEmptyString;
2236 if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
2238 *token = instancePin->
GetAlt().IsEmpty() ? instancePin->
GetName() : instancePin->
GetAlt();
2247 *token = wxEmptyString;
2249 else if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
2252 if( netName.Lower().StartsWith( wxT(
"unconnected" ) ) )
2253 *token = wxT(
"NC" );
2257 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
2259 *token = conn->
Name();
2261 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
2271 *token = wxString::Format( wxT(
"<Unresolved: pin %s>" ), pinNumber );
2291 if( instance.m_Path ==
path )
2293 if( instance.m_Reference.IsEmpty() || aResetPrefix )
2304 if( instance.m_Reference.IsEmpty() || aResetPrefix )
2311 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2312 pin->ClearDefaultNetName( aSheetPath );
2322 if( currentReference.IsEmpty() || aResetPrefix )
2333 wxCHECK( aSheetPath.size() > 0,
false );
2338 if( instance.m_Path == aSheetPath )
2351 bool transform =
false;
2353 switch( aOrientation )
2474 wxFAIL_MSG(
"Invalid schematic symbol orientation type." );
2528 for(
int type_rotate : rotate_values )
2540 wxFAIL_MSG(
"Schematic symbol orientation matrix internal error." );
2548void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const
2551 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str() <<
" ref=\""
2557 for(
int i = 1; i < (int)
GetFields().size(); ++i )
2559 const wxString& value =
GetFields()[i].GetText();
2561 if( !value.IsEmpty() )
2563 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\"" <<
TO_UTF8(
GetFields()[i].GetName() ) <<
'"'
2564 <<
" value=\"" <<
TO_UTF8( value ) <<
"\"/>\n";
2568 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
2588 if( aIncludeFields )
2592 if( field.IsVisible() )
2593 bBox.
Merge( field.GetBoundingBox() );
2607 catch(
const boost::bad_pointer& e )
2609 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ), e.what() ) );
2635 auto addExcludes = [&]()
2640 msgs.Add(
_(
"Simulation" ) );
2643 msgs.Add(
_(
"BOM" ) );
2646 msgs.Add(
_(
"Board" ) );
2648 if(
GetDNP( currentSheet, currentVariant ) )
2649 msgs.Add(
_(
"DNP" ) );
2651 msg = wxJoin( msgs,
'|' );
2652 msg.Replace(
'|', wxS(
", " ) );
2655 aList.emplace_back(
_(
"Exclude from" ), msg );
2666 aList.emplace_back(
_(
"Power symbol" ),
2674 aList.emplace_back(
_(
"Value" ),
2681 aList.emplace_back(
_(
"flags" ), wxString::Format(
"%X",
GetEditFlags() ) );
2686 msg =
_(
"Missing parent" );
2688 std::shared_ptr<LIB_SYMBOL> parent =
m_part->GetParent().lock();
2691 msg = parent->GetName();
2695 else if( !
m_lib_id.GetLibNickname().empty() )
2697 aList.emplace_back(
_(
"Library" ),
m_lib_id.GetLibNickname() );
2701 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
2709 msg =
_(
"<Unknown>" );
2711 aList.emplace_back(
_(
"Footprint" ), msg );
2715 _(
"Keywords" ) + wxT(
": " ) +
m_part->GetKeyWords() );
2720 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
2729 if( libNickname.empty() )
2730 msg =
_(
"No library defined!" );
2732 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
2734 aList.emplace_back(
_(
"Library" ), msg );
2769 field.SetTextPos( pos );
2787 field.SetTextPos( pos );
2806 field.SetTextPos( pos );
2827 if( drawItem.Matches( aSearchData, aAuxData ) )
2838 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2846 aItemList.push_back( item );
2852 std::vector<DANGLING_END_ITEM>& aItemListByPos,
const SCH_SHEET_PATH* aPath )
2854 bool changed =
false;
2856 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2858 bool previousState =
pin->IsDangling();
2859 pin->SetIsDangling(
true );
2864 bool do_break =
false;
2866 for(
auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
2885 pin->SetIsDangling(
false );
2896 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
2921 wxCHECK( symbol,
false );
2927 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2929 if(
pin->IsDangling() )
2942 if(
GetRef( aInstance ) != symbol->
GetRef( aInstance ) )
2952 for(
size_t i = 0; i <
m_pins.size(); i++ )
2964 std::vector<VECTOR2I> retval;
2966 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2970 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
2971 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
2973 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2976 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
3002 return wxString::Format(
_(
"Symbol %s [%s]" ),
3010 for(
KICAD_T scanType : aScanTypes )
3055 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3059 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
3060 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
3062 if( pin_unit > 0 && pin_unit !=
GetUnit() )
3065 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
3102 std::vector<SCH_FIELD*> fields, otherFields;
3105 aSymbol.
GetFields( otherFields,
false );
3107 if( fields.size() != otherFields.size() )
3110 for(
int ii = 0; ii < (int) fields.size(); ii++ )
3115 if( fields[ii]->GetText().Cmp( otherFields[ii]->GetText() ) != 0 )
3125 return !( *
this == aSymbol );
3131 wxCHECK_MSG(
Type() == aSymbol.
Type(), *
this,
3132 wxT(
"Cannot assign object type " ) + aSymbol.
GetClass() + wxT(
" to type " ) +
GetClass() );
3134 if( &aSymbol !=
this )
3151 field.SetParent(
this );
3163 bBox.
Inflate( aAccuracy / 2 );
3179 rect.
Inflate( aAccuracy / 2 );
3201 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3214 if(
pin->GetLocalPosition() == new_pos )
3229 const VECTOR2I& aOffset,
bool aDimmed )
3243 for(
unsigned i = 0; i < tempPins.size(); ++i )
3246 SCH_PIN* tempPin = tempPins[i];
3266 text->SetText(
dummy.GetShownText(
false ) );
3277 bool dnp =
GetDNP( sheet, variant );
3279 for(
bool local_background : {
true,
false } )
3285 field.ClearRenderCache();
3289 && ( field.IsVisible() || field.IsForceVisible() ) )
3302 std::vector<wxString> properties;
3306 wxString text_field = field.GetShownText( sheet,
false, 0, variant );
3308 if( text_field.IsEmpty() )
3311 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ), field.GetName(), text_field ) );
3314 if( !
m_part->GetKeyWords().IsEmpty() )
3316 properties.emplace_back(
3317 wxString::Format( wxT(
"!%s = %s" ),
_(
"Keywords" ),
m_part->GetKeyWords() ) );
3340 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
3341 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
3359 double lineWidth = aSize / 10.0;
3361 std::vector<SCH_SHAPE> shapeList;
3363 int tolerance = 100;
3365 for(
const SCH_SHAPE& shape : shapeList )
3371 aPlotter->
BezierCurve( shape.GetStart(), shape.GetBezierC1(), shape.GetBezierC2(), shape.GetEnd(),
3372 tolerance, lineWidth );
3374 aPlotter->
Circle( shape.getCenter(), shape.GetRadius() * 2, filled, lineWidth );
3434 for(
unsigned i = 0; i < tempPins.size(); ++i )
3437 SCH_PIN* tempPin = tempPins[i];
3455 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3457 if(
pin->IsBrightened() )
3467 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3468 pin->ClearBrightened();
3486 m_part->SetShowPinNames( aShow );
3499 m_part->SetShowPinNumbers( aShow );
3505 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3507 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
3508 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
3510 if( pin_unit > 0 && pin_unit !=
GetUnit() )
3513 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
3516 if(
pin->IsPointClickableAnchor( aPos ) )
3535 if( pin_list.size() != 1 )
3553 if( pin_list.size() != 1 )
3565 return m_part->IsLocalPower();
3574 return m_part->IsGlobalPower();
3586 wxCHECK(
m_part,
false );
3588 return m_part->IsNormal();
3594 std::unordered_set<wxString> componentClass;
3596 auto getComponentClassFields = [&](
const std::vector<SCH_FIELD>& fields )
3600 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
3602 if( field.GetShownText( aPath,
false ) != wxEmptyString )
3603 componentClass.insert( field.GetShownText( aPath,
false ) );
3609 getComponentClassFields(
m_fields );
3616 getComponentClassFields( label->GetFields() );
3620 return componentClass;
3625 const wxString& aVariantName )
const
3630 return std::nullopt;
3632 return instance.
m_Variants.find( aVariantName )->second;
3644 instance->
m_Variants.insert( std::make_pair( aVariant.
m_Name, aVariant ) );
3653 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
3661 const wxString& aNewName )
3666 if( !instance || !instance->
m_Variants.contains( aOldName ) )
3671 variant.
m_Name = aNewName;
3673 instance->
m_Variants.insert( std::make_pair( aNewName, variant ) );
3678 const wxString& aNewVariant )
3683 if( !instance || !instance->
m_Variants.contains( aSourceVariant ) )
3688 variant.
m_Name = aNewVariant;
3689 instance->
m_Variants.insert( std::make_pair( aNewVariant, variant ) );
3736 for(
unsigned i = 0; i <
m_pins.size(); ++i )
3745 if( m_instanceReferences != symbol.m_instanceReferences )
3771 double aLineWidth,
bool aHorizontal )
3775 double x_right = aSize / 1.6180339887;
3776 double x_middle = x_right / 2.0;
3789 aShapeList.back().SetStart( bottomPt );
3790 aShapeList.back().SetBezierC1( bottomAnchorPt );
3791 aShapeList.back().SetBezierC2( leftSideAnchorPt1 );
3792 aShapeList.back().SetEnd( leftPt );
3796 aShapeList.back().SetStart( leftPt );
3797 aShapeList.back().SetBezierC1( leftSideAnchorPt2 );
3798 aShapeList.back().SetBezierC2( rightSideAnchorPt2 );
3799 aShapeList.back().SetEnd( rightPt );
3802 aShapeList.back().SetStart( rightPt );
3803 aShapeList.back().SetBezierC1( rightSideAnchorPt1 );
3804 aShapeList.back().SetBezierC2( bottomAnchorPt );
3805 aShapeList.back().SetEnd( bottomPt );
3808 aShapeList.back().SetCenter( ( leftPt + rightPt ) / 2.0 );
3809 aShapeList.back().SetRadius( aSize / 15.0 );
3814 shape.Rotate(
VECTOR2I( 0, 0 ),
true );
3825 if( instance.m_Path == aSheetPath )
3837 if( instance.m_Path == aSheetPath )
3873 auto hasLibPart = [](
INSPECTABLE* aItem ) ->
bool
3876 return symbol->GetLibSymbolRef() !=
nullptr;
3889 const wxString groupFields =
_HKI(
"Fields" );
3909 auto multiUnit = [=](
INSPECTABLE* aItem ) ->
bool
3912 return symbol->IsMultiUnit();
3917 auto multiBodyStyle = [=](
INSPECTABLE* aItem ) ->
bool
3920 return symbol->IsMultiBodyStyle();
3931 wxPGChoices choices;
3935 for(
int ii = 1; ii <= symbol->GetUnitCount(); ii++ )
3936 choices.Add( symbol->GetUnitDisplayName( ii,
false ), ii );
3948 wxPGChoices choices;
3952 for(
int ii = 1; ii <= symbol->GetBodyStyleCount(); ii++ )
3953 choices.Add( symbol->GetBodyStyleDescription( ii,
false ) );
3959 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 coord_type GetLeft() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr bool Intersects(const BOX2< Vec > &aRect) const
constexpr coord_type GetBottom() 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
bool IsHorizontal() 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,...
const EDA_ANGLE & GetTextAngle() const
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.
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
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.
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.
const wxString GetName() const
Gets the name of this (maybe aggregate) netclass in a format for internal usage or for export to exte...
A singleton reporter that reports to nowhere.
Base plotter engine class.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
virtual void BezierCurve(const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness)
Generic fallback: Cubic Bezier curve rendered as a polyline.
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.
wxString GetCurrentVariant() const
Return the current variant being edited.
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
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual const wxString & GetText() const override
Return the string associated with the text object.
void ImportValues(const SCH_FIELD &aSource)
Copy parameters from a SCH_FIELD source.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
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.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
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)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
ALT GetAlt(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
const 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.
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
bool GetExcludedFromBoard() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
size_t size() const
Forwarded method from std::vector.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
Variant information for a schematic symbol.
void InitializeAttributes(const SCH_SYMBOL &aSymbol)
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the display name for a given unit aUnit.
SCH_SYMBOL & operator=(const SCH_SYMBOL &aItem)
size_t GetFullPinCount() const
std::vector< SCH_SYMBOL_INSTANCE > m_instances
Define the hierarchical path and reference of the symbol.
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 GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
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...
virtual void SetDNP(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
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
SCH_SYMBOL_INSTANCE * getInstance(const KIID_PATH &aPath)
wxString SubReference(int aUnit, bool aAddSeparator=true) const
wxString GetClass() const override
Return the class name.
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
void SetFieldText(const wxString &aFieldName, const wxString &aFieldText, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString)
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 SetBodyStyleProp(const wxString &aBodyStyle) override
std::vector< SCH_PIN * > GetPins() const override
bool GetExcludedFromPosFilesProp() const
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
wxString GetFieldText(const wxString &aFieldName, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariantName=wxEmptyString) const
void SetExcludedFromSim(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
void SetExcludedFromSimProp(bool aEnable)
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
wxString GetShownKeyWords(int aDepth=0) const override
std::optional< SCH_SYMBOL_VARIANT > GetVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName) const
bool GetExcludedFromBoardProp() 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.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
bool GetExcludedFromSimProp() const
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
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_instances), if this entry does not already exist.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void SetExcludedFromBOMProp(bool aEnable)
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
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.
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, const wxString &aVariantName=wxEmptyString) const override
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
void RenameVariant(const KIID_PATH &aPath, const wxString &aOldName, const wxString &aNewName)
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.
bool HasDeMorganBodyStyles() const override
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
std::vector< SCH_PIN * > GetAllLibPins() const
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, const wxString &aVariantName=wxEmptyString) 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...
void PlotPins(PLOTTER *aPlotter, bool aDnp) const
Plot just the symbol pins.
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 SetExcludedFromPosFiles(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
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 SyncOtherUnits(const SCH_SHEET_PATH &aSourceSheet, SCH_COMMIT &aCommit, PROPERTY_BASE *aProperty, const wxString &aVariantName=wxEmptyString)
Keep fields other than the reference, include/exclude flags, and alternate pin assignments in sync in...
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
void SetExcludedFromPosFilesProp(bool aEnable)
wxString GetShownDescription(int aDepth=0) const override
const LIB_ID & GetLibId() const override
bool operator<(const SCH_ITEM &aItem) const override
static void BuildLocalPowerIconShape(std::vector< SCH_SHAPE > &aShapeList, const VECTOR2D &aPos, double aSize, double aLineWidth, bool aHorizontal)
Build the local power pin indicator icon shape, at coordinate aPos.
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
void SetValueProp(const wxString &aValue)
void SetUnitProp(int aUnit)
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
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 GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
void AddVariant(const SCH_SHEET_PATH &aInstance, const SCH_SYMBOL_VARIANT &aVariant)
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetDNPProp(bool aEnable)
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
std::vector< SCH_PIN * > GetPinsByNumber(const wxString &aNumber) const
Find all symbol pins with the given number.
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
bool GetExcludedFromBOMProp() const
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
void SetExcludedFromBoardProp(bool aEnable)
void SetExcludedFromBOM(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
void PlotLocalPowerIconShape(PLOTTER *aPlotter) const
Plot the local power pin indicator icon shape.
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 DeleteVariant(const KIID_PATH &aPath, const wxString &aVariantName)
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.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
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
void SetExcludedFromBoard(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void CopyVariant(const KIID_PATH &aPath, const wxString &aSourceVariant, const wxString &aNewVariant)
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)
A base class for LIB_SYMBOL and SCH_SYMBOL.
bool m_DNP
True if symbol is set to 'Do Not Populate'.
bool m_excludedFromPosFiles
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
const TRANSFORM & GetTransform() const
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
virtual bool GetShowPinNames() const
SYMBOL & operator=(const SYMBOL &aItem)
virtual bool GetShowPinNumbers() const
TRANSFORM m_transform
The rotation/mirror transformation.
const std::vector< TEMPLATE_FIELDNAME > & GetTemplateFieldNames()
Return a template field name list for read only access.
std::map< wxString, wxString > m_Fields
bool m_ExcludedFromPosFiles
#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_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
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
@ FILLED_SHAPE
Fill with object color.
a few functions useful in geometry calculations.
const wxChar *const traceSchSymbolRef
Flag to enable debug output of schematic symbol reference resolution.
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 void plotLocalPowerIcon(PLOTTER *aPlotter, const VECTOR2D &aPos, double aSize, bool aRotate)
plot a local power pin indicator icon.
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.
std::map< wxString, SCH_SYMBOL_VARIANT > m_Variants
A list of symbol variants.
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)
wxString result
Test unit parsing edge cases and error handling.
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