KiCad PCB EDA Suite
LIB_PIN Class Reference

#include <lib_pin.h>

Inheritance diagram for LIB_PIN:
LIB_ITEM EDA_ITEM KIGFX::VIEW_ITEM

Public Types

enum  LIB_CONVERT : int { BASE = 1, DEMORGAN = 2 }
 

Public Member Functions

 LIB_PIN (LIB_PART *aParent)
 
 ~LIB_PIN ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
wxString GetTypeName () override
 Provide a user-consumable name of the object type. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Display basic info (type, part and convert) about the current item in message panel. More...
 
void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList, SCH_COMPONENT *aComponent)
 Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent (schematic pin position, and sheet path) More...
 
bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation) override
 Function Matches compares the item against the search criteria in aSearchData. More...
 
const EDA_RECT GetBoundingBox () const override
 
const EDA_RECT GetBoundingBox (bool aIncludeInvisibles) const
 
wxPoint PinEndPoint () const
 
int PinDrawOrient (const TRANSFORM &aTransform) const
 Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform. More...
 
const wxString & GetName () const
 
void SetName (const wxString &aName, bool aTestOtherPins=true)
 Set the pin name. More...
 
void SetNameTextSize (int aSize, bool aTestOtherPins=true)
 Set the aSize of the pin name text. More...
 
int GetNameTextSize () const
 
const wxString & GetNumber () const
 
void SetNumber (const wxString &aNumber)
 Set the pin number. More...
 
void SetNumberTextSize (int aSize, bool aTestOtherPins=true)
 Set the size of the pin number text. More...
 
int GetNumberTextSize () const
 
int GetOrientation () const
 
void SetOrientation (int aOrientation, bool aTestOtherPins=true)
 Set orientation on the pin. More...
 
void Rotate () override
 Rotate the draw item. More...
 
GRAPHIC_PINSHAPE GetShape () const
 
void SetShape (GRAPHIC_PINSHAPE aShape)
 Set the shape of the pin to aShape. More...
 
ELECTRICAL_PINTYPE GetType () const
 Get the electrical type of the pin. More...
 
wxString const GetCanonicalElectricalTypeName () const
 return a string giving the electrical type of the pin. More...
 
wxString const GetElectricalTypeName () const
 return a translated string for messages giving the electrical type of the pin. More...
 
void SetType (ELECTRICAL_PINTYPE aType, bool aTestOtherPins=true)
 Set the electrical type of the pin. More...
 
void SetLength (int aLength, bool aTestOtherPins=true)
 Set the pin length. More...
 
int GetLength ()
 
void SetPartNumber (int aPart)
 Set the pin part number. More...
 
int GetPartNumber () const
 Get the pin part number. More...
 
void SetConversion (int aConversion)
 Set the body style (conversion) of the pin. More...
 
void SetVisible (bool aVisible)
 Set or clear the visibility flag for the pin. More...
 
void EnableEditMode (bool aEnable, bool aEditPinByPin=false)
 Enable or clear pin editing mode. More...
 
bool IsVisible () const
 Return the visibility status of the draw object. More...
 
bool IsPowerConnection () const
 Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN. More...
 
int GetPenSize () const override
 
void DrawPinSymbol (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPos, int aOrientation)
 Draw the pin symbol without text. More...
 
void DrawPinTexts (EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName)
 Put the pin number and pin text info, given the pin line coordinates. More...
 
void DrawPinElectricalTypeName (EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation)
 Draw the electrical type text of the pin (only for the footprint editor) More...
 
void PlotPinTexts (PLOTTER *aPlotter, wxPoint &aPosition, int aOrientation, int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aWidth)
 Plot the pin number and pin text info, given the pin line coordinates. More...
 
void PlotSymbol (PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
 
void Offset (const wxPoint &aOffset) override
 Set the drawing object by aOffset from the current position. More...
 
bool Inside (EDA_RECT &aRect) const override
 Test if any part of the draw object is inside rectangle bounds of aRect. More...
 
void MoveTo (const wxPoint &aPosition) override
 Move a draw object to aPosition. More...
 
wxPoint GetPosition () const override
 Return the current draw object position. More...
 
void SetPinPosition (wxPoint aPosition)
 move this and all linked pins to the new position used in pin editing. More...
 
void MirrorHorizontal (const wxPoint &aCenter) override
 Mirror the draw object along the horizontal (X) axis about aCenter point. More...
 
void MirrorVertical (const wxPoint &aCenter) override
 Mirror the draw object along the MirrorVertical (Y) axis about aCenter point. More...
 
void Rotate (const wxPoint &aCenter, bool aRotateCCW=true) override
 Rotate the object about aCenter point. More...
 
void Plot (PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) override
 Plot the draw item using the plot object. More...
 
int GetWidth () const override
 Return the width of the draw item. More...
 
void SetWidth (int aWidth) override
 Set the width of the draw item to aWidth. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
wxString GetSelectMenuText (EDA_UNITS_T aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
void CalcEdit (const wxPoint &aPosition) override
 Calculates the attributes of an item at aPosition when it is being edited. More...
 
virtual void BeginEdit (STATUS_FLAGS aEditMode, const wxPoint aPosition)
 Begin an editing a component library draw item in aEditMode at aPosition. More...
 
virtual bool ContinueEdit (const wxPoint aPosition)
 Continue an edit in progress at aPosition. More...
 
virtual void EndEdit (const wxPoint &aPosition)
 End an object editing action. More...
 
virtual void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform)
 Draw an item. More...
 
LIB_PARTGetParent () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
bool operator== (const LIB_ITEM &aOther) const
 Test LIB_ITEM objects for equivalence. More...
 
bool operator== (const LIB_ITEM *aOther) const
 
bool operator< (const LIB_ITEM &aOther) const
 Test if another draw item is less than this draw object. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
void SetPosition (const wxPoint &aPosition)
 
bool IsFillable () const
 Check if draw object can be filled. More...
 
bool InEditMode () const
 Return the draw item editing mode status. More...
 
virtual COLOR4D GetDefaultColor ()
 
void SetUnit (int aUnit)
 
int GetUnit () const
 
void SetConvert (int aConvert)
 
int GetConvert () const
 
void SetFillMode (FILL_T aFillMode)
 
FILL_T GetFillMode () const
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () 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
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[])
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
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 its member data. 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 bool IsReplaceable () const
 Function IsReplaceable. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static const wxString GetCanonicalElectricalTypeName (ELECTRICAL_PINTYPE aType)
 return a string giving the electrical type of a pin. More...
 
static wxArrayString GetOrientationNames ()
 Get a list of pin orientation names. More...
 
static const BITMAP_DEF * GetOrientationSymbols ()
 Get a list of pin orientation bitmaps for menus and dialogs. More...
 
static int GetOrientationCode (int aIndex)
 Get the orientation code by index used to set the pin orientation. More...
 
static int GetOrientationIndex (int aCode)
 Get the index of the orientation code. 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

int m_Unit
 Unit identification for multiple parts per package. More...
 
int m_Convert
 Shape identification for alternate body styles. More...
 
FILL_T m_Fill
 The body fill type. More...
 
wxPoint m_initialPos
 Temporary position when moving an existing item. More...
 
wxPoint m_initialCursorPos
 Initial cursor position at the beginning of a move. More...
 
bool m_isFillable
 Flag to indicate if draw item is fillable. More...
 
EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

void drawGraphic (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
 Draw a pin, with or without the pin texts. More...
 
void getMsgPanelInfoBase (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList)
 Build the pin basic info to display in message panel. More...
 
int compare (const LIB_ITEM &aOther) const override
 Provide the draw object specific comparison called by the == and < operators. More...
 

Private Attributes

wxPoint m_position
 Position of the pin. More...
 
int m_length
 Length of the pin. More...
 
int m_orientation
 Pin orientation (Up, Down, Left, Right) More...
 
GRAPHIC_PINSHAPE m_shape
 Shape drawn around pin. More...
 
int m_width
 Line width of the pin. More...
 
ELECTRICAL_PINTYPE m_type
 Electrical type of the pin. See enum ELECTRICAL_PINTYPE. More...
 
int m_attributes
 Set bit 0 to indicate pin is invisible. More...
 
wxString m_name
 
wxString m_number
 
int m_numTextSize
 
int m_nameTextSize
 Pin num and Pin name sizes. More...
 

Friends

class SCH_LEGACY_PLUGIN_CACHE
 

Detailed Description

Definition at line 60 of file lib_pin.h.

Member Enumeration Documentation

◆ LIB_CONVERT

enum LIB_ITEM::LIB_CONVERT : int
inherited
Enumerator
BASE 
DEMORGAN 

Definition at line 124 of file lib_draw_item.h.

Constructor & Destructor Documentation

◆ LIB_PIN()

LIB_PIN::LIB_PIN ( LIB_PART aParent)

Definition at line 148 of file lib_pin.cpp.

148  :
149  LIB_ITEM( LIB_PIN_T, aParent ),
151 {
153  m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
154  m_type = PIN_UNSPECIFIED; // electrical type of pin
155  m_attributes = 0; // bit 0 != 0: pin invisible
158  m_width = 0;
159 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
int m_numTextSize
Definition: lib_pin.h:76
static int GetDefaultPinLength()
int m_length
Length of the pin.
Definition: lib_pin.h:68
static int GetPinNumDefaultSize()
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:73
static int GetPinNameDefaultSize()
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
LIB_ITEM(KICAD_T aType, LIB_PART *aComponent=NULL, int aUnit=0, int aConvert=0, FILL_T aFillType=NO_FILL)
int m_width
Line width of the pin.
Definition: lib_pin.h:71

References LIB_EDIT_FRAME::GetDefaultPinLength(), LIB_EDIT_FRAME::GetPinNameDefaultSize(), LIB_EDIT_FRAME::GetPinNumDefaultSize(), m_attributes, m_length, m_nameTextSize, m_numTextSize, m_orientation, m_type, m_width, PIN_RIGHT, and PIN_UNSPECIFIED.

Referenced by Clone().

◆ ~LIB_PIN()

LIB_PIN::~LIB_PIN ( )
inline

Definition at line 97 of file lib_pin.h.

97 { }

Member Function Documentation

◆ Back()

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 213 of file base_struct.h.

213 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:171

References EDA_ITEM::Pback.

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

◆ BeginEdit()

virtual void LIB_ITEM::BeginEdit ( STATUS_FLAGS  aEditMode,
const wxPoint  aPosition 
)
inlinevirtualinherited

Begin an editing a component library draw item in aEditMode at aPosition.

This is used to start an editing action such as resize or move a draw object. It typically would be called on a left click when a draw tool is selected in the component library editor and one of the graphics tools is selected. It allows the draw item to maintain it's own internal state while it is being edited. Call AbortEdit() to quit the editing mode.

Parameters
aEditModeThe editing mode being performed. See base_struct.h for a list of mode flags.
aPositionThe position in drawing coordinates where the editing mode was started. This may or may not be required depending on the item being edited and the edit mode.

Reimplemented in LIB_FIELD, LIB_TEXT, LIB_ARC, LIB_POLYLINE, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 147 of file lib_draw_item.h.

148  {
149  SetFlags( aEditMode );
150  }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259

References EDA_ITEM::SetFlags().

Referenced by LIB_CIRCLE::BeginEdit(), LIB_RECTANGLE::BeginEdit(), LIB_POLYLINE::BeginEdit(), LIB_ARC::BeginEdit(), LIB_TEXT::BeginEdit(), LIB_FIELD::BeginEdit(), and LIB_DRAWING_TOOLS::DrawShape().

◆ CalcEdit()

void LIB_PIN::CalcEdit ( const wxPoint &  aPosition)
overridevirtual

Calculates the attributes of an item at aPosition when it is being edited.

This method gets called by the Draw() method when the item is being edited. This probably should be a pure virtual method but bezier curves are not yet editable in the component library editor. Therefore, the default method does nothing.

Parameters
aPositionThe current mouse position in drawing coordinates.

Reimplemented from LIB_ITEM.

Definition at line 1713 of file lib_pin.cpp.

1714 {
1715  if( IsMoving() )
1716  {
1717  DBG(printf("MOVEPIN\n");)
1718  MoveTo( aPosition );
1719  }
1720 }
bool IsMoving() const
Definition: base_struct.h:224
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_pin.cpp:1331
#define DBG(x)
Definition: fctsys.h:33

References DBG, EDA_ITEM::IsMoving(), and MoveTo().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 239 of file base_struct.h.

239 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 260 of file base_struct.h.

260 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References EDA_ITEM::m_Flags.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), AbortMoveTextModule(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), PCB_BASE_FRAME::Import_Pad_Settings(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EDIT_POINTS_FACTORY::Make(), MarkItemsInBloc(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), BOARD_COMMIT::Revert(), LIB_EDIT_FRAME::RollbackPartFromUndo(), PCB_BASE_FRAME::Rotate_Module(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 238 of file base_struct.h.

238 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 271 of file base_struct.h.

272  {
274  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:125
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:124
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:120
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:119

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, and STARTPOINT.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * LIB_PIN::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 1287 of file lib_pin.cpp.

1288 {
1289  return new LIB_PIN( *this );
1290 }
LIB_PIN(LIB_PART *aParent)
Definition: lib_pin.cpp:148

References LIB_PIN().

Referenced by LIB_PIN_TOOL::CreateImagePins(), and LIB_PIN_TOOL::RepeatPin().

◆ compare()

int LIB_PIN::compare ( const LIB_ITEM aOther) const
overrideprivatevirtual

Provide the draw object specific comparison called by the == and < operators.

The base object sort order which always proceeds the derived object sort order is as follows:

  • Component alternate part (DeMorgan) number.
  • Component part number.
  • KICAD_T enum value.
  • Result of derived classes comparison.
Parameters
aOtherA reference to the other LIB_ITEM to compare the arc against.
Returns
An integer value less than 0 if the object is less than aOther ojbect, zero if the object is equal to aOther object, or greater than 0 if the object is greater than aOther object.

The pin specific sort order is as follows:

  • Pin number.
  • Pin name, case insensitive compare.
  • Pin horizontal (X) position.
  • Pin vertical (Y) position.

Implements LIB_ITEM.

Definition at line 1293 of file lib_pin.cpp.

1294 {
1295  wxASSERT( other.Type() == LIB_PIN_T );
1296 
1297  const LIB_PIN* tmp = (LIB_PIN*) &other;
1298 
1299  if( m_number != tmp->m_number )
1300  return m_number.Cmp( tmp->m_number );
1301 
1302  int result = m_name.CmpNoCase( tmp->m_name );
1303 
1304  if( result != 0 )
1305  return result;
1306 
1307  if( m_position.x != tmp->m_position.x )
1308  return m_position.x - tmp->m_position.x;
1309 
1310  if( m_position.y != tmp->m_position.y )
1311  return m_position.y - tmp->m_position.y;
1312 
1313  return 0;
1314 }
wxString m_name
Definition: lib_pin.h:74
wxString m_number
Definition: lib_pin.h:75
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References LIB_PIN_T, m_name, m_number, m_position, and EDA_ITEM::Type().

◆ ContinueEdit()

virtual bool LIB_ITEM::ContinueEdit ( const wxPoint  aPosition)
inlinevirtualinherited

Continue an edit in progress at aPosition.

This is used to perform the next action while editing a draw item. This would be called for each additional left click when the mouse is captured while the item is being edited.

Parameters
aPositionThe position of the mouse left click in drawing coordinates.
Returns
True if additional mouse clicks are required to complete the edit in progress.

Reimplemented in LIB_ARC, and LIB_POLYLINE.

Definition at line 162 of file lib_draw_item.h.

163  {
164  return false;
165  }

Referenced by LIB_DRAWING_TOOLS::DrawShape().

◆ Draw()

void LIB_ITEM::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aOffset,
void *  aData,
const TRANSFORM aTransform 
)
virtualinherited

Draw an item.

Parameters
aPanelDrawPanel to use (can be null) mainly used for clipping purposes.
aDCDevice Context (can be null)
aOffsetOffset to draw
aDataValue or pointer used to pass others parameters, depending on body items. Used for some items to force to force no fill mode ( has meaning only for items what can be filled ). used in printing or moving objects mode or to pass reference to the lib component for pins.
aTransformTransform Matrix (rotation, mirror ..)

Definition at line 127 of file lib_draw_item.cpp.

129 {
130  drawGraphic( aPanel, aDC, aOffset, aData, aTransform );
131 }
virtual void drawGraphic(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform)=0
Draw the item on aPanel.

References LIB_ITEM::drawGraphic().

Referenced by DIALOG_LIB_EDIT_PIN::OnPaintShowPanel().

◆ drawGraphic()

void LIB_PIN::drawGraphic ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aOffset,
void *  aData,
const TRANSFORM aTransform 
)
overrideprivatevirtual

Draw a pin, with or without the pin texts.

Parameters
aPanelDrawPanel to use (can be null) mainly used for clipping purposes.
aDCDevice Context (can be null)
aOffsetOffset to draw
aData= used here as a boolean indicating whether or not to draw the pin electrical types
aTransformTransform Matrix (rotation, mirror ..)

Implements LIB_ITEM.

Definition at line 561 of file lib_pin.cpp.

563 {
564  // aData is used here as a boolean.
565  bool drawElectricalTypeName = (bool) aData;
566 
567  LIB_PART* Entry = GetParent();
568 
569  /* Calculate pin orient taking in account the component orientation. */
570  int orient = PinDrawOrient( aTransform );
571 
572  /* Calculate the pin position */
573  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
574 
575  // Invisible pins are only drawn on request.
576  if( !IsVisible() )
577  {
578  bool drawHidden = true;
579 
580  if( aPanel && aPanel->GetParent() )
581  {
582  EDA_DRAW_FRAME* frame = aPanel->GetParent();
583 
584  if( frame->IsType( FRAME_SCH ) )
585  drawHidden = static_cast<SCH_EDIT_FRAME*>( frame )->GetShowAllPins();
586  }
587 
588  if( !drawHidden )
589  return;
590  }
591 
592  DrawPinSymbol( aPanel, aDC, pos1, orient );
593 
594  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(), Entry->ShowPinNumbers(),
595  Entry->ShowPinNames() );
596 
597  if( drawElectricalTypeName )
598  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient );
599 }
int GetPinNameOffset()
LIB_PART * GetParent() const
The base class for create windows for drawing purpose.
Definition: draw_frame.h:82
int PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition: lib_pin.cpp:1253
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
virtual EDA_DRAW_FRAME * GetParent() const =0
bool ShowPinNames()
bool ShowPinNumbers()
void DrawPinElectricalTypeName(EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation)
Draw the electrical type text of the pin (only for the footprint editor)
Definition: lib_pin.cpp:869
Define a library symbol object.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
void DrawPinSymbol(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPos, int aOrientation)
Draw the pin symbol without text.
Definition: lib_pin.cpp:602
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
bool IsType(FRAME_T aType) const
void DrawPinTexts(EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName)
Put the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:724

