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...
 
void PinStringNum (wxString &aStringBuffer) const
 Fill a string buffer with pin number. More...
 
long GetNumber () const
 
wxString GetNumberString () const
 
void SetPinNumFromString (wxString &aBuffer)
 Function SetPinNumFromString fill the pin number buffer with aBuffer. More...
 
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
 
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
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 
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 wxString PinStringNum (long aPinNum)
 Function PinStringNum (static function) Pin num is coded as a long or 4 ascii chars. More...
 
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
 
long m_number
 Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12". More...
 
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_number, 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
152  m_number = 0; // pin number (i.e. 4 ASCII chars)
155  m_width = 0;
156  m_typeName = _( "Pin" );
157 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:81
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:80
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
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
LIB_PIN::~LIB_PIN ( )
inline

Definition at line 107 of file lib_pin.h.

107 { }

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 181 of file lib_draw_item.h.

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

181 {}
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(), 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 1925 of file lib_pin.cpp.

References LIB_PIN().

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

1926 {
1927  return new LIB_PIN( *this );
1928 }
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 1931 of file lib_pin.cpp.

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

1932 {
1933  wxASSERT( other.Type() == LIB_PIN_T );
1934 
1935  const LIB_PIN* tmp = (LIB_PIN*) &other;
1936 
1937  if( m_number != tmp->m_number )
1938  return m_number - tmp->m_number;
1939 
1940  int result = m_name.CmpNoCase( tmp->m_name );
1941 
1942  if( result != 0 )
1943  return result;
1944 
1945  if( m_position.x != tmp->m_position.x )
1946  return m_position.x - tmp->m_position.x;
1947 
1948  if( m_position.y != tmp->m_position.y )
1949  return m_position.y - tmp->m_position.y;
1950 
1951  return 0;
1952 }
wxString m_name
Definition: lib_pin.h:76
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
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 193 of file lib_draw_item.h.

Referenced by LIB_EDIT_FRAME::GraphicItemBeginDraw().

193 { 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(), 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;
126  COLOR4D color = GetDefaultColor();
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.
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 905 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().

912 {
913  // aData is used here as a bitfield of flags.
914  uintptr_t flags = (uintptr_t) aData;
915  bool drawPinText = flags & PIN_DRAW_TEXTS;
916  bool drawPinDangling = flags & PIN_DRAW_DANGLING;
917  bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
918  bool drawElectricalTypeName = flags & PIN_DRAW_ELECTRICAL_TYPE_NAME;
919 
920  LIB_PART* Entry = GetParent();
921 
922  /* Calculate pin orient taking in account the component orientation. */
923  int orient = PinDrawOrient( aTransform );
924 
925  /* Calculate the pin position */
926  wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
927 
928  // Invisible pins are only drawn on request.
929  // They are drawn in GetInvisibleItemColor().
930  // in schematic, they are drawn only if m_showAllPins is true.
931  // In other windows, they are always drawn because we must see them.
932  if( ! IsVisible() )
933  {
934  EDA_DRAW_FRAME* frame = NULL;
935 
936  if( aPanel && aPanel->GetParent() )
937  frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
938 
939  if( frame && frame->IsType( FRAME_SCH ) &&
940  ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
941  {
942  if( drawPinDangling && drawDanglingHidden )
943  {
944  // Draw the target
945  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
946  /* aOnlyTarget */ true );
947  }
948  return;
949  }
950 
951  aColor = GetInvisibleItemColor();
952  }
953 
954  /* Drawing from the pin and the special symbol combination */
955  DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
956 
957  if( drawPinText )
958  {
959  DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
960  Entry->ShowPinNumbers(), Entry->ShowPinNames(),
961  aColor, aDrawMode );
962  }
963 
964  if( drawElectricalTypeName )
965  DrawPinElectricalTypeName( aPanel, aDC, pos1, orient, aColor, aDrawMode );
966 
967 
968  /* Set to one (1) to draw bounding box around pin to validate bounding
969  * box calculation. */
970 #if 0
971  EDA_RECT bBox = GetBoundingBox();
972  bBox.RevertYAxis();
973  bBox = aTransform.TransformCoordinate( bBox );
974  bBox.Move( aOffset );
975  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDC, bBox, 0, LIGHTMAGENTA );
976 #endif
977 }
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:1397
int GetPinNameOffset()
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h: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:372
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:1179
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:216
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:980
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:1841
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 1397 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().

1400 {
1401  wxString etypeName = GetElectricalTypeName();
1402 
1403  // Use a reasonable (small) size to draw the text
1404  int etextSize = (m_nameTextSize*3)/4;
1405 
1406  #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
1407  if( etextSize > ETXT_MAX_SIZE )
1408  etextSize = ETXT_MAX_SIZE;
1409 
1410  // Use a reasonable pen size to draw the text
1411  int pensize = etextSize/6;
1412 
1413  // Get a suitable color
1414  if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
1415  aColor = GetItemSelectedColor();
1416  else if( !IsVisible() )
1417  aColor = GetInvisibleItemColor();
1418  else
1419  aColor = GetLayerColor( LAYER_NOTES );
1420 
1421  wxPoint txtpos = aPosition;
1422  int offset = Millimeter2iu( 0.4 );
1424  int orient = TEXT_ANGLE_HORIZ;
1425 
1426  switch( aOrientation )
1427  {
1428  case PIN_UP:
1429  txtpos.y += offset;
1430  orient = TEXT_ANGLE_VERT;
1431  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1432  break;
1433 
1434  case PIN_DOWN:
1435  txtpos.y -= offset;
1436  orient = TEXT_ANGLE_VERT;
1437  break;
1438 
1439  case PIN_LEFT:
1440  txtpos.x += offset;
1441  break;
1442 
1443  case PIN_RIGHT:
1444  txtpos.x -= offset;
1445  hjustify = GR_TEXT_HJUSTIFY_RIGHT;
1446  break;
1447  }
1448 
1449  GRSetDrawMode( aDC, aDrawMode );
1450  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
1451 
1452  DrawGraphicText( clipbox, aDC, txtpos, aColor, etypeName,
1453  orient, wxSize( etextSize, etextSize ),
1454  hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize,
1455  false, false );
1456 }
#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:81
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:289
Definition: lib_pin.h:54
#define TEXT_ANGLE_VERT
Definition: common.h:92
COLOR4D GetInvisibleItemColor()
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
EDA_RECT * GetClipBox()
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:372
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 980 of file lib_pin.cpp.

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

