KiCad PCB EDA Suite
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) 1992-2022 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 __SYMBOL_H__
28#define __SYMBOL_H__
29
30#include <eda_item.h>
31#include <core/typeinfo.h>
32#include <layer_ids.h>
33#include <lib_id.h>
34#include <widgets/msgpanel.h>
35
36#include <memory>
37#include <string>
38#include <unordered_map>
39#include <vector>
40#include <wx/arrstr.h>
41#include <wx/chartype.h>
42#include <wx/fdrepdlg.h>
43#include <wx/gdicmn.h>
44#include <wx/string.h>
45
46#include <sch_field.h>
47#include <sch_item.h>
48#include <sch_pin.h>
49#include <sch_sheet_path.h> // SYMBOL_INSTANCE_REFERENCE
50#include <symbol_lib_table.h>
51#include <transform.h>
52
53struct PICKED_SYMBOL;
54class KIID_PATH;
55class SCH_SCREEN;
56class LIB_ITEM;
57class LIB_PIN;
58class LIB_SYMBOL;
59class NETLIST_OBJECT_LIST;
60class SYMBOL_LIB;
61class SYMBOL_LIBS;
62class EE_COLLECTOR;
63class SCH_SCREEN;
65
66
68typedef std::vector<SCH_FIELD> SCH_FIELDS;
69
70typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
71
72
73extern std::string toUTFTildaText( const wxString& txt );
74
75
79class SCH_SYMBOL : public SCH_ITEM
80{
81public:
82 SCH_SYMBOL();
83
94 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
95 int aUnit, int aConvert = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
96 EDA_ITEM* aParent = nullptr );
97
98 SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
99 const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
100
110 SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
111
113
114 static inline bool ClassOf( const EDA_ITEM* aItem )
115 {
116 return aItem && SCH_SYMBOL_T == aItem->Type();
117 }
118
119 wxString GetClass() const override
120 {
121 return wxT( "SCH_SYMBOL" );
122 }
123
137 bool IsMissingLibSymbol() const;
138
139 const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
140 {
142 }
143
144 bool GetInstance( SYMBOL_INSTANCE_REFERENCE& aInstance,
145 const KIID_PATH& aSheetPath ) const;
146
147 void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
148
149 void SortInstances( bool ( *aSortFunction )( const SYMBOL_INSTANCE_REFERENCE& aLhs,
150 const SYMBOL_INSTANCE_REFERENCE& aRhs ) );
151
152 void ViewGetLayers( int aLayers[], int& aCount ) const override;
153
168 bool IsMovableFromAnchorPoint() const override;
169
170 void SetLibId( const LIB_ID& aName );
171
172 const LIB_ID& GetLibId() const { return m_lib_id; }
173
185 void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
186 wxString GetSchSymbolLibraryName() const;
187 bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
188
189 std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
190 const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
191
208 void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
209
213 wxString GetDescription() const;
214
218 wxString GetKeyWords() const;
219
223 wxString GetDatasheet() const;
224
225 int GetUnit() const { return m_unit; }
226
230 void UpdatePins();
231
241 void SetUnit( int aUnit );
242
248 bool HasUnitDisplayName( int aUnit );
249
255 wxString GetUnitDisplayName( int aUnit );
256
265 void UpdateUnit( int aUnit );
266
267 int GetConvert() const { return m_convert; }
268
269 void SetConvert( int aConvert );
270
271 wxString GetPrefix() const { return m_prefix; }
272
273 void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
274
276 const TRANSFORM& GetTransform() const { return m_transform; }
277
278 void SetTransform( const TRANSFORM& aTransform );
279
285 int GetUnitCount() const;
286
293 void SetOrientation( int aOrientation );
294
310 int GetOrientation() const;
311
315 void GetContextualTextVars( wxArrayString* aVars ) const;
316
322 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
323
324 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
325
336 void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath, bool aResetPrefix );
337
349 bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
350
360 bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
361
362 const BOX2I GetBoundingBox() const override;
363
368
373
374
375 //-----<Fields>-----------------------------------------------------------
376
385 SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
386 const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
387
395 SCH_FIELD* GetFieldById( int aFieldId );
396
402 wxString GetFieldText( const wxString& aFieldName ) const;
403
410 void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
411
415 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
416 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
417
425 SCH_FIELD* AddField( const SCH_FIELD& aField );
426
432 void RemoveField( const wxString& aFieldName );
433
442 SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
443
449 void SetFields( const SCH_FIELDS& aFields )
450 {
451 m_fields = aFields; // vector copying, length is changed possibly
452 }
453
464 void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
465 bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
466
470 int GetFieldCount() const { return (int)m_fields.size(); }
471
481 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
482
483 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
484
485
486 //-----</Fields>----------------------------------------------------------
487
488
495 SCH_PIN* GetPin( const wxString& number ) const;
496
502 void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
503
509 std::vector<LIB_PIN*> GetLibPins() const;
510
511 SCH_PIN* GetPin( LIB_PIN* aLibPin ) const;
512
521 std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
522
528 std::vector<SCH_PIN*> GetAllPins() const;
529
530
531 std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
532
540 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
541
549 void PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
550
551 void SwapData( SCH_ITEM* aItem ) override;
552
561 static bool IsReferenceStringValid( const wxString& aReferenceString );
562
568 const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
569
576 void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
577
584 bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
585
597 void AddHierarchicalReference( const KIID_PATH& aPath,
598 const wxString& aRef,
599 int aUnit,
600 const wxString& aValue = wxEmptyString,
601 const wxString& aFootprint = wxEmptyString );
602
604
606 int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
607
609 void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
610
612 void SetUnitSelection( int aUnitSelection );
613
615 const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
616 void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
617
619 void SetValue( const wxString& aValue )
620 {
621 SetValue( nullptr, aValue );
622 }
623
625 const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
626 void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
627
629 void SetFootprint( const wxString& aFootprint )
630 {
631 SetFootprint( nullptr, aFootprint );
632 }
633
634 // Geometric transforms (used in block operations):
635
636 void Move( const VECTOR2I& aMoveVector ) override
637 {
638 if( aMoveVector == VECTOR2I( 0, 0 ) )
639 return;
640
641 m_pos += aMoveVector;
642
643 for( SCH_FIELD& field : m_fields )
644 field.Move( aMoveVector );
645
646 SetModified();
647 }
648
649 void MirrorHorizontally( int aCenter ) override;
650 void MirrorVertically( int aCenter ) override;
651 void Rotate( const VECTOR2I& aCenter ) override;
652
653 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
654
655 void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
656
667 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
668 const SCH_SHEET_PATH* aPath = nullptr ) override;
669
670 VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
671
672 bool IsConnectable() const override { return true; }
673
674 bool CanConnect( const SCH_ITEM* aItem ) const override
675 {
676 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
677 ( aItem->Type() == SCH_NO_CONNECT_T ) ||
678 ( aItem->Type() == SCH_JUNCTION_T ) ||
679 ( aItem->Type() == SCH_SYMBOL_T ) ||
680 ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
681 ( aItem->Type() == SCH_LABEL_T ) ||
682 ( aItem->Type() == SCH_HIER_LABEL_T ) ||
683 ( aItem->Type() == SCH_GLOBAL_LABEL_T );
684 }
685
689 bool IsInNetlist() const;
690
691 std::vector<VECTOR2I> GetConnectionPoints() const override;
692
693 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
694 const std::vector<KICAD_T>& aScanTypes ) override;
695
703 LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
704
705 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
706
707 BITMAPS GetMenuImage() const override;
708
709 bool operator <( const SCH_ITEM& aItem ) const override;
710
711 bool operator==( const SCH_SYMBOL& aSymbol) const;
712 bool operator!=( const SCH_SYMBOL& aSymbol) const;
713
714 SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
715
716 bool IsReplaceable() const override { return true; }
717
718 VECTOR2I GetPosition() const override { return m_pos; }
719 void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
720
721 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
722 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
723
724 void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
725
733 void PlotPins( PLOTTER* aPlotter ) const;
734
735 EDA_ITEM* Clone() const override;
736
737#if defined(DEBUG)
738 void Show( int nestLevel, std::ostream& os ) const override;
739#endif
740
741 void ClearBrightenedPins();
742
743 bool HasBrightenedPins();
744
745 bool GetIncludeInBom() const { return m_inBom; }
746 void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
747
748 bool GetIncludeOnBoard() const { return m_onBoard; }
749 void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
750
751 bool GetDNP() const { return m_DNP; }
752 void SetDNP( bool aDNP ) { m_DNP = aDNP; }
753
754 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
755
756private:
757 BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
758
759 bool doIsConnected( const VECTOR2I& aPosition ) const override;
760
761 void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
762
765 int m_unit;
769 wxString m_prefix;
773
782
784 std::vector<SCH_FIELD> m_fields;
785
786 std::unique_ptr< LIB_SYMBOL > m_part;
788 std::vector<std::unique_ptr<SCH_PIN>> m_pins;
789 std::unordered_map<LIB_PIN*, unsigned> m_pinMap;
790
792 bool m_inBom;
794 bool m_DNP;
795
796 // Defines the hierarchical path and reference of the symbol. This allows support
797 // for multiple references to a single sub-sheet.
798 std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
799};
800
801#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
void SetModified()
Definition: eda_item.cpp:64
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:61
Define a library symbol object.
Definition: lib_symbol.h:98
Base plotter engine class.
Definition: plotter.h:110
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:50
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
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:80
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:276
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
Definition: sch_symbol.h:139
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
Definition: sch_symbol.h:769
void SetFootprint(const wxString &aFootprint)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:629
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:449
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:425
VECTOR2I m_pos
Definition: sch_symbol.h:763
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:764
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:402
void SetValue(const wxString &aValue)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:619
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:328
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:282
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
bool HasBrightenedPins()
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:415
void AddHierarchicalReference(const KIID_PATH &aPath, const wxString &aRef, int aUnit, const wxString &aValue=wxEmptyString, const wxString &aFootprint=wxEmptyString)
Add a full hierarchical reference to this symbol.
Definition: sch_symbol.cpp:528
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:462
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.
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:531
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_symbol.h:719
bool operator!=(const SCH_SYMBOL &aSymbol) const
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:798
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:225
bool IsConnectable() const override
Definition: sch_symbol.h:672
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:470
const wxString GetFootprint(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific footprint assignment for the given sheet path.
Definition: sch_symbol.cpp:836
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:968
void SetDNP(bool aDNP)
Definition: sch_symbol.h:752
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:396
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:749
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:119
void RemoveInstance(const SCH_SHEET_PATH &aInstancePath)
Definition: sch_symbol.cpp:499
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:671
void PlotPins(PLOTTER *aPlotter) const
Plot just the symbol pins.
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:798
bool UseLibIdLookup() const
Definition: sch_symbol.h:187
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:955
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:766
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:292
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:635
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:114
bool IsInNetlist() const
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:748
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:636
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
library pin pointer : SCH_PIN's index
Definition: sch_symbol.h:789
bool GetIncludeInBom() const
Definition: sch_symbol.h:745
void ClearBrightenedPins()
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:232
std::vector< SCH_PIN * > GetAllPins() const
Retrieve all SCH_PINs (from all sheets)
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:857
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:895
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
VECTOR2I GetPinPhysicalPosition(const LIB_PIN *Pin) const
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:337
int GetConvert() const
Definition: sch_symbol.h:267
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:190
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
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:982
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:781
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:677
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.
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print only the background parts of a symbol (if any)
Definition: sch_symbol.cpp:450
wxString GetDescription() const
Definition: sch_symbol.cpp:310
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
Definition: sch_symbol.h:784
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.
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:793
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:765
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
bool IsMissingLibSymbol() const
Check to see if the library symbol is set to the dummy library symbol.
Definition: sch_symbol.cpp:238
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:718
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:415
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:416
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:674
void Init(const VECTOR2I &pos=VECTOR2I(0, 0))
Definition: sch_symbol.cpp:202
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:247
bool GetInstance(SYMBOL_INSTANCE_REFERENCE &aInstance, const KIID_PATH &aSheetPath) const
Definition: sch_symbol.cpp:483
bool operator<(const SCH_ITEM &aItem) const override
bool m_DNP
True if symbol is set to 'Do Not Populate'.
Definition: sch_symbol.h:794
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
wxString GetKeyWords() const
Definition: sch_symbol.cpp:319
std::vector< LIB_PIN * > GetLibPins() const
Return a vector with all the pins from the library object.
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:185
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:907
TRANSFORM & GetTransform()
Definition: sch_symbol.h:275
bool HasUnitDisplayName(int aUnit)
Return true if the given unit aUnit has a display name set.
Definition: sch_symbol.cpp:442
BOX2I doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:946
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.
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:714
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:791
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
Return the instance-specific value for the given sheet path.
Definition: sch_symbol.cpp:770
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:728
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:386
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:172
wxString GetUnitDisplayName(int aUnit)
Return the display name for a given unit aUnit.
Definition: sch_symbol.cpp:434
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:783
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:273
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:744
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:189
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every LIB_PIN (all units)
Definition: sch_symbol.h:788
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:716
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:301
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
wxString GetFieldText(const wxString &aFieldName) const
Search for a field named aFieldName and returns text associated with this field.
Definition: sch_symbol.cpp:919
wxString GetPrefix() const
Definition: sch_symbol.h:271
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:261
void SortInstances(bool(*aSortFunction)(const SYMBOL_INSTANCE_REFERENCE &aLhs, const SYMBOL_INSTANCE_REFERENCE &aRhs))
Definition: sch_symbol.cpp:521
void SetIncludeInBom(bool aIncludeInBom)
Definition: sch_symbol.h:746
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:792
std::unique_ptr< LIB_SYMBOL > m_part
a flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
Definition: sch_symbol.h:786
bool operator==(const SCH_SYMBOL &aSymbol) const
bool GetDNP() const
Definition: sch_symbol.h:751
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:47
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
@ LAYER_WIRE
Definition: layer_ids.h:344
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:47
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition: sch_symbol.h:70
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:68
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:146
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ TYPE_NOT_INIT
Definition: typeinfo.h:81
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_JUNCTION_T
Definition: typeinfo.h:142
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618