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...
 
bool Save (OUTPUTFORMATTER &aFormatter) override
 Function Save writes draw item object to aFormatter in component library "*.lib" format. More...
 
bool Load (LINE_READER &aLineReader, wxString &aErrorMsg) override
 
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
 Function GetMsgPanelInfo displays 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
 Function GetBoundingBox. More...
 
wxPoint PinEndPoint () const
 Function PinEndPoint. More...
 
int PinDrawOrient (const TRANSFORM &aTransform) const
 Function PinDrawOrient returns 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
 Function GetPenSize. More...
 
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)
 Function DrawPinSymbol 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)
 Function DrawPinTexts puts 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)
 Function DrawPinElectricalTypeName draws 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)
 Function PlotPinTexts plots 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
 Function Offset sets the drawing object by aOffset from the current position. More...
 
bool Inside (EDA_RECT &aRect) const override
 Function Inside tests if any part of the draw object is inside rectangle bounds of aRect. More...
 
void Move (const wxPoint &aPosition) override
 Function Move moves a draw object to aPosition. More...
 
wxPoint GetPosition () const override
 Function GetPosition returns 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
 Function MirrorHorizontal mirrors the draw object along the horizontal (X) axis about aCenter point. More...
 
void MirrorVertical (const wxPoint &aCenter) override
 Function MirrorVertical mirrors the draw object along the MirrorVertical (Y) axis about aCenter point. More...
 
void Rotate (const wxPoint &aCenter, bool aRotateCCW=true) override
 Function Rotate rotates 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
 Function GetWidth return the width of the draw item. More...
 
void SetWidth (int aWidth) override
 Function SetWidth sets 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...
 
wxString GetTypeName ()
 
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 (time_t aNewTimeStamp)
 
time_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...
 
wxString m_typeName
 Name of object displayed in the message panel. 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...
 
time_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

void 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
 Function compare provides 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...
 

Detailed Description

Definition at line 68 of file lib_pin.h.

Constructor & Destructor Documentation

LIB_PIN::LIB_PIN ( LIB_PART aParent)

Definition at line 145 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, LIB_ITEM::m_typeName, m_width, PIN_RIGHT, and PIN_UNSPECIFIED.

Referenced by Clone().

145  :
146  LIB_ITEM( LIB_PIN_T, aParent ),
148 {
150  m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
151  m_type = PIN_UNSPECIFIED; // electrical type of pin
152  m_attributes = 0; // bit 0 != 0: pin invisible
155  m_width = 0;
156  m_typeName = _( "Pin" );
157 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
wxString m_typeName
Name of object displayed in the message panel.
int m_numTextSize
Definition: lib_pin.h:79
static int GetDefaultPinLength()
Definition: libeditframe.h:178
int m_length
Length of the pin.
Definition: lib_pin.h:71
static int GetPinNumDefaultSize()
Definition: libeditframe.h:170
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:76
static int GetPinNameDefaultSize()
Definition: libeditframe.h:174
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
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:74
LIB_PIN::~LIB_PIN ( )
inline

Definition at line 106 of file lib_pin.h.

106 { }

Member Function Documentation

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

References EDA_ITEM::Pback.

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

221 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
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 171 of file lib_draw_item.h.

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

171 {}
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

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

Definition at line 268 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), 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(), Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

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

Definition at line 246 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

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

References LIB_PIN().

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

1875 {
1876  return new LIB_PIN( *this );
1877 }
LIB_PIN(LIB_PART *aParent)
Definition: lib_pin.cpp:145
int LIB_PIN::compare ( const LIB_ITEM aOther) const
overrideprivatevirtual

Function compare provides 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 1880 of file lib_pin.cpp.

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

1881 {
1882  wxASSERT( other.Type() == LIB_PIN_T );
1883 
1884  const LIB_PIN* tmp = (LIB_PIN*) &other;
1885 
1886  if( m_number != tmp->m_number )
1887  return m_number.Cmp( tmp->m_number );
1888 
1889  int result = m_name.CmpNoCase( tmp->m_name );
1890 
1891  if( result != 0 )
1892  return result;
1893 
1894  if( m_position.x != tmp->m_position.x )
1895  return m_position.x - tmp->m_position.x;
1896 
1897  if( m_position.y != tmp->m_position.y )
1898  return m_position.y - tmp->m_position.y;
1899 
1900  return 0;
1901 }
wxString m_name
Definition: lib_pin.h:77
wxString m_number
Definition: lib_pin.h:78
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 183 of file lib_draw_item.h.

Referenced by LIB_EDIT_FRAME::GraphicItemBeginDraw().

183 { 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 117 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_EDIT_FRAME::GraphicItemBeginDraw(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), LIB_EDIT_FRAME::Process_Special_Functions(), RedrawWhileMovingCursor(), LIB_PART::RemoveDrawItem(), and SymbolDisplayDraw().

121 {
122  if( InEditMode() )
123  {
124  // Temporarily disable filling while the item is being edited.
125  FILL_T fillMode = m_Fill;
127 
128  m_Fill = NO_FILL;
129 
130 #ifndef USE_WX_OVERLAY
131  // Erase the old items using the previous attributes.
132  if( m_eraseLastDrawItem )
133  {
134  GRSetDrawMode( aDC, g_XorMode );
135  drawEditGraphics( aPanel->GetClipBox(), aDC, color );
136  drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
137  aTransform );
138  }
139 #endif
140  // Calculate the new attributes at the current cursor position.
141  calcEdit( aOffset );
142 
143  // Draw the items using the new attributes.
144  drawEditGraphics( aPanel->GetClipBox(), aDC, color );
145  drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
146  aTransform );
147 
148  m_Fill = fillMode;
149  }
150  else
151  {
152  drawGraphic( aPanel, aDC, aOffset, aColor, aDrawMode, aData, aTransform );
153  }
154 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
virtual COLOR4D GetDefaultColor()
bool m_eraseLastDrawItem
Used when editing a new draw item to prevent drawing artifacts.
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:96
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
Function drawGraphic.
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 901 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().

908 {
909  // aData is used here as a bitfield of flags.
910  uintptr_t flags = (uintptr_t) aData;
911  bool drawPinText = flags & PIN_DRAW_TEXTS;
912  bool drawPinDangling = flags & PIN_DRAW_DANGLING;
913  bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
914  bool drawElectricalTypeName = flags & PIN_DRAW_ELECTRICAL_TYPE_NAME;
915 
916  LIB_PART* Entry = GetParent();
917 
918  /* Calculate pin orient taking in account the component orientation. */
919  int orient = PinDrawOrient( aTransform );
920 
921  /* Calculate the pin position */
922  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
923 
924  // Invisible pins are only drawn on request.
925  // They are drawn in GetInvisibleItemColor().
926  // in schematic, they are drawn only if m_showAllPins is true.
927  // In other windows, they are always drawn because we must see them.
928  if( ! IsVisible() )
929  {
930  EDA_DRAW_FRAME* frame = NULL;
931 
932  if( aPanel && aPanel->GetParent() )
933  frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
934 
935  if( frame && frame->IsType( FRAME_SCH ) &&
936  ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
937  {
938  if( drawPinDangling && drawDanglingHidden )
939  {
940  // Draw the target
941  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
942  /* aOnlyTarget */ true );
943  }
944  return;
945  }
946 
947  aColor = GetInvisibleItemColor();
948  }
949 
950  /* Drawing from the pin and the special symbol combination */
951  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
952 
953  if( drawPinText )
954  {
955  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
956  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
957  aColor, aDrawMode );
958  }
959 
960  if( drawElectricalTypeName )
961  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
962 
963 
964  /* Set to one (1) to draw bounding box around pin to validate bounding
965  * box calculation. */
966 #if 0
967  EDA_RECT bBox = GetBoundingBox();
968  bBox.RevertYAxis();
969  bBox = aTransform.TransformCoordinate( bBox );
970  bBox.Move( aOffset );
971  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
972 #endif
973 }
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)
Function DrawPinElectricalTypeName draws the electrical type text of the pin (only for the footprint ...
Definition: lib_pin.cpp:1389
int GetPinNameOffset()
Schematic editor (Eeschema) main window.
Definition: schframe.h:118
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
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) ...
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:1076
bool ShowPinNumbers()
LIB_PART * GetParent() const
Class LIB_PART defines a library part object.
EDA_RECT * GetClipBox()
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:174
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:360
void DrawPinTexts(EDA_DRAW_PANEL *aPanel, wxDC *aDC, wxPoint &aPosition, int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName, COLOR4D aColor, GR_DRAWMODE aDrawMode)
Function DrawPinTexts puts the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:1175
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
Class EDA_RECT handles the component boundary box.
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:229
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)
Function DrawPinSymbol Draw the pin symbol without text.
Definition: lib_pin.cpp:976
int PinDrawOrient(const TRANSFORM &aTransform) const
Function PinDrawOrient returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform.
Definition: lib_pin.cpp:1829
void LIB_PIN::DrawPinElectricalTypeName ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
wxPoint aPosition,
int  aOrientation,
COLOR4D  aColor,
GR_DRAWMODE  aDrawMode 
)

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

Definition at line 1389 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().

