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_Route(), 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(), 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 1547 of file lib_pin.cpp.

References LIB_PIN().

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

1548 {
1549  return new LIB_PIN( *this );
1550 }
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 1553 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().

1554 {
1555  wxASSERT( other.Type() == LIB_PIN_T );
1556 
1557  const LIB_PIN* tmp = (LIB_PIN*) &other;
1558 
1559  if( m_number != tmp->m_number )
1560  return m_number.Cmp( tmp->m_number );
1561 
1562  int result = m_name.CmpNoCase( tmp->m_name );
1563 
1564  if( result != 0 )
1565  return result;
1566 
1567  if( m_position.x != tmp->m_position.x )
1568  return m_position.x - tmp->m_position.x;
1569 
1570  if( m_position.y != tmp->m_position.y )
1571  return m_position.y - tmp->m_position.y;
1572 
1573  return 0;
1574 }
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, FRAME_SCH_LIB_EDITOR, 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  if( ! IsVisible() )
596  {
597  bool drawHidden = false;
598 
599  if( aPanel && aPanel->GetParent() )
600  {
601  EDA_DRAW_FRAME* frame = aPanel->GetParent();
602 
603  if( frame->IsType( FRAME_SCH ) )
604  drawHidden = dynamic_cast<SCH_EDIT_FRAME*>( frame )->GetShowAllPins();
605  else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) )
606  drawHidden = true; // must be able to edit
607  }
608 
609  if( !drawHidden )
610  {
611  if( drawPinDangling && drawDanglingHidden )
612  {
613  // Draw the target
614  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
615  /* aOnlyTarget */ true );
616  }
617  return;
618  }
619 
620  aColor = GetInvisibleItemColor();
621  }
622 
623  /* Drawing from the pin and the special symbol combination */
624  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
625 
626  if( drawPinText )
627  {
628  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
629  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
630  aColor, aDrawMode );
631  }
632 
633  if( drawElectricalTypeName )
634  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
635 
636 
637  /* Set to one (1) to draw bounding box around pin to validate bounding
638  * box calculation. */
639 #if 0
640  EDA_RECT bBox = GetBoundingBox();
641  bBox.RevertYAxis();
642  bBox = aTransform.TransformCoordinate( bBox );
643  bBox.Move( aOffset );
644  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
645 #endif
646 }
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:1062
int GetPinNameOffset()
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:63
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:848
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:649
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:1502
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 1062 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().

1065 {
1066  wxString etypeName = GetElectricalTypeName();
1067 
1068  // Use a reasonable (small) size to draw the text
1069  int etextSize = (m_nameTextSize*3)/4;
1070 
1071  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
1072  if( etextSize > ETXT_MAX_SIZE )
1073  etextSize = ETXT_MAX_SIZE;
1074 
1075  // Use a reasonable pen size to draw the text
1076  int pensize = etextSize/6;
1077 
1078  // Get a suitable color
1079  if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
1080  aColor = GetItemSelectedColor();
1081  else if( !IsVisible() )
1082  aColor = GetInvisibleItemColor();
1083  else
1084  aColor = GetLayerColor( LAYER_NOTES );
1085 
1086  wxPoint txtpos = aPosition;
1087  int offset = Millimeter2iu( 0.4 );
1089  int orient = TEXT_ANGLE_HORIZ;
1090 
1091  switch( aOrientation )
1092  {
1093  case PIN_UP:
1094  txtpos.y += offset;
1095  orient = TEXT_ANGLE_VERT;
1096  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1097  break;
1098 
1099  case PIN_DOWN:
1100  txtpos.y -= offset;
1101  orient = TEXT_ANGLE_VERT;
1102  break;
1103 
1104  case PIN_LEFT:
1105  txtpos.x += offset;
1106  break;
1107 
1108  case PIN_RIGHT:
1109  txtpos.x -= offset;
1110  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1111  break;
1112  }
1113 
1114  GRSetDrawMode( aDC, aDrawMode );
1115  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
1116 
1117  DrawGraphicText( clipbox, aDC, txtpos, aColor, etypeName,
1118  orient, wxSize( etextSize, etextSize ),
1119  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize,
1120  false, false );
1121 }
#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 649 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().