References DrawPinElectricalTypeName(), DrawPinSymbol(), DrawPinTexts(), FRAME_SCH, EDA_DRAW_PANEL::GetParent(), LIB_ITEM::GetParent(), LIB_PART::GetPinNameOffset(), EDA_BASE_FRAME::IsType(), IsVisible(), m_position, PinDrawOrient(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), and TRANSFORM::TransformCoordinate().

◆ DrawPinElectricalTypeName()

void LIB_PIN::DrawPinElectricalTypeName ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
wxPoint &  aPosition,
int  aOrientation 
)

Draw the electrical type text of the pin (only for the footprint editor)

Definition at line 869 of file lib_pin.cpp.

871 {
872  wxString typeName = GetElectricalTypeName();
873 
874  // Use a reasonable (small) size to draw the text
875  int textSize = (m_nameTextSize*3)/4;
876 
877  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
878  if( textSize > ETXT_MAX_SIZE )
879  textSize = ETXT_MAX_SIZE;
880 
881  // Use a reasonable pen size to draw the text
882  int pensize = textSize/6;
883 
884  // Get a suitable color
886 
887  wxPoint txtpos = aPosition;
888  int offset = Millimeter2iu( 0.4 );
890  int orient = TEXT_ANGLE_HORIZ;
891 
892  switch( aOrientation )
893  {
894  case PIN_UP:
895  txtpos.y += offset;
896  orient = TEXT_ANGLE_VERT;
897  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
898  break;
899 
900  case PIN_DOWN:
901  txtpos.y -= offset;
902  orient = TEXT_ANGLE_VERT;
903  break;
904 
905  case PIN_LEFT:
906  txtpos.x += offset;
907  break;
908 
909  case PIN_RIGHT:
910  txtpos.x -= offset;
911  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
912  break;
913  }
914 
915  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
916 
917  DrawGraphicText( clipbox, aDC, txtpos, color, typeName, orient, wxSize( textSize, textSize ),
918  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize, false, false );
919 }
#define TEXT_ANGLE_HORIZ
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:63
#define ETXT_MAX_SIZE
#define TEXT_ANGLE_VERT
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174
COLOR4D GetInvisibleItemColor()
void DrawGraphicText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:259
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References color, DrawGraphicText(), ETXT_MAX_SIZE, EDA_DRAW_PANEL::GetClipBox(), GetElectricalTypeName(), GetInvisibleItemColor(), GetLayerColor(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, IsVisible(), LAYER_NOTES, m_nameTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, TEXT_ANGLE_HORIZ, and TEXT_ANGLE_VERT.

Referenced by drawGraphic().

◆ DrawPinSymbol()

void LIB_PIN::DrawPinSymbol ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint &  aPos,
int  aOrientation 
)

Draw the pin symbol without text.

If aColor != 0, draw with aColor, else with the normal pin color.

Definition at line 602 of file lib_pin.cpp.

603 {
604  int MapX1, MapY1, x1, y1;
605  int width = GetPenSize();
606  int posX = aPos.x, posY = aPos.y, len = m_length;
608 
609  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
610 
611  MapX1 = MapY1 = 0;
612  x1 = posX;
613  y1 = posY;
614 
615  switch( aOrient )
616  {
617  case PIN_UP: y1 = posY - len; MapY1 = 1; break;
618  case PIN_DOWN: y1 = posY + len; MapY1 = -1; break;
619  case PIN_LEFT: x1 = posX - len; MapX1 = 1; break;
620  case PIN_RIGHT: x1 = posX + len; MapX1 = -1; break;
621  }
622 
624  {
625  const int radius = ExternalPinDecoSize( *this );
626  GRCircle( clipbox, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
627 
628  GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
629  GRLineTo( clipbox, aDC, posX, posY, width, color );
630  }
631  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
632  {
633  const int deco_size = InternalPinDecoSize( *this );
634  if( MapY1 == 0 ) /* MapX1 = +- 1 */
635  {
636  GRMoveTo( x1, y1 + deco_size );
637  GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
638  GRLineTo( clipbox, aDC, x1, y1 - deco_size, width, color );
639  }
640  else /* MapX1 = 0 */
641  {
642  GRMoveTo( x1 + deco_size, y1 );
643  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
644  GRLineTo( clipbox, aDC, x1 - deco_size, y1, width, color );
645  }
646  GRMoveTo( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 );
647  GRLineTo( clipbox, aDC, posX, posY, width, color );
648  }
649  else
650  {
651  GRMoveTo( x1, y1 );
652  GRLineTo( clipbox, aDC, posX, posY, width, color );
653  }
654 
656  {
657  const int clock_size = InternalPinDecoSize( *this );
658  if( MapY1 == 0 ) /* MapX1 = +- 1 */
659  {
660  GRMoveTo( x1, y1 + clock_size );
661  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1, width, color );
662  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
663  }
664  else /* MapX1 = 0 */
665  {
666  GRMoveTo( x1 + clock_size, y1 );
667  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2, width, color );
668  GRLineTo( clipbox, aDC, x1 - clock_size, y1, width, color );
669  }
670  }
671 
673  {
674  const int deco_size = ExternalPinDecoSize( *this );
675  if( MapY1 == 0 ) /* MapX1 = +- 1 */
676  {
677  GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
678  GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
679  GRLineTo( clipbox, aDC, x1, y1, width, color );
680  }
681  else /* MapX1 = 0 */
682  {
683  GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
684  GRLineTo( clipbox, aDC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
685  GRLineTo( clipbox, aDC, x1, y1, width, color );
686  }
687  }
688 
689 
690  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
691  {
692  const int deco_size = ExternalPinDecoSize( *this );
693  if( MapY1 == 0 ) /* MapX1 = +- 1 */
694  {
695  GRMoveTo( x1, y1 - deco_size * 2 );
696  GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
697  }
698  else /* MapX1 = 0 */
699  {
700  GRMoveTo( x1 - deco_size * 2, y1 );
701  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
702  }
703  }
704  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
705  {
706  const int deco_size = ExternalPinDecoSize( *this );
707  GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
708  GRLineTo( clipbox, aDC, x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size, width,
709  color );
710  GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
711  GRLineTo( clipbox, aDC, x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size, width,
712  color );
713  }
714 
715  if( m_type == PIN_NC ) // Draw a N.C. symbol
716  {
717  const int deco_size = TARGET_PIN_RADIUS;
718  GRLine( clipbox, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
719  GRLine( clipbox, aDC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width, color );
720  }
721 }
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:143
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174
int m_length
Length of the pin.
Definition: lib_pin.h:68
COLOR4D GetInvisibleItemColor()
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:337
int GetPenSize() const override
Definition: lib_pin.cpp:549
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
Definition: lib_pin.cpp:134
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:327
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:755
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:43
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References color, ExternalPinDecoSize(), EDA_DRAW_PANEL::GetClipBox(), GetInvisibleItemColor(), GetLayerColor(), GetPenSize(), GRCircle(), GRLine(), GRLineTo(), GRMoveTo(), InternalPinDecoSize(), IsVisible(), LAYER_PIN, m_length, m_shape, m_type, PIN_DOWN, PIN_LEFT, PIN_NC, PIN_RIGHT, PIN_UP, PINSHAPE_CLOCK, PINSHAPE_CLOCK_LOW, PINSHAPE_FALLING_EDGE_CLOCK, PINSHAPE_INPUT_LOW, PINSHAPE_INVERTED, PINSHAPE_INVERTED_CLOCK, PINSHAPE_NONLOGIC, PINSHAPE_OUTPUT_LOW, and TARGET_PIN_RADIUS.

Referenced by drawGraphic().

◆ DrawPinTexts()

void LIB_PIN::DrawPinTexts ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
wxPoint &  aPosition,
int  aOrientation,
int  TextInside,
bool  DrawPinNum,
bool  DrawPinName 
)

