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 COMPONENT_CLASS_H
28 #define COMPONENT_CLASS_H
29 
30 #include <eda_item.h>
31 #include <core/typeinfo.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> // COMPONENT_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_PART;
58 class NETLIST_OBJECT_LIST;
59 class PART_LIB;
60 class PART_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_PART> PART_REF;
70 
71 
72 extern std::string toUTFTildaText( const wxString& txt );
73 
74 
78 class SCH_COMPONENT : public SCH_ITEM
79 {
80 public:
81  SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
82 
94  SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
95  int unit = 0, int convert = 0,
96  const wxPoint& pos = wxPoint( 0, 0 ) );
97 
98  SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
99  const wxPoint& pos = wxPoint( 0, 0 ) );
109  SCH_COMPONENT( const SCH_COMPONENT& aSymbol );
110 
112 
113  static inline bool ClassOf( const EDA_ITEM* aItem )
114  {
115  return aItem && SCH_COMPONENT_T == aItem->Type();
116  }
117 
118  wxString GetClass() const override
119  {
120  return wxT( "SCH_COMPONENT" );
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_PART >& GetPartRef() { return m_part; }
165  const std::unique_ptr< LIB_PART >& GetPartRef() const { return m_part; }
166 
183  void SetLibSymbol( LIB_PART* 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( 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_COMPONENT_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_COMPONENT& aSymbol) const;
635  bool operator!=( const SCH_COMPONENT& aSymbol) const;
636 
637  SCH_COMPONENT& 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_PART > m_part; // a flattened copy of the LIB_PART 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 /* COMPONENT_CLASS_H */
MANDATORY_FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
bool ReplaceInstanceSheetPath(const KIID_PATH &aOldSheetPath, const KIID_PATH &aNewSheetPath)
Replace aOldSheetPath with aNewSheetPath in the instance list.
Instances are attached to a symbol or sheet and provide a place for the component's value,...
Definition: sch_field.h:50
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void SetModified()
Definition: eda_item.cpp:63
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_symbol.h:113
void Rotate(wxPoint aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
std::vector< std::unique_ptr< SCH_PIN > > & GetRawPins()
Definition: sch_symbol.h:467
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
Definition: sch_symbol.cpp:761
void SetLibSymbol(LIB_PART *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
Definition: sch_symbol.cpp:248
void SetLibId(const LIB_ID &aName)
Definition: sch_symbol.cpp:229
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
void SetTransform(const TRANSFORM &aTransform)
Definition: sch_symbol.cpp:351
void UpdateUnit(int aUnit)
Change the unit number to aUnit without setting any internal flags.
Definition: sch_symbol.cpp:332
bool operator==(const SCH_COMPONENT &aSymbol) const
int GetOrientation()
Get the display symbol orientation.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:693
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
Definition: sch_symbol.cpp:960
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetIncludeInBom(bool aIncludeInBom)
Definition: sch_symbol.h:660
bool GetIncludeOnBoard() const
Definition: sch_symbol.h:662
bool IsConnectable() const override
Definition: sch_symbol.h:597
wxString GetSchSymbolLibraryName() const
Definition: sch_symbol.cpp:239
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
bool m_onBoard
True to include in netlist when updating board.
Definition: sch_symbol.h:702
int GetUnitCount() const
Return the number of units per package of the symbol.
Definition: sch_symbol.cpp:361
wxString GetPrefix() const
Definition: sch_symbol.h:227
bool IsInNetlist() const
void ClearBrightenedPins()
EE_COLLECTOR.
Definition: ee_collectors.h:42
void SetPosition(const wxPoint &aPosition) override
Definition: sch_symbol.h:642
wxString GetDescription() const
Return information about the aliased parts.
Definition: sch_symbol.cpp:257
Schematic editor (Eeschema) main window.
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.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_symbol.cpp:909
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
Definition: sch_symbol.h:63
void SetSchSymbolLibraryName(const wxString &aName)
The name of the symbol in the schematic library symbol list.
Definition: sch_symbol.h:160
void SetIncludeOnBoard(bool aIncludeOnBoard)
Definition: sch_symbol.h:663
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.
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:95
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_symbol.h:599
The base class for drawable items used by schematic library components.
Definition: lib_item.h:62
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void SetConvert(int aConvert)
Definition: sch_symbol.cpp:338
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:643
bool UseLibIdLookup() const
Definition: sch_symbol.h:162
int GetUnit() const
Definition: sch_symbol.h:195
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_symbol.h:561
wxPoint m_pos
Definition: sch_symbol.h:672
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
void SetFields(const SCH_FIELDS &aFields)
Set multiple schematic fields.
Definition: sch_symbol.h:400
wxString m_schLibSymbolName
The name used to look up a symbol in the symbol library embedded in a schematic.
Definition: sch_symbol.h:690
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:593
#define NULL
bool m_isInNetlist
True if the symbol should appear in the netlist.
Definition: sch_symbol.h:700
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
std::vector< SCH_FIELD > & GetFields()
Return a vector of fields from the symbol.
Definition: sch_symbol.h:366
bool operator<(const SCH_ITEM &aItem) const override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_symbol.cpp:214
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a symbol.
Definition: sch_symbol.cpp:370
SCH_COMPONENT(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
Definition: sch_symbol.cpp:95
Define a library symbol object.
Definition: lib_symbol.h:93
SCH_FIELD * GetFieldById(int aFieldId)
Return a field in this symbol.
Definition: sch_symbol.cpp:705
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
Definition: sch_symbol.cpp:739
wxString GetDatasheet() const
Return the documentation text for the given part alias.
Definition: sch_symbol.cpp:266
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:537
void SetUnit(int aUnit)
Change the unit number to aUnit.
Definition: sch_symbol.cpp:322
TRANSFORM & GetTransform()
Definition: sch_symbol.h:231
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::unique_ptr< LIB_PART > & GetPartRef()
Definition: sch_symbol.h:164
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_symbol.h:639
std::unique_ptr< LIB_PART > m_part
Definition: sch_symbol.h:695
bool GetIncludeInBom() const
Definition: sch_symbol.h:659
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this symbol.
Definition: sch_symbol.cpp:946
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: sch_symbol.h:421
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:884
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
EDA_UNITS
Definition: eda_units.h:38
A collection of PART_LIB objects.
int m_unit
The unit for multiple part per package symbols.
Definition: sch_symbol.h:674
void SetValue(const wxString &aValue)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:544
void Init(const wxPoint &pos=wxPoint(0, 0))
Definition: sch_symbol.cpp:185
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:482
Base plotter engine class.
Definition: plotter.h:121
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Definition: sch_symbol.cpp:567
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:717
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
LIB_ID m_lib_id
Name and library the symbol was loaded from, i.e. 74xx:74LS00.
Definition: sch_symbol.h:673
Board layer functions and definitions.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_symbol.cpp:848
const TRANSFORM & GetTransform() const
Definition: sch_symbol.h:232
bool operator!=(const SCH_COMPONENT &aSymbol) const
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
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:43
bool HasBrightenedPins()
const std::unique_ptr< LIB_PART > & GetPartRef() const
Definition: sch_symbol.h:165
Handle the component boundary box.
Definition: eda_rect.h:42
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Automatically orient all the fields in the symbol.
Schematic symbol object.
Definition: sch_symbol.h:78
void SetPrefix(const wxString &aPrefix)
Definition: sch_symbol.h:229
wxPoint GetPosition() const override
Definition: sch_symbol.h:641
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
Definition: sch_symbol.cpp:748
bool m_inBom
True to include in bill of materials export.
Definition: sch_symbol.h:701
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
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.
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...
bool IsPointClickableAnchor(const wxPoint &aPos) const override
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_symbol.h:367
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:775
std::vector< SYMBOL_INSTANCE_REFERENCE > m_instanceReferences
Definition: sch_symbol.h:706
void GetLibPins(std::vector< LIB_PIN * > &aPinsList) const
Populate a vector with all the pins from the library object.
Definition: sch_symbol.cpp:870
int GetConvert() const
Definition: sch_symbol.h:223
int m_convert
The alternate body style for symbols that have more than one body style defined.
Definition: sch_symbol.h:675
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:391
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
Definition: sch_symbol.cpp:275
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
std::vector< std::unique_ptr< SCH_PIN > > m_pins
Definition: sch_symbol.h:697
void SetValue(const SCH_SHEET_PATH *sheet, const wxString &aValue)
Definition: sch_symbol.cpp:614
static bool IsReferenceStringValid(const wxString &aReferenceString)
Test for an acceptable reference string.
Definition: sch_symbol.cpp:466
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
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:220
wxString GetClass() const override
Return the class name.
Definition: sch_symbol.h:118
const std::vector< SYMBOL_INSTANCE_REFERENCE > & GetInstanceReferences()
Definition: sch_symbol.h:123
SEARCH_RESULT
Definition: eda_item.h:41
Message panel definition file.
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting symbol annotation.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the symbol is.
Definition: sch_symbol.h:678
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:147
SCH_COMPONENT & operator=(const SCH_ITEM &aItem)
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const
Object used to load, save, search, and otherwise manipulate symbol library files.
void Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_symbol.h:692
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
SCH_FIELDS m_fields
Variable length list of fields.
Definition: sch_symbol.h:693
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Definition: sch_symbol.cpp:664
bool AddSheetPathReferenceEntryIfMissing(const KIID_PATH &aSheetPath)
Add an instance to the alternate references list (m_instanceReferences), if this entry does not alrea...
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
Definition: sch_symbol.cpp:551
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
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::unordered_map< LIB_PIN *, unsigned > m_pinMap
Definition: sch_symbol.h:698
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:432
std::weak_ptr< LIB_PART > PART_REF
Definition: sch_symbol.h:69
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SetFootprint(const wxString &aFootprint)
Set the value for all instances (the default GUI behavior).
Definition: sch_symbol.h:554
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
Definition: sch_symbol.cpp:858