657 {
658  int MapX1, MapY1, x1, y1;
659  int width = GetPenSize();
660  int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
661  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
662 
664 
665  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
666  {
667  if( IsSelected() )
668  color = GetItemSelectedColor();
669  }
670  else
671  color = aColor;
672 
673  GRSetDrawMode( aDC, aDrawMode );
674 
675  MapX1 = MapY1 = 0;
676  x1 = posX;
677  y1 = posY;
678 
679  switch( aOrient )
680  {
681  case PIN_UP:
682  y1 = posY - len;
683  MapY1 = 1;
684  break;
685 
686  case PIN_DOWN:
687  y1 = posY + len;
688  MapY1 = -1;
689  break;
690 
691  case PIN_LEFT:
692  x1 = posX - len;
693  MapX1 = 1;
694  break;
695 
696  case PIN_RIGHT:
697  x1 = posX + len;
698  MapX1 = -1;
699  break;
700  }
701 
702  // Draw the pin end target (active end of the pin)
703  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
704  #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
705 
706  // Draw but do not print the pin end target 1 pixel width
707  if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
708  {
709  if( aDrawDangling )
710  GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
711  }
712 
713  if( aOnlyTarget )
714  return;
715 
716 
718  {
719  const int radius = ExternalPinDecoSize( *this );
720  GRCircle( clipbox, aDC, MapX1 * radius + x1,
721  MapY1 * radius + y1,
722  radius, width, color );
723 
724  GRMoveTo( MapX1 * radius * 2 + x1,
725  MapY1 * radius * 2 + y1 );
726  GRLineTo( clipbox, aDC, posX, posY, width, color );
727  }
728  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
729  {
730  const int clock_size = InternalPinDecoSize( *this );
731  if( MapY1 == 0 ) /* MapX1 = +- 1 */
732  {
733  GRMoveTo( x1, y1 + clock_size );
734  GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
735  width, color );
736  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
737  }
738  else /* MapX1 = 0 */
739  {
740  GRMoveTo( x1 + clock_size, y1 );
741  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
742  width, color );
743  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
744  width, color );
745  }
746  GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
747  GRLineTo( clipbox, aDC, posX, posY, width, color );
748  }
749  else
750  {
751  GRMoveTo( x1, y1 );
752  GRLineTo( clipbox, aDC, posX, posY, width, color );
753  }
754 
756  {
757  const int clock_size = InternalPinDecoSize( *this );
758  if( MapY1 == 0 ) /* MapX1 = +- 1 */
759  {
760  GRMoveTo( x1, y1 + clock_size );
761  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1,
762  width, color );
763  GRLineTo( clipbox, aDC, x1, y1 - clock_size,
764  width, color );
765  }
766  else /* MapX1 = 0 */
767  {
768  GRMoveTo( x1 + clock_size, y1 );
769  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2,
770  width, color );
771  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
772  width, color );
773  }
774  }
775 
777  {
778  const int symbol_size = ExternalPinDecoSize( *this );
779  if( MapY1 == 0 ) /* MapX1 = +- 1 */
780  {
781  GRMoveTo( x1 + MapX1 * symbol_size * 2, y1 );
782  GRLineTo( clipbox, aDC,
783  x1 + MapX1 * symbol_size * 2, y1 - symbol_size * 2,
784  width, color );
785  GRLineTo( clipbox, aDC, x1, y1, width, color );
786  }
787  else /* MapX1 = 0 */
788  {
789  GRMoveTo( x1, y1 + MapY1 * symbol_size * 2 );
790  GRLineTo( clipbox, aDC, x1 - symbol_size * 2,
791  y1 + MapY1 * symbol_size * 2, width, color );
792  GRLineTo( clipbox, aDC, x1, y1, width, color );
793  }
794  }
795 
796 
797  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
798  {
799  const int symbol_size = ExternalPinDecoSize( *this );
800  if( MapY1 == 0 ) /* MapX1 = +- 1 */
801  {
802  GRMoveTo( x1, y1 - symbol_size * 2 );
803  GRLineTo( clipbox,
804  aDC,
805  x1 + MapX1 * symbol_size * 2,
806  y1,
807  width,
808  color );
809  }
810  else /* MapX1 = 0 */
811  {
812  GRMoveTo( x1 - symbol_size * 2, y1 );
813  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * symbol_size * 2,
814  width, color );
815  }
816  }
817  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
818  {
819  const int symbol_size = ExternalPinDecoSize( *this );
820  GRMoveTo( x1 - (MapX1 + MapY1) * symbol_size,
821  y1 - (MapY1 - MapX1) * symbol_size );
822  GRLineTo( clipbox, aDC,
823  x1 + (MapX1 + MapY1) * symbol_size,
824  y1 + (MapY1 - MapX1) * symbol_size,
825  width, color );
826  GRMoveTo( x1 - (MapX1 - MapY1) * symbol_size,
827  y1 - (MapY1 + MapX1) * symbol_size );
828  GRLineTo( clipbox, aDC,
829  x1 + (MapX1 - MapY1) * symbol_size,
830  y1 + (MapY1 + MapX1) * symbol_size,
831  width, color );
832  }
833 
834  if( m_type == PIN_NC ) // Draw a N.C. symbol
835  {
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  GRLine( clipbox, aDC,
841  posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
842  posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
843  width, color );
844  }
845 }
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 848 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().

