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 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) const override
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
bool HitTest (const wxPoint &aPosRef, int aThreshold, const TRANSFORM &aTransform) const override
 
void GetMsgPanelInfo (std::vector< MSG_PANEL_ITEM > &aList) override
 Display basic info (type, part and convert) about the current item in message panel. More...
 
void GetMsgPanelInfo (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 &aPosition, int aOrientation, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED, bool aDrawDangling=true, bool aOnlyTarget=false)
 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, COLOR4D aColor, GR_DRAWMODE aDrawMode)
 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, COLOR4D aColor, GR_DRAWMODE aDrawMode)
 Draw the electrical type text of the pin (only for the footprint editor) aDrawMode = GR_OR, XOR ... 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 SetOffset (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 Move (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 edition. 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 () 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...
 
virtual void BeginEdit (STATUS_FLAGS aEditMode, const wxPoint aPosition=wxPoint(0, 0))
 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, bool aAbort=false)
 End an object editing action. More...
 
virtual void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform)
 Draw an item. More...
 
LIB_PARTGetParent () const
 
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...
 
void SetEraseLastDrawItem (bool aErase=true)
 
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
 
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 ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static 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_DEFGetOrientationSymbols ()
 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 GetOrientationCodeIndex (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, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform) override
 Draw a pin, with or without the pin texts. More...
 
void getMsgPanelInfoBase (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 68 of file lib_pin.h.

Constructor & Destructor Documentation

LIB_PIN::LIB_PIN ( LIB_PART aParent)

Definition at line 147 of file lib_pin.cpp.

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().

147  :
148  LIB_ITEM( LIB_PIN_T, aParent ),
150 {
152  m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
153  m_type = PIN_UNSPECIFIED; // electrical type of pin
154  m_attributes = 0; // bit 0 != 0: pin invisible
157  m_width = 0;
158 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
int m_numTextSize
Definition: lib_pin.h:84
static int GetDefaultPinLength()
int m_length
Length of the pin.
Definition: lib_pin.h:76
static int GetPinNumDefaultSize()
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:81
static int GetPinNameDefaultSize()
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
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:79
LIB_PIN::~LIB_PIN ( )
inline

Definition at line 111 of file lib_pin.h.

111 { }

Member Function Documentation

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 218 of file base_struct.h.

References EDA_ITEM::Pback.

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

218 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:176
virtual void LIB_ITEM::BeginEdit ( STATUS_FLAGS  aEditMode,
const wxPoint  aPosition = wxPoint( 0, 0 ) 
)
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_ARC, LIB_TEXT, LIB_POLYLINE, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 170 of file lib_draw_item.h.

Referenced by LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), and LIB_EDIT_FRAME::StartMoveDrawSymbol().

170 {}
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 244 of file base_struct.h.

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

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

244 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 265 of file base_struct.h.

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

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

Definition at line 243 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

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

References LIB_PIN().

Referenced by LIB_EDIT_FRAME::CreateImagePins(), GetWidth(), and LIB_EDIT_FRAME::RepeatPinItem().

1544 {
1545  return new LIB_PIN( *this );
1546 }
LIB_PIN(LIB_PART *aParent)
Definition: lib_pin.cpp:147
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 1549 of file lib_pin.cpp.

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

Referenced by GetWidth().

1550 {
1551  wxASSERT( other.Type() == LIB_PIN_T );
1552 
1553  const LIB_PIN* tmp = (LIB_PIN*) &other;
1554 
1555  if( m_number != tmp->m_number )
1556  return m_number.Cmp( tmp->m_number );
1557 
1558  int result = m_name.CmpNoCase( tmp->m_name );
1559 
1560  if( result != 0 )
1561  return result;
1562 
1563  if( m_position.x != tmp->m_position.x )
1564  return m_position.x - tmp->m_position.x;
1565 
1566  if( m_position.y != tmp->m_position.y )
1567  return m_position.y - tmp->m_position.y;
1568 
1569  return 0;
1570 }
wxString m_name
Definition: lib_pin.h:82
wxString m_number
Definition: lib_pin.h:83
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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_FIELD, LIB_ARC, LIB_TEXT, LIB_POLYLINE, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 182 of file lib_draw_item.h.

182 { return false; }
void LIB_ITEM::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aOffset,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode,
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
aColorDraw color, or COLOR4D::UNSPECIFIED to use the normal body item color
aDrawModeGR_OR, GR_XOR, ...
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 115 of file lib_draw_item.cpp.

References LIB_ITEM::calcEdit(), color, LIB_ITEM::drawEditGraphics(), LIB_ITEM::drawGraphic(), g_XorMode, EDA_DRAW_PANEL::GetClipBox(), LIB_ITEM::GetDefaultColor(), GRSetDrawMode(), LIB_ITEM::InEditMode(), LIB_ITEM::m_eraseLastDrawItem, LIB_ITEM::m_Fill, and NO_FILL.

Referenced by LIB_EDIT_FRAME::CreatePin(), DrawMovePin(), DrawMovingBlockOutlines(), LIB_EDIT_FRAME::EditSymbolText(), LIB_ITEM::EndEdit(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), LIB_EDIT_FRAME::Process_Special_Functions(), RedrawWhileMovingCursor(), LIB_PART::RemoveDrawItem(), and SymbolDisplayDraw().

119 {
120  if( InEditMode() )
121  {
122  // Temporarily disable filling while the item is being edited.
123  FILL_T fillMode = m_Fill;
125 
126  m_Fill = NO_FILL;
127 
128 #ifndef USE_WX_OVERLAY
129  // Erase the old items using the previous attributes.
130  if( m_eraseLastDrawItem )
131  {
132  GRSetDrawMode( aDC, g_XorMode );
133  drawEditGraphics( aPanel->GetClipBox(), aDC, color );
134  drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
135  aTransform );
136  }
137 #endif
138  // Calculate the new attributes at the current cursor position.
139  calcEdit( aOffset );
140 
141  // Draw the items using the new attributes.
142  drawEditGraphics( aPanel->GetClipBox(), aDC, color );
143  drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
144  aTransform );
145 
146  m_Fill = fillMode;
147  }
148  else
149  {
150  drawGraphic( aPanel, aDC, aOffset, aColor, aDrawMode, aData, aTransform );
151  }
152 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
virtual COLOR4D GetDefaultColor()
bool m_eraseLastDrawItem
Used when editing a new draw item to prevent drawing artifacts.
int color
Definition: DXF_plotter.cpp:62
bool InEditMode() const
Return the draw item editing mode status.
virtual void calcEdit(const wxPoint &aPosition)
Calculates the attributes of an item at aPosition when it is being edited.
virtual void drawEditGraphics(EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor)
Draw any editing specific graphics when the item is being edited.
Definition: lib_draw_item.h:93
EDA_RECT * GetClipBox()
virtual void drawGraphic(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform)=0
Draw the item on aPanel.
FILL_T m_Fill
The body fill type.
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:52
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void LIB_PIN::drawGraphic ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aOffset,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode,
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
aColorCOLOR4D::UNSPECIFIED to use the normal body item color, or else use this color
aDrawModeGR_OR, GR_XOR, ...
aData= used here as uintptr_t containing bitwise OR'd flags: PIN_DRAW_TEXTS, – false to draw only pin shape, useful for fast mode PIN_DRAW_DANGLING, – true to draw the pin with its target PIN_DANGLING_HIDDEN – draw the target even if the pin is hidden PIN_DRAW_ELECTRICAL_TYPE_NAME – Draw the pin electrical type name
aTransformTransform Matrix (rotation, mirror ..)

Implements LIB_ITEM.

Definition at line 570 of file lib_pin.cpp.

References DrawPinElectricalTypeName(), DrawPinSymbol(), DrawPinTexts(), FRAME_SCH, GetBoundingBox(), EDA_DRAW_PANEL::GetClipBox(), GetInvisibleItemColor(), EDA_DRAW_PANEL::GetParent(), LIB_ITEM::GetParent(), LIB_PART::GetPinNameOffset(), GRRect(), EDA_BASE_FRAME::IsType(), IsVisible(), LIGHTMAGENTA, m_position, EDA_RECT::Move(), PIN_DANGLING_HIDDEN, PIN_DRAW_DANGLING, PIN_DRAW_ELECTRICAL_TYPE_NAME, PIN_DRAW_TEXTS, PinDrawOrient(), EDA_RECT::RevertYAxis(), LIB_PART::ShowPinNames(), LIB_PART::ShowPinNumbers(), and TRANSFORM::TransformCoordinate().

