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, dick@softplc.com
6  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
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 = 0, 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 
143  bool IsMovableFromAnchorPoint() const override { return true; }
144 
145  void SetLibId( const LIB_ID& aName );
146 
147  const LIB_ID& GetLibId() const { return m_lib_id; }
148 
160  void SetSchSymbolLibraryName( const wxString& aName ) { m_schLibSymbolName = aName; }
161  wxString GetSchSymbolLibraryName() const;
162  bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
163 
164  std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
165  const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
166 
183  void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
184 
188  wxString GetDescription() const;
189 
193  wxString GetDatasheet() const;
194 
195  int GetUnit() const { return m_unit; }
196 
200  void UpdatePins();
201 
211  void SetUnit( int aUnit );
212 
221  void UpdateUnit( int aUnit );
222 
223  int GetConvert() const { return m_convert; }
224 
225  void SetConvert( int aConvert );
226 
227  wxString GetPrefix() const { return m_prefix; }
228 
229  void SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; }
230 
232  const TRANSFORM& GetTransform() const { return m_transform; }
233 
234  void SetTransform( const TRANSFORM& aTransform );
235 
241  int GetUnitCount() const;
242 
249  void SetOrientation( int aOrientation );
250 
266  int GetOrientation();
267 
271  void GetContextualTextVars( wxArrayString* aVars ) const;
272 
278  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
279 
280  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
281 
290  void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath );
291 
303  bool AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath );
304 
314  bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
315 
316  const EDA_RECT GetBoundingBox() const override;
317 
318  const EDA_RECT GetBoundingBox( bool aIncludeInvisibleText ) const;
319 
324 
325 
326  //-----<Fields>-----------------------------------------------------------
327 
336  SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
337  const SCH_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
338 
346  SCH_FIELD* GetFieldById( int aFieldId );
347 
353  wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
354 
361  void GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly );
362 
366  std::vector<SCH_FIELD>& GetFields() { return m_fields; }
367  const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
368 
376  SCH_FIELD* AddField( const SCH_FIELD& aField );
377 
383  void RemoveField( const wxString& aFieldName );
384 
393  SCH_FIELD* FindField( const wxString& aFieldName, bool aIncludeDefaultFields = true );
394 
400  void SetFields( const SCH_FIELDS& aFields )
401  {
402  m_fields = aFields; // vector copying, length is changed possibly
403  }
404 
415  void UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
416  bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
417 
421  int GetFieldCount() const { return (int)m_fields.size(); }
422 
432  void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
433 
434  void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
435 
436 
437  //-----</Fields>----------------------------------------------------------
438 
439 
446  SCH_PIN* GetPin( const wxString& number ) const;
447 
453  void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
454 
455  SCH_PIN* GetPin( LIB_PIN* aLibPin );
456 
465  std::vector<SCH_PIN*> GetPins( const SCH_SHEET_PATH* aSheet = nullptr ) const;
466 
467  std::vector<std::unique_ptr<SCH_PIN>>& GetRawPins() { return m_pins; }
468 
476  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
477 
478  void SwapData( SCH_ITEM* aItem ) override;
479 
488  static bool IsReferenceStringValid( const wxString& aReferenceString );
489 
495  const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false ) const;
496 
503  void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
504 
511  bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
512 
524  void AddHierarchicalReference( const KIID_PATH& aPath,
525  const wxString& aRef,
526  int aUnit,
527  const wxString& aValue = wxEmptyString,
528  const wxString& aFootprint = wxEmptyString );
529 
531  int GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const;
532 
534  void SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection );
535 
537  void SetUnitSelection( int aUnitSelection );
538 
540  const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
541  void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
542 
544  void SetValue( const wxString& aValue )
545  {
546  SetValue( nullptr, aValue );
547  }
548 
550  const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
551  void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
552 
554  void SetFootprint( const wxString& aFootprint )
555  {
556  SetFootprint( nullptr, aFootprint );
557  }
558 
559  // Geometric transforms (used in block operations):
560 
561  void Move( const wxPoint& aMoveVector ) override
562  {
563  if( aMoveVector == wxPoint( 0, 0 ) )
564  return;
565 
566  m_pos += aMoveVector;
567 
568  for( SCH_FIELD& field : m_fields )
569  field.Move( aMoveVector );
570 
571  SetModified();
572  }
573 
574  void MirrorHorizontally( int aCenter ) override;
575  void MirrorVertically( int aCenter ) override;
576  void Rotate( const wxPoint& aCenter ) override;
577 
578  bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
579 
580  void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
581 
592  bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
593  const SCH_SHEET_PATH* aPath = nullptr ) override;
594 
595  wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
596 
597  bool IsConnectable() const override { return true; }
598 
599  bool CanConnect( const SCH_ITEM* aItem ) const override
600  {
601  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
602  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
603  ( aItem->Type() == SCH_JUNCTION_T ) ||
604  ( aItem->Type() == SCH_SYMBOL_T ) ||
605  ( aItem->Type() == SCH_LABEL_T ) ||
606  ( aItem->Type() == SCH_HIER_LABEL_T ) ||
607  ( aItem->Type() == SCH_GLOBAL_LABEL_T );
608  }
609 
613  bool IsInNetlist() const;
614 
615  std::vector<wxPoint> GetConnectionPoints() const override;
616 
617  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
618 
626  LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
627 
628  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
629 
630  BITMAPS GetMenuImage() const override;
631 
632  bool operator <( const SCH_ITEM& aItem ) const override;
633 
634  bool operator==( const SCH_SYMBOL& aSymbol) const;
635  bool operator!=( const SCH_SYMBOL& aSymbol) const;
636 
637  SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
638 
639  bool IsReplaceable() const override { return true; }
640 
641  wxPoint GetPosition() const override { return m_pos; }
642  void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); }
643 
644  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
645  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
646 
647  void Plot( PLOTTER* aPlotter ) const override;
648 
649  EDA_ITEM* Clone() const override;
650 
651 #if defined(DEBUG)
652  void Show( int nestLevel, std::ostream& os ) const override;
653 #endif
654 
655  void ClearBrightenedPins();
656 
657  bool HasBrightenedPins();
658 
659  bool GetIncludeInBom() const { return m_inBom; }
660  void SetIncludeInBom( bool aIncludeInBom ) { m_inBom = aIncludeInBom; }
661 
662  bool GetIncludeOnBoard() const { return m_onBoard; }
663  void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
664 
665  bool IsPointClickableAnchor( const wxPoint& aPos ) const override;
666 
667 private:
668  bool doIsConnected( const wxPoint& aPosition ) const override;
669 
670  void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
671 
672  wxPoint m_pos;
674  int m_unit;
675  int m_convert;
676  wxString m_prefix;
679 
691 
694 
695  std::unique_ptr< LIB_SYMBOL > m_part; // a flattened copy of the LIB_SYMBOL from
696  // the PROJECT's libraries.
697  std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
698  std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
699 
701  bool m_inBom;
702  bool m_onBoard;
703 
704  // Defines the hierarchical path and reference of the symbol. This allows support
705  // for multiple references to a single sub-sheet.
706  std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
707 };
708 
709 #endif /* __SYMBOL_H__ */
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:700
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:757
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:599
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:379
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:678
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:597
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:642
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:675
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:331
Object used to load, save, search, and otherwise manipulate symbol library files.
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:370
std::vector< std::unique_ptr< SCH_PIN > > m_pins
Definition: sch_symbol.h:697
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:594
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:942
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:639
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:659
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:400
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:693
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:554
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:238
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:441
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:891
Define a library symbol object.
Definition: lib_symbol.h:96
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:645
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:275
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:257
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:547
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:674
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:94
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: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:341
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:852
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:928
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:660
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:675
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:690
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:721
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:367
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:248
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:421
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:531
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:284
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
wxPoint m_pos
Definition: sch_symbol.h:672
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:695
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:573
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:702
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:743
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:699
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:467
A collection of SYMBOL_LIB objects.
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:347
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:517
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:268
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:673
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
void ClearBrightenedPins()
Base plotter engine class.
Definition: plotter.h:121
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:663
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:701
std::unordered_map< LIB_PIN *, unsigned > m_pinMap
Definition: sch_symbol.h:698
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:561
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:840
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:481
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:692
wxString GetPrefix() const
Definition: sch_symbol.h:227
wxPoint GetPosition() const override
Definition: sch_symbol.h:641
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:662
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_symbol.cpp:830
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:266
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:624
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:400
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:706
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:366
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:475
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:687
int GetConvert() const
Definition: sch_symbol.h:223
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:730
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:193
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:866
bool UseLibIdLookup() const
Definition: sch_symbol.h:162
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
void SetValue(const wxString &aValue)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:544
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:147
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:360