Put the pin number and pin text info, given the pin line coordinates.

The line must be vertical or horizontal. If DrawPinName == false the pin name is not printed. If DrawPinNum = false the pin number is not printed. If TextInside then the text is been put inside,otherwise all is drawn outside. Pin Name: substring between '~' is negated

Definition at line 724 of file lib_pin.cpp.

726 {
727  if( !DrawPinName && !DrawPinNum )
728  return;
729 
730  int x, y;
731 
732  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
733  wxSize PinNumSize( m_numTextSize, m_numTextSize );
734  int nameLineWidth = Clamp_Text_PenSize( GetPenSize(), m_nameTextSize, false );
735  int numLineWidth = Clamp_Text_PenSize( GetPenSize(), m_numTextSize, false );
736  int name_offset = PIN_TEXT_MARGIN + ( nameLineWidth + GetDefaultLineThickness() ) / 2;
737  int num_offset = PIN_TEXT_MARGIN + ( numLineWidth + GetDefaultLineThickness() ) / 2;
738 
739  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
740 
741  /* Get the num and name colors */
744 
745  int x1 = pin_pos.x;
746  int y1 = pin_pos.y;
747 
748  switch( orient )
749  {
750  case PIN_UP: y1 -= m_length; break;
751  case PIN_DOWN: y1 += m_length; break;
752  case PIN_LEFT: x1 -= m_length; break;
753  case PIN_RIGHT: x1 += m_length; break;
754  }
755 
756  if( m_name.IsEmpty() )
757  DrawPinName = false;
758 
759  if( TextInside ) // Draw the text inside, but the pin numbers outside.
760  {
761  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
762  {
763  // It is an horizontal line
764  if( DrawPinName )
765  {
766  if( orient == PIN_RIGHT )
767  {
768  x = x1 + TextInside;
769  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
770  m_name, TEXT_ANGLE_HORIZ, PinNameSize,
772  nameLineWidth, false, false );
773  }
774  else // Orient == PIN_LEFT
775  {
776  x = x1 - TextInside;
777  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor, m_name,
779  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
780  }
781  }
782 
783  if( DrawPinNum )
784  {
785  DrawGraphicText( clipbox, DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ),
786  NumColor, m_number, TEXT_ANGLE_HORIZ, PinNumSize,
788  false, false );
789  }
790  }
791  else /* Its a vertical line. */
792  {
793  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
794  if( orient == PIN_DOWN )
795  {
796  y = y1 + TextInside;
797 
798  if( DrawPinName )
799  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name,
801  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
802 
803  if( DrawPinNum )
804  DrawGraphicText( clipbox, DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ),
805  NumColor, m_number, TEXT_ANGLE_VERT, PinNumSize,
807  numLineWidth, false, false );
808  }
809  else /* PIN_UP */
810  {
811  y = y1 - TextInside;
812 
813  if( DrawPinName )
814  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name,
816  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
817 
818  if( DrawPinNum )
819  DrawGraphicText( clipbox, DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ),
820  NumColor, m_number, TEXT_ANGLE_VERT, PinNumSize,
822  numLineWidth, false, false );
823  }
824  }
825  }
826  else /**** Draw num & text pin outside ****/
827  {
828  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
829  {
830  /* Its an horizontal line. */
831  if( DrawPinName )
832  {
833  x = (x1 + pin_pos.x) / 2;
834  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ), NameColor, m_name,
836  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth, false, false );
837  }
838  if( DrawPinNum )
839  {
840  x = (x1 + pin_pos.x) / 2;
841  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ), NumColor, m_number,
843  GR_TEXT_VJUSTIFY_TOP, numLineWidth, false, false );
844  }
845  }
846  else /* Its a vertical line. */
847  {
848  if( DrawPinName )
849  {
850  y = (y1 + pin_pos.y) / 2;
851  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ), NameColor, m_name,
853  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth, false, false );
854  }
855 
856  if( DrawPinNum )
857  {
858  DrawGraphicText( clipbox, DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ),
859  NumColor, m_number, TEXT_ANGLE_VERT, PinNumSize,
861  false, false );
862  }
863  }
864  }
865 }
#define TEXT_ANGLE_HORIZ
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
#define TEXT_ANGLE_VERT
int m_numTextSize
Definition: lib_pin.h:76
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
wxString m_name
Definition: lib_pin.h:74
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174
int m_length
Length of the pin.
Definition: lib_pin.h:68
COLOR4D GetInvisibleItemColor()
void DrawGraphicText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
int GetPenSize() const override
Definition: lib_pin.cpp:549
wxString m_number
Definition: lib_pin.h:75
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:64
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References Clamp_Text_PenSize(), DrawGraphicText(), EDA_DRAW_PANEL::GetClipBox(), GetDefaultLineThickness(), GetInvisibleItemColor(), GetLayerColor(), GetPenSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, IsVisible(), LAYER_PINNAM, LAYER_PINNUM, m_length, m_name, m_nameTextSize, m_number, m_numTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, TEXT_ANGLE_HORIZ, and TEXT_ANGLE_VERT.

Referenced by drawGraphic().

◆ EnableEditMode()

void LIB_PIN::EnableEditMode ( bool  aEnable,
bool  aEditPinByPin = false 
)

Enable or clear pin editing mode.

The pin editing mode marks or unmarks all pins common to this pin object for further editing. If any of the pin modification methods are called after enabling the editing mode, all pins marked for editing will have the same attribute changed. The only case were this is not true making this pin common to all parts or body styles in the component. See SetCommonToAllParts() and SetCommonToAllBodyStyles() for more information.

Parameters
aEnable= true marks all common pins for editing mode. False clears the editing mode.
aEditPinByPin== true enables the edit pin by pin mode. aEditPinByPin == false enables the pin edit coupling between pins at the same location if aEnable == false, aEditPinByPin is not used

Definition at line 515 of file lib_pin.cpp.

516 {
517  LIB_PINS pinList;
518 
519  if( GetParent() == NULL )
520  return;
521 
522  GetParent()->GetPins( pinList );
523 
524  for( size_t i = 0; i < pinList.size(); i++ )
525  {
526  if( pinList[i] == this )
527  continue;
528 
529  if( ( pinList[i]->m_position == m_position )
530  && ( pinList[i]->m_orientation == m_orientation )
531  && !IsNew() && !aEditPinByPin && aEnable )
532  {
533  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
534  }
535  else
536  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
537  }
538 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:112
LIB_PART * GetParent() const
bool IsNew() const
Definition: base_struct.h:222
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IN_EDIT, IS_LINKED, EDA_ITEM::IsNew(), m_orientation, and m_position.

Referenced by LIB_PIN_TOOL::EditPinProperties().

◆ EndEdit()

virtual void LIB_ITEM::EndEdit ( const wxPoint &  aPosition)
inlinevirtualinherited

End an object editing action.

This is used to end or abort an edit action in progress initiated by BeginEdit().

Parameters
aPositionThe position of the last edit event in drawing coordinates.

Reimplemented in LIB_FIELD, LIB_TEXT, LIB_ARC, LIB_POLYLINE, and LIB_RECTANGLE.

Definition at line 174 of file lib_draw_item.h.

175  {
176  ClearEditFlags();
177  }
void ClearEditFlags()
Definition: base_struct.h:276

References EDA_ITEM::ClearEditFlags().

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_RECTANGLE::EndEdit(), LIB_POLYLINE::EndEdit(), LIB_ARC::EndEdit(), LIB_TEXT::EndEdit(), and LIB_FIELD::EndEdit().

◆ GetBoundingBox() [1/2]

const EDA_RECT LIB_PIN::GetBoundingBox ( ) const
inlineoverridevirtual
Returns
the boundary box for this, in library coordinates

Reimplemented from LIB_ITEM.

Definition at line 129 of file lib_pin.h.

129 { return GetBoundingBox( false ); }
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:129

References GetBoundingBox().

Referenced by SCH_PIN::GetBoundingBox(), GetBoundingBox(), HitTest(), Matches(), and DIALOG_LIB_EDIT_PIN::OnPaintShowPanel().

◆ GetBoundingBox() [2/2]

const EDA_RECT LIB_PIN::GetBoundingBox ( bool  aIncludeInvisibles) const
Parameters
aIncludeInvisibles- if false, do not include labels for invisible pins in the calculation.

Definition at line 1491 of file lib_pin.cpp.

1492 {
1493  LIB_PART* entry = (LIB_PART* ) m_Parent;
1494  EDA_RECT bbox;
1495  wxPoint begin;
1496  wxPoint end;
1497  int nameTextOffset = 0;
1498  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
1499  bool showNum = !m_number.IsEmpty();
1500  int minsizeV = TARGET_PIN_RADIUS;
1501 
1502  if( !aIncludeInvisibles && !IsVisible() )
1503  showName = false;
1504 
1505  if( entry )
1506  {
1507  if( entry->ShowPinNames() )
1508  nameTextOffset = entry->GetPinNameOffset();
1509  else
1510  showName = false;
1511 
1512  showNum = entry->ShowPinNumbers();
1513  }
1514 
1515  // First, calculate boundary box corners position
1516  int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
1517 
1518  // Actual text height is bigger than text size
1519  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
1520 
1522  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
1523 
1524  // calculate top left corner position
1525  // for the default pin orientation (PIN_RIGHT)
1526  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
1527  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
1528 
1529  // calculate bottom right corner position and adjust top left corner position
1530  int nameTextLength = 0;
1531  int nameTextHeight = 0;
1532 
1533  if( showName )
1534  {
1535  int length = m_name.Len();
1536 
1537  // Don't count the line over text symbol.
1538  if( m_name.Left( 1 ) == wxT( "~" ) )
1539  length -= 1;
1540 
1541  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
1542 
1543  // Actual text height are bigger than text size
1544  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
1545  }
1546 
1547  if( nameTextOffset ) // for values > 0, pin name is inside the body
1548  {
1549  end.x = m_length + nameTextLength;
1550  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
1551  }
1552  else // if value == 0:
1553  // pin name is outside the body, and above the pin line
1554  // pin num is below the pin line
1555  {
1556  end.x = std::max(m_length, nameTextLength);
1557  end.y = -begin.y;
1558  begin.y = std::max( minsizeV, nameTextHeight );
1559  }
1560 
1561  // Now, calculate boundary box corners position for the actual pin orientation
1562  int orient = PinDrawOrient( DefaultTransform );
1563 
1564  /* Calculate the pin position */
1565  switch( orient )
1566  {
1567  case PIN_UP:
1568  // Pin is rotated and texts positions are mirrored
1569  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
1570  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
1571  break;
1572 
1573  case PIN_DOWN:
1574  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
1575  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
1576  begin.x = -begin.x;
1577  end.x = -end.x;
1578  break;
1579 
1580  case PIN_LEFT:
1581  begin.x = -begin.x;
1582  end.x = -end.x;
1583  break;
1584 
1585  case PIN_RIGHT:
1586  break;
1587  }
1588 
1589  begin += m_position;
1590  end += m_position;
1591 
1592  bbox.SetOrigin( begin );
1593  bbox.SetEnd( end );
1594  bbox.Normalize();
1595  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
1596 
1597  // Draw Y axis is reversed in schematic:
1598  bbox.RevertYAxis();
1599 
1600  return bbox;
1601 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:143
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
int GetPinNameOffset()
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
int m_numTextSize
Definition: lib_pin.h:76
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
wxString m_name
Definition: lib_pin.h:74
Definition: lib_pin.h:55
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
int PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition: lib_pin.cpp:1253
int m_length
Length of the pin.
Definition: lib_pin.h:68
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size)
Definition: eda_rect.h:144
bool ShowPinNames()
int GetPenSize() const override
Definition: lib_pin.cpp:549
bool ShowPinNumbers()
wxString m_number
Definition: lib_pin.h:75
void SetEnd(int x, int y)
Definition: eda_rect.h:134
Define a library symbol object.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
void Normalize()
Function Normalize ensures that the height ant width are positive.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
TRANSFORM DefaultTransform
Definition: eeschema.cpp:59
#define max(a, b)
Definition: auxiliary.h:86
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:64
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:43
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
#define min(a, b)
Definition: auxiliary.h:85

References DefaultTransform, ExternalPinDecoSize(), GetPenSize(), LIB_PART::GetPinNameOffset(), EDA_RECT::Inflate(), IsVisible(), KiROUND(), m_length, m_name, m_nameTextSize, m_number, m_numTextSize, EDA_ITEM::m_Parent, m_position, m_shape, max, min, EDA_RECT::Normalize(), PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PinDrawOrient(), PINSHAPE_INVERTED, PINSHAPE_INVERTED_CLOCK, EDA_RECT::RevertYAxis(), RotatePoint(), EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), and TARGET_PIN_RADIUS.

◆ GetCanonicalElectricalTypeName() [1/2]

const wxString LIB_PIN::GetCanonicalElectricalTypeName ( ELECTRICAL_PINTYPE  aType)
static

return a string giving the electrical type of a pin.

Can be used when a known, not translated name is needed (for instance in net lists)

