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

146  :
147  LIB_ITEM( LIB_PIN_T, aParent ),
149 {
151  m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
152  m_type = PIN_UNSPECIFIED; // electrical type of pin
153  m_attributes = 0; // bit 0 != 0: pin invisible
156  m_width = 0;
157 }
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 236 of file base_struct.h.

References EDA_ITEM::Pback.

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

236 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:194
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 262 of file base_struct.h.

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

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

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

Definition at line 283 of file base_struct.h.

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

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

Definition at line 261 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

261 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:283
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 1542 of file lib_pin.cpp.

References LIB_PIN().

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

1543 {
1544  return new LIB_PIN( *this );
1545 }
LIB_PIN(LIB_PART *aParent)
Definition: lib_pin.cpp:146
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 1548 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().

1549 {
1550  wxASSERT( other.Type() == LIB_PIN_T );
1551 
1552  const LIB_PIN* tmp = (LIB_PIN*) &other;
1553 
1554  if( m_number != tmp->m_number )
1555  return m_number.Cmp( tmp->m_number );
1556 
1557  int result = m_name.CmpNoCase( tmp->m_name );
1558 
1559  if( result != 0 )
1560  return result;
1561 
1562  if( m_position.x != tmp->m_position.x )
1563  return m_position.x - tmp->m_position.x;
1564 
1565  if( m_position.y != tmp->m_position.y )
1566  return m_position.y - tmp->m_position.y;
1567 
1568  return 0;
1569 }
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:70
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 569 of file lib_pin.cpp.

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

576 {
577  // aData is used here as a bitfield of flags.
578  uintptr_t flags = (uintptr_t) aData;
579  bool drawPinText = flags & PIN_DRAW_TEXTS;
580  bool drawPinDangling = flags & PIN_DRAW_DANGLING;
581  bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
582  bool drawElectricalTypeName = flags & PIN_DRAW_ELECTRICAL_TYPE_NAME;
583 
584  LIB_PART* Entry = GetParent();
585 
586  /* Calculate pin orient taking in account the component orientation. */
587  int orient = PinDrawOrient( aTransform );
588 
589  /* Calculate the pin position */
590  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
591 
592  // Invisible pins are only drawn on request.
593  // They are drawn in GetInvisibleItemColor().
594  // in schematic, they are drawn only if m_showAllPins is true.
595  // In other windows, they are always drawn because we must see them.
596  if( ! IsVisible() )
597  {
598  EDA_DRAW_FRAME* frame = NULL;
599 
600  if( aPanel && aPanel->GetParent() )
601  frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
602 
603  if( frame && frame->IsType( FRAME_SCH ) &&
604  ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
605  {
606  if( drawPinDangling && drawDanglingHidden )
607  {
608  // Draw the target
609  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
610  /* aOnlyTarget */ true );
611  }
612  return;
613  }
614 
615  aColor = GetInvisibleItemColor();
616  }
617 
618  /* Drawing from the pin and the special symbol combination */
619  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
620 
621  if( drawPinText )
622  {
623  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
624  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
625  aColor, aDrawMode );
626  }
627 
628  if( drawElectricalTypeName )
629  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
630 
631 
632  /* Set to one (1) to draw bounding box around pin to validate bounding
633  * box calculation. */
634 #if 0
635  EDA_RECT bBox = GetBoundingBox();
636  bBox.RevertYAxis();
637  bBox = aTransform.TransformCoordinate( bBox );
638  bBox.Move( aOffset );
639  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
640 #endif
641 }
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:1057
int GetPinNameOffset()
Schematic editor (Eeschema) main window.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:144
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
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:181
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:843
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:644
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:1497
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 1057 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().

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

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

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

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

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

