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 (C) 2004-2023 KiCad Developers, see change_log.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 CLASS_LIBENTRY_H
28#define CLASS_LIBENTRY_H
29
30#include <general.h>
31#include <lib_tree_item.h>
32#include <lib_field.h>
33#include <vector>
34#include <core/multivector.h>
35
36class LINE_READER;
37class OUTPUTFORMATTER;
38class REPORTER;
39class SYMBOL_LIB;
40class LIB_SYMBOL;
41class LIB_FIELD;
43
44
45typedef std::shared_ptr<LIB_SYMBOL> LIB_SYMBOL_SPTR;
46typedef std::weak_ptr<LIB_SYMBOL> LIB_SYMBOL_REF;
49
50
51/* values for member .m_options */
53{
54 ENTRY_NORMAL, // Libentry is a standard symbol (real or alias)
55 ENTRY_POWER // Libentry is a power symbol
56};
57
58
59extern bool operator<( const LIB_SYMBOL& aItem1, const LIB_SYMBOL& aItem2 );
60
61
63{
64 TRANSFORM transform; // Coordinate adjustment settings
65 bool force_draw_pin_text; // Whether or not to force the drawing of pin names and numbers
66 bool draw_visible_fields; // Whether to draw "visible" fields
67 bool draw_hidden_fields; // Whether to draw "hidden" fields
68 bool show_elec_type; // Whether to show the pin electrical type
69 bool show_connect_point; // Whether to show the pin connect point marker (small circle)
70 // useful in dialog pin properties
71
73 {
75 force_draw_pin_text = false;
77 draw_hidden_fields = true;
78 show_elec_type = false;
79 show_connect_point = false;
80 }
81};
82
83
85{
86 int m_unit;
88 std::vector<LIB_ITEM*> m_items;
89};
90
91
98class LIB_SYMBOL : public EDA_ITEM, public LIB_TREE_ITEM
99{
100public:
101 LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
102 SYMBOL_LIB* aLibrary = nullptr );
103
104 LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr );
105
106 virtual ~LIB_SYMBOL()
107 {}
108
110 LIB_SYMBOL_SPTR SharedPtr() const { return m_me; }
111
115 virtual LIB_SYMBOL* Duplicate() const
116 {
117 LIB_SYMBOL* dupe = new LIB_SYMBOL( *this, m_library );
118 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
119
120 for( LIB_ITEM& item : dupe->m_drawings )
121 const_cast<KIID&>( item.m_Uuid ) = KIID();
122
123 return dupe;
124 }
125
126 void SetParent( LIB_SYMBOL* aParent = nullptr );
128 const LIB_SYMBOL_REF& GetParent() const { return m_parent; }
129
135 unsigned GetInheritanceDepth() const;
136
146
147 void ClearCaches();
148
149 virtual wxString GetClass() const override
150 {
151 return wxT( "LIB_SYMBOL" );
152 }
153
154 static inline bool ClassOf( const EDA_ITEM* aItem )
155 {
156 return aItem && aItem->Type() == LIB_SYMBOL_T;
157 }
158
159 virtual void SetName( const wxString& aName );
160 wxString GetName() const override { return m_name; }
161
162 LIB_ID& LibId() { return m_libId; }
163 LIB_ID GetLibId() const override { return m_libId; }
164 void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; }
165
167 void SetSourceLibId( const LIB_ID& aLibId ) { m_sourceLibId = aLibId; }
168
169 wxString GetLibNickname() const override { return GetLibraryName(); }
170
172 void SetDescription( const wxString& aDescription )
173 {
174 GetDescriptionField().SetText( aDescription );
175 }
176
178 wxString GetDescription() override
179 {
180 if( GetDescriptionField().GetText().IsEmpty() && IsAlias() )
181 {
182 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
183 return parent->GetDescription();
184 }
185
186 return GetDescriptionField().GetText();
187 }
188
189 void SetKeyWords( const wxString& aKeyWords ) { m_keyWords = aKeyWords; }
190
191 wxString GetKeyWords() const
192 {
193 if( m_keyWords.IsEmpty() && IsAlias() )
194 {
195 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
196 return parent->GetKeyWords();
197 }
198
199 return m_keyWords;
200 }
201
202 std::vector<SEARCH_TERM> GetSearchTerms() override;
203
204 wxString GetFootprint() override
205 {
206 return GetFootprintField().GetText();
207 }
208
209 void GetChooserFields( std::map<wxString , wxString>& aColumnMap ) override;
210
214 bool IsRoot() const override { return m_parent.use_count() == 0; }
215 bool IsAlias() const { return !m_parent.expired() && m_parent.use_count() > 0; }
216
217 const wxString GetLibraryName() const;
218
219 SYMBOL_LIB* GetLib() const { return m_library; }
220 void SetLib( SYMBOL_LIB* aLibrary ) { m_library = aLibrary; }
221
223
224 void SetFPFilters( const wxArrayString& aFilters ) { m_fpFilters = aFilters; }
225
226 wxArrayString GetFPFilters() const
227 {
228 if( m_fpFilters.IsEmpty() && IsAlias() )
229 {
230 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
231 return parent->GetFPFilters();
232 }
233
234 return m_fpFilters;
235 }
236
237 void ViewGetLayers( int aLayers[], int& aCount ) const override;
238
249 const BOX2I GetUnitBoundingBox( int aUnit, int aBodyStyle,
250 bool aIgnoreHiddenFields = true ) const;
251
262 const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
263 bool aIncludePrivateItems ) const;
264
265 const BOX2I GetBoundingBox() const override
266 {
267 return GetUnitBoundingBox( 0, 0 );
268 }
269
270 bool IsPower() const;
271 bool IsNormal() const;
272
273 void SetPower();
274 void SetNormal();
275
280 void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
281
286 bool UnitsLocked() const { return m_unitsLocked; }
287
293 void SetFields( const std::vector<LIB_FIELD>& aFieldsList );
294
300 void GetFields( std::vector<LIB_FIELD*>& aList );
301 void GetFields( std::vector<LIB_FIELD>& aList );
302
306 void AddField( LIB_FIELD* aField );
307
308 void AddField( LIB_FIELD& aField ) { AddField( new LIB_FIELD( aField ) ); }
309
318 LIB_FIELD* FindField( const wxString& aFieldName, bool aCaseInsensitive = false );
319
320 const LIB_FIELD* FindField( const wxString& aFieldName,
321 const bool aCaseInsensitive = false ) const;
322
329 LIB_FIELD* GetFieldById( int aId ) const;
330
333
336
339
342
345
346 wxString GetPrefix();
347
348 void RunOnChildren( const std::function<void( LIB_ITEM* )>& aFunction );
349
358
359 int GetNextAvailableFieldId() const;
360
370 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti,
371 int aBodyStyle, const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed );
372
382 void PrintBackground( const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti,
383 int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed );
384
398 void Plot( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
399 const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed ) const;
400
413 void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
414 const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed,
415 bool aPlotHidden = true );
416
423 void AddDrawItem( LIB_ITEM* aItem, bool aSort = true );
424
430 void RemoveDrawItem( LIB_ITEM* aItem );
431
432 void RemoveField( LIB_FIELD* aField ) { RemoveDrawItem( aField ); }
433
434 size_t GetFieldCount() const { return m_drawings.size( LIB_FIELD_T ); }
435
447 void GetPins( LIB_PINS& aList, int aUnit = 0, int aBodyStyle = 0 ) const;
448
453 std::vector<LIB_PIN*> GetAllLibPins() const;
454
458 int GetPinCount() override;
459
469 LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aBodyStyle = 0 ) const;
470
482 bool PinsConflictWith( const LIB_SYMBOL& aOtherSymbol, bool aTestNums, bool aTestNames,
483 bool aTestType, bool aTestOrientation, bool aTestLength ) const;
484
490 void SetOffset( const VECTOR2I& aOffset );
491
496
502 bool HasAlternateBodyStyle() const;
503
508 int GetMaxPinNumber() const;
509
513 void ClearTempFlags();
514 void ClearEditFlags();
515
525 LIB_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint );
526
537 LIB_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint,
538 const TRANSFORM& aTransform );
539
546 const LIB_ITEMS_CONTAINER& GetDrawItems() const { return m_drawings; }
547
552 void FixupDrawItems();
553
554 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
555 const std::vector<KICAD_T>& aScanTypes ) override;
556
568 void SetUnitCount( int aCount, bool aDuplicateDrawItems = true );
569 int GetUnitCount() const override;
570
574 wxString GetUnitReference( int aUnit ) override;
575
579 bool HasUnitDisplayName( int aUnit ) override;
580
584 wxString GetUnitDisplayName( int aUnit ) override;
585
589 void CopyUnitDisplayNames( std::map<int, wxString>& aTarget ) const;
590
594 void SetUnitDisplayName( int aUnit, const wxString& aName );
595
600 bool IsMulti() const { return m_unitCount > 1; }
601
602 static wxString LetterSubReference( int aUnit, int aFirstId );
603
615 void SetHasAlternateBodyStyle( bool aHasAlternate, bool aDuplicatePins = true );
616
624 void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
625 int GetPinNameOffset() const { return m_pinNameOffset; }
626
632 void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
633 bool ShowPinNames() const { return m_showPinNames; }
634
640 void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
641 bool ShowPinNumbers() const { return m_showPinNumbers; }
642
648 void SetExcludedFromSim( bool aExcludeFromSim ) { m_excludedFromSim = aExcludeFromSim; }
649 bool GetExcludedFromSim() const { return m_excludedFromSim; }
650
656 void SetExcludedFromBOM( bool aExcludeFromBOM ) { m_excludedFromBOM = aExcludeFromBOM; }
657 bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
658
664 void SetExcludedFromBoard( bool aExcludeFromBoard ) { m_excludedFromBoard = aExcludeFromBoard; }
666
676 int Compare( const LIB_SYMBOL& aRhs, int aCompareFlags = 0,
677 REPORTER* aReporter = nullptr ) const;
678
679 bool operator==( const LIB_SYMBOL* aSymbol ) const { return this == aSymbol; }
680 bool operator==( const LIB_SYMBOL& aSymbol ) const;
681 bool operator!=( const LIB_SYMBOL& aSymbol ) const
682 {
683 return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) != 0;
684 }
685
686 const LIB_SYMBOL& operator=( const LIB_SYMBOL& aSymbol );
687
695 std::unique_ptr< LIB_SYMBOL > Flatten() const;
696
703 std::vector<struct LIB_SYMBOL_UNIT> GetUnitDrawItems();
704
713 std::vector<struct LIB_SYMBOL_UNIT> GetUniqueUnits();
714
725 std::vector<LIB_ITEM*> GetUnitDrawItems( int aUnit, int aBodyStyle );
726
733 double Similarity( const LIB_SYMBOL& aSymbol ) const;
734#if defined(DEBUG)
735 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
736#endif
737
738private:
739 // We create a different set parent function for this class, so we hide the inherited one.
741
742 void deleteAllFields();
743
744private:
750
754
759
764
766
768 wxString m_name;
769 wxString m_keyWords;
770 wxArrayString m_fpFilters;
772
773 std::map<int, wxString> m_unitDisplayNames;
774};
775
776#endif // CLASS_LIBENTRY_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
const KIID m_Uuid
Definition: eda_item.h:482
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:183
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Definition: kiid.h:49
Field object used in symbol libraries.
Definition: lib_field.h:62
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:68
@ EQUALITY
Definition: lib_item.h:96
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:765
bool HasAlternateBodyStyle() const
Test if symbol has more than one body conversion type (DeMorgan).
bool operator!=(const LIB_SYMBOL &aSymbol) const
Definition: lib_symbol.h:681
void ClearTempFlags()
Clears the status flag all draw objects in this symbol.
LIB_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:763
void PlotLibFields(PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed, bool aPlotHidden=true)
Plot Lib Fields only of the symbol to plotter.
Definition: lib_symbol.cpp:906
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
void RunOnChildren(const std::function< void(LIB_ITEM *)> &aFunction)
void RemoveField(LIB_FIELD *aField)
Definition: lib_symbol.h:432
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.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
Definition: lib_symbol.h:632
bool IsMulti() const
Definition: lib_symbol.h:600
int GetPinNameOffset() const
Definition: lib_symbol.h:625
wxString GetPrefix()
void SetSourceLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:167
wxString GetKeyWords() const
Definition: lib_symbol.h:191
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
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:286
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
int GetNextAvailableFieldId() const
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:214
bool operator==(const LIB_SYMBOL *aSymbol) const
Definition: lib_symbol.h:679
std::map< int, wxString > m_unitDisplayNames
Definition: lib_symbol.h:773
SYMBOL_LIB * m_library
Definition: lib_symbol.h:767
wxString GetFootprint() override
For items with footprint fields.
Definition: lib_symbol.h:204
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:551
const wxString GetLibraryName() const
Definition: lib_symbol.cpp:695
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
std::vector< SEARCH_TERM > GetSearchTerms() override
Definition: lib_symbol.cpp:40
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Definition: lib_symbol.h:624
timestamp_t GetLastModDate() const
Definition: lib_symbol.h:222
LIB_ID GetSourceLibId() const
Definition: lib_symbol.h:166
bool IsAlias() const
Definition: lib_symbol.h:215
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of LIB_ITEM objects separated by unit and convert number.
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:115
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:745
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
bool IsPower() const
Definition: lib_symbol.cpp:704
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_symbol.h:265
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0, REPORTER *aReporter=nullptr) const
Comparison test that can be used for operators.
Definition: lib_symbol.cpp:248
void FixupDrawItems()
This function finds the filled draw items that are covering up smaller draw items and replaces their ...
Definition: lib_symbol.cpp:958
static wxString LetterSubReference(int aUnit, int aFirstId)
Definition: lib_symbol.cpp:760
wxString m_name
Definition: lib_symbol.h:768
void SetPower()
Definition: lib_symbol.cpp:718
static bool ClassOf(const EDA_ITEM *aItem)
Definition: lib_symbol.h:154
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:769
void GetPins(LIB_PINS &aList, int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
bool ShowPinNames() const
Definition: lib_symbol.h:633
LIB_FIELD & GetDescriptionField()
Return reference to the description field.
void RemoveDuplicateDrawItems()
Remove duplicate draw items from list.
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
Definition: lib_symbol.h:280
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
Definition: lib_symbol.h:640
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:545
LIB_ID GetLibId() const override
Definition: lib_symbol.h:163
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:596
wxString GetName() const override
Definition: lib_symbol.h:160
void SetDescription(const wxString &aDescription)
Gets the Description field text value *‍/.
Definition: lib_symbol.h:172
const LIB_SYMBOL_REF & GetParent() const
Definition: lib_symbol.h:128
void ClearEditFlags()
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:755
void SetKeyWords(const wxString &aKeyWords)
Definition: lib_symbol.h:189
LIB_FIELD * FindField(const wxString &aFieldName, bool aCaseInsensitive=false)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
bool m_showPinNumbers
Definition: lib_symbol.h:758
void GetFields(std::vector< LIB_FIELD * > &aList)
Return a list of fields within this symbol.
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:226
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print symbol.
Definition: lib_symbol.cpp:814
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
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
Definition: lib_symbol.h:656
timestamp_t m_lastModDate
Definition: lib_symbol.h:749
double Similarity(const LIB_SYMBOL &aSymbol) const
Return a measure of similarity between this symbol and aSymbol.
LIB_ID m_libId
Definition: lib_symbol.h:747
void SetLib(SYMBOL_LIB *aLibrary)
Definition: lib_symbol.h:220
bool GetExcludedFromBOM() const
Definition: lib_symbol.h:657
std::vector< struct LIB_SYMBOL_UNIT > GetUniqueUnits()
Return a list of unit numbers that are unique to this symbol.
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
Definition: lib_symbol.h:664
wxString GetLibNickname() const override
Sets the Description field text value.
Definition: lib_symbol.h:169
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:106
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
Definition: lib_symbol.cpp:180
LIB_FIELD & GetValueField()
Return reference to the value field.
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:752
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:770
bool m_excludedFromSim
Definition: lib_symbol.h:760
bool GetExcludedFromSim() const
Definition: lib_symbol.h:649
void SetFPFilters(const wxArrayString &aFilters)
Definition: lib_symbol.h:224
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
Definition: lib_symbol.cpp:545
bool IsNormal() const
Definition: lib_symbol.cpp:732
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print just the background fills of a symbol.
Definition: lib_symbol.cpp:779
size_t GetFieldCount() const
Definition: lib_symbol.h:434
const BOX2I GetBodyBoundingBox(int aUnit, int aBodyStyle, bool aIncludePins, bool aIncludePrivateItems) const
Get the symbol bounding box excluding fields.
LIB_SYMBOL_SPTR SharedPtr() const
Definition: lib_symbol.h:110
bool m_excludedFromBOM
Definition: lib_symbol.h:761
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...
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
Definition: lib_symbol.cpp:539
wxString GetDescription() override
Definition: lib_symbol.h:178
void Plot(PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
Definition: lib_symbol.cpp:865
std::vector< LIB_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:751
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:149
LIB_ID m_sourceLibId
For database library symbols; the original symbol.
Definition: lib_symbol.h:748
void AddField(LIB_FIELD &aField)
Definition: lib_symbol.h:308
void ClearCaches()
Definition: lib_symbol.cpp:682
unsigned GetInheritanceDepth() const
Get the number of parents for this symbol.
Definition: lib_symbol.cpp:229
int GetUnitCount() const override
For items with units, return the number of units.
void AddField(LIB_FIELD *aField)
Add a field.
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:746
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:605
LIB_ID & LibId()
Definition: lib_symbol.h:162
SYMBOL_LIB * GetLib() const
Definition: lib_symbol.h:219
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
int GetPinCount() override
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:164
void deleteAllFields()
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:127
bool m_excludedFromBoard
Definition: lib_symbol.h:762
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
Definition: lib_symbol.cpp:527
void SetFields(const std::vector< LIB_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
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:573
void SetOffset(const VECTOR2I &aOffset)
Move the symbol aOffset.
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:589
bool m_showPinNames
Definition: lib_symbol.h:757
void SetNormal()
Definition: lib_symbol.cpp:746
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
Definition: lib_symbol.cpp:564
LIB_ITEM * LocateDrawItem(int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
bool ShowPinNumbers() const
Definition: lib_symbol.h:641
void SetExcludedFromSim(bool aExcludeFromSim)
Set or clear the exclude from simulation flag.
Definition: lib_symbol.h:648
const LIB_ITEMS_CONTAINER & GetDrawItems() const
Definition: lib_symbol.h:546
bool GetExcludedFromBoard() const
Definition: lib_symbol.h:665
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< LIB_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:104
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
Object used to load, save, search, and otherwise manipulate symbol library files.
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:46
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
TRANSFORM DefaultTransform
Definition: transform.cpp:32
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
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:61
MULTIVECTOR< LIB_ITEM, LIB_SHAPE_T, LIB_FIELD_T > LIB_ITEMS_CONTAINER
Definition: lib_symbol.h:47
LIBRENTRYOPTIONS
Definition: lib_symbol.h:53
@ ENTRY_NORMAL
Definition: lib_symbol.h:54
@ ENTRY_POWER
Definition: lib_symbol.h:55
std::weak_ptr< LIB_SYMBOL > LIB_SYMBOL_REF
weak pointer to LIB_SYMBOL
Definition: lib_symbol.h:46
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:45
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
Definition: lib_symbol.h:48
bool operator<(const LIB_SYMBOL &aItem1, const LIB_SYMBOL &aItem2)
Definition: lib_symbol.cpp:83
bool draw_visible_fields
Definition: lib_symbol.h:66
bool force_draw_pin_text
Definition: lib_symbol.h:65
TRANSFORM transform
Definition: lib_symbol.h:64
std::vector< LIB_ITEM * > m_items
The items unique to this unit and alternate body style.
Definition: lib_symbol.h:88
int m_bodyStyle
The alternate body style of the unit.
Definition: lib_symbol.h:87
int m_unit
The unit number.
Definition: lib_symbol.h:86
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ LIB_SYMBOL_T
Definition: typeinfo.h:202
@ LIB_FIELD_T
Definition: typeinfo.h:212