KiCad PCB EDA Suite
SCH_COMPONENT Class Reference

Class SCH_COMPONENT describes a real schematic component. More...

#include <sch_component.h>

Inheritance diagram for SCH_COMPONENT:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM

Public Types

enum  AUTOPLACED { AUTOPLACED_NO = 0, AUTOPLACED_AUTO, AUTOPLACED_MANUAL }
 

Public Member Functions

 SCH_COMPONENT (const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
 
 SCH_COMPONENT (LIB_PART &aPart, LIB_ID aLibId, SCH_SHEET_PATH *aSheet, int unit=0, int convert=0, const wxPoint &pos=wxPoint(0, 0), bool setNewItemFlag=false)
 Create schematic component from library component object. More...
 
 SCH_COMPONENT (const SCH_COMPONENT &aComponent)
 Clones aComponent into a new schematic symbol object. More...
 
 ~SCH_COMPONENT ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
const wxArrayString & GetPathsAndReferences () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
bool IsMovableFromAnchorPoint () override
 Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor. More...
 
void SetLibId (const LIB_ID &aName, PART_LIBS *aLibs=NULL)
 
void SetLibId (const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aSymLibTable, PART_LIB *aCacheLib)
 
const LIB_IDGetLibId () const
 
PART_REFGetPartRef ()
 
wxString GetDescription () const
 Return information about the aliased parts. More...
 
wxString GetDatasheet () const
 Return the documentation text for the given part alias. More...
 
bool Resolve (PART_LIBS *aLibs)
 Assigns the current LIB_PART from aLibs which this symbol is based on. More...
 
bool Resolve (SYMBOL_LIB_TABLE &aLibTable, PART_LIB *aCacheLib=NULL)
 
int GetUnit () const
 
void UpdatePinCache ()
 Updates the local cache of pin positions. More...
 
void SetUnit (int aUnit)
 Change the unit number to aUnit. More...
 
void UpdateUnit (int aUnit)
 Change the unit number to aUnit without setting any internal flags. More...
 
int GetConvert () const
 
void SetConvert (int aConvert)
 
wxString GetPrefix () const
 
void SetPrefix (const wxString &aPrefix)
 
TRANSFORMGetTransform () const
 
void SetTransform (const TRANSFORM &aTransform)
 
int GetUnitCount () const
 Return the number of units per package of the symbol. More...
 
void SetOrientation (int aOrientation)
 Compute the new transform matrix based on aOrientation for the symbol which is applied to the current transform. More...
 
int GetOrientation ()
 Get the display symbol orientation. More...
 
wxPoint GetScreenCoord (const wxPoint &aPoint)
 Returns the coordinate points relative to the orientation of the symbol to aPoint. More...
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void ClearAnnotation (SCH_SHEET_PATH *aSheetPath)
 Clear exiting component annotation. More...
 
bool AddSheetPathReferenceEntryIfMissing (const wxString &aSheetPathName)
 Add aSheetPath in m_PathsAndReferences alternate references list, if this entry does not exist Do nothing if already exists. More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 Change the time stamp to aNewTimeStamp and updates the reference path. More...
 
void ClearAllHighlightFlags ()
 Clear the HIGHLIGHTED flag of all items of the component (fields, pins ...) More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
EDA_RECT GetBodyBoundingBox () const
 Return a bounding box for the symbol body but not the fields. More...
 
SCH_FIELDGetField (int aFieldNdx) const
 Returns a field in this symbol. More...
 
wxString GetFieldText (const wxString &aFieldName, SCH_EDIT_FRAME *aFrame) const
 Search for a field named aFieldName and returns text associated with this field. More...
 
void GetFields (std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
 Populates a std::vector with SCH_FIELDs. More...
 
SCH_FIELDAddField (const SCH_FIELD &aField)
 Add a field to the symbol. More...
 
void RemoveField (const wxString &aFieldName)
 Removes a user field from the symbol. More...
 
SCH_FIELDFindField (const wxString &aFieldName, bool aIncludeDefaultFields=true)
 Search for a SCH_FIELD with aFieldName. More...
 
void SetFields (const SCH_FIELDS &aFields)
 Set multiple schematic fields. More...
 
void UpdateFields (bool aResetStyle, bool aResetRef=false)
 Restores fields to the original library values. More...
 
int GetFieldCount () const
 Return the number of fields in this symbol. More...
 
AUTOPLACED GetFieldsAutoplaced () const
 Return whether the fields have been automatically placed. More...
 
void ClearFieldsAutoplaced ()
 Set fields automatically placed flag false. More...
 
void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual)
 Automatically orient all the fields in the component. More...
 
void AutoAutoplaceFields (SCH_SCREEN *aScreen)
 Autoplace fields only if correct to do so automatically. More...
 
LIB_PINGetPin (const wxString &number)
 Find a symbol pin by number. More...
 
void GetPins (std::vector< LIB_PIN * > &aPinsList)
 Populate a vector with all the pins. More...
 
std::vector< bool > * GetDanglingPinFlags ()
 
void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
 Function Draw Draw a schematic item. More...
 
void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor, bool aDrawPinText)
 Draw a component with or without pin text. More...
 
void SwapData (SCH_ITEM *aItem) override
 Function SwapData swap the internal data structures aItem with the schematic item. More...
 
wxString GetPath (const SCH_SHEET_PATH *sheet) const
 
void SetCurrentSheetPath (const SCH_SHEET_PATH *aSheetPath)
 
const wxString GetRef (const SCH_SHEET_PATH *aSheet)
 Return the reference for the given sheet path. More...
 
void SetRef (const SCH_SHEET_PATH *aSheet, const wxString &aReference)
 Set the reference for the given sheet path for this symbol. More...
 
void AddHierarchicalReference (const wxString &aPath, const wxString &aRef, int aMulti)
 Add a full hierarchical reference to this symbol. More...
 
int GetUnitSelection (SCH_SHEET_PATH *aSheet)
 
void SetUnitSelection (SCH_SHEET_PATH *aSheet, int aUnitSelection)
 
void Move (const wxPoint &aMoveVector) override
 Function Move moves the item by aMoveVector to a new position. More...
 
void MirrorY (int aYaxis_position) override
 Function MirrorY mirrors item relative to the Y axis about aYaxis_position. More...
 
void MirrorX (int aXaxis_position) override
 Function MirrorX mirrors item relative to the X axis about aXaxis_position. More...
 
void Rotate (wxPoint aPosition) override
 Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction. More...
 
bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation) override
 Function Matches compares the item against the search criteria in aSearchData. More...
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Function GetEndPoints adds the schematic item end points to aItemList if the item has end points. More...
 
bool UpdateDanglingState (std::vector< DANGLING_END_ITEM > &aItemList) override
 Test if the component's dangling state has changed for all pins. More...
 
wxPoint GetPinPhysicalPosition (const LIB_PIN *Pin) const
 
bool IsSelectStateChanged (const wxRect &aRect) override
 Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed. More...
 
bool IsConnectable () const override
 Function IsConnectable returns true if the schematic item can connect to another schematic item. More...
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
bool IsInNetlist () const
 
void GetConnectionPoints (std::vector< wxPoint > &aPoints) const override
 Function GetConnectionPoints add all the connection points for this item to aPoints. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
LIB_ITEMGetDrawItem (const wxPoint &aPosition, KICAD_T aType=TYPE_NOT_INIT)
 Return the component library item at aPosition that is part of this component. More...
 
