KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2014 Dick Hollenbeck, [email protected]
6 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 2022 CERN
8 * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, you may find one here:
22 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23 * or you may search the http://www.gnu.org website for the version 2 license,
24 * or you may write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#ifndef __SYMBOL_H__
29#define __SYMBOL_H__
30
31#include <eda_item.h>
32#include <core/typeinfo.h>
33#include <layer_ids.h>
34#include <lib_id.h>
35#include <widgets/msgpanel.h>
36
37#include <memory>
38#include <string>
39#include <unordered_map>
40#include <vector>
41#include <wx/arrstr.h>
42#include <wx/chartype.h>
43#include <wx/fdrepdlg.h>
44#include <wx/gdicmn.h>
45#include <wx/string.h>
46
47#include <sch_field.h>
48#include <sch_item.h>
49#include <sch_pin.h>
50#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
51#include <symbol_lib_table.h>
52#include <transform.h>
53
54struct PICKED_SYMBOL;
55class KIID_PATH;
56class SCH_SCREEN;
57class LIB_ITEM;
58class LIB_PIN;
59class LIB_SYMBOL;
60class NETLIST_OBJECT_LIST;
61class SYMBOL_LIB;
62class SYMBOL_LIBS;
63class EE_COLLECTOR;
64class SCH_SCREEN;
66
67
69typedef std::vector<SCH_FIELD> SCH_FIELDS;
70
71typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
72
73
74extern std::string toUTFTildaText( const wxString& txt );
75
76
80class SCH_SYMBOL : public SCH_ITEM
81{
82public:
83 SCH_SYMBOL();
84
95 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
96 int aUnit, int aConvert = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
97 EDA_ITEM* aParent = nullptr );
98
99 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
100 const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
101
111 SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
112
114
115 static inline bool ClassOf( const EDA_ITEM* aItem )
116 {
117 return aItem && SCH_SYMBOL_T == aItem->Type();
118 }
119
120 wxString GetClass() const override
121 {
122 return wxT( "SCH_SYMBOL" );
123 }
124
138 bool IsMissingLibSymbol() const;
139
140 const std::vector<SCH_SYMBOL_INSTANCE>& GetInstanceReferences() const
141 {
143 }
144
145 bool GetInstance( SCH_SYMBOL_INSTANCE& aInstance,
146 const KIID_PATH& aSheetPath, bool aTestFromEnd = false ) const;
147
148 void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
149
150 void SortInstances( bool ( *aSortFunction )( const SCH_SYMBOL_INSTANCE& aLhs,
151 const SCH_SYMBOL_INSTANCE& aRhs ) );
152
153 void ViewGetLayers( int aLayers[], int& aCount ) const override;
154
169 bool IsMovableFromAnchorPoint() const override;
170
171 void SetLibId( const LIB_ID& aName );
172
173 const LIB_ID& GetLibId() const { return m_lib_id; }
174
186 void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
187 wxString GetSchSymbolLibraryName() const;
188 bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
189
190 std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
191 const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
192
209 void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
210
214 wxString GetDescription() const;
215
219 wxString GetKeyWords() const;
220
224 wxString GetDatasheet() const;
225
226 int GetUnit() const { return m_unit; }
227
231 void UpdatePins();
232
242 void SetUnit( int aUnit );
243
249 bool HasUnitDisplayName( int aUnit );
250
256 wxString GetUnitDisplayName( int aUnit );
257
266 void UpdateUnit( int aUnit );
267
268 int GetConvert() const { return m_convert; }
269
270 void SetConvert( int aConvert );
271
272 wxString GetPrefix() const { return m_prefix; }
273
274 void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
275
279 void UpdatePrefix();
280
282 const TRANSFORM& GetTransform() const { return m_transform; }
283
284 void SetTransform( const TRANSFORM& aTransform );
285
291 int GetUnitCount() const;
292
299 void SetOrientation( int aOrientation );
300
316 int GetOrientation() const;
317
321 void GetContextualTextVars( wxArrayString* aVars ) const;
322
328 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth = 0 ) const;
329
330 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
331
342 void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
343
355 bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
356
357
358 const BOX2I GetBoundingBox() const override;
359
364
369
370
371 //-----<Fields>-----------------------------------------------------------
372
381 SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
382 const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
383
391 SCH_FIELD* GetFieldById( int aFieldId );
392
400 SCH_FIELD* GetFieldByName( const wxString& aFieldName );
401
402 const SCH_FIELD* GetFieldByName( const wxString& aFieldName ) const;
403
409 wxString GetFieldText( const wxString& aFieldName ) const;
410
417 void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
418
422 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
423 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
424
432 SCH_FIELD* AddField( const SCH_FIELD& aField );
433
439 void RemoveField( const wxString& aFieldName );
440
441 void RemoveField( SCH_FIELD* aField ) { RemoveField( aField->GetName() ); }
442
452 SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true,
453 bool aCaseInsensitive = false );
454
455 const wxString GetValueFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
456 bool aAllowExtraText ) const;
457 void SetValueFieldText( const wxString& aValue );
458
459 const wxString GetFootprintFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
460 bool aAllowExtraText ) const;
461 void SetFootprintFieldText( const wxString& aFootprint );
462
473 void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
474 bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
475
479 int GetFieldCount() const { return (int)m_fields.size(); }
480
490 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
491
492 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
493
494
495 //-----</Fields>----------------------------------------------------------
496
497
504 SCH_PIN* GetPin( const wxString& number ) const;
505
511 void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
512
517 std::vector<LIB_PIN*> GetAllLibPins() const;
518
522 size_t GetFullPinCount() { return GetAllLibPins().size(); }
523
527 SCH_PIN* GetPin( LIB_PIN* aLibPin ) const;
528
537 std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
538
539
540 std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
541
549 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
550
558 void PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
559
560 void SwapData( SCH_ITEM* aItem ) override;
561
570 static bool IsReferenceStringValid( const wxString& aReferenceString );
571
577 const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
578
585 void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
586
593 bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
594
606 void AddHierarchicalReference( const KIID_PATH& aPath,
607 const wxString& aRef,
608 int aUnit );
609
610 void AddHierarchicalReference( const SCH_SYMBOL_INSTANCE& aInstance );
611
613 int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
614
616 void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
617
619 void SetUnitSelection( int aUnitSelection );
620
621 // Geometric transforms (used in block operations):
622
623 void Move( const VECTOR2I& aMoveVector ) override
624 {
625 if( aMoveVector == VECTOR2I( 0, 0 ) )
626 return;
627
628 m_pos += aMoveVector;
629
630 for( SCH_FIELD& field : m_fields )
631 field.Move( aMoveVector );
632 }
633
634 void MirrorHorizontally( int aCenter ) override;
635 void MirrorVertically( int aCenter ) override;
636 void Rotate( const VECTOR2I& aCenter ) override;
637
638 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
639
640 void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
641
652 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
653 const SCH_SHEET_PATH* aPath = nullptr ) override;
654
655 VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
656
657 bool IsConnectable() const override { return true; }
658
659 bool CanConnect( const SCH_ITEM* aItem ) const override
660 {
661 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
662 ( aItem->Type() == SCH_NO_CONNECT_T ) ||
663 ( aItem->Type() == SCH_JUNCTION_T ) ||
664 ( aItem->Type() == SCH_SYMBOL_T ) ||
665 ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
666 ( aItem->Type() == SCH_LABEL_T ) ||
667 ( aItem->Type() == SCH_HIER_LABEL_T ) ||
668 ( aItem->Type() == SCH_GLOBAL_LABEL_T );
669 }
670
674 bool IsInNetlist() const;
675
676 std::vector<VECTOR2I> GetConnectionPoints() const override;
677
678 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
679 const std::vector<KICAD_T>& aScanTypes ) override;
680
688 LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
689
690 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
691
692 BITMAPS GetMenuImage() const override;
693
694 bool operator <( const SCH_ITEM& aItem ) const override;
695
696 bool operator==( const SCH_SYMBOL& aSymbol) const;
697 bool operator!=( const SCH_SYMBOL& aSymbol) const;
698
699 SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
700
701 bool IsReplaceable() const override { return true; }
702
703 VECTOR2I GetPosition() const override { return m_pos; }
704 void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
705
706 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
707 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
708
709 void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
710
718 void PlotPins( PLOTTER* aPlotter ) const;
719
726 void PlotDNP( PLOTTER* aPlotter ) const;
727
728 EDA_ITEM* Clone() const override;
729
730#if defined(DEBUG)
731 void Show( int nestLevel, std::ostream& os ) const override;
732#endif
733
734 void ClearBrightenedPins();
735
736 bool HasBrightenedPins();
737
738 bool GetExcludedFromSim() const override { return m_excludedFromSim; }
739 void SetExcludedFromSim( bool aExclude ) override { m_excludedFromSim = aExclude; }
740
741 bool GetExcludedFromBOM() const { return m_excludedFromBOM; }
742 void SetExcludedFromBOM( bool aIncludeInBOM ) { m_excludedFromBOM = aIncludeInBOM; }
743
745 void SetExcludedFromBoard( bool aIncludeOnBoard ) { m_excludedFromBoard = aIncludeOnBoard; }
746
747 bool GetDNP() const { return m_DNP; }
748 void SetDNP( bool aDNP ) { m_DNP = aDNP; }
749
750 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
751
757 bool IsSymbolLikePowerGlobalLabel() const;
758
759 bool IsPower() const;
760
761private:
762 BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
763
764 bool doIsConnected( const VECTOR2I& aPosition ) const override;
765
766 void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
767
770 int m_unit;
774 wxString m_prefix;
778
787
789 std::vector<SCH_FIELD> m_fields;
790
791 std::unique_ptr< LIB_SYMBOL > m_part;
793 std::vector<std::unique_ptr<SCH_PIN>> m_pins;
794 std::unordered_map<LIB_PIN*, unsigned> m_pinMap;
795
800 bool m_DNP;
801
802 // Defines the hierarchical path and reference of the symbol. This allows support
803 // for multiple references to a single sub-sheet.
804 std::vector<SCH_SYMBOL_INSTANCE> m_instanceReferences;
805
807 static std::unordered_map<TRANSFORM, int> s_transformToOrientationCache;
808};
809
810#endif /* __SYMBOL_H__ */
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
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
Define a library symbol object.
Definition: lib_symbol.h:99
Base plotter engine class.
Definition: plotter.h:104
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:52
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: sch_field.cpp:996
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:257
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:81
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:282
void UpdatePrefix()
Set the prefix based on the current reference designator.
Definition: sch_symbol.cpp:757
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
Definition: sch_symbol.h:774
SCH_FIELD * GetFieldByName(const wxString &aFieldName)
Return a field in this symbol.
Definition: sch_symbol.cpp:882
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:418
bool IsSymbolLikePowerGlobalLabel() const
VECTOR2I m_pos
Definition: sch_symbol.h:768
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
Definition: sch_symbol.h:769
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:399
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:329
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:287
bool HasBrightenedPins()
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:422
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:455
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...
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
size_t GetFullPinCount()
Definition: sch_symbol.h:522
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:540
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_symbol.h:704
void PlotDNP(PLOTTER *aPlotter) const
Plot the red 'X' over the symbol.
bool operator!=(const SCH_SYMBOL &aSymbol) const
LIB_ITEM * GetDrawItem(const VECTOR2I &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
int GetUnit() const
Definition: sch_symbol.h:226
bool IsConnectable() const override
Definition: sch_symbol.h:657
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:479
void SetDNP(bool aDNP)
Definition: sch_symbol.h:748
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:393
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:120
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
Definition: sch_symbol.cpp:534
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:701
const std::vector< SCH_SYMBOL_INSTANCE > & GetInstanceReferences() const
Definition: sch_symbol.h:140
void PlotPins(PLOTTER *aPlotter) const
Plot just the symbol pins.
bool UseLibIdLookup() const
Definition: sch_symbol.h:188
void SetValueFieldText(const wxString &aValue)
Definition: sch_symbol.cpp:836
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:942
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:771
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:293
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true, bool aCaseInsensitive=false)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:955
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:665
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:115
bool IsInNetlist() const
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:623
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
library pin pointer : SCH_PIN's index
Definition: sch_symbol.h:794
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
void ClearBrightenedPins()
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:236
void SetExcludedFromSim(bool aExclude) override
Definition: sch_symbol.h:739
bool m_excludedFromSim
True to exclude from simulation.
Definition: sch_symbol.h:797
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:858
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
bool m_excludedFromBoard
True to exclude from netlist when updating board.
Definition: sch_symbol.h:799
static std::unordered_map< TRANSFORM, int > s_transformToOrientationCache
Definition: sch_symbol.h:807
VECTOR2I GetPinPhysicalPosition(const LIB_PIN *Pin) const
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:338
int GetConvert() const
Definition: sch_symbol.h:268
std::vector< SCH_SYMBOL_INSTANCE > m_instanceReferences
Definition: sch_symbol.h:804
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:191
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
void UpdateFields(const SCH_SHEET_PATH *aPath, bool aUpdateStyle, bool aUpdateRef, bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields)
Restore fields to the original library values.
Definition: sch_symbol.cpp:978
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:786
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
Definition: sch_symbol.cpp:707
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath, bool aResetPrefix)
Clear exiting symbol annotation.
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
const wxString GetFootprintFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
Definition: sch_symbol.cpp:842
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print only the background parts of a symbol (if any)
Definition: sch_symbol.cpp:443
wxString GetDescription() const
Definition: sch_symbol.cpp:311
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
Definition: sch_symbol.h:789
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:770
void SetFootprintFieldText(const wxString &aFootprint)
Definition: sch_symbol.cpp:852
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
bool GetExcludedFromBOM() const
Definition: sch_symbol.h:741
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit)
Add a full hierarchical reference to this symbol.
Definition: sch_symbol.cpp:563
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
Definition: sch_symbol.cpp:242
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:703
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:411
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:423
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:659
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
Definition: sch_symbol.cpp:205
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_symbol.cpp:251
bool GetExcludedFromSim() const override
Definition: sch_symbol.h:738
bool operator<(const SCH_ITEM &aItem) const override
bool m_DNP
True if symbol is set to 'Do Not Populate'.
Definition: sch_symbol.h:800
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
wxString GetKeyWords() const
Definition: sch_symbol.cpp:320
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:186
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:870
bool GetInstance(SCH_SYMBOL_INSTANCE &aInstance, const KIID_PATH &aSheetPath, bool aTestFromEnd=false) const
Definition: sch_symbol.cpp:510
TRANSFORM & GetTransform()
Definition: sch_symbol.h:281
bool HasUnitDisplayName(int aUnit)
Return true if the given unit aUnit has a display name set.
Definition: sch_symbol.cpp:435
void SetExcludedFromBOM(bool aIncludeInBOM)
Definition: sch_symbol.h:742
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:933
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
Test if the symbol's dangling state has changed for all pins.
const wxString GetValueFieldText(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const
Definition: sch_symbol.cpp:826
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
int GetOrientation() const
Get the display symbol orientation.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:743
void RemoveField(SCH_FIELD *aField)
Definition: sch_symbol.h:441
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:796
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:784
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:387
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:173
wxString GetUnitDisplayName(int aUnit)
Return the display name for a given unit aUnit.
Definition: sch_symbol.cpp:427
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
TRANSFORM m_transform
The rotation/mirror transformation.
Definition: sch_symbol.h:788
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
std::vector< LIB_PIN * > GetAllLibPins() const
bool GetExcludedFromBoard() const
Definition: sch_symbol.h:744
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:274
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:800
bool m_excludedFromBOM
True to exclude from bill of materials export.
Definition: sch_symbol.h:798
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:190
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every LIB_PIN (all units)
Definition: sch_symbol.h:793
void SetExcludedFromBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:745
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:701
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:302
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
void SortInstances(bool(*aSortFunction)(const SCH_SYMBOL_INSTANCE &aLhs, const SCH_SYMBOL_INSTANCE &aRhs))
Definition: sch_symbol.cpp:556
wxString GetFieldText(const wxString &aFieldName) const
Search for a field named aFieldName and returns text associated with this field.
Definition: sch_symbol.cpp:906
wxString GetPrefix() const
Definition: sch_symbol.h:272
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
Definition: sch_symbol.cpp:266
bool IsPower() const
std::unique_ptr< LIB_SYMBOL > m_part
a flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
Definition: sch_symbol.h:791
bool operator==(const SCH_SYMBOL &aSymbol) const
bool GetDNP() const
Definition: sch_symbol.h:747
A collection of SYMBOL_LIB objects.
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
@ LAYER_WIRE
Definition: layer_ids.h:349
Message panel definition file.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::string toUTFTildaText(const wxString &txt)
Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is ...
Definition: sch_symbol.cpp:54
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition: sch_symbol.h:71
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:69
A simple container for schematic symbol instance information.
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:145
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:142
@ TYPE_NOT_INIT
Definition: typeinfo.h:81
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:153
@ SCH_LABEL_T
Definition: typeinfo.h:150
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:152
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:151
@ SCH_JUNCTION_T
Definition: typeinfo.h:141
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588