KiCad PCB EDA Suite
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
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
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  *
22  * or you may search the 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  */
27 #ifndef __SYMBOL_H__
28 #define __SYMBOL_H__
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>
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>
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>
53 struct PICKED_SYMBOL;
54 class SCH_SCREEN;
55 class LIB_ITEM;
56 class LIB_PIN;
57 class LIB_SYMBOL;
59 class SYMBOL_LIB;
60 class SYMBOL_LIBS;
61 class EE_COLLECTOR;
62 class SCH_SCREEN;
67 typedef std::vector<SCH_FIELD> SCH_FIELDS;
69 typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
72 extern std::string toUTFTildaText( const wxString& txt );
78 class SCH_SYMBOL : public SCH_ITEM
79 {
80 public:
81  SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = nullptr );
94  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
95  int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
97  SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
98  const wxPoint& pos = wxPoint( 0, 0 ) );
109  SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
113  static inline bool ClassOf( const EDA_ITEM* aItem )
114  {
115  return aItem && SCH_SYMBOL_T == aItem->Type();
116  }
118  wxString GetClass() const override
119  {
120  return wxT( "SCH_SYMBOL" );
121  }
123  const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
124  {
125  return m_instanceReferences;
126  }
128  void ViewGetLayers( int aLayers[], int& aCount ) const override;
143  bool IsMovableFromAnchorPoint() const override { return true; }
145  void SetLibId( const LIB_ID& aName );
147  const LIB_ID& GetLibId() const { return m_lib_id; }
160  void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
161  wxString GetSchSymbolLibraryName() const;
162  bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
164  std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
165  const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
183  void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
188  wxString GetDescription() const;
193  wxString GetDatasheet() const;
195  int GetUnit() const { return m_unit; }
200  void UpdatePins();
211  void SetUnit( int aUnit );
221  void UpdateUnit( int aUnit );
223  int GetConvert() const { return m_convert; }
225  void SetConvert( int aConvert );
227  wxString GetPrefix() const { return m_prefix; }
229  void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
232  const TRANSFORM& GetTransform() const { return m_transform; }
234  void SetTransform( const TRANSFORM& aTransform );
241  int GetUnitCount() const;
249  void SetOrientation( int aOrientation );
266  int GetOrientation();
271  void GetContextualTextVars( wxArrayString* aVars ) const;
278  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
280  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
290  void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath );
303  bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
314  bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
316  const EDA_RECT GetBoundingBox() const override;
329  //-----<Fields>-----------------------------------------------------------
339  SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
340  const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
349  SCH_FIELD* GetFieldById( int aFieldId );
356  wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
364  void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
369  std::vector<SCH_FIELD>& GetFields() { return m_fields; }
370  const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
379  SCH_FIELD* AddField( const SCH_FIELD& aField );
386  void RemoveField( const wxString& aFieldName );
396  SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
403  void SetFields( const SCH_FIELDS& aFields )
404  {
405  m_fields = aFields; // vector copying, length is changed possibly
406  }
418  void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
419  bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
424  int GetFieldCount() const { return (int)m_fields.size(); }
435  void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
437  void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
440  //-----</Fields>----------------------------------------------------------
449  SCH_PIN* GetPin( const wxString& number ) const;
456  void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
458  SCH_PIN* GetPin( LIB_PIN* aLibPin );
468  std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
470  std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
479  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
481  void SwapData( SCH_ITEM* aItem ) override;
491  static bool IsReferenceStringValid( const wxString& aReferenceString );
498  const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
506  void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
514  bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
527  void AddHierarchicalReference( const KIID_PATH& aPath,
528  const wxString& aRef,
529  int aUnit,
530  const wxString& aValue = wxEmptyString,
531  const wxString& aFootprint = wxEmptyString );
534  int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
537  void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
540  void SetUnitSelection( int aUnitSelection );
543  const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
544  void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
547  void SetValue( const wxString& aValue )
548  {
549  SetValue( nullptr, aValue );
550  }
553  const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
554  void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
557  void SetFootprint( const wxString& aFootprint )
558  {
559  SetFootprint( nullptr, aFootprint );
560  }
562  // Geometric transforms (used in block operations):
564  void Move( const wxPoint& aMoveVector ) override
565  {
566  if( aMoveVector == wxPoint( 0, 0 ) )
567  return;
569  m_pos += aMoveVector;
571  for( SCH_FIELD& field : m_fields )
572  field.Move( aMoveVector );
574  SetModified();
575  }
577  void MirrorHorizontally( int aCenter ) override;
578  void MirrorVertically( int aCenter ) override;
579  void Rotate( const wxPoint& aCenter ) override;
581  bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
583  void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
595  bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
596  const SCH_SHEET_PATH* aPath = nullptr ) override;
598  wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
600  bool IsConnectable() const override { return true; }
602  bool CanConnect( const SCH_ITEM* aItem ) const override
603  {
604  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
605  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
606  ( aItem->Type() == SCH_JUNCTION_T ) ||
607  ( aItem->Type() == SCH_SYMBOL_T ) ||
608  ( aItem->Type() == SCH_LABEL_T ) ||
609  ( aItem->Type() == SCH_HIER_LABEL_T ) ||
610  ( aItem->Type() == SCH_GLOBAL_LABEL_T );
611  }
616  bool IsInNetlist() const;
618  std::vector<wxPoint> GetConnectionPoints() const override;
620  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
629  LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
631  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
633  BITMAPS GetMenuImage() const override;
635  bool operator <( const SCH_ITEM& aItem ) const override;
637  bool operator==( const SCH_SYMBOL& aSymbol) const;
638  bool operator!=( const SCH_SYMBOL& aSymbol) const;
640  SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
642  bool IsReplaceable() const override { return true; }
644  wxPoint GetPosition() const override { return m_pos; }
645  void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); }
647  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
648  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
650  void Plot( PLOTTER* aPlotter ) const override;
652  EDA_ITEM* Clone() const override;
654 #if defined(DEBUG)
655  void Show( int nestLevel, std::ostream& os ) const override;
656 #endif
658  void ClearBrightenedPins();
660  bool HasBrightenedPins();
662  bool GetIncludeInBom() const { return m_inBom; }
663  void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
665  bool GetIncludeOnBoard() const { return m_onBoard; }
666  void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
668  bool IsPointClickableAnchor( const wxPoint& aPos ) const override;
670 private:
671  EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
673  bool doIsConnected( const wxPoint& aPosition ) const override;
675  void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
677  wxPoint m_pos;
679  int m_unit;
680  int m_convert;
681  wxString m_prefix;
700  std::unique_ptr< LIB_SYMBOL > m_part; // a flattened copy of the LIB_SYMBOL from
701  // the PROJECT's libraries.
702  std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
703  std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
706  bool m_inBom;
707  bool m_onBoard;
709  // Defines the hierarchical path and reference of the symbol. This allows support
710  // for multiple references to a single sub-sheet.
711  std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
712 };
714 #endif /* __SYMBOL_H__ */
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:705
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:759
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:602
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:381
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:683
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:600
EDA_RECT doGetBoundingBox(bool aIncludePins, bool aIncludeFields) const
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:645
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.
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:677
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:333
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:372
std::vector< std::unique_ptr< SCH_PIN > > m_pins
Definition: sch_symbol.h:702
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:596
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:944
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:642
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:662
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:403
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
SCH_FIELDS m_fields
Variable length list of fields.
Definition: sch_symbol.h:698
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:557
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:240
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:443
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:893
Define a library symbol object.
Definition: lib_symbol.h:96
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:647
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:277
TRANSFORM & GetTransform()
Definition: sch_symbol.h:231
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:259
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:549
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:679
Definition: eda_item.h:93
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:229
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:164
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:343
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:854
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:930
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:663
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:680
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:695
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:723
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:370
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
const std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef() const
Definition: sch_symbol.h:165
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:250
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:424
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.h:143
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:533
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:286
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:677
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:232
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:160
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
Definition: sch_symbol.h:700
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:575
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:707
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:745
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:701
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:470
A collection of SYMBOL_LIB objects.
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:349
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:519
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:259
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:678
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:666
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:706
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
Definition: sch_symbol.h:703
Schematic symbol object.
Definition: sch_symbol.h:78
SCH_SYMBOL & operator=(const SCH_ITEM &aItem)
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:564
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:842
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:483
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 matrix.
Definition: sch_symbol.h:697
wxString GetPrefix() const
Definition: sch_symbol.h:227
wxPoint GetPosition() const override
Definition: sch_symbol.h:644
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:665
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_symbol.cpp:832
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:268
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:626
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:402
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:711
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:195
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:369
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.
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:477
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:689
int GetConvert() const
Definition: sch_symbol.h:223
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:732
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:868
bool UseLibIdLookup() const
Definition: sch_symbol.h:162
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:547
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:147
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:362