Parameters
aTypeis the electrical type (see enum ELECTRICAL_PINTYPE )
Returns
The electrical name for a pin type (see enun MsgPinElectricType for names).

Definition at line 77 of file lib_pin.cpp.

78 {
79  if( aType < 0 || aType >= (int) PINTYPE_COUNT )
80  return wxT( "???" );
81 
82  // These strings are the canonical name of the electrictal type
83  // Not translated, no space in name, only ASCII chars.
84  // to use when the string name must be known and well defined
85  // must have same order than enum ELECTRICAL_PINTYPE (see lib_pin.h)
86  static const wxChar* msgPinElectricType[] =
87  {
88  wxT( "input" ),
89  wxT( "output" ),
90  wxT( "BiDi" ),
91  wxT( "3state" ),
92  wxT( "passive" ),
93  wxT( "unspc" ),
94  wxT( "power_in" ),
95  wxT( "power_out" ),
96  wxT( "openCol" ),
97  wxT( "openEm" ),
98  wxT( "NotConnected" )
99  };
100 
101  return msgPinElectricType[ aType ];
102 }

References PINTYPE_COUNT.

◆ GetCanonicalElectricalTypeName() [2/2]

wxString const LIB_PIN::GetCanonicalElectricalTypeName ( ) const
inline

return a string giving the electrical type of the pin.

Can be used when a known, not translated name is needed (for instance in net lists)

Returns
The canonical electrical name of the pin.

Definition at line 250 of file lib_pin.h.

251  {
253  }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
wxString const GetCanonicalElectricalTypeName() const
return a string giving the electrical type of the pin.
Definition: lib_pin.h:250

References m_type.

◆ GetClass()

wxString LIB_PIN::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 99 of file lib_pin.h.

100  {
101  return wxT( "LIB_PIN" );
102  }

◆ GetConvert()

◆ GetDefaultColor()

COLOR4D LIB_ITEM::GetDefaultColor ( )
virtualinherited

Reimplemented in LIB_FIELD.

Definition at line 143 of file lib_draw_item.cpp.

144 {
145  return GetLayerColor( LAYER_DEVICE );
146 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174

References GetLayerColor(), and LAYER_DEVICE.

Referenced by LIB_TEXT::drawGraphic(), and LIB_TEXT::Plot().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 263 of file base_struct.h.

264  {
268  return m_Flags & mask;
269  }
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:148
#define SELECTED
Definition: base_struct.h:121
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:139
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:143
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:120
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:119

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, and STARTPOINT.

Referenced by AbortMoveAndEditTarget(), SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_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(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ GetElectricalTypeName()

wxString const LIB_PIN::GetElectricalTypeName ( ) const
inline

return a translated string for messages giving the electrical type of the pin.

Returns
The electrical name of the pin.

Definition at line 259 of file lib_pin.h.

260  {
261  return GetText( m_type );
262  }
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72

References GetText(), and m_type.

Referenced by KIGFX::SCH_PAINTER::draw(), DrawPinElectricalTypeName(), and GetSelectMenuText().

◆ GetFillMode()

◆ GetFlags()

◆ GetLength()

int LIB_PIN::GetLength ( )
inline

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

◆ GetMenuImage()

BITMAP_DEF LIB_PIN::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 1661 of file lib_pin.cpp.

1662 {
1663  return GetBitmap( m_type );
1664 }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
BITMAP_DEF GetBitmap(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:70

References GetBitmap(), and m_type.

◆ GetMsgPanelInfo() [1/2]

void LIB_PIN::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Display basic info (type, part and convert) about the current item in message panel.

This base function is used to display the information common to the all library items. Call the base class from the derived class or the common information will not be updated in the message panel.

Parameters
aListis the list to populate.

Reimplemented from LIB_ITEM.

Referenced by LIB_PIN_TOOL::EditPinProperties(), and SCH_PIN::GetMsgPanelInfo().

◆ GetMsgPanelInfo() [2/2]

void LIB_PIN::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList,
SCH_COMPONENT aComponent 
)

Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent (schematic pin position, and sheet path)

Parameters
aListis the message list to fill
aComponentis the component which "owns" the pin

Definition at line 1460 of file lib_pin.cpp.

1462 {
1463  getMsgPanelInfoBase( aUnits, aList );
1464 
1465  if( !aComponent )
1466  return;
1467 
1468  wxString text;
1469  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
1470  + aComponent->GetPosition();
1471 
1472  text = MessageTextFromValue( aUnits, pinpos.x, true );
1473  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
1474 
1475  text = MessageTextFromValue( aUnits, pinpos.y, true );
1476  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
1477 
1478  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
1479  aComponent->GetField( VALUE )->GetShownText(), DARKCYAN ) );
1480 
1481 #if defined(DEBUG)
1482 
1483  auto conn = aComponent->GetConnectionForPin( this, *g_CurrentSheet );
1484 
1485  if( conn )
1486  conn->AppendDebugInfoToMsgPanel( aList );
1487 
1488 #endif
1489 }
wxString GetShownText() const override
Returns the string actually shown after processing of the base text.
Definition: sch_field.cpp:115
Field Reference of part, i.e. "IC21".
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
#define VALUE
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
TRANSFORM & GetTransform() const
SCH_CONNECTION * GetConnectionForPin(LIB_PIN *aPin, const SCH_SHEET_PATH &aSheet)
Retrieves the connection for a given pin of the component.
void AppendDebugInfoToMsgPanel(MSG_PANEL_ITEMS &aList) const
Adds extended debug information about the connection object to aList.
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:432
wxPoint GetPosition() const override
Function GetPosition.
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void getMsgPanelInfoBase(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:1420

References SCH_CONNECTION::AppendDebugInfoToMsgPanel(), DARKCYAN, DARKMAGENTA, g_CurrentSheet, SCH_COMPONENT::GetConnectionForPin(), SCH_COMPONENT::GetField(), getMsgPanelInfoBase(), GetPosition(), SCH_COMPONENT::GetPosition(), SCH_FIELD::GetShownText(), SCH_COMPONENT::GetTransform(), MessageTextFromValue(), REFERENCE, TRANSFORM::TransformCoordinate(), and VALUE.

◆ getMsgPanelInfoBase()

void LIB_PIN::getMsgPanelInfoBase ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
private

Build the pin basic info to display in message panel.

they are pin info without the actual pin position, which is not known in schematic without knowing the parent component

Definition at line 1420 of file lib_pin.cpp.

1421 {
1422  wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
1423 
1424  LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
1425 
1426  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
1427  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
1428  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetText( m_type ), RED ) );
1429 
1430  text = GetText( m_shape );
1431  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
1432 
1433  text = IsVisible() ? _( "Yes" ) : _( "No" );
1434  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
1435 
1436  // Display pin length
1437  text = StringFromValue( aUnits, m_length, true );
1438  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
1439 
1441  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
1442 }
Definition: colors.h:57
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:109
static int GetOrientationIndex(int aCode)
Get the index of the orientation code.
Definition: lib_pin.cpp:1624
Definition: colors.h:61
wxString m_name
Definition: lib_pin.h:74
int m_length
Length of the pin.
Definition: lib_pin.h:68
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxString m_number
Definition: lib_pin.h:75
Definition: colors.h:60
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53

References BLUE, DARKCYAN, DARKGREEN, DARKMAGENTA, LIB_ITEM::GetMsgPanelInfo(), GetOrientationIndex(), getPinOrientationName(), GetText(), IsVisible(), m_length, m_name, m_number, m_orientation, m_shape, m_type, MAGENTA, RED, and StringFromValue().

Referenced by GetMsgPanelInfo().

◆ GetName()

const wxString& LIB_PIN::GetName ( void  ) const
inline

◆ GetNameTextSize()

int LIB_PIN::GetNameTextSize ( ) const
inline

◆ GetNumber()

◆ GetNumberTextSize()

◆ GetOrientation()

◆ GetOrientationCode()

int LIB_PIN::GetOrientationCode ( int  aIndex)
static

Get the orientation code by index used to set the pin orientation.

Parameters
aIndex- The index of the orientation code to look up.
Returns
Orientation code if index is valid. Returns right orientation on index error.

Definition at line 1615 of file lib_pin.cpp.

1616 {
1617  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
1618  return pin_orientation_codes[ index ];
1619 
1620  return PIN_RIGHT;
1621 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:54
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:61

References PIN_ORIENTATION_CNT, pin_orientation_codes, and PIN_RIGHT.

Referenced by DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), PIN_TABLE_DATA_MODEL::SetValue(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ GetOrientationIndex()

int LIB_PIN::GetOrientationIndex ( int  aCode)
static

Get the index of the orientation code.

Parameters
aCode- The orientation code to look up.
Returns
The index of the orientation code if found. Otherwise, return wxNOT_FOUND.

Definition at line 1624 of file lib_pin.cpp.

1625 {
1626  size_t i;
1627 
1628  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
1629  {
1630  if( pin_orientation_codes[i] == code )
1631  return (int) i;
1632  }
1633 
1634  return wxNOT_FOUND;
1635 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:54
size_t i
Definition: json11.cpp:597
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:61

References i, PIN_ORIENTATION_CNT, and pin_orientation_codes.

Referenced by getMsgPanelInfoBase(), PIN_TABLE_DATA_MODEL::GetValue(), and DIALOG_LIB_EDIT_PIN::TransferDataToWindow().

◆ GetOrientationNames()

wxArrayString LIB_PIN::GetOrientationNames ( void  )
static

Get a list of pin orientation names.

Returns
List of valid pin orientation names.

Definition at line 1604 of file lib_pin.cpp.

1605 {
1606  wxArrayString tmp;
1607 
1608  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
1609  tmp.Add( getPinOrientationName( ii ) );
1610 
1611  return tmp;
1612 }
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:109
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:61

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

Referenced by DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), and DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE().

◆ GetOrientationSymbols()

const BITMAP_DEF * LIB_PIN::GetOrientationSymbols ( )
static

Get a list of pin orientation bitmaps for menus and dialogs.

Returns
List of valid pin orientation bitmaps symbols in .xpm format

Definition at line 1655 of file lib_pin.cpp.

1656 {
1657  return iconsPinsOrientations;
1658 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:68

References iconsPinsOrientations.

Referenced by DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), and DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE().

◆ GetParent()

◆ GetPartNumber()

int LIB_PIN::GetPartNumber ( ) const
inline

Get the pin part number.

Definition at line 299 of file lib_pin.h.

299 { return m_Unit; }
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_draw_item.h:89

References LIB_ITEM::m_Unit.

◆ GetPenSize()

int LIB_PIN::GetPenSize ( ) const
overridevirtual
Returns
the size of the "pen" that be used to draw or plot this item

Implements LIB_ITEM.

Definition at line 549 of file lib_pin.cpp.

550 {
551  if( m_width > 0 )
552  return m_width;
553 
554  if( m_width == 0 )
555  return GetDefaultLineThickness();
556 
557  return 0;
558 }
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
int m_width
Line width of the pin.
Definition: lib_pin.h:71

References GetDefaultLineThickness(), and m_width.

Referenced by KIGFX::SCH_PAINTER::draw(), DrawPinSymbol(), DrawPinTexts(), GetBoundingBox(), Plot(), PlotPinTexts(), and PlotSymbol().

◆ GetPosition()

wxPoint LIB_PIN::GetPosition ( ) const
inlineoverridevirtual

◆ GetSelectMenuText()

wxString LIB_PIN::GetSelectMenuText ( EDA_UNITS_T  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1667 of file lib_pin.cpp.

1668 {
1669  return wxString::Format( _( "Pin %s, %s, %s" ),
1670  m_number,
1672  GetText( m_shape ));
1673 }
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
wxString m_number
Definition: lib_pin.h:75
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:259
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
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

References Format(), GetElectricalTypeName(), GetText(), m_number, and m_shape.

Referenced by SCH_PIN::GetSelectMenuText(), and Matches().

◆ GetShape()

GRAPHIC_PINSHAPE LIB_PIN::GetShape ( ) const
inline

◆ GetState()

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 256 of file base_struct.h.

256 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:167

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTimeStamp()

◆ GetType()

ELECTRICAL_PINTYPE LIB_PIN::GetType ( ) const
inline

Get the electrical type of the pin.

Returns
The electrical type of the pin (see enum ELECTRICAL_PINTYPE for values).

Definition at line 235 of file lib_pin.h.

235 { return m_type; }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72

References m_type.

Referenced by KIGFX::SCH_PAINTER::draw(), LIB_PIN_TOOL::EditPinProperties(), SCH_PIN::GetType(), IsPowerConnection(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), LIB_PIN_TOOL::PlacePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), and DIALOG_LIB_EDIT_PIN::TransferDataToWindow().

◆ GetTypeName()

wxString LIB_PIN::GetTypeName ( )
inlineoverridevirtual

Provide a user-consumable name of the object type.

Perform localization when called so that run-time language selection works.

Implements LIB_ITEM.

Definition at line 104 of file lib_pin.h.

105  {
106  return _( "Pin" );
107  }

◆ GetUnit()

◆ GetWidth()

int LIB_PIN::GetWidth ( ) const
inlineoverridevirtual

Return the width of the draw item.

Returns
Width of draw object.

Implements LIB_ITEM.

Definition at line 449 of file lib_pin.h.

449 { return m_width; }
int m_width
Line width of the pin.
Definition: lib_pin.h:71

References m_width.

◆ HitTest() [1/2]

bool LIB_PIN::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) 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 LIB_ITEM.

