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)
 Set the pin name. More...
 
void SetNameTextSize (int aSize)
 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)
 Set the size of the pin number text. More...
 
int GetNumberTextSize () const
 
int GetOrientation () const
 
void SetOrientation (int aOrientation)
 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)
 Set the electrical type of the pin. More...
 
void SetLength (int aLength)
 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 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 67 of file lib_pin.h.

Constructor & Destructor Documentation

LIB_PIN::LIB_PIN ( LIB_PART aParent)

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

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

Definition at line 105 of file lib_pin.h.

105 { }

Member Function Documentation

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 207 of file base_struct.h.

References EDA_ITEM::Pback.

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

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

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

Definition at line 254 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(), SCH_EDIT_FRAME::AppendOneEEProject(), 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(), LIB_PART::CopySelectedItems(), 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_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), 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().

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

Definition at line 232 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

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

Definition at line 231 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), EDIT_TOOL::Duplicate(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unselectVisually(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

231 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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 1855 of file lib_pin.cpp.

References LIB_PIN().

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

1856 {
1857  return new LIB_PIN( *this );
1858 }
LIB_PIN(LIB_PART *aParent)
Definition: lib_pin.cpp:144
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 1861 of file lib_pin.cpp.

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

1862 {
1863  wxASSERT( other.Type() == LIB_PIN_T );
1864 
1865  const LIB_PIN* tmp = (LIB_PIN*) &other;
1866 
1867  if( m_number != tmp->m_number )
1868  return m_number.Cmp( tmp->m_number );
1869 
1870  int result = m_name.CmpNoCase( tmp->m_name );
1871 
1872  if( result != 0 )
1873  return result;
1874 
1875  if( m_position.x != tmp->m_position.x )
1876  return m_position.x - tmp->m_position.x;
1877 
1878  if( m_position.y != tmp->m_position.y )
1879  return m_position.y - tmp->m_position.y;
1880 
1881  return 0;
1882 }
wxString m_name
Definition: lib_pin.h:76
wxString m_number
Definition: lib_pin.h:77
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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(), 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:290
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:56
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 882 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().

889 {
890  // aData is used here as a bitfield of flags.
891  uintptr_t flags = (uintptr_t) aData;
892  bool drawPinText = flags & PIN_DRAW_TEXTS;
893  bool drawPinDangling = flags & PIN_DRAW_DANGLING;
894  bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
895  bool drawElectricalTypeName = flags & PIN_DRAW_ELECTRICAL_TYPE_NAME;
896 
897  LIB_PART* Entry = GetParent();
898 
899  /* Calculate pin orient taking in account the component orientation. */
900  int orient = PinDrawOrient( aTransform );
901 
902  /* Calculate the pin position */
903  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
904 
905  // Invisible pins are only drawn on request.
906  // They are drawn in GetInvisibleItemColor().
907  // in schematic, they are drawn only if m_showAllPins is true.
908  // In other windows, they are always drawn because we must see them.
909  if( ! IsVisible() )
910  {
911  EDA_DRAW_FRAME* frame = NULL;
912 
913  if( aPanel && aPanel->GetParent() )
914  frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
915 
916  if( frame && frame->IsType( FRAME_SCH ) &&
917  ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
918  {
919  if( drawPinDangling && drawDanglingHidden )
920  {
921  // Draw the target
922  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
923  /* aOnlyTarget */ true );
924  }
925  return;
926  }
927 
928  aColor = GetInvisibleItemColor();
929  }
930 
931  /* Drawing from the pin and the special symbol combination */
932  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
933 
934  if( drawPinText )
935  {
936  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
937  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
938  aColor, aDrawMode );
939  }
940 
941  if( drawElectricalTypeName )
942  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
943 
944 
945  /* Set to one (1) to draw bounding box around pin to validate bounding
946  * box calculation. */
947 #if 0
948  EDA_RECT bBox = GetBoundingBox();
949  bBox.RevertYAxis();
950  bBox = aTransform.TransformCoordinate( bBox );
951  bBox.Move( aOffset );
952  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
953 #endif
954 }
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:1370
int GetPinNameOffset()
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:137
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
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:1077
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:175
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:353
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:1156
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
Class EDA_RECT handles the component boundary box.
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:217
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:957
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:1810
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 1370 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().

1373 {
1374  wxString etypeName = GetElectricalTypeName();
1375 
1376  // Use a reasonable (small) size to draw the text
1377  int etextSize = (m_nameTextSize*3)/4;
1378 
1379  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
1380  if( etextSize > ETXT_MAX_SIZE )
1381  etextSize = ETXT_MAX_SIZE;
1382 
1383  // Use a reasonable pen size to draw the text
1384  int pensize = etextSize/6;
1385 
1386  // Get a suitable color
1387  if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
1388  aColor = GetItemSelectedColor();
1389  else if( !IsVisible() )
1390  aColor = GetInvisibleItemColor();
1391  else
1392  aColor = GetLayerColor( LAYER_NOTES );
1393 
1394  wxPoint txtpos = aPosition;
1395  int offset = Millimeter2iu( 0.4 );
1397  int orient = TEXT_ANGLE_HORIZ;
1398 
1399  switch( aOrientation )
1400  {
1401  case PIN_UP:
1402  txtpos.y += offset;
1403  orient = TEXT_ANGLE_VERT;
1404  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1405  break;
1406 
1407  case PIN_DOWN:
1408  txtpos.y -= offset;
1409  orient = TEXT_ANGLE_VERT;
1410  break;
1411 
1412  case PIN_LEFT:
1413  txtpos.x += offset;
1414  break;
1415 
1416  case PIN_RIGHT:
1417  txtpos.x -= offset;
1418  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1419  break;
1420  }
1421 
1422  GRSetDrawMode( aDC, aDrawMode );
1423  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
1424 
1425  DrawGraphicText( clipbox, aDC, txtpos, aColor, etypeName,
1426  orient, wxSize( etextSize, etextSize ),
1427  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize,
1428  false, false );
1429 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
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:290
#define ETXT_MAX_SIZE
bool IsSelected() const
Definition: base_struct.h:221
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:270
Definition: lib_pin.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
#define TEXT_ANGLE_VERT
Definition: common.h:92
COLOR4D GetInvisibleItemColor()
EDA_RECT * GetClipBox()
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:353
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 957 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().

965 {
966  int MapX1, MapY1, x1, y1;
967  int width = GetPenSize();
968  int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
969  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
970 
972 
973  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
974  {
975  if( IsSelected() )
976  color = GetItemSelectedColor();
977  }
978  else
979  color = aColor;
980 
981  GRSetDrawMode( aDC, aDrawMode );
982 
983  MapX1 = MapY1 = 0;
984  x1 = posX;
985  y1 = posY;
986 
987  switch( aOrient )
988  {
989  case PIN_UP:
990  y1 = posY - len;
991  MapY1 = 1;
992  break;
993 
994  case PIN_DOWN:
995  y1 = posY + len;
996  MapY1 = -1;
997  break;
998 
999  case PIN_LEFT:
1000  x1 = posX - len;
1001  MapX1 = 1;
1002  break;
1003 
1004  case PIN_RIGHT:
1005  x1 = posX + len;
1006  MapX1 = -1;
1007  break;
1008  }
1009 
1010  // Draw the pin end target (active end of the pin)
1011  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
1012  #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
1013 
1014  // Draw but do not print the pin end target 1 pixel width
1015  if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
1016  {
1017  if( aDrawDangling )
1018  GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
1019  }
1020 
1021  if( aOnlyTarget )
1022  return;
1023 
1024 
1026  {
1027  const int radius = ExternalPinDecoSize( *this );
1028  GRCircle( clipbox, aDC, MapX1 * radius + x1,
1029  MapY1 * radius + y1,
1030  radius, width, color );
1031 
1032  GRMoveTo( MapX1 * radius * 2 + x1,
1033  MapY1 * radius * 2 + y1 );
1034  GRLineTo( clipbox, aDC, posX, posY, width, color );
1035  }
1036  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
1037  {
1038  const int clock_size = InternalPinDecoSize( *this );
1039  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1040  {
1041  GRMoveTo( x1, y1 + clock_size );
1042  GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
1043  width, color );
1044  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
1045  }
1046  else /* MapX1 = 0 */
1047  {
1048  GRMoveTo( x1 + clock_size, y1 );
1049  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
1050  width, color );
1051  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1052  width, color );
1053  }
1054  GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
1055  GRLineTo( clipbox, aDC, posX, posY, width, color );
1056  }
1057  else
1058  {
1059  GRMoveTo( x1, y1 );
1060  GRLineTo( clipbox, aDC, posX, posY, width, color );
1061  }
1062 
1064  {
1065  const int clock_size = InternalPinDecoSize( *this );
1066  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1067  {
1068  GRMoveTo( x1, y1 + clock_size );
1069  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1,
1070  width, color );
1071  GRLineTo( clipbox, aDC, x1, y1 - clock_size,
1072  width, color );
1073  }
1074  else /* MapX1 = 0 */
1075  {
1076  GRMoveTo( x1 + clock_size, y1 );
1077  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2,
1078  width, color );
1079  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1080  width, color );
1081  }
1082  }
1083 
1085  {
1086  const int symbol_size = ExternalPinDecoSize( *this );
1087  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1088  {
1089  GRMoveTo( x1 + MapX1 * symbol_size * 2, y1 );
1090  GRLineTo( clipbox, aDC,
1091  x1 + MapX1 * symbol_size * 2, y1 - symbol_size * 2,
1092  width, color );
1093  GRLineTo( clipbox, aDC, x1, y1, width, color );
1094  }
1095  else /* MapX1 = 0 */
1096  {
1097  GRMoveTo( x1, y1 + MapY1 * symbol_size * 2 );
1098  GRLineTo( clipbox, aDC, x1 - symbol_size * 2,
1099  y1 + MapY1 * symbol_size * 2, width, color );
1100  GRLineTo( clipbox, aDC, x1, y1, width, color );
1101  }
1102  }
1103 
1104 
1105  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1106  {
1107  const int symbol_size = ExternalPinDecoSize( *this );
1108  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1109  {
1110  GRMoveTo( x1, y1 - symbol_size * 2 );
1111  GRLineTo( clipbox,
1112  aDC,
1113  x1 + MapX1 * symbol_size * 2,
1114  y1,
1115  width,
1116  color );
1117  }
1118  else /* MapX1 = 0 */
1119  {
1120  GRMoveTo( x1 - symbol_size * 2, y1 );
1121  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * symbol_size * 2,
1122  width, color );
1123  }
1124  }
1125  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1126  {
1127  const int symbol_size = ExternalPinDecoSize( *this );
1128  GRMoveTo( x1 - (MapX1 + MapY1) * symbol_size,
1129  y1 - (MapY1 - MapX1) * symbol_size );
1130  GRLineTo( clipbox, aDC,
1131  x1 + (MapX1 + MapY1) * symbol_size,
1132  y1 + (MapY1 - MapX1) * symbol_size,
1133  width, color );
1134  GRMoveTo( x1 - (MapX1 - MapY1) * symbol_size,
1135  y1 - (MapY1 + MapX1) * symbol_size );
1136  GRLineTo( clipbox, aDC,
1137  x1 + (MapX1 - MapY1) * symbol_size,
1138  y1 + (MapY1 + MapX1) * symbol_size,
1139  width, color );
1140  }
1141 
1142  if( m_type == PIN_NC ) // Draw a N.C. symbol
1143  {
1144  GRLine( clipbox, aDC,
1145  posX - NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1146  posX + NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1147  width, color );
1148  GRLine( clipbox, aDC,
1149  posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1150  posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1151  width, color );
1152  }
1153 }
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:139
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
bool IsSelected() const
Definition: base_struct.h:221
Definition: lib_pin.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:70
void GRLineTo(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int width, COLOR4D Color)
Definition: gr_basic.cpp:401
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:876
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 GRMoveTo(int x, int y)
Definition: gr_basic.cpp:391
#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:791
Class EDA_RECT handles the component boundary box.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:42
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
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 1156 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().