988 {
989  int MapX1, MapY1, x1, y1;
990  int width = GetPenSize();
991  int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
992  EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
993 
994  COLOR4D color = GetLayerColor( LAYER_PIN );
995 
996  if( aColor == COLOR4D::UNSPECIFIED ) // Used normal color or selected color
997  {
998  if( IsSelected() )
999  color = GetItemSelectedColor();
1000  }
1001  else
1002  color = aColor;
1003 
1004  GRSetDrawMode( aDC, aDrawMode );
1005 
1006  MapX1 = MapY1 = 0;
1007  x1 = posX;
1008  y1 = posY;
1009 
1010  switch( aOrient )
1011  {
1012  case PIN_UP:
1013  y1 = posY - len;
1014  MapY1 = 1;
1015  break;
1016 
1017  case PIN_DOWN:
1018  y1 = posY + len;
1019  MapY1 = -1;
1020  break;
1021 
1022  case PIN_LEFT:
1023  x1 = posX - len;
1024  MapX1 = 1;
1025  break;
1026 
1027  case PIN_RIGHT:
1028  x1 = posX + len;
1029  MapX1 = -1;
1030  break;
1031  }
1032 
1033  // Draw the pin end target (active end of the pin)
1034  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
1035  #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
1036 
1037  // Draw but do not print the pin end target 1 pixel width
1038  if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
1039  {
1040  if( aDrawDangling )
1041  GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
1042  }
1043 
1044  if( aOnlyTarget )
1045  return;
1046 
1047 
1049  {
1050  const int radius = ExternalPinDecoSize( *this );
1051  GRCircle( clipbox, aDC, MapX1 * radius + x1,
1052  MapY1 * radius + y1,
1053  radius, width, color );
1054 
1055  GRMoveTo( MapX1 * radius * 2 + x1,
1056  MapY1 * radius * 2 + y1 );
1057  GRLineTo( clipbox, aDC, posX, posY, width, color );
1058  }
1059  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
1060  {
1061  const int clock_size = InternalPinDecoSize( *this );
1062  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1063  {
1064  GRMoveTo( x1, y1 + clock_size );
1065  GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
1066  width, color );
1067  GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
1068  }
1069  else /* MapX1 = 0 */
1070  {
1071  GRMoveTo( x1 + clock_size, y1 );
1072  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
1073  width, color );
1074  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1075  width, color );
1076  }
1077  GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
1078  GRLineTo( clipbox, aDC, posX, posY, width, color );
1079  }
1080  else
1081  {
1082  GRMoveTo( x1, y1 );
1083  GRLineTo( clipbox, aDC, posX, posY, width, color );
1084  }
1085 
1087  {
1088  const int clock_size = InternalPinDecoSize( *this );
1089  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1090  {
1091  GRMoveTo( x1, y1 + clock_size );
1092  GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1,
1093  width, color );
1094  GRLineTo( clipbox, aDC, x1, y1 - clock_size,
1095  width, color );
1096  }
1097  else /* MapX1 = 0 */
1098  {
1099  GRMoveTo( x1 + clock_size, y1 );
1100  GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2,
1101  width, color );
1102  GRLineTo( clipbox, aDC, x1 - clock_size, y1,
1103  width, color );
1104  }
1105  }
1106 
1108  {
1109  const int symbol_size = ExternalPinDecoSize( *this );
1110  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1111  {
1112  GRMoveTo( x1 + MapX1 * symbol_size * 2, y1 );
1113  GRLineTo( clipbox, aDC,
1114  x1 + MapX1 * symbol_size * 2, y1 - symbol_size * 2,
1115  width, color );
1116  GRLineTo( clipbox, aDC, x1, y1, width, color );
1117  }
1118  else /* MapX1 = 0 */
1119  {
1120  GRMoveTo( x1, y1 + MapY1 * symbol_size * 2 );
1121  GRLineTo( clipbox, aDC, x1 - symbol_size * 2,
1122  y1 + MapY1 * symbol_size * 2, width, color );
1123  GRLineTo( clipbox, aDC, x1, y1, width, color );
1124  }
1125  }
1126 
1127 
1128  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1129  {
1130  const int symbol_size = ExternalPinDecoSize( *this );
1131  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1132  {
1133  GRMoveTo( x1, y1 - symbol_size * 2 );
1134  GRLineTo( clipbox,
1135  aDC,
1136  x1 + MapX1 * symbol_size * 2,
1137  y1,
1138  width,
1139  color );
1140  }
1141  else /* MapX1 = 0 */
1142  {
1143  GRMoveTo( x1 - symbol_size * 2, y1 );
1144  GRLineTo( clipbox, aDC, x1, y1 + MapY1 * symbol_size * 2,
1145  width, color );
1146  }
1147  }
1148  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1149  {
1150  const int symbol_size = ExternalPinDecoSize( *this );
1151  GRMoveTo( x1 - (MapX1 + MapY1) * symbol_size,
1152  y1 - (MapY1 - MapX1) * symbol_size );
1153  GRLineTo( clipbox, aDC,
1154  x1 + (MapX1 + MapY1) * symbol_size,
1155  y1 + (MapY1 - MapX1) * symbol_size,
1156  width, color );
1157  GRMoveTo( x1 - (MapX1 - MapY1) * symbol_size,
1158  y1 - (MapY1 + MapX1) * symbol_size );
1159  GRLineTo( clipbox, aDC,
1160  x1 + (MapX1 - MapY1) * symbol_size,
1161  y1 + (MapY1 + MapX1) * symbol_size,
1162  width, color );
1163  }
1164 
1165  if( m_type == PIN_NC ) // Draw a N.C. symbol
1166  {
1167  GRLine( clipbox, aDC,
1168  posX - NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1169  posX + NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1170  width, color );
1171  GRLine( clipbox, aDC,
1172  posX + NCSYMB_PIN_DIM, posY - NCSYMB_PIN_DIM,
1173  posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
1174  width, color );
1175  }
1176 }
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
int m_length
Length of the pin.
Definition: lib_pin.h:70
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
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:899
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 1179 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_numTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PinStringNum(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by drawGraphic().

1188 {
1189  if( !DrawPinName && !DrawPinNum )
1190  return;
1191 
1192  int x, y;
1193  wxString StringPinNum;
1194 
1195  wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
1196  wxSize PinNumSize( m_numTextSize, m_numTextSize );
1197 
1198  int nameLineWidth = GetPenSize();
1199 
1200  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1201  int numLineWidth = GetPenSize();
1202  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1203 
1204  int name_offset = PIN_TEXT_MARGIN +
1205  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1206  int num_offset = PIN_TEXT_MARGIN +
1207  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1208 
1209  GRSetDrawMode( DC, DrawMode );
1210  EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
1211 
1212  /* Get the num and name colors */
1213  if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
1214  Color = GetItemSelectedColor();
1215 
1216  COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
1217  GetLayerColor( LAYER_PINNAM ) : Color;
1218  COLOR4D NumColor = Color == COLOR4D::UNSPECIFIED ?
1219  GetLayerColor( LAYER_PINNUM ) : Color;
1220 
1221  /* Create the pin num string */
1222  PinStringNum( StringPinNum );
1223 
1224  int x1 = pin_pos.x;
1225  int y1 = pin_pos.y;
1226 
1227  switch( orient )
1228  {
1229  case PIN_UP:
1230  y1 -= m_length;
1231  break;
1232 
1233  case PIN_DOWN:
1234  y1 += m_length;
1235  break;
1236 
1237  case PIN_LEFT:
1238  x1 -= m_length;
1239  break;
1240 
1241  case PIN_RIGHT:
1242  x1 += m_length;
1243  break;
1244  }
1245 
1246  if( m_name.IsEmpty() )
1247  DrawPinName = false;
1248 
1249  if( TextInside ) // Draw the text inside, but the pin numbers outside.
1250  {
1251  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1252  {
1253  // It is an horizontal line
1254  if( DrawPinName )
1255  {
1256  if( orient == PIN_RIGHT )
1257  {
1258  x = x1 + TextInside;
1259  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1260  m_name,
1262  PinNameSize,
1264  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1265  false, false );
1266  }
1267  else // Orient == PIN_LEFT
1268  {
1269  x = x1 - TextInside;
1270  DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
1271  m_name,
1273  PinNameSize,
1275  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1276  false, false );
1277  }
1278  }
1279 
1280  if( DrawPinNum )
1281  {
1282  DrawGraphicText( clipbox, DC,
1283  wxPoint( (x1 + pin_pos.x) / 2,
1284  y1 - num_offset ), NumColor,
1285  StringPinNum,
1286  TEXT_ANGLE_HORIZ, PinNumSize,
1288  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1289  false, false );
1290  }
1291  }
1292  else /* Its a vertical line. */
1293  {
1294  // Text is drawn from bottom to top (i.e. to negative value for Y axis)
1295  if( orient == PIN_DOWN )
1296  {
1297  y = y1 + TextInside;
1298 
1299  if( DrawPinName )
1300  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1301  m_name,
1302  TEXT_ANGLE_VERT, PinNameSize,
1304  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1305  false, false );
1306 
1307  if( DrawPinNum )
1308  DrawGraphicText( clipbox, DC,
1309  wxPoint( x1 - num_offset,
1310  (y1 + pin_pos.y) / 2 ), NumColor,
1311  StringPinNum,
1312  TEXT_ANGLE_VERT, PinNumSize,
1314  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1315  false, false );
1316  }
1317  else /* PIN_UP */
1318  {
1319  y = y1 - TextInside;
1320 
1321  if( DrawPinName )
1322  DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
1323  m_name,
1324  TEXT_ANGLE_VERT, PinNameSize,
1326  GR_TEXT_VJUSTIFY_CENTER, nameLineWidth,
1327  false, false );
1328 
1329  if( DrawPinNum )
1330  DrawGraphicText( clipbox, DC,
1331  wxPoint( x1 - num_offset,
1332  (y1 + pin_pos.y) / 2 ), NumColor,
1333  StringPinNum,
1334  TEXT_ANGLE_VERT, PinNumSize,
1336  GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
1337  false, false );
1338  }
1339  }
1340  }
1341  else /**** Draw num & text pin outside ****/
1342  {
1343  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1344  {
1345  /* Its an horizontal line. */
1346  if( DrawPinName )
1347  {
1348  x = (x1 + pin_pos.x) / 2;
1349  DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ),
1350  NameColor, m_name,
1351  TEXT_ANGLE_HORIZ, PinNameSize,
1353  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1354  false, false );
1355  }
1356  if( DrawPinNum )
1357  {
1358  x = (x1 + pin_pos.x) / 2;
1359  DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ),
1360  NumColor, StringPinNum,
1361  TEXT_ANGLE_HORIZ, PinNumSize,
1363  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1364  false, false );
1365  }
1366  }
1367  else /* Its a vertical line. */
1368  {
1369  if( DrawPinName )
1370  {
1371  y = (y1 + pin_pos.y) / 2;
1372  DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ),
1373  NameColor, m_name,
1374  TEXT_ANGLE_VERT, PinNameSize,
1376  GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth,
1377  false, false );
1378  }
1379 
1380  if( DrawPinNum )
1381  {
1382  DrawGraphicText( clipbox, DC,
1383  wxPoint( x1 + num_offset, (y1 + pin_pos.y)
1384  / 2 ),
1385  NumColor, StringPinNum,
1386  TEXT_ANGLE_VERT, PinNumSize,
1388  GR_TEXT_VJUSTIFY_TOP, numLineWidth,
1389  false, false );
1390  }
1391  }
1392  }
1393 }
#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:81
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:80
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
int m_length
Length of the pin.
Definition: lib_pin.h:70
#define TEXT_ANGLE_VERT
Definition: common.h:92
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:899
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
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
#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 492 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().