Definition at line 541 of file lib_pin.cpp.

542 {
543  EDA_RECT rect = GetBoundingBox();
544 
545  return rect.Inflate( aAccuracy ).Contains( aPosition );
546 }
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:129
bool Contains(const wxPoint &aPoint) const
Function Contains.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ HitTest() [2/2]

bool LIB_ITEM::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtualinherited

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 EDA_ITEM.

Reimplemented in LIB_TEXT, and LIB_POLYLINE.

Definition at line 110 of file lib_draw_item.cpp.

111 {
112  if( m_Flags & ( STRUCT_DELETED | SKIP_STRUCT ) )
113  return false;
114 
115  EDA_RECT sel = aRect;
116 
117  if ( aAccuracy )
118  sel.Inflate( aAccuracy );
119 
120  if( aContained )
121  return sel.Contains( GetBoundingBox() );
122 
123  return sel.Intersects( GetBoundingBox() );
124 }
const EDA_RECT GetBoundingBox() const override
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:125
bool Contains(const wxPoint &aPoint) const
Function Contains.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ InEditMode()

bool LIB_ITEM::InEditMode ( ) const
inlineinherited

Return the draw item editing mode status.

Returns
True if the item is being edited.

Definition at line 359 of file lib_draw_item.h.

359 { return ( m_Flags & ( IS_NEW | IS_DRAGGED | IS_MOVED | IS_RESIZED ) ) != 0; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:115
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by LIB_EDIT_TOOL::Properties(), LIB_TEXT::Rotate(), LIB_FIELD::Rotate(), LIB_TEXT::SetText(), LIB_FIELD::SetText(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ Inside()

bool LIB_PIN::Inside ( EDA_RECT aRect) const
overridevirtual

Test if any part of the draw object is inside rectangle bounds of aRect.

Parameters
aRectRectangle to check against.
Returns
True if object is inside rectangle.

Implements LIB_ITEM.

Definition at line 1323 of file lib_pin.cpp.

1324 {
1325  wxPoint end = PinEndPoint();
1326 
1327  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1328 }
wxPoint PinEndPoint() const
Definition: lib_pin.cpp:1237
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References EDA_RECT::Contains(), m_position, and PinEndPoint().

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 230 of file base_struct.h.

230 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References BRIGHTENED, and EDA_ITEM::m_Flags.

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

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

◆ IsFillable()

bool LIB_ITEM::IsFillable ( ) const
inlineinherited

Check if draw object can be filled.

The default setting is false. If the derived object support filling, set the m_isFillable member to true.

Returns
True if draw object can be filled. Default is false.

Definition at line 352 of file lib_draw_item.h.

352 { return m_isFillable; }
bool m_isFillable
Flag to indicate if draw item is fillable.

References LIB_ITEM::m_isFillable.

Referenced by LIB_EDIT_TOOL::editGraphicProperties(), and DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

223 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:110
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

222 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References IS_NEW, and EDA_ITEM::m_Flags.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_EDIT_TOOL::AutoplaceFields(), LIB_CIRCLE::CalcEdit(), LIB_RECTANGLE::CalcEdit(), LIB_FIELD::CalcEdit(), LIB_POLYLINE::CalcEdit(), LIB_ARC::CalcEdit(), LIB_TEXT::CalcEdit(), LIB_POLYLINE::ContinueEdit(), LIB_ARC::ContinueEdit(), SCH_EDIT_TOOL::ConvertDeMorgan(), SCH_EDIT_FRAME::ConvertTextType(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_ARC::drawGraphic(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EnableEditMode(), LIB_DRAWING_TOOLS::Init(), isNewSegment(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

◆ IsPowerConnection()

bool LIB_PIN::IsPowerConnection ( ) const
inline

Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN.

Definition at line 352 of file lib_pin.h.

352  {
353  return GetType() == PIN_POWER_IN && ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
354  }
LIB_PART * GetParent() const
Define a library symbol object.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:235
bool IsPower() const

References LIB_ITEM::GetParent(), GetType(), LIB_PART::IsPower(), IsVisible(), and PIN_POWER_IN.

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_PIN::GetDefaultNetName(), and SCH_PIN::IsPowerConnection().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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 in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 502 of file base_struct.h.

502 { return false; }

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 228 of file base_struct.h.

228 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:115

References IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by LIB_POLYLINE::CalcEdit(), and KIGFX::SCH_PAINTER::setColors().

◆ IsSelected()

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
inlinevirtualinherited

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

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

Reimplemented in SCH_FIELD, and SCH_LINE.

Definition at line 287 of file base_struct.h.

288  {
289  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
290  return true;
291 
292  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
293  {
294  if( m_StructType == *p )
295  return true;
296  }
297 
298  return false;
299  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:166
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_SCREEN::GetItem(), SCH_WIRE_BUS_TOOL::IsDrawingBus(), SCH_WIRE_BUS_TOOL::IsDrawingLine(), SCH_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), and EDA_ITEM::Visit().

◆ IsVisible()

bool LIB_PIN::IsVisible ( ) const
inline

Return the visibility status of the draw object.

Returns
True if draw object is visible otherwise false.

Definition at line 346 of file lib_pin.h.

346 { return ( m_attributes & PIN_INVISIBLE ) == 0; }
#define PIN_INVISIBLE
Definition: lib_pin.h:46
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:73

References m_attributes, and PIN_INVISIBLE.

Referenced by KIGFX::SCH_PAINTER::draw(), drawGraphic(), DrawPinElectricalTypeName(), DrawPinSymbol(), DrawPinTexts(), LIB_PIN_TOOL::EditPinProperties(), GetBoundingBox(), getMsgPanelInfoBase(), IsPowerConnection(), SCH_PIN::IsVisible(), Plot(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SetVisible(), and DIALOG_LIB_EDIT_PIN::TransferDataToWindow().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

226 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:118
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward()

SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

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

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

Definition at line 130 of file base_struct.cpp.

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

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

Referenced by EE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::GetItem(), EE_SELECTION_TOOL::RebuildSelection(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

◆ Matches() [1/2]

bool LIB_PIN::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 1676 of file lib_pin.cpp.

1677 {
1678  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
1679 
1680  // Note: this will have to be modified if we add find and replace capability to the
1681  // compoment library editor. Otherwise, you wont be able to replace pin text.
1682  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
1683  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
1684  return false;
1685 
1686  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
1687 
1688  if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
1689  {
1690  if( aFindLocation )
1691  *aFindLocation = GetBoundingBox().Centre();
1692 
1693  return true;
1694  }
1695 
1696  return false;
1697 }
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:458
Search texts (name and number (a 4 letters text) )in pins.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:129
wxString m_number
Definition: lib_pin.h:75
const wxString & GetName() const
Definition: lib_pin.h:150
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_pin.cpp:1667
const wxChar *const traceFindItem
Flag to enable find debug tracing.
Perform a search for a item that has replaceable text.
wxPoint Centre() const
Definition: eda_rect.h:60

References EDA_RECT::Centre(), FR_SEARCH_ALL_PINS, FR_SEARCH_REPLACE, GetBoundingBox(), GetName(), GetSelectMenuText(), m_number, EDA_ITEM::Matches(), MILLIMETRES, and traceFindItem.

◆ Matches() [2/2]

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 174 of file base_struct.cpp.

175 {
176  wxString text = aText;
177  wxString searchText = aSearchData.GetFindString();
178 
179  // Don't match if searching for replaceable item and the item doesn't support text replace.
180  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
181  return false;
182 
183  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
184  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
185 
186  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
187  {
188  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
189  return text.Matches( searchText );
190 
191  return text.MakeUpper().Matches( searchText.MakeUpper() );
192  }
193 
194  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
195  return aText.Find( searchText ) != wxNOT_FOUND;
196 
197  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
198 }
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:502

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

◆ MirrorHorizontal()

void LIB_PIN::MirrorHorizontal ( const wxPoint &  aCenter)
overridevirtual

Mirror the draw object along the horizontal (X) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1341 of file lib_pin.cpp.

1342 {
1343  m_position.x -= center.x;
1344  m_position.x *= -1;
1345  m_position.x += center.x;
1346 
1347  if( m_orientation == PIN_RIGHT )
1349  else if( m_orientation == PIN_LEFT )
1351 }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_orientation, m_position, PIN_LEFT, and PIN_RIGHT.

◆ MirrorVertical()

void LIB_PIN::MirrorVertical ( const wxPoint &  aCenter)
overridevirtual

Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1353 of file lib_pin.cpp.

1354 {
1355  m_position.y -= center.y;
1356  m_position.y *= -1;
1357  m_position.y += center.y;
1358 
1359  if( m_orientation == PIN_UP )
1361  else if( m_orientation == PIN_DOWN )
1363 }
Definition: lib_pin.h:55
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_orientation, m_position, PIN_DOWN, and PIN_UP.

◆ MoveTo()

void LIB_PIN::MoveTo ( const wxPoint &  aPosition)
overridevirtual

Move a draw object to aPosition.

Parameters
aPositionPosition to move draw item to.

Implements LIB_ITEM.

Definition at line 1331 of file lib_pin.cpp.

1332 {
1333  if( m_position != newPosition )
1334  {
1335  m_position = newPosition;
1336  SetModified();
1337  }
1338 }
void SetModified()
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_position, and EDA_ITEM::SetModified().

Referenced by CalcEdit(), and LIB_PIN_TOOL::CreatePin().

◆ Next()

◆ Offset()

void LIB_PIN::Offset ( const wxPoint &  aOffset)
overridevirtual

Set the drawing object by aOffset from the current position.

Parameters
aOffsetCoordinates to offset the item position.

Implements LIB_ITEM.

Definition at line 1317 of file lib_pin.cpp.

1318 {
1319  m_position += aOffset;
1320 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_position.

Referenced by LIB_PIN_TOOL::RepeatPin().

◆ operator<() [1/2]

bool LIB_ITEM::operator< ( const LIB_ITEM aOther) const
inherited

Test if another draw item is less than this draw object.

Parameters
aOther- Draw item to compare against.
Returns
- True if object is less than this object.

Definition at line 89 of file lib_draw_item.cpp.

90 {
91  int result = m_Convert - aOther.m_Convert;
92 
93  if( result != 0 )
94  return result < 0;
95 
96  result = m_Unit - aOther.m_Unit;
97 
98  if( result != 0 )
99  return result < 0;
100 
101  result = Type() - aOther.Type();
102 
103  if( result != 0 )
104  return result < 0;
105 
106  return ( compare( aOther ) < 0 );
107 }
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_draw_item.h:89
virtual int compare(const LIB_ITEM &aOther) const =0
Provide the draw object specific comparison called by the == and < operators.
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References LIB_ITEM::compare(), LIB_ITEM::m_Convert, LIB_ITEM::m_Unit, and EDA_ITEM::Type().

◆ operator<() [2/2]

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 231 of file base_struct.cpp.

232 {
233  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234  GetChars( GetClass() ) ) );
235 
236  return false;
237 }
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:100
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

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

◆ operator==() [1/2]

bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inherited

Test LIB_ITEM objects for equivalence.

Parameters
aOtherObject to test against.
Returns
True if object is identical to this object.

Definition at line 80 of file lib_draw_item.cpp.

81 {
82  return ( ( Type() == aOther.Type() )
83  && ( m_Unit == aOther.m_Unit )
84  && ( m_Convert == aOther.m_Convert )
85  && compare( aOther ) == 0 );
86 }
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_draw_item.h:89
virtual int compare(const LIB_ITEM &aOther) const =0
Provide the draw object specific comparison called by the == and < operators.
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References LIB_ITEM::compare(), LIB_ITEM::m_Convert, LIB_ITEM::m_Unit, and EDA_ITEM::Type().

◆ operator==() [2/2]

bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inlineinherited

Definition at line 250 of file lib_draw_item.h.

251  {
252  return *this == *aOther;
253  }

◆ PinDrawOrient()

int LIB_PIN::PinDrawOrient ( const TRANSFORM aTransform) const

Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform.

Parameters
aTransformTransform matrix

Definition at line 1253 of file lib_pin.cpp.

1254 {
1255  int orient;
1256  wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
1257 
1258  switch( m_orientation )
1259  {
1260  case PIN_UP: end.y = 1; break;
1261  case PIN_DOWN: end.y = -1; break;
1262  case PIN_LEFT: end.x = -1; break;
1263  case PIN_RIGHT: end.x = 1; break;
1264  }
1265 
1266  // = pos of end point, according to the component orientation
1267  end = aTransform.TransformCoordinate( end );
1268  orient = PIN_UP;
1269 
1270  if( end.x == 0 )
1271  {
1272  if( end.y > 0 )
1273  orient = PIN_DOWN;
1274  }
1275  else
1276  {
1277  orient = PIN_RIGHT;
1278 
1279  if( end.x < 0 )
1280  orient = PIN_LEFT;
1281  }
1282 
1283  return orient;
1284 }
Definition: lib_pin.h:55
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69

References m_orientation, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, and TRANSFORM::TransformCoordinate().

Referenced by drawGraphic(), AUTOPLACER::get_pin_side(), GetBoundingBox(), and Plot().

◆ PinEndPoint()

wxPoint LIB_PIN::PinEndPoint ( ) const
Returns
The pin end position for a component in the normal orientation.

Definition at line 1237 of file lib_pin.cpp.

1238 {
1239  wxPoint pos = m_position;
1240 
1241  switch( m_orientation )
1242  {
1243  case PIN_UP: pos.y += m_length; break;
1244  case PIN_DOWN: pos.y -= m_length; break;
1245  case PIN_LEFT: pos.x -= m_length; break;
1246  case PIN_RIGHT: pos.x += m_length; break;
1247  }
1248 
1249  return pos;
1250 }
Definition: lib_pin.h:55
int m_length
Length of the pin.
Definition: lib_pin.h:68
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_length, m_orientation, m_position, PIN_DOWN, PIN_LEFT, PIN_RIGHT, and PIN_UP.

Referenced by Inside().

◆ Plot()

void LIB_PIN::Plot ( PLOTTER aPlotter,
const wxPoint &  aOffset,
bool  aFill,
const TRANSFORM aTransform 
)
overridevirtual

Plot the draw item using the plot object.

Parameters
aPlotterThe plot object to plot to.
aOffsetPlot offset position.
aFillFlag to indicate whether or not the object is filled.
aTransformThe plot transform.

Implements LIB_ITEM.

Definition at line 1394 of file lib_pin.cpp.

1396 {
1397  if( ! IsVisible() )
1398  return;
1399 
1400  int orient = PinDrawOrient( aTransform );
1401 
1402  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
1403 
1404  PlotSymbol( plotter, pos, orient );
1405  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
1406  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(), GetPenSize() );
1407 }
LIB_PART * GetParent() const
void PlotPinTexts(PLOTTER *aPlotter, wxPoint &aPosition, int aOrientation, int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aWidth)
Plot the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:1048
int PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition: lib_pin.cpp:1253
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
int GetPenSize() const override
Definition: lib_pin.cpp:549
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:922
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References LIB_ITEM::GetParent(), GetPenSize(), IsVisible(), m_position, PinDrawOrient(), PlotPinTexts(), PlotSymbol(), and TRANSFORM::TransformCoordinate().

◆ PlotPinTexts()

void LIB_PIN::PlotPinTexts ( PLOTTER aPlotter,
wxPoint &  aPosition,
int  aOrientation,
int  aTextInside,
bool  aDrawPinNum,
bool  aDrawPinName,
int  aWidth 
)

Plot the pin number and pin text info, given the pin line coordinates.

Same as DrawPinTexts((), but output is the plotter The line must be vertical or horizontal. If TextInside then the text is been put inside (moving from x1, y1 in the opposite direction to x2,y2), otherwise all is drawn outside.

Definition at line 1048 of file lib_pin.cpp.

1051 {
1052  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1053  DrawPinName = false;
1054 
1055  if( m_number.IsEmpty() )
1056  DrawPinNum = false;
1057 
1058  if( !DrawPinNum && !DrawPinName )
1059  return;
1060 
1061  int x, y;
1062  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1063  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1064 
1065  int nameLineWidth = GetPenSize();
1066  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1067  int numLineWidth = GetPenSize();
1068  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1069 
1070  int name_offset = PIN_TEXT_MARGIN +
1071  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1072  int num_offset = PIN_TEXT_MARGIN +
1073  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1074 
1075  /* Get the num and name colors */
1076  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1077  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1078 
1079  int x1 = pin_pos.x;
1080  int y1 = pin_pos.y;
1081 
1082  switch( orient )
1083  {
1084  case PIN_UP: y1 -= m_length; break;
1085  case PIN_DOWN: y1 += m_length; break;
1086  case PIN_LEFT: x1 -= m_length; break;
1087  case PIN_RIGHT: x1 += m_length; break;
1088  }
1089 
1090  /* Draw the text inside, but the pin numbers outside. */
1091  if( TextInside )
1092  {
1093  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1094  {
1095  if( DrawPinName )
1096  {
1097  if( orient == PIN_RIGHT )
1098  {
1099  x = x1 + TextInside;
1100  plotter->Text( wxPoint( x, y1 ), NameColor,
1101  m_name,
1103  PinNameSize,
1106  aWidth, false, false );
1107  }
1108  else // orient == PIN_LEFT
1109  {
1110  x = x1 - TextInside;
1111 
1112  if( DrawPinName )
1113  plotter->Text( wxPoint( x, y1 ),
1114  NameColor, m_name, TEXT_ANGLE_HORIZ,
1115  PinNameSize,
1118  aWidth, false, false );
1119  }
1120  }
1121  if( DrawPinNum )
1122  {
1123  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1124  y1 - num_offset ),
1125  NumColor, m_number,
1126  TEXT_ANGLE_HORIZ, PinNumSize,
1129  aWidth, false, false );
1130  }
1131  }
1132  else /* Its a vertical line. */
1133  {
1134  if( orient == PIN_DOWN )
1135  {
1136  y = y1 + TextInside;
1137 
1138  if( DrawPinName )
1139  plotter->Text( wxPoint( x1, y ), NameColor,
1140  m_name,
1141  TEXT_ANGLE_VERT, PinNameSize,
1144  aWidth, false, false );
1145 
1146  if( DrawPinNum )
1147  {
1148  plotter->Text( wxPoint( x1 - num_offset,
1149  (y1 + pin_pos.y) / 2 ),
1150  NumColor, m_number,
1151  TEXT_ANGLE_VERT, PinNumSize,
1154  aWidth, false, false );
1155  }
1156  }
1157  else /* PIN_UP */
1158  {
1159  y = y1 - TextInside;
1160 
1161  if( DrawPinName )
1162  plotter->Text( wxPoint( x1, y ), NameColor,
1163  m_name,
1164  TEXT_ANGLE_VERT, PinNameSize,
1167  aWidth, false, false );
1168 
1169  if( DrawPinNum )
1170  {
1171  plotter->Text( wxPoint( x1 - num_offset,
1172  (y1 + pin_pos.y) / 2 ),
1173  NumColor, m_number,
1174  TEXT_ANGLE_VERT, PinNumSize,
1177  aWidth, false, false );
1178  }
1179  }
1180  }
1181  }
1182  else /* Draw num & text pin outside */
1183  {
1184  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1185  {
1186  /* Its an horizontal line. */
1187  if( DrawPinName )
1188  {
1189  x = (x1 + pin_pos.x) / 2;
1190  plotter->Text( wxPoint( x, y1 - name_offset ),
1191  NameColor, m_name,
1192  TEXT_ANGLE_HORIZ, PinNameSize,
1195  aWidth, false, false );
1196  }
1197 
1198  if( DrawPinNum )
1199  {
1200  x = ( x1 + pin_pos.x ) / 2;
1201  plotter->Text( wxPoint( x, y1 + num_offset ),
1202  NumColor, m_number,
1203  TEXT_ANGLE_HORIZ, PinNumSize,
1206  aWidth, false, false );
1207  }
1208  }
1209  else /* Its a vertical line. */
1210  {
1211  if( DrawPinName )
1212  {
1213  y = ( y1 + pin_pos.y ) / 2;
1214  plotter->Text( wxPoint( x1 - name_offset, y ),
1215  NameColor, m_name,
1216  TEXT_ANGLE_VERT, PinNameSize,
1219  aWidth, false, false );
1220  }
1221 
1222  if( DrawPinNum )
1223  {
1224  plotter->Text( wxPoint( x1 + num_offset,
1225  ( y1 + pin_pos.y ) / 2 ),
1226  NumColor, m_number,
1227  TEXT_ANGLE_VERT, PinNumSize,
1230  aWidth, false, false );
1231  }
1232  }
1233  }
1234 }
#define TEXT_ANGLE_HORIZ
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
#define TEXT_ANGLE_VERT
int m_numTextSize
Definition: lib_pin.h:76
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
wxString m_name
Definition: lib_pin.h:74
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174
int m_length
Length of the pin.
Definition: lib_pin.h:68
int GetPenSize() const override
Definition: lib_pin.cpp:549
wxString m_number
Definition: lib_pin.h:75
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:64
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References Clamp_Text_PenSize(), GetDefaultLineThickness(), GetLayerColor(), GetPenSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LAYER_PINNAM, LAYER_PINNUM, m_length, m_name, m_nameTextSize, m_number, m_numTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PLOTTER::Text(), TEXT_ANGLE_HORIZ, and TEXT_ANGLE_VERT.

Referenced by Plot().

◆ PlotSymbol()

void LIB_PIN::PlotSymbol ( PLOTTER aPlotter,
const wxPoint &  aPosition,
int  aOrientation 
)

Definition at line 922 of file lib_pin.cpp.

923 {
924  int MapX1, MapY1, x1, y1;
926 
927  aPlotter->SetColor( color );
928  aPlotter->SetCurrentLineWidth( GetPenSize() );
929 
930  MapX1 = MapY1 = 0;
931  x1 = aPosition.x; y1 = aPosition.y;
932 
933  switch( aOrientation )
934  {
935  case PIN_UP: y1 = aPosition.y - m_length; MapY1 = 1; break;
936  case PIN_DOWN: y1 = aPosition.y + m_length; MapY1 = -1; break;
937  case PIN_LEFT: x1 = aPosition.x - m_length; MapX1 = 1; break;
938  case PIN_RIGHT: x1 = aPosition.x + m_length; MapX1 = -1; break;
939  }
940 
942  {
943  const int radius = ExternalPinDecoSize( *this );
944  aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ),
945  radius * 2, NO_FILL, GetPenSize() );
946 
947  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
948  aPlotter->FinishTo( aPosition );
949  }
951  {
952  const int deco_size = InternalPinDecoSize( *this );
953  if( MapY1 == 0 ) /* MapX1 = +- 1 */
954  {
955  aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) );
956  aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) );
957  aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) );
958  }
959  else /* MapX1 = 0 */
960  {
961  aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) );
962  aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) );
963  aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) );
964  }
965 
966  aPlotter->MoveTo( wxPoint( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
967  aPlotter->FinishTo( aPosition );
968  }
969  else
970  {
971  aPlotter->MoveTo( wxPoint( x1, y1 ) );
972  aPlotter->FinishTo( aPosition );
973  }
974 
977  {
978  const int deco_size = InternalPinDecoSize( *this );
979  if( MapY1 == 0 ) /* MapX1 = +- 1 */
980  {
981  aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) );
982  aPlotter->LineTo( wxPoint( x1 - MapX1 * deco_size * 2, y1 ) );
983  aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) );
984  }
985  else /* MapX1 = 0 */
986  {
987  aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) );
988  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * deco_size * 2 ) );
989  aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) );
990  }
991  }
992 
993  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
994  {
995  const int deco_size = ExternalPinDecoSize( *this );
996 
997  if( MapY1 == 0 ) /* MapX1 = +- 1 */
998  {
999  aPlotter->MoveTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) );
1000  aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
1001  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1002  }
1003  else /* MapX1 = 0 */
1004  {
1005  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) );
1006  aPlotter->LineTo( wxPoint( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
1007  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1008  }
1009  }
1010 
1011 
1012  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1013  {
1014  const int symbol_size = ExternalPinDecoSize( *this );
1015 
1016  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1017  {
1018  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1019  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1020  }
1021  else /* MapX1 = 0 */
1022  {
1023  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1024  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1025  }
1026  }
1027  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1028  {
1029  const int deco_size = ExternalPinDecoSize( *this );
1030  aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) );
1031  aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size ) );
1032  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) );
1033  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size ) );
1034  }
1035  if( m_type == PIN_NC ) // Draw a N.C. symbol
1036  {
1037  const int deco_size = TARGET_PIN_RADIUS;
1038  const int ex1 = aPosition.x;
1039  const int ey1 = aPosition.y;
1040  aPlotter->MoveTo( wxPoint( ex1 - deco_size, ey1 - deco_size ) );
1041  aPlotter->FinishTo( wxPoint( ex1 + deco_size, ey1 + deco_size ) );
1042  aPlotter->MoveTo( wxPoint( ex1 + deco_size, ey1 - deco_size ) );
1043  aPlotter->FinishTo( wxPoint( ex1 - deco_size, ey1 + deco_size ) );
1044  }
1045 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:251
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:143
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
virtual void SetColor(COLOR4D color)=0
int color
Definition: DXF_plotter.cpp:62
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:174
int m_length
Length of the pin.
Definition: lib_pin.h:68
int GetPenSize() const override
Definition: lib_pin.cpp:549
void LineTo(const wxPoint &pos)
Definition: plotter.h:246
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
Definition: lib_pin.cpp:134
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:43
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References PLOTTER::Circle(), color, ExternalPinDecoSize(), PLOTTER::FinishTo(), GetLayerColor(), GetPenSize(), InternalPinDecoSize(), LAYER_PIN, PLOTTER::LineTo(), m_length, m_shape, m_type, PLOTTER::MoveTo(), NO_FILL, PIN_DOWN, PIN_LEFT, PIN_NC, PIN_RIGHT, PIN_UP, PINSHAPE_CLOCK, PINSHAPE_CLOCK_LOW, PINSHAPE_FALLING_EDGE_CLOCK, PINSHAPE_INPUT_LOW, PINSHAPE_INVERTED, PINSHAPE_INVERTED_CLOCK, PINSHAPE_NONLOGIC, PINSHAPE_OUTPUT_LOW, PLOTTER::SetColor(), PLOTTER::SetCurrentLineWidth(), and TARGET_PIN_RADIUS.