1165 {
1166  if( !DrawPinName && !DrawPinNum )
1167  return;
1168 
1169  int x, y;
1170 
1171  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
1172  wxSize PinNumSize( m_numTextSize, m_numTextSize );
1173 
1174  int nameLineWidth = GetPenSize();
1175 
1176  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1177  int numLineWidth = GetPenSize();
1178  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1179 
1180  int name_offset = PIN_TEXT_MARGIN +
1181  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1182  int num_offset = PIN_TEXT_MARGIN +
1183  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1184 
1185  GRSetDrawMode( DC, DrawMode );
1186  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
1187 
1188  /* Get the num and name colors */
1189  if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
1190  Color = GetItemSelectedColor();
1191 
1192  COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
1193  GetLayerColor( LAYER_PINNAM ) : Color;
1194  COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
1195  GetLayerColor( LAYER_PINNUM ) : Color;
1196 
1197  int x1 = pin_pos.x;
1198  int y1 = pin_pos.y;
1199 
1200  switch( orient )
1201  {
1202  case PIN_UP:
1203  y1 -= m_length;
1204  break;
1205 
1206  case PIN_DOWN:
1207  y1 += m_length;
1208  break;
1209 
1210  case PIN_LEFT:
1211  x1 -= m_length;
1212  break;
1213 
1214  case PIN_RIGHT:
1215  x1 += m_length;
1216  break;
1217  }
1218 
1219  if( m_name.IsEmpty() )
1220  DrawPinName = false;
1221 
1222  if( TextInside ) // Draw the text inside, but the pin numbers outside.
1223  {
1224  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1225  {
1226  // It is an horizontal line
1227  if( DrawPinName )
1228  {
1229  if( orient == PIN_RIGHT )
1230  {
1231  x = x1 + TextInside;
1232  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1233  m_name,
1235  PinNameSize,
1237  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1238  false, false );
1239  }
1240  else // Orient == PIN_LEFT
1241  {
1242  x = x1 - TextInside;
1243  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1244  m_name,
1246  PinNameSize,
1248  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1249  false, false );
1250  }
1251  }
1252 
1253  if( DrawPinNum )
1254  {
1255  DrawGraphicText( clipbox, DC,
1256  wxPoint( (x1 + pin_pos.x) / 2,
1257  y1 - num_offset ), NumColor,
1258  m_number,
1259  TEXT_ANGLE_HORIZ, PinNumSize,
1261  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1262  false, false );
1263  }
1264  }
1265  else /* Its a vertical line. */
1266  {
1267  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
1268  if( orient == PIN_DOWN )
1269  {
1270  y = y1 + TextInside;
1271 
1272  if( DrawPinName )
1273  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1274  m_name,
1275  TEXT_ANGLE_VERT, PinNameSize,
1277  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1278  false, false );
1279 
1280  if( DrawPinNum )
1281  DrawGraphicText( clipbox, DC,
1282  wxPoint( x1 - num_offset,
1283  (y1 + pin_pos.y) / 2 ), NumColor,
1284  m_number,
1285  TEXT_ANGLE_VERT, PinNumSize,
1287  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1288  false, false );
1289  }
1290  else /* PIN_UP */
1291  {
1292  y = y1 - TextInside;
1293 
1294  if( DrawPinName )
1295  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1296  m_name,
1297  TEXT_ANGLE_VERT, PinNameSize,
1299  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1300  false, false );
1301 
1302  if( DrawPinNum )
1303  DrawGraphicText( clipbox, DC,
1304  wxPoint( x1 - num_offset,
1305  (y1 + pin_pos.y) / 2 ), NumColor,
1306  m_number,
1307  TEXT_ANGLE_VERT, PinNumSize,
1309  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1310  false, false );
1311  }
1312  }
1313  }
1314  else /**** Draw num & text pin outside ****/
1315  {
1316  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1317  {
1318  /* Its an horizontal line. */
1319  if( DrawPinName )
1320  {
1321  x = (x1 + pin_pos.x) / 2;
1322  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ),
1323  NameColor, m_name,
1324  TEXT_ANGLE_HORIZ, PinNameSize,
1326  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1327  false, false );
1328  }
1329  if( DrawPinNum )
1330  {
1331  x = (x1 + pin_pos.x) / 2;
1332  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
1333  NumColor, m_number,
1334  TEXT_ANGLE_HORIZ, PinNumSize,
1336  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1337  false, false );
1338  }
1339  }
1340  else /* Its a vertical line. */
1341  {
1342  if( DrawPinName )
1343  {
1344  y = (y1 + pin_pos.y) / 2;
1345  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ),
1346  NameColor, m_name,
1347  TEXT_ANGLE_VERT, PinNameSize,
1349  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1350  false, false );
1351  }
1352 
1353  if( DrawPinNum )
1354  {
1355  DrawGraphicText( clipbox, DC,
1356  wxPoint( x1 + num_offset, (y1 + pin_pos.y)
1357  / 2 ),
1358  NumColor, m_number,
1359  TEXT_ANGLE_VERT, PinNumSize,
1361  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1362  false, false );
1363  }
1364  }
1365  }
1366 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
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:290
int m_numTextSize
Definition: lib_pin.h:78
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
bool IsSelected() const
Definition: base_struct.h:221
wxString m_name
Definition: lib_pin.h:76
Definition: lib_pin.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:70
#define TEXT_ANGLE_VERT
Definition: common.h:92
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:876
wxString m_number
Definition: lib_pin.h:77
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
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 474 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().