493 {
494  LIB_PINS pinList;
495 
496  if( GetParent() == NULL )
497  return;
498 
499  GetParent()->GetPins( pinList );
500 
501  for( size_t i = 0; i < pinList.size(); i++ )
502  {
503  if( pinList[i] == this )
504  continue;
505 
506  if( ( pinList[i]->m_position == m_position )
507  && ( pinList[i]->m_orientation == m_orientation )
508  && !IsNew()
509  && editPinByPin == false
510  && enable )
511  pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
512  else
513  pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
514  }
515 }
#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:70
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 203 of file lib_draw_item.h.

References EDA_ITEM::m_Flags.

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

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

References GetBoundingBox().

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

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

Function GetBoundingBox.

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

Definition at line 2156 of file lib_pin.cpp.

References DefaultTransform, ExternalPinDecoSize(), GetNumberString(), 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.

2157 {
2158  LIB_PART* entry = (LIB_PART* ) m_Parent;
2159  EDA_RECT bbox;
2160  wxPoint begin;
2161  wxPoint end;
2162  int nameTextOffset = 0;
2163  bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
2164  bool showNum = m_number != 0;
2165  int minsizeV = TARGET_PIN_RADIUS;
2166 
2167  if( !aIncludeInvisibles && !IsVisible() )
2168  showName = false;
2169 
2170  if( entry )
2171  {
2172  if( entry->ShowPinNames() )
2173  nameTextOffset = entry->GetPinNameOffset();
2174  else
2175  showName = false;
2176 
2177  showNum = entry->ShowPinNumbers();
2178  }
2179 
2180  // First, calculate boundary box corners position
2181  int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0;
2182 
2183  // Actual text height is bigger than text size
2184  int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
2185 
2187  minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
2188 
2189  // calculate top left corner position
2190  // for the default pin orientation (PIN_RIGHT)
2191  begin.y = std::max( minsizeV, numberTextHeight + PIN_TEXT_MARGIN );
2192  begin.x = std::min( -TARGET_PIN_RADIUS, m_length - (numberTextLength / 2) );
2193 
2194  // calculate bottom right corner position and adjust top left corner position
2195  int nameTextLength = 0;
2196  int nameTextHeight = 0;
2197 
2198  if( showName )
2199  {
2200  int length = m_name.Len();
2201 
2202  // Don't count the line over text symbol.
2203  if( m_name.Left( 1 ) == wxT( "~" ) )
2204  length -= 1;
2205 
2206  nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
2207 
2208  // Actual text height are bigger than text size
2209  nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + PIN_TEXT_MARGIN;
2210  }
2211 
2212  if( nameTextOffset ) // for values > 0, pin name is inside the body
2213  {
2214  end.x = m_length + nameTextLength;
2215  end.y = std::min( -minsizeV, -nameTextHeight / 2 );
2216  }
2217  else // if value == 0:
2218  // pin name is outside the body, and above the pin line
2219  // pin num is below the pin line
2220  {
2221  end.x = std::max(m_length, nameTextLength);
2222  end.y = -begin.y;
2223  begin.y = std::max( minsizeV, nameTextHeight );
2224  }
2225 
2226  // Now, calculate boundary box corners position for the actual pin orientation
2227  int orient = PinDrawOrient( DefaultTransform );
2228 
2229  /* Calculate the pin position */
2230  switch( orient )
2231  {
2232  case PIN_UP:
2233  // Pin is rotated and texts positions are mirrored
2234  RotatePoint( &begin, wxPoint( 0, 0 ), -900 );
2235  RotatePoint( &end, wxPoint( 0, 0 ), -900 );
2236  break;
2237 
2238  case PIN_DOWN:
2239  RotatePoint( &begin, wxPoint( 0, 0 ), 900 );
2240  RotatePoint( &end, wxPoint( 0, 0 ), 900 );
2241  begin.x = -begin.x;
2242  end.x = -end.x;
2243  break;
2244 
2245  case PIN_LEFT:
2246  begin.x = -begin.x;
2247  end.x = -end.x;
2248  break;
2249 
2250  case PIN_RIGHT:
2251  break;
2252  }
2253 
2254  begin += m_position;
2255  end += m_position;
2256 
2257  bbox.SetOrigin( begin );
2258  bbox.SetEnd( end );
2259  bbox.Normalize();
2260  bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
2261 
2262  // Draw Y axis is reversed in schematic:
2263  bbox.RevertYAxis();
2264 
2265  return bbox;
2266 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:81
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:80
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:899
bool ShowPinNumbers()
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:372
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:57
#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
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
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:1841
#define min(a, b)
Definition: auxiliary.h:85
wxString GetNumberString() const
Definition: lib_pin.h:175
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 280 of file lib_pin.h.

281  {
283  }
wxString const GetCanonicalElectricalTypeName() const
return a string giving the electrical type of the pin.
Definition: lib_pin.h:280
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 109 of file lib_pin.h.

110  {
111  return wxT( "LIB_PIN" );
112  }
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(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
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 289 of file lib_pin.h.

References GetText().

Referenced by DrawPinElectricalTypeName(), and GetSelectMenuText().

290  {
291  return GetText( m_type );
292  }
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 421 of file lib_draw_item.h.

References LIB_ITEM::m_Fill.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

421 { 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 313 of file lib_pin.h.

References m_length.

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

313 { 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 2337 of file lib_pin.cpp.

References GetBitmap(), and m_type.

2338 {
2339  return GetBitmap( m_type );
2340 }
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 2117 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().

2118 {
2119  getMsgPanelInfoBase( aList );
2120 
2121  wxString text;
2122  wxPoint pinpos = GetPosition();
2123  pinpos.y = -pinpos.y; // Display coord are top to bottom
2124  // lib items coord are bottom to top
2125 
2126  text = StringFromValue( g_UserUnit, pinpos.x, true );
2127  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
2128 
2129  text = StringFromValue( g_UserUnit, pinpos.y, true );
2130  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
2131 }
void getMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Build the pin basic info to display in message panel.
Definition: lib_pin.cpp:2079
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:471
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
aComponentis the component which "owns" the pin

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

2135 {
2136  getMsgPanelInfoBase( aList );
2137 
2138  if( !aComponent )
2139  return;
2140 
2141  wxString text;
2142  wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
2143  + aComponent->GetPosition();
2144 
2145  text = StringFromValue( g_UserUnit, pinpos.x, true );
2146  aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
2147 
2148  text = StringFromValue( g_UserUnit, pinpos.y, true );
2149  aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
2150 
2151  aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
2152  aComponent->GetField( VALUE )->GetShownText(),
2153  DARKCYAN ) );
2154 }
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:2079
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
Function GetField returns a field.
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:471
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 2079 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, PinStringNum(), RED, and StringFromValue().

Referenced by GetMsgPanelInfo().

2080 {
2081  wxString text;
2082 
2083  LIB_ITEM::GetMsgPanelInfo( aList );
2084 
2085  aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
2086 
2087  if( m_number == 0 )
2088  text = wxT( "?" );
2089  else
2090  PinStringNum( text );
2091 
2092  aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
2093 
2094  aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
2095  GetText( m_type ),
2096  RED ) );
2097 
2098  text = GetText( m_shape );
2099 
2100  aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
2101 
2102  if( IsVisible() )
2103  text = _( "Yes" );
2104  else
2105  text = _( "No" );
2106 
2107  aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
2108 
2109  // Display pin length
2110  text = StringFromValue( g_UserUnit, m_length, true );
2111  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
2112 
2114  aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
2115 }
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:2289
int m_orientation
Pin orientation (Up, Down, Left, Right)
Definition: lib_pin.h:71
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:372
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...
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
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
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
wxString LIB_PIN::GetName ( void  ) const
inline

