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, 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
 
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 GetAliasDescription () const
 Return information about the aliased parts. More...
 
wxString GetAliasDocumentation () 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 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 (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...
 
void SetTimeStamp (time_t aNewTimeStamp)
 Change the time stamp to aNewTimeStamp and updates the reference path. 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 (wxString aFieldName, bool aIncludeDefaultFields=true) 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...
 
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...
 
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 IsPinDanglingStateChanged (std::vector< DANGLING_END_ITEM > &aItemList, LIB_PINS &aLibPins, unsigned aPin)
 Test if the symbol's dangling state has changed for one given pin index. More...
 
bool IsDanglingStateChanged (std::vector< DANGLING_END_ITEM > &aItemList) override
 Test if the component's dangling state has changed for all pins. More...
 
bool IsDangling () const override
 Return whether any pin in this symbol is dangling. More...
 
wxPoint GetPinPhysicalPosition (LIB_PIN *Pin)
 
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 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 () 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...
 
SCH_ITEMNext () const
 
SCH_ITEMBack () const
 
wxPointGetStoredPos ()
 
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...
 
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...
 
time_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
 
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 ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. 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 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 bool IsReferenceStringValid (const wxString &aReferenceString)
 Tests for an acceptable reference string. More...
 
static std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. 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...
 
time_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...
 
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...
 

Friends

class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
 

Detailed Description

Class SCH_COMPONENT describes a real schematic component.

Definition at line 69 of file sch_component.h.

Member Enumeration Documentation

Enumerator
AUTOPLACED_NO 
AUTOPLACED_AUTO 
AUTOPLACED_MANUAL 

Definition at line 74 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 119 of file sch_component.cpp.

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

Referenced by Clone().

119  :
120  SCH_ITEM( aParent, SCH_COMPONENT_T )
121 {
122  Init( aPos );
123  m_currentSheetPath = NULL;
125 }
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:97
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_COMPONENT::SCH_COMPONENT ( LIB_PART aPart,
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.
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 128 of file sch_component.cpp.

References AUTOPLACED_NO, GetField(), GetLibId(), LIB_PART::GetName(), 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, LIB_ID::SetLibItemName(), SetRef(), EDA_TEXT::SetText(), SetTimeStamp(), LIB_PART::SharedPtr(), UpdateFields(), and VALUE.

129  :
130  SCH_ITEM( NULL, SCH_COMPONENT_T )
131 {
132  Init( pos );
133 
134  m_unit = unit;
135  m_convert = convert;
136  m_lib_id.SetLibItemName( aPart.GetName(), false );
137  m_part = aPart.SharedPtr();
138  m_currentSheetPath = NULL;
140 
142 
143  if( setNewItemFlag )
144  m_Flags = IS_NEW | IS_MOVED;
145 
146  // Import user defined fields from the library component
147  UpdateFields( true, true );
148 
149  wxString msg = aPart.GetReferenceField().GetText();
150 
151  if( msg.IsEmpty() )
152  msg = wxT( "U" );
153 
154  m_prefix = msg;
155 
156  // update the reference -- just the prefix for now.
157  msg += wxT( "?" );
158  SetRef( sheet, msg );
159 
160  // Use the schematic component name instead of the library value field name.
161  GetField( VALUE )->SetText( GetLibId().GetLibItemName() );
162 }
void UpdateFields(bool aResetStyle, bool aResetRef=false)
Restores fields to the original library values.
const SCH_SHEET_PATH * m_currentSheetPath
A temporary sheet path is required to generate the correct reference designator string in complex hie...
time_t GetNewTimeStamp()
Definition: common.cpp:166
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
void SetTimeStamp(time_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetName() const
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
PART_SPTR SharedPtr()
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Function SetLibItemName.
Definition: lib_id.cpp:232
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
Field Value of part, i.e. "3.3K".
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:189
const LIB_ID & GetLibId() const
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:97
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:86
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
#define IS_MOVED
Item being moved.
Definition: base_struct.h:126
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 165 of file sch_component.cpp.

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

165  :
166  SCH_ITEM( aComponent )
167 {
168  m_currentSheetPath = NULL;
169  m_Parent = aComponent.m_Parent;
170  m_Pos = aComponent.m_Pos;
171  m_unit = aComponent.m_unit;
172  m_convert = aComponent.m_convert;
173  m_lib_id = aComponent.m_lib_id;
174  m_part = aComponent.m_part;
175 
176  SetTimeStamp( aComponent.m_TimeStamp );
177 
178  m_transform = aComponent.m_transform;
179  m_prefix = aComponent.m_prefix;
181  m_Fields = aComponent.m_Fields;
182 
183  // Re-parent the fields, which before this had aComponent as parent
184  for( int i = 0; i<GetFieldCount(); ++i )
185  {
186  GetField( i )->SetParent( this );
187  }
188 
189  m_isDangling = aComponent.m_isDangling;
191 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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:77
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:95
void SetTimeStamp(time_t aNewTimeStamp)
Change the time stamp to aNewTimeStamp and updates the reference path.
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
int GetFieldCount() const
Return the number of fields in this symbol.
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:97
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:86
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_COMPONENT::~SCH_COMPONENT ( )
inline

Definition at line 148 of file sch_component.h.

148 { }

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 849 of file sch_component.cpp.

References m_Fields.

Referenced by Init(), and UpdateFields().

850 {
851  int newNdx = m_Fields.size();
852 
853  m_Fields.push_back( aField );
854  return &m_Fields[newNdx];
855 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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 551 of file sch_component.cpp.

References m_PathsAndReferences.

Referenced by SetRef(), and SetUnitSelection().

554 {
555  wxString h_path, h_ref;
556  wxStringTokenizer tokenizer;
557  wxString separators( wxT( " " ) );
558 
559  // Search for an existing path and remove it if found (should not occur)
560  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
561  {
562  tokenizer.SetString( m_PathsAndReferences[ii], separators );
563  h_path = tokenizer.GetNextToken();
564 
565  if( h_path.Cmp( aPath ) == 0 )
566  {
567  m_PathsAndReferences.RemoveAt( ii );
568  ii--;
569  }
570  }
571 
572  h_ref = aPath + wxT( " " ) + aRef;
573  h_ref << wxT( " " ) << aMulti;
574  m_PathsAndReferences.Add( h_ref );
575 }
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
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 404 of file sch_component.h.

References AUTOPLACED_MANUAL, AutoplaceFields(), and GetFieldsAutoplaced().

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

405  {
406  if( GetFieldsAutoplaced() )
408  }
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 AUTOPLACED_AUTO, AUTOPLACED_MANUAL, AUTOPLACER::DoAutoplace(), and m_fieldsAutoplaced.

Referenced by AutoAutoplaceFields(), 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:97
SCH_ITEM* SCH_ITEM::Back ( ) const
inlineinherited

Definition at line 148 of file sch_item_struct.h.

References EDA_ITEM::Pback.

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

148 { return static_cast<SCH_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
virtual bool SCH_ITEM::CanIncrementLabel ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT.

Definition at line 340 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem().

340 { return false; }
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 978 of file sch_component.cpp.

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

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

979 {
980  bool keepMulti = false;
981  wxArrayString reference_fields;
982 
983  static const wxChar separators[] = wxT( " " );
984 
985  PART_SPTR part = m_part.lock();
986 
987  if( part && part->UnitsLocked() )
988  keepMulti = true;
989 
990  // Build a reference with no annotation,
991  // i.e. a reference ended by only one '?'
992  wxString defRef = m_prefix;
993 
994  if( IsReferenceStringValid( defRef ) )
995  {
996  while( defRef.Last() == '?' )
997  defRef.RemoveLast();
998  }
999  else
1000  { // This is a malformed reference: reinit this reference
1001  m_prefix = defRef = wxT("U"); // Set to default ref prefix
1002  }
1003 
1004  defRef.Append( wxT( "?" ) );
1005 
1006  wxString multi = wxT( "1" );
1007 
1008  // For components with units locked,
1009  // we cannot remove all annotations: part selection must be kept
1010  // For all components: if aSheetPath is not NULL,
1011  // remove annotation only for the given path
1012  if( keepMulti || aSheetPath )
1013  {
1014  wxString NewHref;
1015  wxString path;
1016 
1017  if( aSheetPath )
1018  path = GetPath( aSheetPath );
1019 
1020  for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
1021  {
1022  // Break hierarchical reference in path, ref and multi selection:
1023  reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
1024 
1025  if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
1026  {
1027  if( keepMulti ) // Get and keep part selection
1028  multi = reference_fields[2];
1029 
1030  NewHref = reference_fields[0];
1031  NewHref << wxT( " " ) << defRef << wxT( " " ) << multi;
1032  m_PathsAndReferences[ii] = NewHref;
1033  }
1034  }
1035  }
1036  else
1037  {
1038  // Clear reference strings, but does not free memory because a new annotation
1039  // will reuse it
1040  m_PathsAndReferences.Empty();
1041  m_unit = 1;
1042  }
1043 
1044  // These 2 changes do not work in complex hierarchy.
1045  // When a clear annotation is made, the calling function must call a
1046  // UpdateAllScreenReferences for the active sheet.
1047  // But this call cannot made here.
1048  m_Fields[REFERENCE].SetText( defRef ); //for drawing.
1049 
1050  SetModified();
1051 }
void SetModified()
wxString GetPath(const SCH_SHEET_PATH *sheet) const
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
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:86
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

247 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
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 300 of file sch_item_struct.h.

300 { 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 383 of file sch_component.h.

References AUTOPLACED_NO.

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

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

Definition at line 268 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(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), 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(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), 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_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), 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(), SCH_EAGLE_PLUGIN::loadSheet(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), 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(), PCBNEW_CONTROL::placeBoardItems(), 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(), EDIT_TOOL::Properties(), 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(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

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

Definition at line 246 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

246 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearSelected ( )
inlineinherited
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 223 of file sch_component.cpp.

References SCH_COMPONENT().

224 {
225  return new SCH_COMPONENT( *this );
226 }
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 1865 of file sch_component.cpp.

References GetConnectionPoints().

1866 {
1867  std::vector< wxPoint > pts;
1868 
1869  GetConnectionPoints( pts );
1870 
1871  for( size_t i = 0; i < pts.size(); i++ )
1872  {
1873  if( pts[i] == aPosition )
1874  return true;
1875  }
1876 
1877  return false;
1878 }
void GetConnectionPoints(std::vector< wxPoint > &aPoints) const override
Function GetConnectionPoints add all the connection points for this item to aPoints.
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 430 of file sch_component.h.

Referenced by SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::Load_Component(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnSelectUnit(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp().

432  {
433  Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
434  }
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 482 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.

485 {
486  auto opts = PART_DRAW_OPTIONS::Default();
487  opts.draw_mode = aDrawMode;
488  opts.color = aColor;
489  opts.transform = m_transform;
490  opts.show_pin_text = aDrawPinText;
491  opts.draw_visible_fields = false;
492  opts.draw_hidden_fields = false;
493 
494  if( PART_SPTR part = m_part.lock() )
495  {
496  // Draw pin targets if part is being dragged
497  bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured();
498 
499  if( !dragging )
500  {
501  opts.dangling = m_isDangling;
502  }
503 
504  part->Draw( aPanel, aDC, m_Pos + aOffset, m_unit, m_convert, opts );
505  }
506  else // Use dummy() part if the actual cannot be found.
507  {
508  dummy()->Draw( aPanel, aDC, m_Pos + aOffset, 0, 0, opts );
509  }
510 
511  SCH_FIELD* field = GetField( REFERENCE );
512 
513  if( field->IsVisible() && !field->IsMoving() )
514  {
515  field->Draw( aPanel, aDC, aOffset, aDrawMode );
516  }
517 
518  for( int ii = VALUE; ii < GetFieldCount(); ii++ )
519  {
520  field = GetField( ii );
521 
522  if( field->IsMoving() )
523  continue;
524 
525  field->Draw( aPanel, aDC, aOffset, aDrawMode );
526  }
527 
528 #if 0
529  // Only for testing purposes, draw the component bounding box
530  {
532  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
533 #if 1
534  if( GetField( REFERENCE )->IsVisible() )
535  {
536  boundingBox = GetField( REFERENCE )->GetBoundingBox();
537  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
538  }
539 
540  if( GetField( VALUE )->IsVisible() )
541  {
542  boundingBox = GetField( VALUE )->GetBoundingBox();
543  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
544  }
545 #endif
546  }
547 #endif
548 }
Class SCH_FIELD instances are attached to a component and provide a place for the component'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:232
EDA_ITEM * GetCurItem() const
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
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:118
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:95
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
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1076
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
bool IsMouseCaptured() const
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
EDA_RECT * GetClipBox()
static PART_DRAW_OPTIONS Default()
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
Field Value of part, i.e. "3.3K".
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:251
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:176
Class EDA_RECT handles the component boundary box.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 858 of file sch_component.cpp.

References m_Fields, and MANDATORY_FIELDS.

Referenced by NETLIST_EXPORTER_PSPICE::GetSpiceField(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and UpdateFields().

859 {
860  unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
861 
862  for( unsigned i = start; i<m_Fields.size(); ++i )
863  {
864  if( aFieldName == m_Fields[i].GetName( false ) )
865  {
866  return &m_Fields[i];
867  }
868  }
869 
870  return NULL;
871 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
std::string SCH_ITEM::FormatAngle ( double  aAngle)
staticinherited

Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.

Note
Internal angles for board items can be either degrees or tenths of degree on how KiCad is built.
Parameters
aAngleA angle value to convert.
Returns
A std::string object containing the converted angle.

Definition at line 124 of file sch_item_struct.cpp.

125 {
126  char temp[50];
127  int len;
128 
129  len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
130 
131  return std::string( temp, len );
132 }
std::string SCH_ITEM::FormatInternalUnits ( int  aValue)
staticinherited

Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate for writing to file.

Parameters
aValueA coordinate value to convert.
Returns
A std::string object containing the converted value.

Definition at line 100 of file sch_item_struct.cpp.

Referenced by SCH_ITEM::FormatInternalUnits().

101 {
102  char buf[50];
103  double engUnits = aValue;
104  int len;
105 
106  if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
107  {
108  len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
109 
110  while( --len > 0 && buf[len] == '0' )
111  buf[len] = '\0';
112 
113  ++len;
114  }
115  else
116  {
117  len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
118  }
119 
120  return std::string( buf, len );
121 }
std::string SCH_ITEM::FormatInternalUnits ( const wxPoint aPoint)
staticinherited

Definition at line 135 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits(), wxPoint::x, and wxPoint::y.

136 {
137  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
138 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate fo...
std::string SCH_ITEM::FormatInternalUnits ( const wxSize &  aSize)
staticinherited

Definition at line 141 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits().

142 {
143  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
144 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate fo...
wxString SCH_COMPONENT::GetAliasDescription ( ) const

Return information about the aliased parts.

Definition at line 268 of file sch_component.cpp.

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

269 {
270  if( PART_SPTR part = m_part.lock() )
271  {
272  LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() );
273 
274  if( !alias )
275  return wxEmptyString;
276 
277  return alias->GetDescription();
278  }
279 
280  return wxEmptyString;
281 }
Part library alias object definition.
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
wxString GetDescription() const
const LIB_ID & GetLibId() const
wxString SCH_COMPONENT::GetAliasDocumentation ( ) const

Return the documentation text for the given part alias.

Definition at line 284 of file sch_component.cpp.

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

285 {
286  if( PART_SPTR part = m_part.lock() )
287  {
288  LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() );
289 
290  if( !alias )
291  return wxEmptyString;
292 
293  return alias->GetDocFileName();
294  }
295 
296  return wxEmptyString;
297 }
Part library alias object definition.
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
wxString GetDocFileName() const
const LIB_ID & GetLibId() const
EDA_RECT SCH_COMPONENT::GetBodyBoundingBox ( ) const

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

Definition at line 1258 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(), HitTest(), and operator<().

1259 {
1260  EDA_RECT bBox;
1261 
1262  if( PART_SPTR part = m_part.lock() )
1263  {
1264  bBox = part->GetBodyBoundingBox( m_unit, m_convert );
1265  }
1266  else
1267  {
1268  bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert );
1269  }
1270 
1271  int x0 = bBox.GetX();
1272  int xm = bBox.GetRight();
1273 
1274  // We must reverse Y values, because matrix orientation
1275  // suppose Y axis normal for the library items coordinates,
1276  // m_transform reverse Y values, but bBox is already reversed!
1277  int y0 = -bBox.GetY();
1278  int ym = -bBox.GetBottom();
1279 
1280  // Compute the real Boundary box (rotated, mirrored ...)
1281  int x1 = m_transform.x1 * x0 + m_transform.y1 * y0;
1282  int y1 = m_transform.x2 * x0 + m_transform.y2 * y0;
1283  int x2 = m_transform.x1 * xm + m_transform.y1 * ym;
1284  int y2 = m_transform.x2 * xm + m_transform.y2 * ym;
1285 
1286  // H and W must be > 0:
1287  if( x2 < x1 )
1288  std::swap( x2, x1 );
1289 
1290  if( y2 < y1 )
1291  std::swap( y2, y1 );
1292 
1293  bBox.SetX( x1 );
1294  bBox.SetY( y1 );
1295  bBox.SetWidth( x2 - x1 );
1296  bBox.SetHeight( y2 - y1 );
1297 
1298  bBox.Offset( m_Pos );
1299  return bBox;
1300 }
void Offset(int dx, int dy)
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:77
const EDA_RECT GetBodyBoundingBox(int aUnit, int aConvert) const
Function GetBodyBoundingBox.
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's libraries to the LIB_PART for this component
Definition: sch_component.h:93
void SetHeight(int val)
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
void SetX(int val)
int GetBottom() const
int GetRight() const
void SetWidth(int val)
void SetY(int val)
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
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.
int GetX() const
int GetY() const
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 1303 of file sch_component.cpp.

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

Referenced by Draw(), and IsSelectStateChanged().

1304 {
1305  EDA_RECT bbox = GetBodyBoundingBox();
1306 
1307  for( size_t i = 0; i < m_Fields.size(); i++ )
1308  {
1309  bbox.Merge( m_Fields[i].GetBoundingBox() );
1310  }
1311 
1312  return bbox;
1313 }
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:91
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...
Class EDA_RECT handles the component boundary box.
wxString SCH_COMPONENT::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 150 of file sch_component.h.

Referenced by operator=().

151  {
152  return wxT( "SCH_COMPONENT" );
153  }
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 1593 of file sch_component.cpp.

References GetLibId(), LIB_PIN_T, m_convert, m_part, m_Pos, m_transform, m_unit, and TRANSFORM::TransformCoordinate().

Referenced by doIsConnected().

1594 {
1595  if( PART_SPTR part = m_part.lock() )
1596  {
1597  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1598  {
1599  wxCHECK_RET( pin->Type() == LIB_PIN_T,
1600  wxT( "GetNextPin() did not return a pin object. Bad programmer!" ) );
1601 
1602  // Skip items not used for this part.
1603  if( m_unit && pin->GetUnit() && ( pin->GetUnit() != m_unit ) )
1604  continue;
1605 
1606  if( m_convert && pin->GetConvert() && ( pin->GetConvert() != m_convert ) )
1607  continue;
1608 
1609  // Calculate the pin position relative to the component position and orientation.
1610  aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos );
1611  }
1612  }
1613  else
1614  {
1615  wxCHECK_RET( 0,
1616  wxT( "Cannot add connection points to list. Cannot find component <" ) +
1617  GetLibId().GetLibItemName() + wxT( "> in any of the loaded libraries." ) );
1618  }
1619 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
const LIB_ID & GetLibId() const
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
int SCH_COMPONENT::GetConvert ( ) const
inline
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 1622 of file sch_component.cpp.

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

Referenced by SCH_SCREEN::GetPin().

1623 {
1624  if( PART_SPTR part = m_part.lock() )
1625  {
1626  // Calculate the position relative to the component.
1627  wxPoint libPosition = aPosition - m_Pos;
1628 
1629  return part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
1630  }
1631 
1632  return NULL;
1633 }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 1465 of file sch_component.cpp.

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

1466 {
1467  if( PART_SPTR part = m_part.lock() )
1468  {
1469  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1470  {
1471  wxASSERT( pin->Type() == LIB_PIN_T );
1472 
1473  if( pin->GetUnit() && m_unit && ( m_unit != pin->GetUnit() ) )
1474  continue;
1475 
1476  if( pin->GetConvert() && m_convert && ( m_convert != pin->GetConvert() ) )
1477  continue;
1478 
1479  DANGLING_END_ITEM item( PIN_END, pin, GetPinPhysicalPosition( pin ) );
1480  aItemList.push_back( item );
1481  }
1482  }
1483 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
wxPoint GetPinPhysicalPosition(LIB_PIN *Pin)
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:82
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
Class DANGLING_END_ITEM is a helper class used to store the state of schematic items that can be conn...
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 788 of file sch_component.cpp.

References m_Fields.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), AddMenusForComponent(), SIM_PLOT_FRAME::AddTuner(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_SHEET::ComponentCount(), Draw(), SCH_EDIT_FRAME::FindComponentAndItem(), FormatProbeItem(), SCH_SCREEN::GetItem(), LIB_PIN::GetMsgPanelInfo(), GetMsgPanelInfo(), GetRef(), GetSelectMenuText(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), IsInNetlist(), SCH_EDIT_FRAME::Load_Component(), 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(), BOM_TABLE_MODEL::SetComponents(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), SetRef(), SCH_REFERENCE_LIST::sortByReferenceOnly(), SwapData(), TUNER_SLIDER::TUNER_SLIDER(), SCH_SHEET_PATH::UpdateAllScreenReferences(), UpdateFields(), Visit(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

789 {
790  const SCH_FIELD* field;
791 
792  if( (unsigned) aFieldNdx < m_Fields.size() )
793  field = &m_Fields[aFieldNdx];
794  else
795  field = NULL;
796 
797  wxASSERT( field );
798 
799  // use cast to remove const-ness
800  return (SCH_FIELD*) field;
801 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
int SCH_COMPONENT::GetFieldCount ( ) const
inline
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 839 of file sch_component.cpp.

References m_Fields.

Referenced by BOM_TABLE_MODEL::AddComponentFields(), AUTOPLACER::AUTOPLACER(), and DIALOG_UPDATE_FIELDS::updateFields().

840 {
841  for( SCH_FIELD& each_field : m_Fields )
842  {
843  if( !aVisibleOnly || ( each_field.IsVisible() && !each_field.IsVoid() ) )
844  aVector.push_back( &each_field );
845  }
846 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
AUTOPLACED SCH_COMPONENT::GetFieldsAutoplaced ( ) const
inline

Return whether the fields have been automatically placed.

Definition at line 378 of file sch_component.h.

References m_fieldsAutoplaced.

Referenced by AutoAutoplaceFields().

378 { return m_fieldsAutoplaced; }
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
Definition: sch_component.h:97
wxString SCH_COMPONENT::GetFieldText ( wxString  aFieldName,
bool  aIncludeDefaultFields = true 
) const

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

Parameters
aFieldNameis the name of the field
aIncludeDefaultFieldsis used to search the default library symbol fields in the search.

Definition at line 804 of file sch_component.cpp.

References TEMPLATE_FIELDNAME::GetDefaultFieldName(), m_Fields, and MANDATORY_FIELDS.

805 {
806  // Field name for comparison
807  wxString cmpFieldName;
808 
809  if( aIncludeDefaultFields )
810  {
811 
812  // Default field names
813  for ( unsigned int i=0; i<MANDATORY_FIELDS; i++)
814  {
815  cmpFieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( i );
816 
817  if( cmpFieldName.Cmp( aFieldName ) == 0 )
818  {
819  return m_Fields[i].GetText();
820  }
821  }
822  }
823 
824  // Search custom fields
825  for( unsigned int ii=MANDATORY_FIELDS; ii<m_Fields.size(); ii++ )
826  {
827  cmpFieldName = m_Fields[ii].GetName();
828 
829  if( cmpFieldName.Cmp( aFieldName ) == 0 )
830  {
831  return m_Fields[ii].GetText();
832  }
833  }
834 
835  return wxEmptyString;
836 }
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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...
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 269 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(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), 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(), 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(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), 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(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), 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(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), 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(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow().

269 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 1394 of file sch_component.cpp.

1395 {
1396  return add_component_xpm;
1397 }
void SCH_COMPONENT::GetMsgPanelInfo ( 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 1316 of file sch_component.cpp.

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

Referenced by SCH_EDIT_FRAME::Load_Component().

1317 {
1318  wxString msg;
1319 
1320  // part and alias can differ if alias is not the root
1321  if( PART_SPTR part = m_part.lock() )
1322  {
1323  if( part.get() != dummy() )
1324  {
1325  LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() );
1326 
1327  if( !alias )
1328  return;
1329 
1330  if( m_currentSheetPath )
1331  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ),
1333  DARKCYAN ) );
1334 
1335  msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
1336 
1337  aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
1338 
1339  // Display component reference in library and library
1340  aList.push_back( MSG_PANEL_ITEM( _( "Component" ), GetLibId().GetLibItemName(),
1341  BROWN ) );
1342 
1343  if( alias->GetName() != part->GetName() )
1344  aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) );
1345 
1346  if( m_lib_id.GetLibNickname().empty() && alias->GetLib() && alias->GetLib()->IsCache() )
1347  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), alias->GetLibraryName(), RED ) );
1348  else if( !m_lib_id.GetLibNickname().empty() )
1349  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
1350  BROWN ) );
1351  else
1352  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), _( "Undefined!!!" ), RED ) );
1353 
1354  // Display the current associated footprint, if exists.
1355  if( !GetField( FOOTPRINT )->IsVoid() )
1356  msg = GetField( FOOTPRINT )->GetShownText();
1357  else
1358  msg = _( "<Unknown>" );
1359 
1360  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKRED ) );
1361 
1362  // Display description of the component, and keywords found in lib
1363  aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(),
1364  DARKCYAN ) );
1365  aList.push_back( MSG_PANEL_ITEM( _( "Key Words" ), alias->GetKeyWords(), DARKCYAN ) );
1366  }
1367  }
1368  else
1369  {
1370  if( m_currentSheetPath )
1371  aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( m_currentSheetPath ),
1372  DARKCYAN ) );
1373 
1374  aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetField( VALUE )->GetShownText(),
1375  DARKCYAN ) );
1376  aList.push_back( MSG_PANEL_ITEM( _( "Symbol" ), GetLibId().GetLibItemName(), BROWN ) );
1377 
1378  wxString libNickname = GetLibId().GetLibNickname();
1379 
1380  if( libNickname.empty() )
1381  {
1382  aList.push_back( MSG_PANEL_ITEM( _( "Library" ),
1383  _( "No library defined!!!" ), RED ) );
1384  }
1385  else
1386  {
1387  msg.Printf( _( "Symbol not found in %s!!!" ), libNickname );
1388  aList.push_back( MSG_PANEL_ITEM( _( "Library" ), msg , RED ) );
1389  }
1390  }
1391 }
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...
const wxString GetLibraryName()
bool IsCache() const
PART_LIB * GetLib()
Field Name Module PCB, i.e. "16DIP300".
Definition: colors.h:54
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
bool empty() const
Definition: utf8.h:108
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
wxString GetDescription() const
Definition: colors.h:60
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
Field Value of part, i.e. "3.3K".
const wxString & GetName() const
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
Function GetLibNickname.
Definition: lib_id.h:108
wxString GetKeyWords() const
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 1711 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().