475 {
476  LIB_PINS pinList;
477 
478  if( GetParent() == NULL )
479  return;
480 
481  GetParent()->GetPins( pinList );
482 
483  for( size_t i = 0; i < pinList.size(); i++ )
484  {
485  if( pinList[i] == this )
486  continue;
487 
488  if( ( pinList[i]->m_position == m_position )
489  && ( pinList[i]->m_orientation == m_orientation )
490  && !IsNew()
491  && editPinByPin == false
492  && enable )
493  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
494  else
495  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
496  }
497 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:111
bool IsNew() const
Definition: base_struct.h:216
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:71
LIB_PART * GetParent() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h: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:175
const EDA_RECT LIB_PIN::GetBoundingBox ( ) const
inlineoverridevirtual
Returns
the boundary box for this, in library coordinates

Reimplemented from LIB_ITEM.

Definition at line 137 of file lib_pin.h.

References GetBoundingBox().

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

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

References LIB_ITEMS_LIST::begin(), DefaultTransform, LIB_ITEMS_LIST::end(), 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.

2082 {
2083  LIB_PART* entry = (LIB_PART* ) m_Parent;
2084  EDA_RECT bbox;
2085  wxPoint begin;
2086  wxPoint end;
2087  int nameTextOffset = 0;
2088  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
2089  bool showNum = !m_number.IsEmpty();
2090  int minsizeV = TARGET_PIN_RADIUS;
2091 
2092  if( !aIncludeInvisibles && !IsVisible() )
2093  showName = false;
2094 
2095  if( entry )
2096  {
2097  if( entry->ShowPinNames() )
2098  nameTextOffset = entry->GetPinNameOffset();
2099  else
2100  showName = false;
2101 
2102  showNum = entry->ShowPinNumbers();
2103  }
2104 
2105  // First, calculate boundary box corners position
2106  int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
2107 
2108  // Actual text height is bigger than text size
2109  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
2110 
2112  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
2113 
2114  // calculate top left corner position
2115  // for the default pin orientation (PIN_RIGHT)
2116  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
2117  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
2118 
2119  // calculate bottom right corner position and adjust top left corner position
2120  int nameTextLength = 0;
2121  int nameTextHeight = 0;
2122 
2123  if( showName )
2124  {
2125  int length = m_name.Len();
2126 
2127  // Don't count the line over text symbol.
2128  if( m_name.Left( 1 ) == wxT( "~" ) )
2129  length -= 1;
2130 
2131  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
2132 
2133  // Actual text height are bigger than text size
2134  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
2135  }
2136 
2137  if( nameTextOffset ) // for values > 0, pin name is inside the body
2138  {
2139  end.x = m_length + nameTextLength;
2140  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
2141  }
2142  else // if value == 0:
2143  // pin name is outside the body, and above the pin line
2144  // pin num is below the pin line
2145  {
2146  end.x = std::max(m_length, nameTextLength);
2147  end.y = -begin.y;
2148  begin.y = std::max( minsizeV, nameTextHeight );
2149  }
2150 
2151  // Now, calculate boundary box corners position for the actual pin orientation
2152  int orient = PinDrawOrient( DefaultTransform );
2153 
2154  /* Calculate the pin position */
2155  switch( orient )
2156  {
2157  case PIN_UP:
2158  // Pin is rotated and texts positions are mirrored
2159  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
2160  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
2161  break;
2162 
2163  case PIN_DOWN:
2164  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
2165  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
2166  begin.x = -begin.x;
2167  end.x = -end.x;
2168  break;
2169 
2170  case PIN_LEFT:
2171  begin.x = -begin.x;
2172  end.x = -end.x;
2173  break;
2174 
2175  case PIN_RIGHT:
2176  break;
2177  }
2178 
2179  begin += m_position;
2180  end += m_position;
2181 
2182  bbox.SetOrigin( begin );
2183  bbox.SetEnd( end );
2184  bbox.Normalize();
2185  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
2186 
2187  // Draw Y axis is reversed in schematic:
2188  bbox.RevertYAxis();
2189 
2190  return bbox;
2191 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:139
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
int GetPinNameOffset()
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int m_numTextSize
Definition: lib_pin.h:78
void SetOrigin(const wxPoint &pos)
wxString m_name
Definition: lib_pin.h:76
Definition: lib_pin.h:54
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
int m_length
Length of the pin.
Definition: lib_pin.h:70
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:876
bool ShowPinNumbers()
wxString m_number
Definition: lib_pin.h:77
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:353
void Normalize()
Function Normalize ensures that the height ant width are positive.
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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:42
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:1810
#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 261 of file lib_pin.h.

262  {
264  }
wxString const GetCanonicalElectricalTypeName() const
return a string giving the electrical type of the pin.
Definition: lib_pin.h:261
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
wxString LIB_PIN::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 107 of file lib_pin.h.

108  {
109  return wxT( "LIB_PIN" );
110  }
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 270 of file lib_pin.h.

References GetText().

Referenced by DrawPinElectricalTypeName(), and GetSelectMenuText().

271  {
272  return GetText( m_type );
273  }
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:74
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 255 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(), 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(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), 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().

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

Definition at line 294 of file lib_pin.h.

References m_length.

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

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

References GetBitmap(), and m_type.

2263 {
2264  return GetBitmap( m_type );
2265 }
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
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 2042 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().

2043 {
2044  getMsgPanelInfoBase( aList );
2045 
2046  wxString text;
2047  wxPoint pinpos = GetPosition();
2048  pinpos.y = -pinpos.y; // Display coord are top to bottom
2049  // lib items coord are bottom to top
2050 
2051  text = StringFromValue( g_UserUnit, pinpos.x, true );
2052  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
2053 
2054  text = StringFromValue( g_UserUnit, pinpos.y, true );
2055  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
2056 }
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:2009
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:452
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 2058 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.

2060 {
2061  getMsgPanelInfoBase( aList );
2062 
2063  if( !aComponent )
2064  return;
2065 
2066  wxString text;
2067  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
2068  + aComponent->GetPosition();
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 
2076  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
2077  aComponent->GetField( VALUE )->GetShownText(),
2078  DARKCYAN ) );
2079 }
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:2009
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:452
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 2009 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().