wxString GetSelectMenuText (EDA_UNITS_T aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
void GetNetListItem (NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
 Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems. More...
 
bool operator< (const SCH_ITEM &aItem) const override
 
bool operator== (const SCH_COMPONENT &aComponent) const
 
bool operator!= (const SCH_COMPONENT &aComponent) const
 
SCH_ITEMoperator= (const SCH_ITEM &aItem)
 
bool IsReplaceable () const override
 Function IsReplaceable. More...
 
wxPoint GetPosition () const override
 Function GetPosition. More...
 
void SetPosition (const wxPoint &aPosition) override
 Function SetPosition set the schematic item position to aPosition. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=false, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
void Plot (PLOTTER *aPlotter) override
 Function Plot plots the schematic item to aPlotter. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
void ClearHighlightedPins ()
 
void HighlightPin (LIB_PIN *aPin)
 
bool IsPinHighlighted (const LIB_PIN *aPin)
 
SCH_ITEMNext () const
 
SCH_ITEMBack () const
 
wxPoint & GetStoredPos ()
 
void SetStoredPos (wxPoint aPos)
 
SCH_LAYER_ID GetLayer () const
 Function GetLayer returns the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
virtual int GetPenSize () const
 Function GetPenSize virtual pure. More...
 
virtual bool Load (LINE_READER &aLine, wxString &aErrorMsg)
 Function Load reads a schematic item from aLine in a .sch file. More...
 
virtual bool IsDangling () const
 
void ClearConnections ()
 Function ClearConnections clears all of the connection items from the list. More...
 
bool IsConnected (const wxPoint &aPoint) const
 Function IsConnected tests the item to see if it is connected to aPoint. More...
 
virtual bool HitTest (const wxPoint &aPosition) const override
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
virtual bool CanIncrementLabel () const
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
KICAD_T Type () const
 Function Type() More...
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMGetParent () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool IsType (const KICAD_T aScanTypes[])
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static void ResolveAll (const SCH_COLLECTOR &aComponents, PART_LIBS *aLibs)
 
static void ResolveAll (const SCH_COLLECTOR &aComponents, SYMBOL_LIB_TABLE &aLibTable, PART_LIB *aCacheLib=NULL)
 
static void UpdateAllPinCaches (const SCH_COLLECTOR &aComponents)
 Update the pin cache for all components in aComponents. More...
 
static bool IsReferenceStringValid (const wxString &aReferenceString)
 Tests for an acceptable reference string. More...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Protected Member Functions

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

SCH_LAYER_ID m_Layer
 
EDA_ITEMS m_connections
 List of items connected to this item. More...
 
wxPoint m_storedPos
 a temporary variable used in some move commands

to store a initial pos (of the item or mouse cursor)

More...
 
EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

void Init (const wxPoint &pos=wxPoint(0, 0))
 
bool doIsConnected (const wxPoint &aPosition) const override
 Function doIsConnected provides the object specific test to see if it is connected to aPosition. More...
 

Private Attributes

wxPoint m_Pos
 Name and library where symbol was loaded from, i.e. "74xx:74LS00". More...
 
LIB_ID m_lib_id
 
int m_unit
 The unit for multiple part per package components. More...
 
int m_convert
 The alternate body style for components that have more than one body style defined. More...
 
wxString m_prefix
 C, R, U, Q etc - the first character which typically indicates what the component is. More...
 
TRANSFORM m_transform
 The rotation/mirror transformation matrix. More...
 
SCH_FIELDS m_Fields
 Variable length list of fields. More...
 
PART_REF m_part
 points into the PROJECT's libraries to the LIB_PART for this component More...
 
std::vector< bool > m_isDangling
 One isDangling per pin. More...
 
std::vector< wxPoint > m_Pins
 
std::set< wxString > m_highlightedPins
 God forgive me - Tom. More...
 
AUTOPLACED m_fieldsAutoplaced
 indicates status of field autoplacement More...
 
const SCH_SHEET_PATHm_currentSheetPath
 A temporary sheet path is required to generate the correct reference designator string in complex hierarchies. More...
 
wxArrayString m_PathsAndReferences
 Defines the hierarchical path and reference of the component. More...
 

Detailed Description

Class SCH_COMPONENT describes a real schematic component.

Definition at line 70 of file sch_component.h.

Member Enumeration Documentation

Enumerator
AUTOPLACED_NO 
AUTOPLACED_AUTO 
AUTOPLACED_MANUAL 

Definition at line 73 of file sch_component.h.

Constructor & Destructor Documentation

SCH_COMPONENT::SCH_COMPONENT ( const wxPoint &  pos = wxPoint( 0, 0 ),
SCH_ITEM aParent = NULL 
)

Definition at line 122 of file sch_component.cpp.

References AUTOPLACED_NO, Init(), m_currentSheetPath, and m_fieldsAutoplaced.

Referenced by Clone().

122  :
123  SCH_ITEM( aParent, SCH_COMPONENT_T )
124 {
125  Init( aPos );
126  m_currentSheetPath = NULL;
128 }
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
void Init(const wxPoint &pos=wxPoint(0, 0))
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_COMPONENT::SCH_COMPONENT ( LIB_PART aPart,
LIB_ID  aLibId,
SCH_SHEET_PATH aSheet,
int  unit = 0,
int  convert = 0,
const wxPoint &  pos = wxPoint( 0, 0 ),
bool  setNewItemFlag = false 
)

Create schematic component from library component object.

Parameters
aPart- library part to create schematic component from.
aLibId- libId of alias to create.
aSheet- Schematic sheet the component is place into.
unit- Part for components that have multiple parts per package.
convert- Use the alternate body style for the schematic component.
pos- Position to place new component.
setNewItemFlag- Set the component IS_NEW and IS_MOVED flags.

Definition at line 131 of file sch_component.cpp.

References AUTOPLACED_NO, GetNewTimeStamp(), LIB_PART::GetReferenceField(), EDA_TEXT::GetText(), Init(), IS_MOVED, IS_NEW, m_convert, m_currentSheetPath, m_fieldsAutoplaced, EDA_ITEM::m_Flags, m_lib_id, m_part, m_prefix, m_unit, SetRef(), SetTimeStamp(), LIB_PART::SharedPtr(), UpdateFields(), and UpdatePinCache().

132  :
133  SCH_ITEM( NULL, SCH_COMPONENT_T )
134 {
135  Init( pos );
136 
137  m_unit = unit;
138  m_convert = convert;
139  m_lib_id = aLibId;
140  m_part = aPart.SharedPtr();
141  m_currentSheetPath = NULL;
143 
145 
146  if( setNewItemFlag )
147  m_Flags = IS_NEW | IS_MOVED;
148 
149  // Copy fields from the library component
150  UpdateFields( true, true );
151 
152  // Update the pin locations
153  UpdatePinCache();
154 
155  // Update the reference -- just the prefix for now.
156  if( sheet )
157  SetRef( sheet, aPart.GetReferenceField().GetText() + wxT( "?" ) );
158  else
159  m_prefix = aPart.GetReferenceField().GetText() + wxT( "?" );
160 }
void UpdateFields(bool aResetStyle, bool aResetRef=false)
Restores fields to the original library values.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
void UpdatePinCache()
Updates the local cache of pin positions.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
PART_SPTR SharedPtr()
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
void Init(const wxPoint &pos=wxPoint(0, 0))
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113
SCH_COMPONENT::SCH_COMPONENT ( const SCH_COMPONENT aComponent)

Clones aComponent into a new schematic symbol object.

All fields are copied as is except for the linked list management pointers which are set to NULL, and the SCH_FIELD's m_Parent pointers which are set to the new object.

Parameters
aComponentis the schematic symbol to clone.

Definition at line 163 of file sch_component.cpp.

References GetField(), GetFieldCount(), i, m_convert, m_currentSheetPath, m_Fields, m_fieldsAutoplaced, m_isDangling, m_lib_id, EDA_ITEM::m_Parent, m_part, m_PathsAndReferences, m_Pins, m_Pos, m_prefix, EDA_ITEM::m_TimeStamp, m_transform, m_unit, EDA_ITEM::SetParent(), and SetTimeStamp().

163  :
164  SCH_ITEM( aComponent )
165 {
166  m_currentSheetPath = NULL;
167  m_Parent = aComponent.m_Parent;
168  m_Pos = aComponent.m_Pos;
169  m_unit = aComponent.m_unit;
170  m_convert = aComponent.m_convert;
171  m_lib_id = aComponent.m_lib_id;
172  m_part = aComponent.m_part;
173  m_Pins = aComponent.m_Pins;
174 
175  SetTimeStamp( aComponent.m_TimeStamp );
176 
177  m_transform = aComponent.m_transform;
178  m_prefix = aComponent.m_prefix;
180  m_Fields = aComponent.m_Fields;
181 
182  // Re-parent the fields, which before this had aComponent as parent
183  for( int i = 0; i<GetFieldCount(); ++i )
184  {
185  GetField( i )->SetParent( this );
186  }
187 
188  m_isDangling = aComponent.m_isDangling;
190 }
void SetTimeStamp(timestamp_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:171
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:172
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:94
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
size_t i
Definition: json11.cpp:597
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_COMPONENT::~SCH_COMPONENT ( )
inline

Definition at line 150 of file sch_component.h.

150 { }

Member Function Documentation

SCH_FIELD * SCH_COMPONENT::AddField ( const SCH_FIELD aField)

Add a field to the symbol.

Parameters
aFieldis the field to add to this symbol.
Returns
the newly inserted field.

Definition at line 928 of file sch_component.cpp.

References m_Fields.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), GetTransform(), Init(), and UpdateFields().

929 {
930  int newNdx = m_Fields.size();
931 
932  m_Fields.push_back( aField );
933  return &m_Fields[newNdx];
934 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
void SCH_COMPONENT::AddHierarchicalReference ( const wxString &  aPath,
const wxString &  aRef,
int  aMulti 
)

Add a full hierarchical reference to this symbol.

Parameters
aPathis the hierarchical path (/&ltsheet timestamp&gt/&ltcomponent timestamp&gt like /05678E50/A23EF560)
aRefis the local reference like C45, R56
aMultiis the unit selection used for symbols with multiple units per package.

Definition at line 653 of file sch_component.cpp.

References m_PathsAndReferences.

Referenced by AddSheetPathReferenceEntryIfMissing(), SetCurrentSheetPath(), SetRef(), and SetUnitSelection().

656 {
657  wxString h_path, h_ref;
658  wxStringTokenizer tokenizer;
659  wxString separators( wxT( " " ) );
660 
661  // Search for an existing path and remove it if found (should not occur)
662  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
663  {
664  tokenizer.SetString( m_PathsAndReferences[ii], separators );
665  h_path = tokenizer.GetNextToken();
666 
667  if( h_path.Cmp( aPath ) == 0 )
668  {
669  m_PathsAndReferences.RemoveAt( ii );
670  ii--;
671  }
672  }
673 
674  h_ref = aPath + wxT( " " ) + aRef;
675  h_ref << wxT( " " ) << aMulti;
676  m_PathsAndReferences.Add( h_ref );
677 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing ( const wxString &  aSheetPathName)

Add aSheetPath in m_PathsAndReferences alternate references list, if this entry does not exist Do nothing if already exists.

In component lists shared by more than one sheet path, an entry for each sheet path must exist to manage references

Parameters
aSheetPathNameis the candidate sheet path name this sheet path is the sheet path of the sheet containing the component, not the full component sheet path
Returns
false if the alternate reference was existing, true if added.

Definition at line 1132 of file sch_component.cpp.

References AddHierarchicalReference(), Format(), GetText(), EDA_ITEM::GetTimeStamp(), m_Fields, m_PathsAndReferences, m_unit, and REFERENCE.

Referenced by GetTransform().

1133 {
1134  // a empty sheet path is illegal:
1135  wxCHECK( !aSheetPathName.IsEmpty(), false );
1136 
1137  wxString reference_path;
1138 
1139  // The full component reference path is aSheetPathName + the component time stamp itself
1140  // full_AR_path is the alternate reference path to search
1141  wxString full_AR_path = aSheetPathName
1142  + wxString::Format( "%8.8lX", (unsigned long) GetTimeStamp() );
1143 
1144  for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
1145  {
1146  // Break hierarchical reference in path, ref and multi selection:
1147  reference_path = m_PathsAndReferences[ii].BeforeFirst( ' ' );
1148 
1149  // if aSheetPath is found, nothing to do:
1150  if( reference_path.Cmp( full_AR_path ) == 0 )
1151  return false;
1152  }
1153 
1154  // This entry does not exist: add it, with a (temporary?) reference (last ref used for display)
1156  return true;
1157 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
Field Reference of part, i.e. "IC21".
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.
timestamp_t GetTimeStamp() const
Definition: base_struct.h:207
void SCH_COMPONENT::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inline

Autoplace fields only if correct to do so automatically.

Fields that have been moved by hand are not automatically placed.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the component.

Definition at line 449 of file sch_component.h.

References AutoplaceFields(), GetFieldsAutoplaced(), GetPin(), and GetPins().

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnRotate(), and SCH_EDIT_FRAME::OnSelectUnit().

450  {
451  if( GetFieldsAutoplaced() )
453  }
AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Automatically orient all the fields in the component.
void SCH_COMPONENT::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)

Automatically orient all the fields in the component.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the component. This can be NULL when aManual is false.
aManualshould be true if the autoplace was manually initiated (e.g. by a hotkey or a menu item). Some more 'intelligent' routines will be used that would be annoying if done automatically during moves.

Definition at line 717 of file autoplace_fields.cpp.

References AUTOPLACER::DoAutoplace().

Referenced by AutoAutoplaceFields(), ClearFieldsAutoplaced(), SCH_EDIT_FRAME::Load_Component(), and SCH_EDIT_FRAME::OnAutoplaceFields().

718 {
719  if( aManual )
720  wxASSERT_MSG( aScreen, "A SCH_SCREEN pointer must be given for manual autoplacement" );
721  AUTOPLACER autoplacer( this, aScreen );
722  autoplacer.DoAutoplace( aManual );
724 }
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
SCH_ITEM* SCH_ITEM::Back ( ) const
inlineinherited

Definition at line 144 of file sch_item_struct.h.

Referenced by DrawSegment(), SCH_SHEET_PATH::FindPreviousItem(), and SCH_SHEET_LIST::FindPreviousItem().

144 { return static_cast<SCH_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:168
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
bool SCH_COMPONENT::CanConnect ( const SCH_ITEM aItem) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 598 of file sch_component.h.

References GetConnectionPoints(), GetDrawItem(), SCH_ITEM::GetLayer(), GetMenuImage(), GetNetListItem(), GetSelectMenuText(), IsInNetlist(), LAYER_WIRE, operator!=(), operator<(), operator=(), operator==(), SCH_JUNCTION_T, SCH_LINE_T, SCH_NO_CONNECT_T, EDA_ITEM::Type(), TYPE_NOT_INIT, and Visit().

599  {
600  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
601  ( aItem->Type() == SCH_NO_CONNECT_T ) ||
602  ( aItem->Type() == SCH_JUNCTION_T );
603  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
virtual bool SCH_ITEM::CanIncrementLabel ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT.

Definition at line 344 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem().

344 { return false; }
static bool SCH_COMPONENT::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 152 of file sch_component.h.

References SCH_COMPONENT_T, and EDA_ITEM::Type().

153  {
154  return aItem && SCH_COMPONENT_T == aItem->Type();
155  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void SCH_COMPONENT::ClearAllHighlightFlags ( )

Clear the HIGHLIGHTED flag of all items of the component (fields, pins ...)

Definition at line 2000 of file sch_component.cpp.

References EDA_ITEM::ClearFlags(), ClearHighlightedPins(), HIGHLIGHTED, and m_Fields.

Referenced by GetTransform().

2001 {
2003 
2004  // Clear the HIGHLIGHTED flag of pins
2006 
2007  // Clear the HIGHLIGHTED flag of other items, currently only fields
2008  for( SCH_FIELD& each_field : m_Fields )
2009  each_field.ClearFlags( HIGHLIGHTED );
2010 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void ClearHighlightedPins()
void SCH_COMPONENT::ClearAnnotation ( SCH_SHEET_PATH aSheetPath)

Clear exiting component annotation.

For example, IC23 would be changed to IC? and unit number would be reset.

Parameters
aSheetPathis the hierarchical path of the symbol to clear or remove all annotations for this symbol if NULL.

Definition at line 1082 of file sch_component.cpp.

References GetPath(), IsReferenceStringValid(), m_Fields, m_part, m_PathsAndReferences, m_prefix, REFERENCE, and EDA_ITEM::SetModified().

Referenced by SCH_SCREEN::ClearAnnotation(), GetTransform(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), and SCH_EDIT_FRAME::PasteListOfItems().

1083 {
1084  wxArrayString reference_fields;
1085  static const wxChar separators[] = wxT( " " );
1086  PART_SPTR part = m_part.lock();
1087 
1088  // Build a reference with no annotation,
1089  // i.e. a reference ended by only one '?'
1090  wxString defRef = m_prefix;
1091 
1092  if( !IsReferenceStringValid( defRef ) )
1093  { // This is a malformed reference: reinit this reference
1094  m_prefix = defRef = wxT("U"); // Set to default ref prefix
1095  }
1096 
1097  while( defRef.Last() == '?' )
1098  defRef.RemoveLast();
1099 
1100  defRef.Append( wxT( "?" ) );
1101 
1102  wxString path;
1103 
1104  if( aSheetPath )
1105  path = GetPath( aSheetPath );
1106 
1107  for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
1108  {
1109  // Break hierarchical reference in path, ref and multi selection:
1110  reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
1111 
1112  // For all components: if aSheetPath is not NULL,
1113  // remove annotation only for the given path
1114  if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
1115  {
1116  wxString NewHref = reference_fields[0];
1117  NewHref << wxT( " " ) << defRef << wxT( " " ) << reference_fields[2];
1118  m_PathsAndReferences[ii] = NewHref;
1119  }
1120  }
1121 
1122  // These 2 changes do not work in complex hierarchy.
1123  // When a clear annotation is made, the calling function must call a
1124  // UpdateAllScreenReferences for the active sheet.
1125  // But this call cannot made here.
1126  m_Fields[REFERENCE].SetText( defRef ); //for drawing.
1127 
1128  SetModified();
1129 }
void SetModified()
wxString GetPath(const SCH_SHEET_PATH *sheet) const
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
Field Reference of part, i.e. "IC21".
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 236 of file base_struct.h.

References BRIGHTENED, EDA_ITEM::ClearFlags(), and EDA_ITEM::SetModified().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::unhighlight().

236 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void SCH_ITEM::ClearConnections ( )
inlineinherited

Function ClearConnections clears all of the connection items from the list.

The vector release method is used to prevent the item pointers from being deleted. Do not use the vector erase method on the connection list.

Definition at line 304 of file sch_item_struct.h.

304 { m_connections.clear(); }
EDA_ITEMS m_connections
List of items connected to this item.
void SCH_COMPONENT::ClearFieldsAutoplaced ( )
inline

Set fields automatically placed flag false.

Definition at line 428 of file sch_component.h.

References AUTOPLACED_NO, and AutoplaceFields().

Referenced by SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::PrepareMoveItem(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 257 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToScreen(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), DRAG_LIST::ClearList(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), EraseDragList(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), KIGFX::SCH_VIEW::HighlightItem(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), MarkItemsInBloc(), MirrorX(), MirrorY(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

257 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 235 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

235 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
void SCH_COMPONENT::ClearHighlightedPins ( )

Definition at line 1982 of file sch_component.cpp.

References m_highlightedPins.

Referenced by ClearAllHighlightFlags(), and SetPosition().

1983 {
1984  m_highlightedPins.clear();
1985 }
std::set< wxString > m_highlightedPins
God forgive me - Tom.
Definition: sch_component.h:96
void EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 234 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), EDIT_TOOL::Duplicate(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unhighlight(), and GERBVIEW_SELECTION_TOOL::unselectVisually().

234 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:121
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
EDA_ITEM * SCH_COMPONENT::Clone ( ) const
overridevirtual

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 222 of file sch_component.cpp.

References SCH_COMPONENT().

Referenced by SetPosition().

223 {
224  return new SCH_COMPONENT( *this );
225 }
SCH_COMPONENT(const wxPoint &pos=wxPoint(0, 0), SCH_ITEM *aParent=NULL)
bool SCH_COMPONENT::doIsConnected ( const wxPoint &  aPosition) const
overrideprivatevirtual

Function doIsConnected provides the object specific test to see if it is connected to aPosition.

Note
Override this function if the derived object can be connect to another object such as a wire, bus, or junction. Do not override this function for objects that cannot have connections. The default will always return false. This functions is call through the public function IsConnected() which performs tests common to all schematic items before calling the item specific connection testing.
Parameters
aPositionA reference to a wxPoint object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented from SCH_ITEM.

Definition at line 1950 of file sch_component.cpp.

References TRANSFORM::InverseTransform(), m_Pins, m_Pos, m_transform, and TRANSFORM::TransformCoordinate().

Referenced by SetPosition().

1951 {
1952  wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_Pos );
1953  return std::find( m_Pins.begin(), m_Pins.end(), new_pos ) != m_Pins.end();
1954 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
TRANSFORM InverseTransform() const
Calculate the Inverse mirror/rotation transform.
Definition: transform.cpp:58
void SCH_COMPONENT::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED 
)
inlineoverridevirtual

Function Draw Draw a schematic item.

Each schematic item should have its own method

Parameters
aPanelDrawPanel to use (can be null) mainly used for clipping purposes.
aDCDevice Context (can be null)
aOffsetdrawing Offset (usually wxPoint(0,0), but can be different when moving an object)
aDrawModeGR_OR, GR_XOR, ...
aColorCOLOR4D::UNSPECIFIED to use the normal body item color, or force this color if it is a valid color

Implements SCH_ITEM.

Definition at line 477 of file sch_component.h.

References GetPath(), IsReferenceStringValid(), and SwapData().

479  {
480  Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
481  }
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
void SCH_COMPONENT::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor,
bool  aDrawPinText 
)

Draw a component with or without pin text.

Parameters
aPanelis the panel to use (can be null) mainly used for clipping purposes.
aDCis the device context (can be null)
aOffsetis the drawing offset (usually wxPoint(0,0), but can be different when moving an object)
aDrawModeis the drawing mode, GR_OR, GR_XOR, ...
aColoruse COLOR4D::UNSPECIFIED for the normal body item color or use this color if >= 0
aDrawPinTextuse true to draw pin texts, false to draw only the pin shape usually false to draw a component when moving it and true otherwise.

Definition at line 584 of file sch_component.cpp.

References boundingBox(), BROWN, PART_DRAW_OPTIONS::Default(), SCH_FIELD::Draw(), LIB_PART::Draw(), dummy(), SCH_FIELD::GetBoundingBox(), GetBoundingBox(), EDA_DRAW_PANEL::GetClipBox(), BASE_SCREEN::GetCurItem(), GetField(), GetFieldCount(), EDA_DRAW_PANEL::GetScreen(), GRRect(), EDA_DRAW_PANEL::IsMouseCaptured(), EDA_ITEM::IsMoving(), EDA_TEXT::IsVisible(), m_convert, m_isDangling, m_part, m_Pos, m_transform, m_unit, REFERENCE, and VALUE.

587 {
588  auto opts = PART_DRAW_OPTIONS::Default();
589  opts.draw_mode = aDrawMode;
590  opts.color = aColor;
591  opts.transform = m_transform;
592  opts.show_pin_text = aDrawPinText;
593  opts.draw_visible_fields = false;
594  opts.draw_hidden_fields = false;
595 
596  if( PART_SPTR part = m_part.lock() )
597  {
598  // Draw pin targets if part is being dragged
599  bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured();
600 
601  if( !dragging )
602  {
603  opts.dangling = m_isDangling;
604  }
605 
606  part->Draw( aPanel, aDC, m_Pos + aOffset, m_unit, m_convert, opts );
607  }
608  else // Use dummy() part if the actual cannot be found.
609  {
610  dummy()->Draw( aPanel, aDC, m_Pos + aOffset, 0, 0, opts );
611  }
612 
613  SCH_FIELD* field = GetField( REFERENCE );
614 
615  if( field->IsVisible() && !field->IsMoving() )
616  {
617  field->Draw( aPanel, aDC, aOffset, aDrawMode );
618  }
619 
620  for( int ii = VALUE; ii < GetFieldCount(); ii++ )
621  {
622  field = GetField( ii );
623 
624  if( field->IsMoving() )
625  continue;
626 
627  field->Draw( aPanel, aDC, aOffset, aDrawMode );
628  }
629 
630 #if 0
631  // Only for testing purposes, draw the component bounding box
632  {
634  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
635 #if 1
636  if( GetField( REFERENCE )->IsVisible() )
637  {
638  boundingBox = GetField( REFERENCE )->GetBoundingBox();
639  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
640  }
641 
642  if( GetField( VALUE )->IsVisible() )
643  {
644  boundingBox = GetField( VALUE )->GetBoundingBox();
645  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
646  }
647 #endif
648  }
649 #endif
650 }
virtual BASE_SCREEN * GetScreen()=0
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
Draw part.
bool IsMoving() const
Definition: base_struct.h:221
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_field.cpp:119
virtual EDA_RECT * GetClipBox()
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:94
Field Reference of part, i.e. "IC21".
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
#define VALUE
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
static PART_DRAW_OPTIONS Default()
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_field.cpp:252
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
bool IsVisible() const
Definition: eda_text.h:189
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
Definition: colors.h:62
SCH_FIELD * SCH_COMPONENT::FindField ( const wxString &  aFieldName,
bool  aIncludeDefaultFields = true 
)

Search for a SCH_FIELD with aFieldName.

Parameters
aFieldNameis the name of the field to find.
aIncludeDefaultFieldssearches the library symbol default fields if true.
Returns
the field if found or NULL if the field was not found.

Definition at line 950 of file sch_component.cpp.

References i, m_Fields, and MANDATORY_FIELDS.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), GetTransform(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and UpdateFields().

951 {
952  unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
953 
954  for( unsigned i = start; i<m_Fields.size(); ++i )
955  {
956  if( aFieldName == m_Fields[i].GetName( false ) )
957  {
958  return &m_Fields[i];
959  }
960  }
961 
962  return NULL;
963 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
size_t i
Definition: json11.cpp:597
EDA_RECT SCH_COMPONENT::GetBodyBoundingBox ( ) const

Return a bounding box for the symbol body but not the fields.

Definition at line 1362 of file sch_component.cpp.

References dummy(), LIB_PART::GetBodyBoundingBox(), EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), m_convert, m_part, m_Pos, m_transform, m_unit, EDA_RECT::Offset(), EDA_RECT::SetHeight(), EDA_RECT::SetWidth(), EDA_RECT::SetX(), EDA_RECT::SetY(), TRANSFORM::x1, TRANSFORM::x2, TRANSFORM::y1, and TRANSFORM::y2.

Referenced by AUTOPLACER::AUTOPLACER(), GetBoundingBox(), GetTransform(), HitTest(), and operator<().

1363 {
1364  EDA_RECT bBox;
1365 
1366  if( PART_SPTR part = m_part.lock() )
1367  {
1368  bBox = part->GetBodyBoundingBox( m_unit, m_convert );
1369  }
1370  else
1371  {
1372  bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert );
1373  }
1374 
1375  int x0 = bBox.GetX();
1376  int xm = bBox.GetRight();
1377 
1378  // We must reverse Y values, because matrix orientation
1379  // suppose Y axis normal for the library items coordinates,
1380  // m_transform reverse Y values, but bBox is already reversed!
1381  int y0 = -bBox.GetY();
1382  int ym = -bBox.GetBottom();
1383 
1384  // Compute the real Boundary box (rotated, mirrored ...)
1385  int x1 = m_transform.x1 * x0 + m_transform.y1 * y0;
1386  int y1 = m_transform.x2 * x0 + m_transform.y2 * y0;
1387  int x2 = m_transform.x1 * xm + m_transform.y1 * ym;
1388  int y2 = m_transform.x2 * xm + m_transform.y2 * ym;
1389 
1390  // H and W must be > 0:
1391  if( x2 < x1 )
1392  std::swap( x2, x1 );
1393 
1394  if( y2 < y1 )
1395  std::swap( y2, y1 );
1396 
1397  bBox.SetX( x1 );
1398  bBox.SetY( y1 );
1399  bBox.SetWidth( x2 - x1 );
1400  bBox.SetHeight( y2 - y1 );
1401 
1402  bBox.Offset( m_Pos );
1403  return bBox;
1404 }
void Offset(int dx, int dy)
Definition: eda_rect.h:128
int y2
Definition: transform.h:51
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
const EDA_RECT GetBodyBoundingBox(int aUnit, int aConvert) const
Get the symbol bounding box excluding fields.
int x2
Definition: transform.h:50
int x1
Definition: transform.h:48
int y1
Definition: transform.h:49
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
void SetHeight(int val)
Definition: eda_rect.h:133
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
void SetX(int val)
Definition: eda_rect.h:130
int GetBottom() const
Definition: eda_rect.h:122
int GetRight() const
Definition: eda_rect.h:119
void SetWidth(int val)
Definition: eda_rect.h:132
void SetY(int val)
Definition: eda_rect.h:131
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetX() const
Definition: eda_rect.h:109
int GetY() const
Definition: eda_rect.h:110
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
const EDA_RECT SCH_COMPONENT::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 1407 of file sch_component.cpp.

References GetBodyBoundingBox(), i, m_Fields, and EDA_RECT::Merge().

Referenced by Draw(), GetTransform(), and IsSelectStateChanged().

1408 {
1409  EDA_RECT bbox = GetBodyBoundingBox();
1410 
1411  for( size_t i = 0; i < m_Fields.size(); i++ )
1412  {
1413  bbox.Merge( m_Fields[i].GetBoundingBox() );
1414  }
1415 
1416  return bbox;
1417 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect...
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxString SCH_COMPONENT::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 157 of file sch_component.h.

Referenced by GetScreenCoord(), and operator=().

158  {
159  return wxT( "SCH_COMPONENT" );
160  }
void SCH_COMPONENT::GetConnectionPoints ( std::vector< wxPoint > &  aPoints) const
overridevirtual

Function GetConnectionPoints add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsList of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 1681 of file sch_component.cpp.

References m_Pins, m_Pos, m_transform, and TRANSFORM::TransformCoordinate().

Referenced by CanConnect(), and SCH_EDIT_FRAME::importFile().

1682 {
1683  for( auto pin : m_Pins )
1684  aPoints.push_back( m_transform.TransformCoordinate( pin ) + m_Pos );
1685 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
std::vector<bool>* SCH_COMPONENT::GetDanglingPinFlags ( )
inline

Definition at line 475 of file sch_component.h.

References m_isDangling.

Referenced by KIGFX::SCH_PAINTER::draw().

475 { return &m_isDangling; }
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:94
wxString SCH_COMPONENT::GetDatasheet ( ) const

Return the documentation text for the given part alias.

Definition at line 291 of file sch_component.cpp.

References LIB_ALIAS::GetDocFileName(), GetLibId(), and m_part.

Referenced by GetPartRef(), and UpdateFields().

292 {
293  if( PART_SPTR part = m_part.lock() )
294  {
295  LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() );
296 
297  if( !alias )
298  return wxEmptyString;
299 
300  return alias->GetDocFileName();
301  }
302 
303  return wxEmptyString;
304 }
Part library alias object definition.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
const wxString & GetDocFileName() const
const LIB_ID & GetLibId() const
wxString SCH_COMPONENT::GetDescription ( ) const

Return information about the aliased parts.

Definition at line 275 of file sch_component.cpp.

References LIB_ALIAS::GetDescription(), GetLibId(), and m_part.

Referenced by GetPartRef(), and NETLIST_EXPORTER_GENERIC::makeComponents().

276 {
277  if( PART_SPTR part = m_part.lock() )
278  {
279  LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() );
280 
281  if( !alias )
282  return wxEmptyString;
283 
284  return alias->GetDescription();
285  }
286 
287  return wxEmptyString;
288 }
Part library alias object definition.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
const wxString & GetDescription() override
const LIB_ID & GetLibId() const
LIB_ITEM * SCH_COMPONENT::GetDrawItem ( const wxPoint &  aPosition,
KICAD_T  aType = TYPE_NOT_INIT 
)

Return the component library item at aPosition that is part of this component.

Parameters
aPositionis the schematic position of the component library object.
aTypeis the type of symbol library object to find or any if set to TYPE_NOT_INIT.
Returns
is the symbol library object if found otherwise NULL.

Definition at line 1688 of file sch_component.cpp.

References LIB_PIN_T, m_convert, m_part, m_Pins, m_Pos, m_transform, and m_unit.

Referenced by CanConnect(), and SCH_SCREEN::GetPin().

1689 {
1690  if( PART_SPTR part = m_part.lock() )
1691  {
1692 
1693  m_Pins.clear();
1694 
1695  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1696  {
1697  wxASSERT( pin->Type() == LIB_PIN_T );
1698 
1699  if( pin->GetUnit() && m_unit && ( m_unit != pin->GetUnit() ) )
1700  continue;
1701 
1702  if( pin->GetConvert() && m_convert && ( m_convert != pin->GetConvert() ) )
1703  continue;
1704 
1705  m_Pins.push_back( pin->GetPosition() );
1706  }
1707 
1708  // Calculate the position relative to the component.
1709  wxPoint libPosition = aPosition - m_Pos;
1710 
1711  return part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
1712  }
1713 
1714  return NULL;
1715 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
void SCH_COMPONENT::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Function GetEndPoints adds the schematic item end points to aItemList if the item has end points.

The default version doesn't do anything since many of the schematic object cannot be tested for dangling ends. If you add a new schematic item that can have a dangling end ( no connect ), override this method to provide the correct end points.

Parameters
aItemList- List of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 1574 of file sch_component.cpp.

References GetPinPhysicalPosition(), LIB_PIN_T, m_convert, m_part, m_unit, and PIN_END.

Referenced by Move().

1575 {
1576  if( PART_SPTR part = m_part.lock() )
1577  {
1578  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1579  {
1580  wxASSERT( pin->Type() == LIB_PIN_T );
1581 
1582  if( pin->GetUnit() && m_unit && ( m_unit != pin->GetUnit() ) )
1583  continue;
1584 
1585  if( pin->GetConvert() && m_convert && ( m_convert != pin->GetConvert() ) )
1586  continue;
1587 
1588  DANGLING_END_ITEM item( PIN_END, pin, GetPinPhysicalPosition( pin ), this );
1589  aItemList.push_back( item );
1590  }
1591  }
1592 }
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
Class DANGLING_END_ITEM is a helper class used to store the state of schematic items that can be conn...
wxPoint GetPinPhysicalPosition(const LIB_PIN *Pin) const
SCH_FIELD * SCH_COMPONENT::GetField ( int  aFieldNdx) const

Returns a field in this symbol.

Parameters
aFieldNdxis the index into the array of fields, not a field id.
Returns
is the field at aFieldNdx or NULL if the field does not exist.

Definition at line 890 of file sch_component.cpp.

References m_Fields.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EAGLE_PLUGIN::addImplicitConnections(), AddMenusForComponent(), SIM_PLOT_FRAME::AddTuner(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_SHEET::ComponentCount(), Draw(), SCH_EDIT_FRAME::FindComponentAndItem(), FormatProbeItem(), SCH_SCREEN::GetItem(), LIB_PIN::GetMsgPanelInfo(), GetMsgPanelInfo(), GetRef(), GetScreenCoord(), GetSelectMenuText(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), GetTransform(), SCH_EDIT_FRAME::importFile(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), IsInNetlist(), SCH_EDIT_FRAME::Load_Component(), DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames(), SCH_EAGLE_PLUGIN::loadSchematic(), mapExistingAnnotation(), MirrorX(), MirrorY(), Move(), TUNER_SLIDER::onSave(), operator=(), operator==(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), Rotate(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), SetRef(), SCH_REFERENCE_LIST::sortByReferenceOnly(), SwapData(), TestMultiunitFootprints(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), TUNER_SLIDER::TUNER_SLIDER(), SCH_SHEET_PATH::UpdateAllScreenReferences(), UpdateFields(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), Visit(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

891 {
892  const SCH_FIELD* field;
893 
894  if( (unsigned) aFieldNdx < m_Fields.size() )
895  field = &m_Fields[aFieldNdx];
896  else
897  field = NULL;
898 
899  wxASSERT( field );
900 
901  // use cast to remove const-ness
902  return (SCH_FIELD*) field;
903 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
void SCH_COMPONENT::GetFields ( std::vector< SCH_FIELD * > &  aVector,
bool  aVisibleOnly 
)

Populates a std::vector with SCH_FIELDs.

Parameters
aVectoris the vector to populate.
aVisibleOnlyis used to add only the fields that are visible and contain text.

Definition at line 918 of file sch_component.cpp.

References m_Fields.

Referenced by AUTOPLACER::AUTOPLACER(), KIGFX::SCH_PAINTER::draw(), GetTransform(), and DIALOG_UPDATE_FIELDS::updateFields().

919 {
920  for( SCH_FIELD& each_field : m_Fields )
921  {
922  if( !aVisibleOnly || ( each_field.IsVisible() && !each_field.IsVoid() ) )
923  aVector.push_back( &each_field );
924  }
925 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
AUTOPLACED SCH_COMPONENT::GetFieldsAutoplaced ( ) const
inline

Return whether the fields have been automatically placed.

Definition at line 423 of file sch_component.h.

References m_fieldsAutoplaced.

Referenced by AutoAutoplaceFields().

423 { return m_fieldsAutoplaced; }
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:98
wxString SCH_COMPONENT::GetFieldText ( const wxString &  aFieldName,
SCH_EDIT_FRAME aFrame 
) const

Search for a field named aFieldName and returns text associated with this field.

Parameters
aFieldNameis the name of the field

Definition at line 906 of file sch_component.cpp.

References GetText(), and m_Fields.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), and GetTransform().

907 {
908  for( unsigned int ii = 0; ii < m_Fields.size(); ii++ )
909  {
910  if( aFieldName == m_Fields[ii].GetName() )
911  return m_Fields[ii].GetText();
912  }
913 
914  return wxEmptyString;
915 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 258 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), LIB_EDIT_FRAME::copySelectedItems(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteItem(), SCH_EDIT_FRAME::DeleteItemsInList(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_EDIT_FRAME::OrientComponent(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

258 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
BITMAP_DEF SCH_COMPONENT::GetMenuImage ( ) const
overridevirtual

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1503 of file sch_component.cpp.

Referenced by CanConnect().

1504 {
1505  return add_component_xpm;
1506 }
void SCH_COMPONENT::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 1420 of file sch_component.cpp.

References BROWN, DARKCYAN, DARKRED, dummy(), UTF8::empty(), FOOTPRINT, Format(), LIB_ALIAS::GetDescription(), GetField(), LIB_ALIAS::GetKeyWords(), LIB_ALIAS::GetLib(), GetLibId(), LIB_ID::GetLibNickname(), LIB_ALIAS::GetLibNickname(), LIB_ALIAS::GetName(), GetRef(), EDA_TEXT::GetShownText(), PART_LIB::IsCache(), m_currentSheetPath, m_lib_id, m_part, RED, and VALUE.

Referenced by GetTransform(), and SCH_EDIT_FRAME::Load_Component().

1421 {
1422  wxString msg;
1423 
1424  // part and alias can differ if alias is not the root
1425  if( PART_SPTR part = m_part.lock() )
1426  {
1427  if( part.get() != dummy() )
1428  {
1429  LIB_ALIAS* alias = nullptr;
1430 
1431  if( part->GetLib() && part->GetLib()->IsCache() )
1432  alias = part->GetAlias( GetLibId().Format() );
1433  else
1434  alias = part->GetAlias( GetLibId().GetLibItemName() );
1435 
1436  if( !alias )
1437  return;
1438 
1439  if( m_currentSheetPath )
1440  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ),
1442  DARKCYAN ) );
1443 
1444  msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
1445 
1446  aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
1447 
1448  // Display component reference in library and library
1449  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(),
1450  BROWN ) );
1451 
1452  if( alias->GetName() != part->GetName() )
1453  aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) );
1454 
1455  if( alias->GetLib() && alias->GetLib()->IsCache() )
1456  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), alias->GetLibNickname(), RED ) );
1457  else if( !m_lib_id.GetLibNickname().empty() )
1458  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
1459  BROWN ) );
1460  else
1461  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ), RED ) );
1462 
1463  // Display the current associated footprint, if exists.
1464  if( !GetField( FOOTPRINT )->IsVoid() )
1465  msg = GetField( FOOTPRINT )->GetShownText();
1466  else
1467  msg = _( "<Unknown>" );
1468 
1469  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKRED ) );
1470 
1471  // Display description of the component, and keywords found in lib
1472  aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(),
1473  DARKCYAN ) );
1474  aList.push_back( MSG_PANEL_ITEM( _( "Key words" ), alias->GetKeyWords(), DARKCYAN ) );
1475  }
1476  }
1477  else
1478  {
1479  if( m_currentSheetPath )
1480  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( m_currentSheetPath ),
1481  DARKCYAN ) );
1482 
1483  aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetField( VALUE )->GetShownText(),
1484  DARKCYAN ) );
1485  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetLibId().GetLibItemName(), BROWN ) );
1486 
1487  wxString libNickname = GetLibId().GetLibNickname();
1488 
1489  if( libNickname.empty() )
1490  {
1491  aList.push_back( MSG_PANEL_ITEM( _( "Library" ),
1492  _( "No library defined!!!" ), RED ) );
1493  }
1494  else
1495  {
1496  msg.Printf( _( "Symbol not found in %s!!!" ), libNickname );
1497  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg , RED ) );
1498  }
1499  }
1500 }
Part library alias object definition.
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
bool IsCache() const
PART_LIB * GetLib()
Field Name Module PCB, i.e. "16DIP300".
Definition: colors.h:54
wxString GetLibNickname() const override
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:148
#define VALUE
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
bool empty() const
Definition: utf8.h:108
const wxString & GetKeyWords() const
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
Definition: colors.h:60
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
const wxString & GetDescription() override
const wxString & GetName() const override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
const LIB_ID & GetLibId() const
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
Definition: colors.h:62
void SCH_COMPONENT::GetNetListItem ( NETLIST_OBJECT_LIST aNetListItems,
SCH_SHEET_PATH aSheetPath 
)
overridevirtual

Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems.