Definition at line 192 of file lib_pin.h.

References m_name.

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

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

Definition at line 213 of file lib_pin.h.

References m_nameTextSize.

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

213 { return m_nameTextSize; }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:81
long LIB_PIN::GetNumber ( ) const
inline

Definition at line 173 of file lib_pin.h.

References m_number.

Referenced by NETLIST_EXPORTER::addPinToComponentPinList(), FormatProbeItem(), LIB_EDIT_FRAME::OnCheckComponent(), and sort_by_pin_number().

173 { return m_number; }
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
wxString LIB_PIN::GetNumberString ( ) const
inline

Definition at line 175 of file lib_pin.h.

References PinStringNum().

Referenced by GetBoundingBox(), GetSelectMenuText(), Matches(), LIB_EDIT_FRAME::OnEditPin(), and sortPinsByNumber().

175 { return PinStringNum( m_number ); }
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
int LIB_PIN::GetNumberTextSize ( ) const
inline

Definition at line 234 of file lib_pin.h.

References m_numTextSize.

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

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

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

236 { 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 2280 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().

2281 {
2282  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
2283  return pin_orientation_codes[ index ];
2284 
2285  return PIN_RIGHT;
2286 }
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 2289 of file lib_pin.cpp.

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

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

2290 {
2291  size_t i;
2292 
2293  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
2294  {
2295  if( pin_orientation_codes[i] == code )
2296  return (int) i;
2297  }
2298 
2299  return wxNOT_FOUND;
2300 }
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 2269 of file lib_pin.cpp.

References getPinOrientationName(), and PIN_ORIENTATION_CNT.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2270 {
2271  wxArrayString tmp;
2272 
2273  for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
2274  tmp.Add( getPinOrientationName( ii ) );
2275 
2276  return tmp;
2277 }
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 2331 of file lib_pin.cpp.

References iconsPinsOrientations.

Referenced by LIB_EDIT_FRAME::OnEditPin().

2332 {
2333  return iconsPinsOrientations;
2334 }
static const BITMAP_DEF iconsPinsOrientations[]
Definition: lib_pin.cpp:65
int LIB_PIN::GetPartNumber ( ) const
inline

Get the pin part number.

Definition at line 327 of file lib_pin.h.

References LIB_ITEM::m_Unit.

327 { 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 899 of file lib_pin.cpp.

References GetDefaultLineThickness(), and m_width.

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

900 {
901  return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
902 }
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 471 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().

471 { 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 2343 of file lib_pin.cpp.

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

Referenced by Matches().

2344 {
2345  wxString tmp;
2346  wxString style;
2347 
2348  style = GetText( m_shape );
2349 
2350  tmp.Printf( _( "Pin %s, %s, %s" ),
2353  GetChars( style )
2354  );
2355  return tmp;
2356 }
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:289
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
wxString GetNumberString() const
Definition: lib_pin.h:175
GRAPHIC_PINSHAPE LIB_PIN::GetShape ( ) const
inline

Definition at line 249 of file lib_pin.h.

References m_shape.

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

249 { 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.

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

References m_type.

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

265 { 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 164 of file lib_draw_item.h.

References LIB_ITEM::m_typeName.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

164 { 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 490 of file lib_pin.h.

References m_width.

490 { 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 518 of file lib_pin.cpp.

References DefaultTransform.

519 {
520  return HitTest( aPosition, 0, DefaultTransform );
521 }
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:518
TRANSFORM DefaultTransform
Definition: eeschema.cpp:57
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 524 of file lib_pin.cpp.

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

525 {
526  if( aThreshold < 0 )
527  aThreshold = 0;
528 
529  TRANSFORM transform = DefaultTransform;
530  DefaultTransform = aTransform;
531 
532  EDA_RECT rect = GetBoundingBox();
533  rect.Inflate( aThreshold );
534 
535  //Restore matrix
536  DefaultTransform = transform;
537 
538  return rect.Contains( aPosition );
539 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const override
Definition: lib_pin.h:138
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM DefaultTransform
Definition: eeschema.cpp:57
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 405 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().

405 { 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 1961 of file lib_pin.cpp.

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

1962 {
1963  wxPoint end = PinEndPoint();
1964 
1965  return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
1966 }
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
wxPoint PinEndPoint() const
Function PinEndPoint.
Definition: lib_pin.cpp:1814
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 398 of file lib_draw_item.h.

References LIB_ITEM::m_isFillable.

Referenced by LIB_EDIT_FRAME::EditGraphicSymbol().

398 { 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(), 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 378 of file lib_pin.h.

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

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

378 { return !IsVisible() && GetType() == PIN_POWER_IN; }
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
Definition: lib_pin.h:265
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:372
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 372 of file lib_pin.h.

References PIN_INVISIBLE.

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

372 { 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 686 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, SetPinNumFromString(), TO_UTF8, wxPoint::x, and wxPoint::y.

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

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

2360 {
2361  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
2362 
2363  // Note: this will have to be modified if we add find and replace capability to the
2364  // compoment library editor. Otherwise, you wont be able to replace pin text.
2365  if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS )
2366  || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
2367  return false;
2368 
2369  wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
2370 
2371  if( EDA_ITEM::Matches( GetName(), aSearchData )
2372  || EDA_ITEM::Matches( GetNumberString(), aSearchData ) )
2373  {
2374  if( aFindLocation )
2375  *aFindLocation = GetBoundingBox().Centre();
2376 
2377  return true;
2378  }
2379 
2380  return false;
2381 }
const wxString traceFindItem
Flag to enable find item tracing using the WXTRACE environment variable.
wxString GetName() const
Definition: lib_pin.h:192
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:138
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:2343
Perform a search for a item that has replaceable text.
wxString GetNumberString() const
Definition: lib_pin.h:175
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 1979 of file lib_pin.cpp.

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

1980 {
1981  m_position.x -= center.x;
1982  m_position.x *= -1;
1983  m_position.x += center.x;
1984 
1985  if( m_orientation == PIN_RIGHT )
1987  else if( m_orientation == PIN_LEFT )
1989 }
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 1991 of file lib_pin.cpp.

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

1992 {
1993  m_position.y -= center.y;
1994  m_position.y *= -1;
1995  m_position.y += center.y;
1996 
1997  if( m_orientation == PIN_UP )
1999  else if( m_orientation == PIN_DOWN )
2001 }
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 1969 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().

1970 {
1971  if( m_position != newPosition )
1972  {
1973  m_position = newPosition;
1974  SetModified();
1975  }
1976 }
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 287 of file lib_draw_item.h.

288  {
289  return *this == *aOther;
290  }
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 1841 of file lib_pin.cpp.

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

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

1842 {
1843  int orient;
1844  wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1
1845 
1846  switch( m_orientation )
1847  {
1848  case PIN_UP:
1849  end.y = 1;
1850  break;
1851 
1852  case PIN_DOWN:
1853  end.y = -1;
1854  break;
1855 
1856  case PIN_LEFT:
1857  end.x = -1;
1858  break;
1859 
1860  case PIN_RIGHT:
1861  end.x = 1;
1862  break;
1863  }
1864 
1865  // = pos of end point, according to the component orientation
1866  end = aTransform.TransformCoordinate( end );
1867  orient = PIN_UP;
1868 
1869  if( end.x == 0 )
1870  {
1871  if( end.y > 0 )
1872  orient = PIN_DOWN;
1873  }
1874  else
1875  {
1876  orient = PIN_RIGHT;
1877 
1878  if( end.x < 0 )
1879  orient = PIN_LEFT;
1880  }
1881 
1882  return orient;
1883 }
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 1814 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().

1815 {
1816  wxPoint pos = m_position;
1817 
1818  switch( m_orientation )
1819  {
1820  case PIN_UP:
1821  pos.y += m_length;
1822  break;
1823 
1824  case PIN_DOWN:
1825  pos.y -= m_length;
1826  break;
1827 
1828  case PIN_LEFT:
1829  pos.x -= m_length;
1830  break;
1831 
1832  case PIN_RIGHT:
1833  pos.x += m_length;
1834  break;
1835  }
1836 
1837  return pos;
1838 }
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::PinStringNum ( wxString &  aStringBuffer) const

Fill a string buffer with pin number.

Pin numbers are coded as a long or 4 ASCII characters. Used to print or draw the pin number.

Parameters
aStringBuffer- the wxString to store the pin num as an unicode string

Definition at line 1886 of file lib_pin.cpp.

References m_number.

Referenced by DrawPinTexts(), FormatProbeItem(), getMsgPanelInfoBase(), GetNumberString(), NETLIST_OBJECT::GetPinNumText(), NETLIST_OBJECT::GetShortNetName(), LIB_EDIT_FRAME::OnCheckComponent(), PlotPinTexts(), LIB_EDIT_FRAME::RepeatPinItem(), and Save().

1887 {
1888  aStringBuffer = PinStringNum( m_number );
1889 }
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
wxString LIB_PIN::PinStringNum ( long  aPinNum)
static

Function PinStringNum (static function) Pin num is coded as a long or 4 ascii chars.

Parameters
aPinNum= a long containing a pin num
Returns
aStringBuffer = the wxString to store the pin num as an unicode string

Definition at line 1892 of file lib_pin.cpp.

References FROM_UTF8().

1893 {
1894  char ascii_buf[5];
1895 
1896  memcpy( ascii_buf, &aPinNum, 4 );
1897  ascii_buf[4] = 0;
1898 
1899  wxString buffer = FROM_UTF8( ascii_buf );
1900 
1901  return buffer;
1902 }
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
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 2052 of file lib_pin.cpp.

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

2054 {
2055  if( ! IsVisible() )
2056  return;
2057 
2058  int orient = PinDrawOrient( aTransform );
2059 
2060  wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
2061 
2062  PlotSymbol( plotter, pos, orient );
2063  PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
2064  GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
2065  GetPenSize() );
2066 }
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:1610
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:899
LIB_PART * GetParent() const
void PlotSymbol(PLOTTER *aPlotter, const wxPoint &aPosition, int aOrientation)
Definition: lib_pin.cpp:1459
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:372
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:1841
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 1610 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_numTextSize, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PinStringNum(), PLOTTER::Text(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by Plot().

1613 {
1614  if( m_name.IsEmpty() || m_name == wxT( "~" ) )
1615  DrawPinName = false;
1616 
1617  /* Create the pin num string */
1618  wxString StringPinNum;
1619  PinStringNum( StringPinNum );
1620 
1621  if( StringPinNum.IsEmpty() )
1622  DrawPinNum = false;
1623 
1624  if( !DrawPinNum && !DrawPinName )
1625  return;
1626 
1627  int x, y;
1628  wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
1629  wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
1630 
1631  int nameLineWidth = GetPenSize();
1632  nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
1633  int numLineWidth = GetPenSize();
1634  numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
1635 
1636  int name_offset = PIN_TEXT_MARGIN +
1637  ( nameLineWidth + GetDefaultLineThickness() ) / 2;
1638  int num_offset = PIN_TEXT_MARGIN +
1639  ( numLineWidth + GetDefaultLineThickness() ) / 2;
1640 
1641  /* Get the num and name colors */
1642  COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
1643  COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
1644 
1645  int x1 = pin_pos.x;
1646  int y1 = pin_pos.y;
1647 
1648  switch( orient )
1649  {
1650  case PIN_UP:
1651  y1 -= m_length;
1652  break;
1653 
1654  case PIN_DOWN:
1655  y1 += m_length;
1656  break;
1657 
1658  case PIN_LEFT:
1659  x1 -= m_length;
1660  break;
1661 
1662  case PIN_RIGHT:
1663  x1 += m_length;
1664  break;
1665  }
1666 
1667  /* Draw the text inside, but the pin numbers outside. */
1668  if( TextInside )
1669  {
1670  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */
1671  {
1672  if( DrawPinName )
1673  {
1674  if( orient == PIN_RIGHT )
1675  {
1676  x = x1 + TextInside;
1677  plotter->Text( wxPoint( x, y1 ), NameColor,
1678  m_name,
1680  PinNameSize,
1683  aWidth, false, false );
1684  }
1685  else // orient == PIN_LEFT
1686  {
1687  x = x1 - TextInside;
1688 
1689  if( DrawPinName )
1690  plotter->Text( wxPoint( x, y1 ),
1691  NameColor, m_name, TEXT_ANGLE_HORIZ,
1692  PinNameSize,
1695  aWidth, false, false );
1696  }
1697  }
1698  if( DrawPinNum )
1699  {
1700  plotter->Text( wxPoint( (x1 + pin_pos.x) / 2,
1701  y1 - num_offset ),
1702  NumColor, StringPinNum,
1703  TEXT_ANGLE_HORIZ, PinNumSize,
1706  aWidth, false, false );
1707  }
1708  }
1709  else /* Its a vertical line. */
1710  {
1711  if( orient == PIN_DOWN )
1712  {
1713  y = y1 + TextInside;
1714 
1715  if( DrawPinName )
1716  plotter->Text( wxPoint( x1, y ), NameColor,
1717  m_name,
1718  TEXT_ANGLE_VERT, PinNameSize,
1721  aWidth, false, false );
1722 
1723  if( DrawPinNum )
1724  {
1725  plotter->Text( wxPoint( x1 - num_offset,
1726  (y1 + pin_pos.y) / 2 ),
1727  NumColor, StringPinNum,
1728  TEXT_ANGLE_VERT, PinNumSize,
1731  aWidth, false, false );
1732  }
1733  }
1734  else /* PIN_UP */
1735  {
1736  y = y1 - TextInside;
1737 
1738  if( DrawPinName )
1739  plotter->Text( wxPoint( x1, y ), NameColor,
1740  m_name,
1741  TEXT_ANGLE_VERT, PinNameSize,
1744  aWidth, false, false );
1745 
1746  if( DrawPinNum )
1747  {
1748  plotter->Text( wxPoint( x1 - num_offset,
1749  (y1 + pin_pos.y) / 2 ),
1750  NumColor, StringPinNum,
1751  TEXT_ANGLE_VERT, PinNumSize,
1754  aWidth, false, false );
1755  }
1756  }
1757  }
1758  }
1759  else /* Draw num & text pin outside */
1760  {
1761  if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) )
1762  {
1763  /* Its an horizontal line. */
1764  if( DrawPinName )
1765  {
1766  x = (x1 + pin_pos.x) / 2;
1767  plotter->Text( wxPoint( x, y1 - name_offset ),
1768  NameColor, m_name,
1769  TEXT_ANGLE_HORIZ, PinNameSize,
1772  aWidth, false, false );
1773  }
1774 
1775  if( DrawPinNum )
1776  {
1777  x = ( x1 + pin_pos.x ) / 2;
1778  plotter->Text( wxPoint( x, y1 + num_offset ),
1779  NumColor, StringPinNum,
1780  TEXT_ANGLE_HORIZ, PinNumSize,
1783  aWidth, false, false );
1784  }
1785  }
1786  else /* Its a vertical line. */
1787  {
1788  if( DrawPinName )
1789  {
1790  y = ( y1 + pin_pos.y ) / 2;
1791  plotter->Text( wxPoint( x1 - name_offset, y ),
1792  NameColor, m_name,
1793  TEXT_ANGLE_VERT, PinNameSize,
1796  aWidth, false, false );
1797  }
1798 
1799  if( DrawPinNum )
1800  {
1801  plotter->Text( wxPoint( x1 + num_offset,
1802  ( y1 + pin_pos.y ) / 2 ),
1803  NumColor, StringPinNum,
1804  TEXT_ANGLE_VERT, PinNumSize,
1807  aWidth, false, false );
1808  }
1809  }
1810  }
1811 }
#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:81
int m_numTextSize
Definition: lib_pin.h:80
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
int m_length
Length of the pin.
Definition: lib_pin.h:70
#define TEXT_ANGLE_VERT
Definition: common.h:92
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:899
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
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
#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 1459 of file lib_pin.cpp.

References PLOTTER::Circle(), 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().

1460 {
1461  int MapX1, MapY1, x1, y1;
1462  COLOR4D color = GetLayerColor( LAYER_PIN );
1463 
1464  aPlotter->SetColor( color );
1465  aPlotter->SetCurrentLineWidth( GetPenSize() );
1466 
1467  MapX1 = MapY1 = 0;
1468  x1 = aPosition.x; y1 = aPosition.y;
1469 
1470  switch( aOrientation )
1471  {
1472  case PIN_UP:
1473  y1 = aPosition.y - m_length;
1474  MapY1 = 1;
1475  break;
1476 
1477  case PIN_DOWN:
1478  y1 = aPosition.y + m_length;
1479  MapY1 = -1;
1480  break;
1481 
1482  case PIN_LEFT:
1483  x1 = aPosition.x - m_length;
1484  MapX1 = 1;
1485  break;
1486 
1487  case PIN_RIGHT:
1488  x1 = aPosition.x + m_length;
1489  MapX1 = -1;
1490  break;
1491  }
1492 
1494  {
1495  const int radius = ExternalPinDecoSize( *this );
1496  aPlotter->Circle( wxPoint( MapX1 * radius + x1,
1497  MapY1 * radius + y1 ),
1498  radius * 2, // diameter
1499  NO_FILL, // fill option
1500  GetPenSize() ); // width
1501 
1502  aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1,
1503  MapY1 * radius * 2 + y1 ) );
1504  aPlotter->FinishTo( aPosition );
1505  }
1506  else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
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  aPlotter->MoveTo( wxPoint( MapX1 * clock_size * 2 + x1,
1523  MapY1 * clock_size * 2 + y1 ) );
1524  aPlotter->FinishTo( aPosition );
1525  }
1526  else
1527  {
1528  aPlotter->MoveTo( wxPoint( x1, y1 ) );
1529  aPlotter->FinishTo( aPosition );
1530  }
1531 
1534  {
1535  const int clock_size = InternalPinDecoSize( *this );
1536  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1537  {
1538  aPlotter->MoveTo( wxPoint( x1, y1 + clock_size ) );
1539  aPlotter->LineTo( wxPoint( x1 - MapX1 * clock_size * 2, y1 ) );
1540  aPlotter->FinishTo( wxPoint( x1, y1 - clock_size ) );
1541  }
1542  else /* MapX1 = 0 */
1543  {
1544  aPlotter->MoveTo( wxPoint( x1 + clock_size, y1 ) );
1545  aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * clock_size * 2 ) );
1546  aPlotter->FinishTo( wxPoint( x1 - clock_size, y1 ) );
1547  }
1548  }
1549 
1550  if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
1551  {
1552  const int symbol_size = ExternalPinDecoSize( *this );
1553 
1554  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1555  {
1556  aPlotter->MoveTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1557  aPlotter->LineTo( wxPoint( x1 + MapX1 * symbol_size * 2,
1558  y1 - symbol_size * 2 ) );
1559  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1560  }
1561  else /* MapX1 = 0 */
1562  {
1563  aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1564  aPlotter->LineTo( wxPoint( x1 - symbol_size * 2,
1565  y1 + MapY1 * symbol_size * 2 ) );
1566  aPlotter->FinishTo( wxPoint( x1, y1 ) );
1567  }
1568  }
1569 
1570 
1571  if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
1572  {
1573  const int symbol_size = ExternalPinDecoSize( *this );
1574 
1575  if( MapY1 == 0 ) /* MapX1 = +- 1 */
1576  {
1577  aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) );
1578  aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) );
1579  }
1580  else /* MapX1 = 0 */
1581  {
1582  aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) );
1583  aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
1584  }
1585  }
1586  else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
1587  {
1588  const int symbol_size = ExternalPinDecoSize( *this );
1589  aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * symbol_size,
1590  y1 - (MapY1 - MapX1) * symbol_size ) );
1591  aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * symbol_size,
1592  y1 + (MapY1 - MapX1) * symbol_size ) );
1593  aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * symbol_size,
1594  y1 - (MapY1 + MapX1) * symbol_size ) );
1595  aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * symbol_size,
1596  y1 + (MapY1 + MapX1) * symbol_size ) );
1597  }
1598  if( m_type == PIN_NC ) // Draw a N.C. symbol
1599  {
1600  const int ex1 = aPosition.x;
1601  const int ey1 = aPosition.y;
1602  aPlotter->MoveTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1603  aPlotter->FinishTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1604  aPlotter->MoveTo( wxPoint( ex1 + NCSYMB_PIN_DIM, ey1 - NCSYMB_PIN_DIM ) );
1605  aPlotter->FinishTo( wxPoint( ex1 - NCSYMB_PIN_DIM, ey1 + NCSYMB_PIN_DIM ) );
1606  }
1607 }
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
int m_length
Length of the pin.
Definition: lib_pin.h:70
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
int GetPenSize() const override
Function GetPenSize.
Definition: lib_pin.cpp:899
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(), SCH_FIND_COLLECTOR::ReplaceItem(), and ALIAS_INFO_GENERATOR::SetHtmlAliasOf().

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 2303 of file lib_pin.cpp.

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