2010 {
2011  wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
2012 
2013  LIB_ITEM::GetMsgPanelInfo( aList );
2014 
2015  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
2016 
2017  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
2018 
2019  aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
2020  GetText( m_type ),
2021  RED ) );
2022 
2023  text = GetText( m_shape );
2024 
2025  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
2026 
2027  if( IsVisible() )
2028  text = _( "Yes" );
2029  else
2030  text = _( "No" );
2031 
2032  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
2033 
2034  // Display pin length
2035  text = StringFromValue( g_UserUnit, m_length, true );
2036  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
2037 
2039  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
2040 }
Definition: colors.h:57
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
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:76
int m_length
Length of the pin.
Definition: lib_pin.h:70
static int GetOrientationCodeIndex(int aCode)
Get the index of the orientation code.
Definition: lib_pin.cpp:2214
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
wxString m_number
Definition: lib_pin.h:77
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:353
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:74
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 162 of file lib_pin.h.

References m_name.

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

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

Definition at line 186 of file lib_pin.h.

References m_nameTextSize.

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

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

Definition at line 215 of file lib_pin.h.

References m_numTextSize.

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

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

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

217 { return m_orientation; }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
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 2205 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().

2206 {
2207  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
2208  return pin_orientation_codes[ index ];
2209 
2210  return PIN_RIGHT;
2211 }
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 2214 of file lib_pin.cpp.

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

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

2215 {
2216  size_t i;
2217 
2218  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
2219  {
2220  if( pin_orientation_codes[i] == code )
2221  return (int) i;
2222  }
2223 
2224  return wxNOT_FOUND;
2225 }
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 2194 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2195 {
2196  wxArrayString tmp;
2197 
2198  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
2199  tmp.Add( getPinOrientationName( ii ) );
2200 
2201  return tmp;
2202 }
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 2256 of file lib_pin.cpp.

