KiCad PCB EDA Suite
LIB_PIN Class Reference

#include <lib_pin.h>

Inheritance diagram for LIB_PIN:
LIB_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Classes

struct  ALT
 

Public Types

enum  LIB_CONVERT : int { BASE = 1 , DEMORGAN = 2 }
 
enum  COMPARE_FLAGS : int { UNIT = 0x01 , EQUALITY = 0x02 , ERC = 0x04 }
 The list of flags used by the compare function. More...
 

Public Member Functions

 ~LIB_PIN ()
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetTypeName () const override
 Provide a user-consumable name of the object type. More...
 
int GetOrientation () const
 
void SetOrientation (int aOrientation)
 
GRAPHIC_PINSHAPE GetShape () const
 
void SetShape (GRAPHIC_PINSHAPE aShape)
 
int GetLength () const
 
void SetLength (int aLength)
 
void ChangeLength (int aLength)
 Change the length of a pin and adjust its position based on orientation. More...
 
ELECTRICAL_PINTYPE GetType () const
 
void SetType (ELECTRICAL_PINTYPE aType)
 
wxString const GetCanonicalElectricalTypeName () const
 
wxString const GetElectricalTypeName () const
 
bool IsVisible () const
 
void SetVisible (bool aVisible)
 
const wxString & GetName () const
 
wxString GetShownName () const
 
void SetName (const wxString &aName)
 
const wxString & GetNumber () const
 
wxString GetShownNumber () const
 
void SetNumber (const wxString &aNumber)
 
int GetNameTextSize () const
 
void SetNameTextSize (int aSize)
 
int GetNumberTextSize () const
 
void SetNumberTextSize (int aSize)
 
std::map< wxString, ALT > & GetAlternates ()
 
ALT GetAlt (const wxString &aAlt)
 