857 {
858  if( !DrawPinName && !DrawPinNum )
859  return;
860 
861  int x, y;
862 
863  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
864  wxSize PinNumSize( m_numTextSize, m_numTextSize );
865 
866  int nameLineWidth = GetPenSize();
867 
868  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
869  int numLineWidth = GetPenSize();
870  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
871 
872  int name_offset = PIN_TEXT_MARGIN +
873  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
874  int num_offset = PIN_TEXT_MARGIN +
875  ( numLineWidth + GetDefaultLineThickness() ) / 2;
876 
877  GRSetDrawMode( DC, DrawMode );
878  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
879 
880  /* Get the num and name colors */
881  if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
882  Color = GetItemSelectedColor();
883 
884  COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
885  GetLayerColor( LAYER_PINNAM ) : Color;
886  COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
887  GetLayerColor( LAYER_PINNUM ) : Color;
888 
889  int x1 = pin_pos.x;
890  int y1 = pin_pos.y;
891 
892  switch( orient )
893  {
894  case PIN_UP:
895  y1 -= m_length;
896  break;
897 
898  case PIN_DOWN:
899  y1 += m_length;
900  break;
901 
902  case PIN_LEFT:
903  x1 -= m_length;
904  break;
905 
906  case PIN_RIGHT:
907  x1 += m_length;
908  break;
909  }
910 
911  if( m_name.IsEmpty() )
912  DrawPinName = false;
913 
914  if( TextInside ) // Draw the text inside, but the pin numbers outside.
915  {
916  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
917  {
918  // It is an horizontal line
919  if( DrawPinName )
920  {
921  if( orient == PIN_RIGHT )
922  {
923  x = x1 + TextInside;
924  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
925  m_name,
927  PinNameSize,
929  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
930  false, false );
931  }
932  else // Orient == PIN_LEFT
933  {
934  x = x1 - TextInside;
935  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
936  m_name,
938  PinNameSize,
940  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
941  false, false );
942  }
943  }
944 
945  if( DrawPinNum )
946  {
947  DrawGraphicText( clipbox, DC,
948  wxPoint( (x1 + pin_pos.x) / 2,
949  y1 - num_offset ), NumColor,
950  m_number,
951  TEXT_ANGLE_HORIZ, PinNumSize,
953  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
954  false, false );
955  }
956  }
957  else /* Its a vertical line. */
958  {
959  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
960  if( orient == PIN_DOWN )
961  {
962  y = y1 + TextInside;
963 
964  if( DrawPinName )
965  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
966  m_name,
967  TEXT_ANGLE_VERT, PinNameSize,
969  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
970  false, false );
971 
972  if( DrawPinNum )
973  DrawGraphicText( clipbox, DC,
974  wxPoint( x1 - num_offset,
975  (y1 + pin_pos.y) / 2 ), NumColor,
976  m_number,
977  TEXT_ANGLE_VERT, PinNumSize,
979  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
980  false, false );
981  }
982  else /* PIN_UP */
983  {
984  y = y1 - TextInside;
985 
986  if( DrawPinName )
987  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
988  m_name,
989  TEXT_ANGLE_VERT, PinNameSize,
991  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
992  false, false );
993 
994  if( DrawPinNum )
995  DrawGraphicText( clipbox, DC,
996  wxPoint( x1 - num_offset,
997  (y1 + pin_pos.y) / 2 ), NumColor,
998  m_number,
999  TEXT_ANGLE_VERT, PinNumSize,
1001  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1002  false, false );
1003  }
1004  }
1005  }
1006  else /**** Draw num & text pin outside ****/
1007  {
1008  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1009  {
1010  /* Its an horizontal line. */
1011  if( DrawPinName )
1012  {
1013  x = (x1 + pin_pos.x) / 2;
1014  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ),
1015  NameColor, m_name,
1016  TEXT_ANGLE_HORIZ, PinNameSize,
1018  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1019  false, false );
1020  }
1021  if( DrawPinNum )
1022  {
1023  x = (x1 + pin_pos.x) / 2;
1024  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
1025  NumColor, m_number,
1026  TEXT_ANGLE_HORIZ, PinNumSize,
1028  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1029  false, false );
1030  }
1031  }
1032  else /* Its a vertical line. */
1033  {
1034  if( DrawPinName )
1035  {
1036  y = (y1 + pin_pos.y) / 2;
1037  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ),
1038  NameColor, m_name,
1039  TEXT_ANGLE_VERT, PinNameSize,
1041  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1042  false, false );
1043  }
1044 
1045  if( DrawPinNum )
1046  {
1047  DrawGraphicText( clipbox, DC,
1048  wxPoint( x1 + num_offset, (y1 + pin_pos.y)
1049  / 2 ),
1050  NumColor, m_number,
1051  TEXT_ANGLE_VERT, PinNumSize,
1053  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1054  false, false );
1055  }
1056  }
1057  }
1058 }
#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 1773 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.