References iconsPinsOrientations.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2257 {
2258  return iconsPinsOrientations;
2259 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:65
int LIB_PIN::GetPartNumber ( ) const
inline

Get the pin part number.

Definition at line 308 of file lib_pin.h.

References LIB_ITEM::m_Unit.

308 { 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 876 of file lib_pin.cpp.

References GetDefaultLineThickness(), and m_width.

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

877 {
878  return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
879 }
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:73
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 452 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().

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

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

Referenced by Matches().

2269 {
2270  wxString tmp;
2271  wxString style;
2272 
2273  style = GetText( m_shape );
2274 
2275  tmp.Printf( _( "Pin %s, %s, %s" ),
2277 
2278  return tmp;
2279 }
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
wxString const GetElectricalTypeName() const
return a translated string for messages giving the electrical type of the pin.
Definition: lib_pin.h:270
wxString m_number
Definition: lib_pin.h:77
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 230 of file lib_pin.h.

References m_shape.

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

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

Definition at line 250 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

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

References m_type.

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

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

References m_width.

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

References DefaultTransform.

501 {
502  return HitTest( aPosition, 0, DefaultTransform );
503 }
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:500
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 506 of file lib_pin.cpp.

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

507 {
508  if( aThreshold < 0 )
509  aThreshold = 0;
510 
511  TRANSFORM transform = DefaultTransform;
512  DefaultTransform = aTransform;
513 
514  EDA_RECT rect = GetBoundingBox();
515  rect.Inflate( aThreshold );
516 
517  //Restore matrix
518  DefaultTransform = transform;
519 
520  return rect.Contains( aPosition );
521 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:137
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:113
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:115
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
#define IS_MOVED
Item being moved.
Definition: base_struct.h:112
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 1891 of file lib_pin.cpp.

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

1892 {
1893  wxPoint end = PinEndPoint();
1894 
1895  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1896 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
wxPoint PinEndPoint() const
Function PinEndPoint.
Definition: lib_pin.cpp:1783
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

References BRIGHTENED.

Referenced by SELECTION_TOOL::disambiguationMenu().

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

References HIGHLIGHTED.

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

Definition at line 217 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

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

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

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

References GetType(), IsVisible(), and PIN_POWER_IN.

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

359 { return !IsVisible() && GetType() == PIN_POWER_IN; }
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:246
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:353
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_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 444 of file base_struct.h.

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

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

Definition at line 222 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

222 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
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 353 of file lib_pin.h.

References PIN_INVISIBLE.

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

353 { return ( m_attributes & PIN_INVISIBLE ) == 0; }
#define PIN_INVISIBLE
Definition: lib_pin.h:45
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:75
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_WIRE_IMAGE.

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

220 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:117
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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(), 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:151
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
bool LIB_PIN::Load ( LINE_READER aLineReader,
wxString &  aErrorMsg 
)
overridevirtual

Implements LIB_ITEM.

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

664 {
665  char pinAttrs[64];
666  char pinOrient[64];
667  char pinType[64];
668 
669  *pinAttrs = 0;
670 
671  // We cannot use sscanf, at least on Windows, to parse the pin description.
672  // The reason is the pin name is free, and use UTF8 encoding.
673  // We encourtered issues (Windows specific) to read this name for some UTF8
674  // cyrillic codes
675  // So, read the pin name (and num) after conversion from UTF8, and read the others
676  // parameters (in ASCII) using sscanf
677 
678  // the full line starts by "X ". The pin data starts at line + 2.
679  wxString utf8line = FROM_UTF8( aLineReader.Line() + 2 );
680  wxStringTokenizer tokenizer( utf8line, wxT(" \n\r" ) );
681  int prms_count = tokenizer.CountTokens();
682 
683  if( prms_count < 11 )
684  {
685  aErrorMsg.Printf( wxT( "pin had %d parameters of the required 11 or 12" ), prms_count );
686  return false;
687  }
688 
689  // Extract the pinName (UTF8 encoded)
690  m_name = tokenizer.GetNextToken();
691 
692  wxString tmp;
693 
694  // Extract the pinName (UTF8 encoded accepted, but should be only ASCII8.)
695  tmp = tokenizer.GetNextToken();
696  SetNumber( tmp );
697 
698  // Read other parameters, in pure ASCII
699  char line[1024];
700  tmp = tokenizer.GetString();
701 
702  unsigned len = tmp.Length();
703 
704  if( len >= sizeof( line ) ) // Should not occur.
705  len = sizeof( line) - 1;
706 
707  strncpy( line, TO_UTF8( tmp ), len );
708  line[len] = 0;
709 
710  int cnt = sscanf( line, "%d %d %d %63s %d %d %d %d %63s %63s",
711  &m_position.x, &m_position.y, &m_length, pinOrient, &m_numTextSize,
712  &m_nameTextSize, &m_Unit, &m_Convert, pinType, pinAttrs );
713 
714  if( cnt != (prms_count - 2) )
715  {
716  aErrorMsg.Printf( wxT( "pin parameters read issue" ) );
717  return false;
718  }
719 
720  m_orientation = pinOrient[0] & 255;
721 
722  switch( *pinType & 255 )
723  {
724  case 'I':
725  m_type = PIN_INPUT;
726  break;
727 
728  case 'O':
729  m_type = PIN_OUTPUT;
730  break;
731 
732  case 'B':
733  m_type = PIN_BIDI;
734  break;
735 
736  case 'T':
738  break;
739 
740  case 'P':
742  break;
743 
744  case 'U':
746  break;
747 
748  case 'W':
750  break;
751 
752  case 'w':
754  break;
755 
756  case 'C':
758  break;
759 
760  case 'E':
762  break;
763 
764  case 'N':
765  m_type = PIN_NC;
766  break;
767 
768  default:
769  aErrorMsg.Printf( wxT( "unknown pin type [%c]" ), *pinType & 255 );
770  return false;
771  }
772 
773  if( prms_count >= 12 ) /* Special Symbol defined */
774  {
775  enum
776  {
777  INVERTED = 1 << 0,
778  CLOCK = 1 << 1,
779  LOWLEVEL_IN = 1 << 2,
780  LOWLEVEL_OUT = 1 << 3,
781  FALLING_EDGE = 1 << 4,
782  NONLOGIC = 1 << 5
783  };
784 
785  int flags = 0;
786 
787  for( int j = strlen( pinAttrs ); j > 0; )
788  {
789  switch( pinAttrs[--j] )
790  {
791  case '~':
792  break;
793 
794  case 'N':
796  break;
797 
798  case 'I':
799  flags |= INVERTED;
800  break;
801 
802  case 'C':
803  flags |= CLOCK;
804  break;
805 
806  case 'L':
807  flags |= LOWLEVEL_IN;
808  break;
809 
810  case 'V':
811  flags |= LOWLEVEL_OUT;
812  break;
813 
814  case 'F':
815  flags |= FALLING_EDGE;
816  break;
817 
818  case 'X':
819  flags |= NONLOGIC;
820  break;
821 
822  default:
823  aErrorMsg.Printf( wxT( "unknown pin attribute [%c]" ), pinAttrs[j] );
824  return false;
825  }
826  }
827 
828  switch( flags )
829  {
830  case 0:
832  break;
833 
834  case INVERTED:
836  break;
837 
838  case CLOCK:
840  break;
841 
842  case INVERTED | CLOCK:
844  break;
845 
846  case LOWLEVEL_IN:
848  break;
849 
850  case LOWLEVEL_IN | CLOCK:
852  break;
853 
854  case LOWLEVEL_OUT:
856  break;
857 
858  case FALLING_EDGE:
860  break;
861 
862  case NONLOGIC:
864  break;
865 
866  default:
867  aErrorMsg.Printf( wxT( "pin attributes do not give a valid pin shape [%s]" ), pinAttrs );
868  return false;
869  }
870  }
871 
872  return true;
873 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
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:72
int m_numTextSize
Definition: lib_pin.h:78
int m_Unit
Unit identification for multiple parts per package.
wxString m_name
Definition: lib_pin.h:76
int m_length
Length of the pin.
Definition: lib_pin.h:70
void SetNumber(const wxString &aNumber)
Set the pin number.
Definition: lib_pin.h:200
#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:71
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:45
int m_attributes
Set bit 0 to indicate pin is invisible.
Definition: lib_pin.h:75
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
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 2282 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.

2283 {
2284  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
2285 
2286  // Note: this will have to be modified if we add find and replace capability to the
2287  // compoment library editor. Otherwise, you wont be able to replace pin text.
2288  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
2289  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
2290  return false;
2291 
2292  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
2293 
2294  if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
2295  {
2296  if( aFindLocation )
2297  *aFindLocation = GetBoundingBox().Centre();
2298 
2299  return true;
2300  }
2301 
2302  return false;
2303 }
const wxString traceFindItem
Flag to enable find item tracing using the WXTRACE environment variable.
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:400
Search texts (name and number (a 4 letters text) )in pins.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:137
const wxString & GetName() const
Definition: lib_pin.h:162
wxString m_number
Definition: lib_pin.h:77
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:2268
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:444
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 1909 of file lib_pin.cpp.

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

1910 {
1911  m_position.x -= center.x;
1912  m_position.x *= -1;
1913  m_position.x += center.x;
1914 
1915  if( m_orientation == PIN_RIGHT )
1917  else if( m_orientation == PIN_LEFT )
1919 }
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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 1921 of file lib_pin.cpp.

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

1922 {
1923  m_position.y -= center.y;
1924  m_position.y *= -1;
1925  m_position.y += center.y;
1926 
1927  if( m_orientation == PIN_UP )
1929  else if( m_orientation == PIN_DOWN )
1931 }
Definition: lib_pin.h:54
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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 1899 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().

1900 {
1901  if( m_position != newPosition )
1902  {
1903  m_position = newPosition;
1904  SetModified();
1905  }
1906 }
void SetModified()
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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:198
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:198
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 1810 of file lib_pin.cpp.

References LIB_ITEMS_LIST::end(), 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().

1811 {
1812  int orient;
1813  wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
1814 
1815  switch( m_orientation )
1816  {
1817  case PIN_UP:
1818  end.y = 1;
1819  break;
1820 
1821  case PIN_DOWN:
1822  end.y = -1;
1823  break;
1824 
1825  case PIN_LEFT:
1826  end.x = -1;
1827  break;
1828 
1829  case PIN_RIGHT:
1830  end.x = 1;
1831  break;
1832  }
1833 
1834  // = pos of end point, according to the component orientation
1835  end = aTransform.TransformCoordinate( end );
1836  orient = PIN_UP;
1837 
1838  if( end.x == 0 )
1839  {
1840  if( end.y > 0 )
1841  orient = PIN_DOWN;
1842  }
1843  else
1844  {
1845  orient = PIN_RIGHT;
1846 
1847  if( end.x < 0 )
1848  orient = PIN_LEFT;
1849  }
1850 
1851  return orient;
1852 }
Definition: lib_pin.h:54
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:71
wxPoint LIB_PIN::PinEndPoint ( ) const

Function PinEndPoint.

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

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

1784 {
1785  wxPoint pos = m_position;
1786 
1787  switch( m_orientation )
1788  {
1789  case PIN_UP:
1790  pos.y += m_length;
1791  break;
1792 
1793  case PIN_DOWN:
1794  pos.y -= m_length;
1795  break;
1796 
1797  case PIN_LEFT:
1798  pos.x -= m_length;
1799  break;
1800 
1801  case PIN_RIGHT:
1802  pos.x += m_length;
1803  break;
1804  }
1805 
1806  return pos;
1807 }
Definition: lib_pin.h:54
int m_length
Length of the pin.
Definition: lib_pin.h:70
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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 1982 of file lib_pin.cpp.

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

1984 {
1985  if( ! IsVisible() )
1986  return;
1987 
1988  int orient = PinDrawOrient( aTransform );
1989 
1990  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
1991 
1992  PlotSymbol( plotter, pos, orient );
1993  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
1994  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
1995  GetPenSize() );
1996 }
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:1583
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:876
LIB_PART * GetParent() const
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:1432
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:353
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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:1810
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 1583 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().

1586 {
1587  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1588  DrawPinName = false;
1589 
1590  if( m_number.IsEmpty() )
1591  DrawPinNum = false;
1592 
1593  if( !DrawPinNum && !DrawPinName )
1594  return;
1595 
1596  int x, y;
1597  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1598  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1599 
1600  int nameLineWidth = GetPenSize();
1601  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1602  int numLineWidth = GetPenSize();
1603  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1604 
1605  int name_offset = PIN_TEXT_MARGIN +
1606  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1607  int num_offset = PIN_TEXT_MARGIN +
1608  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1609 
1610  /* Get the num and name colors */
1611  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1612  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1613 
1614  int x1 = pin_pos.x;
1615  int y1 = pin_pos.y;
1616 
1617  switch( orient )
1618  {
1619  case PIN_UP:
1620  y1 -= m_length;
1621  break;
1622 
1623  case PIN_DOWN:
1624  y1 += m_length;
1625  break;
1626 
1627  case PIN_LEFT:
1628  x1 -= m_length;
1629  break;
1630 
1631  case PIN_RIGHT:
1632  x1 += m_length;
1633  break;
1634  }
1635 
1636  /* Draw the text inside, but the pin numbers outside. */
1637  if( TextInside )
1638  {
1639  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1640  {
1641  if( DrawPinName )
1642  {
1643  if( orient == PIN_RIGHT )
1644  {
1645  x = x1 + TextInside;
1646  plotter->Text( wxPoint( x, y1 ), NameColor,
1647  m_name,
1649  PinNameSize,
1652  aWidth, false, false );
1653  }
1654  else // orient == PIN_LEFT
1655  {
1656  x = x1 - TextInside;
1657 
1658  if( DrawPinName )
1659  plotter->Text( wxPoint( x, y1 ),
1660  NameColor, m_name, TEXT_ANGLE_HORIZ,
1661  PinNameSize,
1664  aWidth, false, false );
1665  }
1666  }
1667  if( DrawPinNum )
1668  {
1669  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1670  y1 - num_offset ),
1671  NumColor, m_number,
1672  TEXT_ANGLE_HORIZ, PinNumSize,
1675  aWidth, false, false );
1676  }
1677  }
1678  else /* Its a vertical line. */
1679  {
1680  if( orient == PIN_DOWN )
1681  {
1682  y = y1 + TextInside;
1683 
1684  if( DrawPinName )
1685  plotter->Text( wxPoint( x1, y ), NameColor,
1686  m_name,
1687  TEXT_ANGLE_VERT, PinNameSize,
1690  aWidth, false, false );
1691 
1692  if( DrawPinNum )
1693  {
1694  plotter->Text( wxPoint( x1 - num_offset,
1695  (y1 + pin_pos.y) / 2 ),
1696  NumColor, m_number,
1697  TEXT_ANGLE_VERT, PinNumSize,
1700  aWidth, false, false );
1701  }
1702  }
1703  else /* PIN_UP */
1704  {
1705  y = y1 - TextInside;
1706 
1707  if( DrawPinName )
1708  plotter->Text( wxPoint( x1, y ), NameColor,
1709  m_name,
1710  TEXT_ANGLE_VERT, PinNameSize,
1713  aWidth, false, false );
1714 
1715  if( DrawPinNum )
1716  {
1717  plotter->Text( wxPoint( x1 - num_offset,
1718  (y1 + pin_pos.y) / 2 ),
1719  NumColor, m_number,
1720  TEXT_ANGLE_VERT, PinNumSize,
1723  aWidth, false, false );
1724  }
1725  }
1726  }
1727  }
1728  else /* Draw num & text pin outside */
1729  {
1730  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1731  {
1732  /* Its an horizontal line. */
1733  if( DrawPinName )
1734  {
1735  x = (x1 + pin_pos.x) / 2;
1736  plotter->Text( wxPoint( x, y1 - name_offset ),
1737  NameColor, m_name,
1738  TEXT_ANGLE_HORIZ, PinNameSize,
1741  aWidth, false, false );
1742  }
1743 
1744  if( DrawPinNum )
1745  {
1746  x = ( x1 + pin_pos.x ) / 2;
1747  plotter->Text( wxPoint( x, y1 + num_offset ),
1748  NumColor, m_number,
1749  TEXT_ANGLE_HORIZ, PinNumSize,
1752  aWidth, false, false );
1753  }
1754  }
1755  else /* Its a vertical line. */
1756  {
1757  if( DrawPinName )
1758  {
1759  y = ( y1 + pin_pos.y ) / 2;
1760  plotter->Text( wxPoint( x1 - name_offset, y ),
1761  NameColor, m_name,
1762  TEXT_ANGLE_VERT, PinNameSize,
1765  aWidth, false, false );
1766  }
1767 
1768  if( DrawPinNum )
1769  {
1770  plotter->Text( wxPoint( x1 + num_offset,
1771  ( y1 + pin_pos.y ) / 2 ),
1772  NumColor, m_number,
1773  TEXT_ANGLE_VERT, PinNumSize,
1776  aWidth, false, false );
1777  }
1778  }
1779  }
1780 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
int m_numTextSize
Definition: lib_pin.h:78
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
wxString m_name
Definition: lib_pin.h:76
Definition: lib_pin.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:70
#define TEXT_ANGLE_VERT
Definition: common.h:92
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:876
wxString m_number
Definition: lib_pin.h:77
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
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 1432 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().

1433 {
1434  int MapX1, MapY1, x1, y1;
1436 
1437  aPlotter->SetColor( color );
1438  aPlotter->SetCurrentLineWidth( GetPenSize() );
1439 
1440  MapX1 = MapY1 = 0;
1441  x1 = aPosition.x; y1 = aPosition.y;
1442 
1443  switch( aOrientation )
1444  {
1445  case PIN_UP:
1446  y1 = aPosition.y - m_length;
1447  MapY1 = 1;
1448  break;
1449 
1450  case PIN_DOWN:
1451  y1 = aPosition.y + m_length;
1452  MapY1 = -1;
1453  break;
1454 
1455  case PIN_LEFT:
1456  x1 = aPosition.x - m_length;
1457  MapX1 = 1;
1458  break;
1459 
1460  case PIN_RIGHT:
1461  x1 = aPosition.x + m_length;
1462  MapX1 = -1;
1463  break;
1464  }
1465 
1467  {
1468  const int radius = ExternalPinDecoSize( *this );
1469  aPlotter->Circle( wxPoint( MapX1 * radius + x1,
1470  MapY1 * radius + y1 ),
1471  radius * 2, // diameter
1472  NO_FILL, // fill option
1473  GetPenSize() ); // width
1474 
1475  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1,
1476  MapY1 * radius * 2 + y1 ) );
1477  aPlotter->FinishTo( aPosition );
1478  }
1479  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
1480  {
1481  const int clock_size = InternalPinDecoSize( *this );
1482  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1483  {
1484  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1485  aPlotter->LineTo( wxPoint( x1 + MapX1 * clock_size * 2, y1 ) );
1486  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1487  }
1488  else /* MapX1 = 0 */
1489  {
1490  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1491  aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * clock_size * 2 ) );
1492  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1493  }
1494 
1495  aPlotter->MoveTo( wxPoint( MapX1 * clock_size * 2 + x1,
1496  MapY1 * clock_size * 2 + y1 ) );
1497  aPlotter->FinishTo( aPosition );
1498  }
1499  else
1500  {
1501  aPlotter->MoveTo( wxPoint( x1, y1 ) );
1502  aPlotter->FinishTo( aPosition );
1503  }
1504 
1507  {
1508  const int clock_size = InternalPinDecoSize( *this );
1509  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1510  {
1511  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1512  aPlotter->LineTo( wxPoint( x1 - MapX1 * clock_size * 2, y1 ) );
1513  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1514  }
1515  else /* MapX1 = 0 */
1516  {
1517  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1518  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * clock_size * 2 ) );
1519  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1520  }
1521  }
1522 
1523  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
1524  {
1525  const int symbol_size = ExternalPinDecoSize( *this );
1526 
1527  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1528  {
1529  aPlotter->MoveTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1530  aPlotter->LineTo( wxPoint( x1 + MapX1 * symbol_size * 2,
1531  y1 - symbol_size * 2 ) );
1532  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1533  }
1534  else /* MapX1 = 0 */
1535  {
1536  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1537  aPlotter->LineTo( wxPoint( x1 - symbol_size * 2,
1538  y1 + MapY1 * symbol_size * 2 ) );
1539  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1540  }
1541  }
1542 
1543 
1544  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1545  {
1546  const int symbol_size = ExternalPinDecoSize( *this );
1547 
1548  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1549  {
1550  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1551  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1552  }
1553  else /* MapX1 = 0 */
1554  {
1555  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1556  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1557  }
1558  }
1559  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1560  {
1561  const int symbol_size = ExternalPinDecoSize( *this );
1562  aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * symbol_size,
1563  y1 - (MapY1 - MapX1) * symbol_size ) );
1564  aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * symbol_size,
1565  y1 + (MapY1 - MapX1) * symbol_size ) );
1566  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * symbol_size,
1567  y1 - (MapY1 + MapX1) * symbol_size ) );
1568  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * symbol_size,
1569  y1 + (MapY1 + MapX1) * symbol_size ) );
1570  }
1571  if( m_type == PIN_NC ) // Draw a N.C. symbol
1572  {
1573  const int ex1 = aPosition.x;
1574  const int ey1 = aPosition.y;
1575  aPlotter->MoveTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1576  aPlotter->FinishTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1577  aPlotter->MoveTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1578  aPlotter->FinishTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1579  }
1580 }
void FinishTo(const wxPoint &pos)
Definition: plot_common.h:241
static int ExternalPinDecoSize(const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:139
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
virtual void SetColor(COLOR4D color)=0
Definition: lib_pin.h:54
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int m_length
Length of the pin.
Definition: lib_pin.h:70
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:876
void LineTo(const wxPoint &pos)
Definition: plot_common.h:236
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)
Definition: plot_common.h:231
#define NCSYMB_PIN_DIM
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
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:444
const wxString traceFindReplace(wxT("KicadFindReplace"))
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 432 of file base_struct.h.

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