1392 {
1393  wxString etypeName = GetElectricalTypeName();
1394 
1395  // Use a reasonable (small) size to draw the text
1396  int etextSize = (m_nameTextSize*3)/4;
1397 
1398  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
1399  if( etextSize > ETXT_MAX_SIZE )
1400  etextSize = ETXT_MAX_SIZE;
1401 
1402  // Use a reasonable pen size to draw the text
1403  int pensize = etextSize/6;
1404 
1405  // Get a suitable color
1406  if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
1407  aColor = GetItemSelectedColor();
1408  else if( !IsVisible() )
1409  aColor = GetInvisibleItemColor();
1410  else
1411  aColor = GetLayerColor( LAYER_NOTES );
1412 
1413  wxPoint txtpos = aPosition;
1414  int offset = Millimeter2iu( 0.4 );
1416  int orient = TEXT_ANGLE_HORIZ;
1417 
1418  switch( aOrientation )
1419  {
1420  case PIN_UP:
1421  txtpos.y += offset;
1422  orient = TEXT_ANGLE_VERT;
1423  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1424  break;
1425 
1426  case PIN_DOWN:
1427  txtpos.y -= offset;
1428  orient = TEXT_ANGLE_VERT;
1429  break;
1430 
1431  case PIN_LEFT:
1432  txtpos.x += offset;
1433  break;
1434 
1435  case PIN_RIGHT:
1436  txtpos.x -= offset;
1437  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1438  break;
1439  }
1440 
1441  GRSetDrawMode( aDC, aDrawMode );
1442  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
1443 
1444  DrawGraphicText( clipbox, aDC, txtpos, aColor, etypeName,
1445  orient, wxSize( etextSize, etextSize ),
1446  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize,
1447  false, false );
1448 }
#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:90
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
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)
Definition: drawtxt.cpp:122
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
#define ETXT_MAX_SIZE
bool IsSelected() const
Definition: base_struct.h:235
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:275
Definition: lib_pin.h:55
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
#define TEXT_ANGLE_VERT
Definition: common.h:91
COLOR4D GetInvisibleItemColor()
EDA_RECT * GetClipBox()
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:360
Class EDA_RECT handles the component boundary box.
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 
)

Function DrawPinSymbol Draw the pin symbol without text.

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

Definition at line 976 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().

984 {
985  int MapX1, MapY1, x1, y1;
986  int width = GetPenSize();
987  int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
988  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
989 
991 
992  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
993  {
994  if( IsSelected() )
995  color = GetItemSelectedColor();
996  }
997  else
998  color = aColor;
999 
1000  GRSetDrawMode( aDC, aDrawMode );
1001 
1002  MapX1 = MapY1 = 0;
1003  x1 = posX;
1004  y1 = posY;
1005 
1006  switch( aOrient )
1007  {
1008  case PIN_UP:
1009  y1 = posY - len;
1010  MapY1 = 1;
1011  break;
1012 
1013  case PIN_DOWN:
1014  y1 = posY + len;
1015  MapY1 = -1;
1016  break;
1017 
1018  case PIN_LEFT:
1019  x1 = posX - len;
1020  MapX1 = 1;
1021  break;
1022 
1023  case PIN_RIGHT:
1024  x1 = posX + len;
1025  MapX1 = -1;
1026  break;
1027  }
1028 
1029  // Draw the pin end target (active end of the pin)
1030  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
1031  #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
1032 
1033  // Draw but do not print the pin end target 1 pixel width
1034  if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
1035  {
1036  if( aDrawDangling )
1037  GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
1038  }
1039 
1040  if( aOnlyTarget )
1041  return;
1042 
1043 
1045  {
1046  const int radius = ExternalPinDecoSize( *this );
1047  GRCircle( clipbox, aDC, MapX1 * radius + x1,
1048  MapY1 * radius + y1,
1049  radius, width, color );
1050 
1051  GRMoveTo( MapX1 * radius * 2 + x1,
1052  MapY1 * radius * 2 + y1 );
1053  GRLineTo( clipbox, aDC, posX, posY, width, color );
1054  }
1055  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
1056  {
1057  const int clock_size = InternalPinDecoSize( *this );
1058  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1059  {
1060  GRMoveTo( x1, y1 + clock_size );
1061  GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
1062  width, color );
1063  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
1064  }
1065  else /* MapX1 = 0 */
1066  {
1067  GRMoveTo( x1 + clock_size, y1 );
1068  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
1069  width, color );
1070  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1071  width, color );
1072  }
1073  GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
1074  GRLineTo( clipbox, aDC, posX, posY, width, color );
1075  }
1076  else
1077  {
1078  GRMoveTo( x1, y1 );
1079  GRLineTo( clipbox, aDC, posX, posY, width, color );
1080  }
1081 
1083  {
1084  const int clock_size = InternalPinDecoSize( *this );
1085  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1086  {
1087  GRMoveTo( x1, y1 + clock_size );
1088  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1,
1089  width, color );
1090  GRLineTo( clipbox, aDC, x1, y1 - clock_size,
1091  width, color );
1092  }
1093  else /* MapX1 = 0 */
1094  {
1095  GRMoveTo( x1 + clock_size, y1 );
1096  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2,
1097  width, color );
1098  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1099  width, color );
1100  }
1101  }
1102 
1104  {
1105  const int symbol_size = ExternalPinDecoSize( *this );
1106  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1107  {
1108  GRMoveTo( x1 + MapX1 * symbol_size * 2, y1 );
1109  GRLineTo( clipbox, aDC,
1110  x1 + MapX1 * symbol_size * 2, y1 - symbol_size * 2,
1111  width, color );
1112  GRLineTo( clipbox, aDC, x1, y1, width, color );
1113  }
1114  else /* MapX1 = 0 */
1115  {
1116  GRMoveTo( x1, y1 + MapY1 * symbol_size * 2 );
1117  GRLineTo( clipbox, aDC, x1 - symbol_size * 2,
1118  y1 + MapY1 * symbol_size * 2, width, color );
1119  GRLineTo( clipbox, aDC, x1, y1, width, color );
1120  }
1121  }
1122 
1123 
1124  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1125  {
1126  const int symbol_size = ExternalPinDecoSize( *this );
1127  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1128  {
1129  GRMoveTo( x1, y1 - symbol_size * 2 );
1130  GRLineTo( clipbox,
1131  aDC,
1132  x1 + MapX1 * symbol_size * 2,
1133  y1,
1134  width,
1135  color );
1136  }
1137  else /* MapX1 = 0 */
1138  {
1139  GRMoveTo( x1 - symbol_size * 2, y1 );
1140  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * symbol_size * 2,
1141  width, color );
1142  }
1143  }
1144  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1145  {
1146  const int symbol_size = ExternalPinDecoSize( *this );
1147  GRMoveTo( x1 - (MapX1 + MapY1) * symbol_size,
1148  y1 - (MapY1 - MapX1) * symbol_size );
1149  GRLineTo( clipbox, aDC,
1150  x1 + (MapX1 + MapY1) * symbol_size,
1151  y1 + (MapY1 - MapX1) * symbol_size,
1152  width, color );
1153  GRMoveTo( x1 - (MapX1 - MapY1) * symbol_size,
1154  y1 - (MapY1 + MapX1) * symbol_size );
1155  GRLineTo( clipbox, aDC,
1156  x1 + (MapX1 - MapY1) * symbol_size,
1157  y1 + (MapY1 + MapX1) * symbol_size,
1158  width, color );
1159  }
1160 
1161  if( m_type == PIN_NC ) // Draw a N.C. symbol
1162  {
1163  GRLine( clipbox, aDC,
1164  posX - NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1165  posX + NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1166  width, color );
1167  GRLine( clipbox, aDC,
1168  posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1169  posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1170  width, color );
1171  }
1172 }
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:140
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
bool IsSelected() const
Definition: base_struct.h:235
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:71
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:410
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
EDA_RECT * GetClipBox()
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
Definition: lib_pin.cpp:131
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:358
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:400
#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:828
Class EDA_RECT handles the component boundary box.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
#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:75
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 
)

Function DrawPinTexts puts 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 1175 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().