1713 {
1714  if( PART_SPTR part = m_part.lock() )
1715  {
1716  for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
1717  {
1718  wxASSERT( pin->Type() == LIB_PIN_T );
1719 
1720  if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
1721  continue;
1722 
1723  if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )
1724  continue;
1725 
1726  wxPoint pos = GetTransform().TransformCoordinate( pin->GetPosition() ) + m_Pos;
1727 
1728  NETLIST_OBJECT* item = new NETLIST_OBJECT();
1729  item->m_SheetPathInclude = *aSheetPath;
1730  item->m_Comp = (SCH_ITEM*) pin;
1731  item->m_SheetPath = *aSheetPath;
1732  item->m_Type = NET_PIN;
1733  item->m_Link = (SCH_ITEM*) this;
1734  item->m_ElectricalPinType = pin->GetType();
1735  item->m_PinNum = pin->GetNumber();
1736  item->m_Label = pin->GetName();
1737  item->m_Start = item->m_End = pos;
1738 
1739  aNetListItems.push_back( item );
1740 
1741  if( pin->IsPowerConnection() )
1742  {
1743  // There is an associated PIN_LABEL.
1744  item = new NETLIST_OBJECT();
1745  item->m_SheetPathInclude = *aSheetPath;
1746  item->m_Comp = NULL;
1747  item->m_SheetPath = *aSheetPath;
1748  item->m_Type = NET_PINLABEL;
1749  item->m_Label = pin->GetName();
1750  item->m_Start = pos;
1751  item->m_End = item->m_Start;
1752 
1753  aNetListItems.push_back( item );
1754  }
1755  }
1756  }
1757 }
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:77
int GetUnitSelection(SCH_SHEET_PATH *aSheet)
SCH_SHEET_PATH m_SheetPath
ELECTRICAL_PINTYPE m_ElectricalPinType
NETLIST_ITEM_T m_Type
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's libraries to the LIB_PART for this component
Definition: sch_component.h:93
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
int SCH_COMPONENT::GetOrientation ( void  )

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 1181 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, ROTATE_VALUES_COUNT, and SetOrientation().

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel(), and AUTOPLACER::get_preferred_sides().