577 {
578  // aData is used here as a bitfield of flags.
579  uintptr_t flags = (uintptr_t) aData;
580  bool drawPinText = flags & PIN_DRAW_TEXTS;
581  bool drawPinDangling = flags & PIN_DRAW_DANGLING;
582  bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
583  bool drawElectricalTypeName = flags & PIN_DRAW_ELECTRICAL_TYPE_NAME;
584 
585  LIB_PART* Entry = GetParent();
586 
587  /* Calculate pin orient taking in account the component orientation. */
588  int orient = PinDrawOrient( aTransform );
589 
590  /* Calculate the pin position */
591  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
592 
593  // Invisible pins are only drawn on request.
594  // They are drawn in GetInvisibleItemColor().
595  // in schematic, they are drawn only if m_showAllPins is true.
596  // In other windows, they are always drawn because we must see them.
597  if( ! IsVisible() )
598  {
599  EDA_DRAW_FRAME* frame = NULL;
600 
601  if( aPanel && aPanel->GetParent() )
602  frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
603 
604  if( frame && frame->IsType( FRAME_SCH ) &&
605  ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
606  {
607  if( drawPinDangling && drawDanglingHidden )
608  {
609  // Draw the target
610  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
611  /* aOnlyTarget */ true );
612  }
613  return;
614  }
615 
616  aColor = GetInvisibleItemColor();
617  }
618 
619  /* Drawing from the pin and the special symbol combination */
620  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
621 
622  if( drawPinText )
623  {
624  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
625  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
626  aColor, aDrawMode );
627  }
628 
629  if( drawElectricalTypeName )
630  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
631 
632 
633  /* Set to one (1) to draw bounding box around pin to validate bounding
634  * box calculation. */
635 #if 0
636  EDA_RECT bBox = GetBoundingBox();
637  bBox.RevertYAxis();
638  bBox = aTransform.TransformCoordinate( bBox );
639  bBox.Move( aOffset );
640  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
641 #endif
642 }
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
void DrawPinElectricalTypeName(EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation, COLOR4D aColor, GR_DRAWMODE aDrawMode)
Draw the electrical type text of the pin (only for the footprint editor) aDrawMode = GR_OR...
Definition: lib_pin.cpp:1058
int GetPinNameOffset()
Schematic editor (Eeschema) main window.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:144
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:55
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) ...
Definition: eda_rect.h:144
COLOR4D GetInvisibleItemColor()
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
bool ShowPinNames()
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1098
bool ShowPinNumbers()
LIB_PART * GetParent() const
Define a library symbol object.
EDA_RECT * GetClipBox()
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:180
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:361
void DrawPinTexts(EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName, COLOR4D aColor, GR_DRAWMODE aDrawMode)
Put the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:844
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsType(FRAME_T aType) const
void DrawPinSymbol(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, int aOrientation, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED, bool aDrawDangling=true, bool aOnlyTarget=false)
Draw the pin symbol without text.
Definition: lib_pin.cpp:645
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:1498
void LIB_PIN::DrawPinElectricalTypeName ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
wxPoint aPosition,
int  aOrientation,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode 
)

Draw the electrical type text of the pin (only for the footprint editor) aDrawMode = GR_OR, XOR ...

Definition at line 1058 of file lib_pin.cpp.

References DrawGraphicText(), ETXT_MAX_SIZE, EDA_DRAW_PANEL::GetClipBox(), GetElectricalTypeName(), GetInvisibleItemColor(), GetItemSelectedColor(), GetLayerColor(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, GRSetDrawMode(), EDA_ITEM::IsSelected(), IsVisible(), LAYER_NOTES, m_nameTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by drawGraphic(), and IsPowerConnection().

1061 {
1062  wxString etypeName = GetElectricalTypeName();
1063 
1064  // Use a reasonable (small) size to draw the text
1065  int etextSize = (m_nameTextSize*3)/4;
1066 
1067  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
1068  if( etextSize > ETXT_MAX_SIZE )
1069  etextSize = ETXT_MAX_SIZE;
1070 
1071  // Use a reasonable pen size to draw the text
1072  int pensize = etextSize/6;
1073 
1074  // Get a suitable color
1075  if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
1076  aColor = GetItemSelectedColor();
1077  else if( !IsVisible() )
1078  aColor = GetInvisibleItemColor();
1079  else
1080  aColor = GetLayerColor( LAYER_NOTES );
1081 
1082  wxPoint txtpos = aPosition;
1083  int offset = Millimeter2iu( 0.4 );
1085  int orient = TEXT_ANGLE_HORIZ;
1086 
1087  switch( aOrientation )
1088  {
1089  case PIN_UP:
1090  txtpos.y += offset;
1091  orient = TEXT_ANGLE_VERT;
1092  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1093  break;
1094 
1095  case PIN_DOWN:
1096  txtpos.y -= offset;
1097  orient = TEXT_ANGLE_VERT;
1098  break;
1099 
1100  case PIN_LEFT:
1101  txtpos.x += offset;
1102  break;
1103 
1104  case PIN_RIGHT:
1105  txtpos.x -= offset;
1106  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1107  break;
1108  }
1109 
1110  GRSetDrawMode( aDC, aDrawMode );
1111  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
1112 
1113  DrawGraphicText( clipbox, aDC, txtpos, aColor, etypeName,
1114  orient, wxSize( etextSize, etextSize ),
1115  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize,
1116  false, false );
1117 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
#define ETXT_MAX_SIZE
bool IsSelected() const
Definition: base_struct.h:232
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:274
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
#define TEXT_ANGLE_VERT
Definition: common.h:92
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)
EDA_RECT * GetClipBox()
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:361
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
COLOR4D GetItemSelectedColor()
void LIB_PIN::DrawPinSymbol ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
int  aOrientation,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED,
bool  aDrawDangling = true,
bool  aOnlyTarget = false 
)

Draw the pin symbol without text.

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

Definition at line 645 of file lib_pin.cpp.

References color, ExternalPinDecoSize(), EDA_DRAW_PANEL::GetClipBox(), GetItemSelectedColor(), GetLayerColor(), GetPenSize(), EDA_DRAW_PANEL::GetScreen(), GRCircle(), GRLine(), GRLineTo(), GRMoveTo(), GRSetDrawMode(), InternalPinDecoSize(), EDA_ITEM::IsSelected(), LAYER_PIN, BASE_SCREEN::m_IsPrinting, m_length, m_shape, m_type, NCSYMB_PIN_DIM, 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, TARGET_PIN_RADIUS, wxPoint::x, and wxPoint::y.

Referenced by drawGraphic(), and IsPowerConnection().

653 {
654  int MapX1, MapY1, x1, y1;
655  int width = GetPenSize();
656  int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
657  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
658 
660 
661  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
662  {
663  if( IsSelected() )
664  color = GetItemSelectedColor();
665  }
666  else
667  color = aColor;
668 
669  GRSetDrawMode( aDC, aDrawMode );
670 
671  MapX1 = MapY1 = 0;
672  x1 = posX;
673  y1 = posY;
674 
675  switch( aOrient )
676  {
677  case PIN_UP:
678  y1 = posY - len;
679  MapY1 = 1;
680  break;
681 
682  case PIN_DOWN:
683  y1 = posY + len;
684  MapY1 = -1;
685  break;
686 
687  case PIN_LEFT:
688  x1 = posX - len;
689  MapX1 = 1;
690  break;
691 
692  case PIN_RIGHT:
693  x1 = posX + len;
694  MapX1 = -1;
695  break;
696  }
697 
698  // Draw the pin end target (active end of the pin)
699  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
700  #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
701 
702  // Draw but do not print the pin end target 1 pixel width
703  if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
704  {
705  if( aDrawDangling )
706  GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
707  }
708 
709  if( aOnlyTarget )
710  return;
711 
712 
714  {
715  const int radius = ExternalPinDecoSize( *this );
716  GRCircle( clipbox, aDC, MapX1 * radius + x1,
717  MapY1 * radius + y1,
718  radius, width, color );
719 
720  GRMoveTo( MapX1 * radius * 2 + x1,
721  MapY1 * radius * 2 + y1 );
722  GRLineTo( clipbox, aDC, posX, posY, width, color );
723  }
724  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
725  {
726  const int clock_size = InternalPinDecoSize( *this );
727  if( MapY1 == 0 ) /* MapX1 = +- 1 */
728  {
729  GRMoveTo( x1, y1 + clock_size );
730  GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
731  width, color );
732  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
733  }
734  else /* MapX1 = 0 */
735  {
736  GRMoveTo( x1 + clock_size, y1 );
737  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
738  width, color );
739  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
740  width, color );
741  }
742  GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
743  GRLineTo( clipbox, aDC, posX, posY, width, color );
744  }
745  else
746  {
747  GRMoveTo( x1, y1 );
748  GRLineTo( clipbox, aDC, posX, posY, width, color );
749  }
750 
752  {
753  const int clock_size = InternalPinDecoSize( *this );
754  if( MapY1 == 0 ) /* MapX1 = +- 1 */
755  {
756  GRMoveTo( x1, y1 + clock_size );
757  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1,
758  width, color );
759  GRLineTo( clipbox, aDC, x1, y1 - clock_size,
760  width, color );
761  }
762  else /* MapX1 = 0 */
763  {
764  GRMoveTo( x1 + clock_size, y1 );
765  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2,
766  width, color );
767  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
768  width, color );
769  }
770  }
771 
773  {
774  const int symbol_size = ExternalPinDecoSize( *this );
775  if( MapY1 == 0 ) /* MapX1 = +- 1 */
776  {
777  GRMoveTo( x1 + MapX1 * symbol_size * 2, y1 );
778  GRLineTo( clipbox, aDC,
779  x1 + MapX1 * symbol_size * 2, y1 - symbol_size * 2,
780  width, color );
781  GRLineTo( clipbox, aDC, x1, y1, width, color );
782  }
783  else /* MapX1 = 0 */
784  {
785  GRMoveTo( x1, y1 + MapY1 * symbol_size * 2 );
786  GRLineTo( clipbox, aDC, x1 - symbol_size * 2,
787  y1 + MapY1 * symbol_size * 2, width, color );
788  GRLineTo( clipbox, aDC, x1, y1, width, color );
789  }
790  }
791 
792 
793  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
794  {
795  const int symbol_size = ExternalPinDecoSize( *this );
796  if( MapY1 == 0 ) /* MapX1 = +- 1 */
797  {
798  GRMoveTo( x1, y1 - symbol_size * 2 );
799  GRLineTo( clipbox,
800  aDC,
801  x1 + MapX1 * symbol_size * 2,
802  y1,
803  width,
804  color );
805  }
806  else /* MapX1 = 0 */
807  {
808  GRMoveTo( x1 - symbol_size * 2, y1 );
809  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * symbol_size * 2,
810  width, color );
811  }
812  }
813  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
814  {
815  const int symbol_size = ExternalPinDecoSize( *this );
816  GRMoveTo( x1 - (MapX1 + MapY1) * symbol_size,
817  y1 - (MapY1 - MapX1) * symbol_size );
818  GRLineTo( clipbox, aDC,
819  x1 + (MapX1 + MapY1) * symbol_size,
820  y1 + (MapY1 - MapX1) * symbol_size,
821  width, color );
822  GRMoveTo( x1 - (MapX1 - MapY1) * symbol_size,
823  y1 - (MapY1 + MapX1) * symbol_size );
824  GRLineTo( clipbox, aDC,
825  x1 + (MapX1 - MapY1) * symbol_size,
826  y1 + (MapY1 + MapX1) * symbol_size,
827  width, color );
828  }
829 
830  if( m_type == PIN_NC ) // Draw a N.C. symbol
831  {
832  GRLine( clipbox, aDC,
833  posX - NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
834  posX + NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
835  width, color );
836  GRLine( clipbox, aDC,
837  posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
838  posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
839  width, color );
840  }
841 }
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the &#39;external&#39; pin decorators (as a radius)
Definition: lib_pin.cpp:142
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
int color
Definition: DXF_plotter.cpp:62
bool IsSelected() const
Definition: base_struct.h:232
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:76
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:432
int GetPenSize() const override
Definition: lib_pin.cpp:564
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_RECT * GetClipBox()
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the &#39;internal&#39; pin decorators (as a radius)
Definition: lib_pin.cpp:133
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:380
bool m_IsPrinting
Definition: base_screen.h:220
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:422
#define NCSYMB_PIN_DIM
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:850
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
#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:80
COLOR4D GetItemSelectedColor()
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void LIB_PIN::DrawPinTexts ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
wxPoint aPosition,
int  aOrientation,
int  TextInside,
bool  DrawPinNum,
bool  DrawPinName,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode 
)

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 DrawMode = GR_OR, XOR ...