1184 {
1185  if( !DrawPinName && !DrawPinNum )
1186  return;
1187 
1188  int x, y;
1189 
1190  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
1191  wxSize PinNumSize( m_numTextSize, m_numTextSize );
1192 
1193  int nameLineWidth = GetPenSize();
1194 
1195  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1196  int numLineWidth = GetPenSize();
1197  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1198 
1199  int name_offset = PIN_TEXT_MARGIN +
1200  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1201  int num_offset = PIN_TEXT_MARGIN +
1202  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1203 
1204  GRSetDrawMode( DC, DrawMode );
1205  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
1206 
1207  /* Get the num and name colors */
1208  if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
1209  Color = GetItemSelectedColor();
1210 
1211  COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
1212  GetLayerColor( LAYER_PINNAM ) : Color;
1213  COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
1214  GetLayerColor( LAYER_PINNUM ) : Color;
1215 
1216  int x1 = pin_pos.x;
1217  int y1 = pin_pos.y;
1218 
1219  switch( orient )
1220  {
1221  case PIN_UP:
1222  y1 -= m_length;
1223  break;
1224 
1225  case PIN_DOWN:
1226  y1 += m_length;
1227  break;
1228 
1229  case PIN_LEFT:
1230  x1 -= m_length;
1231  break;
1232 
1233  case PIN_RIGHT:
1234  x1 += m_length;
1235  break;
1236  }
1237 
1238  if( m_name.IsEmpty() )
1239  DrawPinName = false;
1240 
1241  if( TextInside ) // Draw the text inside, but the pin numbers outside.
1242  {
1243  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1244  {
1245  // It is an horizontal line
1246  if( DrawPinName )
1247  {
1248  if( orient == PIN_RIGHT )
1249  {
1250  x = x1 + TextInside;
1251  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1252  m_name,
1254  PinNameSize,
1256  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1257  false, false );
1258  }
1259  else // Orient == PIN_LEFT
1260  {
1261  x = x1 - TextInside;
1262  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1263  m_name,
1265  PinNameSize,
1267  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1268  false, false );
1269  }
1270  }
1271 
1272  if( DrawPinNum )
1273  {
1274  DrawGraphicText( clipbox, DC,
1275  wxPoint( (x1 + pin_pos.x) / 2,
1276  y1 - num_offset ), NumColor,
1277  m_number,
1278  TEXT_ANGLE_HORIZ, PinNumSize,
1280  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1281  false, false );
1282  }
1283  }
1284  else /* Its a vertical line. */
1285  {
1286  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
1287  if( orient == PIN_DOWN )
1288  {
1289  y = y1 + TextInside;
1290 
1291  if( DrawPinName )
1292  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1293  m_name,
1294  TEXT_ANGLE_VERT, PinNameSize,
1296  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1297  false, false );
1298 
1299  if( DrawPinNum )
1300  DrawGraphicText( clipbox, DC,
1301  wxPoint( x1 - num_offset,
1302  (y1 + pin_pos.y) / 2 ), NumColor,
1303  m_number,
1304  TEXT_ANGLE_VERT, PinNumSize,
1306  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1307  false, false );
1308  }
1309  else /* PIN_UP */
1310  {
1311  y = y1 - TextInside;
1312 
1313  if( DrawPinName )
1314  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1315  m_name,
1316  TEXT_ANGLE_VERT, PinNameSize,
1318  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1319  false, false );
1320 
1321  if( DrawPinNum )
1322  DrawGraphicText( clipbox, DC,
1323  wxPoint( x1 - num_offset,
1324  (y1 + pin_pos.y) / 2 ), NumColor,
1325  m_number,
1326  TEXT_ANGLE_VERT, PinNumSize,
1328  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1329  false, false );
1330  }
1331  }
1332  }
1333  else /**** Draw num & text pin outside ****/
1334  {
1335  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1336  {
1337  /* Its an horizontal line. */
1338  if( DrawPinName )
1339  {
1340  x = (x1 + pin_pos.x) / 2;
1341  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ),
1342  NameColor, m_name,
1343  TEXT_ANGLE_HORIZ, PinNameSize,
1345  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1346  false, false );
1347  }
1348  if( DrawPinNum )
1349  {
1350  x = (x1 + pin_pos.x) / 2;
1351  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
1352  NumColor, m_number,
1353  TEXT_ANGLE_HORIZ, PinNumSize,
1355  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1356  false, false );
1357  }
1358  }
1359  else /* Its a vertical line. */
1360  {
1361  if( DrawPinName )
1362  {
1363  y = (y1 + pin_pos.y) / 2;
1364  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ),
1365  NameColor, m_name,
1366  TEXT_ANGLE_VERT, PinNameSize,
1368  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1369  false, false );
1370  }
1371 
1372  if( DrawPinNum )
1373  {
1374  DrawGraphicText( clipbox, DC,
1375  wxPoint( x1 + num_offset, (y1 + pin_pos.y)
1376  / 2 ),
1377  NumColor, m_number,
1378  TEXT_ANGLE_VERT, PinNumSize,
1380  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1381  false, false );
1382  }
1383  }
1384  }
1385 }
#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:90
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
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)
Definition: drawtxt.cpp:122
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
int m_numTextSize
Definition: lib_pin.h:79
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
bool IsSelected() const
Definition: base_struct.h:235
wxString m_name
Definition: lib_pin.h:77
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:71
#define TEXT_ANGLE_VERT
Definition: common.h:91
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
wxString m_number
Definition: lib_pin.h:78
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...
Definition: drawtxt.cpp:67
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:61
Class EDA_RECT handles the component boundary box.
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
aEnableTrue marks all common pins for editing mode. False clears the editing mode.
aEditPinByPinEnables the edit pin by pin mode.

Definition at line 493 of file lib_pin.cpp.

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

Referenced by LIB_EDIT_FRAME::OnEditPin().

494 {
495  LIB_PINS pinList;
496 
497  if( GetParent() == NULL )
498  return;
499 
500  GetParent()->GetPins( pinList );
501 
502  for( size_t i = 0; i < pinList.size(); i++ )
503  {
504  if( pinList[i] == this )
505  continue;
506 
507  if( ( pinList[i]->m_position == m_position )
508  && ( pinList[i]->m_orientation == m_orientation )
509  && !IsNew()
510  && editPinByPin == false
511  && enable )
512  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
513  else
514  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
515  }
516 }
#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:230
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:72
LIB_PART * GetParent() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 193 of file lib_draw_item.h.

References EDA_ITEM::m_Flags.

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

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

Reimplemented from LIB_ITEM.

Definition at line 138 of file lib_pin.h.

References GetBoundingBox().

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

138 { return GetBoundingBox( false ); }
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
const EDA_RECT LIB_PIN::GetBoundingBox ( bool  aIncludeInvisibles) const

Function GetBoundingBox.

Parameters
aIncludeInvisibles- if false, do not include labels for invisible pins in the calculation.

Definition at line 2100 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.

2101 {
2102  LIB_PART* entry = (LIB_PART* ) m_Parent;
2103  EDA_RECT bbox;
2104  wxPoint begin;
2105  wxPoint end;
2106  int nameTextOffset = 0;
2107  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
2108  bool showNum = !m_number.IsEmpty();
2109  int minsizeV = TARGET_PIN_RADIUS;
2110 
2111  if( !aIncludeInvisibles && !IsVisible() )
2112  showName = false;
2113 
2114  if( entry )
2115  {
2116  if( entry->ShowPinNames() )
2117  nameTextOffset = entry->GetPinNameOffset();
2118  else
2119  showName = false;
2120 
2121  showNum = entry->ShowPinNumbers();
2122  }
2123 
2124  // First, calculate boundary box corners position
2125  int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
2126 
2127  // Actual text height is bigger than text size
2128  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
2129 
2131  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
2132 
2133  // calculate top left corner position
2134  // for the default pin orientation (PIN_RIGHT)
2135  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
2136  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
2137 
2138  // calculate bottom right corner position and adjust top left corner position
2139  int nameTextLength = 0;
2140  int nameTextHeight = 0;
2141 
2142  if( showName )
2143  {
2144  int length = m_name.Len();
2145 
2146  // Don't count the line over text symbol.
2147  if( m_name.Left( 1 ) == wxT( "~" ) )
2148  length -= 1;
2149 
2150  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
2151 
2152  // Actual text height are bigger than text size
2153  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
2154  }
2155 
2156  if( nameTextOffset ) // for values > 0, pin name is inside the body
2157  {
2158  end.x = m_length + nameTextLength;
2159  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
2160  }
2161  else // if value == 0:
2162  // pin name is outside the body, and above the pin line
2163  // pin num is below the pin line
2164  {
2165  end.x = std::max(m_length, nameTextLength);
2166  end.y = -begin.y;
2167  begin.y = std::max( minsizeV, nameTextHeight );
2168  }
2169 
2170  // Now, calculate boundary box corners position for the actual pin orientation
2171  int orient = PinDrawOrient( DefaultTransform );
2172 
2173  /* Calculate the pin position */
2174  switch( orient )
2175  {
2176  case PIN_UP:
2177  // Pin is rotated and texts positions are mirrored
2178  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
2179  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
2180  break;
2181 
2182  case PIN_DOWN:
2183  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
2184  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
2185  begin.x = -begin.x;
2186  end.x = -end.x;
2187  break;
2188 
2189  case PIN_LEFT:
2190  begin.x = -begin.x;
2191  end.x = -end.x;
2192  break;
2193 
2194  case PIN_RIGHT:
2195  break;
2196  }
2197 
2198  begin += m_position;
2199  end += m_position;
2200 
2201  bbox.SetOrigin( begin );
2202  bbox.SetEnd( end );
2203  bbox.Normalize();
2204  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
2205 
2206  // Draw Y axis is reversed in schematic:
2207  bbox.RevertYAxis();
2208 
2209  return bbox;
2210 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:140
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
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:106
int m_numTextSize
Definition: lib_pin.h:79
void SetOrigin(const wxPoint &pos)
wxString m_name
Definition: lib_pin.h:77
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:71
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) ...
bool ShowPinNames()
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
bool ShowPinNumbers()
wxString m_number
Definition: lib_pin.h:78
void SetEnd(int x, int y)
Class LIB_PART defines a library part object.
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:360
void Normalize()
Function Normalize ensures that the height ant width are positive.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
#define max(a, b)
Definition: auxiliary.h:86
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:61
Class EDA_RECT handles the component boundary box.
#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
Function PinDrawOrient returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform.
Definition: lib_pin.cpp:1829
#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 74 of file lib_pin.cpp.

References PINTYPE_COUNT.

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

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

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 108 of file lib_pin.h.

109  {
110  return wxT( "LIB_PIN" );
111  }
int LIB_ITEM::GetConvert ( ) const
inlineinherited
COLOR4D LIB_ITEM::GetDefaultColor ( )
virtualinherited

Reimplemented in LIB_FIELD.

Definition at line 157 of file lib_draw_item.cpp.

References GetLayerColor(), and LAYER_DEVICE.

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