void print (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
 Print a pin, with or without the pin texts. More...
 
int PinDrawOrient (const TRANSFORM &aTransform) const
 Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform. More...
 
 LIB_PIN (LIB_SYMBOL *aParent)
 
 LIB_PIN (LIB_SYMBOL *aParent, const wxString &aName, const wxString &aNumber, int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize, int aConvert, const VECTOR2I &aPos, int aUnit)
 
bool HitTest (const VECTOR2I &aPosition, int aAccuracy=0) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Display basic info (type, part and convert) about the current item in message panel. More...
 
const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
const BOX2I GetBoundingBox () const override
 
const BOX2I GetBoundingBox (bool aIncludeInvisiblePins, bool aIncludeNameAndNumber, bool aIncludeElectricalType) const
 
bool IsPowerConnection () const
 Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN. More...
 
int GetPenWidth () const override
 
void PlotPinTexts (PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
 Plot the pin number and pin text info, given the pin line coordinates. More...
 
void PlotSymbol (PLOTTER *aPlotter, const VECTOR2I &aPosition, int aOrientation, bool aDimmed) const
 
void Offset (const VECTOR2I &aOffset) override
 Set the drawing object by aOffset from the current position. More...
 
void MoveTo (const VECTOR2I &aNewPosition) override
 Move a draw object to aPosition. More...
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPos) override
 
VECTOR2I GetPinRoot () const
 
void MirrorHorizontal (const VECTOR2I &aCenter) override
 Mirror the draw object along the horizontal (X) axis about aCenter point. More...
 
void MirrorVertical (const VECTOR2I &aCenter) override
 Mirror the draw object along the MirrorVertical (Y) axis about aCenter point. More...
 
void Rotate (const VECTOR2I &aCenter, bool aRotateCCW=true) override
 Rotate the object about aCenter point. More...
 
void Plot (PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
 Plot the draw item using the plot object. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
wxString GetSelectMenuText (UNITS_PROVIDER *aUnitsProvider) const override
 Return 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
 Create a duplicate of this item with linked list members set to NULL. More...
 
void CalcEdit (const VECTOR2I &aPosition) override
 Calculate the attributes of an item at aPosition when it is being edited. More...
 
virtual void BeginEdit (const VECTOR2I &aPosition)
 Begin drawing a symbol library draw item at aPosition. More...
 
virtual bool ContinueEdit (const VECTOR2I &aPosition)
 Continue an edit in progress at aPosition. More...
 
virtual void EndEdit ()
 End an object editing action. More...
 
virtual void Print (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed)
 Draw an item. More...
 
const wxString & GetDefaultFont () const
 
virtual int GetEffectivePenWidth (const RENDER_SETTINGS *aSettings) const
 
LIB_SYMBOLGetParent () 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 SetUnit (int aUnit)
 
int GetUnit () const
 
void SetConvert (int aConvert)
 
int GetConvert () const
 
void SetPrivate (bool aPrivate)
 
bool IsPrivate () const
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool RenderAsBitmap (double aWorldScale) const
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
virtual bool IsType (const std::vector< KICAD_T > &aScanTypes) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual wxString GetFriendlyName () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
virtual INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

static const wxString GetCanonicalElectricalTypeName (ELECTRICAL_PINTYPE aType)
 Return a string giving the electrical type of a pin. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

void printPinSymbol (const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, int aOrientation, bool aDimmed)
 Print the pin symbol without text. More...
 
void printPinTexts (const RENDER_SETTINGS *aSettings, VECTOR2I &aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed)
 Put the pin number and pin text info, given the pin line coordinates. More...
 
void printPinElectricalTypeName (const RENDER_SETTINGS *aSettings, VECTOR2I &aPosition, int aOrientation, bool aDimmed)
 Draw the electrical type text of the pin (only for the footprint editor) More...
 
bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

VECTOR2I m_position
 
int m_length
 
int m_orientation
 
GRAPHIC_PINSHAPE m_shape
 
ELECTRICAL_PINTYPE m_type
 
int m_attributes
 
wxString m_name
 
wxString m_number
 
int m_numTextSize
 
int m_nameTextSize
 
std::map< wxString, ALTm_alternates
 
int m_unit
 Unit identification for multiple parts per package. More...
 
int m_convert
 Shape identification for alternate body styles. More...
 
bool m_private
 Private items are shown only in the Symbol Editor. More...
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

int compare (const LIB_ITEM &aOther, int aCompareFlags=0) const override
 Provide the draw object specific comparison called by the == and < operators. More...
 

Private Attributes

KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Definition at line 52 of file lib_pin.h.

Member Enumeration Documentation

◆ COMPARE_FLAGS

enum LIB_ITEM::COMPARE_FLAGS : int
inherited

The list of flags used by the compare function.

  • UNIT This flag relaxes unit, conversion and pin number constraints. It is used for LIB_ITEM object unit comparisons.
  • EQUALITY This flag relaxes ordering contstraints so that fields, etc. don't have to appear in the same order to be considered equal.
  • ERC This flag relaxes constraints on data that is settable in the schematic editor. It compares only symbol-editor-only data.
Enumerator
UNIT 
EQUALITY 
ERC 

Definition at line 82 of file lib_item.h.

83 {
84 UNIT = 0x01,
85 EQUALITY = 0x02,
86 ERC = 0x04
87 };
@ EQUALITY
Definition: lib_item.h:85
@ UNIT
Definition: lib_item.h:84

◆ LIB_CONVERT

enum LIB_ITEM::LIB_CONVERT : int
inherited
Enumerator
BASE 
DEMORGAN 

Definition at line 70 of file lib_item.h.

70: int { BASE = 1, DEMORGAN = 2 };
@ BASE
Definition: lib_item.h:70
@ DEMORGAN
Definition: lib_item.h:70

Constructor & Destructor Documentation

◆ ~LIB_PIN()

LIB_PIN::~LIB_PIN ( )
inline

Definition at line 62 of file lib_pin.h.

62{ }

◆ LIB_PIN() [1/2]

LIB_PIN::LIB_PIN ( LIB_SYMBOL aParent)

Definition at line 97 of file lib_pin.cpp.

97 :
98 LIB_ITEM( LIB_PIN_T, aParent ),
102 m_attributes( 0 )
103{
104 // Use the application settings for pin sizes if exists.
105 // pgm can be nullptr when running a shared lib from a script, not from a kicad appl
106 PGM_BASE* pgm = PgmOrNull();
107
108 if( pgm )
109 {
111 m_length = schIUScale.MilsToIU( settings->m_Defaults.pin_length );
112 m_numTextSize = schIUScale.MilsToIU( settings->m_Defaults.pin_num_size );
113 m_nameTextSize = schIUScale.MilsToIU( settings->m_Defaults.pin_name_size );
114 }
115 else // Use hardcoded eeschema defaults: symbol_editor settings are not existing.
116 {
120 }
121}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
LIB_ITEM(KICAD_T aType, LIB_SYMBOL *aSymbol=nullptr, int aUnit=0, int aConvert=0)
Definition: lib_item.cpp:38
int m_attributes
Definition: lib_pin.h:295
int m_nameTextSize
Definition: lib_pin.h:299
int m_length
Definition: lib_pin.h:291
int m_orientation
Definition: lib_pin.h:292
int m_numTextSize
Definition: lib_pin.h:298
GRAPHIC_PINSHAPE m_shape
Definition: lib_pin.h:293
ELECTRICAL_PINTYPE m_type
Definition: lib_pin.h:294
Container for data for KiCad programs.
Definition: pgm_base.h:94
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:134
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:125
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_PIN_LENGTH
The default pin number size when creating pins(can be changed in preference menu)
@ PIN_RIGHT
Definition: lib_pin.h:45
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
@ LIB_PIN_T
Definition: typeinfo.h:202

References DEFAULT_PIN_LENGTH, DEFAULT_PINNAME_SIZE, DEFAULT_PINNUM_SIZE, SETTINGS_MANAGER::GetAppSettings(), PGM_BASE::GetSettingsManager(), LINE, m_length, m_nameTextSize, m_numTextSize, EDA_IU_SCALE::MilsToIU(), PgmOrNull(), PT_UNSPECIFIED, and schIUScale.

Referenced by Clone().

◆ LIB_PIN() [2/2]

LIB_PIN::LIB_PIN ( LIB_SYMBOL aParent,
const wxString &  aName,
const wxString &  aNumber,
int  aOrientation,
ELECTRICAL_PINTYPE  aPinType,
int  aLength,
int  aNameTextSize,
int  aNumTextSize,
int  aConvert,
const VECTOR2I aPos,
int  aUnit 
)

Definition at line 124 of file lib_pin.cpp.

126 :
127 LIB_ITEM( LIB_PIN_T, aParent ),
128 m_position( aPos ),
129 m_length( aLength ),
130 m_orientation( aOrientation ),
132 m_type( aPinType ),
133 m_attributes( 0 ),
134 m_numTextSize( aNumTextSize ),
135 m_nameTextSize( aNameTextSize )
136{
137 SetName( aName );
138 SetNumber( aNumber );
139 SetUnit( aUnit );
140 SetConvert( aConvert );
141}
void SetConvert(int aConvert)
Definition: lib_item.h:275
void SetUnit(int aUnit)
Definition: lib_item.h:272
void SetName(const wxString &aName)
Definition: lib_pin.h:114
VECTOR2I m_position
Definition: lib_pin.h:290
void SetNumber(const wxString &aNumber)
Definition: lib_pin.h:124

References LINE, LIB_ITEM::SetConvert(), SetName(), SetNumber(), and LIB_ITEM::SetUnit().

Member Function Documentation

◆ BeginEdit()

virtual void LIB_ITEM::BeginEdit ( const VECTOR2I aPosition)
inlinevirtualinherited

Begin drawing a symbol library draw item at aPosition.

It typically would be called on a left click when a draw tool is selected in the symbol library editor and one of the graphics tools is selected.

Parameters
aPositionThe position in drawing coordinates where the drawing was started. May or may not be required depending on the item being drawn.

Reimplemented in LIB_FIELD, LIB_SHAPE, and LIB_TEXT.

Definition at line 104 of file lib_item.h.

104{}

◆ CalcEdit()

void LIB_PIN::CalcEdit ( const VECTOR2I aPosition)
overridevirtual

Calculate the attributes of an item at aPosition when it is being edited.

This method gets called by the Draw() method when the item is being edited. This probably should be a pure virtual method but bezier curves are not yet editable in the symbol library editor. Therefore, the default method does nothing.

Parameters
aPositionThe current mouse position in drawing coordinates.

Reimplemented from LIB_ITEM.

Definition at line 1379 of file lib_pin.cpp.

1380{
1381 if( IsMoving() )
1382 MoveTo( aPosition );
1383}
bool IsMoving() const
Definition: eda_item.h:104
void MoveTo(const VECTOR2I &aNewPosition) override
Move a draw object to aPosition.
Definition: lib_pin.cpp:1060

References EDA_ITEM::IsMoving(), and MoveTo().

◆ ChangeLength()

void LIB_PIN::ChangeLength ( int  aLength)

Change the length of a pin and adjust its position based on orientation.

Parameters
aLengthNew length of pin

Definition at line 1026 of file lib_pin.cpp.

1027{
1028 int lengthChange = m_length - aLength;
1029 int offsetX = 0;
1030 int offsetY = 0;
1031
1032 switch( m_orientation )
1033 {
1034 case PIN_RIGHT:
1035 offsetX = lengthChange;
1036 break;
1037 case PIN_LEFT:
1038 offsetX = -1 * lengthChange;
1039 break;
1040 case PIN_UP:
1041 offsetY = lengthChange;
1042 break;
1043 case PIN_DOWN:
1044 offsetY = -1 * lengthChange;
1045 break;
1046 }
1047
1048 wxPoint offset = wxPoint( offsetX, offsetY );
1049 Offset( offset );
1050
1051 m_length = aLength;
1052}
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_pin.cpp:1054
@ PIN_LEFT
Definition: lib_pin.h:46
@ PIN_UP
Definition: lib_pin.h:47
@ PIN_DOWN
Definition: lib_pin.h:48

References m_length, m_orientation, Offset(), PIN_DOWN, PIN_LEFT, PIN_RIGHT, and PIN_UP.

Referenced by DIALOG_PIN_PROPERTIES::TransferDataFromWindow().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 122 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:143
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 143 of file eda_item.h.

143{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:500

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 155 of file eda_item.h.

156 {
158 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define DO_NOT_DRAW
Used to disable draw function.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * LIB_PIN::Clone ( ) const
overridevirtual

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

944{
945 return new LIB_PIN( *this );
946}
LIB_PIN(LIB_SYMBOL *aParent)
Definition: lib_pin.cpp:97

References LIB_PIN().

Referenced by SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), and SYMBOL_EDITOR_PIN_TOOL::RepeatPin().

◆ compare()

int LIB_PIN::compare ( const LIB_ITEM aOther,
int  aCompareFlags = 0 
) const
overrideprivatevirtual

Provide the draw object specific comparison called by the == and < operators.

The base object sort order which always proceeds the derived object sort order is as follows:

  • Symbol alternate part (DeMorgan) number.
  • Symbol part number.
  • KICAD_T enum value.
  • Result of derived classes comparison.
Note
Make sure you call down to LIB_ITEM::compare before doing any derived object comparisons or you will break the sorting using the symbol library file format.
Parameters
aOtherA reference to the other LIB_ITEM to compare the arc against.
aCompareFlagsThe flags used to perform the comparison.
Returns
An integer value less than 0 if the object is less than aOther object, 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.

Reimplemented from LIB_ITEM.

Definition at line 949 of file lib_pin.cpp.

950{
951 wxASSERT( aOther.Type() == LIB_PIN_T );
952
953 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
954
955 if( retv )
956 return retv;
957
958 const LIB_PIN* tmp = (LIB_PIN*) &aOther;
959
960 // When comparing units, we do not compare the part numbers. If everything else is
961 // identical, then we can just renumber the parts for the inherited symbol.
962 if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_number != tmp->m_number )
963 return m_number.Cmp( tmp->m_number );
964
965 int result = m_name.Cmp( tmp->m_name );
966
967 if( result )
968 return result;
969
970 if( m_position.x != tmp->m_position.x )
971 return m_position.x - tmp->m_position.x;
972
973 if( m_position.y != tmp->m_position.y )
974 return m_position.y - tmp->m_position.y;
975
976 if( m_length != tmp->m_length )
977 return m_length - tmp->m_length;
978
979 if( m_orientation != tmp->m_orientation )
980 return m_orientation - tmp->m_orientation;
981
982 if( m_shape != tmp->m_shape )
983 return static_cast<int>( m_shape ) - static_cast<int>( tmp->m_shape );
984
985 if( m_type != tmp->m_type )
986 return static_cast<int>( m_type ) - static_cast<int>( tmp->m_type );
987
988 if( m_attributes != tmp->m_attributes )
989 return m_attributes - tmp->m_attributes;
990
991 if( m_numTextSize != tmp->m_numTextSize )
992 return m_numTextSize - tmp->m_numTextSize;
993
994 if( m_nameTextSize != tmp->m_nameTextSize )
995 return m_nameTextSize - tmp->m_nameTextSize;
996
997 if( m_alternates.size() != tmp->m_alternates.size() )
998 return m_alternates.size() - tmp->m_alternates.size();
999
1000 auto lhsItem = m_alternates.begin();
1001 auto rhsItem = tmp->m_alternates.begin();
1002
1003 while( lhsItem != m_alternates.end() )
1004 {
1005 const ALT& lhsAlt = lhsItem->second;
1006 const ALT& rhsAlt = rhsItem->second;
1007
1008 retv = lhsAlt.m_Name.Cmp( rhsAlt.m_Name );
1009
1010 if( retv )
1011 return retv;
1012
1013 if( lhsAlt.m_Type != rhsAlt.m_Type )
1014 return static_cast<int>( lhsAlt.m_Type ) - static_cast<int>( rhsAlt.m_Type );
1015
1016 if( lhsAlt.m_Shape != rhsAlt.m_Shape )
1017 return static_cast<int>( lhsAlt.m_Shape ) - static_cast<int>( rhsAlt.m_Shape );
1018
1019 ++lhsItem;
1020 ++rhsItem;
1021 }
1022
1023 return 0;
1024}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74
wxString m_name
Definition: lib_pin.h:296
std::map< wxString, ALT > m_alternates
Definition: lib_pin.h:301
wxString m_number
Definition: lib_pin.h:297

References LIB_ITEM::compare(), LIB_PIN_T, m_alternates, m_attributes, m_length, LIB_PIN::ALT::m_Name, m_name, m_nameTextSize, m_number, m_numTextSize, m_orientation, m_position, LIB_PIN::ALT::m_Shape, m_shape, LIB_PIN::ALT::m_Type, m_type, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ContinueEdit()

virtual bool LIB_ITEM::ContinueEdit ( const VECTOR2I aPosition)
inlinevirtualinherited

Continue an edit in progress at aPosition.

This is used to perform the next action while drawing an item. This would be called for each additional left click when the mouse is captured while the item is being drawn.

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

Definition at line 116 of file lib_item.h.

116{ return false; }

◆ EndEdit()

virtual void LIB_ITEM::EndEdit ( )
inlinevirtualinherited

End an object editing action.

This is used to end or abort an edit action in progress initiated by BeginEdit().

Reimplemented in LIB_SHAPE.

Definition at line 123 of file lib_item.h.

123{}

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:294
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:67
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:69
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:61
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:44

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetAlt()

ALT LIB_PIN::GetAlt ( const wxString &  aAlt)
inline

Definition at line 140 of file lib_pin.h.

140{ return m_alternates[ aAlt ]; }

References m_alternates.

Referenced by SCH_PIN::GetShape(), and SCH_PIN::GetType().

◆ GetAlternates()

◆ GetBoundingBox() [1/2]

const BOX2I LIB_PIN::GetBoundingBox ( ) const
inlineoverridevirtual
Returns
the boundary box for this, in library coordinates

Reimplemented from LIB_ITEM.

Definition at line 184 of file lib_pin.h.

184{ return GetBoundingBox( false, true, false ); }
const BOX2I GetBoundingBox() const override
Definition: lib_pin.h:184

References GetBoundingBox().

Referenced by GetBoundingBox(), SCH_PIN::GetBoundingBox(), HitTest(), DIALOG_PIN_PROPERTIES::OnPaintShowPanel(), and ViewBBox().

◆ GetBoundingBox() [2/2]

const BOX2I LIB_PIN::GetBoundingBox ( bool  aIncludeInvisiblePins,
bool  aIncludeNameAndNumber,
bool  aIncludeElectricalType 
) const
Parameters
aIncludeInvisibles- if false, do not include labels for invisible pins in the calculation.

Definition at line 1183 of file lib_pin.cpp.

1185{
1186 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
1188
1189 BOX2I bbox;
1190 VECTOR2I begin;
1191 VECTOR2I end;
1192 int nameTextOffset = 0;
1193 int nameTextLength = 0;
1194 int nameTextHeight = 0;
1195 int numberTextLength = 0;
1196 int numberTextHeight = 0;
1197 int typeTextLength = 0;
1198 wxString name = GetShownName();
1199 wxString number = GetShownNumber();
1200 bool includeName = aIncludeNameAndNumber && !name.IsEmpty();
1201 bool includeNumber = aIncludeNameAndNumber && !number.IsEmpty();
1202 bool includeType = aIncludeElectricalType;
1203 int minsizeV = TARGET_PIN_RADIUS;
1204 int penWidth = GetPenWidth();
1205
1206 if( !aIncludeInvisiblePins && !IsVisible() )
1207 {
1208 includeName = false;
1209 includeType = false;
1210 }
1211
1212 if( GetParent() )
1213 {
1214 if( GetParent()->ShowPinNames() )
1215 nameTextOffset = GetParent()->GetPinNameOffset();
1216 else
1217 includeName = false;
1218
1219 if( !GetParent()->ShowPinNumbers() )
1220 includeNumber = false;
1221 }
1222
1223 if( includeNumber )
1224 {
1226 VECTOR2I numSize = font->StringBoundaryLimits( number, fontSize, penWidth, false, false );
1227
1228 numberTextLength = numSize.x;
1229 numberTextHeight = numSize.y;
1230 }
1231
1232 if( includeName )
1233 {
1235 VECTOR2I nameSize = font->StringBoundaryLimits( name, fontSize, penWidth, false, false );
1236
1237 nameTextLength = nameSize.x + nameTextOffset;
1238 nameTextHeight = nameSize.y + schIUScale.MilsToIU( PIN_TEXT_MARGIN );
1239 }
1240
1241 if( includeType )
1242 {
1243 double fontSize = std::max( m_nameTextSize * 3 / 4, schIUScale.mmToIU( 0.7 ) );
1244 VECTOR2I typeTextSize = font->StringBoundaryLimits( GetElectricalTypeName(),
1245 VECTOR2D( fontSize, fontSize ),
1246 fontSize / 8.0, false, false );
1247
1248 typeTextLength = typeTextSize.x + schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + TARGET_PIN_RADIUS;
1249 minsizeV = std::max( minsizeV, typeTextSize.y / 2 );
1250 }
1251
1252 // First, calculate boundary box corners position
1254 minsizeV = std::max( TARGET_PIN_RADIUS, externalPinDecoSize( nullptr, *this ) );
1255
1256 // calculate top left corner position
1257 // for the default pin orientation (PIN_RIGHT)
1258 begin.y = std::max( minsizeV, numberTextHeight + schIUScale.MilsToIU( PIN_TEXT_MARGIN ) );
1259 begin.x = std::min( -typeTextLength, m_length - ( numberTextLength / 2) );
1260
1261 // calculate bottom right corner position and adjust top left corner position
1262 if( nameTextOffset ) // for values > 0, pin name is inside the body
1263 {
1264 end.x = m_length + nameTextLength;
1265 end.y = std::min( -minsizeV, -nameTextHeight / 2 );
1266 }
1267 else // if value == 0:
1268 // pin name is outside the body, and above the pin line
1269 // pin num is below the pin line
1270 {
1271 end.x = std::max( m_length, nameTextLength );
1272 end.y = -begin.y;
1273 begin.y = std::max( minsizeV, nameTextHeight );
1274 }
1275
1276 // Now, calculate boundary box corners position for the actual pin orientation
1277 int orient = PinDrawOrient( DefaultTransform );
1278
1279 /* Calculate the pin position */
1280 switch( orient )
1281 {
1282 case PIN_UP:
1283 // Pin is rotated and texts positions are mirrored
1284 RotatePoint( begin, VECTOR2I( 0, 0 ), -ANGLE_90 );
1285 RotatePoint( end, VECTOR2I( 0, 0 ), -ANGLE_90 );
1286 break;
1287
1288 case PIN_DOWN:
1289 RotatePoint( begin, VECTOR2I( 0, 0 ), ANGLE_90 );
1290 RotatePoint( end, VECTOR2I( 0, 0 ), ANGLE_90 );
1291 begin.x = -begin.x;
1292 end.x = -end.x;
1293 break;
1294
1295 case PIN_LEFT:
1296 begin.x = -begin.x;
1297 end.x = -end.x;
1298 break;
1299
1300 case PIN_RIGHT:
1301 break;
1302 }
1303
1304 begin += m_position;
1305 end += m_position;
1306
1307 bbox.SetOrigin( begin );
1308 bbox.SetEnd( end );
1309 bbox.Normalize();
1310 bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
1311
1312 // Draw Y axis is reversed in schematic:
1313 bbox.RevertYAxis();
1314
1315 return bbox;
1316}
const char * name
Definition: DXF_plotter.cpp:56
void SetOrigin(const Vec &pos)
Definition: box2.h:202
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: box2.h:689
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
void SetEnd(coord_type x, coord_type y)
Definition: box2.h:255
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:105
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:65
LIB_SYMBOL * GetParent() const
Definition: lib_item.h:168
wxString GetShownNumber() const
Definition: lib_pin.h:123
wxString GetShownName() const
Definition: lib_pin.cpp:175
wxString const GetElectricalTypeName() const
Definition: lib_pin.h:98
bool IsVisible() const
Definition: lib_pin.h:103
int PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition: lib_pin.cpp:909
int GetPenWidth() const override
Definition: lib_pin.cpp:169
int GetPinNameOffset() const
Definition: lib_symbol.h:628
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
TRANSFORM DefaultTransform
Definition: eeschema.cpp:68
#define PIN_TEXT_MARGIN
Definition: lib_pin.cpp:41
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
Definition: lib_pin.cpp:86
#define TARGET_PIN_RADIUS
Definition: lib_pin.h:35
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References ANGLE_90, EESCHEMA_SETTINGS::APPEARANCE::default_font, DefaultTransform, externalPinDecoSize(), GetElectricalTypeName(), KIFONT::FONT::GetFont(), LIB_ITEM::GetParent(), GetPenWidth(), LIB_SYMBOL::GetPinNameOffset(), GetShownName(), GetShownNumber(), BOX2< Vec >::Inflate(), INVERTED, INVERTED_CLOCK, IsVisible(), EESCHEMA_SETTINGS::m_Appearance, m_length, m_nameTextSize, m_numTextSize, m_position, m_shape, EDA_IU_SCALE::MilsToIU(), EDA_IU_SCALE::mmToIU(), name, BOX2< Vec >::Normalize(), Pgm(), PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PinDrawOrient(), BOX2< Vec >::RevertYAxis(), RotatePoint(), schIUScale, BOX2< Vec >::SetEnd(), BOX2< Vec >::SetOrigin(), TARGET_PIN_RADIUS, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetCanonicalElectricalTypeName() [1/2]

wxString const LIB_PIN::GetCanonicalElectricalTypeName ( ) const
inline

Definition at line 93 of file lib_pin.h.

94 {
96 }
wxString const GetCanonicalElectricalTypeName() const
Definition: lib_pin.h:93

References GetCanonicalElectricalTypeName(), and m_type.

Referenced by GetCanonicalElectricalTypeName(), and SCH_PIN::GetCanonicalElectricalTypeName().

◆ GetCanonicalElectricalTypeName() [2/2]

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

44{
45 // These strings are the canonical name of the electrictal type
46 // Not translated, no space in name, only ASCII chars.
47 // to use when the string name must be known and well defined
48 // must have same order than enum ELECTRICAL_PINTYPE (see lib_pin.h)
49 static const wxChar* msgPinElectricType[] =
50 {
51 wxT( "input" ),
52 wxT( "output" ),
53 wxT( "bidirectional" ),
54 wxT( "tri_state" ),
55 wxT( "passive" ),
56 wxT( "free" ),
57 wxT( "unspecified" ),
58 wxT( "power_in" ),
59 wxT( "power_out" ),
60 wxT( "open_collector" ),
61 wxT( "open_emitter" ),
62 wxT( "no_connect" )
63 };
64
65 return msgPinElectricType[static_cast<int>( aType )];
66}

◆ GetClass()

wxString LIB_PIN::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 64 of file lib_pin.h.

65 {
66 return wxT( "LIB_PIN" );
67 }

◆ GetConvert()

◆ GetDefaultFont()

const wxString & LIB_ITEM::GetDefaultFont ( ) const
inherited

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 147 of file eda_item.h.

148 {
149 constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
151
152 return m_flags & mask;
153 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_DRAGGING
Item being dragged.
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
#define IS_RESIZING
Item being resized.

References IS_CHANGED, IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetEffectivePenWidth()

virtual int LIB_ITEM::GetEffectivePenWidth ( const RENDER_SETTINGS aSettings) const
inlinevirtualinherited

Definition at line 155 of file lib_item.h.

156 {
157 // For historical reasons, a stored value of 0 means "default width" and negative
158 // numbers meant "don't stroke".
159
160 if( GetPenWidth() < 0 )
161 return 0;
162 else if( GetPenWidth() == 0 )
163 return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
164 else
165 return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
166 }
int GetDefaultPenWidth() const
virtual int GetPenWidth() const =0

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), and LIB_ITEM::GetPenWidth().

Referenced by LIB_FIELD::Plot(), LIB_SHAPE::Plot(), LIB_TEXTBOX::Plot(), PlotSymbol(), LIB_FIELD::print(), LIB_SHAPE::print(), LIB_TEXTBOX::print(), and printPinSymbol().

◆ GetElectricalTypeName()

wxString const LIB_PIN::GetElectricalTypeName ( ) const
inline

Definition at line 98 of file lib_pin.h.

99 {
101 }
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:240

References ElectricalPinTypeGetText(), and m_type.

Referenced by KIGFX::SCH_PAINTER::draw(), GetBoundingBox(), GetSelectMenuText(), and printPinElectricalTypeName().

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 258 of file eda_item.h.

258{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:251

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::update().

◆ GetLength()

◆ GetMenuImage()

BITMAPS LIB_PIN::GetMenuImage ( ) const
overridevirtual

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

1320{
1322}
BITMAPS ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:268

References ElectricalPinTypeGetBitmap(), and m_type.

◆ GetMsgPanelInfo()

void LIB_PIN::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Display basic info (type, part and convert) about the current item in message panel.

This base function is used to display the information common to the all library items. Call the base class from the derived class or the common information will not be updated in the message panel.

Parameters
aListis the list to populate.

Reimplemented from LIB_ITEM.

Definition at line 1141 of file lib_pin.cpp.

1142{
1143 LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
1144
1145 aList.emplace_back( _( "Name" ), UnescapeString( GetShownName() ) );
1146 aList.emplace_back( _( "Number" ), GetShownNumber() );
1147 aList.emplace_back( _( "Type" ), ElectricalPinTypeGetText( m_type ) );
1148 aList.emplace_back( _( "Style" ), PinShapeGetText( m_shape ) );
1149
1150 aList.emplace_back( _( "Style" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
1151
1152 // Display pin length
1153 aList.emplace_back( _( "Length" ), aFrame->MessageTextFromValue( m_length, true ) );
1154
1156 aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
1157
1158 VECTOR2I pinpos = GetPosition();
1159 pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top
1160
1161 aList.emplace_back( _( "Pos X" ), aFrame->MessageTextFromValue( pinpos.x, true ) );
1162 aList.emplace_back( _( "Pos Y" ), aFrame->MessageTextFromValue( pinpos.y, true ) );
1163}
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_item.cpp:47
VECTOR2I GetPosition() const override
Definition: lib_pin.h:222
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define _(s)
wxString PinOrientationName(unsigned aPinOrientationCode)
Definition: pin_type.cpp:119
int PinOrientationIndex(int code)
Definition: pin_type.cpp:150
wxString PinShapeGetText(GRAPHIC_PINSHAPE aShape)
Definition: pin_type.cpp:278
wxString UnescapeString(const wxString &aSource)

References _, ElectricalPinTypeGetText(), LIB_ITEM::GetMsgPanelInfo(), GetPosition(), GetShownName(), GetShownNumber(), IsVisible(), m_length, m_orientation, m_shape, m_type, UNITS_PROVIDER::MessageTextFromValue(), PinOrientationIndex(), PinOrientationName(), PinShapeGetText(), UnescapeString(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SYMBOL_EDITOR_PIN_TOOL::EditPinProperties().

◆ GetName()

◆ GetNameTextSize()

◆ GetNumber()

◆ GetNumberTextSize()

◆ GetOrientation()

◆ GetParent()

◆ GetPenWidth()

int LIB_PIN::GetPenWidth ( ) const
overridevirtual

Implements LIB_ITEM.

Definition at line 169 of file lib_pin.cpp.

170{
171 return 0;
172}

Referenced by GetBoundingBox(), PlotPinTexts(), and printPinTexts().

◆ GetPinRoot()

VECTOR2I LIB_PIN::GetPinRoot ( ) const

Definition at line 184 of file lib_pin.cpp.

185{
186 switch( m_orientation )
187 {
188 default:
189 case PIN_RIGHT: return VECTOR2I( m_position.x + m_length, -( m_position.y ) );
190 case PIN_LEFT: return VECTOR2I( m_position.x - m_length, -( m_position.y ) );
191 case PIN_UP: return VECTOR2I( m_position.x, -( m_position.y + m_length ) );
192 case PIN_DOWN: return VECTOR2I( m_position.x, -( m_position.y - m_length ) );
193 }
194}

References m_length, m_orientation, m_position, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetPosition()

◆ GetSelectMenuText()

wxString LIB_PIN::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

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

1326{
1327 if( IsVisible() )
1328 {
1329 if( !m_name.IsEmpty() )
1330 {
1331 return wxString::Format( _( "Pin %s [%s, %s, %s]" ),
1336 }
1337 else
1338 {
1339 return wxString::Format( _( "Pin %s [%s, %s]" ),
1343 }
1344 }
1345 else
1346 {
1347 if( !m_name.IsEmpty() )
1348 {
1349 return wxString::Format( _( "Hidden pin %s [%s, %s, %s]" ),
1354 }
1355 else
1356 {
1357 return wxString::Format( _( "Hidden pin %s [%s, %s]" ),
1361 }
1362 }
1363}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References _, Format(), GetElectricalTypeName(), GetShownName(), GetShownNumber(), IsVisible(), m_name, m_shape, PinShapeGetText(), and UnescapeString().

Referenced by SCH_PIN::GetSelectMenuText().

◆ GetShape()

◆ GetShownName()

wxString LIB_PIN::GetShownName ( ) const

Definition at line 175 of file lib_pin.cpp.

176{
177 if( m_name == wxS( "~" ) )
178 return wxEmptyString;
179 else
180 return m_name;
181}

References m_name.

Referenced by KIGFX::SCH_PAINTER::draw(), GetBoundingBox(), SCH_PIN::GetDefaultNetName(), GetMsgPanelInfo(), GetSelectMenuText(), PlotPinTexts(), and printPinTexts().

◆ GetShownNumber()

wxString LIB_PIN::GetShownNumber ( ) const
inline

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 267 of file eda_item.h.

267{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 126 of file eda_item.h.

127 {
128 return m_status & type;
129 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:497

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 139 of file eda_item.h.

139{ return m_status; }

References EDA_ITEM::m_status.

◆ GetType()

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:546

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ GetTypeName()

wxString LIB_PIN::GetTypeName ( ) const
inlineoverridevirtual

Provide a user-consumable name of the object type.

Perform localization when called so that run-time language selection works.

Implements LIB_ITEM.

Definition at line 69 of file lib_pin.h.

70 {
71 return _( "Pin" );
72 }

References _.

◆ GetUnit()

◆ HasFlag()

◆ HitTest() [1/2]

bool LIB_PIN::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from LIB_ITEM.

Definition at line 152 of file lib_pin.cpp.

153{
155 return false;
156
157 BOX2I sel = aRect;
158
159 if ( aAccuracy )
160 sel.Inflate( aAccuracy );
161
162 if( aContained )
163 return sel.Contains( GetBoundingBox( false, false, false ) );
164
165 return sel.Intersects( GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE ) );
166}
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
#define SHOW_ELEC_TYPE
Show pin electrical type. Shared with IS_ROLLOVER.

References BOX2< Vec >::Contains(), GetBoundingBox(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), EDA_ITEM::m_flags, SHOW_ELEC_TYPE, SKIP_STRUCT, and STRUCT_DELETED.

◆ HitTest() [2/2]

bool LIB_PIN::HitTest ( const VECTOR2I aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Test if aPosition is inside or on the boundary of this item.

Parameters
aPositionA reference to a VECTOR2I object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from LIB_ITEM.

Definition at line 144 of file lib_pin.cpp.

145{
146 BOX2I rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
147
148 return rect.Inflate( aAccuracy ).Contains( aPosition );
149}

References BOX2< Vec >::Contains(), GetBoundingBox(), BOX2< Vec >::Inflate(), EDA_ITEM::m_flags, and SHOW_ELEC_TYPE.

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 105 of file eda_item.h.

105{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 108 of file eda_item.h.

108{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 203 of file eda_item.h.

203{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:499

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsPowerConnection()

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

198 {
200 && ( !IsVisible() || (LIB_SYMBOL*) GetParent()->IsPower() );
201 }
ELECTRICAL_PINTYPE GetType() const
Definition: lib_pin.h:90
bool IsPower() const
Definition: lib_symbol.cpp:552
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.

References LIB_ITEM::GetParent(), GetType(), LIB_SYMBOL::IsPower(), IsVisible(), and PT_POWER_IN.

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_PIN::GetDefaultNetName(), and SCH_PIN::IsPowerConnection().

◆ IsPrivate()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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 LIB_TEXTBOX, SCH_FIELD, SCH_LABEL, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 422 of file eda_item.h.

422{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 109 of file eda_item.h.

109{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 112 of file eda_item.h.

113 {
114 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
115 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsType()

virtual bool EDA_ITEM::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlinevirtualinherited

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented in SCH_FIELD, SCH_ITEM, SCH_LABEL_BASE, SCH_LINE, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_DIMENSION_BASE, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, and PCB_VIA.

Definition at line 183 of file eda_item.h.

184 {
185 for( KICAD_T scanType : aScanTypes )
186 {
187 if( scanType == SCH_LOCATE_ANY_T || scanType == m_structType )
188 return true;
189 }
190
191 return false;
192 }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:507
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:183

References EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_FIELD::GetCanonicalName(), KIGFX::SCH_PAINTER::getLineWidth(), SCH_FIELD::GetName(), KIGFX::SCH_PAINTER::getRenderColor(), SCH_FIELD::GetShownText(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_ITEM::IsType(), FP_TEXT::IsType(), FP_TEXTBOX::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), PCB_SHAPE::IsType(), PCB_TEXT::IsType(), PCB_TEXTBOX::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), CONVERT_TOOL::makePolysFromChainedSegs(), EE_SELECTION_TOOL::RequestSelection(), SCH_FIELD::SetId(), SCH_BASE_FRAME::UpdateItem(), and EDA_ITEM::Visit().

◆ IsVisible()

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 304 of file eda_item.h.

306 {
307 for( const auto& it : aList )
308 {
309 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
310 testData,
311 scanTypes ) == INSPECT_RESULT::QUIT )
312 {
314 }
315 }
316
318 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 324 of file eda_item.h.

326 {
327 for( const auto& it : aList )
328 {
329 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
330 testData,
331 scanTypes ) == INSPECT_RESULT::QUIT )
332 {
334 }
335 }
336
338 }

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

Compare 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.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_MARKER, LIB_TEXTBOX, SCH_FIELD, SCH_LABEL_BASE, SCH_PIN, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, FP_TEXT, FP_TEXTBOX, NETINFO_ITEM, PCB_MARKER, PCB_TEXT, PCB_TEXTBOX, and ZONE.

Definition at line 384 of file eda_item.h.

385 {
386 return false;
387 }

Referenced by SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_EDITOR_CONTROL::HasMatch(), SCH_MARKER::Matches(), LIB_TEXTBOX::Matches(), SCH_FIELD::Matches(), SCH_LABEL_BASE::Matches(), SCH_PIN::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), FP_TEXT::Matches(), FP_TEXTBOX::Matches(), NETINFO_ITEM::Matches(), PCB_MARKER::Matches(), PCB_TEXT::Matches(), PCB_TEXTBOX::Matches(), ZONE::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA aSearchData 
) const
protectedinherited

Compare 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 117 of file eda_item.cpp.

118{
119 wxString text = aText;
120 wxString searchText = aSearchData.findString;
121
122 // Don't match if searching for replaceable item and the item doesn't support text replace.
123 if( aSearchData.searchAndReplace && !IsReplaceable() )
124 return false;
125
126 if( !aSearchData.matchCase )
127 {
128 text.MakeUpper();
129 searchText.MakeUpper();
130 }
131
133 {
134 int ii = 0;
135
136 while( ii < (int) text.length() )
137 {
138 int next = text.find( searchText, ii );
139
140 if( next == wxNOT_FOUND )
141 return false;
142
143 ii = next;
144 next += searchText.length();
145
146 bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
147 bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
148
149 if( startOK && endOK )
150 return true;
151 else
152 ii++;
153 }
154
155 return false;
156 }
157 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 {
159 return text.Matches( searchText );
160 }
161 else
162 {
163 return text.Find( searchText ) != wxNOT_FOUND;
164 }
165}
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:422
CITER next(CITER it)
Definition: ptree.cpp:126
EDA_SEARCH_MATCH_MODE matchMode

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ MirrorHorizontal()

void LIB_PIN::MirrorHorizontal ( const VECTOR2I aCenter)
overridevirtual

Mirror the draw object along the horizontal (X) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1070 of file lib_pin.cpp.

1071{
1072 m_position.x -= aCenter.x;
1073 m_position.x *= -1;
1074 m_position.x += aCenter.x;
1075
1076 if( m_orientation == PIN_RIGHT )
1078 else if( m_orientation == PIN_LEFT )
1080}

References m_orientation, m_position, PIN_LEFT, PIN_RIGHT, and VECTOR2< T >::x.

◆ MirrorVertical()

void LIB_PIN::MirrorVertical ( const VECTOR2I aCenter)
overridevirtual

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

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 1083 of file lib_pin.cpp.

1084{
1085 m_position.y -= aCenter.y;
1086 m_position.y *= -1;
1087 m_position.y += aCenter.y;
1088
1089 if( m_orientation == PIN_UP )
1091 else if( m_orientation == PIN_DOWN )
1093}

References m_orientation, m_position, PIN_DOWN, PIN_UP, and VECTOR2< T >::y.

◆ MoveTo()

void LIB_PIN::MoveTo ( const VECTOR2I aPosition)
overridevirtual

Move a draw object to aPosition.

Parameters
aPositionPosition to move draw item to.

Implements LIB_ITEM.

Definition at line 1060 of file lib_pin.cpp.

1061{
1062 if( m_position != aNewPosition )
1063 {
1064 m_position = aNewPosition;
1065 SetModified();
1066 }
1067}
void SetModified()
Definition: eda_item.cpp:64

References m_position, and EDA_ITEM::SetModified().

Referenced by CalcEdit().

◆ Offset()

void LIB_PIN::Offset ( const VECTOR2I aOffset)
overridevirtual

Set the drawing object by aOffset from the current position.

Parameters
aOffsetCoordinates to offset the item position.

Implements LIB_ITEM.

Definition at line 1054 of file lib_pin.cpp.

1055{
1056 m_position += aOffset;
1057}

References m_position.

Referenced by ChangeLength().

◆ operator<() [1/2]

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 231 of file eda_item.cpp.

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator<() [2/2]

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 102 of file lib_item.cpp.

103{
104 if( Type() != aOther.Type() )
105 return Type() < aOther.Type();
106
107 return ( compare( aOther ) < 0 );
108}

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

◆ operator==() [1/2]

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 93 of file lib_item.cpp.

94{
95 if( Type() != aOther.Type() )
96 return false;
97
98 return compare( aOther, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
99}

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

◆ operator==() [2/2]

bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inlineinherited

Definition at line 207 of file lib_item.h.

208 {
209 return *this == *aOther;
210 }

◆ PinDrawOrient()

int LIB_PIN::PinDrawOrient ( const TRANSFORM aTransform) const

Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation and the matrix transform (rot, mirror) aTransform.

Parameters
aTransformTransform matrix

Definition at line 909 of file lib_pin.cpp.

910{
911 int orient;
912 VECTOR2I end; // position of pin end starting at 0,0 according to its orientation, length = 1
913
914 switch( m_orientation )
915 {
916 case PIN_UP: end.y = 1; break;
917 case PIN_DOWN: end.y = -1; break;
918 case PIN_LEFT: end.x = -1; break;
919 case PIN_RIGHT: end.x = 1; break;
920 }
921
922 // = pos of end point, according to the symbol orientation.
923 end = aTransform.TransformCoordinate( end );
924 orient = PIN_UP;
925
926 if( end.x == 0 )
927 {
928 if( end.y > 0 )
929 orient = PIN_DOWN;
930 }
931 else
932 {
933 orient = PIN_RIGHT;
934
935 if( end.x < 0 )
936 orient = PIN_LEFT;
937 }
938
939 return orient;
940}
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41

References m_orientation, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, TRANSFORM::TransformCoordinate(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetBoundingBox(), AUTOPLACER::getPinSide(), Plot(), and print().

◆ Plot()

void LIB_PIN::Plot ( PLOTTER aPlotter,
bool  aBackground,
const VECTOR2I aOffset,
const TRANSFORM aTransform,
bool  aDimmed 
) const
overridevirtual

Plot the draw item using the plot object.

Parameters
aPlotterThe plot object to plot to.
aBackgrounda poor-man's Z-order. The routine will get called twice, first with aBackground true and then with aBackground false.
aOffsetPlot offset position.
aFillFlag to indicate whether or not the object is filled.
aTransformThe plot transform.
aDimmedif true, reduce color to background

Implements LIB_ITEM.

Definition at line 1125 of file lib_pin.cpp.

1127{
1128 if( !IsVisible() || aBackground )
1129 return;
1130
1131 int orient = PinDrawOrient( aTransform );
1132 VECTOR2I pos = aTransform.TransformCoordinate( m_position ) + aOffset;
1133
1134 PlotSymbol( aPlotter, pos, orient, aDimmed );
1135 PlotPinTexts( aPlotter, pos, orient, GetParent()->GetPinNameOffset(),
1136 GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
1137 aDimmed );
1138}
void PlotPinTexts(PLOTTER *aPlotter, const VECTOR2I &aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed) const
Plot the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:744
void PlotSymbol(PLOTTER *aPlotter, const VECTOR2I &aPosition, int aOrientation, bool aDimmed) const
Definition: lib_pin.cpp:604

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

Referenced by SCH_SYMBOL::PlotPins().

◆ PlotPinTexts()

void LIB_PIN::PlotPinTexts ( PLOTTER aPlotter,
const VECTOR2I aPinPos,
int  aPinOrient,
int  aTextInside,
bool  aDrawPinNum,
bool  aDrawPinName,
bool  aDimmed 
) const

Plot the pin number and pin text info, given the pin line coordinates.

Same as DrawPinTexts((), but output is the plotter The line must be vertical or horizontal. If TextInside then the text is been put inside (moving from x1, y1 in the opposite direction to x2,y2), otherwise all is drawn outside.

Definition at line 744 of file lib_pin.cpp.

746{
747 RENDER_SETTINGS* settings = aPlotter->RenderSettings();
748 KIFONT::FONT* font = KIFONT::FONT::GetFont( settings->GetDefaultFont(), false, false );
749 wxString name = GetShownName();
750 wxString number = GetShownNumber();
751
752 if( name.IsEmpty() || m_nameTextSize == 0 )
753 aDrawPinName = false;
754
755 if( number.IsEmpty() || m_numTextSize == 0 )
756 aDrawPinNum = false;
757
758 if( !aDrawPinNum && !aDrawPinName )
759 return;
760
761 int x, y;
762 int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
763 settings->GetDefaultPenWidth() );
764 int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
765 settings->GetDefaultPenWidth() );
766 int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
767 int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
768
769 /* Get the num and name colors */
770 COLOR4D nameColor = settings->GetLayerColor( LAYER_PINNAM );
771 COLOR4D numColor = settings->GetLayerColor( LAYER_PINNUM );
772 COLOR4D bg = settings->GetBackgroundColor();
773
774 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
775 bg = COLOR4D::WHITE;
776
777 if( aDimmed )
778 {
779 nameColor = nameColor.Mix( bg, 0.5f );
780 numColor = numColor.Mix( bg, 0.5f );
781 }
782
783 int x1 = aPinPos.x;
784 int y1 = aPinPos.y;
785
786 switch( aPinOrient )
787 {
788 case PIN_UP: y1 -= m_length; break;
789 case PIN_DOWN: y1 += m_length; break;
790 case PIN_LEFT: x1 -= m_length; break;
791 case PIN_RIGHT: x1 += m_length; break;
792 }
793
794 auto plotText =
795 [&]( int px, int py, const COLOR4D& color, const wxString& text, const EDA_ANGLE& angle,
796 int size, GR_TEXT_H_ALIGN_T hJustify, GR_TEXT_V_ALIGN_T vJustify, int penWidth )
797
798 {
799 aPlotter->Text( VECTOR2I( px, py ), color, text, angle, VECTOR2I( size, size ),
800 hJustify, vJustify, penWidth, false, false, false, font );
801 };
802
803 /* Draw the text inside, but the pin numbers outside. */
804 if( aTextInside )
805 {
806 if( ( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) ) /* Its an horizontal line. */
807 {
808 if( aDrawPinName )
809 {
810 GR_TEXT_H_ALIGN_T hjustify;
811 if( aPinOrient == PIN_RIGHT )
812 {
813 x = x1 + aTextInside;
814 hjustify = GR_TEXT_H_ALIGN_LEFT;
815 }
816 else // orient == PIN_LEFT
817 {
818 x = x1 - aTextInside;
819 hjustify = GR_TEXT_H_ALIGN_RIGHT;
820 }
821
822 plotText( x, y1, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize, hjustify,
823 GR_TEXT_V_ALIGN_CENTER, namePenWidth );
824 }
825
826 if( aDrawPinNum )
827 {
828 plotText( ( x1 + aPinPos.x) / 2, y1 - num_offset, numColor, number,
830 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
831 }
832 }
833 else /* Its a vertical line. */
834 {
835 if( aPinOrient == PIN_DOWN )
836 {
837 y = y1 + aTextInside;
838
839 if( aDrawPinName )
840 {
841 plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
843 }
844
845 if( aDrawPinNum )
846 {
847 plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
849 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
850 }
851 }
852 else /* PIN_UP */
853 {
854 y = y1 - aTextInside;
855
856 if( aDrawPinName )
857 {
858 plotText( x1, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
860 }
861
862 if( aDrawPinNum )
863 {
864 plotText( x1 - num_offset, ( y1 + aPinPos.y) / 2, numColor, number,
866 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth );
867 }
868 }
869 }
870 }
871 else /* Draw num & text pin outside */
872 {
873 if(( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) )
874 {
875 /* Its an horizontal line. */
876 if( aDrawPinName )
877 {
878 x = ( x1 + aPinPos.x) / 2;
879 plotText( x, y1 - name_offset, nameColor, name, ANGLE_HORIZONTAL, m_nameTextSize,
881 }
882
883 if( aDrawPinNum )
884 {
885 x = ( x1 + aPinPos.x ) / 2;
886 plotText( x, y1 + num_offset, numColor, number, ANGLE_HORIZONTAL, m_numTextSize,
888 }
889 }
890 else /* Its a vertical line. */
891 {
892 if( aDrawPinName )
893 {
894 y = ( y1 + aPinPos.y ) / 2;
895 plotText( x1 - name_offset, y, nameColor, name, ANGLE_VERTICAL, m_nameTextSize,
897 }
898
899 if( aDrawPinNum )
900 {
901 plotText( x1 + num_offset, ( y1 + aPinPos.y ) / 2, numColor, number, ANGLE_VERTICAL,
903 }
904 }
905 }
906}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:305
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
bool GetColorMode() const
Definition: plotter.h:138
@ WHITE
Definition: color4d.h:48
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
static constexpr EDA_ANGLE & ANGLE_VERTICAL
Definition: eda_angle.h:409
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
Definition: gr_text.cpp:75
@ LAYER_PINNUM
Definition: layer_ids.h:350
@ LAYER_PINNAM
Definition: layer_ids.h:351
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
GR_TEXT_H_ALIGN_T
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
GR_TEXT_V_ALIGN_T
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP

References PNS::angle(), ANGLE_HORIZONTAL, ANGLE_VERTICAL, Clamp_Text_PenSize(), color, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), PLOTTER::GetColorMode(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), KIFONT::FONT::GetFont(), KIGFX::RENDER_SETTINGS::GetLayerColor(), GetPenWidth(), GetShownName(), GetShownNumber(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, LAYER_PINNAM, LAYER_PINNUM, m_length, m_nameTextSize, m_numTextSize, EDA_IU_SCALE::MilsToIU(), KIGFX::COLOR4D::Mix(), name, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, PLOTTER::RenderSettings(), schIUScale, text, PLOTTER::Text(), WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Plot().

◆ PlotSymbol()

void LIB_PIN::PlotSymbol ( PLOTTER aPlotter,
const VECTOR2I aPosition,
int  aOrientation,
bool  aDimmed 
) const

Definition at line 604 of file lib_pin.cpp.

606{
607 int MapX1, MapY1, x1, y1;
609 COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
610 int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
611
612 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
613 bg = COLOR4D::WHITE;
614
615 if( aDimmed )
616 color = color.Mix( bg, 0.5f );
617
618 aPlotter->SetColor( color );
619 aPlotter->SetCurrentLineWidth( penWidth );
620
621 MapX1 = MapY1 = 0;
622 x1 = aPosition.x; y1 = aPosition.y;
623
624 switch( aOrientation )
625 {
626 case PIN_UP: y1 = aPosition.y - m_length; MapY1 = 1; break;
627 case PIN_DOWN: y1 = aPosition.y + m_length; MapY1 = -1; break;
628 case PIN_LEFT: x1 = aPosition.x - m_length; MapX1 = 1; break;
629 case PIN_RIGHT: x1 = aPosition.x + m_length; MapX1 = -1; break;
630 }
631
633 {
634 const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this );
635 aPlotter->Circle( VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
636 FILL_T::NO_FILL, penWidth );
637
638 aPlotter->MoveTo( VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
639 aPlotter->FinishTo( aPosition );
640 }
642 {
643 const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
644 if( MapY1 == 0 ) /* MapX1 = +- 1 */
645 {
646 aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
647 aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
648 aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
649 }
650 else /* MapX1 = 0 */
651 {
652 aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
653 aPlotter->LineTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
654 aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
655 }
656
657 aPlotter->MoveTo( VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
658 aPlotter->FinishTo( aPosition );
659 }
660 else
661 {
662 aPlotter->MoveTo( VECTOR2I( x1, y1 ) );
663 aPlotter->FinishTo( aPosition );
664 }
665
669 {
670 const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
671 if( MapY1 == 0 ) /* MapX1 = +- 1 */
672 {
673 aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
674 aPlotter->LineTo( VECTOR2I( x1 - MapX1 * deco_size * 2, y1 ) );
675 aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
676 }
677 else /* MapX1 = 0 */
678 {
679 aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
680 aPlotter->LineTo( VECTOR2I( x1, y1 - MapY1 * deco_size * 2 ) );
681 aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
682 }
683 }
684
686 || m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
687 {
688 const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
689
690 if( MapY1 == 0 ) /* MapX1 = +- 1 */
691 {
692 aPlotter->MoveTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
693 aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
694 aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
695 }
696 else /* MapX1 = 0 */
697 {
698 aPlotter->MoveTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
699 aPlotter->LineTo( VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
700 aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
701 }
702 }
703
704 if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
705 {
706 const int symbol_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
707
708 if( MapY1 == 0 ) /* MapX1 = +- 1 */
709 {
710 aPlotter->MoveTo( VECTOR2I( x1, y1 - symbol_size * 2 ) );
711 aPlotter->FinishTo( VECTOR2I( x1 + MapX1 * symbol_size * 2, y1 ) );
712 }
713 else /* MapX1 = 0 */
714 {
715 aPlotter->MoveTo( VECTOR2I( x1 - symbol_size * 2, y1 ) );
716 aPlotter->FinishTo( VECTOR2I( x1, y1 + MapY1 * symbol_size * 2 ) );
717 }
718 }
719 else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
720 {
721 const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
722 aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 + MapY1 ) * deco_size,
723 y1 - ( MapY1 - MapX1 ) * deco_size ) );
724 aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 + MapY1 ) * deco_size,
725 y1 + ( MapY1 - MapX1 ) * deco_size ) );
726 aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 - MapY1 ) * deco_size,
727 y1 - ( MapY1 + MapX1 ) * deco_size ) );
728 aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 - MapY1 ) * deco_size,
729 y1 + ( MapY1 + MapX1 ) * deco_size ) );
730 }
731
732 if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
733 {
734 const int deco_size = TARGET_PIN_RADIUS;
735 const int ex1 = aPosition.x;
736 const int ey1 = aPosition.y;
737 aPlotter->MoveTo( VECTOR2I( ex1 - deco_size, ey1 - deco_size ) );
738 aPlotter->FinishTo( VECTOR2I( ex1 + deco_size, ey1 + deco_size ) );
739 aPlotter->MoveTo( VECTOR2I( ex1 + deco_size, ey1 - deco_size ) );
740 aPlotter->FinishTo( VECTOR2I( ex1 - deco_size, ey1 + deco_size ) );
741 }
742}
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:155
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
Definition: plotter.h:252
virtual void SetColor(const COLOR4D &color)=0
@ LAYER_PIN
Definition: layer_ids.h:361
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
Definition: lib_pin.cpp:73
@ PT_NC
not connected (must be left open)

References PLOTTER::Circle(), CLOCK, CLOCK_LOW, color, externalPinDecoSize(), FALLING_EDGE_CLOCK, PLOTTER::FinishTo(), KIGFX::RENDER_SETTINGS::GetBackgroundColor(), PLOTTER::GetColorMode(), LIB_ITEM::GetEffectivePenWidth(), KIGFX::RENDER_SETTINGS::GetLayerColor(), INPUT_LOW, internalPinDecoSize(), INVERTED, INVERTED_CLOCK, LAYER_PIN, PLOTTER::LineTo(), m_length, m_shape, m_type, PLOTTER::MoveTo(), NO_FILL, NONLOGIC, OUTPUT_LOW, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, PT_NC, PLOTTER::RenderSettings(), PLOTTER::SetColor(), PLOTTER::SetCurrentLineWidth(), TARGET_PIN_RADIUS, WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Plot().

◆ Print()

void LIB_ITEM::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset,
void *  aData,
const TRANSFORM aTransform,
bool  aDimmed 
)
virtualinherited

Draw an item.

Parameters
aDCDevice Context (can be null)
aOffsetOffset to draw
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 symbol for pins.
aTransformTransform Matrix (rotation, mirror ..)
aDimmedDim the color on the printout

Definition at line 136 of file lib_item.cpp.

138{
139 print( aSettings, aOffset, aData, aTransform, aDimmed );
140}
virtual void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed)=0
Print the item to aDC.

References LIB_ITEM::print().

Referenced by DIALOG_PIN_PROPERTIES::OnPaintShowPanel(), LIB_SYMBOL::Print(), and LIB_SYMBOL::PrintBackground().

◆ print()

void LIB_PIN::print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset,
void *  aData,
const TRANSFORM aTransform,
bool  aDimmed 
)
overridevirtual

Print a pin, with or without the pin texts.

Parameters
aOffsetOffset to draw
aData= used here as a boolean indicating whether or not to draw the pin electrical types
aTransformTransform Matrix (rotation, mirror ..)

Implements LIB_ITEM.

Definition at line 197 of file lib_pin.cpp.

199{
200 LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData;
201 bool drawHiddenFields = opts ? opts->draw_hidden_fields : false;
202 bool showPinType = opts ? opts->show_elec_type : false;
203 bool show_connect_point = opts ? opts->show_connect_point : false;
204
205 LIB_SYMBOL* part = GetParent();
206
207 wxCHECK( part && opts, /* void */ );
208
209 /* Calculate pin orient taking in account the symbol orientation. */
210 int orient = PinDrawOrient( aTransform );
211
212 /* Calculate the pin position */
213 VECTOR2I pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
214
215 if( IsVisible() || drawHiddenFields )
216 {
217 printPinSymbol( aSettings, pos1, orient, aDimmed );
218
219 printPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(),
220 opts->force_draw_pin_text || part->ShowPinNumbers(),
221 opts->force_draw_pin_text || part->ShowPinNames(),
222 aDimmed );
223
224 if( showPinType )
225 printPinElectricalTypeName( aSettings, pos1, orient, aDimmed );
226
227 if( show_connect_point
230 {
231 wxDC* DC = aSettings->GetPrintDC();
233
234 COLOR4D bg = aSettings->GetBackgroundColor();
235
236 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
237 bg = COLOR4D::WHITE;
238
239 if( aDimmed )
240 color = color.Mix( bg, 0.5f );
241
242 GRCircle( DC, pos1, TARGET_PIN_RADIUS, 0, color );
243 }
244 }
245}
wxDC * GetPrintDC() const
void printPinSymbol(const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, int aOrientation, bool aDimmed)
Print the pin symbol without text.
Definition: lib_pin.cpp:248
void printPinElectricalTypeName(const RENDER_SETTINGS *aSettings, VECTOR2I &aPosition, int aOrientation, bool aDimmed)
Draw the electrical type text of the pin (only for the footprint editor)
Definition: lib_pin.cpp:540
void printPinTexts(const RENDER_SETTINGS *aSettings, VECTOR2I &aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed)
Put the pin number and pin text info, given the pin line coordinates.
Definition: lib_pin.cpp:369
bool ShowPinNames() const
Definition: lib_symbol.h:636
bool ShowPinNumbers() const
Definition: lib_symbol.h:644
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:348
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156
@ LAYER_HIDDEN
Definition: layer_ids.h:380
@ PT_NIC
not internally connected (may be connected to anything)
bool force_draw_pin_text
Definition: lib_symbol.h:64

References color, LIB_SYMBOL_OPTIONS::draw_hidden_fields, LIB_SYMBOL_OPTIONS::force_draw_pin_text, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LIB_ITEM::GetParent(), LIB_SYMBOL::GetPinNameOffset(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GRCircle(), IsVisible(), LAYER_HIDDEN, LAYER_PIN, m_position, m_type, PinDrawOrient(), printPinElectricalTypeName(), printPinSymbol(), printPinTexts(), PT_NC, PT_NIC, LIB_SYMBOL_OPTIONS::show_connect_point, LIB_SYMBOL_OPTIONS::show_elec_type, LIB_SYMBOL::ShowPinNames(), LIB_SYMBOL::ShowPinNumbers(), TARGET_PIN_RADIUS, TRANSFORM::TransformCoordinate(), and WHITE.

◆ printPinElectricalTypeName()

void LIB_PIN::printPinElectricalTypeName ( const RENDER_SETTINGS aSettings,
VECTOR2I aPosition,
int  aOrientation,
bool  aDimmed 
)
protected

Draw the electrical type text of the pin (only for the footprint editor)

Definition at line 540 of file lib_pin.cpp.

542{
543 wxDC* DC = aSettings->GetPrintDC();
544 wxString typeName = GetElectricalTypeName();
545
546 // Use a reasonable (small) size to draw the text
547 int textSize = ( m_nameTextSize * 3 ) / 4;
548
549 #define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
550
551 if( textSize > ETXT_MAX_SIZE )
552 textSize = ETXT_MAX_SIZE;
553
554 // Use a reasonable pen size to draw the text
555 int pensize = textSize/6;
556
557 // Get a suitable color
559 COLOR4D bg = aSettings->GetBackgroundColor();
560
561 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
562 bg = COLOR4D::WHITE;
563
564 if( !IsVisible() )
565 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
566
567 if( aDimmed )
568 color = color.Mix( bg, 0.5f );
569
570 VECTOR2I txtpos = aPosition;
571 int offset = schIUScale.mmToIU( 0.4 );
574 KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
575
576 switch( aOrientation )
577 {
578 case PIN_UP:
579 txtpos.y += offset;
580 orient = ANGLE_VERTICAL;
581 hjustify = GR_TEXT_H_ALIGN_RIGHT;
582 break;
583
584 case PIN_DOWN:
585 txtpos.y -= offset;
586 orient = ANGLE_VERTICAL;
587 break;
588
589 case PIN_LEFT:
590 txtpos.x += offset;
591 break;
592
593 case PIN_RIGHT:
594 txtpos.x -= offset;
595 hjustify = GR_TEXT_H_ALIGN_RIGHT;
596 break;
597 }
598
599 GRPrintText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
600 GR_TEXT_V_ALIGN_CENTER, pensize, false, false, font );
601}
void GRPrintText(wxDC *aDC, const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, KIFONT::FONT *aFont)
Print a graphic text through wxDC.
Definition: gr_text.cpp:129
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:359
#define ETXT_MAX_SIZE

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, color, ETXT_MAX_SIZE, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), GetElectricalTypeName(), KIFONT::FONT::GetFont(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, GRPrintText(), IsVisible(), LAYER_HIDDEN, LAYER_PRIVATE_NOTES, m_nameTextSize, EDA_IU_SCALE::mmToIU(), PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, schIUScale, WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by print().

◆ printPinSymbol()

void LIB_PIN::printPinSymbol ( const RENDER_SETTINGS aSettings,
const VECTOR2I aPos,
int  aOrientation,
bool  aDimmed 
)
protected

Print the pin symbol without text.

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

Definition at line 248 of file lib_pin.cpp.

249{
250 wxDC* DC = aSettings->GetPrintDC();
251 int MapX1, MapY1, x1, y1;
252 int width = GetEffectivePenWidth( aSettings );
253 int posX = aPos.x, posY = aPos.y, len = m_length;
255 COLOR4D bg = aSettings->GetBackgroundColor();
256
257 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
258 bg = COLOR4D::WHITE;
259
260 if( !IsVisible() )
261 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
262
263 if( aDimmed )
264 color = color.Mix( bg, 0.5f );
265
266 MapX1 = MapY1 = 0;
267 x1 = posX;
268 y1 = posY;
269
270 switch( aOrient )
271 {
272 case PIN_UP: y1 = posY - len; MapY1 = 1; break;
273 case PIN_DOWN: y1 = posY + len; MapY1 = -1; break;
274 case PIN_LEFT: x1 = posX - len; MapX1 = 1; break;
275 case PIN_RIGHT: x1 = posX + len; MapX1 = -1; break;
276 }
277
279 {
280 const int radius = externalPinDecoSize( aSettings, *this );
281 GRCircle( DC, VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius, width, color );
282
283 GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
284 GRLineTo( DC, posX, posY, width, color );
285 }
286 else
287 {
288 GRMoveTo( x1, y1 );
289 GRLineTo( DC, posX, posY, width, color );
290 }
291
292 // Draw the clock shape (>)inside the symbol
297 {
298 const int clock_size = internalPinDecoSize( aSettings, *this );
299 if( MapY1 == 0 ) /* MapX1 = +- 1 */
300 {
301 GRMoveTo( x1, y1 + clock_size );
302 GRLineTo( DC, x1 - MapX1 * clock_size * 2, y1, width, color );
303 GRLineTo( DC, x1, y1 - clock_size, width, color );
304 }
305 else /* MapX1 = 0 */
306 {
307 GRMoveTo( x1 + clock_size, y1 );
308 GRLineTo( DC, x1, y1 - MapY1 * clock_size * 2, width, color );
309 GRLineTo( DC, x1 - clock_size, y1, width, color );
310 }
311 }
312
313 // Draw the active low (or H to L active transition)
317 {
318 const int deco_size = externalPinDecoSize( aSettings, *this );
319 if( MapY1 == 0 ) /* MapX1 = +- 1 */
320 {
321 GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
322 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
323 GRLineTo( DC, x1, y1, width, color );
324 }
325 else /* MapX1 = 0 */
326 {
327 GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
328 GRLineTo( DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
329 GRLineTo( DC, x1, y1, width, color );
330 }
331 }
332
333 if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
334 {
335 const int deco_size = externalPinDecoSize( aSettings, *this );
336 if( MapY1 == 0 ) /* MapX1 = +- 1 */
337 {
338 GRMoveTo( x1, y1 - deco_size * 2 );
339 GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1, width, color );
340 }
341 else /* MapX1 = 0 */
342 {
343 GRMoveTo( x1 - deco_size * 2, y1 );
344 GRLineTo( DC, x1, y1 + MapY1 * deco_size * 2, width, color );
345 }
346 }
347 else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
348 {
349 const int deco_size = externalPinDecoSize( aSettings, *this );
350 GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
351 GRLineTo( DC, x1 + (MapX1 + MapY1) * deco_size, y1 + ( MapY1 - MapX1 ) * deco_size, width,
352 color );
353 GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
354 GRLineTo( DC, x1 + (MapX1 - MapY1) * deco_size, y1 + ( MapY1 + MapX1 ) * deco_size, width,
355 color );
356 }
357
358 if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
359 {
360 const int deco_size = TARGET_PIN_RADIUS;
361 GRLine( DC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width,
362 color );
363 GRLine( DC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width,
364 color );
365 }
366}
void GRLineTo(wxDC *DC, int x, int y, int width, const COLOR4D &Color)
Definition: gr_basic.cpp:186
void GRMoveTo(int x, int y)
Definition: gr_basic.cpp:179
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162

References CLOCK, CLOCK_LOW, color, externalPinDecoSize(), FALLING_EDGE_CLOCK, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), LIB_ITEM::GetEffectivePenWidth(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GRCircle(), GRLine(), GRLineTo(), GRMoveTo(), INPUT_LOW, internalPinDecoSize(), INVERTED, INVERTED_CLOCK, IsVisible(), LAYER_HIDDEN, LAYER_PIN, m_length, m_shape, m_type, NONLOGIC, OUTPUT_LOW, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, PT_NC, TARGET_PIN_RADIUS, WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by print().

◆ printPinTexts()

void LIB_PIN::printPinTexts ( const RENDER_SETTINGS aSettings,
VECTOR2I aPinPos,
int  aPinOrient,
int  aTextInside,
bool  aDrawPinNum,
bool  aDrawPinName,
bool  aDimmed 
)
protected

Put the pin number and pin text info, given the pin line coordinates.

The line must be vertical or horizontal. If aDrawPinName == false the pin name is not printed. If aDrawPinNum = false the pin number is not printed. If aTextInside then the text is been put inside,otherwise all is drawn outside. Pin Name: substring between '~' is negated

Definition at line 369 of file lib_pin.cpp.

371{
372 if( !aDrawPinName && !aDrawPinNum )
373 return;
374
375 int x, y;
376 wxDC* DC = aSettings->GetPrintDC();
377 KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
378
379 wxSize pinNameSize( m_nameTextSize, m_nameTextSize );
380 wxSize pinNumSize( m_numTextSize, m_numTextSize );
381
382 int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, true ),
383 aSettings->GetDefaultPenWidth() );
384 int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, true ),
385 aSettings->GetDefaultPenWidth() );
386
387 int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + namePenWidth;
388 int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN ) + numPenWidth;
389
390 /* Get the num and name colors */
391 COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
392 COLOR4D numColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
393 COLOR4D bg = aSettings->GetBackgroundColor();
394
395 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
396 bg = COLOR4D::WHITE;
397
398 if( !IsVisible() )
399 bg = aSettings->GetLayerColor( LAYER_HIDDEN );
400
401 if( aDimmed )
402 {
403 nameColor = nameColor.Mix( bg, 0.5f );
404 numColor = numColor.Mix( bg, 0.5f );
405 }
406
407 int x1 = aPinPos.x;
408 int y1 = aPinPos.y;
409
410 switch( aPinOrient )
411 {
412 case PIN_UP: y1 -= m_length; break;
413 case PIN_DOWN: y1 += m_length; break;
414 case PIN_LEFT: x1 -= m_length; break;
415 case PIN_RIGHT: x1 += m_length; break;
416 }
417
418 wxString name = GetShownName();
419 wxString number = GetShownNumber();
420
421 if( name.IsEmpty() || m_nameTextSize == 0 )
422 aDrawPinName = false;
423
424 if( number.IsEmpty() || m_numTextSize == 0 )
425 aDrawPinNum = false;
426
427 if( aTextInside ) // Draw the text inside, but the pin numbers outside.
428 {
429 if(( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) )
430 {
431 // It is an horizontal line
432 if( aDrawPinName )
433 {
434 if( aPinOrient == PIN_RIGHT )
435 {
436 x = x1 + aTextInside;
437 GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
439 namePenWidth, false, false, font );
440 }
441 else // Orient == PIN_LEFT
442 {
443 x = x1 - aTextInside;
444 GRPrintText( DC, VECTOR2I( x, y1 ), nameColor, name, ANGLE_HORIZONTAL,
446 namePenWidth, false, false, font );
447 }
448 }
449
450 if( aDrawPinNum )
451 {
452 GRPrintText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
453 number, ANGLE_HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
454 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
455 }
456 }
457 else /* Its a vertical line. */
458 {
459 // Text is drawn from bottom to top (i.e. to negative value for Y axis)
460 if( aPinOrient == PIN_DOWN )
461 {
462 y = y1 + aTextInside;
463
464 if( aDrawPinName )
465 {
466 GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
468 namePenWidth, false, false, font );
469 }
470
471 if( aDrawPinNum )
472 {
473 GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
474 number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
475 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
476 }
477 }
478 else /* PIN_UP */
479 {
480 y = y1 - aTextInside;
481
482 if( aDrawPinName )
483 {
484 GRPrintText( DC, VECTOR2I( x1, y ), nameColor, name, ANGLE_VERTICAL,
486 namePenWidth, false, false, font );
487 }
488
489 if( aDrawPinNum )
490 {
491 GRPrintText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
492 number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
493 GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, font );
494 }
495 }
496 }
497 }
498 else /**** Draw num & text pin outside ****/
499 {
500 if( ( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) )
501 {
502 /* Its an horizontal line. */
503 if( aDrawPinName )
504 {
505 x = ( x1 + aPinPos.x) / 2;
506 GRPrintText( DC, VECTOR2I( x, y1 - name_offset ), nameColor, name, ANGLE_HORIZONTAL,
508 namePenWidth, false, false, font );
509 }
510 if( aDrawPinNum )
511 {
512 x = ( x1 + aPinPos.x) / 2;
513 GRPrintText( DC, VECTOR2I( x, y1 + num_offset ), numColor, number, ANGLE_HORIZONTAL,
515 numPenWidth, false, false, font );
516 }
517 }
518 else /* Its a vertical line. */
519 {
520 if( aDrawPinName )
521 {
522 y = ( y1 + aPinPos.y) / 2;
523 GRPrintText( DC, VECTOR2I( x1 - name_offset, y ), nameColor, name, ANGLE_VERTICAL,
525 namePenWidth, false, false, font );
526 }
527
528 if( aDrawPinNum )
529 {
530 GRPrintText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
531 number, ANGLE_VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
532 GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false, font );
533 }
534 }
535 }
536}

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, Clamp_Text_PenSize(), KIGFX::RENDER_SETTINGS::GetBackgroundColor(), KIGFX::RENDER_SETTINGS::GetDefaultFont(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), KIFONT::FONT::GetFont(), GetGRForceBlackPenState(), KIGFX::RENDER_SETTINGS::GetLayerColor(), GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GetShownName(), GetShownNumber(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, GRPrintText(), IsVisible(), LAYER_HIDDEN, LAYER_PINNAM, LAYER_PINNUM, m_length, m_nameTextSize, m_numTextSize, EDA_IU_SCALE::MilsToIU(), KIGFX::COLOR4D::Mix(), name, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_TEXT_MARGIN, PIN_UP, schIUScale, WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by print().

◆ RenderAsBitmap()

virtual bool EDA_ITEM::RenderAsBitmap ( double  aWorldScale) const
inlinevirtualinherited

Reimplemented in SCH_ITEM.

Definition at line 165 of file eda_item.h.

165{ return false; }

◆ Replace() [1/2]

virtual bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform 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 LIB_TEXTBOX, SCH_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 411 of file eda_item.h.

412 {
413 return false;
414 }

◆ Replace() [2/2]

bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
wxString &  aText 
)
staticinherited