Rotate the draw item.

Reimplemented from LIB_ITEM.

Definition at line 2228 of file lib_pin.cpp.

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

2229 {
2230  int orient = PIN_RIGHT;
2231 
2232  switch( GetOrientation() )
2233  {
2234  case PIN_UP:
2235  orient = PIN_LEFT;
2236  break;
2237 
2238  case PIN_DOWN:
2239  orient = PIN_RIGHT;
2240  break;
2241 
2242  case PIN_LEFT:
2243  orient = PIN_DOWN;
2244  break;
2245 
2246  case PIN_RIGHT:
2247  orient = PIN_UP;
2248  break;
2249  }
2250 
2251  // Set the new orientation
2252  SetOrientation( orient );
2253 }
void SetOrientation(int aOrientation)
Set orientation on the pin.
Definition: lib_pin.cpp:238
Definition: lib_pin.h:54
int GetOrientation() const
Definition: lib_pin.h:217
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 1933 of file lib_pin.cpp.

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

1934 {
1935  int rot_angle = aRotateCCW ? -900 : 900;
1936 
1937  RotatePoint( &m_position, center, rot_angle );
1938 
1939  if( aRotateCCW )
1940  {
1941  switch( m_orientation )
1942  {
1943  case PIN_RIGHT:
1945  break;
1946 
1947  case PIN_UP:
1949  break;
1950  case PIN_LEFT:
1952  break;
1953 
1954  case PIN_DOWN:
1956  break;
1957  }
1958  }
1959  else
1960  {
1961  switch( m_orientation )
1962  {
1963  case PIN_RIGHT:
1965  break;
1966 
1967  case PIN_UP:
1969  break;
1970  case PIN_LEFT:
1972  break;
1973 
1974  case PIN_DOWN:
1976  break;
1977  }
1978  }
1979 }
Definition: lib_pin.h:54
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:71
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
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 524 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.