1774 {
1775  LIB_PART* entry = (LIB_PART* ) m_Parent;
1776  EDA_RECT bbox;
1777  wxPoint begin;
1778  wxPoint end;
1779  int nameTextOffset = 0;
1780  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
1781  bool showNum = !m_number.IsEmpty();
1782  int minsizeV = TARGET_PIN_RADIUS;
1783 
1784  if( !aIncludeInvisibles && !IsVisible() )
1785  showName = false;
1786 
1787  if( entry )
1788  {
1789  if( entry->ShowPinNames() )
1790  nameTextOffset = entry->GetPinNameOffset();
1791  else
1792  showName = false;
1793 
1794  showNum = entry->ShowPinNumbers();
1795  }
1796 
1797  // First, calculate boundary box corners position
1798  int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
1799 
1800  // Actual text height is bigger than text size
1801  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
1802 
1804  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
1805 
1806  // calculate top left corner position
1807  // for the default pin orientation (PIN_RIGHT)
1808  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
1809  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
1810 
1811  // calculate bottom right corner position and adjust top left corner position
1812  int nameTextLength = 0;
1813  int nameTextHeight = 0;
1814 
1815  if( showName )
1816  {
1817  int length = m_name.Len();
1818 
1819  // Don't count the line over text symbol.
1820  if( m_name.Left( 1 ) == wxT( "~" ) )
1821  length -= 1;
1822 
1823  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
1824 
1825  // Actual text height are bigger than text size
1826  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
1827  }
1828 
1829  if( nameTextOffset ) // for values > 0, pin name is inside the body
1830  {
1831  end.x = m_length + nameTextLength;
1832  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
1833  }
1834  else // if value == 0:
1835  // pin name is outside the body, and above the pin line
1836  // pin num is below the pin line
1837  {
1838  end.x = std::max(m_length, nameTextLength);
1839  end.y = -begin.y;
1840  begin.y = std::max( minsizeV, nameTextHeight );
1841  }
1842 
1843  // Now, calculate boundary box corners position for the actual pin orientation
1844  int orient = PinDrawOrient( DefaultTransform );
1845 
1846  /* Calculate the pin position */
1847  switch( orient )
1848  {
1849  case PIN_UP:
1850  // Pin is rotated and texts positions are mirrored
1851  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
1852  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
1853  break;
1854 
1855  case PIN_DOWN:
1856  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
1857  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
1858  begin.x = -begin.x;
1859  end.x = -end.x;
1860  break;
1861 
1862  case PIN_LEFT:
1863  begin.x = -begin.x;
1864  end.x = -end.x;
1865  break;
1866 
1867  case PIN_RIGHT:
1868  break;
1869  }
1870 
1871  begin += m_position;
1872  end += m_position;
1873 
1874  bbox.SetOrigin( begin );
1875  bbox.SetEnd( end );
1876  bbox.Normalize();
1877  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
1878 
1879  // Draw Y axis is reversed in schematic:
1880  bbox.RevertYAxis();
1881 
1882  return bbox;
1883 }
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)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
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:1502
#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(), 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 1954 of file lib_pin.cpp.