514 {
515  LIB_PINS pinList;
516 
517  if( GetParent() == NULL )
518  return;
519 
520  GetParent()->GetPins( pinList );
521 
522  for( size_t i = 0; i < pinList.size(); i++ )
523  {
524  if( pinList[i] == this )
525  continue;
526 
527  if( ( pinList[i]->m_position == m_position )
528  && ( pinList[i]->m_orientation == m_orientation )
529  && !IsNew() && !aEditPinByPin && aEnable )
530  {
531  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
532  }
533  else
534  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
535  }
536 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:125
bool IsNew() const
Definition: base_struct.h:245
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
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:204
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 1768 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.

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

References PINTYPE_COUNT.

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

References EDA_ITEM::m_Flags.

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

284 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:204
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 1949 of file lib_pin.cpp.

References GetBitmap(), and m_type.

Referenced by GetWidth().

1950 {
1951  return GetBitmap( m_type );
1952 }
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 1729 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().

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

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

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

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

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

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

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

Get a list of pin orientation names.

Returns
List of valid pin orientation names.

Definition at line 1881 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

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

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

References iconsPinsOrientations.

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

1944 {
1945  return iconsPinsOrientations;
1946 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:66
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 563 of file lib_pin.cpp.

References GetDefaultLineThickness(), and m_width.

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

564 {
565  return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
566 }
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 1955 of file lib_pin.cpp.

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

Referenced by GetWidth(), and Matches().

1956 {
1957  wxString tmp;
1958  wxString style;
1959 
1960  style = GetText( m_shape );
1961 
1962  tmp.Printf( _( "Pin %s, %s, %s" ),
1964 
1965  return tmp;
1966 }
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 279 of file base_struct.h.

References EDA_ITEM::m_Status.

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

279 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:190
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 539 of file lib_pin.cpp.

References DefaultTransform.

Referenced by GetTypeName().

540 {
541  return HitTest( aPosition, 0, DefaultTransform );
542 }
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:539
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 545 of file lib_pin.cpp.

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

546 {
547  if( aThreshold < 0 )
548  aThreshold = 0;
549 
550  TRANSFORM transform = DefaultTransform;
551  DefaultTransform = aTransform;
552 
553  EDA_RECT rect = GetBoundingBox();
554  rect.Inflate( aThreshold );
555 
556  //Restore matrix
557  DefaultTransform = transform;
558 
559  return rect.Contains( aPosition );
560 }
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:127
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:129
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:204
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:128
#define IS_MOVED
Item being moved.
Definition: base_struct.h:126
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 1578 of file lib_pin.cpp.

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

Referenced by IsPowerConnection().

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

Definition at line 253 of file base_struct.h.

References BRIGHTENED.

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

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

References HIGHLIGHTED.

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

Definition at line 246 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

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

Definition at line 245 of file base_struct.h.

References IS_NEW.

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

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

References EDA_ITEM::operator<().

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

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

Definition at line 251 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

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

References IS_WIRE_IMAGE.

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

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

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

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

Definition at line 132 of file base_struct.cpp.

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

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

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

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

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

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

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

Referenced by GetPosition().

1597 {
1598  m_position.x -= center.x;
1599  m_position.x *= -1;
1600  m_position.x += center.x;
1601 
1602  if( m_orientation == PIN_RIGHT )
1604  else if( m_orientation == PIN_LEFT )
1606 }
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 1608 of file lib_pin.cpp.

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

Referenced by GetPosition().

1609 {
1610  m_position.y -= center.y;
1611  m_position.y *= -1;
1612  m_position.y += center.y;
1613 
1614  if( m_orientation == PIN_UP )
1616  else if( m_orientation == PIN_DOWN )
1618 }
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 1586 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().

1587 {
1588  if( m_position != newPosition )
1589  {
1590  m_position = newPosition;
1591  SetModified();
1592  }
1593 }
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:227
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 241 of file base_struct.cpp.

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

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

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

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

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

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

Referenced by GetPosition().

1671 {
1672  if( ! IsVisible() )
1673  return;
1674 
1675  int orient = PinDrawOrient( aTransform );
1676 
1677  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
1678 
1679  PlotSymbol( plotter, pos, orient );
1680  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
1681  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
1682  GetPenSize() );
1683 }
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:1270
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:563
LIB_PART * GetParent() const
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:1119
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:1497
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 1270 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().

1273 {
1274  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1275  DrawPinName = false;
1276 
1277  if( m_number.IsEmpty() )
1278  DrawPinNum = false;
1279 
1280  if( !DrawPinNum && !DrawPinName )
1281  return;
1282 
1283  int x, y;
1284  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1285  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1286 
1287  int nameLineWidth = GetPenSize();
1288  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1289  int numLineWidth = GetPenSize();
1290  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1291 
1292  int name_offset = PIN_TEXT_MARGIN +
1293  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1294  int num_offset = PIN_TEXT_MARGIN +
1295  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1296 
1297  /* Get the num and name colors */
1298  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1299  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1300 
1301  int x1 = pin_pos.x;
1302  int y1 = pin_pos.y;
1303 
1304  switch( orient )
1305  {
1306  case PIN_UP:
1307  y1 -= m_length;
1308  break;
1309 
1310  case PIN_DOWN:
1311  y1 += m_length;
1312  break;
1313 
1314  case PIN_LEFT:
1315  x1 -= m_length;
1316  break;
1317 
1318  case PIN_RIGHT:
1319  x1 += m_length;
1320  break;
1321  }
1322 
1323  /* Draw the text inside, but the pin numbers outside. */
1324  if( TextInside )
1325  {
1326  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1327  {
1328  if( DrawPinName )
1329  {
1330  if( orient == PIN_RIGHT )
1331  {
1332  x = x1 + TextInside;
1333  plotter->Text( wxPoint( x, y1 ), NameColor,
1334  m_name,
1336  PinNameSize,
1339  aWidth, false, false );
1340  }
1341  else // orient == PIN_LEFT
1342  {
1343  x = x1 - TextInside;
1344 
1345  if( DrawPinName )
1346  plotter->Text( wxPoint( x, y1 ),
1347  NameColor, m_name, TEXT_ANGLE_HORIZ,
1348  PinNameSize,
1351  aWidth, false, false );
1352  }
1353  }
1354  if( DrawPinNum )
1355  {
1356  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1357  y1 - num_offset ),
1358  NumColor, m_number,
1359  TEXT_ANGLE_HORIZ, PinNumSize,
1362  aWidth, false, false );
1363  }
1364  }
1365  else /* Its a vertical line. */
1366  {
1367  if( orient == PIN_DOWN )
1368  {
1369  y = y1 + TextInside;
1370 
1371  if( DrawPinName )
1372  plotter->Text( wxPoint( x1, y ), NameColor,
1373  m_name,
1374  TEXT_ANGLE_VERT, PinNameSize,
1377  aWidth, false, false );
1378 
1379  if( DrawPinNum )
1380  {
1381  plotter->Text( wxPoint( x1 - num_offset,
1382  (y1 + pin_pos.y) / 2 ),
1383  NumColor, m_number,
1384  TEXT_ANGLE_VERT, PinNumSize,
1387  aWidth, false, false );
1388  }
1389  }
1390  else /* PIN_UP */
1391  {
1392  y = y1 - TextInside;
1393 
1394  if( DrawPinName )
1395  plotter->Text( wxPoint( x1, y ), NameColor,
1396  m_name,
1397  TEXT_ANGLE_VERT, PinNameSize,
1400  aWidth, false, false );
1401 
1402  if( DrawPinNum )
1403  {
1404  plotter->Text( wxPoint( x1 - num_offset,
1405  (y1 + pin_pos.y) / 2 ),
1406  NumColor, m_number,
1407  TEXT_ANGLE_VERT, PinNumSize,
1410  aWidth, false, false );
1411  }
1412  }
1413  }
1414  }
1415  else /* Draw num & text pin outside */
1416  {
1417  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1418  {
1419  /* Its an horizontal line. */
1420  if( DrawPinName )
1421  {
1422  x = (x1 + pin_pos.x) / 2;
1423  plotter->Text( wxPoint( x, y1 - name_offset ),
1424  NameColor, m_name,
1425  TEXT_ANGLE_HORIZ, PinNameSize,
1428  aWidth, false, false );
1429  }
1430 
1431  if( DrawPinNum )
1432  {
1433  x = ( x1 + pin_pos.x ) / 2;
1434  plotter->Text( wxPoint( x, y1 + num_offset ),
1435  NumColor, m_number,
1436  TEXT_ANGLE_HORIZ, PinNumSize,
1439  aWidth, false, false );
1440  }
1441  }
1442  else /* Its a vertical line. */
1443  {
1444  if( DrawPinName )
1445  {
1446  y = ( y1 + pin_pos.y ) / 2;
1447  plotter->Text( wxPoint( x1 - name_offset, y ),
1448  NameColor, m_name,
1449  TEXT_ANGLE_VERT, PinNameSize,
1452  aWidth, false, false );
1453  }
1454 
1455  if( DrawPinNum )
1456  {
1457  plotter->Text( wxPoint( x1 + num_offset,
1458  ( y1 + pin_pos.y ) / 2 ),
1459  NumColor, m_number,
1460  TEXT_ANGLE_VERT, PinNumSize,
1463  aWidth, false, false );
1464  }
1465  }
1466  }
1467 }
#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:563
wxString m_number
Definition: lib_pin.h:83
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:62
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 1119 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().

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

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

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

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

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

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 461 of file base_struct.h.

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