158 {
159  return GetLayerColor( LAYER_DEVICE );
160 }
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 275 of file lib_pin.h.

References GetText().

Referenced by DrawPinElectricalTypeName(), and GetSelectMenuText().

276  {
277  return GetText( m_type );
278  }
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:75
FILL_T LIB_ITEM::GetFillMode ( ) const
inlineinherited

Definition at line 411 of file lib_draw_item.h.

References LIB_ITEM::m_Fill.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

411 { return m_Fill; }
FILL_T m_Fill
The body fill type.
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 269 of file base_struct.h.

References EDA_ITEM::m_Flags.

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

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

Definition at line 301 of file lib_pin.h.

References m_length.

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

301 { return m_length; }
int m_length
Length of the pin.
Definition: lib_pin.h:71
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 2281 of file lib_pin.cpp.

References GetBitmap(), and m_type.

2282 {
2283  return GetBitmap( m_type );
2284 }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
BITMAP_DEF GetBitmap(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:70
void LIB_PIN::GetMsgPanelInfo ( std::vector< MSG_PANEL_ITEM > &  aList)
overridevirtual

Function GetMsgPanelInfo displays 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 2061 of file lib_pin.cpp.

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

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

2062 {
2063  getMsgPanelInfoBase( aList );
2064 
2065  wxString text;
2066  wxPoint pinpos = GetPosition();
2067  pinpos.y = -pinpos.y; // Display coord are top to bottom
2068  // lib items coord are bottom to top
2069 
2070  text = StringFromValue( g_UserUnit, pinpos.x, true );
2071  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
2072 
2073  text = StringFromValue( g_UserUnit, pinpos.y, true );
2074  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
2075 }
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:2028
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:203
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:465
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 2077 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.

2079 {
2080  getMsgPanelInfoBase( aList );
2081 
2082  if( !aComponent )
2083  return;
2084 
2085  wxString text;
2086  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
2087  + aComponent->GetPosition();
2088 
2089  text = StringFromValue( g_UserUnit, pinpos.x, true );
2090  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
2091 
2092  text = StringFromValue( g_UserUnit, pinpos.y, true );
2093  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
2094 
2095  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
2096  aComponent->GetField( VALUE )->GetShownText(),
2097  DARKCYAN ) );
2098 }
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:2028
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:203
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:135
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
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:465
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
Field Value of part, i.e. "3.3K".
wxPoint GetPosition() const override
Function GetPosition.
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void 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 2028 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().

2029 {
2030  wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
2031 
2032  LIB_ITEM::GetMsgPanelInfo( aList );
2033 
2034  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
2035 
2036  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
2037 
2038  aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
2039  GetText( m_type ),
2040  RED ) );
2041 
2042  text = GetText( m_shape );
2043 
2044  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
2045 
2046  if( IsVisible() )
2047  text = _( "Yes" );
2048  else
2049  text = _( "No" );
2050 
2051  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
2052 
2053  // Display pin length
2054  text = StringFromValue( g_UserUnit, m_length, true );
2055  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
2056 
2058  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
2059 }
Definition: colors.h:57
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:106
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:203
wxString m_name
Definition: lib_pin.h:77
int m_length
Length of the pin.
Definition: lib_pin.h:71
static int GetOrientationCodeIndex(int aCode)
Get the index of the orientation code.
Definition: lib_pin.cpp:2233
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
wxString m_number
Definition: lib_pin.h:78
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:360
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo displays basic info (type, part and convert) about the current item in messa...
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
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

Definition at line 163 of file lib_pin.h.

References m_name.

Referenced by Matches(), LIB_EDIT_FRAME::OnCheckComponent(), LIB_EDIT_FRAME::OnEditPin(), and LIB_EDIT_FRAME::RepeatPinItem().

164  {
165  return m_name;
166  }
wxString m_name
Definition: lib_pin.h:77
int LIB_PIN::GetNameTextSize ( ) const
inline

Definition at line 189 of file lib_pin.h.

References m_nameTextSize.

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

189 { return m_nameTextSize; }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
const wxString& LIB_PIN::GetNumber ( ) const
inline
int LIB_PIN::GetNumberTextSize ( ) const
inline

Definition at line 219 of file lib_pin.h.

References m_numTextSize.

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

219 { return m_numTextSize; }
int m_numTextSize
Definition: lib_pin.h:79
int LIB_PIN::GetOrientation ( void  ) const
inline

Definition at line 221 of file lib_pin.h.

References m_orientation.

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

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

References PIN_ORIENTATION_CNT, pin_orientation_codes, and PIN_RIGHT.

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