References GetBitmap(), and m_type.

Referenced by GetWidth().

1955 {
1956  return GetBitmap( m_type );
1957 }
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 1734 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().

1735 {
1736  getMsgPanelInfoBase( aList );
1737 
1738  wxString text;
1739  wxPoint pinpos = GetPosition();
1740  pinpos.y = -pinpos.y; // Display coord are top to bottom
1741  // lib items coord are bottom to top
1742 
1743  text = StringFromValue( g_UserUnit, pinpos.x, true );
1744  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
1745 
1746  text = StringFromValue( g_UserUnit, pinpos.y, true );
1747  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
1748 }
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:1701
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 1750 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.

1752 {
1753  getMsgPanelInfoBase( aList );
1754 
1755  if( !aComponent )
1756  return;
1757 
1758  wxString text;
1759  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
1760  + aComponent->GetPosition();
1761 
1762  text = StringFromValue( g_UserUnit, pinpos.x, true );
1763  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
1764 
1765  text = StringFromValue( g_UserUnit, pinpos.y, true );
1766  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
1767 
1768  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
1769  aComponent->GetField( VALUE )->GetShownText(),
1770  DARKCYAN ) );
1771 }
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:1701
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 1701 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().

1702 {
1703  wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
1704 
1705  LIB_ITEM::GetMsgPanelInfo( aList );
1706 
1707  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
1708 
1709  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
1710 
1711  aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
1712  GetText( m_type ),
1713  RED ) );
1714 
1715  text = GetText( m_shape );
1716 
1717  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
1718 
1719  if( IsVisible() )
1720  text = _( "Yes" );
1721  else
1722  text = _( "No" );
1723 
1724  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
1725 
1726  // Display pin length
1727  text = StringFromValue( g_UserUnit, m_length, true );
1728  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
1729 
1731  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
1732 }
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:1906
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 1897 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().

1898 {
1899  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
1900  return pin_orientation_codes[ index ];
1901 
1902  return PIN_RIGHT;
1903 }
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 1906 of file lib_pin.cpp.

References i, PIN_ORIENTATION_CNT, and pin_orientation_codes.

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

1907 {
1908  size_t i;
1909 
1910  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
1911  {
1912  if( pin_orientation_codes[i] == code )
1913  return (int) i;
1914  }
1915 
1916  return wxNOT_FOUND;
1917 }
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 1886 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

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

1887 {
1888  wxArrayString tmp;
1889 
1890  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
1891  tmp.Add( getPinOrientationName( ii ) );
1892 
1893  return tmp;
1894 }
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 1948 of file lib_pin.cpp.

References iconsPinsOrientations.

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

1949 {
1950  return iconsPinsOrientations;
1951 }
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 1960 of file lib_pin.cpp.

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

Referenced by GetWidth(), and Matches().