Referenced by Plot().

◆ Replace() [1/2]

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 201 of file base_struct.cpp.

202 {
203  wxCHECK_MSG( IsReplaceable(), false,
204  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
205 
206  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
207 
208  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
209  aSearchData.GetFindString() :
210  aSearchData.GetFindString().Upper() );
211 
212  if( result == wxNOT_FOUND )
213  return false;
214 
215  wxString prefix = aText.Left( result );
216  wxString suffix;
217 
218  if( aSearchData.GetFindString().length() + result < aText.length() )
219  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
220 
221  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
222  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
223  GetChars( suffix ) );
224 
225  aText = prefix + aSearchData.GetReplaceString() + suffix;
226 
227  return true;
228 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:100
virtual wxString GetClass() const =0
Function GetClass returns the class name.
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:502

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

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

◆ Replace() [2/2]

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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 490 of file base_struct.h.

490 { return false; }

◆ Rotate() [1/2]

void LIB_PIN::Rotate ( )
overridevirtual

Rotate the draw item.

Reimplemented from LIB_ITEM.

Definition at line 1638 of file lib_pin.cpp.

1639 {
1640  int orient = PIN_RIGHT;
1641 
1642  switch( GetOrientation() )
1643  {
1644  case PIN_UP: orient = PIN_LEFT; break;
1645  case PIN_DOWN: orient = PIN_RIGHT; break;
1646  case PIN_LEFT: orient = PIN_DOWN; break;
1647  case PIN_RIGHT: orient = PIN_UP; break;
1648  }
1649 
1650  // Set the new orientation
1651  SetOrientation( orient );
1652 }
int GetOrientation() const
Definition: lib_pin.h:205
Definition: lib_pin.h:55
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
Definition: lib_pin.cpp:270