Rotate the draw item.

Reimplemented from LIB_ITEM.

Definition at line 1915 of file lib_pin.cpp.

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

Referenced by GetOrientation(), and GetPosition().

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

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

1621 {
1622  int rot_angle = aRotateCCW ? -900 : 900;
1623 
1624  RotatePoint( &m_position, center, rot_angle );
1625 
1626  if( aRotateCCW )
1627  {
1628  switch( m_orientation )
1629  {
1630  case PIN_RIGHT:
1632  break;
1633 
1634  case PIN_UP:
1636  break;
1637  case PIN_LEFT:
1639  break;
1640 
1641  case PIN_DOWN:
1643  break;
1644  }
1645  }
1646  else
1647  {
1648  switch( m_orientation )
1649  {
1650  case PIN_RIGHT:
1652  break;
1653 
1654  case PIN_UP:
1656  break;
1657  case PIN_LEFT:
1659  break;
1660 
1661  case PIN_DOWN:
1663  break;
1664  }
1665  }
1666 }
Definition: lib_pin.h:55
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
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 241 of file base_struct.h.

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

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

Definition at line 258 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

258 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:282
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
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 449 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().

450 {
451  if( m_Convert == style )
452  return;
453 
454  m_Convert = style;
455  SetFlags( IS_CHANGED );
456 
457  if( style == 0 )
458  {
459  LIB_PIN* pin;
460  LIB_PIN* tmp = GetParent()->GetNextPin();
461 
462  while( tmp != NULL )
463  {
464  pin = tmp;
465  tmp = GetParent()->GetNextPin( pin );
466 
467  if( ( pin->m_Flags & IS_LINKED ) == 0
468  || ( pin == this )
469  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
470  || ( m_position != pin->m_position )
471  || ( pin->m_orientation != m_orientation ) )
472  continue;
473 
474  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
475  }
476  }
477 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:123
LIB_PART * GetParent() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:282
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:204
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 282 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), 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(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), 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().

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

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

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