1961 {
1962  wxString tmp;
1963  wxString style;
1964 
1965  style = GetText( m_shape );
1966 
1967  tmp.Printf( _( "Pin %s, %s, %s" ),
1969 
1970  return tmp;
1971 }
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 1583 of file lib_pin.cpp.

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

Referenced by IsPowerConnection().

1584 {
1585  wxPoint end = PinEndPoint();
1586 
1587  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1588 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:75
wxPoint PinEndPoint() const
Definition: lib_pin.cpp:1475
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(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), 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 1974 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().

1975 {
1976  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
1977 
1978  // Note: this will have to be modified if we add find and replace capability to the
1979  // compoment library editor. Otherwise, you wont be able to replace pin text.
1980  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
1981  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
1982  return false;
1983 
1984  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
1985 
1986  if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
1987  {
1988  if( aFindLocation )
1989  *aFindLocation = GetBoundingBox().Centre();
1990 
1991  return true;
1992  }
1993 
1994  return false;
1995 }
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:1960
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 1601 of file lib_pin.cpp.

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

Referenced by GetPosition().

1602 {
1603  m_position.x -= center.x;
1604  m_position.x *= -1;
1605  m_position.x += center.x;
1606 
1607  if( m_orientation == PIN_RIGHT )
1609  else if( m_orientation == PIN_LEFT )
1611 }
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 1613 of file lib_pin.cpp.

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

Referenced by GetPosition().

1614 {
1615  m_position.y -= center.y;
1616  m_position.y *= -1;
1617  m_position.y += center.y;
1618 
1619  if( m_orientation == PIN_UP )
1621  else if( m_orientation == PIN_DOWN )
1623 }
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 1591 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().

1592 {
1593  if( m_position != newPosition )
1594  {
1595  m_position = newPosition;
1596  SetModified();
1597  }
1598 }
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 1502 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().

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

1476 {
1477  wxPoint pos = m_position;
1478 
1479  switch( m_orientation )
1480  {
1481  case PIN_UP:
1482  pos.y += m_length;
1483  break;
1484 
1485  case PIN_DOWN:
1486  pos.y -= m_length;
1487  break;
1488 
1489  case PIN_LEFT:
1490  pos.x -= m_length;
1491  break;
1492 
1493  case PIN_RIGHT:
1494  pos.x += m_length;
1495  break;
1496  }
1497 
1498  return pos;
1499 }
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 1674 of file lib_pin.cpp.

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

Referenced by GetPosition().

1676 {
1677  if( ! IsVisible() )
1678  return;
1679 
1680  int orient = PinDrawOrient( aTransform );
1681 
1682  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
1683 
1684  PlotSymbol( plotter, pos, orient );
1685  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
1686  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
1687  GetPenSize() );
1688 }
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:1275
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:1124
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:1502
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 1275 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().

1278 {
1279  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1280  DrawPinName = false;
1281 
1282  if( m_number.IsEmpty() )
1283  DrawPinNum = false;
1284 
1285  if( !DrawPinNum && !DrawPinName )
1286  return;
1287 
1288  int x, y;
1289  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1290  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1291 
1292  int nameLineWidth = GetPenSize();
1293  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1294  int numLineWidth = GetPenSize();
1295  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1296 
1297  int name_offset = PIN_TEXT_MARGIN +
1298  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1299  int num_offset = PIN_TEXT_MARGIN +
1300  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1301 
1302  /* Get the num and name colors */
1303  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1304  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1305 
1306  int x1 = pin_pos.x;
1307  int y1 = pin_pos.y;
1308 
1309  switch( orient )
1310  {
1311  case PIN_UP:
1312  y1 -= m_length;
1313  break;
1314 
1315  case PIN_DOWN:
1316  y1 += m_length;
1317  break;
1318 
1319  case PIN_LEFT:
1320  x1 -= m_length;
1321  break;
1322 
1323  case PIN_RIGHT:
1324  x1 += m_length;
1325  break;
1326  }
1327 
1328  /* Draw the text inside, but the pin numbers outside. */
1329  if( TextInside )
1330  {
1331  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1332  {
1333  if( DrawPinName )
1334  {
1335  if( orient == PIN_RIGHT )
1336  {
1337  x = x1 + TextInside;
1338  plotter->Text( wxPoint( x, y1 ), NameColor,
1339  m_name,
1341  PinNameSize,
1344  aWidth, false, false );
1345  }
1346  else // orient == PIN_LEFT
1347  {
1348  x = x1 - TextInside;
1349 
1350  if( DrawPinName )
1351  plotter->Text( wxPoint( x, y1 ),
1352  NameColor, m_name, TEXT_ANGLE_HORIZ,
1353  PinNameSize,
1356  aWidth, false, false );
1357  }
1358  }
1359  if( DrawPinNum )
1360  {
1361  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1362  y1 - num_offset ),
1363  NumColor, m_number,
1364  TEXT_ANGLE_HORIZ, PinNumSize,
1367  aWidth, false, false );
1368  }
1369  }
1370  else /* Its a vertical line. */
1371  {
1372  if( orient == PIN_DOWN )
1373  {
1374  y = y1 + TextInside;
1375 
1376  if( DrawPinName )
1377  plotter->Text( wxPoint( x1, y ), NameColor,
1378  m_name,
1379  TEXT_ANGLE_VERT, PinNameSize,
1382  aWidth, false, false );
1383 
1384  if( DrawPinNum )
1385  {
1386  plotter->Text( wxPoint( x1 - num_offset,
1387  (y1 + pin_pos.y) / 2 ),
1388  NumColor, m_number,
1389  TEXT_ANGLE_VERT, PinNumSize,
1392  aWidth, false, false );
1393  }
1394  }
1395  else /* PIN_UP */
1396  {
1397  y = y1 - TextInside;
1398 
1399  if( DrawPinName )
1400  plotter->Text( wxPoint( x1, y ), NameColor,
1401  m_name,
1402  TEXT_ANGLE_VERT, PinNameSize,
1405  aWidth, false, false );
1406 
1407  if( DrawPinNum )
1408  {
1409  plotter->Text( wxPoint( x1 - num_offset,
1410  (y1 + pin_pos.y) / 2 ),
1411  NumColor, m_number,
1412  TEXT_ANGLE_VERT, PinNumSize,
1415  aWidth, false, false );
1416  }
1417  }
1418  }
1419  }
1420  else /* Draw num & text pin outside */
1421  {
1422  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1423  {
1424  /* Its an horizontal line. */
1425  if( DrawPinName )
1426  {
1427  x = (x1 + pin_pos.x) / 2;
1428  plotter->Text( wxPoint( x, y1 - name_offset ),
1429  NameColor, m_name,
1430  TEXT_ANGLE_HORIZ, PinNameSize,
1433  aWidth, false, false );
1434  }
1435 
1436  if( DrawPinNum )
1437  {
1438  x = ( x1 + pin_pos.x ) / 2;
1439  plotter->Text( wxPoint( x, y1 + num_offset ),
1440  NumColor, m_number,
1441  TEXT_ANGLE_HORIZ, PinNumSize,
1444  aWidth, false, false );
1445  }
1446  }
1447  else /* Its a vertical line. */
1448  {
1449  if( DrawPinName )
1450  {
1451  y = ( y1 + pin_pos.y ) / 2;
1452  plotter->Text( wxPoint( x1 - name_offset, y ),
1453  NameColor, m_name,
1454  TEXT_ANGLE_VERT, PinNameSize,
1457  aWidth, false, false );
1458  }
1459 
1460  if( DrawPinNum )
1461  {
1462  plotter->Text( wxPoint( x1 + num_offset,
1463  ( y1 + pin_pos.y ) / 2 ),
1464  NumColor, m_number,
1465  TEXT_ANGLE_VERT, PinNumSize,
1468  aWidth, false, false );
1469  }
1470  }
1471  }
1472 }
#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 1124 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().