2304 {
2305  int orient = PIN_RIGHT;
2306 
2307  switch( GetOrientation() )
2308  {
2309  case PIN_UP:
2310  orient = PIN_LEFT;
2311  break;
2312 
2313  case PIN_DOWN:
2314  orient = PIN_RIGHT;
2315  break;
2316 
2317  case PIN_LEFT:
2318  orient = PIN_DOWN;
2319  break;
2320 
2321  case PIN_RIGHT:
2322  orient = PIN_UP;
2323  break;
2324  }
2325 
2326  // Set the new orientation
2327  SetOrientation( orient );
2328 }
void SetOrientation(int aOrientation)
Set orientation on the pin.
Definition: lib_pin.cpp:256
Definition: lib_pin.h:54
int GetOrientation() const
Definition: lib_pin.h:236
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 2003 of file lib_pin.cpp.

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

2004 {
2005  int rot_angle = aRotateCCW ? -900 : 900;
2006 
2007  RotatePoint( &m_position, center, rot_angle );
2008 
2009  if( aRotateCCW )
2010  {
2011  switch( m_orientation )
2012  {
2013  case PIN_RIGHT:
2015  break;
2016 
2017  case PIN_UP:
2019  break;
2020  case PIN_LEFT:
2022  break;
2023 
2024  case PIN_DOWN:
2026  break;
2027  }
2028  }
2029  else
2030  {
2031  switch( m_orientation )
2032  {
2033  case PIN_RIGHT:
2035  break;
2036 
2037  case PIN_UP:
2039  break;
2040  case PIN_LEFT:
2042  break;
2043 
2044  case PIN_DOWN:
2046  break;
2047  }
2048  }
2049 }
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 542 of file lib_pin.cpp.