References GetOrientation(), PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, and SetOrientation().

◆ Rotate() [2/2]

void LIB_PIN::Rotate ( const wxPoint &  aCenter,
bool  aRotateCCW = true 
)
overridevirtual

Rotate the object about aCenter point.

Parameters
aCenterPoint to rotate around.
aRotateCCWTrue to rotate counter clockwise. False to rotate clockwise.

Implements LIB_ITEM.

Definition at line 1365 of file lib_pin.cpp.

1366 {
1367  int rot_angle = aRotateCCW ? -900 : 900;
1368 
1369  RotatePoint( &m_position, center, rot_angle );
1370 
1371  if( aRotateCCW )
1372  {
1373  switch( m_orientation )
1374  {
1375  case PIN_RIGHT: m_orientation = PIN_UP; break;
1376  case PIN_UP: m_orientation = PIN_LEFT; break;
1377  case PIN_LEFT: m_orientation = PIN_DOWN; break;
1378  case PIN_DOWN: m_orientation = PIN_RIGHT; break;
1379  }
1380  }
1381  else
1382  {
1383  switch( m_orientation )
1384  {
1385  case PIN_RIGHT: m_orientation = PIN_DOWN; break;
1386  case PIN_UP: m_orientation = PIN_RIGHT; break;
1387  case PIN_LEFT: m_orientation = PIN_UP; break;
1388  case PIN_DOWN: m_orientation = PIN_LEFT; break;
1389  }
1390  }
1391 }
Definition: lib_pin.h:55
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67

References m_orientation, m_position, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, and RotatePoint().

◆ SetBack()

void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 218 of file base_struct.h.

218 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:171

References EDA_ITEM::Pback.

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

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 235 of file base_struct.h.

235 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

◆ SetConversion()

void LIB_PIN::SetConversion ( int  aConversion)

Set the body style (conversion) of the pin.

If the pin is changed from not common to common to all body styles, any linked pins will be removed from the parent component.

Parameters
aConversion- Body style of the pin. Set to zero to make pin common to all body styles.

Definition at line 451 of file lib_pin.cpp.