1125 {
1126  int MapX1, MapY1, x1, y1;
1128 
1129  aPlotter->SetColor( color );
1130  aPlotter->SetCurrentLineWidth( GetPenSize() );
1131 
1132  MapX1 = MapY1 = 0;
1133  x1 = aPosition.x; y1 = aPosition.y;
1134 
1135  switch( aOrientation )
1136  {
1137  case PIN_UP:
1138  y1 = aPosition.y - m_length;
1139  MapY1 = 1;
1140  break;
1141 
1142  case PIN_DOWN:
1143  y1 = aPosition.y + m_length;
1144  MapY1 = -1;
1145  break;
1146 
1147  case PIN_LEFT:
1148  x1 = aPosition.x - m_length;
1149  MapX1 = 1;
1150  break;
1151 
1152  case PIN_RIGHT:
1153  x1 = aPosition.x + m_length;
1154  MapX1 = -1;
1155  break;
1156  }
1157 
1159  {
1160  const int radius = ExternalPinDecoSize( *this );
1161  aPlotter->Circle( wxPoint( MapX1 * radius + x1,
1162  MapY1 * radius + y1 ),
1163  radius * 2, // diameter
1164  NO_FILL, // fill option
1165  GetPenSize() ); // width
1166 
1167  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1,
1168  MapY1 * radius * 2 + y1 ) );
1169  aPlotter->FinishTo( aPosition );
1170  }
1171  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
1172  {
1173  const int clock_size = InternalPinDecoSize( *this );
1174  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1175  {
1176  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1177  aPlotter->LineTo( wxPoint( x1 + MapX1 * clock_size * 2, y1 ) );
1178  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1179  }
1180  else /* MapX1 = 0 */
1181  {
1182  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1183  aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * clock_size * 2 ) );
1184  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1185  }
1186 
1187  aPlotter->MoveTo( wxPoint( MapX1 * clock_size * 2 + x1,
1188  MapY1 * clock_size * 2 + y1 ) );
1189  aPlotter->FinishTo( aPosition );
1190  }
1191  else
1192  {
1193  aPlotter->MoveTo( wxPoint( x1, y1 ) );
1194  aPlotter->FinishTo( aPosition );
1195  }
1196 
1199  {
1200  const int clock_size = InternalPinDecoSize( *this );
1201  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1202  {
1203  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1204  aPlotter->LineTo( wxPoint( x1 - MapX1 * clock_size * 2, y1 ) );
1205  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1206  }
1207  else /* MapX1 = 0 */
1208  {
1209  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1210  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * clock_size * 2 ) );
1211  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1212  }
1213  }
1214 
1215  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
1216  {
1217  const int symbol_size = ExternalPinDecoSize( *this );
1218 
1219  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1220  {
1221  aPlotter->MoveTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1222  aPlotter->LineTo( wxPoint( x1 + MapX1 * symbol_size * 2,
1223  y1 - symbol_size * 2 ) );
1224  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1225  }
1226  else /* MapX1 = 0 */
1227  {
1228  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1229  aPlotter->LineTo( wxPoint( x1 - symbol_size * 2,
1230  y1 + MapY1 * symbol_size * 2 ) );
1231  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1232  }
1233  }
1234 
1235 
1236  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1237  {
1238  const int symbol_size = ExternalPinDecoSize( *this );
1239 
1240  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1241  {
1242  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1243  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1244  }
1245  else /* MapX1 = 0 */
1246  {
1247  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1248  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1249  }
1250  }
1251  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1252  {
1253  const int symbol_size = ExternalPinDecoSize( *this );
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  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * symbol_size,
1259  y1 - (MapY1 + MapX1) * symbol_size ) );
1260  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * symbol_size,
1261  y1 + (MapY1 + MapX1) * symbol_size ) );
1262  }
1263  if( m_type == PIN_NC ) // Draw a N.C. symbol
1264  {
1265  const int ex1 = aPosition.x;
1266  const int ey1 = aPosition.y;
1267  aPlotter->MoveTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1268  aPlotter->FinishTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1269  aPlotter->MoveTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1270  aPlotter->FinishTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1271  }
1272 }
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 1920 of file lib_pin.cpp.

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