1182 {
1183  int type_rotate = CMP_ORIENT_0;
1184  TRANSFORM transform;
1185  int ii;
1186 
1187  #define ROTATE_VALUES_COUNT 12
1188 
1189  // list of all possibilities, but only the first 8 are actually used
1190  int rotate_value[ROTATE_VALUES_COUNT] =
1191  {
1197  CMP_MIRROR_Y + CMP_ORIENT_180, CMP_MIRROR_Y + CMP_ORIENT_270
1198  };
1199 
1200  // Try to find the current transform option:
1201  transform = m_transform;
1202 
1203  for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
1204  {
1205  type_rotate = rotate_value[ii];
1206  SetOrientation( type_rotate );
1207 
1208  if( transform == m_transform )
1209  return type_rotate;
1210  }
1211 
1212  // Error: orientation not found in list (should not happen)
1213  wxMessageBox( wxT( "Component orientation matrix internal error" ) );
1214  m_transform = transform;
1215 
1216  return CMP_NORMAL;
1217 }
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
#define ROTATE_VALUES_COUNT
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 578 of file sch_component.cpp.

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

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

579 {
580  wxCHECK_MSG( sheet != NULL, wxEmptyString,
581  wxT( "Cannot get component path with invalid sheet object." ) );
582 
583  wxString str;
584 
585  str.Printf( wxT( "%8.8lX" ), (long unsigned) m_TimeStamp );
586  return sheet->Path() + str;
587 }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
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 155 of file sch_component.h.