References EDA_ITEM::ClearFlags(), IS_CHANGED, IsVisible(), 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_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, PinStringNum(), OUTPUTFORMATTER::Print(), TO_UTF8, wxPoint::x, and wxPoint::y.

543 {
544  wxString StringPinNum;
545  int Etype;
546 
547  switch( m_type )
548  {
549  default:
550  case PIN_INPUT:
551  Etype = 'I';
552  break;
553 
554  case PIN_OUTPUT:
555  Etype = 'O';
556  break;
557 
558  case PIN_BIDI:
559  Etype = 'B';
560  break;
561 
562  case PIN_TRISTATE:
563  Etype = 'T';
564  break;
565 
566  case PIN_PASSIVE:
567  Etype = 'P';
568  break;
569 
570  case PIN_UNSPECIFIED:
571  Etype = 'U';
572  break;
573 
574  case PIN_POWER_IN:
575  Etype = 'W';
576  break;
577 
578  case PIN_POWER_OUT:
579  Etype = 'w';
580  break;
581 
582  case PIN_OPENCOLLECTOR:
583  Etype = 'C';
584  break;
585 
586  case PIN_OPENEMITTER:
587  Etype = 'E';
588  break;
589 
590  case PIN_NC:
591  Etype = 'N';
592  break;
593  }
594 
595  PinStringNum( StringPinNum );
596 
597  if( StringPinNum.IsEmpty() )
598  StringPinNum = wxT( "~" );
599 
600  if( !m_name.IsEmpty() )
601  {
602  if( aFormatter.Print( 0, "X %s", TO_UTF8( m_name ) ) < 0 )
603  return false;
604  }
605  else
606  {
607  if( aFormatter.Print( 0, "X ~" ) < 0 )
608  return false;
609  }
610 
611  if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
612  TO_UTF8( StringPinNum ), m_position.x, m_position.y,
614  m_Unit, m_Convert, Etype ) < 0 )
615  return false;
616 
617  if( m_shape || !IsVisible() )
618  {
619  if( aFormatter.Print( 0, " " ) < 0 )
620  return false;
621  }
622 
623  if( !IsVisible() && aFormatter.Print( 0, "N" ) < 0 )
624  return false;
625 
626  switch( m_shape )
627  {
628  case PINSHAPE_LINE:
629  break;
630 
631  case PINSHAPE_INVERTED:
632  if( aFormatter.Print( 0, "I" ) < 0 )
633  return false;
634  break;
635 
636  case PINSHAPE_CLOCK:
637  if( aFormatter.Print( 0, "C" ) < 0 )
638  return false;
639  break;
640 
642  if( aFormatter.Print( 0, "IC" ) < 0 )
643  return false;
644  break;
645 
646  case PINSHAPE_INPUT_LOW:
647  if( aFormatter.Print( 0, "L" ) < 0 )
648  return false;
649  break;
650 
651  case PINSHAPE_CLOCK_LOW:
652  if( aFormatter.Print( 0, "CL" ) < 0 )
653  return false;
654  break;
655 
656  case PINSHAPE_OUTPUT_LOW:
657  if( aFormatter.Print( 0, "V" ) < 0 )
658  return false;
659  break;
660 
662  if( aFormatter.Print( 0, "F" ) < 0 )
663  return false;
664  break;
665 
666  case PINSHAPE_NONLOGIC:
667  if( aFormatter.Print( 0, "X" ) < 0 )
668  return false;
669  break;
670 
671  default:
672  assert( !"Invalid pin shape" );
673  return false;
674  }
675 
676  if( aFormatter.Print( 0, "\n" ) < 0 )
677  return false;
678 
680 
681  return true;
682 }
int m_nameTextSize
Pin num and Pin name sizes.
Definition: lib_pin.h:81
GRAPHIC_PINSHAPE m_shape
Shape drawn around pin.
Definition: lib_pin.h:72
int m_numTextSize
Definition: lib_pin.h:80
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
bool IsVisible() const
Return the visibility status of the draw object.
Definition: lib_pin.h:372
wxPoint m_position
Position of the pin.
Definition: lib_pin.h:69
void PinStringNum(wxString &aStringBuffer) const
Fill a string buffer with pin number.
Definition: lib_pin.cpp:1886
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 428 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().