2225 {
2226  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
2227  return pin_orientation_codes[ index ];
2228 
2229  return PIN_RIGHT;
2230 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:51
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:58
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 2233 of file lib_pin.cpp.

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

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

2234 {
2235  size_t i;
2236 
2237  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
2238  {
2239  if( pin_orientation_codes[i] == code )
2240  return (int) i;
2241  }
2242 
2243  return wxNOT_FOUND;
2244 }
static const int pin_orientation_codes[]
Definition: lib_pin.cpp:51
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:58
wxArrayString LIB_PIN::GetOrientationNames ( void  )
static

Get a list of pin orientation names.

Returns
List of valid pin orientation names.

Definition at line 2213 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2214 {
2215  wxArrayString tmp;
2216 
2217  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
2218  tmp.Add( getPinOrientationName( ii ) );
2219 
2220  return tmp;
2221 }
static const wxString getPinOrientationName(unsigned aPinOrientationCode)
Definition: lib_pin.cpp:106
#define PIN_ORIENTATION_CNT
Definition: lib_pin.cpp:58
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 2275 of file lib_pin.cpp.

References iconsPinsOrientations.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2276 {
2277  return iconsPinsOrientations;
2278 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:65
int LIB_PIN::GetPartNumber ( ) const
inline

Get the pin part number.

Definition at line 315 of file lib_pin.h.

References LIB_ITEM::m_Unit.

315 { return m_Unit; }
int m_Unit
Unit identification for multiple parts per package.
int LIB_PIN::GetPenSize ( ) const
overridevirtual

Function GetPenSize.

Returns
the size of the "pen" that be used to draw or plot this item

Implements LIB_ITEM.

Definition at line 895 of file lib_pin.cpp.

References GetDefaultLineThickness(), and m_width.

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

896 {
897  return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
898 }
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:74
wxPoint LIB_PIN::GetPosition ( ) const
inlineoverridevirtual

Function GetPosition returns the current draw object position.

Returns
A wxPoint object containing the position of the object.

Implements LIB_ITEM.

Definition at line 465 of file lib_pin.h.

References m_position.

Referenced by LIB_EDIT_FRAME::CreatePin(), LIB_EDIT_FRAME::deleteItem(), DrawMovePin(), SCH_EDIT_FRAME::FindComponentAndItem(), GetMsgPanelInfo(), SCH_COMPONENT::GetPinPhysicalPosition(), LIB_EDIT_FRAME::OnCheckComponent(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::PlacePin(), LIB_EDIT_FRAME::RepeatPinItem(), and LIB_EDIT_FRAME::StartMovePin().

465 { return m_position; }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 2287 of file lib_pin.cpp.

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

Referenced by Matches().

2288 {
2289  wxString tmp;
2290  wxString style;
2291 
2292  style = GetText( m_shape );
2293 
2294  tmp.Printf( _( "Pin %s, %s, %s" ),
2296 
2297  return tmp;
2298 }
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:275
wxString m_number
Definition: lib_pin.h:78
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 235 of file lib_pin.h.

References m_shape.

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

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

Definition at line 264 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

264 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:175
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 251 of file lib_pin.h.

References m_type.

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

251 { return m_type; }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
wxString LIB_ITEM::GetTypeName ( )
inlineinherited

Definition at line 154 of file lib_draw_item.h.

References LIB_ITEM::m_typeName.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

154 { return m_typeName; }
wxString m_typeName
Name of object displayed in the message panel.
int LIB_ITEM::GetUnit ( ) const
inlineinherited
int LIB_PIN::GetWidth ( ) const
inlineoverridevirtual

Function GetWidth return the width of the draw item.

Returns
Width of draw object.

Implements LIB_ITEM.

Definition at line 484 of file lib_pin.h.

References m_width.

484 { return m_width; }
int m_width
Line width of the pin.
Definition: lib_pin.h:74
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 519 of file lib_pin.cpp.

References DefaultTransform.

520 {
521  return HitTest( aPosition, 0, DefaultTransform );
522 }
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:519
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 525 of file lib_pin.cpp.

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

526 {
527  if( aThreshold < 0 )
528  aThreshold = 0;
529 
530  TRANSFORM transform = DefaultTransform;
531  DefaultTransform = aTransform;
532 
533  EDA_RECT rect = GetBoundingBox();
534  rect.Inflate( aThreshold );
535 
536  //Restore matrix
537  DefaultTransform = transform;
538 
539  return rect.Contains( aPosition );
540 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
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.
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 395 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::OnHotKey(), 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().

395 { 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:189
#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

Function Inside tests 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 1910 of file lib_pin.cpp.

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

1911 {
1912  wxPoint end = PinEndPoint();
1913 
1914  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1915 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
wxPoint PinEndPoint() const
Function PinEndPoint.
Definition: lib_pin.cpp:1802
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

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

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

References LIB_ITEM::m_isFillable.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

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

Definition at line 237 of file base_struct.h.

References HIGHLIGHTED.

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

Definition at line 231 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

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

Definition at line 230 of file base_struct.h.

References IS_NEW.

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

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

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

Referenced by LIB_PART::Draw(), and SCH_COMPONENT::IsPinDanglingStateChanged().

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

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

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

Definition at line 236 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

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

References PIN_INVISIBLE.

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

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

Definition at line 234 of file base_struct.h.

References IS_WIRE_IMAGE.

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

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

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

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

Definition at line 132 of file base_struct.cpp.

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

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

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

Implements LIB_ITEM.

Definition at line 682 of file lib_pin.cpp.

References FROM_UTF8(), LINE_READER::Line(), m_attributes, LIB_ITEM::m_Convert, m_length, m_name, m_nameTextSize, m_numTextSize, m_orientation, m_position, m_shape, m_type, LIB_ITEM::m_Unit, PIN_BIDI, PIN_INPUT, PIN_INVISIBLE, PIN_NC, PIN_OPENCOLLECTOR, PIN_OPENEMITTER, PIN_OUTPUT, PIN_PASSIVE, PIN_POWER_IN, PIN_POWER_OUT, PIN_TRISTATE, PIN_UNSPECIFIED, PINSHAPE_CLOCK, PINSHAPE_CLOCK_LOW, PINSHAPE_FALLING_EDGE_CLOCK, PINSHAPE_INPUT_LOW, PINSHAPE_INVERTED, PINSHAPE_INVERTED_CLOCK, PINSHAPE_LINE, PINSHAPE_NONLOGIC, PINSHAPE_OUTPUT_LOW, SetNumber(), TO_UTF8, wxPoint::x, and wxPoint::y.

683 {
684  char pinAttrs[64];
685  char pinOrient[64];
686  char pinType[64];
687 
688  *pinAttrs = 0;
689 
690  // We cannot use sscanf, at least on Windows, to parse the pin description.
691  // The reason is the pin name is free, and use UTF8 encoding.
692  // We encourtered issues (Windows specific) to read this name for some UTF8
693  // cyrillic codes
694  // So, read the pin name (and num) after conversion from UTF8, and read the others
695  // parameters (in ASCII) using sscanf
696 
697  // the full line starts by "X ". The pin data starts at line + 2.
698  wxString utf8line = FROM_UTF8( aLineReader.Line() + 2 );
699  wxStringTokenizer tokenizer( utf8line, wxT(" \n\r" ) );
700  int prms_count = tokenizer.CountTokens();
701 
702  if( prms_count < 11 )
703  {
704  aErrorMsg.Printf( wxT( "pin had %d parameters of the required 11 or 12" ), prms_count );
705  return false;
706  }
707 
708  // Extract the pinName (UTF8 encoded)
709  m_name = tokenizer.GetNextToken();
710 
711  wxString tmp;
712 
713  // Extract the pinName (UTF8 encoded accepted, but should be only ASCII8.)
714  tmp = tokenizer.GetNextToken();
715  SetNumber( tmp );
716 
717  // Read other parameters, in pure ASCII
718  char line[1024];
719  tmp = tokenizer.GetString();
720 
721  unsigned len = tmp.Length();
722 
723  if( len >= sizeof( line ) ) // Should not occur.
724  len = sizeof( line) - 1;
725 
726  strncpy( line, TO_UTF8( tmp ), len );
727  line[len] = 0;
728 
729  int cnt = sscanf( line, "%d %d %d %63s %d %d %d %d %63s %63s",
730  &m_position.x, &m_position.y, &m_length, pinOrient, &m_numTextSize,
731  &m_nameTextSize, &m_Unit, &m_Convert, pinType, pinAttrs );
732 
733  if( cnt != (prms_count - 2) )
734  {
735  aErrorMsg.Printf( wxT( "pin parameters read issue" ) );
736  return false;
737  }
738 
739  m_orientation = pinOrient[0] & 255;
740 
741  switch( *pinType & 255 )
742  {
743  case 'I':
744  m_type = PIN_INPUT;
745  break;
746 
747  case 'O':
748  m_type = PIN_OUTPUT;
749  break;
750 
751  case 'B':
752  m_type = PIN_BIDI;
753  break;
754 
755  case 'T':
757  break;
758 
759  case 'P':
761  break;
762 
763  case 'U':
765  break;
766 
767  case 'W':
769  break;
770 
771  case 'w':
773  break;
774 
775  case 'C':
777  break;
778 
779  case 'E':
781  break;
782 
783  case 'N':
784  m_type = PIN_NC;
785  break;
786 
787  default:
788  aErrorMsg.Printf( wxT( "unknown pin type [%c]" ), *pinType & 255 );
789  return false;
790  }
791 
792  if( prms_count >= 12 ) /* Special Symbol defined */
793  {
794  enum
795  {
796  INVERTED = 1 << 0,
797  CLOCK = 1 << 1,
798  LOWLEVEL_IN = 1 << 2,
799  LOWLEVEL_OUT = 1 << 3,
800  FALLING_EDGE = 1 << 4,
801  NONLOGIC = 1 << 5
802  };
803 
804  int flags = 0;
805 
806  for( int j = strlen( pinAttrs ); j > 0; )
807  {
808  switch( pinAttrs[--j] )
809  {
810  case '~':
811  break;
812 
813  case 'N':
815  break;
816 
817  case 'I':
818  flags |= INVERTED;
819  break;
820 
821  case 'C':
822  flags |= CLOCK;
823  break;
824 
825  case 'L':
826  flags |= LOWLEVEL_IN;
827  break;
828 
829  case 'V':
830  flags |= LOWLEVEL_OUT;
831  break;
832 
833  case 'F':
834  flags |= FALLING_EDGE;
835  break;
836 
837  case 'X':
838  flags |= NONLOGIC;
839  break;
840 
841  default:
842  aErrorMsg.Printf( wxT( "unknown pin attribute [%c]" ), pinAttrs[j] );
843  return false;
844  }
845  }
846 
847  switch( flags )
848  {
849  case 0:
851  break;
852 
853  case INVERTED:
855  break;
856 
857  case CLOCK:
859  break;
860 
861  case INVERTED | CLOCK:
863  break;
864 
865  case LOWLEVEL_IN:
867  break;
868 
869  case LOWLEVEL_IN | CLOCK:
871  break;
872 
873  case LOWLEVEL_OUT:
875  break;
876 
877  case FALLING_EDGE:
879  break;
880 
881  case NONLOGIC:
883  break;
884 
885  default:
886  aErrorMsg.Printf( wxT( "pin attributes do not give a valid pin shape [%s]" ), pinAttrs );
887  return false;
888  }
889  }
890 
891  return true;
892 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
int m_numTextSize
Definition: lib_pin.h:79
int m_Unit
Unit identification for multiple parts per package.
wxString m_name
Definition: lib_pin.h:77
int m_length
Length of the pin.
Definition: lib_pin.h:71
void SetNumber(const wxString &aNumber)
Set the pin number.
Definition: lib_pin.h:203
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
char * Line() const
Function Line returns a pointer to the last line that was read in.
Definition: richio.h:139
#define PIN_INVISIBLE
Definition: lib_pin.h:46
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:76
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
int m_Convert
Shape identification for alternate body styles.
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 2301 of file lib_pin.cpp.

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

2302 {
2303  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
2304 
2305  // Note: this will have to be modified if we add find and replace capability to the
2306  // compoment library editor. Otherwise, you wont be able to replace pin text.
2307  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
2308  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
2309  return false;
2310 
2311  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
2312 
2313  if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
2314  {
2315  if( aFindLocation )
2316  *aFindLocation = GetBoundingBox().Centre();
2317 
2318  return true;
2319  }
2320 
2321  return false;
2322 }
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:414
Search texts (name and number (a 4 letters text) )in pins.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
const wxString & GetName() const
Definition: lib_pin.h:163
const wxString traceFindItem
Flag to enable finding schematic item debug output.
wxString m_number
Definition: lib_pin.h:78
wxPoint Centre() const
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: lib_pin.cpp:2287
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:458
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

Function MirrorHorizontal mirrors the draw object along the horizontal (X) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1928 of file lib_pin.cpp.

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

1929 {
1930  m_position.x -= center.x;
1931  m_position.x *= -1;
1932  m_position.x += center.x;
1933 
1934  if( m_orientation == PIN_RIGHT )
1936  else if( m_orientation == PIN_LEFT )
1938 }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
void LIB_PIN::MirrorVertical ( const wxPoint aCenter)
overridevirtual

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

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1940 of file lib_pin.cpp.

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

1941 {
1942  m_position.y -= center.y;
1943  m_position.y *= -1;
1944  m_position.y += center.y;
1945 
1946  if( m_orientation == PIN_UP )
1948  else if( m_orientation == PIN_DOWN )
1950 }
Definition: lib_pin.h:55
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
void LIB_PIN::Move ( const wxPoint aPosition)
overridevirtual

Function Move moves a draw object to aPosition.

Parameters
aPositionPosition to move draw item to.

Implements LIB_ITEM.

Definition at line 1918 of file lib_pin.cpp.

References m_position, and EDA_ITEM::SetModified().

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

1919 {
1920  if( m_position != newPosition )
1921  {
1922  m_position = newPosition;
1923  SetModified();
1924  }
1925 }
void SetModified()
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 96 of file lib_draw_item.cpp.

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

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

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 87 of file lib_draw_item.cpp.

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

88 {
89  return ( ( Type() == aOther.Type() )
90  && ( m_Unit == aOther.m_Unit )
91  && ( m_Convert == aOther.m_Convert )
92  && compare( aOther ) == 0 );
93 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
int m_Unit
Unit identification for multiple parts per package.
virtual int compare(const LIB_ITEM &aOther) const =0
Function compare provides 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 277 of file lib_draw_item.h.

278  {
279  return *this == *aOther;
280  }
int LIB_PIN::PinDrawOrient ( const TRANSFORM aTransform) const

Function PinDrawOrient returns 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 1829 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().

1830 {
1831  int orient;
1832  wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
1833 
1834  switch( m_orientation )
1835  {
1836  case PIN_UP:
1837  end.y = 1;
1838  break;
1839 
1840  case PIN_DOWN:
1841  end.y = -1;
1842  break;
1843 
1844  case PIN_LEFT:
1845  end.x = -1;
1846  break;
1847 
1848  case PIN_RIGHT:
1849  end.x = 1;
1850  break;
1851  }
1852 
1853  // = pos of end point, according to the component orientation
1854  end = aTransform.TransformCoordinate( end );
1855  orient = PIN_UP;
1856 
1857  if( end.x == 0 )
1858  {
1859  if( end.y > 0 )
1860  orient = PIN_DOWN;
1861  }
1862  else
1863  {
1864  orient = PIN_RIGHT;
1865 
1866  if( end.x < 0 )
1867  orient = PIN_LEFT;
1868  }
1869 
1870  return orient;
1871 }
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:72
wxPoint LIB_PIN::PinEndPoint ( ) const

Function PinEndPoint.

Returns
The pin end position for a component in the normal orientation.

Definition at line 1802 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 Inside().

1803 {
1804  wxPoint pos = m_position;
1805 
1806  switch( m_orientation )
1807  {
1808  case PIN_UP:
1809  pos.y += m_length;
1810  break;
1811 
1812  case PIN_DOWN:
1813  pos.y -= m_length;
1814  break;
1815 
1816  case PIN_LEFT:
1817  pos.x -= m_length;
1818  break;
1819 
1820  case PIN_RIGHT:
1821  pos.x += m_length;
1822  break;
1823  }
1824 
1825  return pos;
1826 }
Definition: lib_pin.h:55
int m_length
Length of the pin.
Definition: lib_pin.h:71
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 2001 of file lib_pin.cpp.

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

2003 {
2004  if( ! IsVisible() )
2005  return;
2006 
2007  int orient = PinDrawOrient( aTransform );
2008 
2009  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
2010 
2011  PlotSymbol( plotter, pos, orient );
2012  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
2013  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
2014  GetPenSize() );
2015 }
void PlotPinTexts(PLOTTER *aPlotter, wxPoint &aPosition, int aOrientation, int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aWidth)
Function PlotPinTexts plots the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:1602
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
LIB_PART * GetParent() const
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:1451
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:360
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
int PinDrawOrient(const TRANSFORM &aTransform) const
Function PinDrawOrient returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform.
Definition: lib_pin.cpp:1829
void LIB_PIN::PlotPinTexts ( PLOTTER aPlotter,
wxPoint aPosition,
int  aOrientation,
int  aTextInside,
bool  aDrawPinNum,
bool  aDrawPinName,
int  aWidth 
)

Function PlotPinTexts plots 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 1602 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 Plot().

1605 {
1606  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1607  DrawPinName = false;
1608 
1609  if( m_number.IsEmpty() )
1610  DrawPinNum = false;
1611 
1612  if( !DrawPinNum && !DrawPinName )
1613  return;
1614 
1615  int x, y;
1616  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1617  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1618 
1619  int nameLineWidth = GetPenSize();
1620  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1621  int numLineWidth = GetPenSize();
1622  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1623 
1624  int name_offset = PIN_TEXT_MARGIN +
1625  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1626  int num_offset = PIN_TEXT_MARGIN +
1627  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1628 
1629  /* Get the num and name colors */
1630  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1631  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1632 
1633  int x1 = pin_pos.x;
1634  int y1 = pin_pos.y;
1635 
1636  switch( orient )
1637  {
1638  case PIN_UP:
1639  y1 -= m_length;
1640  break;
1641 
1642  case PIN_DOWN:
1643  y1 += m_length;
1644  break;
1645 
1646  case PIN_LEFT:
1647  x1 -= m_length;
1648  break;
1649 
1650  case PIN_RIGHT:
1651  x1 += m_length;
1652  break;
1653  }
1654 
1655  /* Draw the text inside, but the pin numbers outside. */
1656  if( TextInside )
1657  {
1658  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1659  {
1660  if( DrawPinName )
1661  {
1662  if( orient == PIN_RIGHT )
1663  {
1664  x = x1 + TextInside;
1665  plotter->Text( wxPoint( x, y1 ), NameColor,
1666  m_name,
1668  PinNameSize,
1671  aWidth, false, false );
1672  }
1673  else // orient == PIN_LEFT
1674  {
1675  x = x1 - TextInside;
1676 
1677  if( DrawPinName )
1678  plotter->Text( wxPoint( x, y1 ),
1679  NameColor, m_name, TEXT_ANGLE_HORIZ,
1680  PinNameSize,
1683  aWidth, false, false );
1684  }
1685  }
1686  if( DrawPinNum )
1687  {
1688  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1689  y1 - num_offset ),
1690  NumColor, m_number,
1691  TEXT_ANGLE_HORIZ, PinNumSize,
1694  aWidth, false, false );
1695  }
1696  }
1697  else /* Its a vertical line. */
1698  {
1699  if( orient == PIN_DOWN )
1700  {
1701  y = y1 + TextInside;
1702 
1703  if( DrawPinName )
1704  plotter->Text( wxPoint( x1, y ), NameColor,
1705  m_name,
1706  TEXT_ANGLE_VERT, PinNameSize,
1709  aWidth, false, false );
1710 
1711  if( DrawPinNum )
1712  {
1713  plotter->Text( wxPoint( x1 - num_offset,
1714  (y1 + pin_pos.y) / 2 ),
1715  NumColor, m_number,
1716  TEXT_ANGLE_VERT, PinNumSize,
1719  aWidth, false, false );
1720  }
1721  }
1722  else /* PIN_UP */
1723  {
1724  y = y1 - TextInside;
1725 
1726  if( DrawPinName )
1727  plotter->Text( wxPoint( x1, y ), NameColor,
1728  m_name,
1729  TEXT_ANGLE_VERT, PinNameSize,
1732  aWidth, false, false );
1733 
1734  if( DrawPinNum )
1735  {
1736  plotter->Text( wxPoint( x1 - num_offset,
1737  (y1 + pin_pos.y) / 2 ),
1738  NumColor, m_number,
1739  TEXT_ANGLE_VERT, PinNumSize,
1742  aWidth, false, false );
1743  }
1744  }
1745  }
1746  }
1747  else /* Draw num & text pin outside */
1748  {
1749  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1750  {
1751  /* Its an horizontal line. */
1752  if( DrawPinName )
1753  {
1754  x = (x1 + pin_pos.x) / 2;
1755  plotter->Text( wxPoint( x, y1 - name_offset ),
1756  NameColor, m_name,
1757  TEXT_ANGLE_HORIZ, PinNameSize,
1760  aWidth, false, false );
1761  }
1762 
1763  if( DrawPinNum )
1764  {
1765  x = ( x1 + pin_pos.x ) / 2;
1766  plotter->Text( wxPoint( x, y1 + num_offset ),
1767  NumColor, m_number,
1768  TEXT_ANGLE_HORIZ, PinNumSize,
1771  aWidth, false, false );
1772  }
1773  }
1774  else /* Its a vertical line. */
1775  {
1776  if( DrawPinName )
1777  {
1778  y = ( y1 + pin_pos.y ) / 2;
1779  plotter->Text( wxPoint( x1 - name_offset, y ),
1780  NameColor, m_name,
1781  TEXT_ANGLE_VERT, PinNameSize,
1784  aWidth, false, false );
1785  }
1786 
1787  if( DrawPinNum )
1788  {
1789  plotter->Text( wxPoint( x1 + num_offset,
1790  ( y1 + pin_pos.y ) / 2 ),
1791  NumColor, m_number,
1792  TEXT_ANGLE_VERT, PinNumSize,
1795  aWidth, false, false );
1796  }
1797  }
1798  }
1799 }
#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:90
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
int m_numTextSize
Definition: lib_pin.h:79
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
wxString m_name
Definition: lib_pin.h:77
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:71
#define TEXT_ANGLE_VERT
Definition: common.h:91
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
wxString m_number
Definition: lib_pin.h:78
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...
Definition: drawtxt.cpp:67
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:61
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 1451 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 Plot().

1452 {
1453  int MapX1, MapY1, x1, y1;
1455 
1456  aPlotter->SetColor( color );
1457  aPlotter->SetCurrentLineWidth( GetPenSize() );
1458 
1459  MapX1 = MapY1 = 0;
1460  x1 = aPosition.x; y1 = aPosition.y;
1461 
1462  switch( aOrientation )
1463  {
1464  case PIN_UP:
1465  y1 = aPosition.y - m_length;
1466  MapY1 = 1;
1467  break;
1468 
1469  case PIN_DOWN:
1470  y1 = aPosition.y + m_length;
1471  MapY1 = -1;
1472  break;
1473 
1474  case PIN_LEFT:
1475  x1 = aPosition.x - m_length;
1476  MapX1 = 1;
1477  break;
1478 
1479  case PIN_RIGHT:
1480  x1 = aPosition.x + m_length;
1481  MapX1 = -1;
1482  break;
1483  }
1484 
1486  {
1487  const int radius = ExternalPinDecoSize( *this );
1488  aPlotter->Circle( wxPoint( MapX1 * radius + x1,
1489  MapY1 * radius + y1 ),
1490  radius * 2, // diameter
1491  NO_FILL, // fill option
1492  GetPenSize() ); // width
1493 
1494  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1,
1495  MapY1 * radius * 2 + y1 ) );
1496  aPlotter->FinishTo( aPosition );
1497  }
1498  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
1499  {
1500  const int clock_size = InternalPinDecoSize( *this );
1501  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1502  {
1503  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1504  aPlotter->LineTo( wxPoint( x1 + MapX1 * clock_size * 2, y1 ) );
1505  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1506  }
1507  else /* MapX1 = 0 */
1508  {
1509  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1510  aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * clock_size * 2 ) );
1511  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1512  }
1513 
1514  aPlotter->MoveTo( wxPoint( MapX1 * clock_size * 2 + x1,
1515  MapY1 * clock_size * 2 + y1 ) );
1516  aPlotter->FinishTo( aPosition );
1517  }
1518  else
1519  {
1520  aPlotter->MoveTo( wxPoint( x1, y1 ) );
1521  aPlotter->FinishTo( aPosition );
1522  }
1523 
1526  {
1527  const int clock_size = InternalPinDecoSize( *this );
1528  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1529  {
1530  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1531  aPlotter->LineTo( wxPoint( x1 - MapX1 * clock_size * 2, y1 ) );
1532  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1533  }
1534  else /* MapX1 = 0 */
1535  {
1536  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1537  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * clock_size * 2 ) );
1538  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1539  }
1540  }
1541 
1542  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
1543  {
1544  const int symbol_size = ExternalPinDecoSize( *this );
1545 
1546  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1547  {
1548  aPlotter->MoveTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1549  aPlotter->LineTo( wxPoint( x1 + MapX1 * symbol_size * 2,
1550  y1 - symbol_size * 2 ) );
1551  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1552  }
1553  else /* MapX1 = 0 */
1554  {
1555  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1556  aPlotter->LineTo( wxPoint( x1 - symbol_size * 2,
1557  y1 + MapY1 * symbol_size * 2 ) );
1558  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1559  }
1560  }
1561 
1562 
1563  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1564  {
1565  const int symbol_size = ExternalPinDecoSize( *this );
1566 
1567  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1568  {
1569  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1570  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1571  }
1572  else /* MapX1 = 0 */
1573  {
1574  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1575  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1576  }
1577  }
1578  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1579  {
1580  const int symbol_size = ExternalPinDecoSize( *this );
1581  aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * symbol_size,
1582  y1 - (MapY1 - MapX1) * symbol_size ) );
1583  aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * symbol_size,
1584  y1 + (MapY1 - MapX1) * symbol_size ) );
1585  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * symbol_size,
1586  y1 - (MapY1 + MapX1) * symbol_size ) );
1587  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * symbol_size,
1588  y1 + (MapY1 + MapX1) * symbol_size ) );
1589  }
1590  if( m_type == PIN_NC ) // Draw a N.C. symbol
1591  {
1592  const int ex1 = aPosition.x;
1593  const int ey1 = aPosition.y;
1594  aPlotter->MoveTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1595  aPlotter->FinishTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1596  aPlotter->MoveTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1597  aPlotter->FinishTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1598  }
1599 }
void FinishTo(const wxPoint &pos)
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:140
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
virtual void SetColor(COLOR4D color)=0
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:71
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:895
void LineTo(const wxPoint &pos)
static int InternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
Definition: lib_pin.cpp:131
void MoveTo(const wxPoint &pos)
#define NCSYMB_PIN_DIM
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
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(), and EDA_ITEM::IsReplaceable().

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

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

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

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

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

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 446 of file base_struct.h.

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