Perform 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 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}
wxString replaceString

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Rotate()

void LIB_PIN::Rotate ( const VECTOR2I aCenter,
bool  aRotateCCW = true 
)
overridevirtual

Rotate the object about aCenter point.

Parameters
aCenterPoint to rotate around.
aRotateCCWTrue to rotate counter clockwise. False to rotate clockwise.

Implements LIB_ITEM.

Definition at line 1096 of file lib_pin.cpp.

1097{
1098 EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
1099
1100 RotatePoint( m_position, aCenter, rot_angle );
1101
1102 if( aRotateCCW )
1103 {
1104 switch( m_orientation )
1105 {
1106 case PIN_RIGHT: m_orientation = PIN_UP; break;
1107 case PIN_UP: m_orientation = PIN_LEFT; break;
1108 case PIN_LEFT: m_orientation = PIN_DOWN; break;
1109 case PIN_DOWN: m_orientation = PIN_RIGHT; break;
1110 }
1111 }
1112 else
1113 {
1114 switch( m_orientation )
1115 {
1116 case PIN_RIGHT: m_orientation = PIN_DOWN; break;
1117 case PIN_UP: m_orientation = PIN_RIGHT; break;
1118 case PIN_LEFT: m_orientation = PIN_UP; break;
1119 case PIN_DOWN: m_orientation = PIN_LEFT; break;
1120 }
1121 }
1122}

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

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:275

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetBrightened()