429 {
430  if( m_Convert == style )
431  return;
432 
433  m_Convert = style;
434  SetFlags( IS_CHANGED );
435 
436  if( style == 0 )
437  {
438  LIB_PIN* pin;
439  LIB_PIN* tmp = GetParent()->GetNextPin();
440 
441  while( tmp != NULL )
442  {
443  pin = tmp;
444  tmp = GetParent()->GetNextPin( pin );
445 
446  if( ( pin->m_Flags & IS_LINKED ) == 0
447  || ( pin == this )
448  || ( m_Unit && ( m_Unit != pin->m_Unit ) )
449  || ( m_position != pin->m_position )
450  || ( pin->m_orientation != m_orientation ) )
451  continue;
452 
453  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
454  }
455  }
456 }
#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:77
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 415 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().

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

Definition at line 419 of file lib_draw_item.h.

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

419 { 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(), 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(), SetNumber(), 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 344 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().

345 {
346  if( m_length != length )
347  {
348  m_length = length;
349  SetModified();
350  }
351 
352  if( GetParent() == NULL )
353  return;
354 
355  LIB_PINS pinList;
356  GetParent()->GetPins( pinList );
357 
358  for( size_t i = 0; i < pinList.size(); i++ )
359  {
360  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
361  || pinList[i]->m_Convert != m_Convert
362  || pinList[i]->m_length == length )
363  continue;
364 
365  pinList[i]->m_length = length;
366  SetModified();
367  }
368 }
#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:70
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(), SCH_COMPONENT::Move(), 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 160 of file lib_pin.cpp.

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

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

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

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

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

