KiCad PCB EDA Suite
Loading...
Searching...
No Matches
lib_symbol.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2022 CERN
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef LIB_SYMBOL_H
28#define LIB_SYMBOL_H
29
30#include <embedded_files.h>
31#include <symbol.h>
32#include <sch_field.h>
33#include <sch_pin.h>
34#include <lib_tree_item.h>
35#include <vector>
36#include <core/multivector.h>
37
38class LINE_READER;
39class OUTPUTFORMATTER;
40class REPORTER;
41class SYMBOL_LIB;
42class LIB_SYMBOL;
43class OUTLINE_FONT;
45
46namespace KIFONT
47{
48 class OUTLINE_FONT;
49}
50
51
52typedef std::shared_ptr<LIB_SYMBOL> LIB_SYMBOL_SPTR;
53typedef std::weak_ptr<LIB_SYMBOL> LIB_SYMBOL_REF;
56
57
58/* values for member .m_options */
60{
61 ENTRY_NORMAL, // Libentry is a standard symbol (real or alias)
62 ENTRY_POWER // Libentry is a power symbol
63};
64
65
66extern bool operator<( const LIB_SYMBOL& aItem1, const LIB_SYMBOL& aItem2 );
67
68
70{
71 int m_unit;
73 std::vector<SCH_ITEM*> m_items;
74};
75
76
83class LIB_SYMBOL : public SYMBOL, public LIB_TREE_ITEM, public EMBEDDED_FILES
84{
85public:
86 LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
87 SYMBOL_LIB* aLibrary = nullptr );
88
89 LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr );
90
91 virtual ~LIB_SYMBOL()
92 {}
93
95 LIB_SYMBOL_SPTR SharedPtr() const { return m_me; }
96
100 virtual LIB_SYMBOL* Duplicate() const
101 {
102 LIB_SYMBOL* dupe = new LIB_SYMBOL( *this, m_library );
103 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
104
105 for( SCH_ITEM& item : dupe->m_drawings )
106 const_cast<KIID&>( item.m_Uuid ) = KIID();
107
108 return dupe;
109 }
110
114 static LIB_SYMBOL* GetDummy();
115
116 void SetParent( LIB_SYMBOL* aParent = nullptr );
118 const LIB_SYMBOL_REF& GetParent() const { return m_parent; }
119
125 unsigned GetInheritanceDepth() const;
126
136
137 virtual wxString GetClass() const override
138 {
139 return wxT( "LIB_SYMBOL" );
140 }
141
142 static inline bool ClassOf( const EDA_ITEM* aItem )
143 {
144 return aItem && aItem->Type() == LIB_SYMBOL_T;
145 }
146
147 virtual void SetName( const wxString& aName );
148 wxString GetName() const override { return m_name; }
149
150 LIB_ID GetLIB_ID() const override { return m_libId; }
151 wxString GetDesc() override { return GetDescription(); }
152 int GetSubUnitCount() const override { return GetUnitCount(); }
153
154 const LIB_ID& GetLibId() const override { return m_libId; }
155 void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; }
156
158 void SetSourceLibId( const LIB_ID& aLibId ) { m_sourceLibId = aLibId; }
159
160 wxString GetLibNickname() const override { return GetLibraryName(); }
161
163 void SetDescription( const wxString& aDescription )
164 {
165 GetDescriptionField().SetText( aDescription );
166 }
167
169 wxString GetDescription() const override
170 {
171 if( GetDescriptionField().GetText().IsEmpty() && IsAlias() )
172 {
173 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
174 return parent->GetDescription();
175 }
176
177 return GetDescriptionField().GetText();
178 }
179
180 void SetKeyWords( const wxString& aKeyWords ) { m_keyWords = aKeyWords; }
181
182 wxString GetKeyWords() const override
183 {
184 if( m_keyWords.IsEmpty() && IsAlias() )
185 {
186 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
187 return parent->GetKeyWords();
188 }
189
190 return m_keyWords;
191 }
192
193 std::vector<SEARCH_TERM> GetSearchTerms() override;
194
195 wxString GetFootprint() override
196 {
197 return GetFootprintField().GetText();
198 }
199
200 void GetChooserFields( std::map<wxString , wxString>& aColumnMap ) override;
201
205 bool IsRoot() const override { return m_parent.use_count() == 0; }
206 bool IsAlias() const { return !m_parent.expired() && m_parent.use_count() > 0; }
207
208 const wxString GetLibraryName() const;
209
210 SYMBOL_LIB* GetLib() const { return m_library; }
211 void SetLib( SYMBOL_LIB* aLibrary ) { m_library = aLibrary; }
212
214
215 void SetFPFilters( const wxArrayString& aFilters ) { m_fpFilters = aFilters; }
216
217 wxArrayString GetFPFilters() const
218 {
219 if( m_fpFilters.IsEmpty() && IsAlias() )
220 {
221 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
222 return parent->GetFPFilters();
223 }
224
225 return m_fpFilters;
226 }
227
238 const BOX2I GetUnitBoundingBox( int aUnit, int aBodyStyle,
239 bool aIgnoreHiddenFields = true ) const;
240
241 const BOX2I GetBoundingBox() const override
242 {
243 return GetUnitBoundingBox( 0, 0 );
244 }
245
256 const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
257 bool aIncludePrivateItems ) const;
258
259 BOX2I GetBodyBoundingBox() const override
260 {
261 return GetBodyBoundingBox( m_previewUnit, m_previewBodyStyle, false, false );
262 }
263
265 {
267 }
268
269 bool IsPower() const override;
270 bool IsNormal() const override;
271
272 void SetPower();
273 void SetNormal();
274
279 void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
280
285 bool UnitsLocked() const { return m_unitsLocked; }
286
292 void SetFields( const std::vector<SCH_FIELD>& aFieldsList );
293
299 void GetFields( std::vector<SCH_FIELD*>& aList, bool aVisibleOnly = false ) override;
300
301 void CopyFields( std::vector<SCH_FIELD>& aList );
302
306 void AddField( SCH_FIELD* aField );
307
308 void AddField( SCH_FIELD& aField ) { AddField( new SCH_FIELD( aField ) ); }
309
318 SCH_FIELD* FindField( const wxString& aFieldName, bool aCaseInsensitive = false );
319
320 const SCH_FIELD* FindField( const wxString& aFieldName,
321 bool aCaseInsensitive = false ) const;
322
329 SCH_FIELD* GetFieldById( int aId ) const;
330
332 SCH_FIELD& GetValueField() const;
333
336
339
342
345
346 wxString GetPrefix();
347
348 const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const override
349 {
350 return GetReferenceField().GetText();
351 }
352
353 const wxString GetValue( bool aResolve, const SCH_SHEET_PATH* aPath,
354 bool aAllowExtraText ) const override
355 {
356 return GetValueField().GetText();
357 }
358
359 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
360
362 const EMBEDDED_FILES* GetEmbeddedFiles() const;
363
364 void EmbedFonts() override;
365
372 void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
373
374 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
375
384
385 int GetNextAvailableFieldId() const;
386
392 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
393
394 void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
395 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
396
397 void PrintBackground( const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle,
398 const VECTOR2I& aOffset, bool aDimmed ) override;
399
400 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
401 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
402
406 void PlotFields( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
407 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed );
408
415 void AddDrawItem( SCH_ITEM* aItem, bool aSort = true );
416
422 void RemoveDrawItem( SCH_ITEM* aItem );
423
424 void RemoveField( SCH_FIELD* aField ) { RemoveDrawItem( aField ); }
425
426 size_t GetFieldCount() const { return m_drawings.size( SCH_FIELD_T ); }
427
438 std::vector<SCH_PIN*> GetPins( int aUnit, int aBodyStyle ) const;
439
444 std::vector<SCH_PIN*> GetPins() const override;
445
449 int GetPinCount() override;
450
460 SCH_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aBodyStyle = 0 ) const;
461
473 bool PinsConflictWith( const LIB_SYMBOL& aOtherSymbol, bool aTestNums, bool aTestNames,
474 bool aTestType, bool aTestOrientation, bool aTestLength ) const;
475
481 void Move( const VECTOR2I& aOffset ) override;
482
488 bool HasAlternateBodyStyle() const override;
489
494 int GetMaxPinNumber() const;
495
499 void ClearTempFlags() override;
500 void ClearEditFlags() override;
501
511 SCH_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint );
512
523 SCH_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint,
524 const TRANSFORM& aTransform );
525
532 const LIB_ITEMS_CONTAINER& GetDrawItems() const { return m_drawings; }
533
538 void FixupDrawItems();
539
540 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
541 const std::vector<KICAD_T>& aScanTypes ) override;
542
554 void SetUnitCount( int aCount, bool aDuplicateDrawItems = true );
555 int GetUnitCount() const override;
556
560 wxString GetUnitReference( int aUnit ) override;
561
565 bool HasUnitDisplayName( int aUnit ) override;
566
570 wxString GetUnitDisplayName( int aUnit ) override;
571
575 void CopyUnitDisplayNames( std::map<int, wxString>& aTarget ) const;
576
580 void SetUnitDisplayName( int aUnit, const wxString& aName );
581
586 bool IsMulti() const override { return m_unitCount > 1; }
587
588 static wxString LetterSubReference( int aUnit, int aFirstId );
589
601 void SetHasAlternateBodyStyle( bool aHasAlternate, bool aDuplicatePins = true );
602
612 int Compare( const LIB_SYMBOL& aRhs, int aCompareFlags = 0,
613 REPORTER* aReporter = nullptr ) const;
614
615 const LIB_SYMBOL& operator=( const LIB_SYMBOL& aSymbol );
616
624 std::unique_ptr< LIB_SYMBOL > Flatten() const;
625
632 std::vector<struct LIB_SYMBOL_UNIT> GetUnitDrawItems();
633
644 std::vector<SCH_ITEM*> GetUnitDrawItems( int aUnit, int aBodyStyle );
645
652 double Similarity( const SCH_ITEM& aSymbol ) const override;
653#if defined(DEBUG)
654 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
655#endif
656
657private:
658 // We create a different set parent function for this class, so we hide the inherited one.
660
666 int compare( const SCH_ITEM& aOther,
667 int aCompareFlags = SCH_ITEM::COMPARE_FLAGS::EQUALITY ) const override;
668
669 void deleteAllFields();
670
671private:
677
681
683
685
687 wxString m_name;
688 wxString m_keyWords;
689 wxArrayString m_fpFilters;
691
692 std::map<int, wxString> m_unitDisplayNames;
693};
694
695#endif // CLASS_LIBENTRY_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
const KIID m_Uuid
Definition: eda_item.h:490
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
bool IsEmpty() const
Class OUTLINE_FONT implements outline font drawing.
Definition: outline_font.h:53
Definition: kiid.h:49
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
Define a library symbol object.
Definition: lib_symbol.h:84
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:684
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
Definition: lib_symbol.cpp:495
wxString GetDescription() const override
Definition: lib_symbol.h:169
const LIB_ID & GetLibId() const override
Definition: lib_symbol.h:154
wxString GetKeyWords() const override
Definition: lib_symbol.h:182
bool IsMulti() const override
Definition: lib_symbol.h:586
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:682
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: lib_symbol.cpp:596
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.
Definition: lib_symbol.cpp:907
bool IsPower() const override
Definition: lib_symbol.cpp:418
wxString GetPrefix()
void SetSourceLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:158
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:285
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:969
int GetNextAvailableFieldId() const
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:205
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of SCH_ITEM objects separated by unit and convert number.
void RemoveField(SCH_FIELD *aField)
Definition: lib_symbol.h:424
std::map< int, wxString > m_unitDisplayNames
Definition: lib_symbol.h:692
void ClearTempFlags() override
Clears the status flag all draw objects in this symbol.
SYMBOL_LIB * m_library
Definition: lib_symbol.h:686
wxString GetFootprint() override
For items with footprint fields.
Definition: lib_symbol.h:195
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:289
const wxString GetLibraryName() const
Definition: lib_symbol.cpp:409
void SetFields(const std::vector< SCH_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
SCH_FIELD & GetValueField() const
Return reference to the value field.
std::vector< SEARCH_TERM > GetSearchTerms() override
Definition: lib_symbol.cpp:40
timestamp_t GetLastModDate() const
Definition: lib_symbol.h:213
LIB_ID GetSourceLibId() const
Definition: lib_symbol.h:157
bool IsAlias() const
Definition: lib_symbol.h:206
int GetMaxPinNumber() const
virtual LIB_SYMBOL * Duplicate() const
Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children.
Definition: lib_symbol.h:100
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:672
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.
Definition: lib_symbol.cpp:689
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_symbol.h:241
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 ...
Definition: lib_symbol.cpp:770
static wxString LetterSubReference(int aUnit, int aFirstId)
Definition: lib_symbol.cpp:476
SCH_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
Definition: lib_symbol.cpp:895
bool IsNormal() const override
Definition: lib_symbol.cpp:448
wxString m_name
Definition: lib_symbol.h:687
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
void SetPower()
Definition: lib_symbol.cpp:434
bool HasAlternateBodyStyle() const override
Test if symbol has more than one body conversion type (DeMorgan).
static bool ClassOf(const EDA_ITEM *aItem)
Definition: lib_symbol.h:142
SCH_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:688
SCH_ITEM * LocateDrawItem(int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
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.
Definition: lib_symbol.cpp:227
void PlotFields(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot symbol fields.
Definition: lib_symbol.cpp:731
SCH_FIELD & GetDatasheetField() const
Return reference to the datasheet field.
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
Definition: lib_symbol.h:279
SCH_FIELD & GetFootprintField() const
Return reference to the footprint field.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:531
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:324
wxString GetName() const override
Definition: lib_symbol.h:148
void SetDescription(const wxString &aDescription)
Gets the Description field text value *‍/.
Definition: lib_symbol.h:163
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) override
Return a list of fields within this symbol.
const LIB_SYMBOL_REF & GetParent() const
Definition: lib_symbol.h:118
void SetKeyWords(const wxString &aKeyWords)
Definition: lib_symbol.h:180
SCH_FIELD & GetReferenceField() const
Return reference to the reference designator field.
void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Print just the background fills.
Definition: lib_symbol.cpp:655
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:217
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
Definition: lib_symbol.cpp:812
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...
Definition: lib_symbol.cpp:71
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
Definition: lib_symbol.h:676
LIB_ID m_libId
Definition: lib_symbol.h:674
void SetLib(SYMBOL_LIB *aLibrary)
Definition: lib_symbol.h:211
std::vector< SCH_PIN * > GetPins() const override
Return a list of pin pointers for all units / converts.
Definition: lib_symbol.cpp:883
SCH_FIELD & GetDescriptionField() const
Return reference to the description field.
int GetSubUnitCount() const override
For items with units, return the number of units.
Definition: lib_symbol.h:152
wxString GetLibNickname() const override
Sets the Description field text value.
Definition: lib_symbol.h:160
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
virtual ~LIB_SYMBOL()
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
Definition: lib_symbol.h:91
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
Definition: lib_symbol.cpp:179
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:679
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:689
void Move(const VECTOR2I &aOffset) override
Move the symbol aOffset.
void SetFPFilters(const wxArrayString &aFilters)
Definition: lib_symbol.h:215
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
Definition: lib_symbol.cpp:283
void CopyFields(std::vector< SCH_FIELD > &aList)
size_t GetFieldCount() const
Definition: lib_symbol.h:426
LIB_SYMBOL_SPTR SharedPtr() const
Definition: lib_symbol.h:95
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
Definition: lib_symbol.h:353
wxString GetDesc() override
Definition: lib_symbol.h:151
SCH_FIELD * FindField(const wxString &aFieldName, bool aCaseInsensitive=false)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
int UpdateFieldOrdinals()
Order optional field indices.
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...
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: lib_symbol.h:348
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
Definition: lib_symbol.cpp:277
EMBEDDED_FILES * GetEmbeddedFiles() override
void AddField(SCH_FIELD &aField)
Definition: lib_symbol.h:308
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:678
void SetHasAlternateBodyStyle(bool aHasAlternate, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
virtual wxString GetClass() const override
Return the class name.
Definition: lib_symbol.h:137
LIB_ID m_sourceLibId
For database library symbols; the original symbol.
Definition: lib_symbol.h:675
unsigned GetInheritanceDepth() const
Get the number of parents for this symbol.
Definition: lib_symbol.cpp:251
int GetUnitCount() const override
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:673
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:333
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
Definition: lib_symbol.h:259
SYMBOL_LIB * GetLib() const
Definition: lib_symbol.h:210
int GetPinCount() override
Definition: lib_symbol.cpp:889
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
Definition: lib_symbol.h:264
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:155
void AddField(SCH_FIELD *aField)
Add a field.
void ClearEditFlags() override
void deleteAllFields()
LIB_ID GetLIB_ID() const override
Definition: lib_symbol.h:150
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:117
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
Definition: lib_symbol.cpp:265
void SetUnitDisplayName(int aUnit, const wxString &aName)
Set the user-defined display name for aUnit to aName for symbols with units.
Definition: lib_symbol.cpp:305
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:837
void EmbedFonts() override
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:317
void SetNormal()
Definition: lib_symbol.cpp:462
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
Definition: lib_symbol.cpp:298
const LIB_ITEMS_CONTAINER & GetDrawItems() const
Definition: lib_symbol.h:532
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
Definition: lib_tree_item.h:41
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
Multivector container type.
Definition: multivector.h:47
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:226
boost::ptr_vector< SCH_ITEM > ITEM_PTR_VECTOR
Helper for defining a list of library draw object pointers.
Definition: multivector.h:65
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
Base plotter engine class.
Definition: plotter.h:105
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
void SetText(const wxString &aText) override
Definition: sch_field.cpp:1214
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:167
@ EQUALITY
Definition: sch_item.h:646
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Object used to load, save, search, and otherwise manipulate symbol library files.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition: symbol.h:63
int m_previewBodyStyle
Definition: symbol.h:224
int m_previewUnit
Definition: symbol.h:223
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:82
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: kiid.h:46
LIBRENTRYOPTIONS
Definition: lib_symbol.h:60
@ ENTRY_NORMAL
Definition: lib_symbol.h:61
@ ENTRY_POWER
Definition: lib_symbol.h:62
std::weak_ptr< LIB_SYMBOL > LIB_SYMBOL_REF
weak pointer to LIB_SYMBOL
Definition: lib_symbol.h:53
MULTIVECTOR< SCH_ITEM, SCH_SHAPE_T, SCH_PIN_T > LIB_ITEMS_CONTAINER
Definition: lib_symbol.h:54
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:52
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
Definition: lib_symbol.h:55
bool operator<(const LIB_SYMBOL &aItem1, const LIB_SYMBOL &aItem2)
Definition: lib_symbol.cpp:83
AUTOPLACE_ALGO
Definition: sch_item.h:68
int m_bodyStyle
The alternate body style of the unit.
Definition: lib_symbol.h:72
std::vector< SCH_ITEM * > m_items
The items unique to this unit and alternate body style.
Definition: lib_symbol.h:73
int m_unit
The unit number.
Definition: lib_symbol.h:71
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_FIELD_T
Definition: typeinfo.h:150