Not all schematic objects have net list items associated with them. This method only needs to be overridden for those schematic objects that have net list objects associated with them.

Reimplemented from SCH_ITEM.

Definition at line 1795 of file sch_component.cpp.

References GetConvert(), GetTransform(), GetUnitSelection(), LIB_PIN_T, NETLIST_OBJECT::m_Comp, NETLIST_OBJECT::m_ElectricalPinType, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_Link, m_part, NETLIST_OBJECT::m_PinNum, m_Pos, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_SheetPathInclude, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, NET_PIN, NET_PINLABEL, and TRANSFORM::TransformCoordinate().

Referenced by CanConnect().

1797 {
1798  if( PART_SPTR part = m_part.lock() )
1799  {
1800  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1801  {
1802  wxASSERT( pin->Type() == LIB_PIN_T );
1803 
1804  if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
1805  continue;
1806 
1807  if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )
1808  continue;
1809 
1810  wxPoint pos = GetTransform().TransformCoordinate( pin->GetPosition() ) + m_Pos;
1811 
1812  NETLIST_OBJECT* item = new NETLIST_OBJECT();
1813  item->m_SheetPathInclude = *aSheetPath;
1814  item->m_Comp = (SCH_ITEM*) pin;
1815  item->m_SheetPath = *aSheetPath;
1816  item->m_Type = NET_PIN;
1817  item->m_Link = (SCH_ITEM*) this;
1818  item->m_ElectricalPinType = pin->GetType();
1819  item->m_PinNum = pin->GetNumber();
1820  item->m_Label = pin->GetName();
1821  item->m_Start = item->m_End = pos;
1822 
1823  aNetListItems.push_back( item );
1824 
1825  if( pin->IsPowerConnection() )
1826  {
1827  // There is an associated PIN_LABEL.
1828  item = new NETLIST_OBJECT();
1829  item->m_SheetPathInclude = *aSheetPath;
1830  item->m_Comp = NULL;
1831  item->m_SheetPath = *aSheetPath;
1832  item->m_Type = NET_PINLABEL;
1833  item->m_Label = pin->GetName();
1834  item->m_Start = pos;
1835  item->m_End = item->m_Start;
1836 
1837  aNetListItems.push_back( item );
1838  }
1839  }
1840  }
1841 }
TRANSFORM & GetTransform() const
SCH_SHEET_PATH m_SheetPathInclude
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
int GetUnitSelection(SCH_SHEET_PATH *aSheet)
SCH_SHEET_PATH m_SheetPath
ELECTRICAL_PINTYPE m_ElectricalPinType
NETLIST_ITEM_T m_Type
EDA_ITEM * m_Comp
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
int GetConvert() const
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
SCH_ITEM * m_Link
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
int SCH_COMPONENT::GetOrientation ( )