Definition at line 257 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

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

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

363 {
364  if( m_length != length )
365  {
366  m_length = length;
367  SetModified();
368  }
369 
370  if( !aTestOtherPins )
371  return;
372 
373  if( GetParent() == NULL )
374  return;
375 
376  LIB_PINS pinList;
377  GetParent()->GetPins( pinList );
378 
379  for( size_t i = 0; i < pinList.size(); i++ )
380  {
381  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
382  || pinList[i]->m_Convert != m_Convert
383  || pinList[i]->m_length == length )
384  continue;
385 
386  pinList[i]->m_length = length;
387  SetModified();
388  }
389 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
int m_Convert
Shape identification for alternate body styles.
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 243 of file base_struct.h.

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

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

Definition at line 102 of file base_struct.cpp.

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

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

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

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

161 {
162  wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
163 
164  // pin name string does not support spaces
165  tmp.Replace( wxT( " " ), wxT( "_" ) );
166 
167  if( m_name != tmp )
168  {
169  m_name = tmp;
170  SetModified();
171  }
172 
173  if( !aTestOtherPins )
174  return;
175 
176  if( GetParent() == NULL )
177  return;
178 
179  LIB_PINS pinList;
180  GetParent()->GetPins( pinList );
181 
182  for( size_t i = 0; i < pinList.size(); i++ )
183  {
184  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_name == m_name )
185  continue;
186 
187  pinList[i]->m_name = m_name;
188  SetModified();
189  }
190 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
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 193 of file lib_pin.cpp.

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