525 {
526  int Etype;
527 
528  switch( m_type )
529  {
530  default:
531  case PIN_INPUT:
532  Etype = 'I';
533  break;
534 
535  case PIN_OUTPUT:
536  Etype = 'O';
537  break;
538 
539  case PIN_BIDI:
540  Etype = 'B';
541  break;
542 
543  case PIN_TRISTATE:
544  Etype = 'T';
545  break;
546 
547  case PIN_PASSIVE:
548  Etype = 'P';
549  break;
550 
551  case PIN_UNSPECIFIED:
552  Etype = 'U';
553  break;
554 
555  case PIN_POWER_IN:
556  Etype = 'W';
557  break;
558 
559  case PIN_POWER_OUT:
560  Etype = 'w';
561  break;
562 
563  case PIN_OPENCOLLECTOR:
564  Etype = 'C';
565  break;
566 
567  case PIN_OPENEMITTER:
568  Etype = 'E';
569  break;
570 
571  case PIN_NC:
572  Etype = 'N';
573  break;
574  }
575 
576  if( !m_name.IsEmpty() )
577  {
578  if( aFormatter.Print( 0, "X %s", TO_UTF8( m_name ) ) < 0 )
579  return false;
580  }
581  else
582  {
583  if( aFormatter.Print( 0, "X ~" ) < 0 )
584  return false;
585  }
586 
587  if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
588  TO_UTF8( m_number.IsEmpty() ? wxT( "~" ) : m_number ),
589  m_position.x, m_position.y,
591  m_Unit, m_Convert, Etype ) < 0 )
592  return false;
593 
594  if( m_shape || !IsVisible() )
595  {
596  if( aFormatter.Print( 0, " " ) < 0 )
597  return false;
598  }
599 
600  if( !IsVisible() && aFormatter.Print( 0, "N" ) < 0 )
601  return false;
602 
603  switch( m_shape )
604  {
605  case PINSHAPE_LINE:
606  break;
607 
608  case PINSHAPE_INVERTED:
609  if( aFormatter.Print( 0, "I" ) < 0 )
610  return false;
611  break;
612 
613  case PINSHAPE_CLOCK:
614  if( aFormatter.Print( 0, "C" ) < 0 )
615  return false;
616  break;
617 
619  if( aFormatter.Print( 0, "IC" ) < 0 )
620  return false;
621  break;
622 
623  case PINSHAPE_INPUT_LOW:
624  if( aFormatter.Print( 0, "L" ) < 0 )
625  return false;
626  break;
627 
628  case PINSHAPE_CLOCK_LOW:
629  if( aFormatter.Print( 0, "CL" ) < 0 )
630  return false;
631  break;
632 
633  case PINSHAPE_OUTPUT_LOW:
634  if( aFormatter.Print( 0, "V" ) < 0 )
635  return false;
636  break;
637 
639  if( aFormatter.Print( 0, "F" ) < 0 )
640  return false;
641  break;
642 
643  case PINSHAPE_NONLOGIC:
644  if( aFormatter.Print( 0, "X" ) < 0 )
645  return false;
646  break;
647 
648  default:
649  assert( !"Invalid pin shape" );
650  return false;
651  }
652 
653  if( aFormatter.Print( 0, "\n" ) < 0 )
654  return false;
655 
657 
658  return true;
659 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:79
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
int m_numTextSize
Definition: lib_pin.h:78
int m_Unit
Unit identification for multiple parts per package.
wxString m_name
Definition: lib_pin.h:76
int m_length
Length of the pin.
Definition: lib_pin.h:70
#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:71
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:109
wxString m_number
Definition: lib_pin.h:77
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:353
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
int m_Convert
Shape identification for alternate body styles.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 212 of file base_struct.h.

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

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

Definition at line 229 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

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