452 {
453  if( m_Convert == style )
454  return;
455 
456  m_Convert = style;
457  SetFlags( IS_CHANGED );
458 
459  if( style == 0 )
460  {
461  LIB_PIN* pin;
462  LIB_PIN* tmp = GetParent()->GetNextPin();
463 
464  while( tmp != NULL )
465  {
466  pin = tmp;
467  tmp = GetParent()->GetNextPin( pin );
468 
469  if( ( pin->m_Flags & IS_LINKED ) == 0
470  || ( pin == this )
471  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
472  || ( m_position != pin->m_position )
473  || ( pin->m_orientation != m_orientation ) )
474  continue;
475 
476  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
477  }
478  }
479 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
LIB_PART * GetParent() const
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_draw_item.h:89
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:110
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
LIB_PIN * GetNextPin(LIB_PIN *aItem=NULL)
Return the next pin object from the draw list.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
void RemoveDrawItem(LIB_ITEM *aItem, EDA_DRAW_PANEL *aPanel=NULL, wxDC *aDc=NULL)
Remove draw aItem from list.
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96

References LIB_PART::GetNextPin(), LIB_ITEM::GetParent(), IS_CHANGED, IS_LINKED, LIB_ITEM::m_Convert, EDA_ITEM::m_Flags, m_orientation, m_position, LIB_ITEM::m_Unit, LIB_PART::RemoveDrawItem(), and EDA_ITEM::SetFlags().

Referenced by DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetConvert()

◆ SetFillMode()

void LIB_ITEM::SetFillMode ( FILL_T  aFillMode)
inlineinherited

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 259 of file base_struct.h.

259 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), LIB_ITEM::BeginEdit(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), KIGFX::SCH_PAINTER::draw(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), KIGFX::SCH_VIEW::HighlightItem(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), PCB_EDIT_FRAME::Other_Layer_Route(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), SetConversion(), BLOCK_SELECTOR::SetFlags(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), SCH_WIRE_BUS_TOOL::startSegments(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

◆ SetForceVisible()

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 309 of file base_struct.h.

309 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:178

References EDA_ITEM::m_forceVisible.

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

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 234 of file base_struct.h.

234 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetLength()

void LIB_PIN::SetLength ( int  aLength,
bool  aTestOtherPins = true 
)

Set the pin length.

This will also update the length of the pins marked by EnableEditMode().

Parameters
aLength- The length of the pin in mils.
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 364 of file lib_pin.cpp.

365 {
366  if( m_length != length )
367  {
368  m_length = length;
369  SetModified();
370  }
371 
372  if( !aTestOtherPins )
373  return;
374 
375  if( GetParent() == NULL )
376  return;
377 
378  LIB_PINS pinList;
379  GetParent()->GetPins( pinList );
380 
381  for( size_t i = 0; i < pinList.size(); i++ )
382  {
383  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
384  || pinList[i]->m_Convert != m_Convert
385  || pinList[i]->m_length == length )
386  continue;
387 
388  pinList[i]->m_length = length;
389  SetModified();
390  }
391 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
int m_length
Length of the pin.
Definition: lib_pin.h:68
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, LIB_ITEM::m_Convert, EDA_ITEM::m_Flags, m_length, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetList()

void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 220 of file base_struct.h.

220 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:172

References EDA_ITEM::m_List.

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

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

Definition at line 100 of file base_struct.cpp.

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

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

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

◆ SetName()

void LIB_PIN::SetName ( const wxString &  aName,
bool  aTestOtherPins = true 
)

Set the pin name.

This will also all of the pin names marked by EnableEditMode().

Parameters
aNameNew pin name.
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 162 of file lib_pin.cpp.

163 {
164  wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
165 
166  // pin name string does not support spaces
167  tmp.Replace( wxT( " " ), wxT( "_" ) );
168 
169  if( m_name != tmp )
170  {
171  m_name = tmp;
172  SetModified();
173  }
174 
175  if( !aTestOtherPins )
176  return;
177 
178  if( GetParent() == NULL )
179  return;
180 
181  LIB_PINS pinList;
182  GetParent()->GetPins( pinList );
183 
184  for( size_t i = 0; i < pinList.size(); i++ )
185  {
186  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_name == m_name )
187  continue;
188 
189  pinList[i]->m_name = m_name;
190  SetModified();
191  }
192 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
wxString m_name
Definition: lib_pin.h:74
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, EDA_ITEM::m_Flags, m_name, and EDA_ITEM::SetModified().

Referenced by DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), LIB_PIN_TOOL::RepeatPin(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetNameTextSize()

void LIB_PIN::SetNameTextSize ( int  aSize,
bool  aTestOtherPins = true 
)

Set the aSize of the pin name text.

This will also update the text size of the name of the pins marked by EnableEditMode().

Parameters
aSizeThe text size of the pin name in schematic units ( mils ).
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 195 of file lib_pin.cpp.

196 {
197  if( size != m_nameTextSize )
198  {
199  m_nameTextSize = size;
200  SetModified();
201  }
202 
203  if( !aTestOtherPins )
204  return;
205 
206  if( GetParent() == NULL )
207  return;
208 
209  LIB_PINS pinList;
210  GetParent()->GetPins( pinList );
211 
212  for( size_t i = 0; i < pinList.size(); i++ )
213  {
214  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
215  continue;
216 
217  pinList[i]->m_nameTextSize = size;
218  SetModified();
219  }
220 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:77
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, EDA_ITEM::m_Flags, m_nameTextSize, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetNext()

void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 217 of file base_struct.h.

217 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:170

References EDA_ITEM::Pnext.

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

◆ SetNumber()

void LIB_PIN::SetNumber ( const wxString &  aNumber)

Set the pin number.

Others pin numbers marked by EnableEditMode() are not modified because each pin has its own number

Parameters
aNumberNew pin number.

Definition at line 223 of file lib_pin.cpp.

224 {
225  // Unlike SetName, others pin numbers marked by EnableEditMode() are
226  // not modified because each pin has its own number, so set number
227  // only for this.
228 
229  wxString tmp = ( aNumber.IsEmpty() ) ? wxT( "~" ) : aNumber;
230 
231  // pin number string does not support spaces
232  tmp.Replace( wxT( " " ), wxT( "_" ) );
233 
234  if( m_number != tmp )
235  {
236  m_number = tmp;
237  SetModified();
238  }
239 }
void SetModified()
wxString m_number
Definition: lib_pin.h:75

References m_number, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreateImagePins(), SCH_EAGLE_PLUGIN::loadSymbol(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), LIB_PIN_TOOL::RepeatPin(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetNumberTextSize()

void LIB_PIN::SetNumberTextSize ( int  aSize,
bool  aTestOtherPins = true 
)

Set the size of the pin number text.

This will also update the text size of the number of the pins marked by EnableEditMode().

Parameters
aSizeThe text size of the pin number in schematic units ( mils ).
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 242 of file lib_pin.cpp.

243 {
244  if( size != m_numTextSize )
245  {
246  m_numTextSize = size;
247  SetModified();
248  }
249 
250  if( !aTestOtherPins )
251  return;
252 
253  if( GetParent() == NULL )
254  return;
255 
256  LIB_PINS pinList;
257  GetParent()->GetPins( pinList );
258 
259  for( size_t i = 0; i < pinList.size(); i++ )
260  {
261  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
262  continue;
263 
264  pinList[i]->m_numTextSize = size;
265  SetModified();
266  }
267 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
int m_numTextSize
Definition: lib_pin.h:76
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, EDA_ITEM::m_Flags, m_numTextSize, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetOrientation()

void LIB_PIN::SetOrientation ( int  aOrientation,
bool  aTestOtherPins = true 
)

Set orientation on the pin.

This will also update the orientation of the pins marked by EnableEditMode().

Parameters
aOrientation- The orientation of the pin.
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 270 of file lib_pin.cpp.

271 {
272  if( m_orientation != orientation )
273  {
274  m_orientation = orientation;
275  SetModified();
276  }
277 
278  if( !aTestOtherPins )
279  return;
280 
281  if( GetParent() == NULL )
282  return;
283 
284  LIB_PINS pinList;
285  GetParent()->GetPins( pinList );
286 
287  for( size_t i = 0; i < pinList.size(); i++ )
288  {
289  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
290  pinList[i]->m_orientation == orientation )
291  continue;
292 
293  pinList[i]->m_orientation = orientation;
294  SetModified();
295  }
296 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, EDA_ITEM::m_Flags, m_orientation, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), Rotate(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetParent()

◆ SetPartNumber()

void LIB_PIN::SetPartNumber ( int  aPart)

Set the pin part number.

If the pin is changed from not common to common to all parts, any linked pins will be removed from the parent component.

Parameters
aPart- Number of the part the pin belongs to. Set to zero to make pin common to all parts in a multi-part component.

Definition at line 421 of file lib_pin.cpp.

422 {
423  if( m_Unit == part )
424  return;
425 
426  m_Unit = part;
427  SetModified();
428 
429  if( m_Unit == 0 )
430  {
431  LIB_PIN* pin;
432  LIB_PIN* tmp = GetParent()->GetNextPin();
433 
434  while( tmp != NULL )
435  {
436  pin = tmp;
437  tmp = GetParent()->GetNextPin( pin );
438 
439  if( pin->m_Flags == 0 || pin == this
440  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
441  || ( m_position != pin->m_position )
442  || ( pin->m_orientation != m_orientation ) )
443  continue;
444 
445  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
446  }
447  }
448 }
void SetModified()
LIB_PART * GetParent() const
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_draw_item.h:89
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:69
LIB_PIN * GetNextPin(LIB_PIN *aItem=NULL)
Return the next pin object from the draw list.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
void RemoveDrawItem(LIB_ITEM *aItem, EDA_DRAW_PANEL *aPanel=NULL, wxDC *aDc=NULL)
Remove draw aItem from list.
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96

References LIB_PART::GetNextPin(), LIB_ITEM::GetParent(), LIB_ITEM::m_Convert, EDA_ITEM::m_Flags, m_orientation, m_position, LIB_ITEM::m_Unit, LIB_PART::RemoveDrawItem(), and EDA_ITEM::SetModified().

Referenced by DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetPinPosition()

void LIB_PIN::SetPinPosition ( wxPoint  aPosition)

move this and all linked pins to the new position used in pin editing.

use SetPinPosition to set the position of this only

Parameters
aPositionis the new position of this and linked pins

Definition at line 394 of file lib_pin.cpp.

395 {
396  if( m_position != aPosition )
397  {
398  m_position = aPosition;
399  SetModified();
400  }
401 
402  if( GetParent() == NULL )
403  return;
404 
405  LIB_PINS pinList;
406  GetParent()->GetPins( pinList );
407 
408  for( size_t i = 0; i < pinList.size(); i++ )
409  {
410  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
411  || pinList[i]->m_Convert != m_Convert
412  || pinList[i]->m_position == aPosition )
413  continue;
414 
415  pinList[i]->m_position = aPosition;
416  SetModified();
417  }
418 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:67
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, LIB_ITEM::m_Convert, EDA_ITEM::m_Flags, m_position, and EDA_ITEM::SetModified().

Referenced by DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetPosition()

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 233 of file base_struct.h.

233 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:121
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259

References SELECTED, and EDA_ITEM::SetFlags().

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

◆ SetShape()

void LIB_PIN::SetShape ( GRAPHIC_PINSHAPE  aShape)

Set the shape of the pin to aShape.

This will also update the draw style of the pins marked by EnableEditMode().

Parameters
aShape- The draw shape of the pin. See enum GRAPHIC_PINSHAPE.

Definition at line 299 of file lib_pin.cpp.

300 {
301  assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
302 
303  if( m_shape != aShape )
304  {
305  m_shape = aShape;
306  SetModified();
307  }
308 
309  if( GetParent() == NULL )
310  return;
311 
312  LIB_PINS pinList;
313  GetParent()->GetPins( pinList );
314 
315  for( size_t i = 0; i < pinList.size(); i++ )
316  {
317  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
318  || pinList[i]->m_Convert != m_Convert
319  || pinList[i]->m_shape == aShape )
320  continue;
321 
322  pinList[i]->m_shape = aShape;
323  SetModified();
324  }
325 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:70
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597
int m_Convert
Shape identification for alternate body styles.
Definition: lib_draw_item.h:96

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, LIB_ITEM::m_Convert, EDA_ITEM::m_Flags, m_shape, PINSHAPE_COUNT, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetState()

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

◆ SetTimeStamp()

void EDA_ITEM::SetTimeStamp ( timestamp_t  aNewTimeStamp)
inlineinherited

Definition at line 209 of file base_struct.h.

209 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:175

References EDA_ITEM::m_TimeStamp.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), Diagnose(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), and TestMultiunitFootprints().

◆ SetType()

void LIB_PIN::SetType ( ELECTRICAL_PINTYPE  aType,
bool  aTestOtherPins = true 
)

Set the electrical type of the pin.

This will also update the electrical type of the pins marked by EnableEditMode().

Parameters
aType- The electrical type of the pin(see enun ELECTRICAL_PINTYPE for values).
aTestOtherPinsdetermines if other pins need to be updated

Definition at line 328 of file lib_pin.cpp.

329 {
330  assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
331 
332  if( aType < PIN_INPUT )
333  aType = PIN_INPUT;
334 
335  if( aType >= (int)PINTYPE_COUNT )
336  aType = PIN_NC;
337 
338  if( m_type != aType )
339  {
340  m_type = aType;
341  SetModified();
342  }
343 
344  if( !aTestOtherPins )
345  return;
346 
347  if( GetParent() == NULL )
348  return;
349 
350  LIB_PINS pinList;
351  GetParent()->GetPins( pinList );
352 
353  for( size_t i = 0; i < pinList.size(); i++ )
354  {
355  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_type == aType )
356  continue;
357 
358  pinList[i]->m_type = aType;
359  SetModified();
360  }
361 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:72

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, EDA_ITEM::m_Flags, m_type, PIN_INPUT, PIN_NC, PINTYPE_COUNT, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and DIALOG_LIB_EDIT_PIN::TransferDataFromWindow().

◆ SetUnit()

◆ SetVisible()

void LIB_PIN::SetVisible ( bool  aVisible)

Set or clear the visibility flag for the pin.

This will also update the visibility of the pins marked by EnableEditMode().

Parameters
aVisible- True to make the pin visible or false to hide the pin.

Definition at line 482 of file lib_pin.cpp.

483 {
484  if( visible == IsVisible() )
485  return;
486 
487  if( visible )
489  else
491 
492  SetModified();
493 
494  if( GetParent() == NULL )
495  return;
496 
497  LIB_PINS pinList;
498  GetParent()->GetPins( pinList );
499 
500  for( size_t i = 0; i < pinList.size(); i++ )
501  {
502  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->IsVisible() == visible )
503  continue;
504 
505  if( visible )
506  pinList[i]->m_attributes &= ~PIN_INVISIBLE;
507  else
508  pinList[i]->m_attributes |= PIN_INVISIBLE;
509 
510  SetModified();
511  }
512 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
void SetModified()
LIB_PART * GetParent() const
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
#define PIN_INVISIBLE
Definition: lib_pin.h:46
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:346
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:73
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
size_t i
Definition: json11.cpp:597

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), i, IS_LINKED, IsVisible(), m_attributes, EDA_ITEM::m_Flags, PIN_INVISIBLE, and EDA_ITEM::SetModified().

Referenced by LIB_PIN_TOOL::CreatePin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), and DIALOG_LIB_EDIT_PIN::TransferDataToWindow().

◆ SetWidth()

void LIB_PIN::SetWidth ( int  aWidth)
overridevirtual

Set the width of the draw item to aWidth.

Implements LIB_ITEM.

Definition at line 1410 of file lib_pin.cpp.

1411 {
1412  if( m_width != aWidth )
1413  {
1414  m_width = aWidth;
1415  SetModified();
1416  }
1417 }
void SetModified()
int m_width
Line width of the pin.
Definition: lib_pin.h:71

References m_width, and EDA_ITEM::SetModified().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 232 of file base_struct.h.

232 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:118

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

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 521 of file base_struct.h.

521 { return *aLeft < *aRight; }

Referenced by PART_LIB::GetEntryTypePowerNames().

◆ Type()

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 204 of file base_struct.h.

205  {
206  return m_StructType;
207  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:166

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::addJunctionsIfNeeded(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), PCB_EDIT_FRAME::Begin_Route(), 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(), CONNECTION_GRAPH::buildConnectionGraph(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_SCREENS::ChangeSymbolLibNickname(), CN_VISITOR::checkZoneItemConnection(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), PCB_TARGET::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), ZONE_CONTAINER::ClassOf(), MARKER_PCB::ClassOf(), DIMENSION::ClassOf(), NETINFO_ITEM::ClassOf(), TRACK::ClassOf(), MODULE::ClassOf(), SCH_COMPONENT::ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), EE_COLLECTOR::Collect(), Collect_TrackSegmentsToDrag(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_BEZIER::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_EDIT_FRAME::ConvertTextType(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), MODULE::CoverageRatio(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), DeleteNullTrackSegments(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_ERC::DisplayERC_MarkersList(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), LIB_DRAWING_TOOLS::doTwoClickPlace(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_TOOL::EditField(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), PCB_EDIT_FRAME::EraseRedundantTrack(), CONNECTION_GRAPH::ercCheckLabels(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), EDIT_TOOL::FootprintFilter(), FootprintWriteShape(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNameForDriver(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), EE_SELECTION_TOOL::guessSelectionCandidates(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isNewSegment(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegments(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), SCH_MOVE_TOOL::moveItem(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_CONNECTION::Name(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), 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(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftDClick(), FOOTPRINT_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), POINT_EDITOR::OnSelectionChange(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), SCH_EDITOR_CONTROL::Paste(), PCBNEW_CONTROL::PasteItemsFromClipboard(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SELECTION_TOOL::RebuildSelection(), SCH_BASE_FRAME::RefreshItem(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), PCB_BASE_FRAME::ResetTextSize(), BOARD_COMMIT::Revert(), SCH_EDIT_TOOL::Rotate(), SCH_TEXT::Rotate(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), PCB_EDIT_FRAME::SelectHighLight(), ITEM_PICKER::SetItem(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), PCB_TARGET::SwapData(), SCH_BITMAP::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), SCH_FIELD::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), VIA::SwapData(), SCH_COMPONENT::SwapData(), MODULE::SwapData(), ZONE_CONTAINER::SwapData(), D_PAD::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_TEXT::UpdateDanglingState(), EE_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), CONNECTION_GRAPH::updateItemConnectivity(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_SHEET::Visit(), and SCH_COMPONENT::Visit().

◆ ViewBBox()

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, TRACK, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, LIB_ALIAS, KIGFX::WORKSHEET_VIEWITEM, MARKER_PCB, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 257 of file base_struct.cpp.

258 {
259  // Basic fallback
260  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
261  VECTOR2I( GetBoundingBox().GetSize() ) );
262 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References EDA_ITEM::GetBoundingBox().

Referenced by BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), and BRIGHT_BOX::ViewDraw().

◆ ViewDraw()

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, KIGFX::VIEW_OVERLAY, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 116 of file view_item.h.

117  {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void LIB_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.

For instance, a D_PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]output layer index array
aCountnumber of layer indices in aLayers[]

Reimplemented from EDA_ITEM.

Reimplemented in LIB_FIELD, and LIB_TEXT.

Definition at line 134 of file lib_draw_item.cpp.

135 {
136  // Basic fallback
137  aCount = 2;
138  aLayers[0] = LAYER_DEVICE;
139  aLayers[1] = LAYER_DEVICE_BACKGROUND;
140 }

References LAYER_DEVICE, and LAYER_DEVICE_BACKGROUND.

◆ ViewGetLOD()

virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewGetLOD() Returns the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TRACK, TEXTE_MODULE, and EDGE_MODULE.

Definition at line 140 of file view_item.h.

141  {
142  // By default always show the item
143  return 0;
144  }

Referenced by KIGFX::VIEW::drawItem::operator()().

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
virtualinherited

Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE, and determined by the inspector.

Reimplemented in BOARD, LIB_PART, MODULE, SCH_COMPONENT, SCH_SHEET, GERBER_FILE_IMAGE, GERBER_DRAW_ITEM, TRACK, and GBR_LAYOUT.

Definition at line 149 of file base_struct.cpp.

150 {
151 #if 0 && defined(DEBUG)
152  std::cout << GetClass().mb_str() << ' ';
153 #endif
154 
155  if( IsType( scanTypes ) )
156  {
157  if( SEARCH_QUIT == inspector( this, testData ) )
158  return SEARCH_QUIT;
159  }
160 
161  return SEARCH_CONTINUE;
162 }
virtual bool IsType(const KICAD_T aScanTypes[])
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:287
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), EDA_ITEM::IsType(), SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by GERBER_COLLECTOR::Collect(), GENERAL_COLLECTOR::Collect(), PCB_TYPE_COLLECTOR::Collect(), PCB_LAYER_COLLECTOR::Collect(), and EDA_ITEM::IterateForward().

Friends And Related Function Documentation

◆ SCH_LEGACY_PLUGIN_CACHE

friend class SCH_LEGACY_PLUGIN_CACHE
friend

Definition at line 65 of file lib_pin.h.

Member Data Documentation

◆ m_attributes

int LIB_PIN::m_attributes
private

Set bit 0 to indicate pin is invisible.

Definition at line 73 of file lib_pin.h.

Referenced by IsVisible(), LIB_PIN(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), and SetVisible().

◆ m_Convert

int LIB_ITEM::m_Convert
protectedinherited

Shape identification for alternate body styles.

Set 0 if the item is common to all body styles. This is commonly referred to as DeMorgan style and this is typically how it is used in KiCad.

Definition at line 96 of file lib_draw_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::GetConvert(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::LIB_ITEM(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), LIB_ITEM::operator<(), LIB_ITEM::operator==(), SetConversion(), LIB_PART::SetConversion(), LIB_ITEM::SetConvert(), SetLength(), SetPartNumber(), SetPinPosition(), and SetShape().

◆ m_Fill

◆ m_Flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

Set to true to override the visibility setting of the item.

Definition at line 178 of file base_struct.h.

Referenced by SCH_FIELD::Draw(), EDA_ITEM::initVars(), EDA_ITEM::operator=(), and EDA_ITEM::SetForceVisible().

◆ m_initialC