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-2021 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 
53 struct PICKED_SYMBOL;
54 class SCH_SCREEN;
55 class LIB_ITEM;
56 class LIB_PIN;
57 class LIB_SYMBOL;
58 class NETLIST_OBJECT_LIST;
59 class SYMBOL_LIB;
60 class SYMBOL_LIBS;
61 class EE_COLLECTOR;
62 class SCH_SCREEN;
64 
65 
67 typedef std::vector<SCH_FIELD> SCH_FIELDS;
68 
69 typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
70 
71 
72 extern std::string toUTFTildaText( const wxString& txt );
73 
74 
78 class SCH_SYMBOL : public SCH_ITEM
79 {
80 public:
81  SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = nullptr );
82 
94  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
95  int unit, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
96 
97  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
98  const wxPoint& pos = wxPoint( 0, 0 ) );
99 
109  SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
110 
112 
113  static inline bool ClassOf( const EDA_ITEM* aItem )
114  {
115  return aItem && SCH_SYMBOL_T == aItem->Type();
116  }
117 
118  wxString GetClass() const override
119  {
120  return wxT( "SCH_SYMBOL" );
121  }
122 
123  const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
124  {
125  return m_instanceReferences;
126  }
127 
128  void ViewGetLayers( int aLayers[], int& aCount ) const override;
129 
144  bool IsMovableFromAnchorPoint() const override;
145 
146  void SetLibId( const LIB_ID& aName );
147 
148  const LIB_ID& GetLibId() const { return m_lib_id; }
149 
161  void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
162  wxString GetSchSymbolLibraryName() const;
163  bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
164 
165  std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
166  const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
167 
184  void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
185 
189  wxString GetDescription() const;
190 
194  wxString GetDatasheet() const;
195 
196  int GetUnit() const { return m_unit; }
197 
201  void UpdatePins();
202 
212  void SetUnit( int aUnit );
213 
222  void UpdateUnit( int aUnit );
223 
224  int GetConvert() const { return m_convert; }
225 
226  void SetConvert( int aConvert );
227 
228  wxString GetPrefix() const { return m_prefix; }
229 
230  void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
231 
233  const TRANSFORM& GetTransform() const { return m_transform; }
234 
235  void SetTransform( const TRANSFORM& aTransform );
236 
242  int GetUnitCount() const;
243 
250  void SetOrientation( int aOrientation );
251 
267  int GetOrientation();
268 
272  void GetContextualTextVars( wxArrayString* aVars ) const;
273 
279  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
280 
281  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
282 
291  void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath );
292 
304  bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
305 
315  bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
316 
317  const EDA_RECT GetBoundingBox() const override;
318 
323 
328 
329 
330  //-----<Fields>-----------------------------------------------------------
331 
340  SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
341  const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
342 
350  SCH_FIELD* GetFieldById( int aFieldId );
351 
357  wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
358 
365  void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
366 
370  std::vector<SCH_FIELD>& GetFields() { return m_fields; }
371  const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
372 
380  SCH_FIELD* AddField( const SCH_FIELD& aField );
381 
387  void RemoveField( const wxString& aFieldName );
388 
397  SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
398 
404  void SetFields( const SCH_FIELDS& aFields )
405  {
406  m_fields = aFields; // vector copying, length is changed possibly
407  }
408 
419  void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
420  bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
421 
425  int GetFieldCount() const { return (int)m_fields.size(); }
426 
436  void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
437 
438  void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
439 
440 
441  //-----</Fields>----------------------------------------------------------
442 
443 
450  SCH_PIN* GetPin( const wxString& number ) const;
451 
457  void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
458 
459  SCH_PIN* GetPin( LIB_PIN* aLibPin ) const;
460 
469  std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
470 
471  std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
472 
480  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
481 
482  void SwapData( SCH_ITEM* aItem ) override;
483 
492  static bool IsReferenceStringValid( const wxString& aReferenceString );
493 
499  const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
500 
507  void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
508 
515  bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
516 
528  void AddHierarchicalReference( const KIID_PATH& aPath,
529  const wxString& aRef,
530  int aUnit,
531  const wxString& aValue = wxEmptyString,
532  const wxString& aFootprint = wxEmptyString );
533 
535  int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
536 
538  void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
539 
541  void SetUnitSelection( int aUnitSelection );
542 
544  const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
545  void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
546 
548  void SetValue( const wxString& aValue )
549  {
550  SetValue( nullptr, aValue );
551  }
552 
554  const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
555  void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
556 
558  void SetFootprint( const wxString& aFootprint )
559  {
560  SetFootprint( nullptr, aFootprint );
561  }
562 
563  // Geometric transforms (used in block operations):
564 
565  void Move( const wxPoint& aMoveVector ) override
566  {
567  if( aMoveVector == wxPoint( 0, 0 ) )
568  return;
569 
570  m_pos += aMoveVector;
571 
572  for( SCH_FIELD& field : m_fields )
573  field.Move( aMoveVector );
574 
575  SetModified();
576  }
577 
578  void MirrorHorizontally( int aCenter ) override;
579  void MirrorVertically( int aCenter ) override;
580  void Rotate( const wxPoint& aCenter ) override;
581 
582  bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
583 
584  void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
585 
596  bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
597  const SCH_SHEET_PATH* aPath = nullptr ) override;
598 
599  wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
600 
601  bool IsConnectable() const override { return true; }
602 
603  bool CanConnect( const SCH_ITEM* aItem ) const override
604  {
605  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
606  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
607  ( aItem->Type() == SCH_JUNCTION_T ) ||
608  ( aItem->Type() == SCH_SYMBOL_T ) ||
609  ( aItem->Type() == SCH_LABEL_T ) ||
610  ( aItem->Type() == SCH_HIER_LABEL_T ) ||
611  ( aItem->Type() == SCH_GLOBAL_LABEL_T );
612  }
613 
617  bool IsInNetlist() const;
618 
619  std::vector<wxPoint> GetConnectionPoints() const override;
620 
621  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
622 
630  LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
631 
632  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
633 
634  BITMAPS GetMenuImage() const override;
635 
636  bool operator <( const SCH_ITEM& aItem ) const override;
637 
638  bool operator==( const SCH_SYMBOL& aSymbol) const;
639  bool operator!=( const SCH_SYMBOL& aSymbol) const;
640 
641  SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
642 
643  bool IsReplaceable() const override { return true; }
644 
645  wxPoint GetPosition() const override { return m_pos; }
646  void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); }
647 
648  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
649  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
650 
651  void Plot( PLOTTER* aPlotter ) const override;
652 
653  EDA_ITEM* Clone() const override;
654 
655 #if defined(DEBUG)
656  void Show( int nestLevel, std::ostream& os ) const override;
657 #endif
658 
659  void ClearBrightenedPins();
660 
661  bool HasBrightenedPins();
662 
663  bool GetIncludeInBom() const { return m_inBom; }
664  void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
665 
666  bool GetIncludeOnBoard() const { return m_onBoard; }
667  void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
668 
669  bool IsPointClickableAnchor( const wxPoint& aPos ) const override;
670 
671 private:
672  EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
673 
674  bool doIsConnected( const wxPoint& aPosition ) const override;
675 
676  void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
677 
678  wxPoint m_pos;
680  int m_unit;
681  int m_convert;
682  wxString m_prefix;
685 
697 
699  std::vector<SCH_FIELD> m_fields;
700 
701  std::unique_ptr< LIB_SYMBOL > m_part;
702  std::vector<std::unique_ptr<SCH_PIN>> m_pins;
704  std::unordered_map<LIB_PIN*, unsigned> m_pinMap;
705 
707  bool m_inBom;
708  bool m_onBoard;
709 
710  // Defines the hierarchical path and reference of the symbol. This allows support
711  // for multiple references to a single sub-sheet.
712  std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
713 };
714 
715 #endif /* __SYMBOL_H__ */
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:706
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:787
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:603
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:402
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
void SetModified()
Definition: eda_item.cpp:65
wxString m_prefix
C, R, U, Q etc - the first character(s) which typically indicate what the symbol is.
Definition: sch_symbol.h:684
bool operator!=(const SCH_SYMBOL &aSymbol) const
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
bool IsConnectable() const override
Definition: sch_symbol.h:601
EDA_RECT doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:646
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:705
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:354
Object used to load, save, search, and otherwise manipulate symbol library files.
EDA_RECT GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:113
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:393
std::vector< std::unique_ptr< SCH_PIN > > m_pins
a SCH_PIN for every LIB_PIN (all units)
Definition: sch_symbol.h:703
std::weak_ptr< LIB_SYMBOL > PART_REF
Definition: sch_symbol.h:69
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
bool IsPointClickableAnchor(const wxPoint &aPos) const override
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:624
SCH_SYMBOL(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=nullptr)
Definition: sch_symbol.cpp:98
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.
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
Definition: sch_symbol.cpp:972
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:643
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.
bool GetIncludeInBom() const
Definition: sch_symbol.h:663
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:404
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:229
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Schematic editor (Eeschema) main window.
void SetFootprint(const wxString &aFootprint)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:558
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:63
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:261
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:464
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
The base class for create windows for drawing purpose.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_symbol.cpp:921
Define a library symbol object.
Definition: lib_symbol.h:96
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:675
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:298
TRANSFORM & GetTransform()
Definition: sch_symbol.h:232
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:280
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
void Init(const wxPoint &pos=wxPoint(0, 0))
Definition: sch_symbol.cpp:194
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:570
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:680
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:93
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:230
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:165
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:364
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
Definition: sch_symbol.h:123
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
Definition: sch_symbol.cpp:882
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:223
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
Definition: sch_symbol.cpp:958
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
void SetIncludeInBom(bool aIncludeInBom)
Definition: sch_symbol.h:664
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool IsInNetlist() const
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:681
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:696
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:751
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:371
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
std::vector< SCH_FIELD > m_fields
Variable length list of fields.
Definition: sch_symbol.h:699
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:166
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:271
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:425
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:240
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:554
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:307
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
wxPoint m_pos
Definition: sch_symbol.h:678
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:233
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:161
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_SYMBOL > m_part
a flattened copy of the LIB_SYMBOL from the PROJECT's libraries.
Definition: sch_symbol.h:701
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:596
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:708
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:773
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:118
wxString GetFieldText(const wxString &aFieldName, SCH_EDIT_FRAME *aFrame) const
Search for a field named aFieldName and returns text associated with this field.
Definition: sch_symbol.cpp:729
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:471
A collection of SYMBOL_LIB objects.
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:370
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:540
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
EDA_UNITS
Definition: eda_units.h:38
bool HasBrightenedPins()
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
Definition: sch_symbol.h:679
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void ClearBrightenedPins()
Base plotter engine class.
Definition: plotter.h:121
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:667
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:707
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
library pin pointer : SCH_PIN's index
Definition: sch_symbol.h:704
Schematic symbol object.
Definition: sch_symbol.h:78
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:565
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:46
bool operator<(const SCH_ITEM &aItem) const override
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:870
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:504
void Rotate(const wxPoint &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Handle the component boundary box.
Definition: eda_rect.h:42
TRANSFORM m_transform
The rotation/mirror transformation.
Definition: sch_symbol.h:698
wxString GetPrefix() const
Definition: sch_symbol.h:228
wxPoint GetPosition() const override
Definition: sch_symbol.h:645
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:666
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_symbol.cpp:860
bool operator==(const SCH_SYMBOL &aSymbol) const
int GetOrientation()
Get the display symbol orientation.
wxString GetDescription() const
Return information about the aliased parts.
Definition: sch_symbol.cpp:289
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:654
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:423
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:712
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
int GetUnit() const
Definition: sch_symbol.h:196
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:370
LIB_ITEM * GetDrawItem(const wxPoint &aPosition, KICAD_T aType=TYPE_NOT_INIT)
Return the symbol library item at aPosition that is part of this symbol.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SEARCH_RESULT
Definition: eda_item.h:41
Message panel definition file.
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:498
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:717
int GetConvert() const
Definition: sch_symbol.h:224
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:760
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
Definition: sch_symbol.cpp:896
bool UseLibIdLookup() const
Definition: sch_symbol.h:163
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
void SetValue(const wxString &aValue)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:548
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:148
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:383