Definition at line 844 of file lib_pin.cpp.

References Clamp_Text_PenSize(), DrawGraphicText(), EDA_DRAW_PANEL::GetClipBox(), GetDefaultLineThickness(), GetItemSelectedColor(), 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, GRSetDrawMode(), EDA_ITEM::IsSelected(), 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, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by drawGraphic(), and IsPowerConnection().

853 {
854  if( !DrawPinName && !DrawPinNum )
855  return;
856 
857  int x, y;
858 
859  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
860  wxSize PinNumSize( m_numTextSize, m_numTextSize );
861 
862  int nameLineWidth = GetPenSize();
863 
864  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
865  int numLineWidth = GetPenSize();
866  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
867 
868  int name_offset = PIN_TEXT_MARGIN +
869  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
870  int num_offset = PIN_TEXT_MARGIN +
871  ( numLineWidth + GetDefaultLineThickness() ) / 2;
872 
873  GRSetDrawMode( DC, DrawMode );
874  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
875 
876  /* Get the num and name colors */
877  if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
878  Color = GetItemSelectedColor();
879 
880  COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
881  GetLayerColor( LAYER_PINNAM ) : Color;
882  COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
883  GetLayerColor( LAYER_PINNUM ) : Color;
884 
885  int x1 = pin_pos.x;
886  int y1 = pin_pos.y;
887 
888  switch( orient )
889  {
890  case PIN_UP:
891  y1 -= m_length;
892  break;
893 
894  case PIN_DOWN:
895  y1 += m_length;
896  break;
897 
898  case PIN_LEFT:
899  x1 -= m_length;
900  break;
901 
902  case PIN_RIGHT:
903  x1 += m_length;
904  break;
905  }
906 
907  if( m_name.IsEmpty() )
908  DrawPinName = false;
909 
910  if( TextInside ) // Draw the text inside, but the pin numbers outside.
911  {
912  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
913  {
914  // It is an horizontal line
915  if( DrawPinName )
916  {
917  if( orient == PIN_RIGHT )
918  {
919  x = x1 + TextInside;
920  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
921  m_name,
923  PinNameSize,
925  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
926  false, false );
927  }
928  else // Orient == PIN_LEFT
929  {
930  x = x1 - TextInside;
931  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
932  m_name,
934  PinNameSize,
936  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
937  false, false );
938  }
939  }
940 
941  if( DrawPinNum )
942  {
943  DrawGraphicText( clipbox, DC,
944  wxPoint( (x1 + pin_pos.x) / 2,
945  y1 - num_offset ), NumColor,
946  m_number,
947  TEXT_ANGLE_HORIZ, PinNumSize,
949  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
950  false, false );
951  }
952  }
953  else /* Its a vertical line. */
954  {
955  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
956  if( orient == PIN_DOWN )
957  {
958  y = y1 + TextInside;
959 
960  if( DrawPinName )
961  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
962  m_name,
963  TEXT_ANGLE_VERT, PinNameSize,
965  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
966  false, false );
967 
968  if( DrawPinNum )
969  DrawGraphicText( clipbox, DC,
970  wxPoint( x1 - num_offset,
971  (y1 + pin_pos.y) / 2 ), NumColor,
972  m_number,
973  TEXT_ANGLE_VERT, PinNumSize,
975  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
976  false, false );
977  }
978  else /* PIN_UP */
979  {
980  y = y1 - TextInside;
981 
982  if( DrawPinName )
983  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
984  m_name,
985  TEXT_ANGLE_VERT, PinNameSize,
987  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
988  false, false );
989 
990  if( DrawPinNum )
991  DrawGraphicText( clipbox, DC,
992  wxPoint( x1 - num_offset,
993  (y1 + pin_pos.y) / 2 ), NumColor,
994  m_number,
995  TEXT_ANGLE_VERT, PinNumSize,
997  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
998  false, false );
999  }
1000  }
1001  }
1002  else /**** Draw num & text pin outside ****/
1003  {
1004  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1005  {
1006  /* Its an horizontal line. */
1007  if( DrawPinName )
1008  {
1009  x = (x1 + pin_pos.x) / 2;
1010  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ),
1011  NameColor, m_name,
1012  TEXT_ANGLE_HORIZ, PinNameSize,
1014  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1015  false, false );
1016  }
1017  if( DrawPinNum )
1018  {
1019  x = (x1 + pin_pos.x) / 2;
1020  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
1021  NumColor, m_number,
1022  TEXT_ANGLE_HORIZ, PinNumSize,
1024  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1025  false, false );
1026  }
1027  }
1028  else /* Its a vertical line. */
1029  {
1030  if( DrawPinName )
1031  {
1032  y = (y1 + pin_pos.y) / 2;
1033  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ),
1034  NameColor, m_name,
1035  TEXT_ANGLE_VERT, PinNameSize,
1037  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1038  false, false );
1039  }
1040 
1041  if( DrawPinNum )
1042  {
1043  DrawGraphicText( clipbox, DC,
1044  wxPoint( x1 + num_offset, (y1 + pin_pos.y)
1045  / 2 ),
1046  NumColor, m_number,
1047  TEXT_ANGLE_VERT, PinNumSize,
1049  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1050  false, false );
1051  }
1052  }
1053  }
1054 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
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...
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
int m_numTextSize
Definition: lib_pin.h:84
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
bool IsSelected() const
Definition: base_struct.h:232
wxString m_name
Definition: lib_pin.h:82
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:76
#define TEXT_ANGLE_VERT
Definition: common.h:92
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:564
wxString m_number
Definition: lib_pin.h:83
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:63
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
COLOR4D GetItemSelectedColor()
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
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 edition coupling between pins at the same location if aEnable == false, aEditPinByPin is not used

Definition at line 514 of file lib_pin.cpp.

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

Referenced by GetPartNumber(), and LIB_EDIT_FRAME::OnEditPin().