References m_PathsAndReferences.

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

155 { 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 180 of file sch_item_struct.h.

Referenced by SCH_BUS_ENTRY_BASE::Draw(), SCH_JUNCTION::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), SCH_BUS_ENTRY_BASE::Plot(), and SCH_BITMAP::Plot().

180 { 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 921 of file sch_component.cpp.

References m_convert, m_part, and m_unit.

Referenced by SCH_EDIT_FRAME::FindComponentAndItem().

922 {
923  if( PART_SPTR part = m_part.lock() )
924  {
925  return part->GetPin( number, m_unit, m_convert );
926  }
927  return NULL;
928 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
wxPoint SCH_COMPONENT::GetPinPhysicalPosition ( LIB_PIN Pin)

Definition at line 1569 of file sch_component.cpp.

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

Referenced by GetEndPoints(), SCH_SCREEN::GetPin(), and IsPinDanglingStateChanged().

1570 {
1571  wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
1572  wxT( "Cannot get physical position of pin." ) );
1573 
1574  return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos;
1575 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:465
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 931 of file sch_component.cpp.

References m_convert, m_part, and m_unit.

Referenced by NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), and AUTOPLACER::pins_on_side().

932 {
933  if( PART_SPTR part = m_part.lock() )
934  {
935  part->GetPins( aPinsList, m_unit, m_convert );
936  }
937  else
938  wxFAIL_MSG( "Could not obtain PART_SPTR lock" );
939 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
wxPoint SCH_COMPONENT::GetPosition ( ) const
inlineoverridevirtual

Function GetPosition.

Returns
A wxPoint object containing the schematic item position.

Implements SCH_ITEM.

Definition at line 610 of file sch_component.h.

References m_Pos.

Referenced by SCH_FIELD::Draw(), SCH_EDIT_FRAME::FindComponentAndItem(), SCH_FIELD::GetBoundingBox(), LIB_PIN::GetMsgPanelInfo(), SCH_FIELD::GetPosition(), SCH_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), SCH_LEGACY_PLUGIN::saveComponent(), SCH_REFERENCE::SCH_REFERENCE(), and SCH_SCREEN::SetComponentFootprint().

610 { return m_Pos; }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
wxString SCH_COMPONENT::GetPrefix ( ) const
inline

Definition at line 226 of file sch_component.h.

References m_prefix.

Referenced by SCH_LEGACY_PLUGIN::saveComponent().

226 { 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:86
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 590 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(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), NETLIST_EXPORTER_GENERIC::makeComponents(), NETLIST_EXPORTER_GENERIC::makeListOfNets(), SCH_FIELD::Matches(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SCREEN::SetComponentFootprint(), SCH_SHEET_PATH::UpdateAllScreenReferences(), NETLIST_EXPORTER_CADSTAR::writeListOfNets(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

591 {
592  wxString path = GetPath( sheet );
593  wxString h_path, h_ref;
594  wxStringTokenizer tokenizer;
595  wxString separators( wxT( " " ) );
596 
597  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
598  {
599  tokenizer.SetString( m_PathsAndReferences[ii], separators );
600  h_path = tokenizer.GetNextToken();
601 
602  if( h_path.Cmp( path ) == 0 )
603  {
604  h_ref = tokenizer.GetNextToken();
605 
606  /* printf( "GetRef hpath: %s\n",
607  * TO_UTF8( m_PathsAndReferences[ii] ) ); */
608  return h_ref;
609  }
610  }
611 
612  // if it was not found in m_Paths array, then see if it is in
613  // m_Field[REFERENCE] -- if so, use this as a default for this path.
614  // this will happen if we load a version 1 schematic file.
615  // it will also mean that multiple instances of the same sheet by default
616  // all have the same component references, but perhaps this is best.
617  if( !GetField( REFERENCE )->GetText().IsEmpty() )
618  {
619  SetRef( sheet, GetField( REFERENCE )->GetText() );
620  return GetField( REFERENCE )->GetText();
621  }
622 
623  return m_prefix;
624 }
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:130
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:86
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 1220 of file sch_component.cpp.

References m_transform, and TRANSFORM::TransformCoordinate().

Referenced by SCH_FIELD::Draw().

1221 {
1222  return m_transform.TransformCoordinate( aPoint );
1223 }
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:90
wxString SCH_COMPONENT::GetSelectMenuText ( ) 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 1636 of file sch_component.cpp.

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

Referenced by Matches().

1637 {
1638  wxString tmp;
1639  tmp.Printf( _( "Component %s, %s" ),
1640  GetChars( GetLibId().GetLibItemName() ),
1641  GetChars( GetField( REFERENCE )->GetShownText() ) );
1642  return tmp;
1643 }
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
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
const LIB_ID & GetLibId() const
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 264 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

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

Definition at line 159 of file sch_item_struct.h.

References SCH_ITEM::m_storedPos.

Referenced by moveItemWithMouseCursor().

159 { 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) ...
TRANSFORM& SCH_COMPONENT::GetTransform ( ) const
inline
int SCH_COMPONENT::GetUnit ( ) const
inline
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 471 of file sch_component.cpp.

References m_part.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel(), SCH_FIELD::GetFullyQualifiedText(), and SCH_FIELD::Matches().

472 {
473  if( PART_SPTR part = m_part.lock() )
474  {
475  return part->GetUnitCount();
476  }
477 
478  return 0;
479 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int SCH_COMPONENT::GetUnitSelection ( SCH_SHEET_PATH aSheet)

Definition at line 725 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(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

726 {
727  wxString path = GetPath( aSheet );
728  wxString h_path, h_multi;
729  wxStringTokenizer tokenizer;
730  wxString separators( wxT( " " ) );
731 
732  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
733  {
734  tokenizer.SetString( m_PathsAndReferences[ii], separators );
735  h_path = tokenizer.GetNextToken();
736 
737  if( h_path.Cmp( path ) == 0 )
738  {
739  tokenizer.GetNextToken(); // Skip reference
740  h_multi = tokenizer.GetNextToken();
741  long imulti = 1;
742  h_multi.ToLong( &imulti );
743  return imulti;
744  }
745  }
746 
747  // if it was not found in m_Paths array, then use m_unit.
748  // this will happen if we load a version 1 schematic file.
749  return m_unit;
750 }
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:82
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 311 of file sch_item_struct.h.

312  {
313  return HitTest( aPosition, 0 );
314  }
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 1837 of file sch_component.cpp.

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

1838 {
1839  EDA_RECT bBox = GetBodyBoundingBox();
1840  bBox.Inflate( aAccuracy );
1841 
1842  if( bBox.Contains( aPosition ) )
1843  return true;
1844 
1845  return false;
1846 }
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.
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 1849 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.

1850 {
1852  return false;
1853 
1854  EDA_RECT rect = aRect;
1855 
1856  rect.Inflate( aAccuracy );
1857 
1858  if( aContained )
1859  return rect.Contains( GetBodyBoundingBox() );
1860 
1861  return rect.Intersects( GetBodyBoundingBox() );
1862 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:138
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:136
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:189
Class EDA_RECT handles the component boundary box.
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 194 of file sch_component.cpp.

References AddField(), TEMPLATE_FIELDNAME::GetDefaultFieldName(), 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().

195 {
196  m_Pos = pos;
197  m_unit = 0; // In multi unit chip - which unit to draw.
198  m_convert = 0; // De Morgan Handling
199 
200  // The rotation/mirror transformation matrix. pos normal
202 
203  // construct only the mandatory fields, which are the first 4 only.
204  for( int i = 0; i < MANDATORY_FIELDS; ++i )
205  {
206  SCH_FIELD field( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
207 
208  if( i == REFERENCE )
209  field.SetLayer( LAYER_REFERENCEPART );
210  else if( i == VALUE )
211  field.SetLayer( LAYER_VALUEPART );
212 
213  // else keep LAYER_FIELDS from SCH_FIELD constructor
214 
215  // SCH_FIELD's implicitly created copy constructor is called in here
216  AddField( field );
217  }
218 
219  m_prefix = wxString( wxT( "U" ) );
220 }
Class SCH_FIELD instances are attached to a component and provide a place for the component'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:77
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".
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:82
Field Value of part, i.e. "3.3K".
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
wxString m_prefix
C, R, U, Q etc - the first character which typically indicates what the component is...
Definition: sch_component.h:86
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

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

238 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 571 of file sch_component.h.

571 { 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 72 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().

73 {
75  return false;
76 
77  return doIsConnected( aPosition );
78 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:138
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:136
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool SCH_COMPONENT::IsDangling ( ) const
overridevirtual

Return whether any pin in this symbol is dangling.

Note
This does not update the internal status. It only checks the existing status.
Returns
true if any pins of this symbol are not connect otherwise false.

Reimplemented from SCH_ITEM.

Definition at line 1558 of file sch_component.cpp.

References m_isDangling.

1559 {
1560  for( bool each : m_isDangling )
1561  {
1562  if( each )
1563  return true;
1564  }
1565  return false;
1566 }
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:95
bool SCH_COMPONENT::IsDanglingStateChanged ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Test if the component's dangling state has changed for all pins.

As a side effect, actually update the dangling status for all pins.

Note
This does not test for short circuits.
Parameters
aItemListis list of all DANGLING_END_ITEM items to be tested.
Returns
true if any pin's state has changed.

Reimplemented from SCH_ITEM.

Definition at line 1543 of file sch_component.cpp.

References IsPinDanglingStateChanged(), m_convert, m_part, and m_unit.

1544 {
1545  bool changed = false;
1546  LIB_PINS libPins;
1547  if( PART_SPTR part = m_part.lock() )
1548  part->GetPins( libPins, m_unit, m_convert );
1549  for( size_t i = 0; i < libPins.size(); ++i )
1550  {
1551  if( IsPinDanglingStateChanged( aItemList, libPins, i ) )
1552  changed = true;
1553  }
1554  return changed;
1555 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
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:82
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
bool IsPinDanglingStateChanged(std::vector< DANGLING_END_ITEM > &aItemList, LIB_PINS &aLibPins, unsigned aPin)
Test if the symbol's dangling state has changed for one given pin index.
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

References HIGHLIGHTED.

237 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 1881 of file sch_component.cpp.

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

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

1882 {
1883  SCH_FIELD* rf = GetField( REFERENCE );
1884  return ! rf->GetText().StartsWith( wxT( "#" ) );
1885 }
Class SCH_FIELD instances are attached to a component and provide a place for the component'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:130
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

231 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 166 of file sch_component.h.

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

Definition at line 230 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(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), 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(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), 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(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_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(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

230 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool SCH_COMPONENT::IsPinDanglingStateChanged ( std::vector< DANGLING_END_ITEM > &  aItemList,
LIB_PINS aLibPins,
unsigned  aPin 
)

Test if the symbol's dangling state has changed for one given pin index.

As a side effect, it actually updates the dangling status for that pin.

Parameters
aItemListis list of all DANGLING_END_ITEM items to be tested.
aLibPinsis list of all the LIB_PIN items in this symbol
aPinis the index into aLibPins that identifies the pin to test
Returns
true if the pin's state has changed.

Definition at line 1486 of file sch_component.cpp.

References GetPinPhysicalPosition(), IsInNetlist(), LIB_PIN::IsPowerConnection(), JUNCTION_END, LABEL_END, m_isDangling, NO_CONNECT_END, PIN_END, SHEET_LABEL_END, WIRE_END_END, and WIRE_START_END.

Referenced by IsDanglingStateChanged().

1488 {
1489  bool previousState;
1490 
1491  if( aPin < m_isDangling.size() )
1492  {
1493  previousState = m_isDangling[aPin];
1494  m_isDangling[aPin] = true;
1495  }
1496  else
1497  {
1498  previousState = true;
1499  m_isDangling.push_back( true );
1500  }
1501 
1502  wxPoint pin_position = GetPinPhysicalPosition( aLibPins[aPin] );
1503 
1504  for( DANGLING_END_ITEM& each_item : aItemList )
1505  {
1506  // Some people like to stack pins on top of each other in a symbol to indicate
1507  // internal connection. While technically connected, it is not particularly useful
1508  // to display them that way, so skip any pins that are in the same symbol as this
1509  // one.
1510  //
1511  // Do not make this exception for hidden pins, because those actually make internal
1512  // connections to a power net.
1513  const LIB_PIN* item_pin = dynamic_cast<const LIB_PIN*>( each_item.GetItem() );
1514 
1515  if( item_pin
1516  && ( !item_pin->IsPowerConnection() || !IsInNetlist() )
1517  && std::find( aLibPins.begin(), aLibPins.end(), item_pin) != aLibPins.end() )
1518  continue;
1519 
1520  switch( each_item.GetType() )
1521  {
1522  case PIN_END:
1523  case LABEL_END:
1524  case SHEET_LABEL_END:
1525  case WIRE_START_END:
1526  case WIRE_END_END:
1527  case NO_CONNECT_END:
1528  case JUNCTION_END:
1529  if( pin_position == each_item.GetPosition() )
1530  m_isDangling[aPin] = false;
1531  break;
1532  default:
1533  break;
1534  }
1535  if( !m_isDangling[aPin] )
1536  break;
1537  }
1538 
1539  return previousState != m_isDangling[aPin];
1540 }
std::vector< bool > m_isDangling
One isDangling per pin.
Definition: sch_component.h:95
wxPoint GetPinPhysicalPosition(LIB_PIN *Pin)
bool IsInNetlist() const
bool IsPowerConnection() const
Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN...
Definition: lib_pin.h:366
Class DANGLING_END_ITEM is a helper class used to store the state of schematic items that can be conn...
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 627 of file sch_component.cpp.

Referenced by ClearAnnotation(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), SetRef(), and DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow().

628 {
629  wxString text = aReferenceString;
630  bool ok = true;
631 
632  // Try to unannotate this reference
633  while( !text.IsEmpty() && ( text.Last() == '?' || isdigit( text.Last() ) ) )
634  text.RemoveLast();
635 
636  if( text.IsEmpty() )
637  ok = false;
638 
639  // Add here other constraints
640  // Currently:no other constraint
641 
642  return ok;
643 }
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 608 of file sch_component.h.

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

Definition at line 236 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

236 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:128
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 1578 of file sch_component.cpp.

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

1579 {
1580  bool previousState = IsSelected();
1581 
1583 
1584  if( aRect.Intersects( boundingBox ) )
1585  SetFlags( SELECTED );
1586  else
1587  ClearFlags( SELECTED );
1588 
1589  return previousState != IsSelected();
1590 }
bool IsSelected() const
Definition: base_struct.h:235
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:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
Class EDA_RECT handles the component boundary box.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References IS_WIRE_IMAGE.

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

234 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 132 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(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
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:165
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
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 233 of file sch_item_struct.h.

233 { 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 184 of file base_struct.cpp.

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

185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
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 1455 of file sch_component.cpp.

References GetSelectMenuText(), and traceFindItem.

1457 {
1458  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
1459 
1460  // Components are searchable via the child field and pin item text.
1461  return false;
1462 }
const wxString traceFindItem
Flag to enable finding schematic item debug output.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
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 1418 of file sch_component.cpp.

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

1419 {
1420  int dy = m_Pos.y;
1421 
1423  MIRROR( m_Pos.y, aXaxis_position );
1424  dy -= m_Pos.y; // dy,0 is the move vector for this transform
1425 
1426  for( int ii = 0; ii < GetFieldCount(); ii++ )
1427  {
1428  // Move the fields to the new position because the component itself has moved.
1429  wxPoint pos = GetField( ii )->GetTextPos();
1430  pos.y -= dy;
1431  GetField( ii )->SetTextPos( pos );
1432  }
1433 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
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 1400 of file sch_component.cpp.

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

1401 {
1402  int dx = m_Pos.x;
1403 
1405  MIRROR( m_Pos.x, aYaxis_position );
1406  dx -= m_Pos.x; // dx,0 is the move vector for this transform
1407 
1408  for( int ii = 0; ii < GetFieldCount(); ii++ )
1409  {
1410  // Move the fields to the new position because the component itself has moved.
1411  wxPoint pos = GetField( ii )->GetTextPos();
1412  pos.x -= dx;
1413  GetField( ii )->SetTextPos( pos );
1414  }
1415 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
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 509 of file sch_component.h.

References GetField(), GetFieldCount(), SCH_FIELD::Move(), and EDA_ITEM::SetModified().

Referenced by SetPosition().

510  {
511  if( aMoveVector == wxPoint( 0, 0 ) )
512  return;
513 
514  m_Pos += aMoveVector;
515 
516  for( int ii = 0; ii < GetFieldCount(); ii++ )
517  GetField( ii )->Move( aMoveVector );
518 
519  SetModified();
520  }
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:77
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 147 of file sch_item_struct.h.

References EDA_ITEM::Pnext.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_SCREEN::BreakSegment(), SCH_SCREEN::BreakSegmentsOnJunctions(), NETLIST_OBJECT_LIST::BuildNetListInfo(), HIERARCHY_NAVIG_DLG::BuildTree(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SCREEN::CheckIfOnDrawList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::ClearDrawingState(), SCH_SCREEN::CountConnectedItems(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SCH_SCREENS::DeleteAllMarkers(), DIALOG_ERC::DisplayERC_MarkersList(), SCH_SCREEN::Draw(), SCH_EDIT_FRAME::EndSegment(), SCH_SCREEN::ExtractWires(), 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(), SCH_SCREEN::GetSheetLabel(), SCH_SCREEN::GetWireOrBus(), SCH_SCREENS::HasNoFullyDefinedLibIds(), 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(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::ReplaceWires(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SetComponentFootprint(), SCH_EDIT_FRAME::SetCurrentSheetHighlightFlags(), SCH_SCREEN::TestDanglingEnds(), TestDuplicateSheetNames(), and SCH_SCREEN::UpdatePickList().

147 { 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:178
bool SCH_COMPONENT::operator!= ( const SCH_COMPONENT aComponent) const

Definition at line 1797 of file sch_component.cpp.

1798 {
1799  return !( *this == aComponent );
1800 }
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 241 of file base_struct.cpp.

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

242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
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 1760 of file sch_component.cpp.

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

1761 {
1762  if( Type() != aItem.Type() )
1763  return Type() < aItem.Type();
1764 
1765  SCH_COMPONENT* component = (SCH_COMPONENT*) &aItem;
1766 
1767  EDA_RECT rect = GetBodyBoundingBox();
1768 
1769  if( rect.GetArea() != component->GetBodyBoundingBox().GetArea() )
1770  return rect.GetArea() < component->GetBodyBoundingBox().GetArea();
1771 
1772  if( m_Pos.x != component->m_Pos.x )
1773  return m_Pos.x < component->m_Pos.x;
1774 
1775  if( m_Pos.y != component->m_Pos.y )
1776  return m_Pos.y < component->m_Pos.y;
1777 
1778  return false;
1779 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
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.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
SCH_ITEM & SCH_COMPONENT::operator= ( const SCH_ITEM aItem)

Definition at line 1803 of file sch_component.cpp.

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

1804 {
1805  wxCHECK_MSG( Type() == aItem.Type(), *this,
1806  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1807  GetClass() );
1808 
1809  if( &aItem != this )
1810  {
1811  SCH_ITEM::operator=( aItem );
1812 
1813  SCH_COMPONENT* c = (SCH_COMPONENT*) &aItem;
1814 
1815  m_lib_id = c->m_lib_id;
1816  m_part = c->m_part;
1817  m_Pos = c->m_Pos;
1818  m_unit = c->m_unit;
1819  m_convert = c->m_convert;
1820  m_transform = c->m_transform;
1821 
1823 
1824  m_Fields = c->m_Fields; // std::vector's assignment operator.
1825 
1826  // Reparent fields after assignment to new component.
1827  for( int ii = 0; ii < GetFieldCount(); ++ii )
1828  {
1829  GetField( ii )->SetParent( this );
1830  }
1831  }
1832 
1833  return *this;
1834 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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:77
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
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:82
int GetFieldCount() const
Return the number of fields in this symbol.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
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:83
wxString GetClass() const override
Function GetClass returns the class name.
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
bool SCH_COMPONENT::operator== ( const SCH_COMPONENT aComponent) const

Definition at line 1782 of file sch_component.cpp.

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

1783 {
1784  if( GetFieldCount() != aComponent.GetFieldCount() )
1785  return false;
1786 
1787  for( int i = VALUE; i < GetFieldCount(); i++ )
1788  {
1789  if( GetField( i )->GetText().Cmp( aComponent.GetField( i )->GetText() ) != 0 )
1790  return false;
1791  }
1792 
1793  return true;
1794 }
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:130
Field Value of part, i.e. "3.3K".
int GetFieldCount() const
Return the number of fields in this symbol.
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 1888 of file sch_component.cpp.

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

1889 {
1890  TRANSFORM temp;
1891 
1892  if( PART_SPTR part = m_part.lock() )
1893  {
1894  temp = GetTransform();
1895 
1896  part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
1897 
1898  for( size_t i = 0; i < m_Fields.size(); i++ )
1899  {
1900  m_Fields[i].Plot( aPlotter );
1901  }
1902  }
1903 }
TRANSFORM & GetTransform() const
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
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's libraries to the LIB_PART for this component
Definition: sch_component.h:93
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
int GetUnit() const
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 211 of file base_struct.cpp.

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

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

212 {
213  wxCHECK_MSG( IsReplaceable(), false,
214  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
215 
216  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
217 
218  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
219  aSearchData.GetFindString() :
220  aSearchData.GetFindString().Upper() );
221 
222  if( result == wxNOT_FOUND )
223  return false;
224 
225  wxString prefix = aText.Left( result );
226  wxString suffix;
227 
228  if( aSearchData.GetFindString().length() + result < aText.length() )
229  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
230 
231  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
232  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
233  GetChars( suffix ) );
234 
235  aText = prefix + aSearchData.GetReplaceString() + suffix;
236 
237  return true;
238 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
const wxString traceFindReplace
Flag to enable find and replace debug tracing.
Definition: base_struct.cpp:58
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 446 of file base_struct.h.

446 { 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 300 of file sch_component.cpp.

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

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

301 {
302  // I've never been happy that the actual individual PART_LIB is left up to
303  // flimsy search path ordering. None-the-less find a part based on that design:
304  if( LIB_PART* part = aLibs->FindLibPart( m_lib_id ) )
305  {
306  m_part = part->SharedPtr();
307  return true;
308  }
309 
310  return false;
311 }
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
Class LIB_PART defines a library part object.
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibPart searches all libraries in the list for a part.
bool SCH_COMPONENT::Resolve ( SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)

Definition at line 314 of file sch_component.cpp.

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

315 {
316  LIB_ALIAS* alias = nullptr;
317 
318  try
319  {
320  if( m_lib_id.IsValid() )
321  alias = aLibTable.LoadSymbol( m_lib_id );
322 
323  // Fall back to cache library. This is temporary until the new schematic file
324  // format is implemented.
325  if( !alias && aCacheLib )
326  alias = aCacheLib->FindAlias( m_lib_id.GetLibItemName() );
327 
328  if( alias && alias->GetPart() )
329  {
330  m_part = alias->GetPart()->SharedPtr();
331  return true;
332  }
333  }
334  catch( const IO_ERROR& ioe )
335  {
336  wxLogDebug( "Cannot resolve library symbol %s", m_lib_id.Format().wx_str() );
337  }
338 
339  return false;
340 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
bool IsValid() const
Function IsValid.
Definition: lib_id.h:177
Part library alias object definition.
wxString wx_str() const
Definition: utf8.cpp:48
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
PART_SPTR SharedPtr()
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
UTF8 Format() const
Function Format.
Definition: lib_id.cpp:263
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
void SCH_COMPONENT::ResolveAll ( const SCH_COLLECTOR aComponents,
PART_LIBS aLibs 
)
static

Definition at line 351 of file sch_component.cpp.

References COLLECTOR::GetCount(), m_lib_id, m_part, Resolve(), and sort_by_libid().

Referenced by SCH_SCREEN::UpdateSymbolLinks().

352 {
353  // Usually, many components use the same part lib.
354  // to avoid too long calculation time the list of components is grouped
355  // and once the lib part is found for one member of a group, it is also
356  // set for all other members of this group
357  std::vector<SCH_COMPONENT*> cmp_list;
358 
359  // build the cmp list.
360  for( int i = 0; i < aComponents.GetCount(); ++i )
361  {
362  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
363  wxASSERT( cmp );
364 
365  if( cmp ) // cmp == NULL should not occur.
366  cmp_list.push_back( cmp );
367  }
368 
369  // sort it by lib part. Cmp will be grouped by same lib part.
370  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
371 
372  LIB_ID curr_libid;
373 
374  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
375  {
376  SCH_COMPONENT* cmp = cmp_list[ii];
377  curr_libid = cmp->m_lib_id;
378  cmp->Resolve( aLibs );
379 
380  // Propagate the m_part pointer to other members using the same lib_id
381  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
382  {
383  SCH_COMPONENT* next_cmp = cmp_list[jj];
384 
385  if( curr_libid != next_cmp->m_lib_id )
386  break;
387 
388  next_cmp->m_part = cmp->m_part;
389  ii = jj;
390  }
391  }
392 }
int GetCount() const
Function GetCount returns the number of objects in the list.
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)
Class LIB_ID.
Definition: lib_id.h:56
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
void SCH_COMPONENT::ResolveAll ( const SCH_COLLECTOR aComponents,
SYMBOL_LIB_TABLE aLibTable,
PART_LIB aCacheLib = NULL 
)
static

Definition at line 395 of file sch_component.cpp.

References COLLECTOR::GetCount(), m_lib_id, m_part, Resolve(), and sort_by_libid().

397 {
398  std::vector<SCH_COMPONENT*> cmp_list;
399 
400  for( int i = 0; i < aComponents.GetCount(); ++i )
401  {
402  SCH_COMPONENT* cmp = dynamic_cast<SCH_COMPONENT*>( aComponents[i] );
403 
404  wxCHECK2_MSG( cmp, continue, "Invalid SCH_COMPONENT pointer in list." );
405 
406  cmp_list.push_back( cmp );
407  }
408 
409  // sort it by lib part. Cmp will be grouped by same lib part.
410  std::sort( cmp_list.begin(), cmp_list.end(), sort_by_libid );
411 
412  LIB_ID curr_libid;
413 
414  for( unsigned ii = 0; ii < cmp_list.size (); ++ii )
415  {
416  SCH_COMPONENT* cmp = cmp_list[ii];
417  curr_libid = cmp->m_lib_id;
418  cmp->Resolve( aLibTable, aCacheLib );
419 
420  // Propagate the m_part pointer to other members using the same lib_id
421  for( unsigned jj = ii+1; jj < cmp_list.size (); ++jj )
422  {
423  SCH_COMPONENT* next_cmp = cmp_list[jj];
424 
425  if( curr_libid != next_cmp->m_lib_id )
426  break;
427 
428  next_cmp->m_part = cmp->m_part;
429  ii = jj;
430  }
431  }
432 }
int GetCount() const
Function GetCount returns the number of objects in the list.
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)
Class LIB_ID.
Definition: lib_id.h:56
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
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 1436 of file sch_component.cpp.

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

1437 {
1438  wxPoint prev = m_Pos;
1439 
1440  RotatePoint( &m_Pos, aPosition, 900 );
1441 
1443 
1444  for( int ii = 0; ii < GetFieldCount(); ii++ )
1445  {
1446  // Move the fields to the new position because the component itself has moved.
1447  wxPoint pos = GetField( ii )->GetTextPos();
1448  pos.x -= prev.x - m_Pos.x;
1449  pos.y -= prev.y - m_Pos.y;
1450  GetField( ii )->SetTextPos( pos );
1451  }
1452 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
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 226 of file base_struct.h.

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

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

Definition at line 243 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

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

Definition at line 451 of file sch_component.cpp.

References m_convert, and EDA_ITEM::SetModified().

Referenced by SCH_EDIT_FRAME::ConvertPart(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions().

452 {
453  if( m_convert != aConvert )
454  {
455  m_convert = aConvert;
456  SetModified();
457  }
458 }
void SetModified()
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
void SCH_COMPONENT::SetCurrentSheetPath ( const SCH_SHEET_PATH aSheetPath)
inline

Definition at line 469 of file sch_component.h.

Referenced by SCH_EDIT_FRAME::Load_Component().

470  {
471  m_currentSheetPath = aSheetPath;
472  }
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 358 of file sch_component.h.

Referenced by DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::EditSpiceModel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), and DIALOG_UPDATE_FIELDS::updateFields().

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

Definition at line 267 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), 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(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::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(), PCB_EDIT_FRAME::EditDimension(), LIB_PIN::EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), 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(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), 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(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), 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_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

267 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 279 of file base_struct.h.

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

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

Definition at line 242 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

242 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
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 174 of file sch_item_struct.h.

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

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

Definition at line 229 of file sch_component.cpp.

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

Referenced by SCH_SCREENS::ChangeSymbolLibNickname(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), SCH_EDIT_FRAME::Load_Component(), and DIALOG_SYMBOL_REMAP::remapSymbolToLibTable().

230 {
231  if( m_lib_id != aLibId )
232  {
233  m_lib_id = aLibId;
234  SetModified();
235 
236  if( aLibs )
237  Resolve( aLibs );
238  else
239  m_part.reset();
240  }
241 }
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's libraries to the LIB_PART for this component
Definition: sch_component.h:93
void SCH_COMPONENT::SetLibId ( const LIB_ID aLibId,
SYMBOL_LIB_TABLE aSymLibTable,
PART_LIB aCacheLib 
)

Definition at line 244 of file sch_component.cpp.

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

246 {
247  if( m_lib_id == aLibId )
248  return;
249 
250  m_lib_id = aLibId;
251  SetModified();
252 
253  LIB_ALIAS* alias = nullptr;
254 
255  if( aSymLibTable && aSymLibTable->HasLibrary( m_lib_id.GetLibNickname() ) )
256  alias = aSymLibTable->LoadSymbol( m_lib_id.GetLibNickname(), m_lib_id.GetLibItemName() );
257 
258  if( !alias && aCacheLib )
259  alias = aCacheLib->FindAlias( m_lib_id.GetLibItemName() );
260 
261  if( alias && alias->GetPart() )
262  m_part = alias->GetPart()->SharedPtr();
263  else
264  m_part.reset();
265 }
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.
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
PART_SPTR SharedPtr()
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
bool HasLibrary(const wxString &aNickname) const
Test for the existence of aNickname in the library table.
const UTF8 & GetLibNickname() const
Function GetLibNickname.
Definition: lib_id.h:108
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

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

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

Definition at line 102 of file base_struct.cpp.

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

Referenced by ClearAnnotation(), 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::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().

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

Definition at line 225 of file base_struct.h.

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

225 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
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 1054 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 DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), GetOrientation(), MirrorX(), MirrorY(), Rotate(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp().

1055 {
1056  TRANSFORM temp = TRANSFORM();
1057  bool transform = false;
1058 
1059  switch( aOrientation )
1060  {
1061  case CMP_ORIENT_0:
1062  case CMP_NORMAL: // default transform matrix
1063  m_transform.x1 = 1;
1064  m_transform.y2 = -1;
1065  m_transform.x2 = m_transform.y1 = 0;
1066  break;
1067 
1068  case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation)
1069  temp.x1 = temp.y2 = 0;
1070  temp.y1 = 1;
1071  temp.x2 = -1;
1072  transform = true;
1073  break;
1074 
1075  case CMP_ROTATE_CLOCKWISE: // Rotate - (incremental rotation)
1076  temp.x1 = temp.y2 = 0;
1077  temp.y1 = -1;
1078  temp.x2 = 1;
1079  transform = true;
1080  break;
1081 
1082  case CMP_MIRROR_Y: // Mirror Y (incremental rotation)
1083  temp.x1 = -1;
1084  temp.y2 = 1;
1085  temp.y1 = temp.x2 = 0;
1086  transform = true;
1087  break;
1088 
1089  case CMP_MIRROR_X: // Mirror X (incremental rotation)
1090  temp.x1 = 1;
1091  temp.y2 = -1;
1092  temp.y1 = temp.x2 = 0;
1093  transform = true;
1094  break;
1095 
1096  case CMP_ORIENT_90:
1099  break;
1100 
1101  case CMP_ORIENT_180:
1105  break;
1106 
1107  case CMP_ORIENT_270:
1110  break;
1111 
1112  case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
1115  break;
1116 
1117  case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
1120  break;
1121 
1122  case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
1125  break;
1126 
1127  case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
1130  break;
1131 
1132  case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
1135  break;
1136 
1137  case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
1140  break;
1141 
1142  case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
1145  break;
1146 
1147  case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
1150  break;
1151 
1152  default:
1153  transform = false;
1154  wxMessageBox( wxT( "SetRotateMiroir() error: ill value" ) );
1155  break;
1156  }
1157 
1158  if( transform )
1159  {
1160  /* The new matrix transform is the old matrix transform modified by the
1161  * requested transformation, which is the temp transform (rot,
1162  * mirror ..) in order to have (in term of matrix transform):
1163  * transform coord = new_m_transform * coord
1164  * where transform coord is the coord modified by new_m_transform from
1165  * the initial value coord.
1166  * new_m_transform is computed (from old_m_transform and temp) to
1167  * have:
1168  * transform coord = old_m_transform * temp
1169  */
1170  TRANSFORM newTransform;
1171 
1172  newTransform.x1 = m_transform.x1 * temp.x1 + m_transform.x2 * temp.y1;
1173  newTransform.y1 = m_transform.y1 * temp.x1 + m_transform.y2 * temp.y1;
1174  newTransform.x2 = m_transform.x1 * temp.x2 + m_transform.x2 * temp.y2;
1175  newTransform.y2 = m_transform.y1 * temp.x2 + m_transform.y2 * temp.y2;
1176  m_transform = newTransform;
1177  }
1178 }
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:90
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 227 of file base_struct.h.

Referenced by MODULE::Add(), BOARD::Add(), BOARD_NETLIST_UPDATER::addNewComponent(), LIB_FIELD::Copy(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateSheet(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), operator=(), PCB_PARSER::parseMODULE_unchecked(), PCBNEW_CONTROL::PasteItemsFromClipboard(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), SCH_COMPONENT(), SCH_SHEET::SCH_SHEET(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), SetSchItemParent(), PCB_EDIT_FRAME::StartMoveModule(), SCH_SHEET::SwapData(), SwapData(), and SwapItemData().

227 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
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 612 of file sch_component.h.

References Move().

612 { Move( aPosition - m_Pos ); }
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
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 228 of file sch_component.h.

228 { 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:86
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 646 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(), EDA_TEXT::SetTextPos(), wxPoint::x, and wxPoint::y.

Referenced by SCH_REFERENCE::Annotate(), GetRef(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), and DIALOG_SCH_EDIT_ONE_FIELD::UpdateField().

647 {
648  wxString path = GetPath( sheet );
649 
650  bool notInArray = true;
651 
652  wxString h_path, h_ref;
653  wxStringTokenizer tokenizer;
654  wxString separators( wxT( " " ) );
655 
656  // check to see if it is already there before inserting it
657  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
658  {
659  tokenizer.SetString( m_PathsAndReferences[ii], separators );
660  h_path = tokenizer.GetNextToken();
661 
662  if( h_path.Cmp( path ) == 0 )
663  {
664  // just update the reference text, not the timestamp.
665  h_ref = h_path + wxT( " " ) + ref;
666  h_ref += wxT( " " );
667  tokenizer.GetNextToken(); // Skip old reference
668  h_ref += tokenizer.GetNextToken(); // Add part selection
669 
670  // Add the part selection
671  m_PathsAndReferences[ii] = h_ref;
672  notInArray = false;
673  }
674  }
675 
676  if( notInArray )
677  AddHierarchicalReference( path, ref, m_unit );
678 
679  SCH_FIELD* rf = GetField( REFERENCE );
680 
681  if( rf->GetText().IsEmpty()
682  || ( abs( rf->GetTextPos().x - m_Pos.x ) +
683  abs( rf->GetTextPos().y - m_Pos.y ) > 10000 ) )
684  {
685  // move it to a reasonable position
686  rf->SetTextPos( m_Pos + wxPoint( 50, 50 ) );
687  }
688 
689  rf->SetText( ref ); // for drawing.
690 
691  // Reinit the m_prefix member if needed
692  wxString prefix = ref;
693 
694  if( IsReferenceStringValid( prefix ) )
695  {
696  while( prefix.Last() == '?' || isdigit( prefix.Last() ) )
697  prefix.RemoveLast();
698  }
699  else
700  {
701  prefix = wxT( "U" ); // Set to default ref prefix
702  }
703 
704  if( m_prefix != prefix )
705  m_prefix = prefix;
706 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
wxString GetPath(const SCH_SHEET_PATH *sheet) const
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
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:77
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
#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:130
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
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:86
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 241 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::selectVisually(), and SELECTION_TOOL::selectVisually().

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

Definition at line 160 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::PrepareMoveItem().

160 { 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 ( time_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 709 of file sch_component.cpp.

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

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

710 {
711  wxString string_timestamp, string_oldtimestamp;
712 
713  string_timestamp.Printf( wxT( "%08lX" ), (long unsigned) aNewTimeStamp );
714  string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp );
715  EDA_ITEM::SetTimeStamp( aNewTimeStamp );
716 
717  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
718  {
719  m_PathsAndReferences[ii].Replace( string_oldtimestamp.GetData(),
720  string_timestamp.GetData() );
721  }
722 }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
wxArrayString m_PathsAndReferences
Defines the hierarchical path and reference of the component.
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
void SCH_COMPONENT::SetTransform ( const TRANSFORM aTransform)

Definition at line 461 of file sch_component.cpp.

References m_transform, and EDA_ITEM::SetModified().

462 {
463  if( m_transform != aTransform )
464  {
465  m_transform = aTransform;
466  SetModified();
467  }
468 }
void SetModified()
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 435 of file sch_component.cpp.

References m_unit, and EDA_ITEM::SetModified().

Referenced by SCH_REFERENCE::Annotate(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), and SCH_EDIT_FRAME::OnSelectUnit().

436 {
437  if( m_unit != aUnit )
438  {
439  m_unit = aUnit;
440  SetModified();
441  }
442 }
void SetModified()
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
void SCH_COMPONENT::SetUnitSelection ( SCH_SHEET_PATH aSheet,
int  aUnitSelection 
)

Definition at line 753 of file sch_component.cpp.

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

Referenced by SCH_REFERENCE::Annotate(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), and SCH_EDIT_FRAME::OnSelectUnit().

754 {
755  wxString path = GetPath( aSheet );
756 
757  bool notInArray = true;
758 
759  wxString h_path, h_ref;
760  wxStringTokenizer tokenizer;
761  wxString separators( wxT( " " ) );
762 
763  //check to see if it is already there before inserting it
764  for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
765  {
766  tokenizer.SetString( m_PathsAndReferences[ii], separators );
767  h_path = tokenizer.GetNextToken();
768 
769  if( h_path.Cmp( path ) == 0 )
770  {
771  //just update the unit selection.
772  h_ref = h_path + wxT( " " );
773  h_ref += tokenizer.GetNextToken(); // Add reference
774  h_ref += wxT( " " );
775  h_ref << aUnitSelection; // Add part selection
776 
777  // Ann the part selection
778  m_PathsAndReferences[ii] = h_ref;
779  notInArray = false;
780  }
781  }
782 
783  if( notInArray )
784  AddHierarchicalReference( path, m_prefix, aUnitSelection );
785 }
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:86
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 240 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

240 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
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 477 of file base_struct.h.

Referenced by PART_LIB::GetEntryTypePowerNames().

477 { 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 942 of file sch_component.cpp.

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

943 {
944  wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
945  wxT( "Cannot swap data with invalid component." ) );
946 
947  SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
948 
949  std::swap( m_lib_id, component->m_lib_id );
950  std::swap( m_part, component->m_part );
951  std::swap( m_Pos, component->m_Pos );
952  std::swap( m_unit, component->m_unit );
953  std::swap( m_convert, component->m_convert );
954 
955  TRANSFORM tmp = m_transform;
956 
957  m_transform = component->m_transform;
958  component->m_transform = tmp;
959 
960  m_Fields.swap( component->m_Fields ); // std::vector's swap()
961 
962  // Reparent items after copying data
963  // (after swap(), m_Parent member does not point to the right parent):
964  for( int ii = 0; ii < component->GetFieldCount(); ++ii )
965  {
966  component->GetField( ii )->SetParent( component );
967  }
968 
969  for( int ii = 0; ii < GetFieldCount(); ++ii )
970  {
971  GetField( ii )->SetParent( this );
972  }
973 
974  std::swap( m_PathsAndReferences, component->m_PathsAndReferences );
975 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
SCH_FIELDS m_Fields
Variable length list of fields.
Definition: sch_component.h:91
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:77
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
int GetFieldCount() const
Return the number of fields in this symbol.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
int m_convert
The alternate body style for components that have more than one body style defined.
Definition: sch_component.h:83
TRANSFORM m_transform
The rotation/mirror transformation matrix.
Definition: sch_component.h:90
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 212 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CLUSTER::Add(), BOARD::Add(), CN_CONNECTIVITY_ALGO::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), 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(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), HIERARCHY_NAVIG_DLG::BuildTree(), calcArea(), calcMaxArea(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::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(), 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(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteItemsInList(), DeleteNullTrackSegments(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), 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(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), 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(), POINT_EDITOR::finishItem(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), getAnchorPoint(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), 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(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsDraggableJunction(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), 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(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::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(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnHotKey(), 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(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::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(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), CN_CONNECTIVITY_ALGO::searchConnections(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), 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_NO_CONNECT::SwapData(), SCH_JUNCTION::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), SwapData(), VIA::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), ZONE_CONTAINER::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and Visit().

213  {
214  return m_StructType;
215  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:174
void SCH_COMPONENT::UpdateFields ( bool  aResetStyle,
bool  aResetRef = false 
)

Restores fields to the original library values.

Parameters
aResetStyleselects whether fields should reset the position and text attribute.
aResetRefselects whether the reference field should be restored.

Definition at line 874 of file sch_component.cpp.

References AddField(), FindField(), GetField(), GetFieldCount(), SCH_FIELD::ImportValues(), m_part, m_Pos, MANDATORY_FIELDS, REFERENCE, EDA_TEXT::SetText(), and EDA_TEXT::SetTextPos().

Referenced by SCH_COMPONENT().

875 {
876  if( PART_SPTR part = m_part.lock() )
877  {
878  LIB_FIELDS fields;
879  part->GetFields( fields );
880 
881  for( const LIB_FIELD& field : fields )
882  {
883  // Can no longer insert an empty name, since names are now keys. The
884  // field index is not used beyond the first MANDATORY_FIELDS
885  if( field.GetName().IsEmpty() )
886  continue;
887 
888  // See if field already exists (mandatory fields always exist).
889  // for mandatory fields, the name and field id are fixed, so we use the
890  // known and fixed id to get them (more reliable than names, which can be translated)
891  // for other fields (custom fields), locate the field by same name
892  // (field id has no known meaning for custom fields)
893  int idx = field.GetId();
894  SCH_FIELD* schField;
895 
896  if( idx == REFERENCE && !aResetRef )
897  continue;
898  if( (unsigned) idx < MANDATORY_FIELDS )
899  schField = GetField( idx );
900  else
901  schField = FindField( field.GetName() );
902 
903  if( !schField )
904  {
905  SCH_FIELD fld( wxPoint( 0, 0 ), GetFieldCount(), this, field.GetName() );
906  schField = AddField( fld );
907  }
908 
909  if( aResetStyle )
910  {
911  schField->ImportValues( field );
912  schField->SetTextPos( m_Pos + field.GetTextPos() );
913  }
914 
915  schField->SetText( field.GetText() );
916  }
917  }
918 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
void ImportValues(const LIB_FIELD &aSource)
Function ImportValues copy parameters from a LIB_FIELD source.
Definition: sch_field.cpp:221
wxPoint m_Pos
Name and library where symbol was loaded from, i.e. "74xx:74LS00".
Definition: sch_component.h:77
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
Field Reference of part, i.e. "IC21".
PART_REF m_part
points into the PROJECT's libraries to the LIB_PART for this component
Definition: sch_component.h:93
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
int GetFieldCount() const
Return the number of fields in this symbol.
std::vector< LIB_FIELD > LIB_FIELDS
Definition: lib_field.h:261
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
void SCH_COMPONENT::UpdateUnit ( int  aUnit)

Change the unit number to aUnit without setting any internal flags.

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 445 of file sch_component.cpp.

References m_unit.

Referenced by SCH_SHEET_PATH::UpdateAllScreenReferences().

446 {
447  m_unit = aUnit;
448 }
int m_unit
The unit for multiple part per package components.
Definition: sch_component.h:82
const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Function ViewBBox() returns the bounding box of the item covering all its layers.

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 267 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

Referenced by SELECTION_TOOL::selectMultiple(), BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), BRIGHT_BOX::ViewDraw(), and COMMON_TOOLS::ZoomFitScreen().

268 {
269  // Basic fallback
270  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
271  VECTOR2I( GetBoundingBox().GetSize() ) );
272 }
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewDraw() Draws the parts of the object belonging to layer aLayer.

viewDraw() is an alternative way for drawing objects if if there is no PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on

Reimplemented in EDIT_POINTS, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::PRE