190 {
191  if( size != m_nameTextSize )
192  {
193  m_nameTextSize = size;
194  SetModified();
195  }
196 
197  if( GetParent() == NULL )
198  return;
199 
200  LIB_PINS pinList;
201  GetParent()->GetPins( pinList );
202 
203  for( size_t i = 0; i < pinList.size(); i++ )
204  {
205  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_nameTextSize == size )
206  continue;
207 
208  pinList[i]->m_nameTextSize = size;
209  SetModified();
210  }
211 }
#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:81
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:70
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)

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 214 of file lib_pin.cpp.

References IS_CHANGED, m_number, EDA_ITEM::SetFlags(), and SetPinNumFromString().

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

215 {
216  wxString tmp = ( number.IsEmpty() ) ? wxT( "~" ) : number;
217 
218  tmp.Replace( wxT( " " ), wxT( "_" ) );
219  long oldNumber = m_number;
220  SetPinNumFromString( tmp );
221 
222  if( m_number != oldNumber )
223  SetFlags( IS_CHANGED );
224 
225  /* Others pin numbers marked by EnableEditMode() are not modified
226  * because each pin has its own number
227  */
228 }
#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 SetPinNumFromString(wxString &aBuffer)
Function SetPinNumFromString fill the pin number buffer with aBuffer.
Definition: lib_pin.cpp:1905
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
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 231 of file lib_pin.cpp.

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

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

232 {
233  if( size != m_numTextSize )
234  {
235  m_numTextSize = size;
236  SetModified();
237  }
238 
239  if( GetParent() == NULL )
240  return;
241 
242  LIB_PINS pinList;
243  GetParent()->GetPins( pinList );
244 
245  for( size_t i = 0; i < pinList.size(); i++ )
246  {
247  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_numTextSize == size )
248  continue;
249 
250  pinList[i]->m_numTextSize = size;
251  SetModified();
252  }
253 }
#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:80
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
LIB_PART * GetParent() const
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:70
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 1955 of file lib_pin.cpp.

References m_position.

1956 {
1957  m_position += aOffset;
1958 }
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 256 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().

257 {
258  if( m_orientation != orientation )
259  {
260  m_orientation = orientation;
261  SetModified();
262  }
263 
264  if( GetParent() == NULL )
265  return;
266 
267  LIB_PINS pinList;
268  GetParent()->GetPins( pinList );
269 
270  for( size_t i = 0; i < pinList.size(); i++ )
271  {
272  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
273  pinList[i]->m_orientation == orientation )
274  continue;
275 
276  pinList[i]->m_orientation = orientation;
277  SetModified();
278  }
279 }
#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:70
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_COMPONENT::SwapData(), and SCH_SHEET::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 398 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().

399 {
400  if( m_Unit == part )
401  return;
402 
403  m_Unit = part;
404  SetModified();
405 
406  if( m_Unit == 0 )
407  {
408  LIB_PIN* pin;
409  LIB_PIN* tmp = GetParent()->GetNextPin();
410 
411  while( tmp != NULL )
412  {
413  pin = tmp;
414  tmp = GetParent()->GetNextPin( pin );
415 
416  if( pin->m_Flags == 0 || pin == this
417  || ( m_Convert && ( m_Convert != pin->m_Convert ) )
418  || ( m_position != pin->m_position )
419  || ( pin->m_orientation != m_orientation ) )
420  continue;
421 
422  GetParent()->RemoveDrawItem( (LIB_ITEM*) pin );
423  }
424  }
425 }
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:77
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::SetPinNumFromString ( wxString &  aBuffer)

Function SetPinNumFromString fill the pin number buffer with aBuffer.

Definition at line 1905 of file lib_pin.cpp.

References m_number.

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

1906 {
1907  char ascii_buf[4];
1908  unsigned ii, len = buffer.Len();
1909 
1910  ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0;
1911 
1912  if( len > 4 )
1913  len = 4;
1914 
1915  for( ii = 0; ii < len; ii++ )
1916  {
1917  ascii_buf[ii] = buffer.GetChar( ii );
1918  ascii_buf[ii] &= 0xFF;
1919  }
1920 
1921  strncpy( (char*) &m_number, ascii_buf, 4 );
1922 }
long m_number
Pin number defined as 4 ASCII characters like "12", "anod", "G6", or "12".
Definition: lib_pin.h:77
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 371 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().

372 {
373  if( m_position != aPosition )
374  {
375  m_position = aPosition;
376  SetModified();
377  }
378 
379  if( GetParent() == NULL )
380  return;
381 
382  LIB_PINS pinList;
383  GetParent()->GetPins( pinList );
384 
385  for( size_t i = 0; i < pinList.size(); i++ )
386  {
387  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
388  || pinList[i]->m_Convert != m_Convert
389  || pinList[i]->m_position == aPosition )
390  continue;
391 
392  pinList[i]->m_position = aPosition;
393  SetModified();
394  }
395 }
#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:70
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 333 of file lib_draw_item.h.

References LIB_ITEM::Move().

333 { 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 282 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().

283 {
284  assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
285 
286  if( m_shape != aShape )
287  {
288  m_shape = aShape;
289  SetModified();
290  }
291 
292  if( GetParent() == NULL )
293  return;
294 
295  LIB_PINS pinList;
296  GetParent()->GetPins( pinList );
297 
298  for( size_t i = 0; i < pinList.size(); i++ )
299  {
300  if( ( pinList[i]->m_Flags & IS_LINKED ) == 0
301  || pinList[i]->m_Convert != m_Convert
302  || pinList[i]->m_shape == aShape )
303  continue;
304 
305  pinList[i]->m_shape = aShape;
306  SetModified();
307  }
308 }
#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:70
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.