Rotate the draw item.

Reimplemented from LIB_ITEM.

Definition at line 2247 of file lib_pin.cpp.

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

2248 {
2249  int orient = PIN_RIGHT;
2250 
2251  switch( GetOrientation() )
2252  {
2253  case PIN_UP:
2254  orient = PIN_LEFT;
2255  break;
2256 
2257  case PIN_DOWN:
2258  orient = PIN_RIGHT;
2259  break;
2260 
2261  case PIN_LEFT:
2262  orient = PIN_DOWN;
2263  break;
2264 
2265  case PIN_RIGHT:
2266  orient = PIN_UP;
2267  break;
2268  }
2269 
2270  // Set the new orientation
2271  SetOrientation( orient );
2272 }
Definition: lib_pin.h:55
int GetOrientation() const
Definition: lib_pin.h:221
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
Definition: lib_pin.cpp:248
void LIB_PIN::Rotate ( const wxPoint aCenter,
bool  aRotateCCW = true 
)
overridevirtual

Function Rotate rotates 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 1952 of file lib_pin.cpp.

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

1953 {
1954  int rot_angle = aRotateCCW ? -900 : 900;
1955 
1956  RotatePoint( &m_position, center, rot_angle );
1957 
1958  if( aRotateCCW )
1959  {
1960  switch( m_orientation )
1961  {
1962  case PIN_RIGHT:
1964  break;
1965 
1966  case PIN_UP:
1968  break;
1969  case PIN_LEFT:
1971  break;
1972 
1973  case PIN_DOWN:
1975  break;
1976  }
1977  }
1978  else
1979  {
1980  switch( m_orientation )
1981  {
1982  case PIN_RIGHT:
1984  break;
1985 
1986  case PIN_UP:
1988  break;
1989  case PIN_LEFT:
1991  break;
1992 
1993  case PIN_DOWN:
1995  break;
1996  }
1997  }
1998 }
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:72
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
bool LIB_PIN::Save ( OUTPUTFORMATTER aFormatter)
overridevirtual