411 {
412  if( m_Convert == style )
413  return;
414 
415  m_Convert = style;
416  SetFlags( IS_CHANGED );
417 
418  if( style == 0 )
419  {
420  LIB_PIN* pin;
421  LIB_PIN* tmp = GetParent()->GetNextPin();
422 
423  while( tmp != NULL )
424  {
425  pin = tmp;
426  tmp = GetParent()->GetNextPin( pin );
427 
428  if( ( pin->m_Flags & IS_LINKED ) == 0
429  || ( pin == this )
430  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
431  || ( m_position != pin->m_position )
432  || ( pin->m_orientation != m_orientation ) )
433  continue;
434 
435  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
436  }
437  }
438 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
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:71
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:109
LIB_PART * GetParent() const
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
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:69
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 253 of file base_struct.h.

Referenced by 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_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_SHEET::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().

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

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

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

Definition at line 228 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

228 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
void LIB_PIN::SetLength ( int  aLength)

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.

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

327 {
328  if( m_length != length )
329  {
330  m_length = length;
331  SetModified();
332  }
333 
334  if( GetParent() == NULL )
335  return;
336 
337  LIB_PINS pinList;
338  GetParent()->GetPins( pinList );
339 
340  for( size_t i = 0; i < pinList.size(); i++ )
341  {
342  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
343  || pinList[i]->m_Convert != m_Convert
344  || pinList[i]->m_length == length )
345  continue;
346 
347  pinList[i]->m_length = length;
348  SetModified();
349  }
350 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
int m_length
Length of the pin.
Definition: lib_pin.h:70
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:175
int m_Convert
Shape identification for alternate body styles.
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 214 of file base_struct.h.

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

214 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:166
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:168
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:109
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void LIB_PIN::SetName ( const wxString &  aName)

Set the pin name.

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

Parameters
aNameNew pin name.

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

160 {
161  wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
162 
163  tmp.Replace( wxT( " " ), wxT( "_" ) );
164 
165  if( m_name != tmp )
166  {
167  m_name = tmp;
168  SetModified();
169  }
170 
171  if( GetParent() == NULL )
172  return;
173 
174  LIB_PINS pinList;
175  GetParent()->GetPins( pinList );
176 
177  for( size_t i = 0; i < pinList.size(); i++ )
178  {
179  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_name == m_name )
180  continue;
181 
182  pinList[i]->m_name = m_name;
183  SetModified();
184  }
185 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
wxString m_name
Definition: lib_pin.h:76
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
LIB_PART * GetParent() const
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
void LIB_PIN::SetNameTextSize ( int  aSize)

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

Definition at line 188 of file lib_pin.cpp.

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

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

189 {
190  if( size != m_nameTextSize )
191  {
192  m_nameTextSize = size;
193  SetModified();
194  }
195 
196  if( GetParent() == NULL )
197  return;
198 
199  LIB_PINS pinList;
200  GetParent()->GetPins( pinList );
201 
202  for( size_t i = 0; i < pinList.size(); i++ )
203  {
204  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
205  continue;
206 
207  pinList[i]->m_nameTextSize = size;
208  SetModified();
209  }
210 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
int m_nameTextSize
Pin num and Pin name sizes.
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:175
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 211 of file base_struct.h.

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

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

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

201  {
202  m_number = aNumber;
203  }
wxString m_number
Definition: lib_pin.h:77
void LIB_PIN::SetNumberTextSize ( int  aSize)

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

Definition at line 213 of file lib_pin.cpp.

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

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

214 {
215  if( size != m_numTextSize )
216  {
217  m_numTextSize = size;
218  SetModified();
219  }
220 
221  if( GetParent() == NULL )
222  return;
223 
224  LIB_PINS pinList;
225  GetParent()->GetPins( pinList );
226 
227  for( size_t i = 0; i < pinList.size(); i++ )
228  {
229  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
230  continue;
231 
232  pinList[i]->m_numTextSize = size;
233  SetModified();
234  }
235 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
int m_numTextSize
Definition: lib_pin.h:78
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
LIB_PART * GetParent() const
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 1885 of file lib_pin.cpp.

References m_position.

1886 {
1887  m_position += aOffset;
1888 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
void LIB_PIN::SetOrientation ( int  aOrientation)

Set orientation on the pin.

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

Parameters
aOrientation- The orientation of the pin.

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

239 {
240  if( m_orientation != orientation )
241  {
242  m_orientation = orientation;
243  SetModified();
244  }
245 
246  if( GetParent() == NULL )
247  return;
248 
249  LIB_PINS pinList;
250  GetParent()->GetPins( pinList );
251 
252  for( size_t i = 0; i < pinList.size(); i++ )
253  {
254  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
255  pinList[i]->m_orientation == orientation )
256  continue;
257 
258  pinList[i]->m_orientation = orientation;
259  SetModified();
260  }
261 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
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:71
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:175
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 213 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(), SCH_SHEET::Load(), 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(), MODULE_EDITOR_TOOLS::PasteItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), 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(), BOARD_ITEM::SwapData(), SCH_SHEET::SwapData(), and SCH_COMPONENT::SwapData().

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

381 {
382  if( m_Unit == part )
383  return;
384 
385  m_Unit = part;
386  SetModified();
387 
388  if( m_Unit == 0 )
389  {
390  LIB_PIN* pin;
391  LIB_PIN* tmp = GetParent()->GetNextPin();
392 
393  while( tmp != NULL )
394  {
395  pin = tmp;
396  tmp = GetParent()->GetNextPin( pin );
397 
398  if( pin->m_Flags == 0 || pin == this
399  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
400  || ( m_position != pin->m_position )
401  || ( pin->m_orientation != m_orientation ) )
402  continue;
403 
404  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
405  }
406  }
407 }
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:71
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:69
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 353 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().

354 {
355  if( m_position != aPosition )
356  {
357  m_position = aPosition;
358  SetModified();
359  }
360 
361  if( GetParent() == NULL )
362  return;
363 
364  LIB_PINS pinList;
365  GetParent()->GetPins( pinList );
366 
367  for( size_t i = 0; i < pinList.size(); i++ )
368  {
369  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
370  || pinList[i]->m_Convert != m_Convert
371  || pinList[i]->m_position == aPosition )
372  continue;
373 
374  pinList[i]->m_position = aPosition;
375  SetModified();
376  }
377 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
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:69
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:175
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 227 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::selectVisually().

227 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
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 264 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().

265 {
266  assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
267 
268  if( m_shape != aShape )
269  {
270  m_shape = aShape;
271  SetModified();
272  }
273 
274  if( GetParent() == NULL )
275  return;
276 
277  LIB_PINS pinList;
278  GetParent()->GetPins( pinList );
279 
280  for( size_t i = 0; i < pinList.size(); i++ )
281  {
282  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
283  || pinList[i]->m_Convert != m_Convert
284  || pinList[i]->m_shape == aShape )
285  continue;
286 
287  pinList[i]->m_shape = aShape;
288  SetModified();
289  }
290 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
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:175
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 203 of file base_struct.h.

Referenced by BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendOneEEProject(), 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(), SCH_SHEET::Load(), 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(), BOARD_ITEM::SwapData(), and TestDuplicateSheetNames().

203 { m_TimeStamp = aNewTimeStamp; }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:169
void LIB_PIN::SetType ( ELECTRICAL_PINTYPE  aType)

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

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

294 {
295  assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
296 
297  if( aType < PIN_INPUT )
298  aType = PIN_INPUT;
299 
300  if( aType >= (int)PINTYPE_COUNT )
301  aType = PIN_NC;
302 
303  if( m_type != aType )
304  {
305  m_type = aType;
306  SetModified();
307  }
308 
309  if( GetParent() == NULL )
310  return;
311 
312  LIB_PINS pinList;
313  GetParent()->GetPins( pinList );
314 
315  for( size_t i = 0; i < pinList.size(); i++ )
316  {
317  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_type == aType )
318  continue;
319 
320  pinList[i]->m_type = aType;
321  SetModified();
322  }
323 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
void SetModified()
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
LIB_PART * GetParent() const
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
ELECTRICAL_PINTYPE m_type
Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
Definition: lib_pin.h:74
void LIB_ITEM::SetUnit ( int  aUnit)
inlineinherited
void LIB_PIN::SetVisible ( bool  aVisible)

Set or clear the visibility flag for the pin.

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

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

Definition at line 441 of file lib_pin.cpp.

References LIB_ITEM::GetParent(), LIB_PART::GetPins(), IS_LINKED, IsVisible(),