194 {
195  if( size != m_nameTextSize )
196  {
197  m_nameTextSize = size;
198  SetModified();
199  }
200 
201  if( !aTestOtherPins )
202  return;
203 
204  if( GetParent() == NULL )
205  return;
206 
207  LIB_PINS pinList;
208  GetParent()->GetPins( pinList );
209 
210  for( size_t i = 0; i < pinList.size(); i++ )
211  {
212  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
213  continue;
214 
215  pinList[i]->m_nameTextSize = size;
216  SetModified();
217  }
218 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 240 of file base_struct.h.

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

240 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:193
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 221 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().

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

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

241 {
242  if( size != m_numTextSize )
243  {
244  m_numTextSize = size;
245  SetModified();
246  }
247 
248  if( !aTestOtherPins )
249  return;
250 
251  if( GetParent() == NULL )
252  return;
253 
254  LIB_PINS pinList;
255  GetParent()->GetPins( pinList );
256 
257  for( size_t i = 0; i < pinList.size(); i++ )
258  {
259  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
260  continue;
261 
262  pinList[i]->m_numTextSize = size;
263  SetModified();
264  }
265 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
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 1572 of file lib_pin.cpp.

References m_position.

Referenced by IsPowerConnection().

1573 {
1574  m_position += aOffset;
1575 }
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 268 of file lib_pin.cpp.

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

269 {
270  if( m_orientation != orientation )
271  {
272  m_orientation = orientation;
273  SetModified();
274  }
275 
276  if( !aTestOtherPins )
277  return;
278 
279  if( GetParent() == NULL )
280  return;
281 
282  LIB_PINS pinList;
283  GetParent()->GetPins( pinList );
284 
285  for( size_t i = 0; i < pinList.size(); i++ )
286  {
287  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
288  pinList[i]->m_orientation == orientation )
289  continue;
290 
291  pinList[i]->m_orientation = orientation;
292  SetModified();
293  }
294 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 242 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(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), 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().

242 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:197
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 419 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().

420 {
421  if( m_Unit == part )
422  return;
423 
424  m_Unit = part;
425  SetModified();
426 
427  if( m_Unit == 0 )
428  {
429  LIB_PIN* pin;
430  LIB_PIN* tmp = GetParent()->GetNextPin();
431 
432  while( tmp != NULL )
433  {
434  pin = tmp;
435  tmp = GetParent()->GetNextPin( pin );
436 
437  if( pin->m_Flags == 0 || pin == this
438  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
439  || ( m_position != pin->m_position )
440  || ( pin->m_orientation != m_orientation ) )
441  continue;
442 
443  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
444  }
445  }
446 }
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:204
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 392 of file lib_pin.cpp.

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

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

393 {
394  if( m_position != aPosition )
395  {
396  m_position = aPosition;
397  SetModified();
398  }
399 
400  if( GetParent() == NULL )
401  return;
402 
403  LIB_PINS pinList;
404  GetParent()->GetPins( pinList );
405 
406  for( size_t i = 0; i < pinList.size(); i++ )
407  {
408  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
409  || pinList[i]->m_Convert != m_Convert
410  || pinList[i]->m_position == aPosition )
411  continue;
412 
413  pinList[i]->m_position = aPosition;
414  SetModified();
415  }
416 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
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 256 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().

256 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:282
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 297 of file lib_pin.cpp.

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

298 {
299  assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
300 
301  if( m_shape != aShape )
302  {
303  m_shape = aShape;
304  SetModified();
305  }
306 
307  if( GetParent() == NULL )
308  return;
309 
310  LIB_PINS pinList;
311  GetParent()->GetPins( pinList );
312 
313  for( size_t i = 0; i < pinList.size(); i++ )
314  {
315  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
316  || pinList[i]->m_Convert != m_Convert
317  || pinList[i]->m_shape == aShape )
318  continue;
319 
320  pinList[i]->m_shape = aShape;
321  SetModified();
322  }
323 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
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 232 of file base_struct.h.

Referenced by 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(), PCB_BASE_FRAME::LoadModuleFromLibrary(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), and TestDuplicateSheetNames().

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

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

327 {
328  assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
329 
330  if( aType < PIN_INPUT )
331  aType = PIN_INPUT;
332 
333  if( aType >= (int)PINTYPE_COUNT )
334  aType = PIN_NC;
335 
336  if( m_type != aType )
337  {
338  m_type = aType;
339  SetModified();
340  }
341 
342  if( !aTestOtherPins )
343  return;
344 
345  if( GetParent() == NULL )
346  return;
347 
348  LIB_PINS pinList;
349  GetParent()->GetPins( pinList );
350 
351  for( size_t i = 0; i < pinList.size(); i++ )
352  {
353  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_type == aType )
354  continue;
355 
356  pinList[i]->m_type = aType;
357  SetModified();
358  }
359 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
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 480 of file lib_pin.cpp.

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), 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().

481 {
482  if( visible == IsVisible() )
483  return;
484 
485  if( visible )
487  else
489 
490  SetModified();
491 
492  if( GetParent() == NULL )
493  return;
494 
495  LIB_PINS pinList;
496  GetParent()->GetPins( pinList );
497 
498  for( size_t i = 0; i < pinList.size(); i++ )
499  {
500  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->IsVisible() == visible )
501  continue;
502 
503  if( visible )
504  pinList[i]->m_attributes &= ~PIN_INVISIBLE;
505  else
506  pinList[i]->m_attributes |= PIN_INVISIBLE;
507 
508  SetModified();
509  }
510 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
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:204
void LIB_PIN::SetWidth ( int  aWidth)
overridevirtual

Set the width of the draw item to aWidth.

Implements LIB_ITEM.

Definition at line 1686 of file lib_pin.cpp.

References m_width, and EDA_ITEM::SetModified().

Referenced by GetWidth().

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

Definition at line 255 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

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

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

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

Definition at line 492 of file base_struct.h.

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

Referenced by PART_LIB::GetEntryTypePowerNames().

492 { 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 227 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CLUSTER::Add(), BOARD::Add(), CN_CONNECTIVITY_ALGO::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), DIALOG_EXCHANGE_FOOTPRINTS::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_EDIT_FRAME::CheckListConnections(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), Collect_TrackSegmentsToDrag(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), 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(), 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(), 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(), ARRAY_CREATOR::Invoke(), CN_ANCHOR::IsDangling(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), ROUTER_TOOL::NeighboringSegmentFilter(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), CN_CONNECTIVITY_ALGO::searchConnections(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_NO_CONNECT::SwapData(), SCH_JUNCTION::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), VIA::SwapData(), ZONE_CONTAINER::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and SCH_COMPONENT::Visit().

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

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

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

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

Definition at line 267 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

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

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

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

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

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

Reimplemented in EDIT_POINTS, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 115 of file view_item.h.

References KIGFX::VIEW_ITEM::ViewGetLayers().

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

116  {}
void EDA_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

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

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

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

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, VIA, BOARD_ITEM, GERBER_DRAW_ITEM, TRACK, TEXTE_MODULE, ZONE_CONTAINER, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::RATSNEST_VIEWITEM, and KIGFX::PREVIEW::RULER_ITEM.

Definition at line 275 of file base_struct.cpp.

Referenced by EDA_ITEM::Sort().

276 {
277  // Basic fallback
278  aCount = 1;
279  aLayers[0] = 0;
280 }
virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

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

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

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

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

Definition at line 139 of file view_item.h.

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

140  {
141  // By default always show the item
142  return 0;
143  }
VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::viewPrivData ( ) const
inlineinherited