Referenced by GetOrientation(), and GetPosition().

1921 {
1922  int orient = PIN_RIGHT;
1923 
1924  switch( GetOrientation() )
1925  {
1926  case PIN_UP:
1927  orient = PIN_LEFT;
1928  break;
1929 
1930  case PIN_DOWN:
1931  orient = PIN_RIGHT;
1932  break;
1933 
1934  case PIN_LEFT:
1935  orient = PIN_DOWN;
1936  break;
1937 
1938  case PIN_RIGHT:
1939  orient = PIN_UP;
1940  break;
1941  }
1942 
1943  // Set the new orientation
1944  SetOrientation( orient );
1945 }
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 1625 of file lib_pin.cpp.

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

1626 {
1627  int rot_angle = aRotateCCW ? -900 : 900;
1628 
1629  RotatePoint( &m_position, center, rot_angle );
1630 
1631  if( aRotateCCW )
1632  {
1633  switch( m_orientation )
1634  {
1635  case PIN_RIGHT:
1637  break;
1638 
1639  case PIN_UP:
1641  break;
1642  case PIN_LEFT:
1644  break;
1645 
1646  case PIN_DOWN:
1648  break;
1649  }
1650  }
1651  else
1652  {
1653  switch( m_orientation )
1654  {
1655  case PIN_RIGHT:
1657  break;
1658 
1659  case PIN_UP:
1661  break;
1662  case PIN_LEFT:
1664  break;
1665 
1666  case PIN_DOWN:
1668  break;
1669  }
1670  }
1671 }
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 1577 of file lib_pin.cpp.

References m_position.

Referenced by IsPowerConnection().

1578 {
1579  m_position += aOffset;
1580 }
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::loadPolygon(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_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 1691 of file lib_pin.cpp.

References m_width, and EDA_ITEM::SetModified().

Referenced by GetWidth().

1692 {
1693  if( m_width != aWidth )
1694  {
1695  m_width = aWidth;
1696  SetModified();
1697  }
1698 }
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::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(), CN_VISITOR::checkZoneItemConnection(), 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(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), 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(), 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(), 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, TRACK, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, KIGFX::WORKSHEET_VIEWITEM, MARKER_PCB, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 266 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

Referenced by 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,