47#include <api/schematic/schematic_types.pb.h>
76 const wxString& aVariant = wxEmptyString )
78 const std::unique_ptr<LIB_SYMBOL>& libSymbol = aSymbol->
GetLibSymbolRef();
83 const std::vector<ASSOCIATED_FOOTPRINT>& assoc = libSymbol->GetEffectiveAssociatedFootprints();
91 fpId.
Parse( fpField->GetText( aPath, aVariant ) );
95 if( candidate.m_FootprintLibId == fpId )
99 return &assoc.front();
108 wxAny
getter(
const void* aObject )
const final
110 const auto* symbol =
reinterpret_cast<const SCH_SYMBOL*
>( aObject );
111 SCHEMATIC* schematic = symbol->Schematic();
117 const wxString& aVariant )
const = 0;
135 void setter(
void* obj, wxAny& v )
override
139 if( !v.GetAs( &value ) )
145 wxString variantName;
176 field->
SetText( value, sheetPath, variantName );
180 const wxString& variantName )
const override
189 if( !variantName.IsEmpty() && sheetPath )
194 return wxAny(
text );
220 void setter(
void* obj, wxAny& v )
override {}
223 const wxString& variantName )
const override
226 return wxAny( active->m_FootprintLibId.Format().wx_str() );
228 return wxAny( wxEmptyString );
265 void setter(
void* obj, wxAny& v )
override
269 if( !v.GetAs( &value ) )
275 wxString variantName;
292 override.m_ActiveMapName = active->m_MapName;
299 const wxString& variantName )
const override
303 switch(
override.m_Mode )
335 return wxPGChoices();
345 std::vector<wxString> names;
349 for(
const PIN_MAP& map : lib->GetEffectivePinMaps().GetAll() )
350 names.push_back( map.GetName() );
359 const std::vector<wxString> names =
MapNames( aSymbol );
361 for(
size_t ii = 0; ii < names.size(); ++ii )
362 choices.Add( names[ii], (
int) ii );
367 void setter(
void* obj, wxAny& v )
override
371 if( !v.GetAs( &value ) )
375 const std::vector<wxString> names =
MapNames( symbol );
377 if( value < 0 || value >= (
int) names.size() )
381 wxString variantName;
391 override.m_ActiveMapName = names[value];
396 const wxString& variantName )
const override
405 const std::vector<wxString> names =
MapNames( symbol );
407 if( std::find( names.begin(), names.end(), active ) == names.end() )
410 active = fp->m_MapName;
413 for(
size_t ii = 0; ii < names.size(); ++ii )
415 if( names[ii] == active )
416 return wxAny( (
int) ii );
443 void setter(
void* obj, wxAny& v )
override {}
446 const wxString& variantName )
const override
453 std::vector<wxString> logical =
pin->GetStackedPinNumbers();
455 if( std::find( logical.begin(), logical.end(),
m_pinNumber ) == logical.end() )
458 wxString
pad =
pin->GetEffectivePadNumber( *sheetPath, variantName );
461 return wxAny( wxString::Format(
_(
"%s (identity)" ),
pad ) );
483 std::string ret =
TO_UTF8( txt );
487 if( (
unsigned char) c <=
' ' )
514 std::unique_ptr<LIB_SYMBOL> part;
545 SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.BodyStyle, aPosition, aParent )
548 for(
const auto& [fieldId, fieldValue] : aSel.
Fields )
550 if( fieldId == FIELD_T::REFERENCE )
551 SetRef( aSheet, fieldValue );
552 else if( SCH_FIELD* field = GetField( fieldId ) )
553 field->SetText( fieldValue );
581 field.SetParent(
this );
586 for(
const std::unique_ptr<SCH_PIN>&
pin : aSymbol.
m_pins )
588 m_pins.emplace_back( std::make_unique<SCH_PIN>( *pin ) );
589 m_pins.back()->SetParent( this );
610 return libSymbol && !libSymbol->GetEffectiveAssociatedFootprints().empty();
622 std::vector<PROPERTY_BASE*> props;
624 auto getOrCreate = [&](
const wxString& aName, std::unique_ptr<PROPERTY_BASE> aProp )
631 return it->second.get();
636 if( !field.IsMandatory() )
639 if( field.IsPrivate() )
642 const wxString&
name = field.GetUntranslatedName();
647 props.push_back( getOrCreate(
name, std::make_unique<SCH_SYMBOL_FIELD_PROPERTY>(
name ) ) );
650 std::vector<const SCH_FIELD*> userFields;
654 if( field.IsMandatory() || field.IsPrivate() )
657 userFields.push_back( &field );
660 std::ranges::sort( userFields,
666 for(
const SCH_FIELD* field : userFields )
668 const wxString&
name = field->GetUntranslatedName();
669 props.push_back( getOrCreate(
name, std::make_unique<SCH_SYMBOL_FIELD_PROPERTY>(
name ) ) );
673 props.push_back( prop );
680 props.push_back( getOrCreate(
PIN_MAP_MODE_PROP, std::make_unique<SCH_SYMBOL_PIN_MAP_MODE_PROPERTY>() ) );
681 props.push_back( getOrCreate(
PIN_MAP_NAME_PROP, std::make_unique<SCH_SYMBOL_PIN_MAP_NAME_PROPERTY>() ) );
689 for(
const wxString& number :
pin->GetStackedPinNumbers() )
691 if( number.IsEmpty() )
696 props.push_back( getOrCreate(
697 propName, std::make_unique<SCH_SYMBOL_PIN_MAP_ENTRY_PROPERTY>( propName, number ) ) );
746 kiapi::schematic::types::SchematicSymbolInstance symbol;
748 aContainer.PackFrom( symbol );
757 aSymbol.mutable_id()->set_value(
m_Uuid.AsStdString() );
759 aSymbol.set_locked(
IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
766 PackLibId( aSymbol.mutable_lib_id(),
id );
771 SchematicSymbolTransform* transform = aSymbol.mutable_transform();
772 transform->set_orientation(
778 aSymbol.mutable_body_style()->set_style(
GetBodyStyle() );
788 if( field.IsMandatory() )
791 field.Serialize( *aSymbol.add_user_fields(),
schIUScale );
795 m_part->Serialize( *aSymbol.mutable_definition(),
true );
808 kiapi::schematic::types::SchematicSymbolInstance symbol;
810 if( !aContainer.UnpackTo( &symbol ) )
825 SetLocked( aSymbol.locked() == LockedState::LS_LOCKED );
829 if( aSymbol.has_lib_id() )
837 const SchematicSymbol& def = aSymbol.definition();
842 std::unordered_map<::KIID, wxString> pinAltMap;
844 for(
const SchematicSymbolChild& child : def.items() )
849 SchematicPin pinProto;
851 if( child.item().UnpackTo( &pinProto ) && pinProto.has_active_alternate() )
852 pinAltMap[
::KIID( pinProto.id().value() )] = wxString::FromUTF8( pinProto.active_alternate() );
865 if( aSymbol.has_body_style() )
874 std::set<wxString> incoming;
876 for(
const SchematicField& fieldProto : aSymbol.user_fields() )
878 wxString
name = wxString::FromUTF8( fieldProto.name() );
885 incoming.insert(
name );
892 std::vector<wxString> toRemove;
896 if( !field.IsMandatory() && !incoming.count( field.GetName(
false ) ) )
897 toRemove.push_back( field.GetName(
false ) );
900 for(
const wxString&
name : toRemove )
903 if( aSymbol.has_show_pin_names() )
906 if( aSymbol.has_show_pin_numbers() )
909 if( aSymbol.has_pin_name_offset() )
922 m_pins.emplace_back( std::make_unique<SCH_PIN>( *
pin ) );
923 m_pins.back()->SetParent(
this );
931 if( pinAltMap.contains(
pin->m_Uuid ) )
932 pin->SetAlt( pinAltMap.at(
pin->m_Uuid ) );
951 const int min_grid_size =
schIUScale.MilsToIU( 25 );
953 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
955 if( ( (
pin->GetPosition().x -
m_pos.x ) % min_grid_size ) != 0 )
958 if( ( (
pin->GetPosition().y -
m_pos.y ) % min_grid_size ) != 0 )
983 wxCHECK2( !aLibSymbol || aLibSymbol->
IsRoot(), aLibSymbol =
nullptr );
985 m_part.reset( aLibSymbol );
993 pin->SetLibPin(
nullptr );
1002 return m_part->GetDescription();
1004 return wxEmptyString;
1011 return m_part->GetShownDescription( aContext, aDepth );
1013 return wxEmptyString;
1020 return m_part->GetKeyWords();
1022 return wxEmptyString;
1029 return m_part->GetShownKeyWords( aContext, aDepth );
1031 return wxEmptyString;
1038 return m_part->GetDatasheetField().GetText();
1040 return wxEmptyString;
1046 std::map<wxString, wxString> altPinMap;
1047 std::map<wxString, SCH_PIN::ALT> altPinDefs;
1048 std::map<wxString, std::vector<SCH_PIN*>> pinUuidMap;
1049 std::set<SCH_PIN*> unassignedSchPins;
1050 std::vector<SCH_PIN*> unassignedLibPins;
1052 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1055 pinUuidMap[
pin->GetNumber()].push_back(
pin.get() );
1057 unassignedSchPins.insert(
pin.get() );
1059 if( !
pin->GetAlt().IsEmpty() )
1061 altPinMap[
pin->GetNumber()] =
pin->GetAlt();
1062 auto altDefIt =
pin->GetAlternates().find(
pin->GetAlt() );
1064 if( altDefIt !=
pin->GetAlternates().end() )
1065 altPinDefs[
pin->GetNumber()] = altDefIt->second;
1068 pin->SetLibPin(
nullptr );
1085 auto ii = pinUuidMap.find( libPin->GetNumber() );
1087 if( ii == pinUuidMap.end() || ii->second.empty() )
1089 unassignedLibPins.push_back( libPin );
1093 auto it = ii->second.begin();
1095 ii->second.erase( it );
1096 pin->GetAlternates() = libPin->GetAlternates();
1097 pin->SetLibPin( libPin );
1098 pin->SetPosition( libPin->GetPosition() );
1099 pin->SetUnit( libPin->GetUnit() );
1100 pin->SetBodyStyle( libPin->GetBodyStyle() );
1102 unassignedSchPins.erase(
pin );
1104 auto iii = altPinMap.find( libPin->GetNumber() );
1106 if( iii != altPinMap.end() )
1108 wxString altName = iii->second;
1110 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
1112 auto defIt = altPinDefs.find( libPin->GetNumber() );
1114 if( defIt != altPinDefs.end() )
1116 for(
const auto& [
name, alt] :
pin->GetAlternates() )
1118 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
1127 pin->SetAlt( altName );
1134 size_t nextUnassigned = 0;
1136 for(
SCH_PIN* libPin : unassignedLibPins )
1141 if( !unassignedSchPins.empty() )
1143 while( nextUnassigned <
m_pins.size()
1144 && !unassignedSchPins.contains(
m_pins[nextUnassigned].get() ) )
1149 pin =
m_pins.at( nextUnassigned++ ).get();
1150 unassignedSchPins.erase(
pin );
1155 pin =
m_pins.emplace_back( std::make_unique<SCH_PIN>(
SCH_PIN(
this, libPin ) ) ).get();
1159 pin->GetAlternates() = libPin->GetAlternates();
1160 pin->SetLibPin( libPin );
1161 pin->SetPosition( libPin->GetPosition() );
1162 pin->SetUnit( libPin->GetUnit() );
1163 pin->SetBodyStyle( libPin->GetBodyStyle() );
1164 pin->SetNumber( libPin->GetNumber() );
1166 auto iii = altPinMap.find( libPin->GetNumber() );
1168 if( iii != altPinMap.end() )
1170 wxString altName = iii->second;
1172 if(
pin->GetAlternates().find( altName ) ==
pin->GetAlternates().end() )
1174 auto defIt = altPinDefs.find( libPin->GetNumber() );
1176 if( defIt != altPinDefs.end() )
1178 for(
const auto& [
name, alt] :
pin->GetAlternates() )
1180 if( alt.m_Shape == defIt->second.m_Shape && alt.m_Type == defIt->second.m_Type )
1189 pin->SetAlt( altName );
1194 for(
auto it1 =
m_pins.begin(); it1 !=
m_pins.end() && !unassignedSchPins.empty(); )
1196 auto it2 = unassignedSchPins.find( it1->get() );
1198 if( it2 != unassignedSchPins.end() )
1200 it1 =
m_pins.erase( it1 );
1201 unassignedSchPins.erase( it2 );
1212 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1233 return m_part->GetUnitCount();
1242 return m_part->GetBodyStyleCount();
1251 return m_part->HasDeMorganBodyStyles();
1260 return m_part->GetUnitDisplayName( aUnit, aLabel );
1262 return wxString::Format(
_(
"Unit %s" ),
SubReference( aUnit ) );
1271 return m_part->GetBodyStyleDescription( aBodyStyle, aLabel );
1294 if( instance.m_Path.EndsWith( aSheetPath ) )
1296 aInstance = instance;
1313 bool removed =
false;
1317 for(
int ii =
m_instances.size() - 1; ii >= 0; --ii )
1322 wxS(
"Removing symbol instance:\n"
1324 " reference %s, unit %d from symbol %s." ),
1366 wxS(
"Adding symbol '%s' instance:\n"
1367 " sheet path '%s'\n"
1395 wxLogTrace(
traceSchSymbolRef,
"GetRef for symbol %s on path %s (sheet path has %zu sheets)",
1420 wxLogTrace(
traceSchSymbolRef,
" Using fallback from REFERENCE field: %s", ref );
1445 if(
validator.DoValidate( aRef,
nullptr ) )
1466 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1467 pin->ClearDefaultNetName( sheet );
1484 const wxString& aVariantName )
1486 wxCHECK( !aFieldName.IsEmpty(), );
1492 switch( field->
GetId() )
1496 SetRef( aPath, aFieldText );
1501 wxString defaultText = field->
GetText( aPath );
1503 if( aVariantName.IsEmpty() )
1505 if( aFieldText != defaultText )
1512 wxCHECK( instance, );
1518 const SCH_FIELD* altField = altSymbol->GetField( aFieldName );
1520 if( altField && !altField->
GetText().IsEmpty() )
1521 defaultText = altField->
GetText();
1524 if( instance->
m_Variants.contains( aVariantName ) )
1526 if( aFieldText != defaultText )
1527 instance->
m_Variants[aVariantName].m_Fields[aFieldName] = aFieldText;
1529 instance->
m_Variants[aVariantName].m_Fields.erase( aFieldName );
1531 else if( aFieldText != defaultText )
1536 newVariant.
m_Fields[aFieldName] = aFieldText;
1537 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
1548 const wxString& aVariantName )
const
1550 wxCHECK( !aFieldName.IsEmpty(), wxEmptyString );
1554 wxCHECK( field, wxEmptyString );
1556 switch( field->
GetId() )
1559 wxCHECK( aPath, field->
GetText() );
1560 return GetRef( aPath,
false );
1564 if( !aVariantName.IsEmpty() && aPath )
1568 if( instance && instance->
m_Variants.contains( aVariantName )
1569 && instance->
m_Variants.at( aVariantName ).m_Fields.contains( aFieldName ) )
1571 return instance->
m_Variants.at( aVariantName ).m_Fields.at( aFieldName );
1580 if( altField && !altField->
GetText().IsEmpty() )
1588 if( aVariantName.IsEmpty() )
1596 if( instance && instance->
m_Variants.contains( aVariantName ) )
1600 if( variant.
m_Fields.contains( aFieldName ) )
1601 return variant.
m_Fields.at( aFieldName );
1609 if( altField && !altField->
GetText().IsEmpty() )
1628 if( instance.m_Path ==
path )
1629 return !instance.m_Reference.IsEmpty() && instance.m_Reference.Last() !=
'?';
1640 refDesignator.Replace(
"~",
" " );
1642 wxString prefix = refDesignator;
1644 while( prefix.Length() )
1646 wxUniCharRef last = prefix.Last();
1648 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
1649 prefix.RemoveLast();
1655 prefix.Trim(
true );
1656 prefix.Trim(
false );
1658 if( !prefix.IsEmpty() )
1668 const std::map<int, wxString>& names =
m_part->GetUnitDisplayNames();
1669 auto it = names.find( aUnit );
1671 if( it != names.end() )
1677 int sep =
schematic->Settings().m_SubpartIdSeparator;
1679 if( sep != 0 && aAddSeparator )
1680 subRef << wxChar( sep );
1683 subRef << it->second;
1689 return schematic->Settings().SubReference( aUnit, aAddSeparator );
1725 if( !aInstance || aVariantName.IsEmpty() )
1733 wxCHECK_MSG( instance, ,
1734 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
1737 if( aVariantName.IsEmpty() )
1743 if( instance->
m_Variants.contains( aVariantName ) )
1745 instance->
m_Variants[aVariantName].m_DNP = aEnable;
1747 else if( aEnable !=
m_DNP )
1752 variant.
m_DNP = aEnable;
1761 if( !aInstance || aVariantName.IsEmpty() )
1769 if( instance.
m_Variants.contains( aVariantName ) )
1770 return instance.
m_Variants[aVariantName].m_DNP;
1777 const wxString& aVariantName )
1779 if( !aInstance || aVariantName.IsEmpty() )
1787 wxCHECK_MSG( instance, ,
1788 wxString::Format( wxS(
"Cannot set pin map override for invalid sheet path '%s'." ),
1791 if( instance->
m_Variants.contains( aVariantName ) )
1793 instance->
m_Variants[aVariantName].m_PinMapOverride = aOverride;
1807 const wxString& aVariantName )
const
1811 if( aInstance && !aVariantName.IsEmpty() )
1820 if(
result.IsDelegate() && aInstance )
1828 const wxString& aVariantName )
const
1833 wxString ref =
GetRef( &aSheet );
1841 if( sibling ==
this || sibling->
GetUnit() != 1 )
1844 if( sibling->
GetRef( &sheet ).CmpNoCase( ref ) != 0 )
1863 if( !aInstance || aVariantName.IsEmpty() )
1871 wxCHECK_MSG( instance, ,
1872 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
1875 if( aVariantName.IsEmpty() )
1881 if( instance->
m_Variants.contains( aVariantName ) )
1883 instance->
m_Variants[aVariantName].m_ExcludedFromBOM = aEnable;
1899 if( !aInstance || aVariantName.IsEmpty() )
1907 if( instance.
m_Variants.contains( aVariantName ) )
1908 return instance.
m_Variants[aVariantName].m_ExcludedFromBOM;
1917 if( !aInstance || aVariantName.IsEmpty() )
1925 wxCHECK_MSG( instance, ,
1926 wxString::Format( wxS(
"Cannot get DNP attribute for invalid sheet path '%s'." ),
1929 if( aVariantName.IsEmpty() )
1935 if( instance->
m_Variants.contains( aVariantName ) )
1937 instance->
m_Variants[aVariantName].m_ExcludedFromSim = aEnable;
1953 if( !aInstance || aVariantName.IsEmpty() )
1961 if( instance.
m_Variants.contains( aVariantName ) )
1962 return instance.
m_Variants[aVariantName].m_ExcludedFromSim;
1970 const wxString& aVariantName )
1972 if( !aInstance || aVariantName.IsEmpty() )
1980 wxCHECK_MSG( instance, ,
1981 wxString::Format( wxS(
"Cannot set exclude from board for invalid sheet path '%s'." ),
1984 if( aVariantName.IsEmpty() )
1990 if( instance->
m_Variants.contains( aVariantName ) )
1992 instance->
m_Variants[aVariantName].m_ExcludedFromBoard = aEnable;
2007 const wxString& aVariantName )
const
2009 if( !aInstance || aVariantName.IsEmpty() )
2017 if( instance.
m_Variants.contains( aVariantName ) )
2018 return instance.
m_Variants[aVariantName].m_ExcludedFromBoard;
2026 const wxString& aVariantName )
2028 if( !aInstance || aVariantName.IsEmpty() )
2036 wxCHECK_MSG( instance, ,
2037 wxString::Format( wxS(
"Cannot set exclude from pos files for invalid sheet path '%s'." ),
2040 if( aVariantName.IsEmpty() )
2046 if( instance->
m_Variants.contains( aVariantName ) )
2048 instance->
m_Variants[aVariantName].m_ExcludedFromPosFiles = aEnable;
2063 const wxString& aVariantName )
const
2065 if( !aInstance || aVariantName.IsEmpty() )
2073 if( instance.
m_Variants.contains( aVariantName ) )
2074 return instance.
m_Variants[aVariantName].m_ExcludedFromPosFiles;
2084 instance.m_Unit = aUnitSelection;
2089 const wxString& aVariantName )
const
2091 if( aVariantName.IsEmpty() || !aInstance )
2094 std::optional variant =
GetVariant( *aInstance, aVariantName );
2101 [&](
const wxString& aText ) -> wxString
2103 std::function<bool( wxString* )>
resolver =
2104 [&]( wxString* token ) ->
bool
2112 if( variant->m_Fields.contains( fieldName ) )
2113 return resolve( variant->m_Fields[fieldName] );
2121 if( altField && !altField->
GetText().IsEmpty() )
2122 return resolve( altField->
GetText() );
2133 const wxString& aVariantName )
2135 if( !aInstance || aVariantName.IsEmpty() )
2143 wxCHECK( instance, );
2147 if( instance->
m_Variants.contains( aVariantName ) )
2149 instance->
m_Variants[aVariantName].m_Fields[fieldName] = aValue;
2156 newVariant.
m_Fields[fieldName] = aValue;
2157 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
2163 const wxString& aVariantName )
const
2181 m_fields.emplace_back(
this, aFieldType );
2210 if( !field.IsVisible() || field.GetText().IsEmpty() )
2214 aVector.push_back(
const_cast<SCH_FIELD*
>( &field ) );
2217 std::sort( aVector.begin(), aVector.end(),
2220 return lhs->GetOrdinal() < rhs->GetOrdinal();
2241 wxString fieldName = aFieldName;
2243 for(
unsigned ii = 0; ii <
m_fields.size(); ++ii )
2248 if( fieldName ==
m_fields[ii].GetName(
false ) )
2254 for(
auto& variant : instance.m_Variants )
2255 variant.second.m_Fields.erase( fieldName );
2268 if( field.GetName().IsSameAs( aFieldName,
false ) )
2280 if( field.GetName().IsSameAs( aFieldName,
false ) )
2289 bool aResetRef,
bool aResetOtherFields )
2293 std::vector<SCH_FIELD*> fields;
2294 m_part->GetFields( fields );
2296 for(
const SCH_FIELD* libField : fields )
2301 if( libField->IsMandatory() )
2303 fieldType = libField->GetId();
2308 schField =
GetField( libField->GetUntranslatedName() );
2318 schField->
SetPrivate( libField->IsPrivate() );
2330 else if( aUpdateRef )
2331 SetRef( aPath, libField->GetText() );
2339 if( aResetOtherFields )
2341 else if( aUpdateOtherFields )
2342 schField->
SetText( libField->GetText() );
2346 if( aResetOtherFields || aUpdateOtherFields )
2347 schField->
SetText( libField->GetText() );
2357 bool updateValue =
true;
2358 bool updateExclFromBOM =
true;
2359 bool updateExclFromBoard =
true;
2360 bool updateExclFromPosFiles =
true;
2361 bool updateDNP =
true;
2362 bool updateOtherFields =
true;
2363 bool updatePins =
true;
2364 bool updatePinMapOverride =
true;
2368 updateValue = aProperty->
Name() ==
_HKI(
"Value" );
2369 updateExclFromBoard = aProperty->
Name() ==
_HKI(
"Exclude From Board" );
2370 updateExclFromBOM = aProperty->
Name() ==
_HKI(
"Exclude From Bill of Materials" );
2371 updateExclFromPosFiles = aProperty->
Name() ==
_HKI(
"Exclude From Position Files" );
2372 updateDNP = aProperty->
Name() ==
_HKI(
"Do not Populate" );
2373 updatePinMapOverride = aProperty->
Name() == wxS(
"Pin Map Mode" ) || aProperty->
Name() == wxS(
"Pin Map Name" );
2374 updateOtherFields =
false;
2378 if( !updateValue && !updateExclFromBOM && !updateExclFromBoard && !updateExclFromPosFiles && !updateDNP
2379 && !updateOtherFields && !updatePins && !updatePinMapOverride )
2388 wxString ref =
GetRef( &aSourceSheet );
2393 std::vector<SCH_SYMBOL*> otherUnits;
2399 aCommit.
Modify( otherUnit, screen );
2405 &sheet, aVariantName );
2408 if( updateOtherFields )
2420 if( field.IsMandatory() )
2421 otherField = otherUnit->GetField( field.GetId() );
2423 otherField = otherUnit->GetField( field.GetName() );
2427 otherField->
SetText( field.GetText( &aSourceSheet, aVariantName ), &sheet, aVariantName );
2435 newField.
Offset( otherUnit->GetPosition() );
2438 SCH_FIELD* addedField = otherUnit->AddField( newField );
2440 if( !aVariantName.IsEmpty() )
2442 addedField->
SetText( field.GetText( &aSourceSheet, aVariantName ), &sheet,
2448 for(
int ii = (
int) otherUnit->GetFields().size() - 1; ii >= 0; ii-- )
2450 SCH_FIELD& otherField = otherUnit->GetFields()[ii];
2453 otherUnit->RemoveField( otherField.
GetName() );
2457 if( updateExclFromBOM )
2459 otherUnit->SetExcludedFromBOM(
GetExcludedFromBOM( &aSourceSheet, aVariantName ), &sheet,
2463 if( updateExclFromBoard )
2469 if( updateExclFromPosFiles )
2476 otherUnit->SetDNP(
GetDNP( &aSourceSheet, aVariantName ), &sheet, aVariantName );
2478 if( updatePinMapOverride )
2479 otherUnit->SetPinMapOverride(
GetPinMapOverride( &aSourceSheet, aVariantName ), &sheet,
2484 for(
const std::unique_ptr<SCH_PIN>& model_pin :
m_pins )
2486 for(
SCH_PIN* src_pin : otherUnit->GetPinsByNumber( model_pin->GetNumber() ) )
2487 src_pin->SetAlt( model_pin->GetAlt() );
2498 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2499 aFunction(
pin.get() );
2502 aFunction( &field );
2515 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2517 if(
pin->GetNumber() == aNumber )
2526 const wxString& aVariantName )
const
2531 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2535 if(
pad == aPadNumber )
2546 std::vector<SCH_PIN*> pins;
2548 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2550 if(
pin->GetNumber() == aNumber )
2551 pins.push_back(
pin.get() );
2560 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2562 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
2563 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
2565 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2568 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2571 if(
pin->GetPosition() == aPos )
2584 return std::vector<SCH_PIN*>();
2591 return m_part->GetPins();
2593 return std::vector<SCH_PIN*>();
2605 auto it =
m_pinMap.find( aLibPin );
2610 wxFAIL_MSG_AT(
"Pin not found", __FILE__, __LINE__, __FUNCTION__ );
2617 std::vector<const SCH_PIN*> pins;
2626 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2628 if( unit &&
pin->GetUnit() &&
pin->GetUnit() != unit )
2631 pins.push_back(
pin.get() );
2640 std::vector<SCH_PIN*> pins;
2649 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2651 if( unit &&
pin->GetUnit() &&
pin->GetUnit() != unit )
2654 pins.push_back(
pin.get() );
2670 wxCHECK_RET( aItem !=
nullptr && aItem->
Type() ==
SCH_SYMBOL_T, wxT(
"Cannot swap data with invalid symbol." ) );
2678 for( std::unique_ptr<SCH_PIN>&
pin : symbol->
m_pins )
2679 pin->SetParent( symbol );
2681 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2682 pin->SetParent(
this );
2687 m_part.reset( libSymbol );
2726 if( field.IsPrivate() )
2729 if( field.IsMandatory() )
2730 aVars->push_back( field.GetUntranslatedName().Upper() );
2732 aVars->push_back( field.GetName() );
2735 aVars->push_back( wxT(
"OP" ) );
2736 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
2737 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
2738 aVars->push_back( wxT(
"UNIT" ) );
2739 aVars->push_back( wxT(
"SHORT_REFERENCE" ) );
2740 aVars->push_back( wxT(
"SYMBOL_LIBRARY" ) );
2741 aVars->push_back( wxT(
"SYMBOL_NAME" ) );
2742 aVars->push_back( wxT(
"SYMBOL_DESCRIPTION" ) );
2743 aVars->push_back( wxT(
"SYMBOL_KEYWORDS" ) );
2744 aVars->push_back( wxT(
"SYMBOL_IS_POWER" ) );
2745 aVars->push_back( wxT(
"SYMBOL_IS_LOCAL_POWER" ) );
2746 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
2747 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
2748 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
2749 aVars->push_back( wxT(
"DNP" ) );
2750 aVars->push_back( wxT(
"SHORT_NET_NAME(<pin_number>)" ) );
2751 aVars->push_back( wxT(
"NET_NAME(<pin_number>)" ) );
2752 aVars->push_back( wxT(
"NET_CLASS(<pin_number>)" ) );
2753 aVars->push_back( wxT(
"PIN_NAME(<pin_number>)" ) );
2754 aVars->push_back( wxT(
"REFERENCE(<pin_number>)" ) );
2755 aVars->push_back( wxT(
"SHORT_REFERENCE(<pin_number>)" ) );
2756 aVars->push_back( wxT(
"UNIT(<pin_number>)" ) );
2772 const wxString& aVariantName,
int aDepth )
const
2776 thread_local wxRegEx operatingPoint( wxT(
"^"
2791 wxString variant = aVariantName;
2793 if( operatingPoint.Matches( *token ) )
2795 wxString
pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
2796 wxString precisionStr( operatingPoint.GetMatch( *token, 3 ) );
2797 wxString rangeStr( operatingPoint.GetMatch( *token, 4 ) );
2799 int precision = precisionStr.IsEmpty() ? 3 : precisionStr[0] -
'0';
2800 wxString range = rangeStr.IsEmpty() ? wxString( wxS(
"~A" ) ) : rangeStr;
2804 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
2805 embeddedFilesStack.push_back(
schematic->GetEmbeddedFiles() );
2808 embeddedFilesStack.push_back(
m_part->GetEmbeddedFiles() );
2814 aVariantName, devnull ).model;
2818 wxString spiceRef =
model.SpiceGenerator().ItemName( spiceItem );
2819 spiceRef = spiceRef.Lower();
2823 *token =
schematic->GetOperatingPoint( spiceRef, precision, range );
2826 else if(
pin == wxS(
":power" ) )
2828 if( rangeStr.IsEmpty() )
2829 range = wxS(
"~W" );
2831 *token =
schematic->GetOperatingPoint( spiceRef + wxS(
":power" ), precision, range );
2836 pin =
pin.SubString( 1, -1 );
2838 for(
const std::reference_wrapper<const SIM_MODEL_PIN>& modelPin :
model.GetPins() )
2840 SCH_PIN* symbolPin =
GetPin( modelPin.get().symbolPinNumber );
2847 if(
model.GetPins().size() == 2 )
2849 *token =
schematic->GetOperatingPoint( spiceRef, precision, range );
2853 wxString netChainName = spiceRef + wxS(
":" ) + modelPin.get().modelPinName;
2854 *token =
schematic->GetOperatingPoint( netChainName, precision, range );
2862 *token = wxS(
"?" );
2866 if( token->Contains(
':' ) )
2868 if(
schematic->ResolveCrossReference( token, aDepth + 1 ) )
2874 wxString fieldName = field.IsMandatory() ? field.GetUntranslatedName() : field.GetName();
2876 wxString textToken = field.GetText();
2877 textToken.Replace(
" ", wxEmptyString );
2878 wxString tokenString =
"${" + fieldName +
"}";
2881 if( textToken.IsSameAs( tokenString,
false ) )
2884 if( token->IsSameAs( fieldName,
false ) )
2888 *token =
GetRef( aPath,
true );
2892 *token = field.GetShownText( aPath,
INTERNAL, aVariantName, aDepth + 1 );
2900 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) ) || token->IsSameAs( wxT(
"SIM.TYPE" ) )
2901 || token->IsSameAs( wxT(
"SIM.PINS" ) ) || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
2902 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) ) || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
2904 *token = wxEmptyString;
2909 schematic->Project().GetProjectFile().m_TemplateFieldNames.GetResolvedTemplateFieldNames() )
2911 if( token->IsSameAs( templateFieldname.m_Name ) || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
2915 *token = wxEmptyString;
2920 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
2924 wxArrayString parts = wxSplit( footprint,
':' );
2926 if( parts.Count() > 0 )
2929 *token = wxEmptyString;
2933 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
2937 wxArrayString parts = wxSplit( footprint,
':' );
2939 if( parts.Count() > 1 )
2940 *token = parts[std::min( 1, (
int) parts.size() - 1 )];
2942 *token = wxEmptyString;
2946 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
2951 else if( token->IsSameAs( wxT(
"SHORT_REFERENCE" ) ) )
2953 *token =
GetRef( aPath,
false );
2956 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
2958 *token =
m_lib_id.GetUniStringLibNickname();
2961 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
2963 *token =
m_lib_id.GetUniStringLibItemName();
2966 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
2971 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
2976 else if( token->IsSameAs( wxT(
"SYMBOL_IS_POWER" ) ) )
2978 *token = this->
IsPower() ? wxString( wxS(
"Power Symbol" ) ) : wxString(
"" );
2981 else if( token->IsSameAs( wxT(
"SYMBOL_IS_LOCAL_POWER" ) ) )
2983 *token = this->
IsLocalPower() ? wxString( wxS(
"Local Power Symbol" ) ) : wxString(
"" );
2986 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
2988 *token = wxEmptyString;
2990 if( aPath->
GetExcludedFromBOM( variant ) || this->ResolveExcludedFromBOM( aPath, variant ) )
2991 *token = wxS(
"Excluded from BOM" );
2995 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
2997 *token = wxEmptyString;
2999 if( aPath->
GetExcludedFromBoard( variant ) || this->ResolveExcludedFromBoard( aPath, variant ) )
3000 *token = wxS(
"Excluded from board" );
3004 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
3006 *token = wxEmptyString;
3008 if( aPath->
GetExcludedFromSim( variant ) || this->ResolveExcludedFromSim( aPath, variant ) )
3009 *token = wxS(
"Excluded from simulation" );
3013 else if( token->IsSameAs( wxT(
"DNP" ) ) )
3015 *token = wxEmptyString;
3017 if( aPath->
GetDNP( variant ) || this->ResolveDNP( aPath, variant ) )
3018 *token = wxS(
"DNP" );
3022 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) ) || token->StartsWith( wxT(
"NET_NAME(" ) )
3023 || token->StartsWith( wxT(
"NET_CLASS(" ) ) || token->StartsWith( wxT(
"PIN_NAME(" ) )
3024 || token->StartsWith( wxT(
"PIN_BASE_NAME(" ) ) || token->StartsWith( wxT(
"PIN_ALT_LIST(" ) )
3025 || token->StartsWith( wxT(
"REFERENCE(" ) ) || token->StartsWith( wxT(
"SHORT_REFERENCE(" ) )
3026 || token->StartsWith( wxT(
"UNIT(" ) ) )
3028 wxString pinNumber = token->AfterFirst(
'(' );
3029 pinNumber = pinNumber.BeforeLast(
')' );
3033 const bool local = token->StartsWith( wxS(
"SHORT_NET_NAME" ) );
3034 const auto name =
pin.GetConnectionName( &
path, local );
3043 *token =
name->Lower().StartsWith( wxS(
"unconnected" ) ) ? wxString(
"NC" ) : *
name;
3044 else if( token->StartsWith( wxS(
"NET_NAME" ) ) )
3046 else if( token->StartsWith( wxS(
"NET_CLASS" ) ) )
3047 *token =
pin.GetEffectiveNetClass( &
path )->GetName();
3050 bool isReferenceFunction = token->StartsWith( wxT(
"REFERENCE(" ) );
3051 bool isShortReferenceFunction = token->StartsWith( wxT(
"SHORT_REFERENCE(" ) );
3052 bool isUnitFunction = token->StartsWith( wxT(
"UNIT(" ) );
3056 std::vector<const SCH_PIN*> pinsToSearch;
3057 std::vector<const SCH_PIN*> altPinsToSearch;
3059 if( isReferenceFunction || isShortReferenceFunction || isUnitFunction )
3062 pinsToSearch.push_back(
pin );
3067 pinsToSearch.push_back(
pin );
3070 altPinsToSearch.push_back(
pin );
3075 if(
pin->GetNumber() == pinNumber )
3077 if( isReferenceFunction || isShortReferenceFunction || isUnitFunction )
3079 int pinUnit =
pin->GetUnit();
3082 if( isReferenceFunction )
3090 else if( isShortReferenceFunction )
3095 else if( isUnitFunction )
3104 *token = std::move(
result );
3107 else if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
3109 *token =
pin->GetAlt().IsEmpty() ?
pin->GetName() :
pin->GetAlt();
3112 else if( token->StartsWith( wxT(
"PIN_BASE_NAME" ) ) )
3114 *token =
pin->GetBaseName();
3117 else if( token->StartsWith( wxT(
"PIN_ALT_LIST" ) ) )
3122 const std::map<wxString, SCH_PIN::ALT>& alts =
pin->GetAlternates();
3124 for(
const auto& [altName, altDef] : alts )
3126 if( !altList.IsEmpty() )
3127 altList += wxT(
", " );
3132 *token = std::move( altList );
3136 resolvePinConnection( *
pin, *aPath );
3145 if(
pin->GetNumber() == pinNumber )
3148 if( token->StartsWith( wxT(
"PIN_BASE_NAME" ) ) )
3150 *token =
pin->GetBaseName();
3153 else if( token->StartsWith( wxT(
"PIN_ALT_LIST" ) ) )
3158 const std::map<wxString, SCH_PIN::ALT>& alts =
pin->GetAlternates();
3160 for(
const auto& [altName, altDef] : alts )
3162 if( !altList.IsEmpty() )
3163 altList += wxT(
", " );
3172 int pinUnit =
pin->GetUnit();
3188 if( symbol->
GetRef( &sheetPath,
false ) ==
GetRef( aPath,
false )
3191 targetPath = sheetPath;
3192 targetSymbol = symbol;
3205 *token = wxString::Format( wxT(
"<Unit %s not placed>" ),
SubReference( pinUnit,
false ) );
3211 SCH_PIN* instancePin =
nullptr;
3215 if( candidate->GetNumber() == pinNumber )
3217 instancePin = candidate;
3224 *token = wxEmptyString;
3229 if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
3231 *token = instancePin->
GetAlt().IsEmpty() ? instancePin->
GetName() : instancePin->
GetAlt();
3235 resolvePinConnection( *instancePin, targetPath );
3242 *token = wxString::Format( wxT(
"<Unresolved: pin %s>" ), pinNumber );
3246 else if( token->StartsWith( wxS(
"PROPERTY." ) ) )
3249 wxString propertyName = token->AfterFirst(
'.' );
3250 propertyName.Replace( wxS(
"_" ), wxS(
" " ) );
3260 if( propertyName.CmpNoCase( candidate->Name() ) == 0 )
3262 property = candidate;
3268 if( !property || property->IsHiddenFromPropertiesManager() )
3276 const wxString&
name =
property->Name();
3278 if(
name == wxS(
"Reference" ) )
3279 sourceValue =
GetRef( aPath );
3280 else if(
name == wxS(
"Value" ) )
3282 else if(
name == wxS(
"Unit" ) )
3284 else if(
name == wxS(
"Exclude From Simulation" ) )
3286 else if(
name == wxS(
"Exclude From Bill of Materials" ) )
3288 else if(
name == wxS(
"Exclude From Board" ) )
3290 else if(
name == wxS(
"Exclude From Position Files" ) )
3292 else if(
name == wxS(
"Do not Populate" ) )
3293 sourceValue =
GetDNP( aPath, variant );
3295 sourceValue = instanceProperty->ValueForInstance(
this, aPath, variant );
3297 sourceValue =
Get( property );
3324 if( instance.m_Path ==
path )
3326 if( instance.m_Reference.IsEmpty() || aResetPrefix )
3337 if( instance.m_Reference.IsEmpty() || aResetPrefix )
3344 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3345 pin->ClearDefaultNetName( aSheetPath );
3355 if( currentReference.IsEmpty() || aResetPrefix )
3366 wxCHECK( aSheetPath.size() > 0,
false );
3371 if( instance.m_Path == aSheetPath )
3396 bool transform =
false;
3398 switch( aOrientation )
3519 wxFAIL_MSG(
"Invalid schematic symbol orientation type." );
3573 for(
int type_rotate : rotate_values )
3585 wxFAIL_MSG(
"Schematic symbol orientation matrix internal error." );
3593void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const
3596 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str() <<
" ref=\""
3602 for(
int i = 1; i < (int)
GetFields().size(); ++i )
3604 const wxString& value =
GetFields()[i].GetText();
3606 if( !value.IsEmpty() )
3608 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\"" <<
TO_UTF8(
GetFields()[i].GetName() ) <<
'"'
3609 <<
" value=\"" <<
TO_UTF8( value ) <<
"\"/>\n";
3613 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
3635 if( aIncludeFields )
3639 if( field.IsVisible() )
3640 bBox.
Merge( field.GetBoundingBox() );
3654 catch(
const boost::bad_pointer& e )
3656 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ), e.what() ) );
3682 auto addExcludes = [&]()
3687 msgs.Add(
_(
"Simulation" ) );
3690 msgs.Add(
_(
"BOM" ) );
3693 msgs.Add(
_(
"Board" ) );
3695 if(
GetDNP( currentSheet, currentVariant ) )
3696 msgs.Add(
_(
"DNP" ) );
3698 msg = wxJoin( msgs,
'|' );
3699 msg.Replace(
'|', wxS(
", " ) );
3702 aList.emplace_back(
_(
"Exclude from" ), msg );
3713 aList.emplace_back(
_(
"Power symbol" ),
3721 aList.emplace_back(
_(
"Value" ),
3728 aList.emplace_back(
_(
"flags" ), wxString::Format(
"%X",
GetEditFlags() ) );
3733 msg =
_(
"Missing parent" );
3735 std::shared_ptr<LIB_SYMBOL> parent =
m_part->GetParent().lock();
3738 msg = parent->GetName();
3742 else if( !
m_lib_id.GetLibNickname().empty() )
3744 aList.emplace_back(
_(
"Library" ),
m_lib_id.GetLibNickname() );
3748 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
3756 msg =
_(
"<Unknown>" );
3758 aList.emplace_back(
_(
"Footprint" ), msg );
3762 _(
"Keywords" ) + wxT(
": " ) +
m_part->GetKeyWords() );
3767 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
3776 if( libNickname.empty() )
3777 msg =
_(
"No library defined!" );
3779 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
3781 aList.emplace_back(
_(
"Library" ), msg );
3816 field.SetTextPos( pos );
3834 field.SetTextPos( pos );
3853 field.SetTextPos( pos );
3880 if( drawItem.Matches( aSearchData, aAuxData ) )
3891 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3899 aItemList.push_back( item );
3905 std::vector<DANGLING_END_ITEM>& aItemListByPos,
const SCH_SHEET_PATH* aPath )
3907 bool changed =
false;
3909 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3911 bool previousState =
pin->IsDangling();
3912 pin->SetIsDangling(
true );
3917 bool do_break =
false;
3919 for(
auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
3938 pin->SetIsDangling(
false );
3949 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
3974 wxCHECK( symbol,
false );
3980 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
3982 if(
pin->IsDangling() )
3998 if(
GetRef( aInstance ) != symbol->
GetRef( aInstance ) )
4008 for(
size_t i = 0; i <
m_pins.size(); i++ )
4020 std::vector<VECTOR2I> retval;
4022 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4026 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
4027 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
4029 if( pin_unit > 0 && pin_unit !=
GetUnit() )
4032 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
4058 return wxString::Format(
_(
"Symbol %s [%s]" ),
4066 for(
KICAD_T scanType : aScanTypes )
4111 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4115 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
4116 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
4118 if( pin_unit > 0 && pin_unit !=
GetUnit() )
4121 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
4158 std::vector<SCH_FIELD*> fields, otherFields;
4161 aSymbol.
GetFields( otherFields,
false );
4163 if( fields.size() != otherFields.size() )
4166 for(
int ii = 0; ii < (int) fields.size(); ii++ )
4171 if( fields[ii]->GetText().Cmp( otherFields[ii]->GetText() ) != 0 )
4181 return !( *
this == aSymbol );
4187 wxCHECK_MSG(
Type() == aSymbol.
Type(), *
this,
4188 wxT(
"Cannot assign object type " ) + aSymbol.
GetClass() + wxT(
" to type " ) +
GetClass() );
4190 if( &aSymbol !=
this )
4197 auto oldPart = std::exchange(
m_part, aSymbol.
m_part ? std::make_unique<LIB_SYMBOL>( *aSymbol.
m_part )
4213 field.SetParent(
this );
4226 bBox.
Inflate( aAccuracy / 2 );
4242 rect.
Inflate( aAccuracy / 2 );
4264 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4277 if(
pin->GetLocalPosition() == new_pos )
4292 const VECTOR2I& aOffset,
bool aDimmed )
4302 bool usingAlternate = ( effectiveSym !=
m_part.get() );
4309 std::vector<SCH_PIN*> symbolPins =
MapLibPins( libPins, usingAlternate );
4312 for(
unsigned i = 0; i < tempPins.size(); ++i )
4314 SCH_PIN* symbolPin = symbolPins[i];
4315 SCH_PIN* tempPin = tempPins[i];
4345 bool dnp =
GetDNP( sheet, variant );
4347 for(
bool local_background : {
true,
false } )
4353 field.ClearRenderCache();
4357 && ( field.IsVisible() || field.IsForceVisible() ) )
4370 std::vector<wxString> properties;
4374 wxString text_field = field.GetShownText( sheet,
FOR_GUI, variant );
4376 if( text_field.IsEmpty() )
4379 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ), field.GetName(), text_field ) );
4384 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
4395 if( !effectiveSym->
IsPower() )
4409 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
4410 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
4428 double lineWidth = aSize / 10.0;
4430 std::vector<SCH_SHAPE> shapeList;
4432 int tolerance = 100;
4434 for(
const SCH_SHAPE& shape : shapeList )
4441 aPlotter->
BezierCurve( shape.GetStart(), shape.GetBezierC1(), shape.GetBezierC2(), shape.GetEnd(),
4442 tolerance, lineWidth );
4446 aPlotter->
Circle( shape.getCenter(), shape.GetRadius() * 2, filled, lineWidth );
4497 bool usingAlternate = ( effectiveSym !=
m_part.get() );
4508 std::vector<SCH_PIN*> symbolPins =
MapLibPins( libPins, usingAlternate );
4512 for(
unsigned i = 0; i < tempPins.size(); ++i )
4514 SCH_PIN* symbolPin = symbolPins[i];
4515 SCH_PIN* tempPin = tempPins[i];
4533 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4535 if(
pin->IsBrightened() )
4545 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4546 pin->ClearBrightened();
4564 m_part->SetShowPinNames( aShow );
4577 m_part->SetShowPinNumbers( aShow );
4583 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
4585 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit() :
GetUnit();
4586 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle() :
GetBodyStyle();
4588 if( pin_unit > 0 && pin_unit !=
GetUnit() )
4591 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
4594 if(
pin->IsPointClickableAnchor( aPos ) )
4613 if( pin_list.size() != 1 )
4631 if( pin_list.size() != 1 )
4643 return m_part->IsLocalPower();
4652 return m_part->IsGlobalPower();
4664 wxCHECK(
m_part,
false );
4666 return m_part->IsNormal();
4672 std::unordered_set<wxString> componentClass;
4674 auto getComponentClassFields = [&](
const std::vector<SCH_FIELD>& fields )
4678 if( field.GetUntranslatedName() == wxT(
"Component Class" ) )
4680 if( field.GetShownText( aPath,
INTERNAL ) != wxEmptyString )
4681 componentClass.insert( field.GetShownText( aPath,
INTERNAL ) );
4687 getComponentClassFields(
m_fields );
4694 getComponentClassFields( label->GetFields() );
4698 return componentClass;
4703 const wxString& aVariantName )
const
4708 return std::nullopt;
4710 return instance.
m_Variants.find( aVariantName )->second;
4722 instance->
m_Variants.insert( std::make_pair( aVariant.
m_Name, aVariant ) );
4729 if( aVariantName.IsEmpty() )
4734 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
4743 wxString libIdStr = libId.
Format();
4752 return cacheIt->second.get();
4776 cached = libSymbol->Flatten();
4784 return cached.get();
4802 if( !variantName.IsEmpty() )
4816 bool aByNumber )
const
4818 std::vector<SCH_PIN*> mapped;
4820 mapped.reserve( aLibPins.size() );
4828 mapped.resize( aLibPins.size(),
nullptr );
4833 std::vector<bool> matched( basePins.size(),
false );
4835 for(
const SCH_PIN* alternatePin : aLibPins )
4837 SCH_PIN* instancePin =
nullptr;
4839 for(
size_t i = 0; i < basePins.size(); ++i )
4845 instancePin =
GetPin(
const_cast<SCH_PIN*
>( basePins[i] ) );
4849 mapped.push_back( instancePin );
4854 for(
const SCH_PIN* libPin : aLibPins )
4855 mapped.push_back(
GetPin(
const_cast<SCH_PIN*
>( libPin ) ) );
4867 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
4875 const wxString& aFieldName )
4879 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
4882 instance->
m_Variants[aVariantName].m_Fields.erase( aFieldName );
4887 const wxString& aNewName )
4892 if( !instance || !instance->
m_Variants.contains( aOldName ) )
4897 variant.
m_Name = aNewName;
4899 instance->
m_Variants.insert( std::make_pair( aNewName, variant ) );
4904 const wxString& aNewVariant )
4909 if( !instance || !instance->
m_Variants.contains( aSourceVariant ) )
4914 variant.
m_Name = aNewVariant;
4915 instance->
m_Variants.insert( std::make_pair( aNewVariant, variant ) );
4920 const wxString& aVariantName,
4928 if( !instance->
m_Variants.contains( aVariantName ) )
4932 instance->
m_Variants.insert( std::make_pair( aVariantName, newVariant ) );
4935 instance->
m_Variants[aVariantName].m_SymbolOverride = aLibId;
4941 const wxString& aVariantName )
4945 if( !instance || !instance->
m_Variants.contains( aVariantName ) )
5005 for(
unsigned i = 0; i <
m_pins.size(); ++i )
5014 if( m_instanceReferences != symbol.m_instanceReferences )
5040 double aLineWidth,
bool aHorizontal )
5044 double x_right = aSize / 1.6180339887;
5045 double x_middle = x_right / 2.0;
5058 aShapeList.back().SetStart( bottomPt );
5059 aShapeList.back().SetBezierC1( bottomAnchorPt );
5060 aShapeList.back().SetBezierC2( leftSideAnchorPt1 );
5061 aShapeList.back().SetEnd( leftPt );
5065 aShapeList.back().SetStart( leftPt );
5066 aShapeList.back().SetBezierC1( leftSideAnchorPt2 );
5067 aShapeList.back().SetBezierC2( rightSideAnchorPt2 );
5068 aShapeList.back().SetEnd( rightPt );
5071 aShapeList.back().SetStart( rightPt );
5072 aShapeList.back().SetBezierC1( rightSideAnchorPt1 );
5073 aShapeList.back().SetBezierC2( bottomAnchorPt );
5074 aShapeList.back().SetEnd( bottomPt );
5077 aShapeList.back().SetCenter( ( leftPt + rightPt ) / 2.0 );
5078 aShapeList.back().SetRadius( aSize / 15.0 );
5083 shape.Rotate(
VECTOR2I( 0, 0 ),
true );
5142 return symbol->GetLibSymbolRef() !=
nullptr;
5155 const wxString groupFields =
_HKI(
"Fields" );
5177 return symbol->IsMultiUnit();
5182 auto multiBodyStyle =
5186 return symbol->IsMultiBodyStyle();
5197 wxPGChoices choices;
5201 for(
int ii = 1; ii <= symbol->GetUnitCount(); ii++ )
5202 choices.Add( symbol->GetUnitDisplayName( ii,
false ), ii );
5214 wxPGChoices choices;
5218 for(
int ii = 1; ii <= symbol->GetBodyStyleCount(); ii++ )
5219 choices.Add( symbol->GetBodyStyleDescription( ii,
false ) );
5225 const wxString groupAttributes =
_HKI(
"Attributes" );
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
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)
std::vector< PROPERTY_BASE * > GetCustomPropertiesAsInspectables() const
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 void SetTextPos(const VECTOR2I &aPoint)
virtual void Offset(const VECTOR2I &aOffset)
virtual EDA_ANGLE GetTextAngle() const
static ENUM_MAP< T > & Instance()
A text control validator used for validating the text allowed in fields.
Class that other classes need to inherit from, in order to be inspectable.
wxAny Get(PROPERTY_BASE *aProperty) const
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
A typed sum value used to carry the before/after of any single property.
wxString ToDisplayString() const
Human-readable representation with no unit context.
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.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
wxString GetKeyWords() const override
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 IsPower() const override
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.
SCH_FIELD * GetField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName; return nullptr if not found.
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
wxString GetShownKeyWords(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
bool Deserialize(const kiapi::schematic::types::SchematicSymbol &aInput)
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 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...
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
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.
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
< Used to generate unique IDs. Must come up front so it's initialized before ctor.
PROPERTY_BASE & SetGroup(const wxString &aGroup)
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.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
bool IsAvailableFor(TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem)
Checks overriden availability and original availability of a property, returns false if the property ...
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Holds all the data relating to one schematic.
wxString GetCurrentVariant() const
Return the current variant being edited.
SCH_SHEET_PATH & CurrentSheet() 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 GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetText(const wxString &aText) override
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SetLocked(bool aLocked) override
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
bool IsLocked() const override
virtual void ClearCaches()
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
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)
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
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.
size_t BaseHash() const override
Return type-id of the Base class.
size_t OwnerHash() const override
Return type-id of the Owner class.
size_t TypeHash() const override
Return type-id of the property type.
SCH_SYMBOL_FIELD_PROPERTY(const wxString &aName)
void setter(void *obj, wxAny &v) override
wxAny ValueForInstance(const SCH_SYMBOL *symbol, const SCH_SHEET_PATH *sheetPath, const wxString &variantName) const override
wxAny getter(const void *aObject) const final
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
< Used to generate unique IDs. Must come up front so it's initialized before ctor.
virtual wxAny ValueForInstance(const SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH *aPath, const wxString &aVariant) const =0
size_t TypeHash() const override
Return type-id of the property type.
size_t BaseHash() const override
Return type-id of the Base class.
SCH_SYMBOL_PIN_MAP_ENTRY_PROPERTY(const wxString &aName, const wxString &aPinNumber)
bool Writeable(INSPECTABLE *aObject) const override
wxAny ValueForInstance(const SCH_SYMBOL *symbol, const SCH_SHEET_PATH *sheetPath, const wxString &variantName) const override
size_t OwnerHash() const override
Return type-id of the Owner class.
void setter(void *obj, wxAny &v) override
wxAny ValueForInstance(const SCH_SYMBOL *symbol, const SCH_SHEET_PATH *sheetPath, const wxString &variantName) const override
SCH_SYMBOL_PIN_MAP_MODE_PROPERTY()
void setter(void *obj, wxAny &v) override
size_t TypeHash() const override
Return type-id of the property type.
size_t OwnerHash() const override
Return type-id of the Owner class.
static wxPGChoices BuildChoices()
size_t BaseHash() const override
Return type-id of the Base class.
SCH_SYMBOL_PIN_MAP_NAME_PROPERTY()
size_t TypeHash() const override
Return type-id of the property type.
static wxPGChoices BuildChoices(const SCH_SYMBOL *aSymbol)
static std::vector< wxString > MapNames(const SCH_SYMBOL *aSymbol)
size_t OwnerHash() const override
Return type-id of the Owner class.
void setter(void *obj, wxAny &v) override
wxAny ValueForInstance(const SCH_SYMBOL *symbol, const SCH_SHEET_PATH *sheetPath, const wxString &variantName) const override
size_t BaseHash() const override
Return type-id of the Base class.
Variant information for a schematic symbol.
PIN_MAP_INSTANCE_OVERRIDE m_PinMapOverride
Per-instance pin-to-pad map override for this variant (issue #2282).
std::optional< LIB_ID > m_SymbolOverride
Alternate library symbol to substitute for the base symbol in this variant, if any.
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
PASSTHROUGH_MODE GetPassthroughMode() 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
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
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 SetPosition(const VECTOR2I &aPosition) override
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.
bool ClearVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
Remove the alternate-symbol override for a given variant and sheet instance.
SYMBOL_ORIENTATION_PROP GetOrientationProp() const
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_variantSymbolCache
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
void SetVariantSymbolOverride(const SCH_SHEET_PATH &aPath, const wxString &aVariantName, const LIB_ID &aLibId)
Set the alternate-symbol override for a given variant and sheet instance.
bool UseLibIdLookup() const
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
bool SetInstanceProjectName(const KIID_PATH &aSheetPath, const wxString &aProjectName)
Set the owning project of the instance stored for aSheetPath.
wxString GetSchSymbolLibraryName() const
void ClearCaches() override
const wxString GetFootprintFieldText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const
PASSTHROUGH_MODE m_passthroughMode
std::optional< SCH_SYMBOL_VARIANT > GetVariant(const SCH_SHEET_PATH &aInstance, const wxString &aVariantName) const
PIN_MAP_INSTANCE_OVERRIDE GetPinMapOverride(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) 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
void SetPinMapOverride(const PIN_MAP_INSTANCE_OVERRIDE &aOverride, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
Set the per-instance pin-to-pad map override (issue #2282).
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.
wxString GetShownKeyWords(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void SetExcludedFromBOMProp(bool aEnable)
void ClearVariantField(const KIID_PATH &aPath, const wxString &aVariantName, const wxString &aFieldName)
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.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
SCH_PIN * GetPinByEffectivePadNumber(const wxString &aPadNumber, const SCH_SHEET_PATH *aSheet, const wxString &aVariantName=wxEmptyString) const
Find the pin whose effective footprint pad number (issue #2282) is aPadNumber on aSheet,...
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
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.
wxString GetShownDescription(RESOLUTION_CONTEXT aContext, int aDepth=0) const override
std::unordered_map< KIID_PATH, size_t > m_instancePathIndex
Index from an instance's sheet path to its position in m_instances for O(1) lookups.
std::vector< SCH_PIN * > MapLibPins(const std::vector< const SCH_PIN * > &aLibPins, bool aByNumber) const
Map pins of an effective library symbol to this symbol's instance pins.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
VECTOR2I GetPosition() const override
PIN_MAP_INSTANCE_OVERRIDE resolveDelegatedPinMapOverride(const SCH_SHEET_PATH &aSheet, const wxString &aVariantName) const
Return unit 1's pin-map override for a unit that delegates to it (issue #2282).
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 rebuildInstancePathIndex()
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)
const LIB_SYMBOL * GetEffectiveLibSymbol(const SCH_SHEET_PATH *aPath=nullptr) const
Return the library symbol to use for rendering and bounding box calculations.
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.
LIB_SYMBOL * GetVariantLibSymbol(const wxString &aVariantName, const SCH_SHEET_PATH &aPath) const
Resolve the alternate library symbol for a given variant.
void SetValueProp(const wxString &aValue)
void SetUnitProp(int aUnit)
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_dynamicPropertyCache
Per-object cache of dynamic property descriptors for custom fields and effective pin-map entries,...
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< PROPERTY_BASE * > GetDynamicProperties() const override
Return dynamically-computed properties specific to this object instance (e.g.
void SetPassthroughMode(PASSTHROUGH_MODE aMode)
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
const wxString GetValue(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString) const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
PIN_MAP_INSTANCE_OVERRIDE m_pinMapOverride
Base (no-variant) pin-to-pad map override applied when no variant override exists for the sheet path ...
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 HasEffectiveAssociatedFootprint() const
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, std::span< const wxString > aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
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
int GetPinNameOffset() const
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
virtual bool GetShowPinNames() const
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
SYMBOL & operator=(const SYMBOL &aItem)
virtual bool GetShowPinNumbers() const
TRANSFORM m_transform
The rotation/mirror transformation.
std::map< wxString, wxString > m_Fields
bool m_ExcludedFromPosFiles
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, RESOLUTION_CONTEXT aContext)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
static bool empty(const wxTextEntryBase *aCtrl)
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_270
@ FILLED_SHAPE
Fill with object color.
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
static FILENAME_RESOLVER * resolver
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.
DIFF_VALUE WxAnyToDiffValue(const wxAny &aValue, PROPERTY_BASE *aProperty)
Convert a wxAny value read from a PROPERTY_BASE getter into a DIFF_VALUE that the engine can store,...
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.
KICOMMON_API int UnpackDistance(const types::Distance &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API std::optional< KICAD_T > TypeNameFromAny(const google::protobuf::Any &aMessage)
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackDistance(types::Distance &aOutput, int aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackLibId(types::LibraryIdentifier *aOutput, const LIB_ID &aId)
KICOMMON_API LIB_ID UnpackLibId(const types::LibraryIdentifier &aId)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
PIN_MAP_OVERRIDE_MODE
Override mode stored on a SCH_SYMBOL_INSTANCE.
@ 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)
static const wxString PIN_MAP_GROUP
static const wxString PIN_MAP_MODE_PROP
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
static const wxString PIN_MAP_FOOTPRINT_PROP
static const ASSOCIATED_FOOTPRINT * activeAssociatedFootprint(const SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH *aPath=nullptr, const wxString &aVariant=wxEmptyString)
static const wxString PIN_MAP_ENTRY_PREFIX
static const wxString PIN_MAP_NAME_PROP
static void plotLocalPowerIcon(PLOTTER *aPlotter, const VECTOR2D &aPos, double aSize, bool aRotate)
plot a local power pin indicator icon.
static const wxString PIN_MAP_TABLE_GROUP
static struct SCH_SYMBOL_DESC _SCH_SYMBOL_DESC
std::vector< FAB_LAYER_COLOR > dummy
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
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
Per-instance override of the active pin map and a sparse delta on top.
PIN_MAP_OVERRIDE_MODE m_Mode
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
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
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".
JSON_SCHEMA_VALIDATOR validator(schema)
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.
std::vector< VARIANT_COMPAT_RESULT > ValidateVariantSymbolCompatibility(const LIB_SYMBOL &aBase, const LIB_SYMBOL &aCandidate)
Check whether aCandidate can be used as a variant symbol override for aBase.
bool VariantSymbolPinsMatch(const SCH_PIN &aBase, const SCH_PIN &aCandidate)
Check whether two graphical pins occupy the same variant-symbol connection slot.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D