45#include <unordered_set>
55 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
56 shownText = parent->GetShownDescription( aDepth );
69 std::function<bool( wxString* )> libSymbolResolver =
70 [&]( wxString* token ) ->
bool
78 if(
text.Contains( wxT(
"@{" ) ) )
87 std::vector<SEARCH_TERM> terms;
93 wxStringTokenizer keywordTokenizer(
GetShownKeyWords(),
" \t\r\n", wxTOKEN_STRTOK );
95 while( keywordTokenizer.HasMoreTokens() )
96 terms.emplace_back(
SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) );
104 if( !footprint.IsEmpty() )
118 aColumnMap[field->
GetName()] = field->EDA_TEXT::GetShownText(
false );
151 [&](
FIELD_T id,
bool visible )
209 wxFAIL_MSG(
"Failed to clone SCH_ITEM." );
220 if( &aSymbol ==
this )
295 if(
const std::shared_ptr<LIB_SYMBOL> parent =
GetParent().lock() )
304 if(
const std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
327 return aLabel ?
_(
"Alternate" ) : wxString(
_HKI(
"Alternate" ) );
329 return aLabel ?
_(
"Standard" ) : wxString(
_HKI(
"Standard" ) );
344 m_libId.SetLibItemName( aName );
359 std::unique_ptr< LIB_SYMBOL > retv;
363 std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock();
365 wxCHECK_MSG( parent, retv, wxString::Format(
"Parent of derived symbol '%s' undefined",
m_name ) );
368 if( parent->IsDerived() )
369 retv = parent->Flatten();
371 retv = std::make_unique<LIB_SYMBOL>( *parent.get() );
419 retv = std::make_unique<LIB_SYMBOL>( *
this );
431 return m_libId.GetLibNickname();
437 if(
const std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
438 return parent->IsLocalPower();
446 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
448 parent->SetLocalPower();
458 if(
const std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
459 return parent->IsGlobalPower();
473 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
475 parent->SetGlobalPower();
485 if(
const std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
486 return parent->IsNormal();
494 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
514 u = ( aUnit - 1 ) % 26;
515 suffix = wxChar( aInitialLetter + u ) + suffix;
516 aUnit = ( aUnit - u ) / 26;
517 }
while( aUnit > 0 );
534 footprint = field.
GetShownText(
nullptr,
false, aDepth + 1 );
537 || token->IsSameAs( field.
GetName(),
false ) )
539 *token = field.
GetShownText(
nullptr,
false, aDepth + 1 );
546 if( token->IsSameAs( wxT(
"SIM.DEVICE" ) )
547 || token->IsSameAs( wxT(
"SIM.TYPE" ) )
548 || token->IsSameAs( wxT(
"SIM.PINS" ) )
549 || token->IsSameAs( wxT(
"SIM.PARAMS" ) )
550 || token->IsSameAs( wxT(
"SIM.LIBRARY" ) )
551 || token->IsSameAs( wxT(
"SIM.NAME" ) ) )
553 *token = wxEmptyString;
557 if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
559 wxArrayString parts = wxSplit( footprint,
':' );
561 if( parts.Count() > 0 )
564 *token = wxEmptyString;
568 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
570 wxArrayString parts = wxSplit( footprint,
':' );
572 if( parts.Count() > 1 )
573 *token = parts[ std::min( 1, (
int) parts.size() - 1 ) ];
575 *token = wxEmptyString;
579 else if( token->IsSameAs( wxT(
"SYMBOL_LIBRARY" ) ) )
581 *token =
m_libId.GetUniStringLibNickname();
584 else if( token->IsSameAs( wxT(
"SYMBOL_NAME" ) ) )
586 *token =
m_libId.GetUniStringLibItemName();
589 else if( token->IsSameAs( wxT(
"SYMBOL_DESCRIPTION" ) ) )
594 else if( token->IsSameAs( wxT(
"SYMBOL_KEYWORDS" ) ) )
599 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
604 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
609 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
614 else if( token->IsSameAs( wxT(
"DNP" ) ) )
616 *token = this->
GetDNP() ?
_(
"DNP" ) : wxString(
"" );
625 int aUnit,
int aBodyStyle,
const VECTOR2I &aOffset,
bool aDimmed )
627 wxASSERT( aPlotter !=
nullptr );
647 if( item.IsPrivate() )
655 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
658 if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
661 item.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
667 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
669 wxASSERT( aPlotter !=
nullptr );
695 wxString tmp = field.
GetText();
698 item.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
707 std::vector<SCH_SHAPE*> potential_top_items;
708 std::vector<SCH_ITEM*> bottom_items;
717 potential_top_items.push_back( &shape );
719 bottom_items.push_back( &item );
723 bottom_items.push_back( &item );
727 std::sort( potential_top_items.begin(), potential_top_items.end(),
730 return a->GetBoundingBox().GetArea() > b->GetBoundingBox().GetArea();
733 for(
SCH_SHAPE* item : potential_top_items )
735 for(
SCH_ITEM* bottom_item : bottom_items )
737 if( item->GetBoundingBox().Contains( bottom_item->GetBoundingBox() ) )
749 wxASSERT( aItem !=
nullptr );
755 if(
static_cast<SCH_FIELD*
>( aItem )->IsMandatory() )
761 for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
788 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
789 return parent->GetGraphicalPins( aUnit, aBodyStyle );
791 std::vector<SCH_PIN*> pins;
803 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
807 if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
813 wxString::Format(
"GetGraphicalPins: lib='%s' unit=%d body=%d -> include pin name='%s' number='%s' shownNum='%s'",
815 pin->GetName(),
pin->GetNumber(),
pin->GetShownNumber() ) );
816 pins.push_back(
pin );
825 std::vector<UNIT_PIN_INFO> units;
832 VECTOR2I positionB = b->GetPosition();
834 if( positionA.
x != positionB.
x )
835 return positionA.
x < positionB.
x;
837 return positionA.
y < positionB.
y;
840 for(
int unitIdx = 1; unitIdx <= unitCount; ++unitIdx )
847 std::sort( pinList.begin(), pinList.end(), compareByPosition );
849 std::unordered_set<wxString> seenNumbers;
851 for(
SCH_PIN* basePin : pinList )
853 bool stackedValid =
false;
854 std::vector<wxString> expandedNumbers = basePin->GetStackedPinNumbers( &stackedValid );
856 if( stackedValid && !expandedNumbers.empty() )
858 for(
const wxString& number : expandedNumbers )
860 if( seenNumbers.insert( number ).second )
867 const wxString& number = basePin->GetNumber();
869 if( !number.IsEmpty() && seenNumbers.insert( number ).second )
873 units.push_back( std::move( unitInfo ) );
882 std::vector<LOGICAL_PIN> out;
887 std::vector<wxString> expanded =
pin->GetStackedPinNumbers( &valid );
889 if( valid && !expanded.empty() )
891 for(
const wxString& num : expanded )
895 wxString::Format(
"GetLogicalPins: base='%s' -> '%s'",
896 pin->GetShownNumber(), num ) );
903 wxString::Format(
"GetLogicalPins: base='%s' (no expansion)",
904 pin->GetShownNumber() ) );
918 int pinCount =
pin->GetStackedPinCount();
922 wxLogTrace(
"CVPCB_PINCOUNT",
"LIB_SYMBOL::GetPinCount total for lib='%s' => %d",
GetLibId().
Format().wx_str(),
933 if( aNumber ==
pin->GetNumber() )
942 bool aTestType,
bool aTestOrientation,
bool aTestLength )
const
947 bool foundMatch =
false;
951 wxASSERT( otherPin );
954 if(
pin->GetUnit() != otherPin->GetUnit() )
958 if(
pin->GetBodyStyle() != otherPin->GetBodyStyle() )
962 if(
pin->GetPosition() != otherPin->GetPosition() )
966 if( aTestNums && (
pin->GetNumber() != otherPin->GetNumber() ) )
970 if( aTestNames && (
pin->GetName() != otherPin->GetName() ) )
974 if( aTestType && (
pin->GetType() != otherPin->GetType() ) )
979 && (
pin->GetOrientation() != otherPin->GetOrientation() ) )
983 if( aTestLength && (
pin->GetLength() != otherPin->GetLength() ) )
1010 bool aIgnoreLabelsOnInvisiblePins )
const
1014 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
1015 bBox = parent->GetUnitBoundingBox( aUnit, aBodyStyle, aIgnoreHiddenFields, aIgnoreLabelsOnInvisiblePins );
1019 if( item.m_unit > 0 &&
m_unitCount > 1 && aUnit > 0 && aUnit != item.m_unit )
1022 if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
1025 if( aIgnoreHiddenFields && item.Type() ==
SCH_FIELD_T )
1027 if( !
static_cast<const SCH_FIELD&
>( item ).IsVisible() )
1031 if( item.Type() ==
SCH_PIN_T && !aIgnoreLabelsOnInvisiblePins )
1034 bBox.
Merge(
pin.GetBoundingBox(
true,
true,
false ) );
1038 bBox.
Merge( item.GetBoundingBox() );
1047 bool aIncludePrivateItems )
const
1053 if( item.m_unit > 0 && aUnit > 0 && aUnit != item.m_unit )
1056 if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
1059 if( item.IsPrivate() && !aIncludePrivateItems )
1069 if(
pin.IsVisible() )
1075 bbox.
Merge(
pin.GetBoundingBox(
false,
false,
false ) );
1082 bbox.
Merge( item.GetBoundingBox() );
1106 for(
const SCH_FIELD& src : aFieldsList )
1131 aList.push_back(
const_cast<SCH_FIELD*
>( field ) );
1134 std::sort( aList.begin(), aList.end(),
1137 return lhs->GetOrdinal() < rhs->GetOrdinal();
1144 std::vector<SCH_FIELD*> orderedFields;
1149 aList.emplace_back( *field );
1158 ordinal = std::max( ordinal,
static_cast<const SCH_FIELD*
>( &item )->GetOrdinal() + 1 );
1170 if( field->
GetId() == aFieldType )
1184 if( field->
GetId() == aFieldType )
1198 if( field.
GetName() == aFieldName )
1212 if( field.
GetName() == aFieldName )
1237 wxASSERT( field !=
nullptr );
1245 wxASSERT( field !=
nullptr );
1253 wxASSERT( field !=
nullptr );
1261 wxASSERT( field !=
nullptr );
1269 wxASSERT( field !=
nullptr );
1278 refDesignator.Replace( wxS(
"~" ), wxS(
" " ) );
1280 wxString prefix = refDesignator;
1282 while( prefix.Length() )
1284 wxUniCharRef last = prefix.Last();
1286 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
1287 prefix.RemoveLast();
1293 prefix.Trim(
true );
1294 prefix.Trim(
false );
1310 item.Move( aOffset );
1326 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
1327 return parent->HasLegacyAlternateBodyStyle();
1335 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
1336 return parent->GetMaxPinNumber();
1338 int maxPinNumber = 0;
1343 long currentPinNumber = 0;
1345 if(
pin->GetNumber().ToLong( ¤tPinNumber ) )
1346 maxPinNumber = std::max( maxPinNumber, (
int) currentPinNumber );
1349 return maxPinNumber;
1358 item.ClearTempFlags();
1367 item.ClearEditFlags();
1376 if( ( aUnit && item.m_unit && aUnit != item.m_unit )
1377 || ( aBodyStyle && item.m_bodyStyle && aBodyStyle != item.m_bodyStyle )
1383 if( item.HitTest( aPoint ) )
1412 const std::vector<KICAD_T>& aScanTypes )
1417 if( item.IsType( aScanTypes ) )
1442 if( it->m_unit > aCount )
1449 else if( aDuplicateDrawItems )
1456 std::vector<SCH_ITEM*> tmp;
1460 if( item.m_unit != 1 )
1463 for(
int j = prevCount + 1; j <= aCount; j++ )
1467 tmp.push_back( newItem );
1482 if( std::shared_ptr<LIB_SYMBOL> parent =
m_parent.lock() )
1483 return parent->GetUnitCount();
1497 if( aDuplicateDrawItems || aDuplicatePins )
1499 std::vector<SCH_ITEM*> tmp;
1503 if( item.Type() !=
SCH_PIN_T && !aDuplicateDrawItems )
1506 if( item.m_bodyStyle == 1 )
1510 tmp.push_back( newItem );
1526 if( i->m_bodyStyle > 1 )
1539 std::vector<SCH_ITEM*> unitItems;
1546 if( ( aBodyStyle == -1 && item.GetUnit() == aUnit )
1547 || ( aUnit == -1 && item.GetBodyStyle() == aBodyStyle )
1548 || ( aUnit == item.GetUnit() && aBodyStyle == item.GetBodyStyle() ) )
1550 unitItems.push_back( &item );
1560 std::vector<LIB_SYMBOL_UNIT> units;
1567 int unit = item.GetUnit();
1568 int bodyStyle = item.GetBodyStyle();
1570 auto it = std::find_if( units.begin(), units.end(),
1573 return a.m_unit == unit && a.m_bodyStyle == bodyStyle;
1576 if( it == units.end() )
1579 newUnit.
m_unit = item.GetUnit();
1581 newUnit.
m_items.push_back( &item );
1582 units.emplace_back( newUnit );
1586 it->m_items.push_back( &item );
1596#define REPORT( msg ) { if( aReporter ) aReporter->Report( msg ); }
1597#define ITEM_DESC( item ) ( item )->GetItemDescription( &unitsProvider, false )
1626 REPORT(
_(
"Power flag differs." ) );
1635 REPORT(
_(
"Unit count differs." ) );
1643 std::set<const SCH_ITEM*, SCH_ITEM::cmp_items> aShapes;
1644 std::set<const SCH_FIELD*> aFields;
1645 std::set<const SCH_PIN*> aPins;
1650 aShapes.insert( &(*it) );
1652 aFields.insert(
static_cast<const SCH_FIELD*
>( &(*it) ) );
1654 aPins.insert(
static_cast<const SCH_PIN*
>( &(*it) ) );
1657 std::set<const SCH_ITEM*, SCH_ITEM::cmp_items> bShapes;
1658 std::set<const SCH_FIELD*> bFields;
1659 std::set<const SCH_PIN*> bPins;
1664 bShapes.insert( &(*it) );
1666 bFields.insert(
static_cast<const SCH_FIELD*
>( &(*it) ) );
1668 bPins.insert(
static_cast<const SCH_PIN*
>( &(*it) ) );
1671 if(
int tmp =
static_cast<int>( aShapes.size() - bShapes.size() ) )
1674 REPORT(
_(
"Graphic item count differs." ) );
1681 for(
auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ )
1683 if(
int tmp2 = (*aIt)->compare( *(*bIt), aCompareFlags ) )
1686 REPORT( wxString::Format(
_(
"Graphic item differs: %s; %s." ),
1696 for(
const SCH_PIN* aPin : aPins )
1698 const SCH_PIN* bPin = aRhs.
GetPin( aPin->GetNumber(), aPin->GetUnit(), aPin->GetBodyStyle() );
1703 REPORT( wxString::Format(
_(
"Extra pin in schematic symbol: %s." ),
ITEM_DESC( aPin ) ) );
1708 else if(
int tmp = aPin->SCH_ITEM::compare( *bPin, aCompareFlags ) )
1711 REPORT( wxString::Format(
_(
"Pin %s differs: %s; %s" ),
1721 for(
const SCH_PIN* bPin : bPins )
1723 const SCH_PIN* aPin = aRhs.
GetPin( bPin->GetNumber(), bPin->GetUnit(), bPin->GetBodyStyle() );
1728 REPORT( wxString::Format(
_(
"Missing pin in schematic symbol: %s." ),
ITEM_DESC( bPin ) ) );
1735 for(
const SCH_FIELD* aField : aFields )
1739 if( aField->IsMandatory() )
1740 bField = aRhs.
GetField( aField->GetId() );
1742 bField = aRhs.
GetField( aField->GetName() );
1747 REPORT( wxString::Format(
_(
"Extra field in schematic symbol: %s." ),
ITEM_DESC( aField ) ) );
1761 tmp = aField->GetText().compare( bField->
GetText() );
1767 tmp = aField->SCH_ITEM::compare( *bField, aCompareFlags );
1773 REPORT( wxString::Format(
_(
"Field '%s' differs: %s; %s." ),
1774 aField->GetName(
false ),
1784 for(
const SCH_FIELD* bField : bFields )
1788 if( bField->IsMandatory() )
1789 aField = aRhs.
GetField( bField->GetId() );
1791 aField = aRhs.
GetField( bField->GetName() );
1796 REPORT( wxString::Format(
_(
"Missing field in schematic symbol: %s." ),
ITEM_DESC( bField ) ) );
1806 REPORT(
_(
"Footprint filter count differs." ) );
1813 for(
size_t i = 0; i <
m_fpFilters.GetCount(); i++ )
1818 REPORT(
_(
"Footprint filters differ." ) );
1829 REPORT(
_(
"Symbol keywords differ." ) );
1838 REPORT(
_(
"Symbol pin name offsets differ." ) );
1849 REPORT(
_(
"Show pin names settings differ." ) );
1858 REPORT(
_(
"Show pin numbers settings differ." ) );
1867 REPORT(
_(
"Exclude from simulation settings differ." ) );
1876 REPORT(
_(
"Exclude from bill of materials settings differ." ) );
1885 REPORT(
_(
"Exclude from board settings differ." ) );
1921 return Compare( *tmp, aCompareFlags );
1930 double similarity = 0.0;
1939 double max_similarity = 0.0;
1943 double temp_similarity = item.Similarity( otherItem );
1944 max_similarity = std::max( max_similarity, temp_similarity );
1946 if( max_similarity == 1.0 )
1950 similarity += max_similarity;
1956 double max_similarity = 0.0;
1960 double temp_similarity =
pin->Similarity( *otherPin );
1961 max_similarity = std::max( max_similarity, temp_similarity );
1963 if( max_similarity == 1.0 )
1967 similarity += max_similarity;
1970 if( totalItems == 0 )
1973 similarity /= totalItems;
2024 std::set<KIFONT::OUTLINE_FONT*>
fonts;
2032 if(
auto* font =
text.GetFont(); font && !font->IsStroke() )
2037 if( permission == EMBEDDING_PERMISSION::EDITABLE
2038 || permission == EMBEDDING_PERMISSION::INSTALLABLE )
2040 fonts.insert( outline );
2066 if(
group.contains( aPinNumber ) )
2070 return std::nullopt;
2081 const wxString groupFields =
_HKI(
"Fields" );
2099 const wxString groupSymbolDef =
_HKI(
"Symbol Definition" );
2108 const wxString groupPinDisplay =
_HKI(
"Pin Display" );
2124 const wxString groupAttributes =
_HKI(
"Attributes" );
2136 const wxString groupUnits =
_HKI(
"Units and Body Styles" );
2145 auto multiBodyStyle =
2149 return symbol->IsMultiBodyStyle();
2160 wxPGChoices choices;
2164 for(
int ii = 1; ii <= symbol->GetBodyStyleCount(); ii++ )
2165 choices.Add( symbol->GetBodyStyleDescription( ii,
false ) );
constexpr EDA_IU_SCALE schIUScale
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
static const COLOR4D WHITE
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
virtual void ClearEditFlags()
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
EDA_ITEM_FLAGS GetFlags() const
virtual void ClearTempFlags()
FILL_T GetFillMode() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
virtual void SetVisible(bool aVisible)
EMBEDDED_FILES & operator=(EMBEDDED_FILES &&other) noexcept
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
High-level wrapper for evaluating mathematical and string expressions in wxString format.
wxString Evaluate(const wxString &aInput)
Main evaluation function - processes input string and evaluates all} expressions.
Class that other classes need to inherit from, in order to be inspectable.
Class OUTLINE_FONT implements outline font drawing.
EMBEDDING_PERMISSION GetEmbeddingPermission() const
A color representation with 4 components: red, green, blue, alpha.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Object used to load, save, search, and otherwise manipulate symbol library files.
Define a library symbol object.
LIB_ITEMS_CONTAINER m_drawings
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
SCH_FIELD & GetDescriptionField()
Return reference to the description field.
const LIB_ID & GetLibId() const override
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true, bool aIgnoreLabelsOnInvisiblePins=true) const
Get the bounding box for the symbol.
wxString GetKeyWords() const override
std::weak_ptr< LIB_SYMBOL > & GetParent()
wxString GetBodyStyleProp() const override
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.
wxString GetRefProp() const
bool PinsConflictWith(const LIB_SYMBOL &aOtherSymbol, bool aTestNums, bool aTestNames, bool aTestType, bool aTestOrientation, bool aTestLength) const
Return true if this symbol's pins do not match another symbol's pins.
bool GetUnitsInterchangeableProp() const
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
bool IsPower() const override
wxString GetShownKeyWords(int aDepth=0) const override
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
std::weak_ptr< LIB_SYMBOL > m_parent
Use for inherited symbols.
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of SCH_ITEM objects separated by unit and convert number.
std::map< int, wxString > m_unitDisplayNames
std::vector< std::set< wxString > > m_jumperPinGroups
A list of jumper pin groups, each of which is a set of pin numbers that should be jumpered together (...
void ClearTempFlags() override
Clears the status flag all draw objects in this symbol.
void SetKeywordsProp(const wxString &aKeywords)
std::map< int, wxString > & GetUnitDisplayNames()
bool m_demorgan
True if there are two body styles: normal and De Morgan If false, the body style count is taken from ...
wxString GetFootprint() override
For items with footprint fields.
const wxString GetLibraryName() const
void SetFields(const std::vector< SCH_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
std::vector< SEARCH_TERM > GetSearchTerms() override
void SetLib(LEGACY_SYMBOL_LIB *aLibrary)
bool GetPowerSymbolProp() const
bool IsMultiBodyStyle() const override
int GetMaxPinNumber() const
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.
SCH_FIELD & GetFootprintField()
Return reference to the footprint field.
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0, REPORTER *aReporter=nullptr) const
Comparison test that can be used for operators.
void FixupDrawItems()
This function finds the filled draw items that are covering up smaller draw items and replaces their ...
SCH_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
bool IsNormal() const override
void SetUnitsInterchangeableProp(bool aInterchangeable)
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
LEGACY_SYMBOL_LIB * m_library
SCH_FIELD * FindFieldCaseInsensitive(const wxString &aFieldName)
wxString m_keyWords
Search keywords.
SCH_ITEM * LocateDrawItem(int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
static wxString LetterSubReference(int aUnit, wxChar aInitialLetter)
double Similarity(const SCH_ITEM &aSymbol) const override
Return a measure of similarity between this symbol and aSymbol.
static LIB_SYMBOL * GetDummy()
Returns a dummy LIB_SYMBOL, used when one is missing in the schematic.
void PlotFields(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot symbol fields.
wxString GetDatasheetProp() const
std::shared_ptr< LIB_SYMBOL > GetRootSymbol() const
Get the parent symbol that does not have another parent.
void SetRefProp(const wxString &aRef)
void SetParent(LIB_SYMBOL *aParent=nullptr)
std::vector< UNIT_PIN_INFO > GetUnitPinInfo() const
Return pin-number lists for each unit, ordered consistently for gate swapping.
wxString GetName() const override
void SetUnitCount(int aCount, bool aDuplicateDrawItems)
Set the units per symbol count.
std::shared_ptr< LIB_SYMBOL > m_me
wxString GetValueProp() const
bool GetExcludedFromBOMProp() const
void SetKeyWords(const wxString &aKeyWords)
SCH_FIELD & GetValueField()
Return reference to the value field.
bool IsLocalPower() const override
LIB_SYMBOL(const wxString &aName, LIB_SYMBOL *aParent=nullptr, LEGACY_SYMBOL_LIB *aLibrary=nullptr)
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
void GetChooserFields(std::map< wxString, wxString > &aColumnMap) override
Retrieves a key/value map of the fields on this item that should be exposed to the library browser/ch...
bool HasLegacyAlternateBodyStyle() const
Before V10 we didn't store the number of body styles in a symbol – we just looked through all its dra...
std::shared_ptr< LIB_SYMBOL > SharedPtr() const
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared.
bool GetPinNamesInsideProp() const
const std::vector< wxString > & GetBodyStyleNames() const
void SetBodyStyleProp(const wxString &aBodyStyle) override
int compare(const SCH_ITEM &aOther, int aCompareFlags=SCH_ITEM::COMPARE_FLAGS::EQUALITY) const override
The library symbol specific sort order is as follows:
timestamp_t m_lastModDate
void SetExcludedFromSimProp(bool aExclude)
std::optional< const std::set< wxString > > GetJumperPinGroup(const wxString &aPinNumber) const
Retrieves the jumper group containing the specified pin number, if one exists.
std::vector< SCH_PIN * > GetPins() const override
void SetBodyStyleCount(int aCount, bool aDuplicateDrawItems, bool aDuplicatePins)
Set or clear the alternate body style (DeMorgan) for the symbol.
wxString GetLibNickname() const override
Sets the Description field text value.
void SetFootprintProp(const wxString &aFootprint)
std::vector< LOGICAL_PIN > GetLogicalPins(int aUnit, int aBodyStyle) const
Return all logical pins (expanded) filtered by unit/body.
bool HasDeMorganBodyStyles() const override
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
void Move(const VECTOR2I &aOffset) override
Move the symbol aOffset.
void SetFPFilters(const wxArrayString &aFilters)
void CopyFields(std::vector< SCH_FIELD > &aList)
Create a copy of the SCH_FIELDs, sorted in ordinal order.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
bool GetExcludedFromSimProp() const
int GetBodyStyleCount() const override
void SetDatasheetProp(const wxString &aDatasheet)
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...
EMBEDDED_FILES * GetEmbeddedFiles() override
void SetPowerSymbolProp(bool aIsPower)
void SetExcludedFromBOMProp(bool aExclude)
int m_unitCount
Number of units (parts) per package.
wxString GetShownDescription(int aDepth=0) const override
bool IsGlobalPower() const override
wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const override
unsigned GetInheritanceDepth() const
Get the number of parents for this symbol.
int GetUnitCount() const override
wxString GetKeywordsProp() const
std::vector< wxString > m_bodyStyleNames
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
void SetValueProp(const wxString &aValue)
int GetPinCount() override
void SetLibId(const LIB_ID &aLibId)
void AddField(SCH_FIELD *aField)
Add a field.
void ClearEditFlags() override
bool GetLocalPowerSymbolProp() const
LIB_ID GetLIB_ID() const override
bool m_duplicatePinNumbersAreJumpers
Flag that this symbol should automatically treat sets of two or more pins with the same number as jum...
void SetUnitProp(int aUnits)
wxString GetFootprintProp() const
void SetPinNamesInsideProp(bool aInside)
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
void EmbedFonts() override
void SetLocalPowerSymbolProp(bool aIsLocalPower)
virtual void SetName(const wxString &aName)
SCH_FIELD & GetReferenceField()
Return reference to the reference designator field.
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this symbol.
static constexpr int FIRST_TYPE
ITERATOR_BASE< SCH_ITEM, MULTIVECTOR< SCH_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
ITERATOR end(int aType=UNDEFINED_TYPE)
static constexpr int LAST_TYPE
ITERATOR begin(int aType=UNDEFINED_TYPE)
Base plotter engine class.
bool GetColorMode() const
virtual void SetColor(const COLOR4D &color)=0
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.
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.
A pure virtual class used to derive REPORTER objects from.
wxString GetFullText(int unit=1) const
Return the text of a field.
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
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
bool ShowInChooser() const
void SetText(const wxString &aText) override
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
VECTOR2I GetPosition() const override
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
A base class for LIB_SYMBOL and SCH_SYMBOL.
void SetExcludedFromBoard(bool aExcludeFromBoard) override
Set or clear exclude from board netlist flag.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
int GetPinNameOffset() const
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
bool GetExcludedFromBoard() const override
virtual void SetExcludedFromSim(bool aExcludeFromSim, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
virtual bool GetShowPinNames() const
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
SYMBOL & operator=(const SYMBOL &aItem)
virtual bool GetShowPinNumbers() const
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
int m_pinNameOffset
The offset in mils to draw the pin name.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
#define DEFAULT_PIN_NAME_OFFSET
The intersheets references prefix string.
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
#define IGNORE_PARENT_GROUP
#define IS_NEW
New item, just created.
#define STRUCT_DELETED
flag indication structures to be erased
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FILLED_WITH_BG_BODYCOLOR
TRANSFORM DefaultTransform
const wxChar *const traceStackedPins
Flag to enable debug output for stacked pins handling in symbol/pin code.
static struct LIB_SYMBOL_DESC _LIB_SYMBOL_DESC
bool operator<(const LIB_SYMBOL &aItem1, const LIB_SYMBOL &aItem2)
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
@ PT_SIZE
Size expressed in distance units (mm/inch)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Logical pins: Return expanded logical pins based on stacked-pin notation.
std::vector< wxString > m_pinNumbers
int m_bodyStyle
The alternate body style of the unit.
std::vector< SCH_ITEM * > m_items
The items unique to this unit and alternate body style.
int m_unit
The unit number.
A structure for storing weighted search terms.
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
void operator()(void const *) const
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ 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".
wxLogTrace helper definitions.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I