◆ SetConvert()

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 142 of file eda_item.h.

142{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_ALTIUM_PLUGIN::AddTextBox(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildCourtyardCaches(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupShapes(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PAD_TOOL::explodePad(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_COLLECTOR::Inspect(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), SCH_SCREEN::MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_MOVE_TOOL::orthoLineDrag(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), SCH_SYMBOL::Plot(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), BOARD::Remove(), FOOTPRINT::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::SelectAll(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear 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 201 of file eda_item.h.

201{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 167 of file eda_item.h.

168 {
169 if( aBitmap )
171 else
173 }

References EDA_ITEM::ClearFlags(), IS_SHOWN_AS_BITMAP, and EDA_ITEM::SetFlags().

◆ SetLength()

void LIB_PIN::SetLength ( int  aLength)
inline

Definition at line 81 of file lib_pin.h.

81{ m_length = aLength; }

References m_length.

Referenced by DIALOG_PIN_PROPERTIES::OnPropertiesChange().

◆ SetModified()

◆ SetName()

void LIB_PIN::SetName ( const wxString &  aName)
inline

Definition at line 114 of file lib_pin.h.

115 {
116 m_name = aName;
117
118 // pin name string does not support spaces
119 m_name.Replace( wxT( " " ), wxT( "_" ) );
120 }

References m_name.

Referenced by KIGFX::SCH_PAINTER::draw(), LIB_PIN(), DIALOG_PIN_PROPERTIES::OnPropertiesChange(), SCH_SYMBOL::Plot(), SCH_SYMBOL::PlotPins(), PIN_TABLE_DATA_MODEL::SetValue(), TEST_SCH_PIN_FIXTURE::TEST_SCH_PIN_FIXTURE(), and DIALOG_PIN_PROPERTIES::TransferDataFromWindow().

◆ SetNameTextSize()

void LIB_PIN::SetNameTextSize ( int  aSize)
inline

◆ SetNumber()

◆ SetNumberTextSize()

void LIB_PIN::SetNumberTextSize ( int  aSize)
inline

◆ SetOrientation()

void LIB_PIN::SetOrientation ( int  aOrientation)
inline

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL, and PCB_DIMENSION_BASE.

Definition at line 100 of file eda_item.h.

100{ m_parent = aParent; }

References EDA_ITEM::m_parent.

Referenced by BOARD::Add(), FOOTPRINT::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveAnnotationBox(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_SYMBOL::operator=(), FOOTPRINT::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SCH_SHEET::SwapData(), SCH_SYMBOL::SwapData(), BOARD_ITEM::SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetPosition()

void LIB_PIN::SetPosition ( const VECTOR2I aPos)
inlineoverridevirtual

◆ SetPrivate()

void LIB_ITEM::SetPrivate ( bool  aPrivate)
inlineinherited

◆ SetSelected()

◆ SetShape()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 131 of file eda_item.h.

132 {
133 if( state )
134 m_status |= type; // state = ON or OFF
135 else
136 m_status &= ~type;
137 }

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), and TRACKS_CLEANER::mergeCollinearSegments().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetType()

◆ SetUnit()

◆ SetVisible()

void LIB_PIN::SetVisible ( bool  aVisible)
inline

Definition at line 104 of file lib_pin.h.

105 {
106 if( aVisible )
107 m_attributes &= ~PIN_INVISIBLE;
108 else
110 }

References m_attributes, and PIN_INVISIBLE.

Referenced by DIALOG_PIN_PROPERTIES::OnPropertiesChange(), DIALOG_PIN_PROPERTIES::TransferDataFromWindow(), and DIALOG_PIN_PROPERTIES::TransferDataToWindow().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 117 of file eda_item.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

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

Definition at line 440 of file eda_item.h.

440{ return *aLeft < *aRight; }

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 97 of file eda_item.h.

97{ return m_structType; }

References EDA_ITEM::m_structType.

Referenced by CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), FOOTPRINT::Add(), CN_CLUSTER::Add(), KIGFX::PCB_VIEW::Add(), PCB_POINT_EDITOR::addCorner(), PCB_GROUP::AddItem(), CONNECTION_SUBGRAPH::AddItem(), DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), SCH_MOVE_TOOL::AlignElements(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), SCH_LABEL_BASE::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_LABEL_BASE::CanConnect(), SCH_LINE::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_SHEET::CanConnect(), SCH_SYMBOL::CanConnect(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFootprint(), KI_TEST::CheckFpPad(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpText(), KI_TEST::CheckFpZone(), CN_VISITOR::checkZoneItemConnection(), LIB_TEXTBOX::ClassOf(), SCH_BITMAP::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_FIELD::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_LABEL::ClassOf(), SCH_DIRECTIVE_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), SCH_LINE::ClassOf(), SCH_MARKER::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), SCH_SCREEN::ClassOf(), SCH_SHEET::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_SYMBOL::ClassOf(), SCH_TEXT::ClassOf(), SCH_TEXTBOX::ClassOf(), PCB_GROUP::ClassOf(), BOARD::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FOOTPRINT::ClassOf(), FP_SHAPE::ClassOf(), FP_TEXT::ClassOf(), FP_TEXTBOX::ClassOf(), NETINFO_ITEM::ClassOf(), PAD::ClassOf(), PCB_BITMAP::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), PCB_DIM_RADIAL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), PCB_MARKER::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), PCB_TEXT::ClassOf(), PCB_TEXTBOX::ClassOf(), PCB_TRACK::ClassOf(), PCB_ARC::ClassOf(), PCB_VIA::ClassOf(), ZONE::ClassOf(), CONNECTION_GRAPH::collectAllDriverValues(), collidesWithArea(), LIB_ITEM::compare(), LIB_FIELD::compare(), compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), LIB_SYMBOL::Compare(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::computeAnchors(), TEARDROP_MANAGER::ComputePointsOnPadVia(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_LINE::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), BOARD_COMMIT::dirtyIntersectingZones(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextBoxProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), DRC_ENGINE::EvalZoneConnection(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_SELECTION_TOOL::FilterCollectorForMarkers(), PCB_SELECTION_TOOL::FindItem(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItems(), EDIT_TOOL::FootprintFilter(), PCB_PLUGIN::Format(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), SCH_LABEL_BASE::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), getClosestGroup(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), SCH_FIELD::GetDrawRotation(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), getFieldFunc(), getInferredSymbols(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), SCH_LABEL_BASE::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTION_SUBGRAPH::GetNetclassForDriver(), CONNECTIVITY_DATA::GetNetItems(), LIB_SYMBOL::GetNextDrawItem(), BOARD_ITEM::GetParentFootprint(), LIB_SYMBOL::GetPin(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), PCB_TRACK::GetSelectMenuText(), SCH_FIELD::GetShownText(), PCB_TEXT::GetShownText(), PCB_TEXTBOX::GetShownText(), CONVERT_TOOL::getStartEndPoints(), KIGFX::SCH_PAINTER::getTextThickness(), EDA_ITEM::GetTypeDesc(), PCB_EXPR_TYPE_REF::GetValue(), PCB_SELECTION_TOOL::grabUnconnected(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hasDrilledHole(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), SCH_FIELD::HitTest(), SCH_LABEL_BASE::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRC_RTREE::Insert(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), CONNECTIVITY_DATA::IsConnectedOnLayer(), isCopper(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE_BASE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), isMaskAperture(), isNPTHPad(), PCB_TRACK::IsNull(), isNullAperture(), SCH_LINE::IsParallel(), isPlatedFunc(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), SCH_ITEM::IsType(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromChainedSegs(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), SCH_FIELD::Matches(), memberOfFunc(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), DIALOG_DRC::OnDRCItemSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), KI_TEST::kitest_cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_JUNCTION::operator<(), SCH_LINE::operator<(), SCH_SHEET::operator<(), SCH_SYMBOL::operator<(), SCH_TEXT::operator<(), SCH_TEXTBOX::operator<(), PCB_BITMAP::operator=(), SCH_BITMAP::operator=(), SCH_SYMBOL::operator=(), SCH_SHEET::operator=(), LIB_ITEM::operator==(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), SCH_SEXPR_PARSER::parseSchField(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), BRDITEMS_PLOTTER::PlotPcbGraphicItem(), SCH_FIELD::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), CONNECTION_GRAPH::processSubGraphs(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshZoomDependentItems(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), FOOTPRINT::Remove(), EE_RTREE::remove(), SCH_SCREEN::Remove(), KIGFX::PCB_VIEW::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), CONNECTION_GRAPH::resolveAllDrivers(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), SCH_LABEL_BASE::ResolveTextVar(), DS_PROXY_UNDO_ITEM::Restore(), BOARD_COMMIT::Revert(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), EE_TOOL_BASE< T >::saveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_ITEM::Schematic(), SCH_SCREEN::Schematic(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectUnconnected(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), BOARD_COMMIT::Stage(), PNS::LINE_PLACER::Start(), SCH_EDIT_TOOL::Swap(), PCB_GROUP::swapData(), FOOTPRINT::swapData(), PAD::swapData(), PCB_DIM_ALIGNED::swapData(), PCB_DIM_ORTHOGONAL::swapData(), PCB_DIM_RADIAL::swapData(), PCB_DIM_LEADER::swapData(), PCB_DIM_CENTER::swapData(), PCB_TARGET::swapData(), PCB_TEXT::swapData(), PCB_TEXTBOX::swapData(), PCB_TRACK::swapData(), PCB_ARC::swapData(), PCB_VIA::swapData(), ZONE::swapData(), PCB_BITMAP::swapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_SHEET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_SYMBOL::SwapData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_TRACK::TransformShapeToPolygon(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_BASE_FRAME::UpdateItem(), PCB_CONTROL::UpdateMessagePanel(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedSheet(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), SCH_SHEET::Visit(), GERBER_DRAW_ITEM::Visit(), PCB_TRACK::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ ViewBBox()

const BOX2I LIB_PIN::ViewBBox ( ) const
overridevirtual

Return the bounding box of the item covering all its layers.

Returns
the current bounding box.

Reimplemented from EDA_ITEM.

Definition at line 1166 of file lib_pin.cpp.

1167{
1168 return GetBoundingBox( false, true, true );
1169}

References GetBoundingBox().

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Draw the parts of the object belonging to layer aLayer.

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

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in DS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, EDIT_POINTS, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::VIEW_GROUP, and KIGFX::VIEW_OVERLAY.

Definition at line 106 of file view_item.h.

107 {}

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

◆ ViewGetLayers()

void LIB_PIN::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtual

Return the all the layers within the VIEW the object is painted on.

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

Parameters
aLayers[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Reimplemented from LIB_ITEM.

Definition at line 1172 of file lib_pin.cpp.

1173{
1174 aCount = 3;
1175 aLayers[0] = LAYER_DANGLING; // We don't really show dangling vs non-dangling (since there
1176 // are no connections in the symbol editor), but it's still
1177 // a good visual indication of which end of the pin is which.
1178 aLayers[1] = LAYER_DEVICE;
1179 aLayers[2] = LAYER_SELECTION_SHADOWS;
1180}
@ LAYER_DANGLING
Definition: layer_ids.h:368
@ LAYER_DEVICE
Definition: layer_ids.h:357
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381

References LAYER_DANGLING, LAYER_DEVICE, and LAYER_SELECTION_SHADOWS.

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

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

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

Reimplemented in GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

133 {
134 // By default always show the item
135 return 0.0;
136 }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ viewPrivData()

◆ Visit()

INSPECT_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  aScanTypes 
)
virtualinherited

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in aScanTypes, and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
aScanTypesWhich KICAD_T types are of interest and the order in which they should be processed.
Returns
#SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented in PCB_GROUP, LIB_SYMBOL, SCH_SHEET, SCH_SYMBOL, GBR_LAYOUT, GERBER_DRAW_ITEM, GERBER_FILE_IMAGE, FOOTPRINT, PCB_TRACK, SCH_LABEL_BASE, and BOARD.

Definition at line 91 of file eda_item.cpp.

93{
94#if 0 && defined(DEBUG)
95 std::cout << GetClass().mb_str() << ' ';
96#endif
97
98 if( IsType( aScanTypes ) )
99 {
100 if( INSPECT_RESULT::QUIT == inspector( this, testData ) )
102 }
103
105}
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183

References CONTINUE, EDA_ITEM::GetClass(), EDA_ITEM::IsType(), and QUIT.

Referenced by PCB_TYPE_COLLECTOR::Collect(), PCB_LAYER_COLLECTOR::Collect(), GENERAL_COLLECTOR::Collect(), GERBER_COLLECTOR::Collect(), and EDA_ITEM::IterateForward().

Member Data Documentation

◆ m_alternates

std::map<wxString, ALT> LIB_PIN::m_alternates
protected

Definition at line 301 of file lib_pin.h.

Referenced by compare(), GetAlt(), and GetAlternates().

◆ m_attributes

int LIB_PIN::m_attributes
protected

Definition at line 295 of file lib_pin.h.

Referenced by compare(), IsVisible(), and SetVisible().

◆ m_convert

int LIB_ITEM::m_convert
protectedinherited

Shape identification for alternate body styles.

Set 0 if the item is common to all body styles. This is typially used for representing DeMorgan variants in KiCad.

Definition at line 333 of file lib_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::compare(), LIB_ITEM::GetConvert(), LIB_ITEM::GetMsgPanelInfo(), LIB_SYMBOL::PrintBackground(), LIB_SYMBOL::SetConversion(), and LIB_ITEM::SetConvert().

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_length

◆ m_name

wxString LIB_PIN::m_name
protected

Definition at line 296 of file lib_pin.h.

Referenced by compare(), GetName(), GetSelectMenuText(), GetShownName(), and SetName().

◆ m_nameTextSize

int LIB_PIN::m_nameTextSize
protected

◆ m_number

wxString LIB_PIN::m_number
protected

Definition at line 297 of file lib_pin.h.

Referenced by compare(), GetNumber(), GetShownNumber(), and SetNumber().

◆ m_numTextSize

int LIB_PIN::m_numTextSize
protected

◆ m_orientation

int LIB_PIN::m_orientation
protected

◆ m_parent

◆ m_position

VECTOR2I LIB_PIN::m_position
protected

◆ m_private

bool LIB_ITEM::m_private
protectedinherited

Private items are shown only in the Symbol Editor.

Definition at line 338 of file lib_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::IsPrivate(), and LIB_ITEM::SetPrivate().

◆ m_shape

GRAPHIC_PINSHAPE LIB_PIN::m_shape
protected

◆ m_status

◆ m_structType

KICAD_T EDA_ITEM::m_structType
privateinherited

Run time identification, keep private so it can never be changed after a ctor sets it.

See comment near SetType() regarding virtual functions.

Definition at line 507 of file eda_item.h.

Referenced by EDA_ITEM::IsType(), EDA_ITEM::operator=(), and EDA_ITEM::Type().

◆ m_type

◆ m_unit

int LIB_ITEM::m_unit
protectedinherited

Unit identification for multiple parts per package.

Set to 0 if the item is common to all units.

Definition at line 327 of file lib_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::compare(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::GetUnit(), LIB_SYMBOL::PrintBackground(), LIB_ITEM::SetUnit(), and LIB_SYMBOL::SetUnitCount().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 494 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), SCH_SHEET::AddInstance(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), KI_TEST::CheckFpPad(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpText(), KI_TEST::CheckFpZone(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::CreateScreens(), ZONE_FILLER_TOOL::DirtyZone(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), FOOTPRINT::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), SCH_SHEET_LIST::FillItemMap(), BOARD::FillItemMap(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_PIN::GetDefaultNetName(), BOARD::GetItem(), SCH_SHEET_LIST::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), SCH_SHEET::getPageNumber(), FP_SHAPE::GetParentAsString(), FP_TEXT::GetParentAsString(), FP_TEXTBOX::GetParentAsString(), PAD::GetParentAsString(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::GetValue(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), ZONE::HigherPriority(), SCH_SHEET_PATH::IsContainedWithin(), SCH_ALTIUM_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), SCH_LEGACY_PLUGIN::loadHierarchy(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), FOOTPRINT::cmp_pads::operator()(), PCB_TRACK::cmp_tracks::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn(), SCH_SYMBOL::RemoveInstance(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveShape(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveTextBox(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), SCH_SHEET::setPageNumber(), FIELDS_EDITOR_GRID_DATA_MODEL::SetValue(), SCH_DRAWING_TOOLS::SingleClickPlace(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

The documentation for this class was generated from the following files: