58 std::string ret =
TO_UTF8( txt );
62 if( (
unsigned char) c <=
' ' )
88 std::unique_ptr< LIB_SYMBOL > part;
117 SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.
Convert, aPosition, aParent )
120 for(
const auto& [fieldId, fieldValue] : aSel.
Fields )
122 if( fieldId == FIELD_T::REFERENCE )
123 SetRef( aSheet, fieldValue );
125 field->SetText( fieldValue );
150 field.SetParent(
this );
155 for(
const std::unique_ptr<SCH_PIN>&
pin : aSymbol.
m_pins )
157 m_pins.emplace_back( std::make_unique<SCH_PIN>( *
pin ) );
158 m_pins.back()->SetParent(
this );
223 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
225 if( ( (
pin->GetPosition().x -
m_pos.
x ) % min_grid_size ) != 0 )
228 if( ( (
pin->GetPosition().y -
m_pos.
y ) % min_grid_size ) != 0 )
253 wxCHECK2( !aLibSymbol || aLibSymbol->
IsRoot(), aLibSymbol =
nullptr );
255 m_part.reset( aLibSymbol );
263 return m_part->GetDescription();
265 return wxEmptyString;
272 return m_part->GetKeyWords();
274 return wxEmptyString;
281 return m_part->GetDatasheetField().GetText();
283 return wxEmptyString;
289 std::map<wxString, wxString> altPinMap;
290 std::map<wxString, std::set<SCH_PIN*>> pinUuidMap;
291 std::set<SCH_PIN*> unassignedSchPins;
292 std::set<SCH_PIN*> unassignedLibPins;
294 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
296 pinUuidMap[
pin->GetNumber() ].insert(
pin.get() );
298 unassignedSchPins.insert(
pin.get() );
300 if( !
pin->GetAlt().IsEmpty() )
301 altPinMap[
pin->GetNumber() ] =
pin->GetAlt();
303 pin->SetLibPin(
nullptr );
320 auto ii = pinUuidMap.find( libPin->GetNumber() );
322 if( ii == pinUuidMap.end() || ii->second.empty() )
324 unassignedLibPins.insert( libPin );
328 auto it = ii->second.begin();
330 ii->second.erase( it );
331 pin->SetLibPin( libPin );
332 pin->SetPosition( libPin->GetPosition() );
334 unassignedSchPins.erase(
pin );
336 auto iii = altPinMap.find( libPin->GetNumber() );
338 if( iii != altPinMap.end() )
339 pin->SetAlt( iii->second );
345 for(
SCH_PIN* libPin : unassignedLibPins )
350 if( !unassignedSchPins.empty() )
352 auto it = unassignedSchPins.begin();
354 unassignedSchPins.erase( it );
359 pin =
m_pins.emplace_back( std::make_unique<SCH_PIN>(
SCH_PIN(
this, libPin ) ) ).get();
363 pin->SetLibPin( libPin );
364 pin->SetPosition( libPin->GetPosition() );
365 pin->SetNumber( libPin->GetNumber() );
367 auto iii = altPinMap.find( libPin->GetNumber() );
369 if( iii != altPinMap.end() )
370 pin->SetAlt( iii->second );
374 for(
auto it1 =
m_pins.begin(); it1 !=
m_pins.end() && !unassignedSchPins.empty(); )
376 auto it2 = unassignedSchPins.find( it1->get() );
378 if( it2 != unassignedSchPins.end() )
380 it1 =
m_pins.erase( it1 );
381 unassignedSchPins.erase( it2 );
392 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
428 return m_part->HasAlternateBodyStyle();
437 return m_part->GetUnitCount();
447 return m_part->GetUnitDisplayName( aUnit );
455 return m_part->HasUnitDisplayName( aUnit );
460 const KIID_PATH& aSheetPath,
bool aTestFromEnd )
const
466 if( instance.m_Path == aSheetPath )
468 aInstance = instance;
472 else if( instance.m_Path.EndsWith( aSheetPath ) )
474 aInstance = instance;
498 " reference %s, unit %d from symbol %s." ),
520 " reference %s, unit %d from symbol %s." ),
561 std::vector<SCH_SYMBOL_INSTANCE>::iterator resultIt;
566 [searchPath](
const auto& it )
568 return it.m_Path == searchPath;
575 " reference %s, unit %d from symbol %s." ),
577 resultIt->m_Reference,
619 if( instance.m_Path ==
path )
621 ref = instance.m_Reference;
631 if( ref.IsEmpty() && !
GetField( FIELD_T::REFERENCE )->GetText().IsEmpty() )
661 if( instance.m_Path ==
path )
664 instance.m_Reference = ref;
672 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
673 pin->ClearDefaultNetName( sheet );
695 if( instance.m_Path ==
path )
696 return instance.m_Reference.Last() !=
'?';
707 refDesignator.Replace(
"~",
" " );
709 wxString prefix = refDesignator;
711 while( prefix.Length() )
713 wxUniCharRef last = prefix.Last();
715 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
723 prefix.Trim(
false );
725 if( !prefix.IsEmpty() )
733 return schematic->Settings().SubReference( aUnit, aAddSeparator );
745 if( instance.m_Path ==
path )
746 return instance.m_Unit;
762 if( instance.m_Path ==
path )
764 instance.m_Unit = aUnitSelection;
777 instance.m_Unit = aUnitSelection;
782 bool aAllowExtraText )
const
798 bool aAllowExtraText )
const
818 m_fields.emplace_back(
this, aFieldType );
847 if( !field.IsVisible() || field.GetText().IsEmpty() )
851 aVector.push_back(
const_cast<SCH_FIELD*
>( &field ) );
854 std::sort( aVector.begin(), aVector.end(),
857 return lhs->GetOrdinal() < rhs->GetOrdinal();
877 for(
unsigned ii = 0; ii <
m_fields.size(); ++ii )
882 if( aFieldName ==
m_fields[ii].GetName(
false ) )
895 if( field.GetName().IsSameAs( aFieldName,
false ) )
904 bool aUpdateOtherFields,
bool aResetRef,
bool aResetOtherFields )
908 std::vector<SCH_FIELD*> fields;
909 m_part->GetFields( fields );
911 for(
const SCH_FIELD* libField : fields )
914 FIELD_T fieldType = FIELD_T::USER;
916 if( libField->IsMandatory() )
918 fieldType = libField->
GetId();
923 schField =
GetField( libField->GetCanonicalName() );
928 libField->GetCanonicalName() ) );
932 schField->
SetPrivate( libField->IsPrivate() );
940 if( fieldType == FIELD_T::REFERENCE && aPath )
943 SetRef( aPath,
m_part->GetField( FIELD_T::REFERENCE )->GetText() );
944 else if( aUpdateRef )
945 SetRef( aPath, libField->GetText() );
947 else if( fieldType == FIELD_T::VALUE )
951 else if( fieldType == FIELD_T::DATASHEET )
953 if( aResetOtherFields )
955 else if( aUpdateOtherFields )
956 schField->
SetText( libField->GetText() );
960 if( aResetOtherFields || aUpdateOtherFields )
961 schField->
SetText( libField->GetText() );
971 bool updateValue =
true;
972 bool updateExclFromBOM =
true;
973 bool updateExclFromBoard =
true;
974 bool updateDNP =
true;
975 bool updateOtherFields =
true;
976 bool updatePins =
true;
980 updateValue = aProperty->
Name() ==
_HKI(
"Value" );
981 updateExclFromBoard = aProperty->
Name() ==
_HKI(
"Exclude From Board" );
982 updateExclFromBOM = aProperty->
Name() ==
_HKI(
"Exclude From Bill of Materials" );
983 updateDNP = aProperty->
Name() ==
_HKI(
"Do not Populate" );
984 updateOtherFields =
false;
989 && !updateExclFromBOM
990 && !updateExclFromBoard
992 && !updateOtherFields
1002 wxString ref =
GetRef( &aSourceSheet );
1007 std::vector<SCH_SYMBOL*> otherUnits;
1013 aCommit.
Modify( otherUnit, screen );
1016 otherUnit->SetValueFieldText(
GetField( FIELD_T::VALUE )->GetText() );
1018 if( updateOtherFields )
1022 if( field.GetId() == FIELD_T::REFERENCE || field.GetId() == FIELD_T::VALUE )
1030 if( field.IsMandatory() )
1031 otherField = otherUnit->GetField( field.GetId() );
1033 otherField = otherUnit->GetField( field.GetName() );
1037 otherField->
SetText( field.GetText() );
1045 newField.
Offset( otherUnit->GetPosition() );
1048 otherUnit->AddField( newField );
1052 for(
int ii = (
int) otherUnit->GetFields().size() - 1; ii >= 0; ii-- )
1054 SCH_FIELD& otherField = otherUnit->GetFields()[ii];
1057 otherUnit->GetFields().erase( otherUnit->GetFields().begin() + ii );
1061 if( updateExclFromBOM )
1064 if( updateExclFromBoard )
1068 otherUnit->SetDNP(
m_DNP );
1072 for(
const std::unique_ptr<SCH_PIN>& model_pin :
m_pins )
1074 SCH_PIN* src_pin = otherUnit->GetPin( model_pin->GetNumber() );
1077 src_pin->
SetAlt( model_pin->GetAlt() );
1088 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1089 aFunction(
pin.get() );
1092 aFunction( &field );
1098 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1100 if(
pin->GetNumber() == aNumber )
1110 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1112 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
1114 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
1117 if( pin_unit > 0 && pin_unit !=
GetUnit() )
1120 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
1123 if(
pin->GetPosition() == aPos )
1136 return std::vector<SCH_PIN*>();
1143 return m_part->GetPins();
1145 return std::vector<SCH_PIN*>();
1157 auto it =
m_pinMap.find( aLibPin );
1162 wxFAIL_MSG_AT(
"Pin not found", __FILE__, __LINE__, __FUNCTION__ );
1169 std::vector<SCH_PIN*> pins;
1171 if( aSheet ==
nullptr )
1173 wxCHECK_MSG(
Schematic(), pins,
"Can't call GetPins on a symbol with no schematic" );
1180 for(
const std::unique_ptr<SCH_PIN>& p :
m_pins )
1182 if( unit && p->GetLibPin() && p->GetLibPin()->GetUnit()
1183 && ( p->GetLibPin()->GetUnit() != unit ) )
1188 pins.push_back( p.get() );
1206 wxT(
"Cannot swap data with invalid symbol." ) );
1214 for( std::unique_ptr<SCH_PIN>&
pin : symbol->
m_pins )
1215 pin->SetParent( symbol );
1217 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1218 pin->SetParent(
this );
1223 m_part.reset( libSymbol );
1257 if( field.IsPrivate() )
1260 if( field.IsMandatory() )
1261 aVars->push_back( field.GetCanonicalName().Upper() );
1263 aVars->push_back( field.GetName() );
1266 aVars->push_back( wxT(
"OP" ) );
1267 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1268 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1269 aVars->push_back( wxT(
"UNIT" ) );
1270 aVars->push_back( wxT(
"SHORT_REFERENCE" ) );
1271 aVars->push_back( wxT(
"SYMBOL_LIBRARY" ) );
1272 aVars->push_back( wxT(
"SYMBOL_NAME" ) );
1273 aVars->push_back( wxT(
"SYMBOL_DESCRIPTION" ) );
1274 aVars->push_back( wxT(
"SYMBOL_KEYWORDS" ) );
1275 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1276 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1277 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1278 aVars->push_back( wxT(
"DNP" ) );
1279 aVars->push_back( wxT(
"SHORT_NET_NAME(<pin_number>)" ) );
1280 aVars->push_back( wxT(
"NET_NAME(<pin_number>)" ) );
1281 aVars->push_back( wxT(
"NET_CLASS(<pin_number>)" ) );
1282 aVars->push_back( wxT(
"PIN_NAME(<pin_number>)" ) );
1288 static wxRegEx operatingPoint( wxT(
"^"
1291 "(.([0-9])?([a-zA-Z]*))?"
1294 wxCHECK( aPath,
false );
1301 if( operatingPoint.Matches( *token ) )
1303 wxString
pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
1304 wxString precisionStr( operatingPoint.GetMatch( *token, 3 ) );
1305 wxString range( operatingPoint.GetMatch( *token, 4 ) );
1308 if( !precisionStr.IsEmpty() )
1309 precision = precisionStr[0] -
'0';
1311 if( range.IsEmpty() )
1312 range = wxS(
"~A" );
1322 spiceRef = spiceRef.Lower();
1329 else if(
pin == wxS(
":power" ) )
1331 if( range.IsEmpty() )
1332 range = wxS(
"~W" );
1334 *token = schematic->
GetOperatingPoint( spiceRef + wxS(
":power" ), precision, range );
1339 pin =
pin.SubString( 1, -1 );
1341 for(
const std::reference_wrapper<const SIM_MODEL_PIN>& modelPin : model.
GetPins() )
1343 SCH_PIN* symbolPin =
GetPin( modelPin.get().symbolPinNumber );
1347 if( model.
GetPins().size() == 2 )
1353 wxString signalName = spiceRef + wxS(
":" ) + modelPin.get().modelPinName;
1362 *token = wxS(
"?" );
1366 if( token->Contains(
':' ) )
1372 wxString upperToken = token->Upper();
1376 wxString fieldName = field.IsMandatory() ? field.GetCanonicalName()
1379 wxString textToken = field.GetText();
1380 textToken.Replace(
" ", wxEmptyString );
1381 wxString tokenString =
"${" + fieldName +
"}";
1384 if( textToken.IsSameAs( tokenString,
false ) )
1387 if( token->IsSameAs( fieldName,
false ) )
1389 if( field.GetId() == FIELD_T::REFERENCE )
1390 *token =
GetRef( aPath,
true );
1392 *token = field.GetShownText( aPath,
false, aDepth + 1 );
1399 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) )
1400 || token->IsSameAs( wxT(
"SIM.TYPE" ) )
1401 || token->IsSameAs( wxT(
"SIM.PINS" ) )
1402 || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
1403 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) )
1404 || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
1406 *token = wxEmptyString;
1413 if( token->IsSameAs( templateFieldname.m_Name )
1414 || token->IsSameAs( templateFieldname.m_Name.Upper() ) )
1418 *token = wxEmptyString;
1423 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1427 wxArrayString parts = wxSplit( footprint,
':' );
1429 if( parts.Count() > 0 )
1430 *token = parts[ 0 ];
1432 *token = wxEmptyString;
1436 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1440 wxArrayString parts = wxSplit( footprint,
':' );
1442 if( parts.Count() > 1 )
1443 *token = parts[ std::min( 1, (
int) parts.size() - 1 ) ];
1445 *token = wxEmptyString;
1449 else if( token->IsSameAs( wxT(
"UNIT" ) ) )
1454 else if( token->IsSameAs( wxT(
"SHORT_REFERENCE" ) ) )
1456 *token =
GetRef( aPath,
false );
1459 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
1464 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
1469 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
1474 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
1479 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1481 *token = wxEmptyString;
1484 *token =
_(
"Excluded from BOM" );
1488 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
1490 *token = wxEmptyString;
1493 *token =
_(
"Excluded from board" );
1497 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
1499 *token = wxEmptyString;
1502 *token =
_(
"Excluded from simulation" );
1506 else if( token->IsSameAs( wxT(
"DNP" ) ) )
1508 *token = wxEmptyString;
1510 if( aPath->
GetDNP() || this->GetDNP() )
1511 *token =
_(
"DNP" );
1515 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) )
1516 || token->StartsWith( wxT(
"NET_NAME(" ) )
1517 || token->StartsWith( wxT(
"NET_CLASS(" ) )
1518 || token->StartsWith( wxT(
"PIN_NAME(" ) ) )
1520 wxString pinNumber = token->AfterFirst(
'(' );
1521 pinNumber = pinNumber.BeforeLast(
')' );
1525 if(
pin->GetNumber() == pinNumber )
1527 if( token->StartsWith( wxT(
"PIN_NAME" ) ) )
1529 *token =
pin->GetAlt().IsEmpty() ?
pin->GetName() :
pin->GetAlt();
1536 *token = wxEmptyString;
1537 else if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
1539 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
1540 *token = conn->
Name();
1541 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
1542 *token =
pin->GetEffectiveNetClass( aPath )->GetName();
1565 if( instance.m_Path ==
path )
1567 if( instance.m_Reference.IsEmpty() || aResetPrefix )
1578 if( instance.m_Reference.IsEmpty() || aResetPrefix)
1585 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
1586 pin->ClearDefaultNetName( aSheetPath );
1592 wxString currentReference =
GetField( FIELD_T::REFERENCE )->
GetText();
1594 if( currentReference.IsEmpty() || aResetPrefix )
1604 wxCHECK( aSheetPath.size() > 0,
false );
1609 if( instance.m_Path == aSheetPath )
1622 bool transform =
false;
1624 switch( aOrientation )
1745 wxFAIL_MSG(
"Invalid schematic symbol orientation type." );
1781 int rotate_values[] =
1801 for(
int type_rotate : rotate_values )
1813 wxFAIL_MSG(
"Schematic symbol orientation matrix internal error." );
1821void SCH_SYMBOL::Show(
int nestLevel, std::ostream& os )
const
1824 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str()
1826 <<
'"' <<
" chipName=\""
1832 for(
int i = 1; i < (int)
GetFields().size(); ++i )
1834 const wxString& value =
GetFields()[i].GetText();
1836 if( !value.IsEmpty() )
1838 NestedSpace( nestLevel + 1, os ) <<
"<field" <<
" name=\""
1840 <<
'"' <<
" value=\""
1841 <<
TO_UTF8( value ) <<
"\"/>\n";
1845 NestedSpace( nestLevel, os ) <<
"</" <<
TO_UTF8(
GetClass().Lower() ) <<
">\n";
1866 if( aIncludeFields )
1870 if( field.IsVisible() )
1871 bBox.
Merge( field.GetBoundingBox() );
1885 catch(
const boost::bad_pointer& e )
1887 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ), e.what() ) );
1918 msgs.Add(
_(
"Simulation" ) );
1921 msgs.Add(
_(
"BOM" ) );
1924 msgs.Add(
_(
"Board" ) );
1927 msgs.Add(
_(
"DNP" ) );
1929 msg = wxJoin( msgs,
'|' );
1930 msg.Replace(
'|', wxS(
", " ) );
1933 aList.emplace_back(
_(
"Exclude from" ), msg );
1944 aList.emplace_back(
_(
"Power symbol" ),
1949 aList.emplace_back(
_(
"Reference" ),
1953 aList.emplace_back(
_(
"Value" ),
1956 aList.emplace_back(
_(
"Name" ),
1962 aList.emplace_back(
_(
"flags" ), wxString::Format(
"%X",
GetEditFlags() ) );
1967 msg =
_(
"Missing parent" );
1969 std::shared_ptr< LIB_SYMBOL > parent =
m_part->GetParent().lock();
1972 msg = parent->GetName();
1982 aList.emplace_back(
_(
"Library" ),
_(
"Undefined!!!" ) );
1990 msg =
_(
"<Unknown>" );
1992 aList.emplace_back(
_(
"Footprint" ), msg );
1995 aList.emplace_back(
_(
"Description" ) + wxT(
": " )
1996 +
GetField( FIELD_T::DESCRIPTION )->GetText(),
1997 _(
"Keywords" ) + wxT(
": " ) +
m_part->GetKeyWords() );
2002 aList.emplace_back(
_(
"Reference" ),
GetRef( currentSheet ) );
2005 aList.emplace_back(
_(
"Value" ),
2008 aList.emplace_back(
_(
"Name" ),
2013 if( libNickname.empty() )
2014 msg =
_(
"No library defined!" );
2016 msg.Printf(
_(
"Symbol not found in %s!" ), libNickname );
2018 aList.emplace_back(
_(
"Library" ), msg );
2025 return BITMAPS::add_component;
2042 field.SetTextPos( pos );
2060 field.SetTextPos( pos );
2079 field.SetTextPos( pos );
2088 if( drawItem.Matches( aSearchData, aAuxData ) )
2099 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2107 aItemList.push_back( item );
2113 std::vector<DANGLING_END_ITEM>& aItemListByPos,
2116 bool changed =
false;
2118 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2120 bool previousState =
pin->IsDangling();
2121 pin->SetIsDangling(
true );
2126 bool do_break =
false;
2128 for(
auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
2147 pin->SetIsDangling(
false );
2159 changed = ( changed || ( previousState !=
pin->IsDangling() ) );
2185 wxCHECK( symbol,
false );
2191 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2193 if(
pin->IsDangling() )
2206 if(
GetRef( aInstance ) != symbol->
GetRef( aInstance ) )
2211 && (
GetValue(
true, aInstance,
false ) != symbol->
GetValue(
true, aInstance,
false ) ) )
2217 for(
size_t i = 0; i <
m_pins.size(); i++ )
2229 std::vector<VECTOR2I> retval;
2231 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2235 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2237 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2240 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2243 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2269 return wxString::Format(
_(
"Symbol %s [%s]" ),
2276 const std::vector<KICAD_T>& aScanTypes )
2278 for(
KICAD_T scanType : aScanTypes )
2283 if( INSPECT_RESULT::QUIT == aInspector(
this, aTestData ) )
2284 return INSPECT_RESULT::QUIT;
2291 if( INSPECT_RESULT::QUIT == aInspector( &field, (
void*)
this ) )
2292 return INSPECT_RESULT::QUIT;
2298 if( INSPECT_RESULT::QUIT == aInspector(
GetField( FIELD_T::REFERENCE ), (
void*)
this ) )
2299 return INSPECT_RESULT::QUIT;
2305 if( INSPECT_RESULT::QUIT == aInspector(
GetField( FIELD_T::VALUE ), (
void*)
this ) )
2306 return INSPECT_RESULT::QUIT;
2311 if( INSPECT_RESULT::QUIT == aInspector(
GetField( FIELD_T::FOOTPRINT ), (
void*)
this ) )
2312 return INSPECT_RESULT::QUIT;
2317 if( INSPECT_RESULT::QUIT == aInspector(
GetField( FIELD_T::DATASHEET ), (
void*)
this ) )
2318 return INSPECT_RESULT::QUIT;
2323 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2327 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2329 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2332 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2335 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2338 if( INSPECT_RESULT::QUIT == aInspector(
pin.get(), (
void*)
this ) )
2339 return INSPECT_RESULT::QUIT;
2344 return INSPECT_RESULT::CONTINUE;
2372 std::vector<SCH_FIELD*> fields, otherFields;
2375 aSymbol.
GetFields( otherFields,
false );
2377 if( fields.size() != otherFields.size() )
2380 for(
int ii = 0; ii < (int) fields.size(); ii++ )
2382 if( fields[ii]->GetId() == FIELD_T::REFERENCE )
2385 if( fields[ii]->GetText().Cmp( otherFields[ii]->GetText() ) != 0 )
2395 return !( *
this == aSymbol );
2401 wxCHECK_MSG(
Type() == aSymbol.
Type(), *
this,
2402 wxT(
"Cannot assign object type " ) + aSymbol.
GetClass() + wxT(
" to type " ) +
2405 if( &aSymbol !=
this )
2422 field.SetParent(
this );
2434 bBox.
Inflate( aAccuracy / 2 );
2450 rect.
Inflate( aAccuracy / 2 );
2463 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2465 if(
pin->GetType() == ELECTRICAL_PINTYPE::PT_NC )
2470 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2472 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2475 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2478 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2481 if(
pin->GetLocalPosition() == new_pos )
2496 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
2510 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2513 SCH_PIN* tempPin = tempPins[ i ];
2530 text->SetText(
dummy.GetShownText(
false ) );
2539 for(
bool local_background : {
true,
false } )
2546 field.ClearRenderCache();
2560 std::vector<wxString> properties;
2564 wxString text_field = field.GetShownText( sheet,
false);
2566 if( text_field.IsEmpty() )
2569 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2570 field.GetName(), text_field ) );
2573 if( !
m_part->GetKeyWords().IsEmpty() )
2575 properties.emplace_back( wxString::Format( wxT(
"!%s = %s" ),
2577 m_part->GetKeyWords() ) );
2598 std::max( bbox.
GetY() - pins.
GetY(),
2602 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2603 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2613 strokeWidth,
FILLED,
nullptr );
2633 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2636 SCH_PIN* tempPin = tempPins[ i ];
2651 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2653 if(
pin->IsBrightened() )
2663 for( std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2664 pin->ClearBrightened();
2682 m_part->SetShowPinNames( aShow );
2695 m_part->SetShowPinNumbers( aShow );
2701 for(
const std::unique_ptr<SCH_PIN>&
pin :
m_pins )
2703 int pin_unit =
pin->GetLibPin() ?
pin->GetLibPin()->GetUnit()
2705 int pin_bodyStyle =
pin->GetLibPin() ?
pin->GetLibPin()->GetBodyStyle()
2708 if( pin_unit > 0 && pin_unit !=
GetUnit() )
2711 if( pin_bodyStyle > 0 && pin_bodyStyle !=
GetBodyStyle() )
2714 if(
pin->IsPointClickableAnchor( aPos ) )
2733 if( pin_list.size() != 1 )
2736 return pin_list[0]->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN;
2751 if( pin_list.size() != 1 )
2754 return pin_list[0]->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN;
2763 return m_part->IsLocalPower();
2772 return m_part->IsGlobalPower();
2784 wxCHECK(
m_part,
false );
2786 return m_part->IsNormal();
2792 std::unordered_set<wxString> componentClass;
2794 auto getComponentClassFields =
2795 [&](
const std::vector<SCH_FIELD>& fields )
2799 if( field.GetCanonicalName() == wxT(
"Component Class" ) )
2801 if( field.GetShownText( aPath,
false ) != wxEmptyString )
2802 componentClass.insert( field.GetShownText( aPath,
false ) );
2808 getComponentClassFields(
m_fields );
2815 getComponentClassFields( label->GetFields() );
2819 return componentClass;
2851 for(
unsigned i = 0; i <
m_pins.size(); ++i )
2900 _HKI(
"Orientation" ),
2911 return symbol->GetLibSymbolRef() !=
nullptr;
2918 .SetAvailableFunc( hasLibPart );
2922 .SetAvailableFunc( hasLibPart );
2924 const wxString groupFields =
_HKI(
"Fields" );
2946 return symbol->IsMulti();
2951 auto multiBodyStyle =
2955 return symbol->HasAlternateBodyStyle();
2968 const wxString groupAttributes =
_HKI(
"Attributes" );
constexpr EDA_IU_SCALE schIUScale
BITMAPS
A list of all bitmap identifiers.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr ecoord_type GetArea() const
Return the area of the rectangle.
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr bool Intersects(const BOX2< Vec > &aRect) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
Helper class used to store the state of schematic items that can be connected to other schematic item...
DANGLING_END_T GetType() const
const EDA_ITEM * GetParent() const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Linked list: Link (parent struct).
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetTextPos(const VECTOR2I &aPoint)
void Offset(const VECTOR2I &aOffset)
static ENUM_MAP< T > & Instance()
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
wxString AsString() const
A logical library item identifier and consists of various portions much like a URI.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const wxString GetUniStringLibNickname() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit, int aBodyStyle) const
Return a list of pin object pointers from the draw item list.
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
static wxString LetterSubReference(int aUnit, int aFirstId)
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.
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 ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
virtual void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
Create a bookmark to a symbol.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
virtual void SetColor(const COLOR4D &color)=0
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
const wxString & Name() const
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
TEMPLATES m_TemplateFieldNames
Holds all the data relating to one schematic.
PROJECT & Prj() const
Return a reference to the project this schematic is part of.
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
SCHEMATIC_SETTINGS & Settings() const
SCH_SHEET_PATH & CurrentSheet() const
bool ResolveCrossReference(wxString *token, int aDepth) const
Resolves text vars that refer to other items.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString LocalName() const
wxString Name(bool aIgnoreSheet=false) const
Schematic editor (Eeschema) main window.
SCH_SHEET_PATH & GetCurrentSheet() const
void ImportValues(const SCH_FIELD &aSource)
Copy parameters from a SCH_FIELD source.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
void SetPrivate(bool aPrivate)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
AUTOPLACE_ALGO m_fieldsAutoplaced
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
void SetAlt(const wxString &aAlt)
void SetName(const wxString &aName)
const wxString & GetName() const
bool IsDangling() const override
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
wxString GetShownName() const
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetNumber() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool GetExcludedFromBOM() const
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
bool GetExcludedFromSim() const
bool GetExcludedFromBoard() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the sheet.
void SetValueProp(const wxString &aRef)
SCH_SYMBOL & operator=(const SCH_SYMBOL &aItem)
size_t GetFullPinCount() const
void UpdatePrefix()
Set the prefix based on the current reference designator.
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
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
wxString GetSymbolIDAsString() const
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool GetShowPinNumbers() const override
wxString GetDatasheet() const
Return the documentation text for the given part alias.
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLibId(const LIB_ID &aName)
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the symbol's fields.
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
void SetRefProp(const wxString &aRef)
wxString GetUnitDisplayName(int aUnit) const
Return the display name for a given unit aUnit.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
SCH_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void PlotDNP(PLOTTER *aPlotter) const
Plot the red 'X' over the symbol.
bool operator!=(const SCH_SYMBOL &aSymbol) const
void SetShowPinNumbers(bool aShow) override
Set or clear the pin number visibility flag.
SYMBOL_ORIENTATION_PROP GetOrientationProp() const
void SetBodyStyleUnconditional(int aBodyStyle)
Similar to SetBodyStyle(), but always set the body style, regardless the lib symbol properties (the L...
wxString SubReference(int aUnit, bool aAddSeparator=true) const
wxString GetClass() const override
Return the class name.
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
void SetUnitProp(const wxString &aUnit)
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
void SetMirrorY(bool aMirror)
void PlotPins(PLOTTER *aPlotter) const
Plot just the symbol pins.
void SetValueFieldText(const wxString &aValue)
std::vector< SCH_PIN * > GetPins() const override
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
void SetBodyStyle(int aBodyStyle) override
void SetShowPinNames(bool aShow) override
Set or clear the pin name visibility flag.
wxString GetKeyWords() const override
wxString GetSchSymbolLibraryName() const
void SetBodyStyleProp(int aBodyStyle)
void ClearBrightenedPins()
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
bool IsGlobalPower() const override
wxString GetRefProp() const
wxString GetUnitProp() const
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
std::vector< SCH_SYMBOL_INSTANCE > m_instanceReferences
Define the hierarchical path and reference of the symbol.
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
void SyncOtherUnits(const SCH_SHEET_PATH &aSourceSheet, SCH_COMMIT &aCommit, PROPERTY_BASE *aProperty)
Keep fields other than the reference, include/exclude flags, and alternate pin assignments in sync in...
SCH_FIELD * FindFieldCaseInsensitive(const wxString &aFieldName)
Search for a SCH_FIELD with aFieldName.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
void UpdateFields(const SCH_SHEET_PATH *aPath, bool aUpdateStyle, bool aUpdateRef, bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields)
Restore fields to the original library values.
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
void SetOrientationProp(SYMBOL_ORIENTATION_PROP aAngle)
Orientation/mirroring access for property manager.
bool GetShowPinNames() const override
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
int GetBodyStyleProp() const
std::vector< SCH_PIN * > GetAllLibPins() const
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetFootprintFieldText(const wxString &aFootprint)
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
VECTOR2I GetPosition() const override
std::unique_ptr< LIB_SYMBOL > m_part
A flattened copy of the LIB_SYMBOL from the PROJECT object's libraries.
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this symbol.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
bool HasAlternateBodyStyle() const override
Test if symbol has more than one body conversion type (DeMorgan).
const LIB_ID & GetLibId() const override
bool operator<(const SCH_ITEM &aItem) const override
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
std::vector< SCH_PIN * > GetLibPins() const
Populate a vector with all the pins from the library object that match the current unit and bodyStyle...
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool m_isInNetlist
True if the symbol should appear in netlist.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
wxString GetValueProp() const
bool IsLocalPower() const override
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
int GetUnitCount() const override
Return the number of units per package of the symbol.
void SetPrefix(const wxString &aPrefix)
int GetOrientation() const override
Get the display symbol orientation.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
bool IsSymbolLikePowerLocalLabel() const
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
bool IsNormal() const override
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
std::unordered_set< wxString > GetComponentClassNames(const SCH_SHEET_PATH *aPath) const
Return the component classes this symbol belongs in.
std::vector< std::unique_ptr< SCH_PIN > > m_pins
A SCH_PIN for every #LIB_PIN.
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
VECTOR2I GetPinPhysicalPosition(const SCH_PIN *Pin) const
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
bool HasUnitDisplayName(int aUnit) const
Return true if the given unit aUnit has a display name set.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
bool IsPower() const override
bool operator==(const SCH_SYMBOL &aSymbol) const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
const SPICE_GENERATOR & SpiceGenerator() const
std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
virtual std::string ItemName(const SPICE_ITEM &aItem) const
A base class for LIB_SYMBOL and SCH_SYMBOL.
bool m_DNP
True if symbol is set to 'Do Not Populate'.
bool GetExcludedFromBoard() const
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
bool GetExcludedFromBOM() const
const TRANSFORM & GetTransform() const
void SetExcludedFromSim(bool aExcludeFromSim) override
Set or clear the exclude from simulation flag.
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
bool GetDNP() const
Set or clear the 'Do Not Populate' flag.
virtual bool GetShowPinNames() const
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
SYMBOL & operator=(const SYMBOL &aItem)
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
virtual bool GetShowPinNumbers() const
TRANSFORM m_transform
The rotation/mirror transformation.
bool GetExcludedFromSim() const override
const std::vector< TEMPLATE_FIELDNAME > & GetTemplateFieldNames()
Return a template field name list for read only access.
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define IS_DANGLING
indicates a pin is dangling
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.
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.
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
Collection of utility functions for component reference designators (refdes)
void CollectOtherUnits(const wxString &aRef, int aUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
const SCH_FIELD * FindField(const std::vector< SCH_FIELD > &aFields, FIELD_T aFieldId)
int NextFieldOrdinal(const std::vector< SCH_FIELD > &aFields)
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
static struct SCH_SYMBOL_DESC _SCH_SYMBOL_DESC
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
constexpr int MilsToIU(int mils) const
std::vector< std::pair< FIELD_T, wxString > > Fields
A simple container for schematic symbol instance information.
Hold a name of a symbol's field, field value, and default visibility.
@ SYM_ROTATE_COUNTERCLOCKWISE
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
wxString GetCanonicalFieldName(FIELD_T aFieldType)
wxLogTrace helper definitions.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_FIELD_LOCATE_REFERENCE_T
@ SCH_FIELD_LOCATE_FOOTPRINT_T
@ SCH_FIELD_LOCATE_VALUE_T
@ SCH_FIELD_LOCATE_DATASHEET_T
@ SCH_SYMBOL_LOCATE_POWER_T
Custom text control validator definitions.
VECTOR2< int32_t > VECTOR2I