KiCad PCB EDA Suite
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-2022 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_item.h>
33#include <lib_field.h>
34#include <vector>
35#include <multivector.h>
36
37class LINE_READER;
38class OUTPUTFORMATTER;
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
130 void ClearCaches();
131
132 virtual wxString GetClass() const override
133 {
134 return wxT( "LIB_SYMBOL" );
135 }
136
137 virtual void SetName( const wxString& aName );
138 wxString GetName() const override { return m_name; }
139
140 LIB_ID& LibId() { return m_libId; }
141 LIB_ID GetLibId() const override { return m_libId; }
142 void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; }
143
145 void SetSourceLibId( const LIB_ID& aLibId ) { m_sourceLibId = aLibId; }
146
147 wxString GetLibNickname() const override { return GetLibraryName(); }
148
149 void SetDescription( const wxString& aDescription ) { m_description = aDescription; }
150
151 wxString GetDescription() override
152 {
153 if( m_description.IsEmpty() && IsAlias() )
154 {
155 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
156 return parent->GetDescription();
157 }
158
159 return m_description;
160 }
161
162 void SetKeyWords( const wxString& aKeyWords ) { m_keyWords = aKeyWords; }
163
164 wxString GetKeyWords() const
165 {
166 if( m_keyWords.IsEmpty() && IsAlias() )
167 {
168 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
169 return parent->GetKeyWords();
170 }
171
172 return m_keyWords;
173 }
174
175 wxString GetSearchText() override;
176
177 wxString GetFootprint() override
178 {
179 return GetFootprintField().GetText();
180 }
181
182 void GetChooserFields( std::map<wxString , wxString>& aColumnMap ) override;
183
187 bool IsRoot() const override { return m_parent.use_count() == 0; }
188 bool IsAlias() const { return !m_parent.expired() && m_parent.use_count() > 0; }
189
190 const wxString GetLibraryName() const;
191
192 SYMBOL_LIB* GetLib() const { return m_library; }
193 void SetLib( SYMBOL_LIB* aLibrary ) { m_library = aLibrary; }
194
196
197 void SetFPFilters( const wxArrayString& aFilters ) { m_fpFilters = aFilters; }
198
199 wxArrayString GetFPFilters() const
200 {
201 if( m_fpFilters.IsEmpty() && IsAlias() )
202 {
203 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
204 return parent->GetFPFilters();
205 }
206
207 return m_fpFilters;
208 }
209
210 void ViewGetLayers( int aLayers[], int& aCount ) const override;
211
222 const BOX2I GetUnitBoundingBox( int aUnit, int aConvert, bool aIgnoreHiddenFields = true ) const;
223
234 const BOX2I GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
235 bool aIncludePrivateItems ) const;
236
237 const BOX2I GetBoundingBox() const override
238 {
239 return GetUnitBoundingBox( 0, 0 );
240 }
241
242 bool IsPower() const;
243 bool IsNormal() const;
244
245 void SetPower();
246 void SetNormal();
247
252 void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
253
258 bool UnitsLocked() const { return m_unitsLocked; }
259
265 void SetFields( const std::vector<LIB_FIELD>& aFieldsList );
266
272 void GetFields( std::vector<LIB_FIELD*>& aList );
273 void GetFields( std::vector<LIB_FIELD>& aList );
274
278 void AddField( LIB_FIELD* aField );
279
280 void AddField( LIB_FIELD& aField ) { AddField( new LIB_FIELD( aField ) ); }
281
286 LIB_FIELD* FindField( const wxString& aFieldName );
287
288 const LIB_FIELD* FindField( const wxString& aFieldName ) const;
289
296 LIB_FIELD* GetFieldById( int aId ) const;
297
300
303
306
309
310 wxString GetPrefix();
311
320
321 int GetNextAvailableFieldId() const;
322
332 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti, int aConvert,
333 const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed );
334
344 void PrintBackground( const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti,
345 int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed );
346
360 void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
361 const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed ) const;
362
375 void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
376 const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed, bool aPlotHidden = true );
377
384 void AddDrawItem( LIB_ITEM* aItem, bool aSort = true );
385
391 void RemoveDrawItem( LIB_ITEM* aItem );
392
393 void RemoveField( LIB_FIELD* aField ) { RemoveDrawItem( aField ); }
394
395 size_t GetPinCount() const { return m_drawings.size( LIB_PIN_T ); }
396
397 size_t GetFieldCount() const { return m_drawings.size( LIB_FIELD_T ); }
398
410 void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 ) const;
411
416 std::vector<LIB_PIN*> GetAllLibPins() const;
417
421 size_t GetFullPinCount() { return GetAllLibPins().size(); }
422
432 LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 ) const;
433
445 bool PinsConflictWith( const LIB_SYMBOL& aOtherSymbol, bool aTestNums, bool aTestNames,
446 bool aTestType, bool aTestOrientation, bool aTestLength ) const;
447
453 void SetOffset( const VECTOR2I& aOffset );
454
459
465 bool HasConversion() const;
466
471 int GetMaxPinNumber() const;
472
476 void ClearTempFlags();
477 void ClearEditFlags();
478
488 LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint );
489
500 LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint,
501 const TRANSFORM& aTransform );
502
509 const LIB_ITEMS_CONTAINER& GetDrawItems() const { return m_drawings; }
510
511 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
512 const std::vector<KICAD_T>& aScanTypes ) override;
513
525 void SetUnitCount( int aCount, bool aDuplicateDrawItems = true );
526 int GetUnitCount() const override;
527
531 wxString GetUnitReference( int aUnit ) override;
532
536 bool HasUnitDisplayName( int aUnit ) override;
537
541 wxString GetUnitDisplayName( int aUnit ) override;
542
546 void CopyUnitDisplayNames( std::map<int, wxString>& aTarget ) const;
547
551 void SetUnitDisplayName( int aUnit, const wxString& aName );
552
557 bool IsMulti() const { return m_unitCount > 1; }
558
567 static wxString SubReference( int aUnit, bool aAddSeparator = true );
568
569 // Accessors to sub ref parameters
571
576 static int GetSubpartFirstId() { return m_subpartFirstId; }
577
581 static int* SubpartFirstIdPtr() { return &m_subpartFirstId; }
582
593 static void SetSubpartIdNotation( int aSep, int aFirstId );
594
607 void SetConversion( bool aSetConvert, bool aDuplicatePins = true );
608
616 void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
617 int GetPinNameOffset() const { return m_pinNameOffset; }
618
624 void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
625 bool ShowPinNames() const { return m_showPinNames; }
626
632 void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
633 bool ShowPinNumbers() const { return m_showPinNumbers; }
634
640 void SetIncludeInBom( bool aIncludeInBom ) { m_includeInBom = aIncludeInBom; }
641 bool GetIncludeInBom() const { return m_includeInBom; }
642
648 void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_includeOnBoard = aIncludeOnBoard; }
649 bool GetIncludeOnBoard() const { return m_includeOnBoard; }
650
660 int Compare( const LIB_SYMBOL& aRhs, int aCompareFlags = 0 ) const;
661
662 bool operator==( const LIB_SYMBOL* aSymbol ) const { return this == aSymbol; }
663 bool operator==( const LIB_SYMBOL& aSymbol ) const
664 {
665 return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
666 }
667
668 bool operator!=( const LIB_SYMBOL& aSymbol ) const
669 {
670 return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) != 0;
671 }
672
673 const LIB_SYMBOL& operator=( const LIB_SYMBOL& aSymbol );
674
682 std::unique_ptr< LIB_SYMBOL > Flatten() const;
683
690 std::vector<struct LIB_SYMBOL_UNIT> GetUnitDrawItems();
691
700 std::vector<struct LIB_SYMBOL_UNIT> GetUniqueUnits();
701
712 std::vector<LIB_ITEM*> GetUnitDrawItems( int aUnit, int aConvert );
713
714#if defined(DEBUG)
715 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
716#endif
717
718private:
719 // We create a different set parent function for this class, so we hide the inherited one.
721
722 void deleteAllFields();
723
724private:
730
734
739
743
745
747 wxString m_name;
749 wxString m_keyWords;
750 wxArrayString m_fpFilters;
752
756 static int m_subpartFirstId;
759 std::map<int, wxString> m_unitDisplayNames;
760};
761
762#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:492
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:87
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Definition: kiid.h:48
Field object used in symbol libraries.
Definition: lib_field.h:61
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:61
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:744
void SetIncludeOnBoard(bool aIncludeOnBoard)
Set or clear include in board netlist flag.
Definition: lib_symbol.h:648
void Plot(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
Definition: lib_symbol.cpp:702
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print just the background fills of a symbol.
Definition: lib_symbol.cpp:617
bool operator!=(const LIB_SYMBOL &aSymbol) const
Definition: lib_symbol.h:668
void ClearTempFlags()
Clears the status flag all draw objects in this symbol.
static int GetSubpartIdSeparator()
Definition: lib_symbol.h:570
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:742
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
Definition: lib_symbol.cpp:794
void RemoveField(LIB_FIELD *aField)
Definition: lib_symbol.h:393
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:886
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
Definition: lib_symbol.h:624
bool IsMulti() const
Definition: lib_symbol.h:557
int GetPinNameOffset() const
Definition: lib_symbol.h:617
wxString GetPrefix()
void SetSourceLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:145
wxString GetKeyWords() const
Definition: lib_symbol.h:164
void SetConversion(bool aSetConvert, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
Definition: lib_symbol.h:756
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:258
int GetNextAvailableFieldId() const
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
Definition: lib_symbol.h:187
bool operator==(const LIB_SYMBOL *aSymbol) const
Definition: lib_symbol.h:662
std::map< int, wxString > m_unitDisplayNames
Definition: lib_symbol.h:759
SYMBOL_LIB * m_library
Definition: lib_symbol.h:746
wxString GetFootprint() override
For items with footprint fields.
Definition: lib_symbol.h:177
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
Definition: lib_symbol.cpp:399
const wxString GetLibraryName() const
Definition: lib_symbol.cpp:536
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Definition: lib_symbol.h:616
timestamp_t GetLastModDate() const
Definition: lib_symbol.h:195
LIB_ID GetSourceLibId() const
Definition: lib_symbol.h:144
bool IsAlias() const
Definition: lib_symbol.h:188
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(const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
Definition: lib_symbol.cpp:101
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:725
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_symbol.cpp:982
bool IsPower() const
Definition: lib_symbol.cpp:545
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_symbol.h:237
bool GetIncludeOnBoard() const
Definition: lib_symbol.h:649
wxString m_name
Definition: lib_symbol.h:747
bool operator==(const LIB_SYMBOL &aSymbol) const
Definition: lib_symbol.h:663
void SetPower()
Definition: lib_symbol.cpp:554
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:749
bool m_includeInBom
Definition: lib_symbol.h:740
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
bool ShowPinNames() const
Definition: lib_symbol.h:625
void RemoveDuplicateDrawItems()
Remove duplicate draw items from list.
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
Definition: lib_symbol.h:252
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
Definition: lib_symbol.h:632
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:508
LIB_ID GetLibId() const override
Definition: lib_symbol.h:141
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:444
wxString GetName() const override
Definition: lib_symbol.h:138
void SetDescription(const wxString &aDescription)
Definition: lib_symbol.h:149
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
Definition: lib_symbol.h:753
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:735
void SetKeyWords(const wxString &aKeyWords)
Definition: lib_symbol.h:162
bool m_showPinNumbers
Definition: lib_symbol.h:738
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.
Definition: lib_symbol.cpp:820
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
wxArrayString GetFPFilters() const
Definition: lib_symbol.h:199
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:74
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:581
void PlotLibFields(PLOTTER *aPlotter, int aUnit, int aConvert, 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:742
timestamp_t m_lastModDate
Definition: lib_symbol.h:729
bool m_includeOnBoard
Definition: lib_symbol.h:741
LIB_ID m_libId
Definition: lib_symbol.h:727
void SetLib(SYMBOL_LIB *aLibrary)
Definition: lib_symbol.h:193
static int GetSubpartFirstId()
Definition: lib_symbol.h:576
wxString m_description
Definition: lib_symbol.h:748
std::vector< struct LIB_SYMBOL_UNIT > GetUniqueUnits()
Return a list of unit numbers that are unique to this symbol.
wxString GetLibNickname() const override
Definition: lib_symbol.h:147
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 BOX2I GetBodyBoundingBox(int aUnit, int aConvert, bool aIncludePins, bool aIncludePrivateItems) const
Get the symbol bounding box excluding fields.
Definition: lib_symbol.cpp:994
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or '.
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
Definition: lib_symbol.cpp:184
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:732
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:750
void SetFPFilters(const wxArrayString &aFilters)
Definition: lib_symbol.h:197
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
Definition: lib_symbol.cpp:393
bool IsNormal() const
Definition: lib_symbol.cpp:563
size_t GetFieldCount() const
Definition: lib_symbol.h:397
LIB_SYMBOL_SPTR SharedPtr() const
Definition: lib_symbol.h:110
size_t GetPinCount() const
Definition: lib_symbol.h:395
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
const BOX2I GetUnitBoundingBox(int aUnit, int aConvert, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:953
bool GetIncludeInBom() const
Definition: lib_symbol.h:641
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:387
static int * SubpartIdSeparatorPtr()
Return a reference to m_subpartIdSeparator, only for read/save setting functions.
Definition: lib_symbol.h:575
wxString GetDescription() override
Definition: lib_symbol.h:151
std::vector< LIB_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
Definition: lib_symbol.cpp:858
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:731
virtual wxString GetClass() const override
Return the class name.
Definition: lib_symbol.h:132
LIB_ID m_sourceLibId
For database library symbols; the original symbol.
Definition: lib_symbol.h:728
void AddField(LIB_FIELD &aField)
Definition: lib_symbol.h:280
void ClearCaches()
Definition: lib_symbol.cpp:523
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:726
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:831
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:453
LIB_ID & LibId()
Definition: lib_symbol.h:140
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0) const
Comparison test that can be used for operators.
Definition: lib_symbol.cpp:233
SYMBOL_LIB * GetLib() const
Definition: lib_symbol.h:192
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
void SetIncludeInBom(bool aIncludeInBom)
Set or clear the include in schematic bill of materials flag.
Definition: lib_symbol.h:640
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:142
void deleteAllFields()
size_t GetFullPinCount()
Definition: lib_symbol.h:421
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print symbol.
Definition: lib_symbol.cpp:651
LIB_SYMBOL_REF & GetParent()
Definition: lib_symbol.h:127
LIB_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aConvert=0) const
Return pin object with the requested pin aNumber.
Definition: lib_symbol.cpp:868
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:421
void SetOffset(const VECTOR2I &aOffset)
Move the symbol aOffset.
wxString GetSearchText() override
Definition: lib_symbol.cpp:49
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:437
bool m_showPinNames
Definition: lib_symbol.h:737
void SetNormal()
Definition: lib_symbol.cpp:572
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
Definition: lib_symbol.cpp:412
bool ShowPinNumbers() const
Definition: lib_symbol.h:633
static int * SubpartFirstIdPtr()
Return a reference to m_subpartFirstId, only for read/save setting functions.
Definition: lib_symbol.h:581
const LIB_ITEMS_CONTAINER & GetDrawItems() const
Definition: lib_symbol.h:509
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
Definition: lib_tree_item.h:40
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:225
boost::ptr_vector< LIB_ITEM > ITEM_PTR_VECTOR
Helper for defining a list of library draw object pointers.
Definition: multivector.h:64
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:310
Base plotter engine class.
Definition: plotter.h:110
Object used to load, save, search, and otherwise manipulate symbol library files.
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
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:45
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:54
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:86
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_convert
The alternate body style of the unit.
Definition: lib_symbol.h:87
int m_unit
The unit number.
Definition: lib_symbol.h:86
TRANSFORM DefaultTransform
Definition: transform.cpp:34
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ LIB_PIN_T
Definition: typeinfo.h:202
@ LIB_FIELD_T
Definition: typeinfo.h:208