Function Save writes draw item object to aFormatter in component library "*.lib" format.

Parameters
aFormatterA reference to an OUTPUTFORMATTER object to write the component library item to.
Returns
True if success writing else false.

Implements LIB_ITEM.

Definition at line 543 of file lib_pin.cpp.

References EDA_ITEM::ClearFlags(), IS_CHANGED, IsVisible(), LIB_ITEM::m_Convert, m_length, m_name, m_nameTextSize, m_number, m_numTextSize, m_orientation, m_position, m_shape, m_type, LIB_ITEM::m_Unit, PIN_BIDI, PIN_INPUT, PIN_NC, PIN_OPENCOLLECTOR, PIN_OPENEMITTER, PIN_OUTPUT, PIN_PASSIVE, PIN_POWER_IN, PIN_POWER_OUT, PIN_TRISTATE, PIN_UNSPECIFIED, PINSHAPE_CLOCK, PINSHAPE_CLOCK_LOW, PINSHAPE_FALLING_EDGE_CLOCK, PINSHAPE_INPUT_LOW, PINSHAPE_INVERTED, PINSHAPE_INVERTED_CLOCK, PINSHAPE_LINE, PINSHAPE_NONLOGIC, PINSHAPE_OUTPUT_LOW, OUTPUTFORMATTER::Print(), TO_UTF8, wxPoint::x, and wxPoint::y.

544 {
545  int Etype;
546 
547  switch( m_type )
548  {
549  default:
550  case PIN_INPUT:
551  Etype = 'I';
552  break;
553 
554  case PIN_OUTPUT:
555  Etype = 'O';
556  break;
557 
558  case PIN_BIDI:
559  Etype = 'B';
560  break;
561 
562  case PIN_TRISTATE:
563  Etype = 'T';
564  break;
565 
566  case PIN_PASSIVE:
567  Etype = 'P';
568  break;
569 
570  case PIN_UNSPECIFIED:
571  Etype = 'U';
572  break;
573 
574  case PIN_POWER_IN:
575  Etype = 'W';
576  break;
577 
578  case PIN_POWER_OUT:
579  Etype = 'w';
580  break;
581 
582  case PIN_OPENCOLLECTOR:
583  Etype = 'C';
584  break;
585 
586  case PIN_OPENEMITTER:
587  Etype = 'E';
588  break;
589 
590  case PIN_NC:
591  Etype = 'N';
592  break;
593  }
594 
595  if( !m_name.IsEmpty() )
596  {
597  if( aFormatter.Print( 0, "X %s", TO_UTF8( m_name ) ) < 0 )
598  return false;
599  }
600  else
601  {
602  if( aFormatter.Print( 0, "X ~" ) < 0 )
603  return false;
604  }
605 
606  if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
607  m_number.IsEmpty() ? "~" : TO_UTF8( m_number ),
610  m_Unit, m_Convert, Etype ) < 0 )
611  return false;
612 
613  if( m_shape || !IsVisible() )
614  {
615  if( aFormatter.Print( 0, " " ) < 0 )
616  return false;
617  }
618 
619  if( !IsVisible() && aFormatter.Print( 0, "N" ) < 0 )
620  return false;
621 
622  switch( m_shape )
623  {
624  case PINSHAPE_LINE:
625  break;
626 
627  case PINSHAPE_INVERTED:
628  if( aFormatter.Print( 0, "I" ) < 0 )
629  return false;
630  break;
631 
632  case PINSHAPE_CLOCK:
633  if( aFormatter.Print( 0, "C" ) < 0 )
634  return false;
635  break;
636 
638  if( aFormatter.Print( 0, "IC" ) < 0 )
639  return false;
640  break;
641 
642  case PINSHAPE_INPUT_LOW:
643  if( aFormatter.Print( 0, "L" ) < 0 )
644  return false;
645  break;
646 
647  case PINSHAPE_CLOCK_LOW:
648  if( aFormatter.Print( 0, "CL" ) < 0 )
649  return false;
650  break;
651 
652  case PINSHAPE_OUTPUT_LOW:
653  if( aFormatter.Print( 0, "V" ) < 0 )
654  return false;
655  break;
656 
658  if( aFormatter.Print( 0, "F" ) < 0 )
659  return false;
660  break;
661 
662  case PINSHAPE_NONLOGIC:
663  if( aFormatter.Print( 0, "X" ) < 0 )
664  return false;
665  break;
666 
667  default:
668  assert( !"Invalid pin shape" );
669  return false;
670  }
671 
672  if( aFormatter.Print( 0, "\n" ) < 0 )
673  return false;
674 
676 
677  return true;
678 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:80
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:73
int m_numTextSize
Definition: lib_pin.h:79
int m_Unit
Unit identification for multiple parts per package.
wxString m_name
Definition: lib_pin.h:77
int m_length
Length of the pin.
Definition: lib_pin.h:71
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
wxString m_number
Definition: lib_pin.h:78
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:360
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:75
int m_Convert
Shape identification for alternate body styles.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 226 of file base_struct.h.

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

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