515 {
516  LIB_PINS pinList;
517 
518  if( GetParent() == NULL )
519  return;
520 
521  GetParent()->GetPins( pinList );
522 
523  for( size_t i = 0; i < pinList.size(); i++ )
524  {
525  if( pinList[i] == this )
526  continue;
527 
528  if( ( pinList[i]->m_position == m_position )
529  && ( pinList[i]->m_orientation == m_orientation )
530  && !IsNew() && !aEditPinByPin && aEnable )
531  {
532  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
533  }
534  else
535  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
536  }
537 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:106
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:107
bool IsNew() const
Definition: base_struct.h:227
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:77
LIB_PART * GetParent() const
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
size_t i
Definition: json11.cpp:597
virtual void LIB_ITEM::EndEdit ( const wxPoint aPosition,
bool  aAbort = false 
)
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.
aAbortSet to true to abort the current edit in progress.

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

Definition at line 192 of file lib_draw_item.h.

References LIB_ITEM::Draw(), LIB_ITEM::GetPenSize(), and EDA_ITEM::m_Flags.

Referenced by AbortSymbolTraceOn(), and LIB_EDIT_FRAME::EndDrawGraphicItem().

192 { m_Flags = 0; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
const EDA_RECT LIB_PIN::GetBoundingBox ( ) const
inlineoverridevirtual
Returns
the boundary box for this, in library coordinates

Reimplemented from LIB_ITEM.

Definition at line 144 of file lib_pin.h.

References GetBoundingBox(), PinDrawOrient(), and PinEndPoint().

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

144 { return GetBoundingBox( false ); }
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:144
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 1769 of file lib_pin.cpp.

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(), TARGET_PIN_RADIUS, wxPoint::x, and wxPoint::y.

1770 {
1771  LIB_PART* entry = (LIB_PART* ) m_Parent;
1772  EDA_RECT bbox;
1773  wxPoint begin;
1774  wxPoint end;
1775  int nameTextOffset = 0;
1776  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
1777  bool showNum = !m_number.IsEmpty();
1778  int minsizeV = TARGET_PIN_RADIUS;
1779 
1780  if( !aIncludeInvisibles && !IsVisible() )
1781  showName = false;
1782 
1783  if( entry )
1784  {
1785  if( entry->ShowPinNames() )
1786  nameTextOffset = entry->GetPinNameOffset();
1787  else
1788  showName = false;
1789 
1790  showNum = entry->ShowPinNumbers();
1791  }
1792 
1793  // First, calculate boundary box corners position
1794  int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
1795 
1796  // Actual text height is bigger than text size
1797  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
1798 
1800  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
1801 
1802  // calculate top left corner position
1803  // for the default pin orientation (PIN_RIGHT)
1804  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
1805  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
1806 
1807  // calculate bottom right corner position and adjust top left corner position
1808  int nameTextLength = 0;
1809  int nameTextHeight = 0;
1810 
1811  if( showName )
1812  {
1813  int length = m_name.Len();
1814 
1815  // Don't count the line over text symbol.
1816  if( m_name.Left( 1 ) == wxT( "~" ) )
1817  length -= 1;
1818 
1819  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
1820 
1821  // Actual text height are bigger than text size
1822  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
1823  }
1824 
1825  if( nameTextOffset ) // for values > 0, pin name is inside the body
1826  {
1827  end.x = m_length + nameTextLength;
1828  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
1829  }
1830  else // if value == 0:
1831  // pin name is outside the body, and above the pin line
1832  // pin num is below the pin line
1833  {
1834  end.x = std::max(m_length, nameTextLength);
1835  end.y = -begin.y;
1836  begin.y = std::max( minsizeV, nameTextHeight );
1837  }
1838 
1839  // Now, calculate boundary box corners position for the actual pin orientation
1840  int orient = PinDrawOrient( DefaultTransform );
1841 
1842  /* Calculate the pin position */
1843  switch( orient )
1844  {
1845  case PIN_UP:
1846  // Pin is rotated and texts positions are mirrored
1847  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
1848  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
1849  break;
1850 
1851  case PIN_DOWN:
1852  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
1853  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
1854  begin.x = -begin.x;
1855  end.x = -end.x;
1856  break;
1857 
1858  case PIN_LEFT:
1859  begin.x = -begin.x;
1860  end.x = -end.x;
1861  break;
1862 
1863  case PIN_RIGHT:
1864  break;
1865  }
1866 
1867  begin += m_position;
1868  end += m_position;
1869 
1870  bbox.SetOrigin( begin );
1871  bbox.SetEnd( end );
1872  bbox.Normalize();
1873  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
1874 
1875  // Draw Y axis is reversed in schematic:
1876  bbox.RevertYAxis();
1877 
1878  return bbox;
1879 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:179
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the &#39;external&#39; pin decorators (as a radius)
Definition: lib_pin.cpp:142
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
int GetPinNameOffset()
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int m_numTextSize
Definition: lib_pin.h:84
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
wxString m_name
Definition: lib_pin.h:82
Definition: lib_pin.h:55
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
int m_length
Length of the pin.
Definition: lib_pin.h:76
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:564
bool ShowPinNumbers()
wxString m_number
Definition: lib_pin.h:83
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:361
void Normalize()
Function Normalize ensures that the height ant width are positive.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
#define max(a, b)
Definition: auxiliary.h:86
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:63
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.
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:1498
#define min(a, b)
Definition: auxiliary.h:85
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 76 of file lib_pin.cpp.

References PINTYPE_COUNT.

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

Referenced by GetType().

266  {
268  }
wxString const GetCanonicalElectricalTypeName() const
return a string giving the electrical type of the pin.
Definition: lib_pin.h:265
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
wxString LIB_PIN::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 113 of file lib_pin.h.

Referenced by Matches().

114  {
115  return wxT( "LIB_PIN" );
116  }
COLOR4D LIB_ITEM::GetDefaultColor ( )
virtualinherited

Reimplemented in LIB_FIELD.

Definition at line 155 of file lib_draw_item.cpp.

References GetLayerColor(), and LAYER_DEVICE.

Referenced by LIB_ITEM::Draw(), LIB_TEXT::drawGraphic(), LIB_TEXT::Plot(), and LIB_ITEM::SetEraseLastDrawItem().

156 {
157  return GetLayerColor( LAYER_DEVICE );
158 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
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 274 of file lib_pin.h.

References GetText(), SetLength(), and SetType().

Referenced by DrawPinElectricalTypeName(), and GetSelectMenuText().

275  {
276  return GetText( m_type );
277  }
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:80
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 266 of file base_struct.h.

References EDA_ITEM::m_Flags.

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

266 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
int LIB_PIN::GetLength ( void  )
inline

Definition at line 300 of file lib_pin.h.

References m_length, and SetPartNumber().

Referenced by LIB_EDIT_FRAME::GlobalSetPins(), LIB_EDIT_FRAME::OnEditPin(), and SCH_LEGACY_PLUGIN_CACHE::savePin().

300 { return m_length; }
int m_length
Length of the pin.
Definition: lib_pin.h:76
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
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 1950 of file lib_pin.cpp.

References GetBitmap(), and m_type.

Referenced by GetWidth().

1951 {
1952  return GetBitmap( m_type );
1953 }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
BITMAP_DEF GetBitmap(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:70
void LIB_PIN::GetMsgPanelInfo ( 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.

Definition at line 1730 of file lib_pin.cpp.

References DARKMAGENTA, g_UserUnit, getMsgPanelInfoBase(), GetPosition(), StringFromValue(), wxPoint::x, and wxPoint::y.

Referenced by GetTypeName(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::RepeatPinItem(), and LIB_EDIT_FRAME::StartMovePin().

1731 {
1732  getMsgPanelInfoBase( aList );
1733 
1734  wxString text;
1735  wxPoint pinpos = GetPosition();
1736  pinpos.y = -pinpos.y; // Display coord are top to bottom
1737  // lib items coord are bottom to top
1738 
1739  text = StringFromValue( g_UserUnit, pinpos.x, true );
1740  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
1741 
1742  text = StringFromValue( g_UserUnit, pinpos.y, true );
1743  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
1744 }
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:1697
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:462
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void LIB_PIN::GetMsgPanelInfo ( 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 1746 of file lib_pin.cpp.

References DARKCYAN, DARKMAGENTA, g_UserUnit, SCH_COMPONENT::GetField(), getMsgPanelInfoBase(), GetPosition(), SCH_COMPONENT::GetPosition(), EDA_TEXT::GetShownText(), SCH_COMPONENT::GetTransform(), REFERENCE, StringFromValue(), TRANSFORM::TransformCoordinate(), VALUE, wxPoint::x, and wxPoint::y.

1748 {
1749  getMsgPanelInfoBase( aList );
1750 
1751  if( !aComponent )
1752  return;
1753 
1754  wxString text;
1755  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
1756  + aComponent->GetPosition();
1757 
1758  text = StringFromValue( g_UserUnit, pinpos.x, true );
1759  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
1760 
1761  text = StringFromValue( g_UserUnit, pinpos.y, true );
1762  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
1763 
1764  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
1765  aComponent->GetField( VALUE )->GetShownText(),
1766  DARKCYAN ) );
1767 }
TRANSFORM & GetTransform() const
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:1697
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
Field Reference of part, i.e. "IC21".
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
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.
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:462
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
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
#define VALUE
void LIB_PIN::getMsgPanelInfoBase ( 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 1697 of file lib_pin.cpp.

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

Referenced by GetMsgPanelInfo(), and GetWidth().

1698 {
1699  wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
1700 
1701  LIB_ITEM::GetMsgPanelInfo( aList );
1702 
1703  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
1704 
1705  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
1706 
1707  aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
1708  GetText( m_type ),
1709  RED ) );
1710 
1711  text = GetText( m_shape );
1712 
1713  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
1714 
1715  if( IsVisible() )
1716  text = _( "Yes" );
1717  else
1718  text = _( "No" );
1719 
1720  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
1721 
1722  // Display pin length
1723  text = StringFromValue( g_UserUnit, m_length, true );
1724  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
1725 
1727  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
1728 }
Definition: colors.h:57
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:108
Definition: colors.h:61
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
wxString m_name
Definition: lib_pin.h:82
int m_length
Length of the pin.
Definition: lib_pin.h:76
static int GetOrientationCodeIndex(int aCode)
Get the index of the orientation code.
Definition: lib_pin.cpp:1902
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
wxString m_number
Definition: lib_pin.h:83
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:361
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
const wxString& LIB_PIN::GetName ( void  ) const
inline
int LIB_PIN::GetNameTextSize ( ) const
inline

Definition at line 191 of file lib_pin.h.

References m_nameTextSize.

Referenced by LIB_EDIT_FRAME::GlobalSetPins(), InternalPinDecoSize(), LIB_EDIT_FRAME::OnEditPin(), and SCH_LEGACY_PLUGIN_CACHE::savePin().

191 { return m_nameTextSize; }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
int LIB_PIN::GetNumberTextSize ( ) const
inline
int LIB_PIN::GetOrientation ( void  ) const
inline

Definition at line 220 of file lib_pin.h.

References m_orientation, Rotate(), and SetOrientation().

Referenced by LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::PlacePin(), LIB_EDIT_FRAME::RepeatPinItem(), Rotate(), SCH_LEGACY_PLUGIN_CACHE::savePin(), and LIB_EDIT_FRAME::StartMovePin().

220 { return m_orientation; }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
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 1893 of file lib_pin.cpp.

References PIN_ORIENTATION_CNT, pin_orientation_codes, and PIN_RIGHT.

Referenced by IsPowerConnection(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

1894 {
1895  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
1896  return pin_orientation_codes[ index ];
1897 
1898  return PIN_RIGHT;
1899 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:53
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:60
int LIB_PIN::GetOrientationCodeIndex ( 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 1902 of file lib_pin.cpp.

References i, PIN_ORIENTATION_CNT, and pin_orientation_codes.

Referenced by getMsgPanelInfoBase(), IsPowerConnection(), and LIB_EDIT_FRAME::OnEditPin().

1903 {
1904  size_t i;
1905 
1906  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
1907  {
1908  if( pin_orientation_codes[i] == code )
1909  return (int) i;
1910  }
1911 
1912  return wxNOT_FOUND;
1913 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:53
size_t i
Definition: json11.cpp:597
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:60
wxArrayString LIB_PIN::GetOrientationNames ( void  )
static

Get a list of pin orientation names.

Returns
List of valid pin orientation names.

Definition at line 1882 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

Referenced by IsPowerConnection(), and LIB_EDIT_FRAME::OnEditPin().

1883 {
1884  wxArrayString tmp;
1885 
1886  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
1887  tmp.Add( getPinOrientationName( ii ) );
1888 
1889  return tmp;
1890 }
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:108
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:60
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 1944 of file lib_pin.cpp.

References iconsPinsOrientations.

Referenced by IsPowerConnection(), and LIB_EDIT_FRAME::OnEditPin().

1945 {
1946  return iconsPinsOrientations;
1947 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:67
int LIB_PIN::GetPartNumber ( ) const
inline

Get the pin part number.

Definition at line 314 of file lib_pin.h.

References EnableEditMode(), LIB_ITEM::m_Unit, SetConversion(), and SetVisible().

314 { return m_Unit; }
int m_Unit
Unit identification for multiple parts per package.
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 564 of file lib_pin.cpp.

References GetDefaultLineThickness(), and m_width.

Referenced by DrawPinSymbol(), DrawPinTexts(), GetBoundingBox(), IsPowerConnection(), Plot(), PlotPinTexts(), and PlotSymbol().

565 {
566  return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
567 }
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:79
wxPoint LIB_PIN::GetPosition ( ) const
inlineoverridevirtual
wxString LIB_PIN::GetSelectMenuText ( ) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1956 of file lib_pin.cpp.

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

Referenced by GetWidth(), and Matches().

1957 {
1958  wxString tmp;
1959  wxString style;
1960 
1961  style = GetText( m_shape );
1962 
1963  tmp.Printf( _( "Pin %s, %s, %s" ),
1965 
1966  return tmp;
1967 }
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:274
wxString m_number
Definition: lib_pin.h:83
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
GRAPHIC_PINSHAPE LIB_PIN::GetShape ( ) const
inline

Definition at line 234 of file lib_pin.h.

References m_shape, and SetShape().

Referenced by LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::PlacePin(), and SCH_LEGACY_PLUGIN_CACHE::savePin().

234 { return m_shape; }
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 261 of file base_struct.h.

References EDA_ITEM::m_Status.

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

261 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:172
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 250 of file lib_pin.h.

References GetCanonicalElectricalTypeName(), and m_type.

Referenced by IsPowerConnection(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::PlacePin(), and SCH_LEGACY_PLUGIN_CACHE::savePin().

250 { return m_type; }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
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 118 of file lib_pin.h.

References GetMsgPanelInfo(), HitTest(), and Matches().

119  {
120  return _( "Pin" );
121  }
int LIB_PIN::GetWidth ( ) const
inlineoverridevirtual

Return the width of the draw item.

Returns
Width of draw object.

Implements LIB_ITEM.

Definition at line 481 of file lib_pin.h.

References Clone(), compare(), GetMenuImage(), getMsgPanelInfoBase(), GetSelectMenuText(), m_width, and SetWidth().

481 { return m_width; }
int m_width
Line width of the pin.
Definition: lib_pin.h:79
bool LIB_PIN::HitTest ( const wxPoint aPosition) const
overridevirtual

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

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

Reimplemented from LIB_ITEM.

Definition at line 540 of file lib_pin.cpp.

References DefaultTransform.

Referenced by GetTypeName().

541 {
542  return HitTest( aPosition, 0, DefaultTransform );
543 }
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
Definition: lib_pin.cpp:540
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
bool LIB_PIN::HitTest ( const wxPoint aPosition,
int  aThreshold,
const TRANSFORM aTransform 
) const
overridevirtual
Parameters
aPositionA wxPoint to test.
aThresholdMaximum distance to this object (usually the half thickness of a line) if < 0, it will be automatically set to half pen size when locating lines or arcs and set to 0 for other items.
aTransformThe transform matrix.
Returns
True if the point aPosition is near this object

Implements LIB_ITEM.

Definition at line 546 of file lib_pin.cpp.

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

547 {
548  if( aThreshold < 0 )
549  aThreshold = 0;
550 
551  TRANSFORM transform = DefaultTransform;
552  DefaultTransform = aTransform;
553 
554  EDA_RECT rect = GetBoundingBox();
555  rect.Inflate( aThreshold );
556 
557  //Restore matrix
558  DefaultTransform = transform;
559 
560  return rect.Contains( aPosition );
561 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:144
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool LIB_ITEM::InEditMode ( ) const
inlineinherited

Return the draw item editing mode status.

Returns
True if the item is being edited.

Definition at line 369 of file lib_draw_item.h.

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

Referenced by LIB_ITEM::Draw(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::EditGraphicSymbol(), LIB_EDIT_FRAME::EditSymbolText(), LIB_EDIT_FRAME::IsEditingDrawItem(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotateItem(), LIB_TEXT::Rotate(), LIB_FIELD::Rotate(), LIB_TEXT::SetText(), and LIB_FIELD::SetText().

369 { return ( m_Flags & ( IS_NEW | IS_DRAGGED | IS_MOVED | IS_RESIZED ) ) != 0; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:111
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:110
#define IS_MOVED
Item being moved.
Definition: base_struct.h:108
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 1579 of file lib_pin.cpp.

References EDA_RECT::Contains(), m_position, PinEndPoint(), wxPoint::x, and wxPoint::y.

Referenced by IsPowerConnection().

1580 {
1581  wxPoint end = PinEndPoint();
1582 
1583  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1584 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
wxPoint PinEndPoint() const
Definition: lib_pin.cpp:1471
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

References BRIGHTENED.

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

235 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
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 362 of file lib_draw_item.h.

References LIB_ITEM::m_isFillable.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

362 { return m_isFillable; }
bool m_isFillable
Flag to indicate if draw item is fillable.
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References HIGHLIGHTED.

234 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:132
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 228 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

228 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:105
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

References IS_NEW.

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

227 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 367 of file lib_pin.h.

References DrawPinElectricalTypeName(), DrawPinSymbol(), DrawPinTexts(), GetOrientationCode(), GetOrientationCodeIndex(), GetOrientationNames(), GetOrientationSymbols(), LIB_ITEM::GetParent(), GetPenSize(), GetType(), Inside(), IsVisible(), Move(), PIN_POWER_IN, PlotPinTexts(), PlotSymbol(), and SetOffset().

Referenced by LIB_PART::Draw().

367  {
368 
369  return (
370  ( !IsVisible() && GetType() == PIN_POWER_IN )
371  ||
372  ( (LIB_PART*)GetParent()->IsPower() && GetType() == PIN_POWER_IN )
373  ) ; }
LIB_PART * GetParent() const
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:250
Define a library symbol object.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:361
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 455 of file base_struct.h.

References EDA_ITEM::operator<().

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

455 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 233 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

233 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:110
bool EDA_ITEM::IsSelected ( ) const
inlineinherited
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 361 of file lib_pin.h.

References PIN_INVISIBLE.

Referenced by drawGraphic(), DrawPinElectricalTypeName(), GetBoundingBox(), getMsgPanelInfoBase(), IsPowerConnection(), LIB_EDIT_FRAME::OnEditPin(), Plot(), SCH_LEGACY_PLUGIN_CACHE::savePin(), and SetVisible().

361 { 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:81
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_WIRE_IMAGE.

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

231 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 131 of file base_struct.cpp.

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

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

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

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

Referenced by GetTypeName().

1971 {
1972  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
1973 
1974  // Note: this will have to be modified if we add find and replace capability to the
1975  // compoment library editor. Otherwise, you wont be able to replace pin text.
1976  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
1977  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
1978  return false;
1979 
1980  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
1981 
1982  if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
1983  {
1984  if( aFindLocation )
1985  *aFindLocation = GetBoundingBox().Centre();
1986 
1987  return true;
1988  }
1989 
1990  return false;
1991 }
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:411
Search texts (name and number (a 4 letters text) )in pins.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:144
const wxString & GetName() const
Definition: lib_pin.h:165
wxString m_number
Definition: lib_pin.h:83
wxPoint Centre() const
Definition: eda_rect.h:60
const wxChar *const traceFindItem
Flag to enable find debug tracing.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_pin.cpp:1956
Perform a search for a item that has replaceable text.
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 183 of file base_struct.cpp.

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

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

References m_orientation, m_position, PIN_LEFT, PIN_RIGHT, and wxPoint::x.

Referenced by GetPosition().

1598 {
1599  m_position.x -= center.x;
1600  m_position.x *= -1;
1601  m_position.x += center.x;
1602 
1603  if( m_orientation == PIN_RIGHT )
1605  else if( m_orientation == PIN_LEFT )
1607 }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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 1609 of file lib_pin.cpp.

References m_orientation, m_position, PIN_DOWN, PIN_UP, and wxPoint::y.

Referenced by GetPosition().

1610 {
1611  m_position.y -= center.y;
1612  m_position.y *= -1;
1613  m_position.y += center.y;
1614 
1615  if( m_orientation == PIN_UP )
1617  else if( m_orientation == PIN_DOWN )
1619 }
Definition: lib_pin.h:55
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
void LIB_PIN::Move ( const wxPoint aPosition)
overridevirtual

Move a draw object to aPosition.

Parameters
aPositionPosition to move draw item to.

Implements LIB_ITEM.

Definition at line 1587 of file lib_pin.cpp.

References m_position, and EDA_ITEM::SetModified().

Referenced by LIB_EDIT_FRAME::CreatePin(), DrawMovePin(), IsPowerConnection(), LIB_EDIT_FRAME::PlacePin(), and LIB_EDIT_FRAME::RepeatPinItem().

1588 {
1589  if( m_position != newPosition )
1590  {
1591  m_position = newPosition;
1592  SetModified();
1593  }
1594 }
void SetModified()
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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 94 of file lib_draw_item.cpp.

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

Referenced by LIB_ITEM::operator==().

95 {
96  int result = m_Convert - aOther.m_Convert;
97 
98  if( result != 0 )
99  return result < 0;
100 
101  result = m_Unit - aOther.m_Unit;
102 
103  if( result != 0 )
104  return result < 0;
105 
106  result = Type() - aOther.Type();
107 
108  if( result != 0 )
109  return result < 0;
110 
111  return ( compare( aOther ) < 0 );
112 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int m_Unit
Unit identification for multiple parts per package.
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.
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 240 of file base_struct.cpp.

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

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

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

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

Referenced by LIB_ITEM::GetBoundingBox().

86 {
87  return ( ( Type() == aOther.Type() )
88  && ( m_Unit == aOther.m_Unit )
89  && ( m_Convert == aOther.m_Convert )
90  && compare( aOther ) == 0 );
91 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int m_Unit
Unit identification for multiple parts per package.
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.
bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inlineinherited

Definition at line 260 of file lib_draw_item.h.

References LIB_ITEM::GetPosition(), LIB_ITEM::Inside(), LIB_ITEM::Move(), LIB_ITEM::operator<(), and LIB_ITEM::SetOffset().

261  {
262  return *this == *aOther;
263  }
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 1498 of file lib_pin.cpp.

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

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

1499 {
1500  int orient;
1501  wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
1502 
1503  switch( m_orientation )
1504  {
1505  case PIN_UP:
1506  end.y = 1;
1507  break;
1508 
1509  case PIN_DOWN:
1510  end.y = -1;
1511  break;
1512 
1513  case PIN_LEFT:
1514  end.x = -1;
1515  break;
1516 
1517  case PIN_RIGHT:
1518  end.x = 1;
1519  break;
1520  }
1521 
1522  // = pos of end point, according to the component orientation
1523  end = aTransform.TransformCoordinate( end );
1524  orient = PIN_UP;
1525 
1526  if( end.x == 0 )
1527  {
1528  if( end.y > 0 )
1529  orient = PIN_DOWN;
1530  }
1531  else
1532  {
1533  orient = PIN_RIGHT;
1534 
1535  if( end.x < 0 )
1536  orient = PIN_LEFT;
1537  }
1538 
1539  return orient;
1540 }
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:77
wxPoint LIB_PIN::PinEndPoint ( ) const
Returns
The pin end position for a component in the normal orientation.

Definition at line 1471 of file lib_pin.cpp.

References m_length, m_orientation, m_position, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, wxPoint::x, and wxPoint::y.

Referenced by GetBoundingBox(), and Inside().

1472 {
1473  wxPoint pos = m_position;
1474 
1475  switch( m_orientation )
1476  {
1477  case PIN_UP:
1478  pos.y += m_length;
1479  break;
1480 
1481  case PIN_DOWN:
1482  pos.y -= m_length;
1483  break;
1484 
1485  case PIN_LEFT:
1486  pos.x -= m_length;
1487  break;
1488 
1489  case PIN_RIGHT:
1490  pos.x += m_length;
1491  break;
1492  }
1493 
1494  return pos;
1495 }
Definition: lib_pin.h:55
int m_length
Length of the pin.
Definition: lib_pin.h:76
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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 1670 of file lib_pin.cpp.

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

Referenced by GetPosition().

1672 {
1673  if( ! IsVisible() )
1674  return;
1675 
1676  int orient = PinDrawOrient( aTransform );
1677 
1678  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
1679 
1680  PlotSymbol( plotter, pos, orient );
1681  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
1682  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
1683  GetPenSize() );
1684 }
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:1271
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:564
LIB_PART * GetParent() const
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:1120
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:361
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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:1498
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 1271 of file lib_pin.cpp.

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, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by IsPowerConnection(), and Plot().

1274 {
1275  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1276  DrawPinName = false;
1277 
1278  if( m_number.IsEmpty() )
1279  DrawPinNum = false;
1280 
1281  if( !DrawPinNum && !DrawPinName )
1282  return;
1283 
1284  int x, y;
1285  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1286  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1287 
1288  int nameLineWidth = GetPenSize();
1289  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1290  int numLineWidth = GetPenSize();
1291  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1292 
1293  int name_offset = PIN_TEXT_MARGIN +
1294  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1295  int num_offset = PIN_TEXT_MARGIN +
1296  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1297 
1298  /* Get the num and name colors */
1299  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1300  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1301 
1302  int x1 = pin_pos.x;
1303  int y1 = pin_pos.y;
1304 
1305  switch( orient )
1306  {
1307  case PIN_UP:
1308  y1 -= m_length;
1309  break;
1310 
1311  case PIN_DOWN:
1312  y1 += m_length;
1313  break;
1314 
1315  case PIN_LEFT:
1316  x1 -= m_length;
1317  break;
1318 
1319  case PIN_RIGHT:
1320  x1 += m_length;
1321  break;
1322  }
1323 
1324  /* Draw the text inside, but the pin numbers outside. */
1325  if( TextInside )
1326  {
1327  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1328  {
1329  if( DrawPinName )
1330  {
1331  if( orient == PIN_RIGHT )
1332  {
1333  x = x1 + TextInside;
1334  plotter->Text( wxPoint( x, y1 ), NameColor,
1335  m_name,
1337  PinNameSize,
1340  aWidth, false, false );
1341  }
1342  else // orient == PIN_LEFT
1343  {
1344  x = x1 - TextInside;
1345 
1346  if( DrawPinName )
1347  plotter->Text( wxPoint( x, y1 ),
1348  NameColor, m_name, TEXT_ANGLE_HORIZ,
1349  PinNameSize,
1352  aWidth, false, false );
1353  }
1354  }
1355  if( DrawPinNum )
1356  {
1357  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1358  y1 - num_offset ),
1359  NumColor, m_number,
1360  TEXT_ANGLE_HORIZ, PinNumSize,
1363  aWidth, false, false );
1364  }
1365  }
1366  else /* Its a vertical line. */
1367  {
1368  if( orient == PIN_DOWN )
1369  {
1370  y = y1 + TextInside;
1371 
1372  if( DrawPinName )
1373  plotter->Text( wxPoint( x1, y ), NameColor,
1374  m_name,
1375  TEXT_ANGLE_VERT, PinNameSize,
1378  aWidth, false, false );
1379 
1380  if( DrawPinNum )
1381  {
1382  plotter->Text( wxPoint( x1 - num_offset,
1383  (y1 + pin_pos.y) / 2 ),
1384  NumColor, m_number,
1385  TEXT_ANGLE_VERT, PinNumSize,
1388  aWidth, false, false );
1389  }
1390  }
1391  else /* PIN_UP */
1392  {
1393  y = y1 - TextInside;
1394 
1395  if( DrawPinName )
1396  plotter->Text( wxPoint( x1, y ), NameColor,
1397  m_name,
1398  TEXT_ANGLE_VERT, PinNameSize,
1401  aWidth, false, false );
1402 
1403  if( DrawPinNum )
1404  {
1405  plotter->Text( wxPoint( x1 - num_offset,
1406  (y1 + pin_pos.y) / 2 ),
1407  NumColor, m_number,
1408  TEXT_ANGLE_VERT, PinNumSize,
1411  aWidth, false, false );
1412  }
1413  }
1414  }
1415  }
1416  else /* Draw num & text pin outside */
1417  {
1418  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1419  {
1420  /* Its an horizontal line. */
1421  if( DrawPinName )
1422  {
1423  x = (x1 + pin_pos.x) / 2;
1424  plotter->Text( wxPoint( x, y1 - name_offset ),
1425  NameColor, m_name,
1426  TEXT_ANGLE_HORIZ, PinNameSize,
1429  aWidth, false, false );
1430  }
1431 
1432  if( DrawPinNum )
1433  {
1434  x = ( x1 + pin_pos.x ) / 2;
1435  plotter->Text( wxPoint( x, y1 + num_offset ),
1436  NumColor, m_number,
1437  TEXT_ANGLE_HORIZ, PinNumSize,
1440  aWidth, false, false );
1441  }
1442  }
1443  else /* Its a vertical line. */
1444  {
1445  if( DrawPinName )
1446  {
1447  y = ( y1 + pin_pos.y ) / 2;
1448  plotter->Text( wxPoint( x1 - name_offset, y ),
1449  NameColor, m_name,
1450  TEXT_ANGLE_VERT, PinNameSize,
1453  aWidth, false, false );
1454  }
1455 
1456  if( DrawPinNum )
1457  {
1458  plotter->Text( wxPoint( x1 + num_offset,
1459  ( y1 + pin_pos.y ) / 2 ),
1460  NumColor, m_number,
1461  TEXT_ANGLE_VERT, PinNumSize,
1464  aWidth, false, false );
1465  }
1466  }
1467  }
1468 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:85
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...
int m_numTextSize
Definition: lib_pin.h:84
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
wxString m_name
Definition: lib_pin.h:82
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:76
#define TEXT_ANGLE_VERT
Definition: common.h:92
int GetPenSize() const override
Definition: lib_pin.cpp:564
wxString m_number
Definition: lib_pin.h:83
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:63
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void LIB_PIN::PlotSymbol ( PLOTTER aPlotter,
const wxPoint aPosition,
int  aOrientation 
)

Definition at line 1120 of file lib_pin.cpp.

References PLOTTER::Circle(), color, ExternalPinDecoSize(), PLOTTER::FinishTo(), GetLayerColor(), GetPenSize(), InternalPinDecoSize(), LAYER_PIN, PLOTTER::LineTo(), m_length, m_shape, m_type, PLOTTER::MoveTo(), NCSYMB_PIN_DIM, 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(), wxPoint::x, and wxPoint::y.

Referenced by IsPowerConnection(), and Plot().

1121 {
1122  int MapX1, MapY1, x1, y1;
1124 
1125  aPlotter->SetColor( color );
1126  aPlotter->SetCurrentLineWidth( GetPenSize() );
1127 
1128  MapX1 = MapY1 = 0;
1129  x1 = aPosition.x; y1 = aPosition.y;
1130 
1131  switch( aOrientation )
1132  {
1133  case PIN_UP:
1134  y1 = aPosition.y - m_length;
1135  MapY1 = 1;
1136  break;
1137 
1138  case PIN_DOWN:
1139  y1 = aPosition.y + m_length;
1140  MapY1 = -1;
1141  break;
1142 
1143  case PIN_LEFT:
1144  x1 = aPosition.x - m_length;
1145  MapX1 = 1;
1146  break;
1147 
1148  case PIN_RIGHT:
1149  x1 = aPosition.x + m_length;
1150  MapX1 = -1;
1151  break;
1152  }
1153 
1155  {
1156  const int radius = ExternalPinDecoSize( *this );
1157  aPlotter->Circle( wxPoint( MapX1 * radius + x1,
1158  MapY1 * radius + y1 ),
1159  radius * 2, // diameter
1160  NO_FILL, // fill option
1161  GetPenSize() ); // width
1162 
1163  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1,
1164  MapY1 * radius * 2 + y1 ) );
1165  aPlotter->FinishTo( aPosition );
1166  }
1167  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
1168  {
1169  const int clock_size = InternalPinDecoSize( *this );
1170  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1171  {
1172  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1173  aPlotter->LineTo( wxPoint( x1 + MapX1 * clock_size * 2, y1 ) );
1174  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1175  }
1176  else /* MapX1 = 0 */
1177  {
1178  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1179  aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * clock_size * 2 ) );
1180  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1181  }
1182 
1183  aPlotter->MoveTo( wxPoint( MapX1 * clock_size * 2 + x1,
1184  MapY1 * clock_size * 2 + y1 ) );
1185  aPlotter->FinishTo( aPosition );
1186  }
1187  else
1188  {
1189  aPlotter->MoveTo( wxPoint( x1, y1 ) );
1190  aPlotter->FinishTo( aPosition );
1191  }
1192 
1195  {
1196  const int clock_size = InternalPinDecoSize( *this );
1197  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1198  {
1199  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1200  aPlotter->LineTo( wxPoint( x1 - MapX1 * clock_size * 2, y1 ) );
1201  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1202  }
1203  else /* MapX1 = 0 */
1204  {
1205  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1206  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * clock_size * 2 ) );
1207  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1208  }
1209  }
1210 
1211  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
1212  {
1213  const int symbol_size = ExternalPinDecoSize( *this );
1214 
1215  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1216  {
1217  aPlotter->MoveTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1218  aPlotter->LineTo( wxPoint( x1 + MapX1 * symbol_size * 2,
1219  y1 - symbol_size * 2 ) );
1220  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1221  }
1222  else /* MapX1 = 0 */
1223  {
1224  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1225  aPlotter->LineTo( wxPoint( x1 - symbol_size * 2,
1226  y1 + MapY1 * symbol_size * 2 ) );
1227  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1228  }
1229  }
1230 
1231 
1232  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1233  {
1234  const int symbol_size = ExternalPinDecoSize( *this );
1235 
1236  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1237  {
1238  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1239  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1240  }
1241  else /* MapX1 = 0 */
1242  {
1243  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1244  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1245  }
1246  }
1247  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1248  {
1249  const int symbol_size = ExternalPinDecoSize( *this );
1250  aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * symbol_size,
1251  y1 - (MapY1 - MapX1) * symbol_size ) );
1252  aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * symbol_size,
1253  y1 + (MapY1 - MapX1) * symbol_size ) );
1254  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * symbol_size,
1255  y1 - (MapY1 + MapX1) * symbol_size ) );
1256  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * symbol_size,
1257  y1 + (MapY1 + MapX1) * symbol_size ) );
1258  }
1259  if( m_type == PIN_NC ) // Draw a N.C. symbol
1260  {
1261  const int ex1 = aPosition.x;
1262  const int ey1 = aPosition.y;
1263  aPlotter->MoveTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1264  aPlotter->FinishTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1265  aPlotter->MoveTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1266  aPlotter->FinishTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1267  }
1268 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the &#39;external&#39; pin decorators (as a radius)
Definition: lib_pin.cpp:142
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:78
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:167
int m_length
Length of the pin.
Definition: lib_pin.h:76
int GetPenSize() const override
Definition: lib_pin.cpp:564
void LineTo(const wxPoint &pos)
Definition: plotter.h:245
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the &#39;internal&#39; pin decorators (as a radius)
Definition: lib_pin.cpp:133
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
#define NCSYMB_PIN_DIM
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:80
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
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 210 of file base_struct.cpp.

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

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

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

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

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

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

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 443 of file base_struct.h.

443 { return false; }
void LIB_PIN::Rotate ( )
overridevirtual

Rotate the draw item.

Reimplemented from LIB_ITEM.

Definition at line 1916 of file lib_pin.cpp.

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

Referenced by GetOrientation(), and GetPosition().

1917 {
1918  int orient = PIN_RIGHT;
1919 
1920  switch( GetOrientation() )
1921  {
1922  case PIN_UP:
1923  orient = PIN_LEFT;
1924  break;
1925 
1926  case PIN_DOWN:
1927  orient = PIN_RIGHT;
1928  break;
1929 
1930  case PIN_LEFT:
1931  orient = PIN_DOWN;
1932  break;
1933 
1934  case PIN_RIGHT:
1935  orient = PIN_UP;
1936  break;
1937  }
1938 
1939  // Set the new orientation
1940  SetOrientation( orient );
1941 }
Definition: lib_pin.h:55
int GetOrientation() const
Definition: lib_pin.h:220
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
Definition: lib_pin.cpp:269
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 1621 of file lib_pin.cpp.

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

1622 {
1623  int rot_angle = aRotateCCW ? -900 : 900;
1624 
1625  RotatePoint( &m_position, center, rot_angle );
1626 
1627  if( aRotateCCW )
1628  {
1629  switch( m_orientation )
1630  {
1631  case PIN_RIGHT:
1633  break;
1634 
1635  case PIN_UP:
1637  break;
1638  case PIN_LEFT:
1640  break;
1641 
1642  case PIN_DOWN:
1644  break;
1645  }
1646  }
1647  else
1648  {
1649  switch( m_orientation )
1650  {
1651  case PIN_RIGHT:
1653  break;
1654 
1655  case PIN_UP:
1657  break;
1658  case PIN_LEFT:
1660  break;
1661 
1662  case PIN_DOWN:
1664  break;
1665  }
1666  }
1667 }
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:77
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 223 of file base_struct.h.

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

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

Definition at line 240 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

240 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
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 450 of file lib_pin.cpp.

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 GetPartNumber(), and LIB_EDIT_FRAME::OnEditPin().

451 {
452  if( m_Convert == style )
453  return;
454 
455  m_Convert = style;
456  SetFlags( IS_CHANGED );
457 
458  if( style == 0 )
459  {
460  LIB_PIN* pin;
461  LIB_PIN* tmp = GetParent()->GetNextPin();
462 
463  while( tmp != NULL )
464  {
465  pin = tmp;
466  tmp = GetParent()->GetNextPin( pin );
467 
468  if( ( pin->m_Flags & IS_LINKED ) == 0
469  || ( pin == this )
470  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
471  || ( m_position != pin->m_position )
472  || ( pin->m_orientation != m_orientation ) )
473  continue;
474 
475  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
476  }
477  }
478 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:106
int m_Unit
Unit identification for multiple parts per package.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:66
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:105
LIB_PART * GetParent() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
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:75
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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.
void LIB_ITEM::SetConvert ( int  aConvert)
inlineinherited

Definition at line 379 of file lib_draw_item.h.

Referenced by LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::CreatePin(), LIB_EDIT_FRAME::EditGraphicSymbol(), and DIALOG_LIB_EDIT_TEXT::OnOkClick().

379 { m_Convert = aConvert; }
int m_Convert
Shape identification for alternate body styles.
void LIB_ITEM::SetFillMode ( FILL_T  aFillMode)
inlineinherited

Definition at line 383 of file lib_draw_item.h.

Referenced by LIB_EDIT_FRAME::CreateGraphicItem(), and LIB_EDIT_FRAME::EditGraphicSymbol().

383 { m_Fill = aFillMode; }
FILL_T m_Fill
The body fill type.
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 264 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), PCB_BASE_FRAME::AddModuleToBoard(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), LIB_EDIT_FRAME::copySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteItem(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), 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(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

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

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

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

Definition at line 239 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

239 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:132
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 363 of file lib_pin.cpp.

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_EDIT_FRAME::CreatePin(), GetElectricalTypeName(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

Definition at line 225 of file base_struct.h.

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

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

Definition at line 101 of file base_struct.cpp.

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

Referenced by SCH_COMPONENT::ClearAnnotation(), EDA_ITEM::ClearBrightened(), SCH_LINE::Move(), Move(), SCH_COMPONENT::Move(), 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().

102 {
103  SetFlags( IS_CHANGED );
104 
105  // If this a child object, then the parent modification state also needs to be set.
106  if( m_Parent )
108 }
void SetModified()
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:179
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:105
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
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 161 of file lib_pin.cpp.

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

Referenced by GetName(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and LIB_EDIT_FRAME::RepeatPinItem().

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

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

Referenced by LIB_EDIT_FRAME::CreatePin(), GetName(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

Definition at line 222 of file base_struct.h.

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

222 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:175
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 222 of file lib_pin.cpp.

References m_number, and EDA_ITEM::SetModified().

Referenced by LIB_EDIT_FRAME::CreateImagePins(), GetNumber(), SCH_EAGLE_PLUGIN::loadSymbol(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and LIB_EDIT_FRAME::RepeatPinItem().

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

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

Referenced by LIB_EDIT_FRAME::CreatePin(), GetNumber(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

References m_position.

Referenced by IsPowerConnection().

1574 {
1575  m_position += aOffset;
1576 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
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 269 of file lib_pin.cpp.

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

Referenced by LIB_EDIT_FRAME::CreatePin(), GetOrientation(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and Rotate().

270 {
271  if( m_orientation != orientation )
272  {
273  m_orientation = orientation;
274  SetModified();
275  }
276 
277  if( !aTestOtherPins )
278  return;
279 
280  if( GetParent() == NULL )
281  return;
282 
283  LIB_PINS pinList;
284  GetParent()->GetPins( pinList );
285 
286  for( size_t i = 0; i < pinList.size(); i++ )
287  {
288  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
289  pinList[i]->m_orientation == orientation )
290  continue;
291 
292  pinList[i]->m_orientation = orientation;
293  SetModified();
294  }
295 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:106
void SetModified()
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:77
LIB_PART * GetParent() const
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
size_t i
Definition: json11.cpp:597
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 224 of file base_struct.h.

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

224 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:179
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 420 of file lib_pin.cpp.

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 GetLength(), and LIB_EDIT_FRAME::OnEditPin().

421 {
422  if( m_Unit == part )
423  return;
424 
425  m_Unit = part;
426  SetModified();
427 
428  if( m_Unit == 0 )
429  {
430  LIB_PIN* pin;
431  LIB_PIN* tmp = GetParent()->GetNextPin();
432 
433  while( tmp != NULL )
434  {
435  pin = tmp;
436  tmp = GetParent()->GetNextPin( pin );
437 
438  if( pin->m_Flags == 0 || pin == this
439  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
440  || ( m_position != pin->m_position )
441  || ( pin->m_orientation != m_orientation ) )
442  continue;
443 
444  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
445  }
446  }
447 }
void SetModified()
int m_Unit
Unit identification for multiple parts per package.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:66
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:77
LIB_PART * GetParent() const
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:75
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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.
void LIB_PIN::SetPinPosition ( wxPoint  aPosition)

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

use SetPinPosition to set the position of this only

Parameters
aPositionis the new position of this and linked pins

Definition at line 393 of file lib_pin.cpp.

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 GetPosition(), and LIB_EDIT_FRAME::OnEditPin().

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

Definition at line 302 of file lib_draw_item.h.

References LIB_ITEM::MirrorHorizontal(), LIB_ITEM::MirrorVertical(), LIB_ITEM::Move(), and LIB_ITEM::Rotate().

302 { Move( aPosition ); }
virtual void Move(const wxPoint &aPosition)=0
Move a draw object to aPosition.
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 238 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

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

238 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:116
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
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 298 of file lib_pin.cpp.

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_EDIT_FRAME::CreatePin(), GetShape(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

Definition at line 214 of file base_struct.h.

Referenced by 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(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), DuplicateStruct(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), 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_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), TestDuplicateSheetNames(), and DIALOG_ERC::TestErc().

214 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:180
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 327 of file lib_pin.cpp.

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_EDIT_FRAME::CreatePin(), GetElectricalTypeName(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

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_EDIT_FRAME::CreatePin(), GetPartNumber(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

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

Set the width of the draw item to aWidth.

Implements LIB_ITEM.

Definition at line 1687 of file lib_pin.cpp.

References m_width, and EDA_ITEM::SetModified().

Referenced by GetWidth().

1688 {
1689  if( m_width != aWidth )
1690  {
1691  m_width = aWidth;
1692  SetModified();
1693  }
1694 }
void SetModified()
int m_width
Line width of the pin.
Definition: lib_pin.h:79
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 237 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

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

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

Referenced by PART_LIB::GetEntryTypePowerNames().

474 { return *aLeft < *aRight; }
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 209 of file base_struct.h.

References EDA_ITEM::m_StructType.

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

210  {
211  return m_StructType;
212  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:171
const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

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

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::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 266 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

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

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

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

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

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

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