Get the display symbol orientation.

Because there are different ways to have a given orientation/mirror, the orientation/mirror is not necessary what the user does. For example: a mirrorX then a mirrorY returns no mirror but a rotate. This function finds a rotation and a mirror value CMP_MIRROR_X because this is the first mirror option tested. This can differs from the orientation made by an user. A CMP_MIRROR_Y is returned as a CMP_MIRROR_X with an orientation 180 because they are equivalent.

See also
COMPONENT_ORIENTATION_T
Returns
the orientation and mirror of the symbol.

Definition at line 1287 of file sch_component.cpp.

References CMP_MIRROR_X, CMP_MIRROR_Y, CMP_NORMAL, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, m_transform, and SetOrientation().

Referenced by KIGFX::SCH_PAINTER::draw(), AUTOPLACER::get_preferred_sides(), GetTransform(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow().

1288 {
1289  int rotate_values[] =
1290  {
1291  CMP_ORIENT_0,
1292  CMP_ORIENT_90,
1298  CMP_MIRROR_Y,
1299  CMP_MIRROR_Y + CMP_ORIENT_0,
1300  CMP_MIRROR_Y + CMP_ORIENT_90,
1301  CMP_MIRROR_Y + CMP_ORIENT_180,
1302  CMP_MIRROR_Y + CMP_ORIENT_270
1303  };
1304 
1305  // Try to find the current transform option:
1306  TRANSFORM transform = m_transform;
1307 
1308  for( int type_rotate : rotate_values )
1309  {
1310  SetOrientation( type_rotate );
1311 
1312  if( transform == m_transform )
1313  return type_rotate;
1314  }
1315 
1316  // Error: orientation not found in list (should not happen)
1317  wxMessageBox( wxT( "Component orientation matrix internal error" ) );
1318  m_transform = transform;
1319 
1320  return CMP_NORMAL;
1321 }
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
wxString SCH_COMPONENT::GetPath ( const SCH_SHEET_PATH sheet) const

Definition at line 680 of file sch_component.cpp.

References EDA_ITEM::m_TimeStamp, SCH_SHEET_PATH::Path(), and str.

Referenced by ClearAnnotation(), Draw(), GetRef(), GetUnitSelection(), SetRef(), SetUnitSelection(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

681 {
682  wxCHECK_MSG( sheet != NULL, wxEmptyString,
683  wxT( "Cannot get component path with invalid sheet object." ) );
684 
685  wxString str;
686 
687  str.Printf( wxT( "%8.8lX" ), (long unsigned) m_TimeStamp );
688  return sheet->Path() + str;
689 }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:172
const string & str
Definition: json11.cpp:596
wxString Path() const
Function Path the path uses the time stamps which do not changes even when editing sheet parameters a...
const wxArrayString& SCH_COMPONENT::GetPathsAndReferences ( ) const
inline

Definition at line 162 of file sch_component.h.

References m_PathsAndReferences, and ViewGetLayers().

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

162 { return m_PathsAndReferences; }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
virtual int SCH_ITEM::GetPenSize ( ) const
inlinevirtualinherited

Function GetPenSize virtual pure.

Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented in SCH_SHEET, SCH_BUS_BUS_ENTRY, SCH_TEXT, SCH_BUS_WIRE_ENTRY, SCH_FIELD, SCH_SHEET_PIN, SCH_LINE, and SCH_NO_CONNECT.

Definition at line 182 of file sch_item_struct.h.

References MirrorX(), and MirrorY().

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_JUNCTION::GetBoundingBox(), SCH_BUS_WIRE_ENTRY::GetClass(), SCH_BUS_BUS_ENTRY::GetClass(), and SCH_BITMAP::Plot().

182 { return 0; }
LIB_PIN * SCH_COMPONENT::GetPin ( const wxString &  number)

Find a symbol pin by number.

Parameters
numberis the number of the pin to find.
Returns
Pin object if found, otherwise NULL.

Definition at line 1018 of file sch_component.cpp.

References m_convert, m_part, and m_unit.

Referenced by AutoAutoplaceFields(), and SCH_EDIT_FRAME::FindComponentAndItem().

1019 {
1020  if( PART_SPTR part = m_part.lock() )
1021  {
1022  return part->GetPin( number, m_unit, m_convert );
1023  }
1024  return NULL;
1025 }
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
wxPoint SCH_COMPONENT::GetPinPhysicalPosition ( const LIB_PIN Pin) const

Definition at line 1657 of file sch_component.cpp.

References LIB_PIN::GetPosition(), LIB_PIN_T, m_Pos, m_transform, TRANSFORM::TransformCoordinate(), and EDA_ITEM::Type().

Referenced by SCH_EAGLE_PLUGIN::addImplicitConnections(), SCH_EAGLE_PLUGIN::checkConnections(), GetEndPoints(), SCH_SCREEN::GetPin(), and Move().

1658 {
1659  wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
1660  wxT( "Cannot get physical position of pin." ) );
1661 
1662  return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos;
1663 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:463
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
void SCH_COMPONENT::GetPins ( std::vector< LIB_PIN * > &  aPinsList)

Populate a vector with all the pins.

Parameters
aPinsListis the list to populate with all of the pins.

Definition at line 1028 of file sch_component.cpp.

References m_convert, m_part, and m_unit.

Referenced by AutoAutoplaceFields(), and AUTOPLACER::pins_on_side().

1029 {
1030  if( m_part.expired() )
1031  {
1032  // no pins; nothing to get
1033  }
1034  else if( PART_SPTR part = m_part.lock() )
1035  {
1036  part->GetPins( aPinsList, m_unit, m_convert );
1037  }
1038  else
1039  wxFAIL_MSG( "Could not obtain PART_SPTR lock" );
1040 }
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
wxString SCH_COMPONENT::GetPrefix ( ) const
inline

Definition at line 247 of file sch_component.h.

References m_prefix.

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

247 { return m_prefix; }
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
const wxString SCH_COMPONENT::GetRef ( const SCH_SHEET_PATH aSheet)

Return the reference for the given sheet path.

Returns
the reference for the sheet.

Definition at line 692 of file sch_component.cpp.

References GetField(), GetPath(), GetText(), EDA_TEXT::GetText(), m_PathsAndReferences, m_prefix, REFERENCE, and SetRef().

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), Diagnose(), NETLIST_EXPORTER::findAllUnitsOfComponent(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::GetComponents(), GetMsgPanelInfo(), SCH_SHEET_PATH::GetMultiUnitComponents(), NETLIST_OBJECT::GetShortNetName(), NETLIST_EXPORTER_GENERIC::makeComponents(), NETLIST_EXPORTER_GENERIC::makeListOfNets(), SCH_FIELD::Matches(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), SetCurrentSheetPath(), TestMultiunitFootprints(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), NETLIST_EXPORTER_CADSTAR::writeListOfNets(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

693 {
694  wxString path = GetPath( sheet );
695  wxString h_path, h_ref;
696  wxStringTokenizer tokenizer;
697  wxString separators( wxT( " " ) );
698 
699  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
700  {
701  tokenizer.SetString( m_PathsAndReferences[ii], separators );
702  h_path = tokenizer.GetNextToken();
703 
704  if( h_path.Cmp( path ) == 0 )
705  {
706  h_ref = tokenizer.GetNextToken();
707 
708  /* printf( "GetRef hpath: %s\n",
709  * TO_UTF8( m_PathsAndReferences[ii] ) ); */
710  return h_ref;
711  }
712  }
713 
714  // if it was not found in m_Paths array, then see if it is in
715  // m_Field[REFERENCE] -- if so, use this as a default for this path.
716  // this will happen if we load a version 1 schematic file.
717  // it will also mean that multiple instances of the same sheet by default
718  // all have the same component references, but perhaps this is best.
719  if( !GetField( REFERENCE )->GetText().IsEmpty() )
720  {
721  SetRef( sheet, GetField( REFERENCE )->GetText() );
722  return GetField( REFERENCE )->GetText();
723  }
724 
725  return m_prefix;
726 }
wxString GetPath(const SCH_SHEET_PATH *sheet) const
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
wxPoint SCH_COMPONENT::GetScreenCoord ( const wxPoint &  aPoint)

Returns the coordinate points relative to the orientation of the symbol to aPoint.

The coordinates are always relative to the anchor position of the component.

Parameters
aPointThe coordinates to transform.
Returns
The transformed point.

Definition at line 1324 of file sch_component.cpp.

References LIB_ID::Format(), GetClass(), GetField(), GetFieldCount(), GetLibId(), EDA_TEXT::GetText(), i, SCH_ITEM::m_Layer, m_Pos, m_transform, TO_UTF8, and TRANSFORM::TransformCoordinate().

Referenced by SCH_FIELD::Draw(), and GetTransform().

1325 {
1326  return m_transform.TransformCoordinate( aPoint );
1327 }
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
wxString SCH_COMPONENT::GetSelectMenuText ( EDA_UNITS_T  aUnits) const
overridevirtual

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1718 of file sch_component.cpp.

References Format(), GetField(), GetLibId(), and REFERENCE.

Referenced by CanConnect(), and Matches().

1719 {
1720  return wxString::Format( _( "Symbol %s, %s" ),
1721  GetLibId().GetLibItemName().wx_str(),
1722  GetField( REFERENCE )->GetShownText() );
1723 }
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const LIB_ID & GetLibId() const
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 253 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format(), and GERBER_DRAW_ITEM::HitTest().

253 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:164
wxPoint& SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 155 of file sch_item_struct.h.

Referenced by moveItemWithMouseCursor().

155 { return m_storedPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor) ...
timestamp_t EDA_ITEM::GetTimeStamp ( ) const
inlineinherited

Definition at line 207 of file base_struct.h.

References EDA_ITEM::m_TimeStamp.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), AddSheetPathReferenceEntryIfMissing(), SCH_EDIT_FRAME::AnnotateComponents(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), PCB_EDIT_FRAME::Delete_OldZone_Fill(), PCB_EDIT_FRAME::Delete_Zone_Contour(), DuplicateStruct(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::format(), FormatProbeItem(), NETLIST_OBJECT::GetShortNetName(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), NETLIST_EXPORTER_GENERIC::makeComponents(), mapExistingAnnotation(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), SCH_SHEET_PATH::Path(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_REFERENCE::SCH_REFERENCE(), ZONE_FILLER_TOOL::SegzoneDeleteFill(), SortByTimeStamp(), SwapItemData(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS().

207 { return m_TimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:172
int SCH_COMPONENT::GetUnitCount ( void  ) const

Return the number of units per package of the symbol.

Returns
the number of units per package or zero if the library entry cannot be found.

Definition at line 573 of file sch_component.cpp.

References m_part.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_FIELD::GetFullyQualifiedText(), GetTransform(), SCH_FIELD::Matches(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow().

574 {
575  if( PART_SPTR part = m_part.lock() )
576  {
577  return part->GetUnitCount();
578  }
579 
580  return 0;
581 }
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int SCH_COMPONENT::GetUnitSelection ( SCH_SHEET_PATH aSheet)

Definition at line 827 of file sch_component.cpp.

References GetPath(), m_PathsAndReferences, and m_unit.

Referenced by NETLIST_EXPORTER::findAllUnitsOfComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), GetNetListItem(), SCH_REFERENCE::SCH_REFERENCE(), SetCurrentSheetPath(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

828 {
829  wxString path = GetPath( aSheet );
830  wxString h_path, h_multi;
831  wxStringTokenizer tokenizer;
832  wxString separators( wxT( " " ) );
833 
834  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
835  {
836  tokenizer.SetString( m_PathsAndReferences[ii], separators );
837  h_path = tokenizer.GetNextToken();
838 
839  if( h_path.Cmp( path ) == 0 )
840  {
841  tokenizer.GetNextToken(); // Skip reference
842  h_multi = tokenizer.GetNextToken();
843  long imulti = 1;
844  h_multi.ToLong( &imulti );
845  return imulti;
846  }
847  }
848 
849  // if it was not found in m_Paths array, then use m_unit.
850  // this will happen if we load a version 1 schematic file.
851  return m_unit;
852 }
wxString GetPath(const SCH_SHEET_PATH *sheet) const
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
void SCH_COMPONENT::HighlightPin ( LIB_PIN aPin)

Definition at line 1988 of file sch_component.cpp.

References LIB_PIN::GetNumber(), and m_highlightedPins.

Referenced by SetPosition().

1989 {
1990  m_highlightedPins.insert( aPin->GetNumber() );
1991 }
const wxString & GetNumber() const
Definition: lib_pin.h:194
std::set< wxString > m_highlightedPins
God forgive me - Tom.
Definition: sch_component.h:96
virtual bool SCH_ITEM::HitTest ( const wxPoint &  aPosition) const
inlineoverridevirtualinherited

Function HitTest tests if aPosition is contained within or on the bounding area of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
Returns
True if aPosition is within or on the item bounding area.

Reimplemented from EDA_ITEM.

Definition at line 315 of file sch_item_struct.h.

Referenced by SCH_SCREEN::addConnectedItemsToBlock().

316  {
317  return HitTest( aPosition, 0 );
318  }
virtual bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
bool SCH_COMPONENT::HitTest ( const wxPoint &  aPosition,
int  aAccuracy 
) const
overridevirtual

Function HitTest tests if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from SCH_ITEM.

Definition at line 1922 of file sch_component.cpp.

References EDA_RECT::Contains(), GetBodyBoundingBox(), and EDA_RECT::Inflate().

Referenced by SetPosition().

1923 {
1924  EDA_RECT bBox = GetBodyBoundingBox();
1925  bBox.Inflate( aAccuracy );
1926 
1927  if( bBox.Contains( aPosition ) )
1928  return true;
1929 
1930  return false;
1931 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool SCH_COMPONENT::HitTest ( const EDA_RECT aRect,
bool  aContained = false,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from SCH_ITEM.

Definition at line 1934 of file sch_component.cpp.

References EDA_RECT::Contains(), GetBodyBoundingBox(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_ITEM::m_Flags, SKIP_STRUCT, and STRUCT_DELETED.

1935 {
1937  return false;
1938 
1939  EDA_RECT rect = aRect;
1940 
1941  rect.Inflate( aAccuracy );
1942 
1943  if( aContained )
1944  return rect.Contains( GetBodyBoundingBox() );
1945 
1946  return rect.Intersects( GetBodyBoundingBox() );
1947 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:125
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:123
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void SCH_COMPONENT::Init ( const wxPoint &  pos = wxPoint( 0, 0 ))
private

Definition at line 193 of file sch_component.cpp.

References AddField(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), i, LAYER_REFERENCEPART, LAYER_VALUEPART, m_convert, m_Pos, m_prefix, m_transform, m_unit, MANDATORY_FIELDS, REFERENCE, SCH_ITEM::SetLayer(), and VALUE.

Referenced by SCH_COMPONENT().

194 {
195  m_Pos = pos;
196  m_unit = 0; // In multi unit chip - which unit to draw.
197  m_convert = 0; // De Morgan Handling
198 
199  // The rotation/mirror transformation matrix. pos normal
201 
202  // construct only the mandatory fields, which are the first 4 only.
203  for( int i = 0; i < MANDATORY_FIELDS; ++i )
204  {
205  SCH_FIELD field( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
206 
207  if( i == REFERENCE )
208  field.SetLayer( LAYER_REFERENCEPART );
209  else if( i == VALUE )
210  field.SetLayer( LAYER_VALUEPART );
211 
212  // else keep LAYER_FIELDS from SCH_FIELD constructor
213 
214  // SCH_FIELD's implicitly created copy constructor is called in here
215  AddField( field );
216  }
217 
218  m_prefix = wxString( wxT( "U" ) );
219 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Field Reference of part, i.e. "IC21".
#define VALUE
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
size_t i
Definition: json11.cpp:597
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

227 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
bool SCH_COMPONENT::IsConnectable ( ) const
inlineoverridevirtual

Function IsConnectable returns true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Definition at line 596 of file sch_component.h.

596 { return true; }
bool SCH_ITEM::IsConnected ( const wxPoint &  aPoint) const
inherited

Function IsConnected tests the item to see if it is connected to aPoint.

Parameters
aPointA reference to a wxPoint object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 79 of file sch_item_struct.cpp.

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_Flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), SCH_SCREEN::CountConnectedItems(), and SCH_SCREEN::IsTerminalPoint().

80 {
82  return false;
83 
84  return doIsConnected( aPosition );
85 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:125
virtual bool doIsConnected(const wxPoint &aPosition) const
Function doIsConnected provides the object specific test to see if it is connected to aPosition...
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
virtual bool SCH_ITEM::IsDangling ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT, SCH_LINE, and SCH_BUS_ENTRY_BASE.

Definition at line 265 of file sch_item_struct.h.

265 { return false; }
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

References HIGHLIGHTED.

Referenced by KIGFX::SCH_PAINTER::draw(), and KIGFX::getOverlayColor().

226 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
bool SCH_COMPONENT::IsInNetlist ( ) const
Returns
true if the component is in netlist which means this is not a power component, or something like a component reference starting by #

Definition at line 1957 of file sch_component.cpp.

References GetField(), EDA_TEXT::GetText(), and REFERENCE.

Referenced by AUTOPLACER::AUTOPLACER(), CanConnect(), and NETLIST_OBJECT_LIST::findBestNetNameForEachNet().

1958 {
1959  SCH_FIELD* rf = GetField( REFERENCE );
1960  return ! rf->GetText().StartsWith( wxT( "#" ) );
1961 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

220 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:110
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
bool SCH_COMPONENT::IsMovableFromAnchorPoint ( )
inlineoverridevirtual

Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor.

Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, components).

Returns
false for a component

Reimplemented from SCH_ITEM.

Definition at line 175 of file sch_component.h.

References SetLibId().

175 { return false; }
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), EDIT_TOOL::MoveExact(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

219 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
bool SCH_COMPONENT::IsPinHighlighted ( const LIB_PIN aPin)

Definition at line 1994 of file sch_component.cpp.

References LIB_PIN::GetNumber(), and m_highlightedPins.

Referenced by KIGFX::SCH_PAINTER::draw(), and SetPosition().

1995 {
1996  return m_highlightedPins.find( aPin->GetNumber() ) != m_highlightedPins.end();
1997 }
const wxString & GetNumber() const
Definition: lib_pin.h:194
std::set< wxString > m_highlightedPins
God forgive me - Tom.
Definition: sch_component.h:96
bool SCH_COMPONENT::IsReferenceStringValid ( const wxString &  aReferenceString)
static

Tests for an acceptable reference string.

An acceptable reference string must support unannotation i.e starts by letter

Parameters
aReferenceStringis the reference string to validate
Returns
true if reference string is valid.

Definition at line 729 of file sch_component.cpp.

Referenced by ClearAnnotation(), Draw(), SetRef(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate().

730 {
731  wxString text = aReferenceString;
732  bool ok = true;
733 
734  // Try to unannotate this reference
735  while( !text.IsEmpty() && ( text.Last() == '?' || std::isdigit( text.Last().GetValue() ) ) )
736  text.RemoveLast();
737 
738  if( text.IsEmpty() )
739  ok = false;
740 
741  // Add here other constraints
742  // Currently:no other constraint
743 
744  return ok;
745 }
bool SCH_COMPONENT::IsReplaceable ( ) const
inlineoverridevirtual

Function IsReplaceable.

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented from EDA_ITEM.

Definition at line 640 of file sch_component.h.

640 { return true; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 225 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

225 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:115
bool EDA_ITEM::IsSelected ( ) const
inlineinherited
bool SCH_COMPONENT::IsSelectStateChanged ( const wxRect &  aRect)
overridevirtual

Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed.

This is used by the block selection code to verify if an item is selected or not. True is be return anytime the select state changes. If you need to know the the current selection state, use the IsSelected() method.

Parameters
aRect- Rectangle to test against.

Reimplemented from SCH_ITEM.

Definition at line 1666 of file sch_component.cpp.

References boundingBox(), EDA_ITEM::ClearFlags(), GetBoundingBox(), EDA_ITEM::IsSelected(), SELECTED, and EDA_ITEM::SetFlags().

Referenced by Move().

1667 {
1668  bool previousState = IsSelected();
1669 
1671 
1672  if( aRect.Intersects( boundingBox ) )
1673  SetFlags( SELECTED );
1674  else
1675  ClearFlags( SELECTED );
1676 
1677  return previousState != IsSelected();
1678 }
bool IsSelected() const
Definition: base_struct.h:224
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
#define SELECTED
Definition: base_struct.h:121
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
inlineinherited

Function IsType Checks whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Definition at line 266 of file base_struct.h.

References EOT.

267  {
268  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
269  {
270  if( m_StructType == *p )
271  return true;
272  }
273 
274  return false;
275  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:163
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by SCH_FIELD::Draw().

223 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:118
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 130 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::GetItem(), EDA_ITEM::HitTest(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

134 {
135  EDA_ITEM* p = listStart;
136 
137  for( ; p; p = p->Pnext )
138  {
139  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
140  return SEARCH_QUIT;
141  }
142 
143  return SEARCH_CONTINUE;
144 }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
virtual bool SCH_ITEM::Load ( LINE_READER aLine,
wxString &  aErrorMsg 
)
inlinevirtualinherited

Function Load reads a schematic item from aLine in a .sch file.

Parameters
aLine- Essentially this is file to read the object from.
aErrorMsg- Description of the error if an error occurs while loading the object.
Returns
True if the object loaded successfully.

Definition at line 235 of file sch_item_struct.h.

235 { return false; }
bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 182 of file base_struct.cpp.

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, and EDA_ITEM::IsReplaceable().

183 {
184  wxString text = aText;
185  wxString searchText = aSearchData.GetFindString();
186 
187  // Don't match if searching for replaceable item and the item doesn't support text replace.
188  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
189  return false;
190 
191  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
192  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
193 
194  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
195  {
196  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
197  return text.Matches( searchText );
198 
199  return text.MakeUpper().Matches( searchText.MakeUpper() );
200  }
201 
202  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
203  return aText.Find( searchText ) != wxNOT_FOUND;
204 
205  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
206 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:464
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
bool SCH_COMPONENT::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint *  aFindLocation 
)
overridevirtual

Function Matches compares the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented from EDA_ITEM.

Definition at line 1564 of file sch_component.cpp.

References GetSelectMenuText(), MILLIMETRES, and traceFindItem.

Referenced by Move().

1566 {
1567  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
1568 
1569  // Components are searchable via the child field and pin item text.
1570  return false;
1571 }
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
const wxChar *const traceFindItem
Flag to enable find debug tracing.
void SCH_COMPONENT::MirrorX ( int  aXaxis_position)
overridevirtual

Function MirrorX mirrors item relative to the X axis about aXaxis_position.

Parameters
aXaxis_positionThe X axis position to mirror around.

Implements SCH_ITEM.

Definition at line 1527 of file sch_component.cpp.

References CMP_MIRROR_X, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, MIRROR(), SetOrientation(), and EDA_TEXT::SetTextPos().

Referenced by Move().

1528 {
1529  int dy = m_Pos.y;
1530 
1532  MIRROR( m_Pos.y, aXaxis_position );
1533  dy -= m_Pos.y; // dy,0 is the move vector for this transform
1534 
1535  for( int ii = 0; ii < GetFieldCount(); ii++ )
1536  {
1537  // Move the fields to the new position because the component itself has moved.
1538  wxPoint pos = GetField( ii )->GetTextPos();
1539  pos.y -= dy;
1540  GetField( ii )->SetTextPos( pos );
1541  }
1542 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:114
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SCH_COMPONENT::MirrorY ( int  aYaxis_position)
overridevirtual

Function MirrorY mirrors item relative to the Y axis about aYaxis_position.

Parameters
aYaxis_positionThe Y axis position to mirror around.

Implements SCH_ITEM.

Definition at line 1509 of file sch_component.cpp.

References CMP_MIRROR_Y, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, MIRROR(), SetOrientation(), and EDA_TEXT::SetTextPos().

Referenced by Move().

1510 {
1511  int dx = m_Pos.x;
1512 
1514  MIRROR( m_Pos.x, aYaxis_position );
1515  dx -= m_Pos.x; // dx,0 is the move vector for this transform
1516 
1517  for( int ii = 0; ii < GetFieldCount(); ii++ )
1518  {
1519  // Move the fields to the new position because the component itself has moved.
1520  wxPoint pos = GetField( ii )->GetTextPos();
1521  pos.x -= dx;
1522  GetField( ii )->SetTextPos( pos );
1523  }
1524 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:114
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SCH_COMPONENT::Move ( const wxPoint &  aMoveVector)
inlineoverridevirtual

Function Move moves the item by aMoveVector to a new position.

Parameters
aMoveVector= the displacement vector

Implements SCH_ITEM.

Definition at line 556 of file sch_component.h.

References GetEndPoints(), GetField(), GetFieldCount(), GetPinPhysicalPosition(), IsSelectStateChanged(), Matches(), MirrorX(), MirrorY(), SCH_FIELD::Move(), Rotate(), EDA_ITEM::SetModified(), and UpdateDanglingState().

Referenced by SetPosition().

557  {
558  if( aMoveVector == wxPoint( 0, 0 ) )
559  return;
560 
561  m_Pos += aMoveVector;
562 
563  for( int ii = 0; ii < GetFieldCount(); ii++ )
564  GetField( ii )->Move( aMoveVector );
565 
566  SetModified();
567  }
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_field.h:148
void SetModified()
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
SCH_ITEM* SCH_ITEM::Next ( ) const
inlineinherited

Definition at line 143 of file sch_item_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_BASE_FRAME::AddToScreen(), SCH_SHEET_LIST::AnnotatePowerSymbols(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), NETLIST_OBJECT_LIST::BuildNetListInfo(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SCREEN::CheckIfOnDrawList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::ClearDrawingState(), SCH_SCREEN::CountConnectedItems(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SCH_SCREENS::DeleteAllMarkers(), SCH_EDIT_FRAME::DeleteJunction(), DIALOG_ERC::DisplayERC_MarkersList(), KIGFX::SCH_VIEW::DisplaySheet(), SCH_SCREEN::Draw(), DrawSegment(), SCH_EDIT_FRAME::EndSegment(), SCH_SCREEN::EnsureAlternateReferencesExist(), SCH_EDIT_FRAME::FindComponentAndItem(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FirstDrawList(), SCH_LEGACY_PLUGIN::Format(), get_components(), AUTOPLACER::get_possible_colliders(), SCH_SHEET_PATH::GetComponents(), SCH_SCREEN::GetConnection(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREEN::GetItem(), SCH_SCREEN::GetLabel(), SCH_SCREENS::GetLibNicknames(), SCH_SCREEN::GetLine(), SCH_SCREENS::GetMarkerCount(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SCREEN::GetNode(), SCH_SCREEN::GetPin(), SCH_SCREEN::GetSheet(), getSheetBbox(), SCH_SCREEN::GetSheetLabel(), getSheetPin(), SCH_SCREEN::GetWireOrBus(), SCH_SCREENS::HasNoFullyDefinedLibIds(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_SCREEN::IsJunctionNeeded(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_SCREEN::MarkConnections(), SCH_EAGLE_PLUGIN::moveLabels(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_ERC::OnLeftClickMarkersList(), SCH_EDIT_FRAME::OnUpdateFields(), SCH_SCREEN::Plot(), SCH_EDIT_FRAME::PutDataInPreviousState(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::ReplaceWires(), SCH_EDIT_FRAME::SaveWireImage(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SCREEN::SetComponentFootprint(), SCH_EDIT_FRAME::SetCurrentSheetHighlightFlags(), SCH_SCREEN::TestDanglingEnds(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), SCH_EDIT_FRAME::TrimWire(), and SCH_SCREEN::UpdatePickList().

143 { return static_cast<SCH_ITEM*>( Pnext ); }
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
bool SCH_COMPONENT::operator!= ( const SCH_COMPONENT aComponent) const

Definition at line 1881 of file sch_component.cpp.

Referenced by CanConnect().

1882 {
1883  return !( *this == aComponent );
1884 }
bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 239 of file base_struct.cpp.

References Format(), GetChars(), and EDA_ITEM::GetClass().

Referenced by EDA_ITEM::IsReplaceable(), and LIB_ALIAS::operator==().

240 {
241  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
242  GetChars( GetClass() ) ) );
243 
244  return false;
245 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool SCH_COMPONENT::operator< ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1844 of file sch_component.cpp.

References EDA_RECT::GetArea(), GetBodyBoundingBox(), m_Pos, and EDA_ITEM::Type().

Referenced by CanConnect().

1845 {
1846  if( Type() != aItem.Type() )
1847  return Type() < aItem.Type();
1848 
1849  SCH_COMPONENT* component = (SCH_COMPONENT*) &aItem;
1850 
1851  EDA_RECT rect = GetBodyBoundingBox();
1852 
1853  if( rect.GetArea() != component->GetBodyBoundingBox().GetArea() )
1854  return rect.GetArea() < component->GetBodyBoundingBox().GetArea();
1855 
1856  if( m_Pos.x != component->m_Pos.x )
1857  return m_Pos.x < component->m_Pos.x;
1858 
1859  if( m_Pos.y != component->m_Pos.y )
1860  return m_Pos.y < component->m_Pos.y;
1861 
1862  return false;
1863 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
double GetArea() const
Function GetArea returns the area of the rectangle.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
SCH_ITEM & SCH_COMPONENT::operator= ( const SCH_ITEM aItem)

Definition at line 1887 of file sch_component.cpp.

References SCH_ITEM::GetClass(), GetClass(), GetField(), GetFieldCount(), m_convert, m_Fields, m_lib_id, m_part, m_PathsAndReferences, m_Pins, m_Pos, m_transform, m_unit, EDA_ITEM::operator=(), EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by CanConnect().

1888 {
1889  wxCHECK_MSG( Type() == aItem.Type(), *this,
1890  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1891  GetClass() );
1892 
1893  if( &aItem != this )
1894  {
1895  SCH_ITEM::operator=( aItem );
1896 
1897  SCH_COMPONENT* c = (SCH_COMPONENT*) &aItem;
1898 
1899  m_lib_id = c->m_lib_id;
1900  m_part = c->m_part;
1901  m_Pos = c->m_Pos;
1902  m_unit = c->m_unit;
1903  m_convert = c->m_convert;
1904  m_transform = c->m_transform;
1905  m_Pins = c->m_Pins;
1906 
1908 
1909  m_Fields = c->m_Fields; // std::vector's assignment operator.
1910 
1911  // Reparent fields after assignment to new component.
1912  for( int ii = 0; ii < GetFieldCount(); ++ii )
1913  {
1914  GetField( ii )->SetParent( this );
1915  }
1916  }
1917 
1918  return *this;
1919 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
virtual wxString GetClass() const override
Function GetClass returns the class name.
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
wxString GetClass() const override
Function GetClass returns the class name.
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
bool SCH_COMPONENT::operator== ( const SCH_COMPONENT aComponent) const

Definition at line 1866 of file sch_component.cpp.

References GetField(), GetFieldCount(), EDA_TEXT::GetText(), i, and VALUE.

Referenced by CanConnect().

1867 {
1868  if( GetFieldCount() != aComponent.GetFieldCount() )
1869  return false;
1870 
1871  for( int i = VALUE; i < GetFieldCount(); i++ )
1872  {
1873  if( GetField( i )->GetText().Cmp( aComponent.GetField( i )->GetText() ) != 0 )
1874  return false;
1875  }
1876 
1877  return true;
1878 }
#define VALUE
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
int GetFieldCount() const
Return the number of fields in this symbol.
size_t i
Definition: json11.cpp:597
void SCH_COMPONENT::Plot ( PLOTTER aPlotter)
overridevirtual

Function Plot plots the schematic item to aPlotter.

Parameters
aPlotterA pointer to a PLOTTER object.

Reimplemented from SCH_ITEM.

Definition at line 1964 of file sch_component.cpp.

References GetConvert(), GetTransform(), GetUnit(), i, m_Fields, m_part, and m_Pos.

Referenced by SetPosition().

1965 {
1966  TRANSFORM temp;
1967 
1968  if( PART_SPTR part = m_part.lock() )
1969  {
1970  temp = GetTransform();
1971 
1972  part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
1973 
1974  for( size_t i = 0; i < m_Fields.size(); i++ )
1975  {
1976  m_Fields[i].Plot( aPlotter );
1977  }
1978  }
1979 }
TRANSFORM & GetTransform() const
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
int GetConvert() const
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int GetUnit() const
size_t i
Definition: json11.cpp:597
void SCH_COMPONENT::RemoveField ( const wxString &  aFieldName)

Removes a user field from the symbol.

Parameters
aFieldNameis the user fieldName to remove. Attempts to remove a mandatory field or a non-existant field are silently ignored.

Definition at line 937 of file sch_component.cpp.

References i, m_Fields, and MANDATORY_FIELDS.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), and GetTransform().

938 {
939  for( unsigned i = MANDATORY_FIELDS; i < m_Fields.size(); ++i )
940  {
941  if( aFieldName == m_Fields[i].GetName( false ) )
942  {
943  m_Fields.erase( m_Fields.begin() + i );
944  return;
945  }
946  }
947 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
size_t i
Definition: json11.cpp:597
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 209 of file base_struct.cpp.

References GetChars(), EDA_ITEM::GetClass(), EDA_ITEM::IsReplaceable(), and traceFindReplace.

Referenced by EDA_ITEM::Matches(), SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

210 {
211  wxCHECK_MSG( IsReplaceable(), false,
212  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
213 
214  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
215 
216  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
217  aSearchData.GetFindString() :
218  aSearchData.GetFindString().Upper() );
219 
220  if( result == wxNOT_FOUND )
221  return false;
222 
223  wxString prefix = aText.Left( result );
224  wxString suffix;
225 
226  if( aSearchData.GetFindString().length() + result < aText.length() )
227  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
228 
229  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
230  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
231  GetChars( suffix ) );
232 
233  aText = prefix + aSearchData.GetReplaceString() + suffix;
234 
235  return true;
236 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:464
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 452 of file base_struct.h.

452 { return false; }
bool SCH_COMPONENT::Resolve ( PART_LIBS aLibs)

Assigns the current LIB_PART from aLibs which this symbol is based on.

Parameters
aLibsis the current set of LIB_PARTs to choose from.

Definition at line 307 of file sch_component.cpp.

References PART_LIBS::FindLibPart(), m_lib_id, and m_part.

Referenced by GetPartRef(), SCH_EDIT_FRAME::Load_Component(), ResolveAll(), and SetLibId().

308 {
309  // I've never been happy that the actual individual PART_LIB is left up to
310  // flimsy search path ordering. None-the-less find a part based on that design:
311  if( LIB_PART* part = aLibs->FindLibPart( m_lib_id ) )
312  {
313  m_part = part->SharedPtr();
314  return true;
315  }
316 
317  return false;
318 }
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
Define a library symbol object.
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Search all libraries in the list for a part.
bool SCH_COMPONENT::Resolve ( SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)

Definition at line 321 of file sch_component.cpp.

References PART_LIB::FindAlias(), LIB_ID::Format(), LIB_ID::GetLibNickname(), LIB_ALIAS::GetPart(), LIB_TABLE::HasLibrary(), LIB_ID::IsValid(), SYMBOL_LIB_TABLE::LoadSymbol(), m_lib_id, m_part, LIB_PART::SharedPtr(), and UTF8::wx_str().

322 {
323  LIB_ALIAS* alias = nullptr;
324 
325  try
326  {
327  // LIB_TABLE_BASE::LoadSymbol() throws an IO_ERROR if the the library nickname
328  // is not found in the table so check if the library still exists in the table
329  // before attempting to load the symbol.
330  if( m_lib_id.IsValid() && aLibTable.HasLibrary( m_lib_id.GetLibNickname() ) )
331  alias = aLibTable.LoadSymbol( m_lib_id );
332 
333  // Fall back to cache library. This is temporary until the new schematic file
334  // format is implemented.
335  if( !alias && aCacheLib )
336  alias = aCacheLib->FindAlias( m_lib_id.Format().wx_str() );
337 
338  if( alias && alias->GetPart() )
339  {
340  m_part = alias->GetPart()->SharedPtr();
341  return true;
342  }
343  }
344  catch( const IO_ERROR& )
345  {
346  wxLogDebug( "Cannot resolve library symbol %s", m_lib_id.Format().wx_str() );
347  }
348 
349  return false;
350 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
bool IsValid() const
Definition: lib_id.h:171
Part library alias object definition.
wxString wx_str() const
Definition: utf8.cpp:51
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
PART_SPTR SharedPtr()
LIB_ALIAS * FindAlias(const wxString &aName) const
Find LIB_ALIAS by aName.
LIB_PART * GetPart() const
Get the shared LIB_PART.
UTF8 Format() const
Definition: lib_id.cpp:237
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void SCH_COMPONENT::ResolveAll ( const SCH_COLLECTOR aComponents,
PART_LIBS aLibs 
)
static

Definition at line 369 of file sch_component.cpp.

References COLLECTOR::GetCount(), i, m_convert, m_lib_id, m_part, m_Pins, m_unit, Resolve(), sort_by_libid(), and UpdatePinCache().

Referenced by GetPartRef(), and SCH_SCREEN::UpdateSymbolLinks().

370 {
371  // Usually, many components use the same part lib.
372  // to avoid too long calculation time the list of components is grouped
373  // and once the lib part is found for one member of a group, it is also
374  // set for all other members of this group
375  std::vector<SCH_COMPONENT*> cmp_list;
376 
377  // build the cmp list.
378  for( int i = 0; i < aComponents.GetCount(); ++i )
379  {
380  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
381  wxASSERT( cmp );
382 
383  if( cmp ) // cmp == NULL should not occur.
384  cmp_list.push_back( cmp );
385  }
386 
387  // sort it by lib part. Cmp will be grouped by same lib part.
388  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
389 
390  LIB_ID curr_libid;
391 
392  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
393  {
394  SCH_COMPONENT* cmp = cmp_list[ii];
395  curr_libid = cmp->m_lib_id;
396  cmp->Resolve( aLibs );
397  cmp->UpdatePinCache();
398 
399  // Propagate the m_part pointer to other members using the same lib_id
400  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
401  {
402  SCH_COMPONENT* next_cmp = cmp_list[jj];
403 
404  if( curr_libid != next_cmp->m_lib_id )
405  break;
406 
407  next_cmp->m_part = cmp->m_part;
408 
409  if( ( cmp->m_unit == next_cmp->m_unit ) && ( cmp->m_convert == next_cmp->m_convert ) )
410  // Propagate the pin cache vector as well
411  next_cmp->m_Pins = cmp->m_Pins;
412  else
413  next_cmp->UpdatePinCache();
414 
415  ii = jj;
416  }
417  }
418 }
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
bool Resolve(PART_LIBS *aLibs)
Assigns the current LIB_PART from aLibs which this symbol is based on.
static bool sort_by_libid(const SCH_COMPONENT *ref, SCH_COMPONENT *cmp)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
void UpdatePinCache()
Updates the local cache of pin positions.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
size_t i
Definition: json11.cpp:597
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
void SCH_COMPONENT::ResolveAll ( const SCH_COLLECTOR aComponents,
SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)
static

Definition at line 421 of file sch_component.cpp.

References COLLECTOR::GetCount(), i, m_convert, m_lib_id, m_part, m_Pins, m_unit, Resolve(), sort_by_libid(), and UpdatePinCache().

423 {
424  std::vector<SCH_COMPONENT*> cmp_list;
425 
426  for( int i = 0; i < aComponents.GetCount(); ++i )
427  {
428  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
429 
430  wxCHECK2_MSG( cmp, continue, "Invalid SCH_COMPONENT pointer in list." );
431 
432  cmp_list.push_back( cmp );
433  }
434 
435  // sort it by lib part. Cmp will be grouped by same lib part.
436  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
437 
438  LIB_ID curr_libid;
439 
440  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
441  {
442  SCH_COMPONENT* cmp = cmp_list[ii];
443  curr_libid = cmp->m_lib_id;
444  cmp->Resolve( aLibTable, aCacheLib );
445  cmp->UpdatePinCache();
446 
447  // Propagate the m_part pointer to other members using the same lib_id
448  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
449  {
450  SCH_COMPONENT* next_cmp = cmp_list[jj];
451 
452  if( curr_libid != next_cmp->m_lib_id )
453  break;
454 
455  next_cmp->m_part = cmp->m_part;
456 
457  if( ( cmp->m_unit == next_cmp->m_unit ) && ( cmp->m_convert == next_cmp->m_convert ) )
458  // Propagate the pin cache vector as well
459  next_cmp->m_Pins = cmp->m_Pins;
460  else
461  next_cmp->UpdatePinCache();
462 
463  ii = jj;
464  }
465  }
466 }
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
bool Resolve(PART_LIBS *aLibs)
Assigns the current LIB_PART from aLibs which this symbol is based on.
static bool sort_by_libid(const SCH_COMPONENT *ref, SCH_COMPONENT *cmp)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
void UpdatePinCache()
Updates the local cache of pin positions.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
size_t i
Definition: json11.cpp:597
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
void SCH_COMPONENT::Rotate ( wxPoint  aPosition)
overridevirtual

Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to rotate around.

Implements SCH_ITEM.

Definition at line 1545 of file sch_component.cpp.

References CMP_ROTATE_COUNTERCLOCKWISE, GetField(), GetFieldCount(), EDA_TEXT::GetTextPos(), m_Pos, RotatePoint(), SetOrientation(), and EDA_TEXT::SetTextPos().

Referenced by Move().

1546 {
1547  wxPoint prev = m_Pos;
1548 
1549  RotatePoint( &m_Pos, aPosition, 900 );
1550 
1552 
1553  for( int ii = 0; ii < GetFieldCount(); ii++ )
1554  {
1555  // Move the fields to the new position because the component itself has moved.
1556  wxPoint pos = GetField( ii )->GetTextPos();
1557  pos.x -= prev.x - m_Pos.x;
1558  pos.y -= prev.y - m_Pos.y;
1559  GetField( ii )->SetTextPos( pos );
1560  }
1561 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 215 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

215 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:168
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 232 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::highlight().

232 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
void SCH_COMPONENT::SetConvert ( int  aConvert)

Definition at line 553 of file sch_component.cpp.

References m_convert, and EDA_ITEM::SetModified().

Referenced by SCH_EDIT_FRAME::ConvertPart(), GetConvert(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

554 {
555  if( m_convert != aConvert )
556  {
557  m_convert = aConvert;
558  SetModified();
559  }
560 }
void SetModified()
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
void SCH_COMPONENT::SetCurrentSheetPath ( const SCH_SHEET_PATH aSheetPath)
inline

Definition at line 516 of file sch_component.h.

References AddHierarchicalReference(), GetRef(), GetUnitSelection(), SetRef(), and SetUnitSelection().

Referenced by SCH_EDIT_FRAME::Load_Component().

517  {
518  m_currentSheetPath = aSheetPath;
519  }
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
void SCH_COMPONENT::SetFields ( const SCH_FIELDS aFields)
inline

Set multiple schematic fields.

Parameters
aFieldsare the fields to set in this symbol.

Definition at line 403 of file sch_component.h.

References UpdateFields().

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::updateFields(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

404  {
405  m_Fields = aFields; // vector copying, length is changed possibly
406  }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 256 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), PCB_BASE_FRAME::AddModuleToBoard(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), LIB_EDIT_FRAME::copySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteItem(), KIGFX::SCH_PAINTER::draw(), DrawMovingBlockOutlines(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockPlace(), KIGFX::SCH_VIEW::HighlightItem(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnSelectUnit(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), BLOCK_SELECTOR::SetFlags(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

256 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:178
void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 285 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

285 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:175
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 231 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

231 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
void SCH_ITEM::SetLayer ( SCH_LAYER_ID  aLayer)
inlineinherited

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number.

Definition at line 170 of file sch_item_struct.h.

Referenced by Init(), SCH_FIELD::SCH_FIELD(), and SCH_NO_CONNECT::SCH_NO_CONNECT().

170 { m_Layer = aLayer; }
SCH_LAYER_ID m_Layer
void SCH_COMPONENT::SetLibId ( const LIB_ID aName,
PART_LIBS aLibs = NULL 
)

Definition at line 236 of file sch_component.cpp.

References m_lib_id, m_part, Resolve(), and EDA_ITEM::SetModified().

Referenced by SCH_SCREENS::ChangeSymbolLibNickname(), IsMovableFromAnchorPoint(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

237 {
238  if( m_lib_id != aLibId )
239  {
240  m_lib_id = aLibId;
241  SetModified();
242 
243  if( aLibs )
244  Resolve( aLibs );
245  else
246  m_part.reset();
247  }
248 }
void SetModified()
bool Resolve(PART_LIBS *aLibs)
Assigns the current LIB_PART from aLibs which this symbol is based on.
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
void SCH_COMPONENT::SetLibId ( const LIB_ID aLibId,
SYMBOL_LIB_TABLE aSymLibTable,
PART_LIB aCacheLib 
)

Definition at line 251 of file sch_component.cpp.

References PART_LIB::FindAlias(), LIB_ID::Format(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIB_ALIAS::GetPart(), LIB_TABLE::HasLibrary(), SYMBOL_LIB_TABLE::LoadSymbol(), m_lib_id, m_part, EDA_ITEM::SetModified(), LIB_PART::SharedPtr(), and UTF8::wx_str().

253 {
254  if( m_lib_id == aLibId )
255  return;
256 
257  m_lib_id = aLibId;
258  SetModified();
259 
260  LIB_ALIAS* alias = nullptr;
261 
262  if( aSymLibTable && aSymLibTable->HasLibrary( m_lib_id.GetLibNickname() ) )
263  alias = aSymLibTable->LoadSymbol( m_lib_id.GetLibNickname(), m_lib_id.GetLibItemName() );
264 
265  if( !alias && aCacheLib )
266  alias = aCacheLib->FindAlias( m_lib_id.Format().wx_str() );
267 
268  if( alias && alias->GetPart() )
269  m_part = alias->GetPart()->SharedPtr();
270  else
271  m_part.reset();
272 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
void SetModified()
Part library alias object definition.
wxString wx_str() const
Definition: utf8.cpp:51
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
PART_SPTR SharedPtr()
LIB_ALIAS * FindAlias(const wxString &aName) const
Find LIB_ALIAS by aName.
LIB_PART * GetPart() const
Get the shared LIB_PART.
UTF8 Format() const
Definition: lib_id.cpp:237
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

217 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:169
void EDA_ITEM::SetModified ( )
inherited

Definition at line 100 of file base_struct.cpp.

References IS_CHANGED, EDA_ITEM::m_Parent, EDA_ITEM::SetFlags(), and EDA_ITEM::SetModified().

Referenced by ClearAnnotation(), EDA_ITEM::ClearBrightened(), SCH_LINE::Move(), LIB_PIN::Move(), Move(), LIB_PART::RemoveDrawItem(), SetConvert(), LIB_PIN::SetLength(), SetLibId(), EDA_ITEM::SetModified(), LIB_FIELD::SetName(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumber(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), SetTransform(), LIB_PIN::SetType(), SetUnit(), LIB_PIN::SetVisible(), and LIB_PIN::SetWidth().

101 {
102  SetFlags( IS_CHANGED );
103 
104  // If this a child object, then the parent modification state also needs to be set.
105  if( m_Parent )
107 }
void SetModified()
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:171
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:110
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 214 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

214 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:167
void SCH_COMPONENT::SetOrientation ( int  aOrientation)

Compute the new transform matrix based on aOrientation for the symbol which is applied to the current transform.

Parameters
aOrientationis the orientation to apply to the transform.

Definition at line 1160 of file sch_component.cpp.

References CMP_MIRROR_X, CMP_MIRROR_Y, CMP_NORMAL, CMP_ORIENT_0, CMP_ORIENT_180, CMP_ORIENT_270, CMP_ORIENT_90, CMP_ROTATE_CLOCKWISE, CMP_ROTATE_COUNTERCLOCKWISE, m_transform, TRANSFORM::x1, TRANSFORM::x2, TRANSFORM::y1, and TRANSFORM::y2.

Referenced by GetOrientation(), GetTransform(), MirrorX(), MirrorY(), SCH_EDIT_FRAME::OrientComponent(), Rotate(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

1161 {
1162  TRANSFORM temp = TRANSFORM();
1163  bool transform = false;
1164 
1165  switch( aOrientation )
1166  {
1167  case CMP_ORIENT_0:
1168  case CMP_NORMAL: // default transform matrix
1169  m_transform.x1 = 1;
1170  m_transform.y2 = -1;
1171  m_transform.x2 = m_transform.y1 = 0;
1172  break;
1173 
1174  case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation)
1175  temp.x1 = temp.y2 = 0;
1176  temp.y1 = 1;
1177  temp.x2 = -1;
1178  transform = true;
1179  break;
1180 
1181  case CMP_ROTATE_CLOCKWISE: // Rotate - (incremental rotation)
1182  temp.x1 = temp.y2 = 0;
1183  temp.y1 = -1;
1184  temp.x2 = 1;
1185  transform = true;
1186  break;
1187 
1188  case CMP_MIRROR_Y: // Mirror Y (incremental rotation)
1189  temp.x1 = -1;
1190  temp.y2 = 1;
1191  temp.y1 = temp.x2 = 0;
1192  transform = true;
1193  break;
1194 
1195  case CMP_MIRROR_X: // Mirror X (incremental rotation)
1196  temp.x1 = 1;
1197  temp.y2 = -1;
1198  temp.y1 = temp.x2 = 0;
1199  transform = true;
1200  break;
1201 
1202  case CMP_ORIENT_90:
1205  break;
1206 
1207  case CMP_ORIENT_180:
1211  break;
1212 
1213  case CMP_ORIENT_270:
1216  break;
1217 
1218  case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
1221  break;
1222 
1223  case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
1226  break;
1227 
1228  case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
1231  break;
1232 
1233  case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
1236  break;
1237 
1238  case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
1241  break;
1242 
1243  case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
1246  break;
1247 
1248  case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
1251  break;
1252 
1253  case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
1256  break;
1257 
1258  default:
1259  transform = false;
1260  wxMessageBox( wxT( "SetRotateMiroir() error: ill value" ) );
1261  break;
1262  }
1263 
1264  if( transform )
1265  {
1266  /* The new matrix transform is the old matrix transform modified by the
1267  * requested transformation, which is the temp transform (rot,
1268  * mirror ..) in order to have (in term of matrix transform):
1269  * transform coord = new_m_transform * coord
1270  * where transform coord is the coord modified by new_m_transform from
1271  * the initial value coord.
1272  * new_m_transform is computed (from old_m_transform and temp) to
1273  * have:
1274  * transform coord = old_m_transform * temp
1275  */
1276  TRANSFORM newTransform;
1277 
1278  newTransform.x1 = m_transform.x1 * temp.x1 + m_transform.x2 * temp.y1;
1279  newTransform.y1 = m_transform.y1 * temp.x1 + m_transform.y2 * temp.y1;
1280  newTransform.x2 = m_transform.x1 * temp.x2 + m_transform.x2 * temp.y2;
1281  newTransform.y2 = m_transform.y1 * temp.x2 + m_transform.y2 * temp.y2;
1282  m_transform = newTransform;
1283  }
1284 }
int y2
Definition: transform.h:51
int x2
Definition: transform.h:50
int x1
Definition: transform.h:48
int y1
Definition: transform.h:49
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SCH_COMPONENT::SetPosition ( const wxPoint &  aPosition)
inlineoverridevirtual

Function SetPosition set the schematic item position to aPosition.

Parameters
aPositionA reference to a wxPoint object containing the new position.

Implements SCH_ITEM.

Definition at line 644 of file sch_component.h.

References ClearHighlightedPins(), Clone(), doIsConnected(), HighlightPin(), HitTest(), IsPinHighlighted(), Move(), and Plot().

644 { Move( aPosition - m_Pos ); }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
void SCH_COMPONENT::SetPrefix ( const wxString &  aPrefix)
inline

Definition at line 249 of file sch_component.h.

249 { m_prefix = aPrefix; }
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
void SCH_COMPONENT::SetRef ( const SCH_SHEET_PATH aSheet,
const wxString &  aReference 
)

Set the reference for the given sheet path for this symbol.

Parameters
aSheetis the hierarchical path of the reference.
aReferenceis the new reference for the symbol.

Definition at line 748 of file sch_component.cpp.

References abs, AddHierarchicalReference(), GetField(), GetPath(), EDA_TEXT::GetText(), EDA_TEXT::GetTextPos(), IsReferenceStringValid(), m_PathsAndReferences, m_Pos, m_prefix, m_unit, REFERENCE, EDA_TEXT::SetText(), and EDA_TEXT::SetTextPos().

Referenced by GetRef(), SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SetCurrentSheetPath(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

749 {
750  wxString path = GetPath( sheet );
751 
752  bool notInArray = true;
753 
754  wxString h_path, h_ref;
755  wxStringTokenizer tokenizer;
756  wxString separators( wxT( " " ) );
757 
758  // check to see if it is already there before inserting it
759  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
760  {
761  tokenizer.SetString( m_PathsAndReferences[ii], separators );
762  h_path = tokenizer.GetNextToken();
763 
764  if( h_path.Cmp( path ) == 0 )
765  {
766  // just update the reference text, not the timestamp.
767  h_ref = h_path + wxT( " " ) + ref;
768  h_ref += wxT( " " );
769  tokenizer.GetNextToken(); // Skip old reference
770  h_ref += tokenizer.GetNextToken(); // Add part selection
771 
772  // Add the part selection
773  m_PathsAndReferences[ii] = h_ref;
774  notInArray = false;
775  }
776  }
777 
778  if( notInArray )
779  AddHierarchicalReference( path, ref, m_unit );
780 
781  SCH_FIELD* rf = GetField( REFERENCE );
782 
783  if( rf->GetText().IsEmpty()
784  || ( abs( rf->GetTextPos().x - m_Pos.x ) +
785  abs( rf->GetTextPos().y - m_Pos.y ) > 10000 ) )
786  {
787  // move it to a reasonable position
788  rf->SetTextPos( m_Pos + wxPoint( 50, 50 ) );
789  }
790 
791  rf->SetText( ref ); // for drawing.
792 
793  // Reinit the m_prefix member if needed
794  wxString prefix = ref;
795 
796  if( IsReferenceStringValid( prefix ) )
797  {
798  while( prefix.Last() == '?' || std::isdigit( prefix.Last().GetValue() ) )
799  prefix.RemoveLast();
800  }
801  else
802  {
803  prefix = wxT( "U" ); // Set to default ref prefix
804  }
805 
806  if( m_prefix != prefix )
807  m_prefix = prefix;
808 }
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
wxString GetPath(const SCH_SHEET_PATH *sheet) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:237
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
#define abs(a)
Definition: auxiliary.h:84
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
void AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.
static bool IsReferenceStringValid(const wxString &aReferenceString)
Tests for an acceptable reference string.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
virtual void SetText(const wxString &aText)
Definition: eda_text.h:154
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 230 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::highlight(), LIB_EDIT_FRAME::pasteClipboard(), and GERBVIEW_SELECTION_TOOL::selectVisually().

230 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:121
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
void SCH_ITEM::SetStoredPos ( wxPoint  aPos)
inlineinherited

Definition at line 156 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::PrepareMoveItem().

156 { m_storedPos = aPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor) ...
void SCH_COMPONENT::SetTimeStamp ( timestamp_t  aNewTimeStamp)

Change the time stamp to aNewTimeStamp and updates the reference path.

See also
m_PathsAndReferences
Parameters
aNewTimeStamp= new time stamp

Definition at line 811 of file sch_component.cpp.

References m_PathsAndReferences, EDA_ITEM::m_TimeStamp, and EDA_ITEM::SetTimeStamp().

Referenced by GetTransform(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::PasteListOfItems(), and SCH_COMPONENT().

812 {
813  wxString string_timestamp, string_oldtimestamp;
814 
815  string_timestamp.Printf( wxT( "%08lX" ), (long unsigned) aNewTimeStamp );
816  string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp );
817  EDA_ITEM::SetTimeStamp( aNewTimeStamp );
818 
819  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
820  {
821  m_PathsAndReferences[ii].Replace( string_oldtimestamp.GetData(),
822  string_timestamp.GetData() );
823  }
824 }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:172
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
void SCH_COMPONENT::SetTransform ( const TRANSFORM aTransform)

Definition at line 563 of file sch_component.cpp.

References m_transform, and EDA_ITEM::SetModified().

Referenced by GetTransform().

564 {
565  if( m_transform != aTransform )
566  {
567  m_transform = aTransform;
568  SetModified();
569  }
570 }
void SetModified()
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
void SCH_COMPONENT::SetUnit ( int  aUnit)

Change the unit number to aUnit.

This has meaning only for symbols made up of multiple units per package.

Note
This also set the modified flag bit
Parameters
aUnitis the new unit to select.

Definition at line 537 of file sch_component.cpp.

References m_unit, and EDA_ITEM::SetModified().

Referenced by GetUnit(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_EDIT_FRAME::PasteListOfItems(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

538 {
539  if( m_unit != aUnit )
540  {
541  m_unit = aUnit;
542  SetModified();
543  }
544 }
void SetModified()
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
void SCH_COMPONENT::SetUnitSelection ( SCH_SHEET_PATH aSheet,
int  aUnitSelection 
)

Definition at line 855 of file sch_component.cpp.

References AddHierarchicalReference(), GetPath(), m_PathsAndReferences, and m_prefix.

Referenced by SCH_EDIT_FRAME::OnSelectUnit(), SetCurrentSheetPath(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

856 {
857  wxString path = GetPath( aSheet );
858 
859  bool notInArray = true;
860 
861  wxString h_path, h_ref;
862  wxStringTokenizer tokenizer;
863  wxString separators( wxT( " " ) );
864 
865  //check to see if it is already there before inserting it
866  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
867  {
868  tokenizer.SetString( m_PathsAndReferences[ii], separators );
869  h_path = tokenizer.GetNextToken();
870 
871  if( h_path.Cmp( path ) == 0 )
872  {
873  //just update the unit selection.
874  h_ref = h_path + wxT( " " );
875  h_ref += tokenizer.GetNextToken(); // Add reference
876  h_ref += wxT( " " );
877  h_ref << aUnitSelection; // Add part selection
878 
879  // Ann the part selection
880  m_PathsAndReferences[ii] = h_ref;
881  notInArray = false;
882  }
883  }
884 
885  if( notInArray )
886  AddHierarchicalReference( path, m_prefix, aUnitSelection );
887 }
wxString GetPath(const SCH_SHEET_PATH *sheet) const
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
void AddHierarchicalReference(const wxString &aPath, const wxString &aRef, int aMulti)
Add a full hierarchical reference to this symbol.
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:85
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 229 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

229 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:118
static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 483 of file base_struct.h.

References EDA_ITEM::Matches(), EDA_ITEM::operator=(), EDA_ITEM::ViewBBox(), and EDA_ITEM::ViewGetLayers().

Referenced by PART_LIB::GetEntryTypePowerNames().

483 { return *aLeft < *aRight; }
void SCH_COMPONENT::SwapData ( SCH_ITEM aItem)
overridevirtual

Function SwapData swap the internal data structures aItem with the schematic item.

Obviously, aItem must have the same type than me

Parameters
aItemThe item to swap the data structures with.

Reimplemented from SCH_ITEM.

Definition at line 1043 of file sch_component.cpp.

References GetField(), GetFieldCount(), m_convert, m_Fields, m_isDangling, m_lib_id, m_part, m_PathsAndReferences, m_Pins, m_Pos, m_transform, m_unit, SCH_COMPONENT_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by Draw().

1044 {
1045  wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
1046  wxT( "Cannot swap data with invalid component." ) );
1047 
1048  SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
1049 
1050  std::swap( m_lib_id, component->m_lib_id );
1051  std::swap( m_part, component->m_part );
1052  std::swap( m_Pos, component->m_Pos );
1053  std::swap( m_unit, component->m_unit );
1054  std::swap( m_convert, component->m_convert );
1055 
1056  std::swap( m_Pins, component->m_Pins );
1057  std::swap( m_isDangling, component->m_isDangling );
1058 
1059  TRANSFORM tmp = m_transform;
1060 
1061  m_transform = component->m_transform;
1062  component->m_transform = tmp;
1063 
1064  m_Fields.swap( component->m_Fields ); // std::vector's swap()
1065 
1066  // Reparent items after copying data
1067  // (after swap(), m_Parent member does not point to the right parent):
1068  for( int ii = 0; ii < component->GetFieldCount(); ++ii )
1069  {
1070  component->GetField( ii )->SetParent( component );
1071  }
1072 
1073  for( int ii = 0; ii < GetFieldCount(); ++ii )
1074  {
1075  GetField( ii )->SetParent( this );
1076  }
1077 
1078  std::swap( m_PathsAndReferences, component->m_PathsAndReferences );
1079 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:90
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:76
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:94
std::vector< wxPoint > m_Pins
Definition: sch_component.h:95
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
PART_REF m_part
points into the PROJECT&#39;s libraries to the LIB_PART for this component
Definition: sch_component.h:92
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:81
int GetFieldCount() const
Return the number of fields in this symbol.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:70
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:82
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:89
KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 201 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), SCH_EDIT_FRAME::addCurrentItemToScreen(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), LIB_EDIT_FRAME::BlockCopySelectedItems(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_EDIT_FRAME::CheckListConnections(), CN_VISITOR::checkZoneItemConnection(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), PCB_TARGET::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), ZONE_CONTAINER::ClassOf(), MARKER_PCB::ClassOf(), DIMENSION::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::ClassOf(), ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), Collect_TrackSegmentsToDrag(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), MODULE::CoverageRatio(), LIB_EDIT_FRAME::CreateGraphicItem(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteNullTrackSegments(), PYTHON_ACTION_PLUGINS::deregister_action(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_ERC::DisplayERC_MarkersList(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), SCH_EDIT_FRAME::DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), EditToolSelectionFilter(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), EDIT_TOOL::FootprintFilter(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), SCH_EDIT_FRAME::ImportSheetPin(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), LIB_EDIT_FRAME::OnEditComponentProperties(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), POINT_EDITOR::OnSelectionChange(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), operator=(), LIB_ITEM::operator==(), OrCell_Trace(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), DRAWING_TOOL::PlaceImportedGraphics(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_BASE_FRAME::RefreshItem(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_TEXT::Rotate(), SCH_EDIT_FRAME::RotateField(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SCH_EDIT_FRAME::SaveWireImage(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), PCB_TARGET::SwapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), VIA::SwapData(), SwapData(), ZONE_CONTAINER::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), SELECTION_TOOL::unhighlight(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_TEXT::UpdateDanglingState(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and Visit().

202  {
203  return m_StructType;
204  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:163
void SCH_COMPONENT::UpdateAllPinCaches ( const SCH_COLLECTOR aComponents)
static

Update the pin cache for all components in aComponents.

Parameters
aComponentscollector of components in screen

Definition at line 490 of file sch_component.cpp.

References COLLECTOR::GetCount(), i, m_convert, m_lib_id, m_Pins, m_unit, sort_by_libid(), and UpdatePinCache().

Referenced by GetUnit(), and SCH_SCREEN::UpdateSymbolLinks().

491 {
492  // Usually, many components use the same part lib.
493  // to avoid too long calculation time the list of components is grouped
494  // and once the lib part is found for one member of a group, it is also
495  // set for all other members of this group
496  std::vector<SCH_COMPONENT*> cmp_list;
497 
498  // build the cmp list.
499  for( int i = 0; i < aComponents.GetCount(); ++i )
500  {
501  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
502  wxASSERT( cmp );
503 
504  if( cmp ) // cmp == NULL should not occur.
505  cmp_list.push_back( cmp );
506  }
507 
508  // sort it by lib part. Cmp will be grouped by same lib part.
509  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
510 
511  LIB_ID curr_libid;
512 
513  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
514  {
515  SCH_COMPONENT* cmp = cmp_list[ii];
516  curr_libid = cmp->m_lib_id;
517  cmp->UpdatePinCache();
518 
519  // Propagate the m_Pins vector to other members using the same lib_id
520  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
521  {
522  SCH_COMPONENT* next_cmp = cmp_list[jj];
523 
524  if( ( curr_libid != next_cmp->m_lib_id )
525  || ( cmp->