Definition at line 243 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

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

430 {
431  if( m_Convert == style )
432  return;
433 
434  m_Convert = style;
435  SetFlags( IS_CHANGED );
436 
437  if( style == 0 )
438  {
439  LIB_PIN* pin;
440  LIB_PIN* tmp = GetParent()->GetNextPin();
441 
442  while( tmp != NULL )
443  {
444  pin = tmp;
445  tmp = GetParent()->GetNextPin( pin );
446 
447  if( ( pin->m_Flags & IS_LINKED ) == 0
448  || ( pin == this )
449  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
450  || ( m_position != pin->m_position )
451  || ( pin->m_orientation != m_orientation ) )
452  continue;
453 
454  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
455  }
456  }
457 }
#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.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
#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:267
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:70
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 405 of file lib_draw_item.h.

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

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

Definition at line 409 of file lib_draw_item.h.

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

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

Definition at line 267 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::EditDimension(), EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), 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(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

267 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 279 of file base_struct.h.

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

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

Definition at line 242 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

242 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void 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 342 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(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

343 {
344  if( m_length != length )
345  {
346  m_length = length;
347  SetModified();
348  }
349 
350  if( !aTestOtherPins )
351  return;
352 
353  if( GetParent() == NULL )
354  return;
355 
356  LIB_PINS pinList;
357  GetParent()->GetPins( pinList );
358 
359  for( size_t i = 0; i < pinList.size(); i++ )
360  {
361  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
362  || pinList[i]->m_Convert != m_Convert
363  || pinList[i]->m_length == length )
364  continue;
365 
366  pinList[i]->m_length = length;
367  SetModified();
368  }
369 }
#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:71
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:189
int m_Convert
Shape identification for alternate body styles.
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

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

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

Definition at line 102 of file base_struct.cpp.

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

Referenced by SCH_COMPONENT::ClearAnnotation(), 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(), 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:182
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void 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 LIB_EDIT_FRAME::OnEditPin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and LIB_EDIT_FRAME::RepeatPinItem().

161 {
162  wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
163 
164  tmp.Replace( wxT( " " ), wxT( "_" ) );
165 
166  if( m_name != tmp )
167  {
168  m_name = tmp;
169  SetModified();
170  }
171 
172  if( !aTestOtherPins )
173  return;
174 
175  if( GetParent() == NULL )
176  return;
177 
178  LIB_PINS pinList;
179  GetParent()->GetPins( pinList );
180 
181  for( size_t i = 0; i < pinList.size(); i++ )
182  {
183  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_name == m_name )
184  continue;
185 
186  pinList[i]->m_name = m_name;
187  SetModified();
188  }
189 }
#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:77
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:189
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 192 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(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

193 {
194  if( size != m_nameTextSize )
195  {
196  m_nameTextSize = size;
197  SetModified();
198  }
199 
200  if( !aTestOtherPins )
201  return;
202 
203  if( GetParent() == NULL )
204  return;
205 
206  LIB_PINS pinList;
207  GetParent()->GetPins( pinList );
208 
209  for( size_t i = 0; i < pinList.size(); i++ )
210  {
211  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
212  continue;
213 
214  pinList[i]->m_nameTextSize = size;
215  SetModified();
216  }
217 }
#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:80
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:189
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 225 of file base_struct.h.

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

225 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
void LIB_PIN::SetNumber ( const wxString &  aNumber)
inline

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 203 of file lib_pin.h.

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

204  {
205  m_number = aNumber;
206  }
wxString m_number
Definition: lib_pin.h:78
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 220 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(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

221 {
222  if( size != m_numTextSize )
223  {
224  m_numTextSize = size;
225  SetModified();
226  }
227 
228  if( !aTestOtherPins )
229  return;
230 
231  if( GetParent() == NULL )
232  return;
233 
234  LIB_PINS pinList;
235  GetParent()->GetPins( pinList );
236 
237  for( size_t i = 0; i < pinList.size(); i++ )
238  {
239  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
240  continue;
241 
242  pinList[i]->m_numTextSize = size;
243  SetModified();
244  }
245 }
#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:79
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:189
void LIB_PIN::SetOffset ( const wxPoint aOffset)
overridevirtual

Function Offset sets the drawing object by aOffset from the current position.

Parameters
aOffsetCoordinates to offset the item position.

Implements LIB_ITEM.

Definition at line 1904 of file lib_pin.cpp.

References m_position.

1905 {
1906  m_position += aOffset;
1907 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:70
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 248 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(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), and Rotate().

249 {
250  if( m_orientation != orientation )
251  {
252  m_orientation = orientation;
253  SetModified();
254  }
255 
256  if( !aTestOtherPins )
257  return;
258 
259  if( GetParent() == NULL )
260  return;
261 
262  LIB_PINS pinList;
263  GetParent()->GetPins( pinList );
264 
265  for( size_t i = 0; i < pinList.size(); i++ )
266  {
267  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
268  pinList[i]->m_orientation == orientation )
269  continue;
270 
271  pinList[i]->m_orientation = orientation;
272  SetModified();
273  }
274 }
#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:72
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:189
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 227 of file base_struct.h.

Referenced by MODULE::Add(), BOARD::Add(), BOARD_NETLIST_UPDATER::addNewComponent(), LIB_FIELD::Copy(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateSheet(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), 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().

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

400 {
401  if( m_Unit == part )
402  return;
403 
404  m_Unit = part;
405  SetModified();
406 
407  if( m_Unit == 0 )
408  {
409  LIB_PIN* pin;
410  LIB_PIN* tmp = GetParent()->GetNextPin();
411 
412  while( tmp != NULL )
413  {
414  pin = tmp;
415  tmp = GetParent()->GetNextPin( pin );
416 
417  if( pin->m_Flags == 0 || pin == this
418  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
419  || ( m_position != pin->m_position )
420  || ( pin->m_orientation != m_orientation ) )
421  continue;
422 
423  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
424  }
425  }
426 }
void SetModified()
int m_Unit
Unit identification for multiple parts per package.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:72
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:70
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 372 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 LIB_EDIT_FRAME::OnEditPin().

373 {
374  if( m_position != aPosition )
375  {
376  m_position = aPosition;
377  SetModified();
378  }
379 
380  if( GetParent() == NULL )
381  return;
382 
383  LIB_PINS pinList;
384  GetParent()->GetPins( pinList );
385 
386  for( size_t i = 0; i < pinList.size(); i++ )
387  {
388  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
389  || pinList[i]->m_Convert != m_Convert
390  || pinList[i]->m_position == aPosition )
391  continue;
392 
393  pinList[i]->m_position = aPosition;
394  SetModified();
395  }
396 }
#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:70
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:189
int m_Convert
Shape identification for alternate body styles.
void LIB_ITEM::SetPosition ( const wxPoint aPosition)
inlineinherited

Definition at line 323 of file lib_draw_item.h.

References LIB_ITEM::Move().

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

Definition at line 241 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().

241 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
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 277 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(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

278 {
279  assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
280 
281  if( m_shape != aShape )
282  {
283  m_shape = aShape;
284  SetModified();
285  }
286 
287  if( GetParent() == NULL )
288  return;
289 
290  LIB_PINS pinList;
291  GetParent()->GetPins( pinList );
292 
293  for( size_t i = 0; i < pinList.size(); i++ )
294  {
295  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
296  || pinList[i]->m_Convert != m_Convert
297  || pinList[i]->m_shape == aShape )
298  continue;
299 
300  pinList[i]->m_shape = aShape;
301  SetModified();
302  }
303 }
#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:73
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:189
int m_Convert
Shape identification for alternate body styles.
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
void EDA_ITEM::SetTimeStamp ( time_t  aNewTimeStamp)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::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(), PCB_IO::FootprintSave(), DIALOG_MODULE_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(), 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().

217 { m_TimeStamp = aNewTimeStamp; }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
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 306 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(), LIB_EDIT_FRAME::OnEditPin(), and DIALOG_LIB_EDIT_PIN::OnPropertiesChange().

307 {
308  assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
309 
310  if( aType < PIN_INPUT )
311  aType = PIN_INPUT;
312 
313  if( aType >