KiCad PCB EDA Suite
LIB_SYMBOL Class Reference

Define a library symbol object. More...

#include <lib_symbol.h>

Inheritance diagram for LIB_SYMBOL:
EDA_ITEM LIB_TREE_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 LIB_SYMBOL (const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
 
 LIB_SYMBOL (const LIB_SYMBOL &aSymbol, SYMBOL_LIB *aLibrary=nullptr)
 
virtual ~LIB_SYMBOL ()
 http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared More...
 
LIB_SYMBOL_SPTR SharedPtr () const
 
virtual LIB_SYMBOLDuplicate () const
 Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children. More...
 
void SetParent (LIB_SYMBOL *aParent=nullptr)
 
LIB_SYMBOL_REFGetParent ()
 
const LIB_SYMBOL_REFGetParent () const
 
virtual wxString GetClass () const override
 Return the class name. More...
 
virtual void SetName (const wxString &aName)
 
wxString GetName () const override
 
LIB_ID GetLibId () const override
 
void SetLibId (const LIB_ID &aLibId)
 
wxString GetLibNickname () const override
 
void SetDescription (const wxString &aDescription)
 
wxString GetDescription () override
 
void SetKeyWords (const wxString &aKeyWords)
 
wxString GetKeyWords () const
 
wxString GetSearchText () override
 
bool IsRoot () const override
 For symbols derived from other symbols, IsRoot() indicates no derivation. More...
 
bool IsAlias () const
 
const wxString GetLibraryName () const
 
SYMBOL_LIBGetLib () const
 
void SetLib (SYMBOL_LIB *aLibrary)
 
timestamp_t GetLastModDate () const
 
void SetFPFilters (const wxArrayString &aFilters)
 
wxArrayString GetFPFilters () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
const EDA_RECT GetUnitBoundingBox (int aUnit, int aConvert) const
 Get the bounding box for the symbol. More...
 
const EDA_RECT GetBodyBoundingBox (int aUnit, int aConvert, bool aIncludePins) const
 Get the symbol bounding box excluding fields. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
bool IsPower () const
 
bool IsNormal () const
 
void SetPower ()
 
void SetNormal ()
 
void LockUnits (bool aLockUnits)
 Set interchangeable the property for symbol units. More...
 
bool UnitsLocked () const
 Check whether symbol units are interchangeable. More...
 
void SetFields (const std::vector< LIB_FIELD > &aFieldsList)
 Overwrite all the existing fields in this symbol with fields supplied in aFieldsList. More...
 
void GetFields (std::vector< LIB_FIELD * > &aList)
 Return a list of fields within this symbol. More...
 
void GetFields (std::vector< LIB_FIELD > &aList)
 
void AddField (LIB_FIELD *aField)
 Add a field. More...
 
LIB_FIELDFindField (const wxString &aFieldName)
 Find a field within this symbol matching aFieldName and returns it or NULL if not found. More...
 
const LIB_FIELDFindField (const wxString &aFieldName) const
 
LIB_FIELDGetFieldById (int aId) const
 Return pointer to the requested field. More...
 
LIB_FIELDGetValueField ()
 Return reference to the value field. More...
 
LIB_FIELDGetReferenceField ()
 Return reference to the reference designator field. More...
 
LIB_FIELDGetFootprintField ()
 Return reference to the footprint field. More...
 
LIB_FIELDGetDatasheetField ()
 Return reference to the datasheet field. More...
 
int UpdateFieldOrdinals ()
 Order optional field indices. More...
 
int GetNextAvailableFieldId () const
 
void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts)
 Print symbol. More...
 
void Plot (PLOTTER *aPlotter, int aUnit, int aConvert, const wxPoint &aOffset, const TRANSFORM &aTransform) const
 Plot lib symbol to plotter. More...
 
void PlotLibFields (PLOTTER *aPlotter, int aUnit, int aConvert, const wxPoint &aOffset, const TRANSFORM &aTransform)
 Plot Lib Fields only of the symbol to plotter. More...
 
void AddDrawItem (LIB_ITEM *aItem, bool aSort=true)
 Add a new draw aItem to the draw object list and sort according to aSort. More...
 
void RemoveDrawItem (LIB_ITEM *aItem)
 Remove draw aItem from list. More...
 
LIB_ITEMGetNextDrawItem (const LIB_ITEM *aItem=nullptr, KICAD_T aType=TYPE_NOT_INIT)
 Return the next draw object pointer. More...
 
size_t GetPinCount () const
 
size_t GetFieldCount () const
 
LIB_PINGetNextPin (LIB_PIN *aItem=nullptr)
 Return the next pin object from the draw list. More...
 
void GetPins (LIB_PINS &aList, int aUnit=0, int aConvert=0) const
 Return a list of pin object pointers from the draw item list. More...
 
LIB_PINGetPin (const wxString &aNumber, int aUnit=0, int aConvert=0) const
 Return pin object with the requested pin aNumber. More...
 
bool PinsConflictWith (const LIB_SYMBOL &aOtherSymbol, bool aTestNums, bool aTestNames, bool aTestType, bool aTestOrientation, bool aTestLength) const
 Return true if this symbol's pins do not match another symbol's pins. More...
 
void SetOffset (const wxPoint &aOffset)
 Move the symbol aOffset. More...
 
void RemoveDuplicateDrawItems ()
 Remove duplicate draw items from list. More...
 
bool HasConversion () const
 Test if symbol has more than one body conversion type (DeMorgan). More...
 
void ClearTempFlags ()
 Clears the status flag all draw objects in this symbol. More...
 
void ClearEditFlags ()
 
LIB_ITEMLocateDrawItem (int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint)
 Locate a draw object. More...
 
LIB_ITEMLocateDrawItem (int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint, const TRANSFORM &aTransform)
 Locate a draw object (overlaid) More...
 
LIB_ITEMS_CONTAINERGetDrawItems ()
 Return a reference to the draw item list. More...
 
const LIB_ITEMS_CONTAINERGetDrawItems () const
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
void SetUnitCount (int aCount, bool aDuplicateDrawItems=true)
 Set the units per symbol count. More...
 
int GetUnitCount () const override
 For items with units, return the number of units. More...
 
wxString GetUnitReference (int aUnit) override
 Return an identifier for aUnit for symbols with units. More...
 
bool IsMulti () const
 
void SetConversion (bool aSetConvert, bool aDuplicatePins=true)
 Set or clear the alternate body style (DeMorgan) for the symbol. More...
 
void SetPinNameOffset (int aOffset)
 Set the offset in mils of the pin name text from the pin symbol. More...
 
int GetPinNameOffset () const
 
void SetShowPinNames (bool aShow)
 Set or clear the pin name visibility flag. More...
 
bool ShowPinNames () const
 
void SetShowPinNumbers (bool aShow)
 Set or clear the pin number visibility flag. More...
 
bool ShowPinNumbers () const
 
void SetIncludeInBom (bool aIncludeInBom)
 Set or clear the include in schematic bill of materials flag. More...
 
bool GetIncludeInBom () const
 
void SetIncludeOnBoard (bool aIncludeOnBoard)
 Set or clear include in board netlist flag. More...
 
bool GetIncludeOnBoard () const
 
int Compare (const LIB_SYMBOL &aRhs, int aCompareFlags=0) const
 Comparison test that can be used for operators. More...
 
bool operator== (const LIB_SYMBOL *aSymbol) const
 
bool operator== (const LIB_SYMBOL &aSymbol) const
 
bool operator!= (const LIB_SYMBOL &aSymbol) const
 
const LIB_SYMBOLoperator= (const LIB_SYMBOL &aSymbol)
 
std::unique_ptr< LIB_SYMBOLFlatten () const
 Return a flattened symbol inheritance to the caller. More...
 
std::vector< struct LIB_SYMBOL_UNITGetUnitDrawItems ()
 Return a list of LIB_ITEM objects separated by unit and convert number. More...
 
std::vector< struct LIB_SYMBOL_UNITGetUniqueUnits ()
 Return a list of unit numbers that are unique to this symbol. More...
 
std::vector< LIB_ITEM * > GetUnitDrawItems (int aUnit, int aConvert)
 Return a list of item pointers for aUnit and aConvert for this symbol. More...
 
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
 
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
 
virtual bool IsType (const 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 void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
virtual bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const
 Test if aPosition is inside or on the boundary of this item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects this item. More...
 
virtual wxPoint GetPosition () const
 
virtual void SetPosition (const wxPoint &aPos)
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText (EDA_UNITS aUnits) const
 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...
 
virtual BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &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...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. 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)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static wxString SubReference (int aUnit, bool aAddSeparator=true)
 
static int GetSubpartIdSeparator ()
 
static int * SubpartIdSeparatorPtr ()
 Return a reference to m_subpartIdSeparator, only for read/save setting functions. More...
 
static int GetSubpartFirstId ()
 
static int * SubpartFirstIdPtr ()
 Return a reference to m_subpartFirstId, only for read/save setting functions. More...
 
static void SetSubpartIdNotation (int aSep, int aFirstId)
 Set the separator char between the subpart id and the reference 0 (no separator) or '. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &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

bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

EDA_ITEM_FLAGS m_status
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

void deleteAllFields ()
 
virtual void SetParent (EDA_ITEM *aParent)
 

Private Attributes

LIB_SYMBOL_SPTR m_me
 
LIB_SYMBOL_REF m_parent
 Use for inherited symbols. More...
 
LIB_ID m_libId
 
timestamp_t m_lastModDate
 
int m_unitCount
 Number of units (parts) per package. More...
 
bool m_unitsLocked
 True if symbol has multiple units and changing one unit does not automatically change another unit. More...
 
int m_pinNameOffset
 The offset in mils to draw the pin name. More...
 
bool m_showPinNames
 
bool m_showPinNumbers
 
bool m_includeInBom
 
bool m_includeOnBoard
 
LIBRENTRYOPTIONS m_options
 Special symbol features such as POWER or NORMAL.) More...
 
LIB_ITEMS_CONTAINER m_drawings
 
SYMBOL_LIBm_library
 
wxString m_name
 
wxString m_description
 
wxString m_keyWords
 Search keywords. More...
 
wxArrayString m_fpFilters
 List of suitable footprint names for the symbol (wild card names accepted). More...
 

Static Private Attributes

static int m_subpartIdSeparator = 0
 the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or U1.A or U1-A More...
 
static int m_subpartFirstId = 'A'
 the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A', 'a' or '1' can be used, other values have no sense. More...
 

Detailed Description

Define a library symbol object.

A library symbol object is typically saved and loaded in a symbol library file (.lib). Library symbols are different from schematic symbols.

Definition at line 96 of file lib_symbol.h.

Constructor & Destructor Documentation

◆ LIB_SYMBOL() [1/2]

LIB_SYMBOL::LIB_SYMBOL ( const wxString &  aName,
LIB_SYMBOL aParent = nullptr,
SYMBOL_LIB aLibrary = nullptr 
)

Definition at line 81 of file lib_symbol.cpp.

81  :
83  m_me( this, null_deleter() ),
84  m_includeInBom( true ),
85  m_includeOnBoard( true )
86 {
87  m_lastModDate = 0;
88  m_unitCount = 1;
91  m_unitsLocked = false;
92  m_showPinNumbers = true;
93  m_showPinNames = true;
94 
95  // Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
96  // when the field editors are invoked.
97  m_drawings[LIB_FIELD_T].reserve( 4 );
102 
103  SetName( aName );
104 
105  if( aParent )
106  SetParent( aParent );
107 
108  SetLib( aLibrary );
109 }
Field Reference of part, i.e. "IC21".
bool m_showPinNumbers
Definition: lib_symbol.h:692
bool m_showPinNames
Definition: lib_symbol.h:691
Field object used in symbol libraries.
Definition: lib_field.h:59
void SetLib(SYMBOL_LIB *aLibrary)
Definition: lib_symbol.h:177
name of datasheet
timestamp_t m_lastModDate
Definition: lib_symbol.h:683
Field Value of part, i.e. "3.3K".
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686
void push_back(T *aItem)
Definition: multivector.h:174
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:362
bool m_includeOnBoard
Definition: lib_symbol.h:695
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:371
#define DEFAULT_PIN_NAME_OFFSET
The intersheets references prefix string.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: eda_item.cpp:37
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
Definition: lib_symbol.cpp:73
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
bool m_includeInBom
Definition: lib_symbol.h:694
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:680
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:689
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685
Field Name Module PCB, i.e. "16DIP300".

References DATASHEET_FIELD, DEFAULT_PIN_NAME_OFFSET, ENTRY_NORMAL, FOOTPRINT_FIELD, LIB_FIELD_T, m_drawings, m_lastModDate, m_options, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), REFERENCE_FIELD, SetLib(), SetName(), SetParent(), and VALUE_FIELD.

Referenced by Duplicate(), and Flatten().

◆ LIB_SYMBOL() [2/2]

LIB_SYMBOL::LIB_SYMBOL ( const LIB_SYMBOL aSymbol,
SYMBOL_LIB aLibrary = nullptr 
)

Definition at line 112 of file lib_symbol.cpp.

112  :
113  EDA_ITEM( aSymbol ),
114  m_me( this, null_deleter() )
115 {
116  LIB_ITEM* newItem;
117 
118  m_library = aLibrary;
119  m_name = aSymbol.m_name;
120  m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
121  m_unitCount = aSymbol.m_unitCount;
122  m_unitsLocked = aSymbol.m_unitsLocked;
125  m_includeInBom = aSymbol.m_includeInBom;
127  m_showPinNames = aSymbol.m_showPinNames;
128  m_lastModDate = aSymbol.m_lastModDate;
129  m_options = aSymbol.m_options;
130  m_libId = aSymbol.m_libId;
131  m_description = aSymbol.m_description;
132  m_keyWords = aSymbol.m_keyWords;
133 
134  ClearSelected();
135 
136  for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
137  {
138  if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
139  continue;
140 
141  try
142  {
143  newItem = (LIB_ITEM*) oldItem.Clone();
144  newItem->ClearSelected();
145  newItem->SetParent( this );
146  m_drawings.push_back( newItem );
147  }
148  catch( ... )
149  {
150  wxFAIL_MSG( wxT( "Failed to clone LIB_ITEM." ) );
151  }
152  }
153 
154  LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
155 
156  if( parent )
157  SetParent( parent.get() );
158 }
bool m_showPinNumbers
Definition: lib_symbol.h:692
bool m_showPinNames
Definition: lib_symbol.h:691
#define IS_NEW
New item, just created.
void ClearSelected()
Definition: eda_item.h:131
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
wxString m_description
Definition: lib_symbol.h:702
wxString m_name
Definition: lib_symbol.h:701
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
timestamp_t m_lastModDate
Definition: lib_symbol.h:683
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686
void push_back(T *aItem)
Definition: multivector.h:174
bool m_includeOnBoard
Definition: lib_symbol.h:695
#define STRUCT_DELETED
flag indication structures to be erased
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:371
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: eda_item.cpp:37
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:154
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
Definition: lib_symbol.cpp:73
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
bool m_includeInBom
Definition: lib_symbol.h:694
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:680
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:689
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704
LIB_ID m_libId
Definition: lib_symbol.h:682
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:703
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References EDA_ITEM::ClearSelected(), EDA_ITEM::Clone(), EDA_ITEM::GetFlags(), IS_NEW, m_description, m_drawings, m_fpFilters, m_includeInBom, m_includeOnBoard, m_keyWords, m_lastModDate, m_libId, m_library, m_name, m_options, m_parent, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), EDA_ITEM::SetParent(), SetParent(), and STRUCT_DELETED.

◆ ~LIB_SYMBOL()

LIB_SYMBOL::~LIB_SYMBOL ( )
virtual

Member Function Documentation

◆ AddDrawItem()

void LIB_SYMBOL::AddDrawItem ( LIB_ITEM aItem,
bool  aSort = true 
)

◆ AddField()

void LIB_SYMBOL::AddField ( LIB_FIELD aField)

Add a field.

Takes ownership of the pointer.

Definition at line 959 of file lib_symbol.cpp.

960 {
961  AddDrawItem( aField );
962 }
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:716

References AddDrawItem().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

void LIB_SYMBOL::ClearEditFlags ( )

Definition at line 1166 of file lib_symbol.cpp.

1167 {
1168  for( LIB_ITEM& item : m_drawings )
1169  item.ClearEditFlags();
1170 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings.

Referenced by SYMBOL_EDIT_FRAME::SaveCopyInUndoList().

◆ ClearFlags()

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

Definition at line 153 of file eda_item.h.

153 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), 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(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void LIB_SYMBOL::ClearTempFlags ( )

Clears the status flag all draw objects in this symbol.

Definition at line 1159 of file lib_symbol.cpp.

1160 {
1161  for( LIB_ITEM& item : m_drawings )
1162  item.ClearTempFlags();
1163 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings.

Referenced by SYMBOL_EDITOR_PIN_TOOL::CreatePin(), and SYMBOL_EDIT_FRAME::SaveCopyInUndoList().

◆ 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 * EDA_ITEM::Clone ( ) const
virtualinherited

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 in FP_ZONE, ZONE, SCH_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_GLOBALLABEL, SCH_LABEL, PCB_ARC, SCH_TEXT, SCH_LINE, LIB_PIN, SCH_BUS_BUS_ENTRY, FP_TEXT, SCH_FIELD, PCB_TRACK, SCH_SHEET_PIN, SCH_BUS_WIRE_ENTRY, LIB_FIELD, FP_SHAPE, PCB_TEXT, SCH_BITMAP, PCB_SHAPE, PCB_GROUP, SCH_JUNCTION, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, LIB_SHAPE, NETINFO_ITEM, PCB_TARGET, SCH_PIN, PCB_MARKER, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 83 of file eda_item.cpp.

84 {
85  wxCHECK_MSG( false, nullptr, wxT( "Clone not implemented in derived class " ) + GetClass() +
86  wxT( ". Bad programmer!" ) );
87 }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), PCB_DIMENSION_BASE::GetEffectiveShape(), LIB_SYMBOL(), new_clone(), operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SetConversion(), SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ Compare()

int LIB_SYMBOL::Compare ( const LIB_SYMBOL aRhs,
int  aCompareFlags = 0 
) const

Comparison test that can be used for operators.

Parameters
aRhsis the right hand side symbol used for comparison.
Returns
-1 if this symbol is less than aRhs 1 if this symbol is greater than aRhs 0 if this symbol is the same as aRhs

Definition at line 212 of file lib_symbol.cpp.

213 {
214  if( m_me == aRhs.m_me )
215  return 0;
216 
217  int retv = 0;
218 
219  if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 )
220  {
221  retv = m_name.Cmp( aRhs.m_name );
222 
223  if( retv )
224  return retv;
225 
226  retv = m_libId.compare( aRhs.m_libId );
227 
228  if( retv )
229  return retv;
230  }
231 
232  if( m_parent.lock() < aRhs.m_parent.lock() )
233  return -1;
234 
235  if( m_parent.lock() > aRhs.m_parent.lock() )
236  return 1;
237 
238  if( m_options != aRhs.m_options )
239  return ( m_options == ENTRY_NORMAL ) ? -1 : 1;
240 
241  if( m_unitCount != aRhs.m_unitCount )
242  return m_unitCount - aRhs.m_unitCount;
243 
244  if( m_drawings.size() != aRhs.m_drawings.size() )
245  return m_drawings.size() - aRhs.m_drawings.size();
246 
249 
250  while( lhsItemIt != m_drawings.end() )
251  {
252  const LIB_ITEM* lhsItem = static_cast<const LIB_ITEM*>( &(*lhsItemIt) );
253  const LIB_ITEM* rhsItem = static_cast<const LIB_ITEM*>( &(*rhsItemIt) );
254 
255  wxCHECK( lhsItem && rhsItem, lhsItem - rhsItem );
256 
257  if( lhsItem->Type() != rhsItem->Type() )
258  return lhsItem->Type() - rhsItem->Type();
259 
260  // Non-mandatory fields are a special case. They can have different ordinal numbers
261  // and are compared separately below.
262  if( lhsItem->Type() == LIB_FIELD_T )
263  {
264  const LIB_FIELD* lhsField = static_cast<const LIB_FIELD*>( lhsItem );
265 
266  if( lhsField->GetId() == VALUE_FIELD )
267  {
268  if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 || IsPower() )
269  retv = lhsItem->compare( *rhsItem, aCompareFlags );
270  }
271  else if( lhsField->IsMandatory() )
272  {
273  retv = lhsItem->compare( *rhsItem, aCompareFlags );
274  }
275  }
276  else
277  {
278  retv = lhsItem->compare( *rhsItem, aCompareFlags );
279  }
280 
281  if( retv )
282  return retv;
283 
284  ++lhsItemIt;
285  ++rhsItemIt;
286  }
287 
288  // Compare the optional fields.
289  for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
290  {
291  const LIB_FIELD* field = dynamic_cast<const LIB_FIELD*>( &item );
292 
293  wxCHECK2( field, continue );
294 
295  // Mandatory fields were already compared above.
296  if( field->IsMandatory() )
297  continue;
298 
299  const LIB_FIELD* foundField = aRhs.FindField( field->GetName() );
300 
301  if( foundField == nullptr )
302  return 1;
303 
304  retv = item.compare( static_cast<const LIB_ITEM&>( *foundField ), aCompareFlags );
305 
306  if( retv )
307  return retv;
308  }
309 
310  if( m_fpFilters.GetCount() != aRhs.m_fpFilters.GetCount() )
311  return m_fpFilters.GetCount() - aRhs.m_fpFilters.GetCount();
312 
313  for( size_t i = 0; i < m_fpFilters.GetCount(); i++ )
314  {
315  retv = m_fpFilters[i].Cmp( aRhs.m_fpFilters[i] );
316 
317  if( retv )
318  return retv;
319  }
320 
321  retv = m_description.Cmp( aRhs.m_description );
322 
323  if( retv )
324  return retv;
325 
326  retv = m_keyWords.Cmp( aRhs.m_keyWords );
327 
328  if( retv )
329  return retv;
330 
331  if( m_pinNameOffset != aRhs.m_pinNameOffset )
332  return m_pinNameOffset - aRhs.m_pinNameOffset;
333 
334  if( m_unitsLocked != aRhs.m_unitsLocked )
335  return ( m_unitsLocked ) ? 1 : -1;
336 
337  if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 )
338  {
339  if( m_showPinNames != aRhs.m_showPinNames )
340  return ( m_showPinNames ) ? 1 : -1;
341 
342  if( m_showPinNumbers != aRhs.m_showPinNumbers )
343  return ( m_showPinNumbers ) ? 1 : -1;
344 
345  if( m_includeInBom != aRhs.m_includeInBom )
346  return ( m_includeInBom ) ? 1 : -1;
347 
348  if( m_includeOnBoard != aRhs.m_includeOnBoard )
349  return ( m_includeOnBoard ) ? 1 : -1;
350  }
351 
352  return 0;
353 }
bool m_showPinNumbers
Definition: lib_symbol.h:692
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:188
bool m_showPinNames
Definition: lib_symbol.h:691
Field object used in symbol libraries.
Definition: lib_field.h:59
wxString m_description
Definition: lib_symbol.h:702
bool IsPower() const
Definition: lib_symbol.cpp:459
int GetId() const
Definition: lib_field.h:115
wxString m_name
Definition: lib_symbol.h:701
int compare(const LIB_ID &aLibId) const
Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname...
Definition: lib_id.cpp:158
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: lib_field.cpp:393
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:194
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
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:67
Field Value of part, i.e. "3.3K".
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_field.cpp:182
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686
bool m_includeOnBoard
Definition: lib_symbol.h:695
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
bool m_includeInBom
Definition: lib_symbol.h:694
ITERATOR_BASE< const LIB_ITEM, const MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::const_iterator > CONST_ITERATOR
Definition: multivector.h:167
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:680
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:689
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704
LIB_ID m_libId
Definition: lib_symbol.h:682
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:703
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:225
bool IsMandatory() const
Definition: lib_field.cpp:495
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), LIB_FIELD::compare(), LIB_ID::compare(), LIB_ITEM::compare(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), ENTRY_NORMAL, FindField(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), LIB_FIELD::IsMandatory(), IsPower(), LIB_FIELD_T, m_description, m_drawings, m_fpFilters, m_includeInBom, m_includeOnBoard, m_keyWords, m_libId, m_me, m_name, m_options, m_parent, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::size(), EDA_ITEM::Type(), and VALUE_FIELD.

Referenced by BOOST_AUTO_TEST_CASE(), operator!=(), and operator==().

◆ deleteAllFields()

void LIB_SYMBOL::deleteAllFields ( )
private

Definition at line 953 of file lib_symbol.cpp.

954 {
956 }
void clear(int aType=UNDEFINED_TYPE)
Definition: multivector.h:212
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::clear(), LIB_FIELD_T, and m_drawings.

Referenced by SetFields().

◆ Duplicate()

virtual LIB_SYMBOL* LIB_SYMBOL::Duplicate ( ) const
inlinevirtual

Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children.

Definition at line 112 of file lib_symbol.h.

113  {
114  LIB_SYMBOL* dupe = new LIB_SYMBOL( *this, m_library );
115  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
116 
117  for( LIB_ITEM& item : dupe->m_drawings )
118  const_cast<KIID&>( item.m_Uuid ) = KIID();
119 
120  return dupe;
121  }
Define a library symbol object.
Definition: lib_symbol.h:96
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:474
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
LIB_SYMBOL(const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
Definition: lib_symbol.cpp:81
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References LIB_SYMBOL(), m_drawings, m_library, and EDA_ITEM::m_Uuid.

◆ FindField() [1/2]

LIB_FIELD * LIB_SYMBOL::FindField ( const wxString &  aFieldName)

Find a field within this symbol matching aFieldName and returns it or NULL if not found.

Definition at line 1030 of file lib_symbol.cpp.

1031 {
1032  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1033  {
1034  if( static_cast<LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
1035  return static_cast<LIB_FIELD*>( &item );
1036  }
1037 
1038  return nullptr;
1039 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References LIB_FIELD_T, and m_drawings.

Referenced by Compare(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), and FOOTPRINT_INFO_GENERATOR::SetHtmlFieldTable().

◆ FindField() [2/2]

const LIB_FIELD * LIB_SYMBOL::FindField ( const wxString &  aFieldName) const

Definition at line 1042 of file lib_symbol.cpp.

1043 {
1044  for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1045  {
1046  if( static_cast<const LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
1047  return static_cast<const LIB_FIELD*>( &item );
1048  }
1049 
1050  return nullptr;
1051 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References LIB_FIELD_T, and m_drawings.

◆ Flatten()

std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten ( ) const

Return a flattened symbol inheritance to the caller.

If the symbol does not inherit from another symbol, a copy of the symbol is returned.

Returns
a flattened symbol on the heap

Definition at line 380 of file lib_symbol.cpp.

381 {
382  std::unique_ptr< LIB_SYMBOL > retv;
383 
384  if( IsAlias() )
385  {
386  LIB_SYMBOL_SPTR parent = m_parent.lock();
387 
388  wxCHECK_MSG( parent, retv,
389  wxString::Format( wxT( "Parent of derived symbol '%s' undefined" ), m_name ) );
390 
391  // Copy the parent.
392  retv.reset( new LIB_SYMBOL( *parent.get() ) );
393 
394  retv->m_name = m_name;
395  retv->SetLibId( m_libId );
396 
397  // Now add the inherited part mandatory field (this) information.
398  for( int i = 0; i < MANDATORY_FIELDS; i++ )
399  {
400  wxString tmp = GetFieldById( i )->GetText();
401 
402  // If the field isn't defined then inherit the parent field value.
403  if( tmp.IsEmpty() )
404  retv->GetFieldById( i )->SetText( parent->GetFieldById( i )->GetText() );
405  else
406  *retv->GetFieldById( i ) = *GetFieldById( i );
407  }
408 
409  // Grab all the rest of derived symbol fields.
410  for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
411  {
412  const LIB_FIELD* aliasField = dynamic_cast<const LIB_FIELD*>( &item );
413 
414  wxCHECK2( aliasField, continue );
415 
416  // Mandatory fields were already resolved.
417  if( aliasField->IsMandatory() )
418  continue;
419 
420  LIB_FIELD* newField = new LIB_FIELD( *aliasField );
421  newField->SetParent( retv.get() );
422 
423  LIB_FIELD* parentField = retv->FindField( aliasField->GetName() );
424 
425  if( !parentField ) // Derived symbol field does not exist in parent symbol.
426  {
427  retv->AddDrawItem( newField );
428  }
429  else // Derived symbol field overrides the parent symbol field.
430  {
431  retv->RemoveDrawItem( parentField );
432  retv->AddDrawItem( newField );
433  }
434  }
435 
436  retv->SetKeyWords( m_keyWords.IsEmpty() ? parent->GetKeyWords() : m_keyWords );
437  retv->SetDescription( m_description.IsEmpty() ? parent->GetDescription() : m_description );
438  retv->SetFPFilters( m_fpFilters.IsEmpty() ? parent->GetFPFilters() : m_fpFilters );
439  retv->UpdateFieldOrdinals();
440  }
441  else
442  {
443  retv.reset( new LIB_SYMBOL( *this ) );
444  }
445 
446  return retv;
447 }
Field object used in symbol libraries.
Definition: lib_field.h:59
bool IsAlias() const
Definition: lib_symbol.h:172
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
wxString m_description
Definition: lib_symbol.h:702
wxString m_name
Definition: lib_symbol.h:701
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
wxString GetName(bool aUseDefaultName=true) const
Return the field name.
Definition: lib_field.cpp:393
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
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
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
LIB_SYMBOL(const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
Definition: lib_symbol.cpp:81
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704
LIB_ID m_libId
Definition: lib_symbol.h:682
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:703
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154
bool IsMandatory() const
Definition: lib_field.cpp:495

References Format(), GetFieldById(), LIB_FIELD::GetName(), EDA_TEXT::GetText(), IsAlias(), LIB_FIELD::IsMandatory(), LIB_FIELD_T, LIB_SYMBOL(), m_description, m_drawings, m_fpFilters, m_keyWords, m_libId, m_name, m_parent, MANDATORY_FIELDS, and EDA_ITEM::SetParent().

Referenced by SCH_SCREEN::Append(), SYMBOL_EDIT_FRAME::CopySymbolToClipboard(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDIT_FRAME::ExportSymbol(), SYMBOL_EDIT_FRAME::GetDocumentExtents(), RESCUE_CACHE_CANDIDATE::PerformAction(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction(), DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_EDIT_FRAME::SaveSymbolToSchematic(), SCH_SYMBOL::SCH_SYMBOL(), ERC_TESTER::TestLibSymbolIssues(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_CHANGE_SYMBOLS::updateFieldsList(), and SCH_SCREEN::UpdateSymbolLinks().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
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  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ GetBodyBoundingBox()

const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox ( int  aUnit,
int  aConvert,
bool  aIncludePins 
) const

Get the symbol bounding box excluding fields.

Returns
the symbol bounding box ( in user coordinates ) without fields
Parameters
aUnit= unit selection = 0, or 1..n
aConvert= 0, 1 or 2 If aUnit == 0, unit is not used if aConvert == 0 Convert is non used Fields are not taken in account

Definition at line 916 of file lib_symbol.cpp.

917 {
918  EDA_RECT bbox;
919 
920  for( const LIB_ITEM& item : m_drawings )
921  {
922  if( item.m_unit > 0 && aUnit > 0 && aUnit != item.m_unit )
923  continue;
924 
925  if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
926  continue;
927 
928  if( item.Type() == LIB_FIELD_T )
929  continue;
930 
931  if( item.Type() == LIB_PIN_T )
932  {
933  const LIB_PIN& pin = static_cast<const LIB_PIN&>( item );
934 
935  // Note: the roots of the pins are always included for symbols that don't have a
936  // well-defined body.
937 
938  if( aIncludePins && pin.IsVisible() )
939  bbox.Merge( pin.GetBoundingBox( false, true ) );
940  else
941  bbox.Merge( pin.GetPinRoot() );
942  }
943  else
944  {
945  bbox.Merge( item.GetBoundingBox() );
946  }
947  }
948 
949  return bbox;
950 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
Handle the component boundary box.
Definition: eda_rect.h:42

References LIB_FIELD_T, LIB_PIN_T, m_drawings, EDA_RECT::Merge(), and pin.

Referenced by SCH_SYMBOL::doGetBoundingBox().

◆ GetBoundingBox()

const EDA_RECT LIB_SYMBOL::GetBoundingBox ( ) const
inlineoverridevirtual

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 220 of file lib_symbol.h.

221  {
222  return GetUnitBoundingBox( 0, 0 );
223  }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:868

References GetUnitBoundingBox().

◆ GetClass()

virtual wxString LIB_SYMBOL::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 127 of file lib_symbol.h.

128  {
129  return wxT( "LIB_SYMBOL" );
130  }

◆ GetDatasheetField()

LIB_FIELD & LIB_SYMBOL::GetDatasheetField ( )

Return reference to the datasheet field.

Definition at line 1078 of file lib_symbol.cpp.

1079 {
1081  wxASSERT( field != nullptr );
1082  return *field;
1083 }
Field object used in symbol libraries.
Definition: lib_field.h:59
name of datasheet
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.

References DATASHEET_FIELD, and GetFieldById().

Referenced by FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), SYMBOL_VIEWER_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), EE_INSPECTION_TOOL::ShowDatasheet(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

◆ GetDescription()

wxString LIB_SYMBOL::GetDescription ( )
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 142 of file lib_symbol.h.

143  {
144  if( m_description.IsEmpty() && IsAlias() )
145  {
146  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
147  return parent->GetDescription();
148  }
149 
150  return m_description;
151  }
bool IsAlias() const
Definition: lib_symbol.h:172
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
wxString m_description
Definition: lib_symbol.h:702
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681

References IsAlias(), m_description, and m_parent.

Referenced by GetSearchText(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), FOOTPRINT_INFO_GENERATOR::SetHtmlDesc(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

◆ GetDrawItems() [1/2]

◆ GetDrawItems() [2/2]

const LIB_ITEMS_CONTAINER& LIB_SYMBOL::GetDrawItems ( ) const
inline

Definition at line 485 of file lib_symbol.h.

485 { return m_drawings; }
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings.

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 157 of file eda_item.h.

158  {
159  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
161 
162  return m_flags & mask;
163  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

Referenced by 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_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetFieldById()

LIB_FIELD * LIB_SYMBOL::GetFieldById ( int  aId) const

Return pointer to the requested field.

Parameters
aId- Id of field to return.
Returns
The field if found, otherwise NULL.

Definition at line 1016 of file lib_symbol.cpp.

1017 {
1018  for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1019  {
1020  LIB_FIELD* field = ( LIB_FIELD* ) &item;
1021 
1022  if( field->GetId() == aId )
1023  return field;
1024  }
1025 
1026  return nullptr;
1027 }
Field object used in symbol libraries.
Definition: lib_field.h:59
int GetId() const
Definition: lib_field.h:115
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References LIB_FIELD::GetId(), LIB_FIELD_T, and m_drawings.

Referenced by SYMBOL_EDIT_FRAME::CreateNewSymbol(), Flatten(), GetDatasheetField(), GetFields(), GetFootprintField(), GetNextAvailableFieldId(), GetReferenceField(), GetValueField(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), DIALOG_CHANGE_SYMBOLS::processSymbol(), and DIALOG_CHOOSE_SYMBOL::ShowFootprintFor().

◆ GetFieldCount()

size_t LIB_SYMBOL::GetFieldCount ( ) const
inline

Definition at line 372 of file lib_symbol.h.

372 { return m_drawings.size( LIB_FIELD_T ); }
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:225

References LIB_FIELD_T, m_drawings, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::size().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ GetFields() [1/2]

void LIB_SYMBOL::GetFields ( std::vector< LIB_FIELD * > &  aList)

Return a list of fields within this symbol.

Parameters
aList- List to add fields to

Definition at line 982 of file lib_symbol.cpp.

983 {
984  // Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
985  for( int id = 0; id < MANDATORY_FIELDS; ++id )
986  aList.push_back( GetFieldById( id ) );
987 
988  // Now grab all the rest of fields.
989  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
990  {
991  LIB_FIELD* field = static_cast<LIB_FIELD*>( &item );
992 
993  if( !field->IsMandatory() )
994  aList.push_back( field );
995  }
996 }
Field object used in symbol libraries.
Definition: lib_field.h:59
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
bool IsMandatory() const
Definition: lib_field.cpp:495

References GetFieldById(), LIB_FIELD::IsMandatory(), LIB_FIELD_T, m_drawings, and MANDATORY_FIELDS.

Referenced by DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), FOOTPRINT_INFO_GENERATOR::SetHtmlFieldTable(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList().

◆ GetFields() [2/2]

void LIB_SYMBOL::GetFields ( std::vector< LIB_FIELD > &  aList)

Definition at line 999 of file lib_symbol.cpp.

1000 {
1001  // Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
1002  for( int id = 0; id < MANDATORY_FIELDS; ++id )
1003  aList.push_back( *GetFieldById( id ) );
1004 
1005  // Now grab all the rest of fields.
1006  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1007  {
1008  LIB_FIELD* field = static_cast<LIB_FIELD*>( &item );
1009 
1010  if( !field->IsMandatory() )
1011  aList.push_back( *field );
1012  }
1013 }
Field object used in symbol libraries.
Definition: lib_field.h:59
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
bool IsMandatory() const
Definition: lib_field.cpp:495

References GetFieldById(), LIB_FIELD::IsMandatory(), LIB_FIELD_T, m_drawings, and MANDATORY_FIELDS.

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_TRACK, and PCB_SHAPE.

Definition at line 258 of file eda_item.h.

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

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFootprintField()

LIB_FIELD & LIB_SYMBOL::GetFootprintField ( )

Return reference to the footprint field.

Definition at line 1070 of file lib_symbol.cpp.

1071 {
1073  wxASSERT( field != nullptr );
1074  return *field;
1075 }
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
Field Name Module PCB, i.e. "16DIP300".

References FOOTPRINT_FIELD, and GetFieldById().

Referenced by GetSearchText(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ GetFPFilters()

wxArrayString LIB_SYMBOL::GetFPFilters ( ) const
inline

Definition at line 183 of file lib_symbol.h.

184  {
185  if( m_fpFilters.IsEmpty() && IsAlias() )
186  {
187  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
188  return parent->GetFPFilters();
189  }
190 
191  return m_fpFilters;
192  }
bool IsAlias() const
Definition: lib_symbol.h:172
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704

References IsAlias(), m_fpFilters, and m_parent.

Referenced by DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow().

◆ GetIncludeInBom()

bool LIB_SYMBOL::GetIncludeInBom ( ) const
inline

◆ GetIncludeOnBoard()

bool LIB_SYMBOL::GetIncludeOnBoard ( ) const
inline

◆ GetKeyWords()

wxString LIB_SYMBOL::GetKeyWords ( ) const
inline

Definition at line 155 of file lib_symbol.h.

156  {
157  if( m_keyWords.IsEmpty() && IsAlias() )
158  {
159  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
160  return parent->GetKeyWords();
161  }
162 
163  return m_keyWords;
164  }
bool IsAlias() const
Definition: lib_symbol.h:172
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:703

References IsAlias(), m_keyWords, and m_parent.

Referenced by GetSearchText(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), FOOTPRINT_INFO_GENERATOR::SetHtmlKeywords(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

◆ GetLastModDate()

timestamp_t LIB_SYMBOL::GetLastModDate ( ) const
inline

Definition at line 179 of file lib_symbol.h.

179 { return m_lastModDate; }
timestamp_t m_lastModDate
Definition: lib_symbol.h:683

References m_lastModDate.

Referenced by SCH_LEGACY_PLUGIN_CACHE::SaveSymbol().

◆ GetLib()

SYMBOL_LIB* LIB_SYMBOL::GetLib ( ) const
inline

Definition at line 176 of file lib_symbol.h.

176 { return m_library; }
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References m_library.

Referenced by SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer(), and SYMBOL_LIB::FindSymbol().

◆ GetLibId()

◆ GetLibNickname()

wxString LIB_SYMBOL::GetLibNickname ( ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 138 of file lib_symbol.h.

138 { return GetLibraryName(); }
const wxString GetLibraryName() const
Definition: lib_symbol.cpp:450

References GetLibraryName().

Referenced by SYMBOL_EDIT_FRAME::IsSymbolFromLegacyLibrary().

◆ GetLibraryName()

const wxString LIB_SYMBOL::GetLibraryName ( ) const

Definition at line 450 of file lib_symbol.cpp.

451 {
452  if( m_library )
453  return m_library->GetName();
454 
455  return m_libId.GetLibNickname();
456 }
const wxString GetName() const
Return the file name without path or extension.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
LIB_ID m_libId
Definition: lib_symbol.h:682
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References LIB_ID::GetLibNickname(), SYMBOL_LIB::GetName(), m_libId, and m_library.

Referenced by GetLibNickname().

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

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 in ZONE, SCH_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, SCH_GLOBALLABEL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_LABEL, GERBER_DRAW_ITEM, SCH_TEXT, SCH_BUS_BUS_ENTRY, SCH_LINE, LIB_PIN, FP_TEXT, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, PCB_GROUP, SCH_BUS_WIRE_ENTRY, LIB_FIELD, FP_SHAPE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, SCH_JUNCTION, SCH_NO_CONNECT, SCH_MARKER, PCB_MARKER, and PCB_TARGET.

Definition at line 274 of file eda_item.cpp.

275 {
276  return BITMAPS::dummy_item;
277 }

References dummy_item.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), and PCB_SELECTION_TOOL::doSelectionMenu().

◆ GetMsgPanelInfo()

◆ GetName()

wxString LIB_SYMBOL::GetName ( void  ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 133 of file lib_symbol.h.

133 { return m_name; }
wxString m_name
Definition: lib_symbol.h:701

References m_name.

Referenced by SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), SYMBOL_EDIT_FRAME::DuplicateSymbol(), SYMBOL_EDIT_FRAME::ensureUniqueName(), SYMBOL_EDIT_FRAME::ExportSymbol(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), SYMBOL_LIB::GetSymbols(), SYMBOL_EDIT_FRAME::ImportSymbol(), SCH_LEGACY_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), operator<(), SCH_SEXPR_PARSER::ParseLib(), SYMBOL_LIB::RemoveSymbol(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SYMBOL_LIB::ReplaceSymbol(), SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SYMBOL_EDIT_FRAME::SetCurSymbol(), FOOTPRINT_INFO_GENERATOR::SetHtmlName(), SYMBOL_EDIT_FRAME::SyncLibraries(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), SYMBOL_LIBRARY_MANAGER::UpdateSymbol(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

◆ GetNextAvailableFieldId()

int LIB_SYMBOL::GetNextAvailableFieldId ( ) const

Definition at line 1114 of file lib_symbol.cpp.

1115 {
1116  int retv = MANDATORY_FIELDS;
1117 
1118  while( GetFieldById( retv ) )
1119  retv += 1;
1120 
1121  return retv;
1122 }
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.

References GetFieldById(), and MANDATORY_FIELDS.

Referenced by SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().

◆ GetNextDrawItem()

LIB_ITEM * LIB_SYMBOL::GetNextDrawItem ( const LIB_ITEM aItem = nullptr,
KICAD_T  aType = TYPE_NOT_INIT 
)

Return the next draw object pointer.

Parameters
aItem- Pointer to the current draw item. Setting item NULL with return the first item of type in the list.
aType- type of searched item (filter). if TYPE_NOT_INIT search for all items types
Returns
- The next drawing object in the list if found, otherwise NULL.

Definition at line 727 of file lib_symbol.cpp.

728 {
729  if( aItem == nullptr )
730  {
732 
733  return (it1 != m_drawings.end( aType ) ) ? &( *( m_drawings.begin( aType ) ) ) : nullptr;
734  }
735 
736  // Search for the last item, assume aItem is of type aType
737  wxASSERT( ( aType == TYPE_NOT_INIT ) || ( aType == aItem->Type() ) );
739 
740  while( ( it != m_drawings.end( aType ) ) && ( aItem != &( *it ) ) )
741  ++it;
742 
743  // Search the next item
744  if( it != m_drawings.end( aType ) )
745  {
746  ++it;
747 
748  if( it != m_drawings.end( aType ) )
749  return &( *it );
750  }
751 
752  return nullptr;
753 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:188
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:194
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The const iterator.
Definition: multivector.h:164
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), m_drawings, EDA_ITEM::Type(), and TYPE_NOT_INIT.

Referenced by BOOST_AUTO_TEST_CASE(), and GetNextPin().

◆ GetNextPin()

LIB_PIN* LIB_SYMBOL::GetNextPin ( LIB_PIN aItem = nullptr)
inline

Return the next pin object from the draw list.

This is just a pin object specific version of GetNextDrawItem().

Parameters
aItem- Pointer to the previous pin item, or NULL to get the first pin in the draw object list.
Returns
- The next pin object in the list if found, otherwise NULL.

Definition at line 383 of file lib_symbol.h.

384  {
385  return (LIB_PIN*) GetNextDrawItem( (LIB_ITEM*) aItem, LIB_PIN_T );
386  }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEM * GetNextDrawItem(const LIB_ITEM *aItem=nullptr, KICAD_T aType=TYPE_NOT_INIT)
Return the next draw object pointer.
Definition: lib_symbol.cpp:727

References GetNextDrawItem(), and LIB_PIN_T.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), SYMBOL_EDITOR_PIN_TOOL::PushPinProperties(), DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow(), and DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow().

◆ GetParent() [1/2]

◆ GetParent() [2/2]

const LIB_SYMBOL_REF& LIB_SYMBOL::GetParent ( void  ) const
inline

Definition at line 125 of file lib_symbol.h.

125 { return m_parent; }
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681

References m_parent.

◆ GetPin()

LIB_PIN * LIB_SYMBOL::GetPin ( const wxString &  aNumber,
int  aUnit = 0,
int  aConvert = 0 
) const

Return pin object with the requested pin aNumber.

Parameters
aNumber- Number of the pin to find.
aUnit- Unit of the symbol to find. Set to 0 if a specific unit number is not required.
aConvert- Alternate body style filter (DeMorgan). Set to 0 if no alternate body style is required.
Returns
The pin object if found. Otherwise NULL.

Definition at line 783 of file lib_symbol.cpp.

784 {
785  LIB_PINS pinList;
786 
787  GetPins( pinList, aUnit, aConvert );
788 
789  for( size_t i = 0; i < pinList.size(); i++ )
790  {
791  wxASSERT( pinList[i]->Type() == LIB_PIN_T );
792 
793  if( aNumber == pinList[i]->GetNumber() )
794  return pinList[i];
795  }
796 
797  return nullptr;
798 }
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:756
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:55
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References GetPins(), LIB_PIN_T, and EDA_ITEM::Type().

◆ GetPinCount()

size_t LIB_SYMBOL::GetPinCount ( ) const
inline

Definition at line 370 of file lib_symbol.h.

370 { return m_drawings.size( LIB_PIN_T ); }
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:225

References LIB_PIN_T, m_drawings, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::size().

◆ GetPinNameOffset()

◆ GetPins()

void LIB_SYMBOL::GetPins ( LIB_PINS aList,
int  aUnit = 0,
int  aConvert = 0 
) const

Return a list of pin object pointers from the draw item list.

Note pin objects are owned by the draw list of the symbol. Deleting any of the objects will leave list in a unstable state and will likely segfault when the list is destroyed.

Parameters
aList- Pin list to place pin object pointers into.
aUnit- Unit number of pin to add to list. Set to 0 to get pins from any symbol unit.
aConvert- Convert number of pin to add to list. Set to 0 to get pins from any convert of symbol.

Definition at line 756 of file lib_symbol.cpp.

757 {
758  /* Notes:
759  * when aUnit == 0: no unit filtering
760  * when aConvert == 0: no convert (shape selection) filtering
761  * when m_unit == 0, the body item is common to units
762  * when m_convert == 0, the body item is common to shapes
763  */
764 
765  LIB_SYMBOL_SPTR parent = m_parent.lock();
766  const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
767 
768  for( const LIB_ITEM& item : drawItems[LIB_PIN_T] )
769  {
770  // Unit filtering:
771  if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
772  continue;
773 
774  // Shape filtering:
775  if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
776  continue;
777 
778  aList.push_back( (LIB_PIN*) &item );
779  }
780 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
void push_back(T *aItem)
Definition: multivector.h:174
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References LIB_PIN_T, m_drawings, m_parent, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back().

Referenced by EE_INSPECTION_TOOL::CheckSymbol(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), GetPin(), PinsConflictWith(), and DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector().

◆ GetPosition()

virtual wxPoint EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

Reimplemented in SCH_SYMBOL, PCB_VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DELETED_BOARD_ITEM, DS_DRAW_ITEM_TEXT, PCB_ARC, BOARD, DS_DRAW_ITEM_PAGE, SCH_TEXT, SCH_LINE, DS_DRAW_ITEM_RECT, LIB_PIN, SCH_FIELD, FOOTPRINT, PAD, DS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, GERBER_DRAW_ITEM, DS_DRAW_ITEM_LINE, SCH_BITMAP, PCB_DIMENSION_BASE, SCH_BUS_ENTRY_BASE, PCB_GROUP, ZONE, SCH_JUNCTION, SCH_NO_CONNECT, KIGFX::ORIGIN_VIEWITEM, SCH_MARKER, PCB_TRACK, LIB_TEXT, NETINFO_ITEM, FP_TEXT, LIB_SHAPE, SCH_PIN, PCB_SHAPE, PCB_TEXT, PCB_MARKER, and PCB_TARGET.

Definition at line 251 of file eda_item.h.

251 { return wxPoint(); }

Referenced by SCH_MOVE_TOOL::AlignElements(), BOOST_AUTO_TEST_CASE(), TEST_EE_ITEM_FIXTURE::CompareItems(), TEST_BOARD_ITEM_FIXTURE::CompareItems(), EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_EDIT_FRAME::DeleteJunction(), KIGFX::PCB_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), PCB_SELECTION_TOOL::FindItem(), GERBVIEW_SELECTION::GetCenter(), EDA_ITEM::GetFocusPosition(), getMinDist(), SCH_FIELD::GetParentPosition(), SCH_SCREEN::GetSheets(), PCB_SELECTION::GetTopLeftItem(), EE_SELECTION::GetTopLeftItem(), BOARD_ITEM::GetX(), BOARD_ITEM::GetY(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::nextMatch(), BOARD::cmp_items::operator()(), SCH_ITEM::operator<(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), POSITION_RELATIVE_TOOL::PositionRelative(), BACK_ANNOTATE::processNetNameChange(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), PCB_SELECTION_TOOL::selectConnectedTracks(), RC_ITEM::ShowReport(), DRC_TEST_PROVIDER_MISC::testTextVars(), TransformItem(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), PL_EDIT_TOOL::updateModificationPoint(), and EE_POINT_EDITOR::updatePoints().

◆ GetReferenceField()

LIB_FIELD & LIB_SYMBOL::GetReferenceField ( )

Return reference to the reference designator field.

Definition at line 1062 of file lib_symbol.cpp.

1063 {
1065  wxASSERT( field != nullptr );
1066  return *field;
1067 }
Field Reference of part, i.e. "IC21".
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.

References GetFieldById(), and REFERENCE_FIELD.

Referenced by SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), and SCH_LEGACY_PLUGIN_CACHE::SaveSymbol().

◆ GetSearchText()

wxString LIB_SYMBOL::GetSearchText ( )
overridevirtual

Reimplemented from LIB_TREE_ITEM.

Definition at line 48 of file lib_symbol.cpp.

49 {
50  // Matches are scored by offset from front of string, so inclusion of this spacer
51  // discounts matches found after it.
52  static const wxString discount( wxT( " " ) );
53 
54  wxString text = GetKeyWords() + discount + GetDescription();
55  wxString footprint = GetFootprintField().GetText();
56 
57  if( !footprint.IsEmpty() )
58  {
59  text += discount + footprint;
60  }
61 
62  return text;
63 }
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
wxString GetKeyWords() const
Definition: lib_symbol.h:155
wxString GetDescription() override
Definition: lib_symbol.h:142
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:154

References GetDescription(), GetFootprintField(), GetKeyWords(), EDA_TEXT::GetText(), and text.

◆ GetSelectMenuText()

wxString EDA_ITEM::GetSelectMenuText ( EDA_UNITS  aUnits) const
virtualinherited

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 in ZONE, SCH_SYMBOL, PAD, FOOTPRINT, BOARD, SCH_HIERLABEL, SCH_GLOBALLABEL, PCB_VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DELETED_BOARD_ITEM, DS_DRAW_ITEM_TEXT, SCH_LABEL, DS_DRAW_ITEM_PAGE, GERBER_DRAW_ITEM, PCB_DIMENSION_BASE, SCH_TEXT, DS_DRAW_ITEM_RECT, LIB_PIN, SCH_BUS_BUS_ENTRY, SCH_LINE, FP_TEXT, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, PCB_GROUP, DS_DRAW_ITEM_POLYPOLYGONS, SCH_BUS_WIRE_ENTRY, LIB_FIELD, FP_SHAPE, DS_DRAW_ITEM_LINE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, PCB_MARKER, SCH_JUNCTION, SCH_NO_CONNECT, SCH_MARKER, PCB_TARGET, SCH_PIN, and DELETED_SHEET_ITEM.

Definition at line 109 of file eda_item.cpp.

110 {
111  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
112  GetClass() );
113 
114  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
115 }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::collectAllDriverValues(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), DIALOG_GROUP_PROPERTIES::DoAddMember(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), DRC_ENGINE::EvalRules(), BOARD_INSPECTION_TOOL::getItemDescription(), PCB_MARKER::GetMsgPanelInfo(), RC_TREE_MODEL::GetValue(), RC_ITEM::ShowReport(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 136 of file eda_item.h.

137  {
138  return m_status & type;
139  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 149 of file eda_item.h.

149 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

◆ GetSubpartFirstId()

static int LIB_SYMBOL::GetSubpartFirstId ( )
inlinestatic

Definition at line 531 of file lib_symbol.h.

531 { return m_subpartFirstId; }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
Definition: lib_symbol.h:710

References m_subpartFirstId.

Referenced by SCH_EDIT_FRAME::LoadProjectSettings(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), and PANEL_SETUP_FORMATTING::TransferDataToWindow().

◆ GetSubpartIdSeparator()

static int LIB_SYMBOL::GetSubpartIdSeparator ( )
inlinestatic

Definition at line 525 of file lib_symbol.h.

525 { return m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
Definition: lib_symbol.h:707

References m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::LoadProjectSettings(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), and PANEL_SETUP_FORMATTING::TransferDataToWindow().

◆ GetUniqueUnits()

std::vector< struct LIB_SYMBOL_UNIT > LIB_SYMBOL::GetUniqueUnits ( )

Return a list of unit numbers that are unique to this symbol.

If the symbol is inherited (alias), the unique units of the parent symbol are returned. When comparing pins, the pin number is ignored.

Returns
a list of unique unit numbers and their associated draw items.

Definition at line 1408 of file lib_symbol.cpp.

1409 {
1410  int unitNum;
1411  size_t i;
1412  struct LIB_SYMBOL_UNIT unit;
1413  std::vector<LIB_ITEM*> compareDrawItems;
1414  std::vector<LIB_ITEM*> currentDrawItems;
1415  std::vector<struct LIB_SYMBOL_UNIT> uniqueUnits;
1416 
1417  // The first unit is guaranteed to be unique so always include it.
1418  unit.m_unit = 1;
1419  unit.m_convert = 1;
1420  unit.m_items = GetUnitDrawItems( 1, 1 );
1421 
1422  // There are no unique units if there are no draw items other than fields.
1423  if( unit.m_items.size() == 0 )
1424  return uniqueUnits;
1425 
1426  uniqueUnits.emplace_back( unit );
1427 
1428  if( ( GetUnitCount() == 1 || UnitsLocked() ) && !HasConversion() )
1429  return uniqueUnits;
1430 
1431  currentDrawItems = unit.m_items;
1432 
1433  for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1434  {
1435  compareDrawItems = GetUnitDrawItems( unitNum, 1 );
1436 
1437  wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1438  wxT( "Multiple unit symbol defined with empty units." ) );
1439 
1440  if( currentDrawItems.size() != compareDrawItems.size() )
1441  {
1442  unit.m_unit = unitNum;
1443  unit.m_convert = 1;
1444  unit.m_items = compareDrawItems;
1445  uniqueUnits.emplace_back( unit );
1446  }
1447  else
1448  {
1449  for( i = 0; i < currentDrawItems.size(); i++ )
1450  {
1451  if( currentDrawItems[i]->compare( *compareDrawItems[i],
1452  LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
1453  {
1454  unit.m_unit = unitNum;
1455  unit.m_convert = 1;
1456  unit.m_items = compareDrawItems;
1457  uniqueUnits.emplace_back( unit );
1458  }
1459  }
1460  }
1461  }
1462 
1463  if( HasConversion() )
1464  {
1465  currentDrawItems = GetUnitDrawItems( 1, 2 );
1466 
1467  if( ( GetUnitCount() == 1 || UnitsLocked() ) )
1468  {
1469  unit.m_unit = 1;
1470  unit.m_convert = 2;
1471  unit.m_items = currentDrawItems;
1472  uniqueUnits.emplace_back( unit );
1473 
1474  return uniqueUnits;
1475  }
1476 
1477  for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1478  {
1479  compareDrawItems = GetUnitDrawItems( unitNum, 2 );
1480 
1481  wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1482  wxT( "Multiple unit symbol defined with empty units." ) );
1483 
1484  if( currentDrawItems.size() != compareDrawItems.size() )
1485  {
1486  unit.m_unit = unitNum;
1487  unit.m_convert = 2;
1488  unit.m_items = compareDrawItems;
1489  uniqueUnits.emplace_back( unit );
1490  }
1491  else
1492  {
1493  for( i = 0; i < currentDrawItems.size(); i++ )
1494  {
1495  if( currentDrawItems[i]->compare( *compareDrawItems[i],
1496  LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
1497  {
1498  unit.m_unit = unitNum;
1499  unit.m_convert = 2;
1500  unit.m_items = compareDrawItems;
1501  uniqueUnits.emplace_back( unit );
1502  }
1503  }
1504  }
1505  }
1506  }
1507 
1508  return uniqueUnits;
1509 }
int m_unit
The unit number.
Definition: lib_symbol.h:84
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of LIB_ITEM objects separated by unit and convert number.
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
int GetUnitCount() const override
For items with units, return the number of units.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:241

References GetUnitCount(), GetUnitDrawItems(), HasConversion(), LIB_SYMBOL_UNIT::m_convert, LIB_SYMBOL_UNIT::m_items, LIB_SYMBOL_UNIT::m_unit, and UnitsLocked().

◆ GetUnitBoundingBox()

const EDA_RECT LIB_SYMBOL::GetUnitBoundingBox ( int  aUnit,
int  aConvert 
) const

Get the bounding box for the symbol.

Returns
the symbol bounding box ( in user coordinates )
Parameters
aUnit= unit selection = 0, or 1..n
aConvert= 0, 1 or 2 If aUnit == 0, unit is not used if aConvert == 0 Convert is non used Invisible fields are not taken in account

Definition at line 868 of file lib_symbol.cpp.

869 {
870  EDA_RECT bBox;
871  bool initialized = false;
872 
873  for( const LIB_ITEM& item : m_drawings )
874  {
875  if( item.m_unit > 0
876  && m_unitCount > 1
877  && aUnit > 0
878  && aUnit != item.m_unit )
879  {
880  continue;
881  }
882 
883  if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
884  continue;
885 
886  if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
887  continue;
888 
889  if( initialized )
890  {
891  bBox.Merge( item.GetBoundingBox() );
892  }
893  else
894  {
895  bBox = item.GetBoundingBox();
896  initialized = true;
897  }
898  }
899 
900  return bBox;
901 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
Field object used in symbol libraries.
Definition: lib_field.h:59
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
Handle the component boundary box.
Definition: eda_rect.h:42
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685

References LIB_FIELD_T, m_drawings, m_unitCount, and EDA_RECT::Merge().

Referenced by SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), and GetBoundingBox().

◆ GetUnitCount()

◆ GetUnitDrawItems() [1/2]

std::vector< struct LIB_SYMBOL_UNIT > LIB_SYMBOL::GetUnitDrawItems ( )

Return a list of LIB_ITEM objects separated by unit and convert number.

Note
This does not include LIB_FIELD objects since they are not associated with unit and/or convert numbers.

Definition at line 1372 of file lib_symbol.cpp.

1373 {
1374  std::vector<struct LIB_SYMBOL_UNIT> units;
1375 
1376  for( LIB_ITEM& item : m_drawings )
1377  {
1378  if( item.Type() == LIB_FIELD_T )
1379  continue;
1380 
1381  int unit = item.GetUnit();
1382  int convert = item.GetConvert();
1383 
1384  auto it = std::find_if( units.begin(), units.end(),
1385  [unit, convert]( const LIB_SYMBOL_UNIT& a )
1386  {
1387  return a.m_unit == unit && a.m_convert == convert;
1388  } );
1389 
1390  if( it == units.end() )
1391  {
1392  struct LIB_SYMBOL_UNIT newUnit;
1393  newUnit.m_unit = item.GetUnit();
1394  newUnit.m_convert = item.GetConvert();
1395  newUnit.m_items.push_back( &item );
1396  units.emplace_back( newUnit );
1397  }
1398  else
1399  {
1400  it->m_items.push_back( &item );
1401  }
1402  }
1403 
1404  return units;
1405 }
int m_unit
The unit number.
Definition: lib_symbol.h:84
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References convert, LIB_FIELD_T, LIB_SYMBOL_UNIT::m_convert, m_drawings, LIB_SYMBOL_UNIT::m_items, and LIB_SYMBOL_UNIT::m_unit.

Referenced by GetUniqueUnits(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), and SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().

◆ GetUnitDrawItems() [2/2]

std::vector< LIB_ITEM * > LIB_SYMBOL::GetUnitDrawItems ( int  aUnit,
int  aConvert 
)

Return a list of item pointers for aUnit and aConvert for this symbol.

Note
LIB_FIELD objects are not included.
Parameters
aUnitis the unit number of the item, -1 includes all units.
aConvertis the alternate body styple of the item, -1 includes all body styles.
Returns
a list of unit items.

Definition at line 1351 of file lib_symbol.cpp.

1352 {
1353  std::vector<LIB_ITEM*> unitItems;
1354 
1355  for( LIB_ITEM& item : m_drawings )
1356  {
1357  if( item.Type() == LIB_FIELD_T )
1358  continue;
1359 
1360  if( ( aConvert == -1 && item.GetUnit() == aUnit )
1361  || ( aUnit == -1 && item.GetConvert() == aConvert )
1362  || ( aUnit == item.GetUnit() && aConvert == item.GetConvert() ) )
1363  {
1364  unitItems.push_back( &item );
1365  }
1366  }
1367 
1368  return unitItems;
1369 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References LIB_FIELD_T, and m_drawings.

◆ GetUnitReference()

wxString LIB_SYMBOL::GetUnitReference ( int  aUnit)
overridevirtual

Return an identifier for aUnit for symbols with units.

Reimplemented from LIB_TREE_ITEM.

Definition at line 356 of file lib_symbol.cpp.

357 {
358  return LIB_SYMBOL::SubReference( aUnit, false );
359 }
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:495

References SubReference().

◆ GetValueField()

LIB_FIELD & LIB_SYMBOL::GetValueField ( )

Return reference to the value field.

Definition at line 1054 of file lib_symbol.cpp.

1055 {
1056  LIB_FIELD* field = GetFieldById( VALUE_FIELD );
1057  wxASSERT( field != nullptr );
1058  return *field;
1059 }
Field object used in symbol libraries.
Definition: lib_field.h:59
Field Value of part, i.e. "3.3K".
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.

References GetFieldById(), and VALUE_FIELD.

Referenced by PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and SetName().

◆ HasConversion()

bool LIB_SYMBOL::HasConversion ( ) const

Test if symbol has more than one body conversion type (DeMorgan).

Returns
True if symbol has more than one conversion.

Definition at line 1138 of file lib_symbol.cpp.

1139 {
1140  for( const LIB_ITEM& item : m_drawings )
1141  {
1142  if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
1143  return true;
1144  }
1145 
1146  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
1147  {
1148  for( const LIB_ITEM& item : parent->GetDrawItems() )
1149  {
1150  if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
1151  return true;
1152  }
1153  }
1154 
1155  return false;
1156 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings, and m_parent.

Referenced by EE_INSPECTION_TOOL::CheckSymbol(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), GetUniqueUnits(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SetConversion(), SYMBOL_VIEWER_FRAME::setupUIConditions(), DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and DIALOG_LIB_SYMBOL_PROPERTIES::Validate().

◆ HasFlag()

◆ HitTest() [1/2]

virtual bool EDA_ITEM::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
inlinevirtualinherited

◆ HitTest() [2/2]

virtual bool EDA_ITEM::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Test if aRect intersects this item.

Parameters
aRectA reference to a EDA_RECT 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 in SCH_SYMBOL, PAD, ZONE, FOOTPRINT, PCB_VIA, SCH_GLOBALLABEL, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, PCB_ARC, SCH_TEXT, SCH_LINE, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, GERBER_DRAW_ITEM, SCH_FIELD, FP_TEXT, LIB_ITEM, PCB_TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_PIN, PCB_GROUP, SCH_BITMAP, SCH_JUNCTION, SCH_BUS_ENTRY_BASE, PCB_TEXT, PCB_SHAPE, SCH_NO_CONNECT, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_TEXT, and LIB_SHAPE.

Definition at line 237 of file eda_item.h.

238  {
239  return false; // derived classes should override this function
240  }

◆ IsAlias()

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 120 of file eda_item.h.

120 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

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 123 of file eda_item.h.

123 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#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 205 of file eda_item.h.

205 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:479

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

117 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsMulti()

bool LIB_SYMBOL::IsMulti ( ) const
inline
Returns
true if the symbol has multiple units per symbol. When true, the reference has a sub reference to identify symbol.

Definition at line 512 of file lib_symbol.h.

512 { return m_unitCount > 1; }
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685

References m_unitCount.

Referenced by SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SYMBOL_EDIT_FRAME::setupUIConditions(), and SYMBOL_EDIT_FRAME::SynchronizePins().

◆ IsNew()

◆ IsNormal()

bool LIB_SYMBOL::IsNormal ( ) const

Definition at line 477 of file lib_symbol.cpp.

478 {
479  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
480  return parent->m_options == ENTRY_NORMAL;
481 
482  return m_options == ENTRY_NORMAL;
483 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696

References ENTRY_NORMAL, m_options, and m_parent.

◆ IsPower()

bool LIB_SYMBOL::IsPower ( ) const

Definition at line 459 of file lib_symbol.cpp.

460 {
461  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
462  return parent->m_options == ENTRY_POWER;
463 
464  return m_options == ENTRY_POWER;
465 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696

References ENTRY_POWER, m_options, and m_parent.

Referenced by SCH_SHEET_LIST::AnnotatePowerSymbols(), EE_INSPECTION_TOOL::CheckSymbol(), Compare(), LIB_PIN::IsPowerConnection(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow(), and SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo().

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

Definition at line 402 of file eda_item.h.

402 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRoot()

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define 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_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(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const 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 PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 182 of file eda_item.h.

183  {
184  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
185  return true;
186 
187  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
188  {
189  if( m_structType == *p )
190  return true;
191  }
192 
193  return false;
194  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:487

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 294 of file eda_item.h.

298  {
299  for( auto it : aList )
300  {
301  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
303  return SEARCH_RESULT::QUIT;
304  }
305 
307  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 313 of file eda_item.h.

315  {
316  for( auto it : aList )
317  {
318  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
320  return SEARCH_RESULT::QUIT;
321  }
322 
324  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ LocateDrawItem() [1/2]

LIB_ITEM * LIB_SYMBOL::LocateDrawItem ( int  aUnit,
int  aConvert,
KICAD_T  aType,
const wxPoint &  aPoint 
)

Locate a draw object.

Parameters
aUnit- Unit number of draw item.
aConvert- Body style of draw item.
aType- Draw object type, set to 0 to search for any type.
aPoint- Coordinate for hit testing.
Returns
The draw object if found. Otherwise NULL.

Definition at line 1173 of file lib_symbol.cpp.

1175 {
1176  for( LIB_ITEM& item : m_drawings )
1177  {
1178  if( ( aUnit && item.m_unit && aUnit != item.m_unit )
1179  || ( aConvert && item.m_convert && aConvert != item.m_convert )
1180  || ( item.Type() != aType && aType != TYPE_NOT_INIT ) )
1181  {
1182  continue;
1183  }
1184 
1185  if( item.HitTest( aPoint ) )
1186  return &item;
1187  }
1188 
1189  return nullptr;
1190 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings, and TYPE_NOT_INIT.

Referenced by LocateDrawItem().

◆ LocateDrawItem() [2/2]

LIB_ITEM * LIB_SYMBOL::LocateDrawItem ( int  aUnit,
int  aConvert,
KICAD_T  aType,
const wxPoint &  aPoint,
const TRANSFORM aTransform 
)

Locate a draw object (overlaid)

Parameters
aUnit- Unit number of draw item.
aConvert- Body style of draw item.
aType- Draw object type, set to 0 to search for any type.
aPoint- Coordinate for hit testing.
aTransform= the transform matrix
Returns
The draw object if found. Otherwise NULL.

Definition at line 1193 of file lib_symbol.cpp.

1195 {
1196  /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
1197  * wxPoint& pt ) to search items.
1198  * because this function uses DefaultTransform as orient/mirror matrix
1199  * we temporary copy aTransform in DefaultTransform
1200  */
1201  LIB_ITEM* item;
1202  TRANSFORM transform = DefaultTransform;
1203  DefaultTransform = aTransform;
1204 
1205  item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
1206 
1207  // Restore matrix
1208  DefaultTransform = transform;
1209 
1210  return item;
1211 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint)
Locate a draw object.
TRANSFORM DefaultTransform
Definition: eeschema.cpp:56

References DefaultTransform, and LocateDrawItem().

◆ LockUnits()

void LIB_SYMBOL::LockUnits ( bool  aLockUnits)
inline

Set interchangeable the property for symbol units.

Parameters
aLockUnitswhen true then units are set as not interchangeable.

Definition at line 235 of file lib_symbol.h.

235 { m_unitsLocked = aLockUnits; }
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686

References m_unitsLocked.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const wxFindReplaceData &  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_SYMBOL, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, PCB_MARKER, SCH_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 364 of file eda_item.h.

365  {
366  return false;
367  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), SCH_MARKER::Matches(), PCB_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const wxFindReplaceData &  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 118 of file eda_item.cpp.

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

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

◆ operator!=()

bool LIB_SYMBOL::operator!= ( const LIB_SYMBOL aSymbol) const
inline

Definition at line 623 of file lib_symbol.h.

624  {
625  return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) != 0;
626  }
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0) const
Comparison test that can be used for operators.
Definition: lib_symbol.cpp:212

References Compare().

◆ operator<()

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

235 {
236  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
237  GetClass() ) );
238 
239  return false;
240 }
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
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator=()

const LIB_SYMBOL & LIB_SYMBOL::operator= ( const LIB_SYMBOL aSymbol)

Definition at line 166 of file lib_symbol.cpp.

167 {
168  if( &aSymbol == this )
169  return aSymbol;
170 
171  LIB_ITEM* newItem;
172 
173  m_library = aSymbol.m_library;
174  m_name = aSymbol.m_name;
175  m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
176  m_unitCount = aSymbol.m_unitCount;
177  m_unitsLocked = aSymbol.m_unitsLocked;
180  m_showPinNames = aSymbol.m_showPinNames;
181  m_includeInBom = aSymbol.m_includeInBom;
183  m_lastModDate = aSymbol.m_lastModDate;
184  m_options = aSymbol.m_options;
185  m_libId = aSymbol.m_libId;
186  m_description = aSymbol.m_description;
187  m_keyWords = aSymbol.m_keyWords;
188 
189  m_drawings.clear();
190 
191  for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
192  {
193  if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
194  continue;
195 
196  newItem = (LIB_ITEM*) oldItem.Clone();
197  newItem->SetParent( this );
198  m_drawings.push_back( newItem );
199  }
200 
201  m_drawings.sort();
202 
203  LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
204 
205  if( parent )
206  SetParent( parent.get() );
207 
208  return *this;
209 }
bool m_showPinNumbers
Definition: lib_symbol.h:692
bool m_showPinNames
Definition: lib_symbol.h:691
#define IS_NEW
New item, just created.
void clear(int aType=UNDEFINED_TYPE)
Definition: multivector.h:212
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
void sort()
Definition: multivector.h:247
wxString m_description
Definition: lib_symbol.h:702
wxString m_name
Definition: lib_symbol.h:701
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
timestamp_t m_lastModDate
Definition: lib_symbol.h:683
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686
void push_back(T *aItem)
Definition: multivector.h:174
bool m_includeOnBoard
Definition: lib_symbol.h:695
#define STRUCT_DELETED
flag indication structures to be erased
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:371
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:154
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
bool m_includeInBom
Definition: lib_symbol.h:694
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:689
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704
LIB_ID m_libId
Definition: lib_symbol.h:682
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:703
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::clear(), EDA_ITEM::Clone(), EDA_ITEM::GetFlags(), IS_NEW, m_description, m_drawings, m_fpFilters, m_includeInBom, m_includeOnBoard, m_keyWords, m_lastModDate, m_libId, m_library, m_name, m_options, m_parent, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), EDA_ITEM::SetParent(), SetParent(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort(), and STRUCT_DELETED.

◆ operator==() [1/2]

bool LIB_SYMBOL::operator== ( const LIB_SYMBOL aSymbol) const
inline

Definition at line 617 of file lib_symbol.h.

617 { return this == aSymbol; }

◆ operator==() [2/2]

bool LIB_SYMBOL::operator== ( const LIB_SYMBOL aSymbol) const
inline

Definition at line 618 of file lib_symbol.h.

619  {
620  return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
621  }
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0) const
Comparison test that can be used for operators.
Definition: lib_symbol.cpp:212

References Compare().

◆ PinsConflictWith()

bool LIB_SYMBOL::PinsConflictWith ( const LIB_SYMBOL aOtherSymbol,
bool  aTestNums,
bool  aTestNames,
bool  aTestType,
bool  aTestOrientation,
bool  aTestLength 
) const

Return true if this symbol's pins do not match another symbol's pins.

This is used to detect whether the project cache is out of sync with the system libs.

Parameters
aOtherSymbol- The other library symbol to test
aTestNums- Whether two pins at the same point must have the same number.
aTestNames- Whether two pins at the same point must have the same name.
aTestType- Whether two pins at the same point must have the same electrical type.
aTestOrientation- Whether two pins at the same point must have the same orientation.
aTestLength- Whether two pins at the same point must have the same length.

Definition at line 801 of file lib_symbol.cpp.

803 {
804  LIB_PINS thisPinList;
805  GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
806 
807  for( const LIB_PIN* eachThisPin : thisPinList )
808  {
809  wxASSERT( eachThisPin );
810  LIB_PINS otherPinList;
811  aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
812  bool foundMatch = false;
813 
814  for( const LIB_PIN* eachOtherPin : otherPinList )
815  {
816  wxASSERT( eachOtherPin );
817 
818  // Same unit?
819  if( eachThisPin->GetUnit() != eachOtherPin->GetUnit() )
820  continue;
821 
822  // Same body stype?
823  if( eachThisPin->GetConvert() != eachOtherPin->GetConvert() )
824  continue;
825 
826  // Same position?
827  if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
828  continue;
829 
830  // Same number?
831  if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ) )
832  continue;
833 
834  // Same name?
835  if( aTestNames && ( eachThisPin->GetName() != eachOtherPin->GetName() ) )
836  continue;
837 
838  // Same electrical type?
839  if( aTestType && ( eachThisPin->GetType() != eachOtherPin->GetType() ) )
840  continue;
841 
842  // Same orientation?
843  if( aTestOrientation
844  && ( eachThisPin->GetOrientation() != eachOtherPin->GetOrientation() ) )
845  continue;
846 
847  // Same length?
848  if( aTestLength && ( eachThisPin->GetLength() != eachOtherPin->GetLength() ) )
849  continue;
850 
851  foundMatch = true;
852  break; // Match found so search is complete.
853  }
854 
855  if( !foundMatch )
856  {
857  // This means there was not an identical (according to the arguments)
858  // pin at the same position in the other symbol.
859  return true;
860  }
861  }
862 
863  // The loop never gave up, so no conflicts were found.
864  return false;
865 }
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
Definition: lib_symbol.cpp:756
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:55

References GetPins().

Referenced by RESCUE_CACHE_CANDIDATE::FindRescues(), and RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues().

◆ Plot()

void LIB_SYMBOL::Plot ( PLOTTER aPlotter,
int  aUnit,
int  aConvert,
const wxPoint &  aOffset,
const TRANSFORM aTransform 
) const

Plot lib symbol to plotter.

Lib Fields not are plotted here, because this plot function is used to plot schematic items, which have they own fields

Parameters
aPlotter- Plotter object to plot to.
aUnit- Symbol symbol to plot.
aConvert- Symbol alternate body style to plot.
aOffset- Distance to shift the plot coordinates.
aTransform- Symbol plot transform matrix.

Definition at line 598 of file lib_symbol.cpp.

600 {
601  wxASSERT( aPlotter != nullptr );
602 
603  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
604 
605  // draw background for filled items using background option
606  // Solid lines will be drawn after the background
607  for( const LIB_ITEM& item : m_drawings )
608  {
609  if( item.Type() != LIB_SHAPE_T )
610  continue;
611 
612  const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item );
613 
614  // Do not draw items not attached to the current part
615  if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
616  continue;
617 
618  if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
619  continue;
620 
621  if( shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR && aPlotter->GetColorMode() )
622  shape.Plot( aPlotter, aOffset, true, aTransform );
623  }
624 
625  // Not filled items and filled shapes are now plotted
626  // Items that have BG fills only get re-stroked to ensure the edges are in the foreground
627  for( const LIB_ITEM& item : m_drawings )
628  {
629  // Lib Fields are not plotted here, because this plot function
630  // is used to plot schematic items, which have they own fields
631  if( item.Type() == LIB_FIELD_T )
632  continue;
633 
634  if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
635  continue;
636 
637  if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
638  continue;
639 
640  bool forceNoFill = false;
641 
642  if( item.Type() == LIB_SHAPE_T )
643  {
644  const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item );
645  forceNoFill = shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
646  }
647 
648  item.Plot( aPlotter, aOffset, !forceNoFill, aTransform );
649  }
650 }
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
int m_unit
Unit identification for multiple parts per package.
Definition: lib_item.h:317
int m_convert
Shape identification for alternate body styles.
Definition: lib_item.h:323
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) const override
Plot the draw item using the plot object.
Definition: lib_shape.cpp:112
virtual void SetColor(const COLOR4D &color)=0
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
FILL_T GetFillType() const
Definition: eda_shape.h:88
bool GetColorMode() const
Definition: plotter.h:153

References FILLED_WITH_BG_BODYCOLOR, PLOTTER::GetColorMode(), EDA_SHAPE::GetFillType(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LAYER_DEVICE, LIB_FIELD_T, LIB_SHAPE_T, LIB_ITEM::m_convert, m_drawings, LIB_ITEM::m_unit, LIB_SHAPE::Plot(), PLOTTER::RenderSettings(), and PLOTTER::SetColor().

Referenced by SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ PlotLibFields()

void LIB_SYMBOL::PlotLibFields ( PLOTTER aPlotter,
int  aUnit,
int  aConvert,
const wxPoint &  aOffset,
const TRANSFORM aTransform 
)

Plot Lib Fields only of the symbol to plotter.

is used to plot the full lib symbol, outside the schematic

Parameters
aPlotter- Plotter object to plot to.
aUnit- Symbol to plot.
aConvert- Symbol alternate body style to plot.
aOffset- Distance to shift the plot coordinates.
aTransform- Symbol plot transform matrix.

Definition at line 653 of file lib_symbol.cpp.

655 {
656  wxASSERT( aPlotter != nullptr );
657 
658  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
659  bool fill = aPlotter->GetColorMode();
660 
661  for( LIB_ITEM& item : m_drawings )
662  {
663  if( item.Type() != LIB_FIELD_T )
664  continue;
665 
666  if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
667  continue;
668 
669  if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
670  continue;
671 
672  LIB_FIELD& field = (LIB_FIELD&) item;
673 
674  // The reference is a special case: we should change the basic text
675  // to add '?' and the part id
676  wxString tmp = field.GetShownText();
677 
678  if( field.GetId() == REFERENCE_FIELD )
679  {
680  wxString text = field.GetFullText( aUnit );
681  field.SetText( text );
682  }
683 
684  item.Plot( aPlotter, aOffset, fill, aTransform );
685  field.SetText( tmp );
686  }
687 }
Field Reference of part, i.e. "IC21".
Field object used in symbol libraries.
Definition: lib_field.h:59
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
int GetId() const
Definition: lib_field.h:115
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
virtual void SetColor(const COLOR4D &color)=0
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:325
virtual wxString GetShownText(int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:162
bool GetColorMode() const
Definition: plotter.h:153

References PLOTTER::GetColorMode(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), KIGFX::RENDER_SETTINGS::GetLayerColor(), EDA_TEXT::GetShownText(), LAYER_FIELDS, LIB_FIELD_T, m_drawings, REFERENCE_FIELD, PLOTTER::RenderSettings(), PLOTTER::SetColor(), EDA_TEXT::SetText(), and text.

Referenced by SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ Print()

void LIB_SYMBOL::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
int  aMulti,
int  aConvert,
const LIB_SYMBOL_OPTIONS aOpts 
)

Print symbol.

Parameters
aOffset- Position of symbol.
aMulti- unit if multiple units per symbol.
aConvert- Symbol conversion (DeMorgan) if available.
aOpts- Drawing options

Definition at line 527 of file lib_symbol.cpp.

529 {
530  /* draw background for filled items using background option
531  * Solid lines will be drawn after the background
532  * Note also, background is not drawn when printing in black and white
533  */
534  if( !GetGRForceBlackPenState() )
535  {
536  for( LIB_ITEM& item : m_drawings )
537  {
538  if( item.Type() == LIB_SHAPE_T )
539  {
540  LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
541 
542  // Do not draw items not attached to the current part
543  if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
544  continue;
545 
546  if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
547  continue;
548 
550  shape.Print( aSettings, aOffset, (void*) false, aOpts.transform );
551  }
552  }
553  }
554 
555  for( LIB_ITEM& item : m_drawings )
556  {
557  // Do not draw items not attached to the current part
558  if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
559  continue;
560 
561  if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
562  continue;
563 
564  if( item.Type() == LIB_FIELD_T )
565  {
566  LIB_FIELD& field = static_cast<LIB_FIELD&>( item );
567 
568  if( field.IsVisible() && !aOpts.draw_visible_fields )
569  continue;
570 
571  if( !field.IsVisible() && !aOpts.draw_hidden_fields )
572  continue;
573  }
574 
575  if( item.Type() == LIB_PIN_T )
576  {
577  item.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform );
578  }
579  else if( item.Type() == LIB_FIELD_T )
580  {
581  item.Print( aSettings, aOffset, (void*) NULL, aOpts.transform );
582  }
583  else if( item.Type() == LIB_SHAPE_T )
584  {
585  LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
586  bool forceNoFill = shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
587 
588  shape.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
589  }
590  else
591  {
592  item.Print( aSettings, aOffset, (void*) false, aOpts.transform );
593  }
594  }
595 }
Field object used in symbol libraries.
Definition: lib_field.h:59
bool draw_visible_fields
Definition: lib_symbol.h:65
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
TRANSFORM transform
Definition: lib_symbol.h:64
int m_unit
Unit identification for multiple parts per package.
Definition: lib_item.h:317
virtual bool IsVisible() const
Definition: eda_text.h:207
int m_convert
Shape identification for alternate body styles.
Definition: lib_item.h:323
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
virtual void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform)
Draw an item.
Definition: lib_item.cpp:118
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:191
FILL_T GetFillType() const
Definition: eda_shape.h:88

References LIB_SYMBOL_OPTIONS::draw_hidden_fields, LIB_SYMBOL_OPTIONS::draw_visible_fields, FILLED_WITH_BG_BODYCOLOR, EDA_SHAPE::GetFillType(), GetGRForceBlackPenState(), EDA_TEXT::IsVisible(), LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_ITEM::m_convert, m_drawings, LIB_ITEM::m_unit, LIB_ITEM::Print(), and LIB_SYMBOL_OPTIONS::transform.

Referenced by SCH_SYMBOL::Print(), and SYMBOL_EDIT_FRAME::PrintPage().

◆ RemoveDrawItem()

void LIB_SYMBOL::RemoveDrawItem ( LIB_ITEM aItem)

Remove draw aItem from list.

Parameters
aItem- Draw item to remove from list.

Definition at line 690 of file lib_symbol.cpp.

691 {
692  wxASSERT( aItem != nullptr );
693 
694  // none of the MANDATORY_FIELDS may be removed in RAM, but they may be
695  // omitted when saving to disk.
696  if( aItem->Type() == LIB_FIELD_T )
697  {
698  if( static_cast<LIB_FIELD*>( aItem )->IsMandatory() )
699  return;
700  }
701 
702  LIB_ITEMS& items = m_drawings[ aItem->Type() ];
703 
704  for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
705  {
706  if( &*i == aItem )
707  {
708  items.erase( i );
709  SetModified();
710  break;
711  }
712  }
713 }
void SetModified()
Definition: eda_item.cpp:65
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
Definition: lib_symbol.h:48
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:179
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), LIB_FIELD_T, m_drawings, EDA_ITEM::SetModified(), and EDA_ITEM::Type().

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), and DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow().

◆ RemoveDuplicateDrawItems()

void LIB_SYMBOL::RemoveDuplicateDrawItems ( )

Remove duplicate draw items from list.

Definition at line 1132 of file lib_symbol.cpp.

1133 {
1134  m_drawings.unique();
1135 }
void unique()
Remove duplicate elements in list.
Definition: multivector.h:256
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::unique().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( const wxFindReplaceData &  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 170 of file eda_item.cpp.

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

References next(), and text.

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

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( const wxFindReplaceData &  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 SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 391 of file eda_item.h.

392  {
393  return false;
394  }

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetBrightened()

◆ SetConversion()

void LIB_SYMBOL::SetConversion ( bool  aSetConvert,
bool  aDuplicatePins = true 
)

Set or clear the alternate body style (DeMorgan) for the symbol.

If the symbol already has an alternate body style set and a asConvert if false, all of the existing draw items for the alternate body style are remove. If the alternate body style is not set and asConvert is true, than the base draw items are duplicated and added to the symbol.

Parameters
aSetConvert- Set or clear the symbol alternate body style.
aDuplicatePins- Duplicate all pins from original body style if true.

Definition at line 1288 of file lib_symbol.cpp.

1289 {
1290  if( aSetConvert == HasConversion() )
1291  return;
1292 
1293  // Duplicate items to create the converted shape
1294  if( aSetConvert )
1295  {
1296  if( aDuplicatePins )
1297  {
1298  std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
1299 
1300  for( LIB_ITEM& item : m_drawings )
1301  {
1302  // Only pins are duplicated.
1303  if( item.Type() != LIB_PIN_T )
1304  continue;
1305 
1306  if( item.m_convert == 1 )
1307  {
1308  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1309  newItem->m_convert = 2;
1310  tmp.push_back( newItem );
1311  }
1312  }
1313 
1314  // Transfer the new pins to the LIB_SYMBOL.
1315  for( unsigned i = 0; i < tmp.size(); i++ )
1316  m_drawings.push_back( tmp[i] );
1317  }
1318  }
1319  else
1320  {
1321  // Delete converted shape items because the converted shape does
1322  // not exist
1324 
1325  while( i != m_drawings.end() )
1326  {
1327  if( i->m_convert > 1 )
1328  i = m_drawings.erase( i );
1329  else
1330  ++i;
1331  }
1332  }
1333 
1334  m_drawings.sort();
1335 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:188
void sort()
Definition: multivector.h:247
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:194
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
void push_back(T *aItem)
Definition: multivector.h:174
int m_convert
Shape identification for alternate body styles.
Definition: lib_item.h:323
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:179
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The const iterator.
Definition: multivector.h:164
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), EDA_ITEM::Clone(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), HasConversion(), LIB_PIN_T, LIB_ITEM::m_convert, m_drawings, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort().

Referenced by SYMBOL_EDIT_FRAME::CreateNewSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetDescription()

◆ SetFields()

void LIB_SYMBOL::SetFields ( const std::vector< LIB_FIELD > &  aFieldsList)

Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.

The only known caller of this function is the library symbol field editor, and it establishes needed behavior.

Parameters
aFieldsListis a set of fields to import, removing all previous fields.

Definition at line 965 of file lib_symbol.cpp.

966 {
967  deleteAllFields();
968 
969  for( unsigned i=0; i<aFields.size(); ++i )
970  {
971  // drawings is a ptr_vector, new and copy an object on the heap.
972  LIB_FIELD* field = new LIB_FIELD( aFields[i] );
973 
974  field->SetParent( this );
975  m_drawings.push_back( field );
976  }
977 
978  m_drawings.sort();
979 }
Field object used in symbol libraries.
Definition: lib_field.h:59
void sort()
Definition: multivector.h:247
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
void push_back(T *aItem)
Definition: multivector.h:174
void deleteAllFields()
Definition: lib_symbol.cpp:953
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References deleteAllFields(), m_drawings, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), EDA_ITEM::SetParent(), and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort().

Referenced by DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 152 of file eda_item.h.

152 { m_flags |= aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), 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(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), 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::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), 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_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_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 203 of file eda_item.h.

203 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:479

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetFPFilters()

void LIB_SYMBOL::SetFPFilters ( const wxArrayString &  aFilters)
inline

Definition at line 181 of file lib_symbol.h.

181 { m_fpFilters = aFilters; }
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:704

References m_fpFilters.

Referenced by BOOST_AUTO_TEST_CASE(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetIncludeInBom()

void LIB_SYMBOL::SetIncludeInBom ( bool  aIncludeInBom)
inline

Set or clear the include in schematic bill of materials flag.

Parameters
aIncludeInBomtrue to include symbol in schematic bill of material

Definition at line 595 of file lib_symbol.h.

595 { m_includeInBom = aIncludeInBom; }
bool m_includeInBom
Definition: lib_symbol.h:694

References m_includeInBom.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetIncludeOnBoard()

void LIB_SYMBOL::SetIncludeOnBoard ( bool  aIncludeOnBoard)
inline

Set or clear include in board netlist flag.

Parameters
aIncludeOnBoardtrue to include symbol in the board netlist

Definition at line 603 of file lib_symbol.h.

603 { m_includeOnBoard = aIncludeOnBoard; }
bool m_includeOnBoard
Definition: lib_symbol.h:695

References m_includeOnBoard.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetKeyWords()

void LIB_SYMBOL::SetKeyWords ( const wxString &  aKeyWords)
inline

◆ SetLib()

void LIB_SYMBOL::SetLib ( SYMBOL_LIB aLibrary)
inline

Definition at line 177 of file lib_symbol.h.

177 { m_library = aLibrary; }
SYMBOL_LIB * m_library
Definition: lib_symbol.h:700

References m_library.

Referenced by LEGACY_RESCUER::AddSymbol(), SYMBOL_LIB::FindSymbol(), LIB_SYMBOL(), and SYMBOL_LIB::LoadLibrary().

◆ SetLibId()

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

Definition at line 65 of file eda_item.cpp.

66 {
68 
69  // If this a child object, then the parent modification state also needs to be set.
70  if( m_parent )
72 }
#define IS_CHANGED
Item was edited, and modified.
void SetModified()
Definition: eda_item.cpp:65
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152

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

Referenced by SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), LEGACY_PLUGIN::loadZONE_CONTAINER(), SCH_LINE::Move(), SCH_SYMBOL::Move(), SCH_LINE::MoveEnd(), SCH_LINE::MoveStart(), LIB_PIN::MoveTo(), PCB_EDIT_FRAME::OpenProjectFiles(), ALTIUM_PCB::Parse(), SCH_ALTIUM_PLUGIN::ParseFileHeader(), RemoveDrawItem(), SCH_SYMBOL::SetConvert(), SCH_SYMBOL::SetLibId(), EDA_ITEM::SetModified(), LIB_FIELD::SetName(), SCH_SYMBOL::SetTransform(), and SCH_SYMBOL::SetUnit().

◆ SetName()

void LIB_SYMBOL::SetName ( const wxString &  aName)
virtual

◆ SetNormal()

void LIB_SYMBOL::SetNormal ( )

Definition at line 486 of file lib_symbol.cpp.

487 {
488  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
489  parent->m_options = ENTRY_NORMAL;
490 
492 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696

References ENTRY_NORMAL, m_options, and m_parent.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetOffset()

void LIB_SYMBOL::SetOffset ( const wxPoint &  aOffset)

Move the symbol aOffset.

Parameters
aOffset- Offset displacement.

Definition at line 1125 of file lib_symbol.cpp.

1126 {
1127  for( LIB_ITEM& item : m_drawings )
1128  item.Offset( aOffset );
1129 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References m_drawings.

Referenced by SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor().

◆ SetParent() [1/3]

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in PCB_DIMENSION_BASE.

Definition at line 115 of file eda_item.h.

115 { m_parent = aParent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478

References EDA_ITEM::m_parent.

Referenced by FOOTPRINT::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), 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(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PCB_EDIT_FRAME::ExchangeFootprint(), Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), FOOTPRINT::operator=(), operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_SHEET::SwapData(), SCH_GLOBALLABEL::SwapData(), SCH_SYMBOL::SwapData(), and SwapItemData().

◆ SetParent() [2/3]

◆ SetParent() [3/3]

virtual void EDA_ITEM::SetParent
inlineprivate

Definition at line 115 of file eda_item.h.

115 { m_parent = aParent; }
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681

◆ SetPinNameOffset()

void LIB_SYMBOL::SetPinNameOffset ( int  aOffset)
inline

Set the offset in mils of the pin name text from the pin symbol.

Set the offset to 0 to draw the pin name above the pin symbol.

Parameters
aOffset- The offset in mils.

Definition at line 571 of file lib_symbol.h.

571 { m_pinNameOffset = aOffset; }
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:689

References m_pinNameOffset.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetPosition()

◆ SetPower()

void LIB_SYMBOL::SetPower ( )

Definition at line 468 of file lib_symbol.cpp.

469 {
470  if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
471  parent->m_options = ENTRY_POWER;
472 
474 }
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:42
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:681
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:696

References ENTRY_POWER, m_options, and m_parent.

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_ALTIUM_PLUGIN::ParsePowerPort(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetSelected()

◆ SetShowPinNames()

void LIB_SYMBOL::SetShowPinNames ( bool  aShow)
inline

◆ SetShowPinNumbers()

void LIB_SYMBOL::SetShowPinNumbers ( bool  aShow)
inline

◆ SetState()

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

Definition at line 141 of file eda_item.h.

142  {
143  if( state )
144  m_status |= type; // state = ON or OFF
145  else
146  m_status &= ~type;
147  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 150 of file eda_item.h.

150 { m_status = aStatus; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetSubpartIdNotation()

void LIB_SYMBOL::SetSubpartIdNotation ( int  aSep,
int  aFirstId 
)
static

Set the separator char between the subpart id and the reference 0 (no separator) or '.

' , '-' and '_' and the ascii char value to calculate the subpart symbol id from the symbol number: 'A' or '1' only are allowed. (to print U1.A or U1.1) if this is a digit, a number is used as id symbol Note also if the subpart symbol is a digit, the separator cannot be null.

Parameters
aSep= the separator symbol (0 (no separator) or '.' , '-' and '_')
aFirstId= the Id of the first symbol ('A' or '1')

Definition at line 1338 of file lib_symbol.cpp.

1339 {
1340  m_subpartFirstId = 'A';
1342 
1343  if( aSep == '.' || aSep == '-' || aSep == '_' )
1344  m_subpartIdSeparator = aSep;
1345 
1346  if( aFirstId == '1' && aSep != 0 )
1347  m_subpartFirstId = aFirstId;
1348 }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
Definition: lib_symbol.h:710
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
Definition: lib_symbol.h:707

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::LoadProjectSettings(), and PANEL_SETUP_FORMATTING::TransferDataFromWindow().

◆ SetUnitCount()

void LIB_SYMBOL::SetUnitCount ( int  aCount,
bool  aDuplicateDrawItems = true 
)

Set the units per symbol count.

If the count is greater than the current count, then the all of the current draw items are duplicated for each additional symbol. If the count is less than the current count, all draw objects for units greater that count are removed from the symbol.

Parameters
aCount- Number of units per package.
aDuplicateDrawItemsCreate duplicate draw items of unit 1 for each additionl unit.

Definition at line 1231 of file lib_symbol.cpp.

1232 {
1233  if( m_unitCount == aCount )
1234  return;
1235 
1236  if( aCount < m_unitCount )
1237  {
1239 
1240  while( i != m_drawings.end() )
1241  {
1242  if( i->m_unit > aCount )
1243  i = m_drawings.erase( i );
1244  else
1245  ++i;
1246  }
1247  }
1248  else if( aDuplicateDrawItems )
1249  {
1250  int prevCount = m_unitCount;
1251 
1252  // Temporary storage for new items, as adding new items directly to
1253  // m_drawings may cause the buffer reallocation which invalidates the
1254  // iterators
1255  std::vector< LIB_ITEM* > tmp;
1256 
1257  for( LIB_ITEM& item : m_drawings )
1258  {
1259  if( item.m_unit != 1 )
1260  continue;
1261 
1262  for( int j = prevCount + 1; j <= aCount; j++ )
1263  {
1264  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1265  newItem->m_unit = j;
1266  tmp.push_back( newItem );
1267  }
1268  }
1269 
1270  for( LIB_ITEM* item : tmp )
1271  m_drawings.push_back( item );
1272  }
1273 
1274  m_drawings.sort();
1275  m_unitCount = aCount;
1276 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:188
void sort()
Definition: multivector.h:247
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:194
int m_unit
Unit identification for multiple parts per package.
Definition: lib_item.h:317
void push_back(T *aItem)
Definition: multivector.h:174
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:179
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The const iterator.
Definition: multivector.h:164
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:685

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), EDA_ITEM::Clone(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), m_drawings, LIB_ITEM::m_unit, m_unitCount, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort().

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 127 of file eda_item.h.

127 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SharedPtr()

◆ ShowPinNames()

◆ ShowPinNumbers()

◆ 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 420 of file eda_item.h.

420 { return *aLeft < *aRight; }

◆ SubpartFirstIdPtr()

static int* LIB_SYMBOL::SubpartFirstIdPtr ( )
inlinestatic

Return a reference to m_subpartFirstId, only for read/save setting functions.

Definition at line 536 of file lib_symbol.h.

536 { return &m_subpartFirstId; }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
Definition: lib_symbol.h:710

References m_subpartFirstId.

Referenced by SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS().

◆ SubpartIdSeparatorPtr()

static int* LIB_SYMBOL::SubpartIdSeparatorPtr ( )
inlinestatic

Return a reference to m_subpartIdSeparator, only for read/save setting functions.

Definition at line 530 of file lib_symbol.h.

530 { return &m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
Definition: lib_symbol.h:707

References m_subpartIdSeparator.

Referenced by SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS().

◆ SubReference()

wxString LIB_SYMBOL::SubReference ( int  aUnit,
bool  aAddSeparator = true 
)
static
Returns
the sub reference for symbol having multiple units per symbol. The sub reference identify the symbol (or unit)
Parameters
aUnit= the symbol identifier ( 1 to max count)
aAddSeparator= true (default) to prepend the sub ref by the separator symbol (if any) Note: this is a static function.

Definition at line 495 of file lib_symbol.cpp.

496 {
497  wxString subRef;
498 
499  if( m_subpartIdSeparator != 0 && aAddSeparator )
500  subRef << wxChar( m_subpartIdSeparator );
501 
502  if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
503  subRef << aUnit;
504  else
505  {
506  // use letters as notation. To allow more than 26 units, the sub ref
507  // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise
508  // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available)
509  int u;
510  aUnit -= 1; // Unit number starts to 1. now to 0.
511 
512  while( aUnit >= 26 ) // more than one letter are needed
513  {
514  u = aUnit / 26;
515  subRef << wxChar( m_subpartFirstId + u -1 );
516  aUnit %= 26;
517  }
518 
519  u = m_subpartFirstId + aUnit;
520  subRef << wxChar( u );
521  }
522 
523  return subRef;
524 }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
Definition: lib_symbol.h:710
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
Definition: lib_symbol.h:707

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_REFERENCE_LIST::CheckAnnotation(), SCH_REFERENCE::GetFullRef(), LIB_FIELD::GetFullText(), SCH_SYMBOL::GetRef(), SCH_FIELD::GetShownText(), GetUnitReference(), SCH_EDIT_FRAME::mapExistingAnnotation(), SCH_FIELD::Matches(), SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList(), SCH_SYMBOL::ResolveTextVar(), DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow(), and SYMBOL_UNIT_MENU::update().

◆ 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 112 of file eda_item.h.

112 { return m_structType; }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:487

References EDA_ITEM::m_structType.

Referenced by KIGFX::PCB_VIEW::Add(), FOOTPRINT::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), 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(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), calcIsInsideArea(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_NO_CONNECT::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_LABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SYMBOL::CanConnect(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), PCB_TEXT::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), PCB_MARKER::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FP_SHAPE::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), PCB_GROUP::ClassOf(), SCH_FIELD::ClassOf(), FP_TEXT::ClassOf(), SCH_SHEET::ClassOf(), NETINFO_ITEM::ClassOf(), ZONE::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_BITMAP::ClassOf(), PCB_TRACK::ClassOf(), PAD::ClassOf(), SCH_SYMBOL::ClassOf(), FOOTPRINT::ClassOf(), SCH_SCREEN::ClassOf(), SCH_TEXT::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), BOARD::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), PCB_ARC::ClassOf(), SCH_LABEL::ClassOf(), PCB_VIA::ClassOf(), SCH_GLOBALLABEL::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), SCH_HIERLABEL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), TRACKS_CLEANER::cleanup(), CONNECTION_GRAPH::collectAllDriverValues(), LIB_TEXT::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), Compare(), EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_LINE::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), CONVERT_TOOL::CreateLines(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), CONVERT_TOOL::CreatePolys(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), 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(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_SELECTION_TOOL::FilterCollectorForMarkers(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItems(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_PLUGIN::Format(), PCB_PLUGIN::format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetContextualTextVars(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), SCH_FIELD::GetDrawRotation(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), PCB_TRACK::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTIVITY_DATA::GetNetItems(), GetNextDrawItem(), PCB_SHAPE::GetParentFootprint(), BOARD_ITEM::GetParentFootprint(), GetPin(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), PCB_TRACK::GetSelectMenuText(), DRC_ENGINE::GetShape(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), CONVERT_TOOL::getStartEndPoints(), getTopLevelGroup(), PCB_EXPR_TYPE_REF::GetValue(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), DRC_RTREE::Insert(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), 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(), CN_ANCHOR::IsDangling(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), DRC_ENGINE::IsNetTie(), PCB_TRACK::IsNull(), SCH_LINE::IsParallel(), isPlated(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromSegs(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), memberOf(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_SHAPE::cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), SCH_BUS_ENTRY_BASE::operator<(), SCH_JUNCTION::operator<(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), LIB_ITEM::operator<(), SCH_LINE::operator<(), SCH_SHEET::operator<(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_SYMBOL::operator=(), LIB_ITEM::operator==(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_EDITOR_CONTROL::PageSettings(), BOARD_COMMIT::parentObject(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), POSITION_RELATIVE_TOOL::PositionRelative(), SCH_FIELD::Print(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), CONNECTION_GRAPH::processSubGraphs(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_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::RefreshSelection(), KIGFX::PCB_VIEW::Remove(), EE_RTREE::remove(), FOOTPRINT::Remove(), CN_CONNECTIVITY_ALGO::Remove(), SCH_SCREEN::Remove(), BOARD::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), DS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_TEXT_AND_LABEL_PROPERTIES::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_FIELD::SwapData(), PCB_GROUP::SwapData(), PCB_TEXT::SwapData(), PCB_TRACK::SwapData(), SCH_SHEET::SwapData(), PCB_ARC::SwapData(), PCB_DIM_ALIGNED::SwapData(), PCB_DIM_ORTHOGONAL::SwapData(), SCH_SYMBOL::SwapData(), PCB_VIA::SwapData(), PCB_DIM_LEADER::SwapData(), PCB_DIM_CENTER::SwapData(), PAD::SwapData(), FOOTPRINT::SwapData(), ZONE::SwapData(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), PCB_TRACK::TransformShapeWithClearanceToPolygon(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_TEXT::UpdateDanglingState(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_BASE_FRAME::UpdateItem(), CONNECTION_GRAPH::updateItemConnectivity(), 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(), PCB_TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_GLOBALLABEL::Visit(), SCH_SHEET::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ UnitsLocked()

bool LIB_SYMBOL::UnitsLocked ( ) const
inline

Check whether symbol units are interchangeable.

Returns
False when interchangeable, true otherwise.

Definition at line 241 of file lib_symbol.h.

241 { return m_unitsLocked; }
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:686

References m_unitsLocked.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GetUniqueUnits(), SCH_REFERENCE::IsUnitsLocked(), SYMBOL_EDIT_FRAME::LoadSymbol(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SYMBOL_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::SynchronizePins(), and DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow().

◆ UpdateFieldOrdinals()

int LIB_SYMBOL::UpdateFieldOrdinals ( )

Order optional field indices.

It's possible when calling LIB_SYMBOL::Flatten that there can be gaps and/or duplicate optional field indices. This method correctly orders the indices so there are no gaps and/or duplicate indices.

Definition at line 1086 of file lib_symbol.cpp.

1087 {
1088  int retv = 0;
1089  int lastOrdinal = MANDATORY_FIELDS;
1090 
1091  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1092  {
1093  LIB_FIELD* field = dynamic_cast<LIB_FIELD*>( &item );
1094 
1095  wxCHECK2( field, continue );
1096 
1097  // Mandatory fields were already resolved always have the same ordinal values.
1098  if( field->IsMandatory() )
1099  continue;
1100 
1101  if( field->GetId() != lastOrdinal )
1102  {
1103  field->SetId( lastOrdinal );
1104  retv += 1;
1105  }
1106 
1107  lastOrdinal += 1;
1108  }
1109 
1110  return retv;
1111 }
Field object used in symbol libraries.
Definition: lib_field.h:59
int GetId() const
Definition: lib_field.h:115
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698
void SetId(int aId)
Definition: lib_field.cpp:101
bool IsMandatory() const
Definition: lib_field.cpp:495

References LIB_FIELD::GetId(), LIB_FIELD::IsMandatory(), LIB_FIELD_T, m_drawings, MANDATORY_FIELDS, and LIB_FIELD::SetId().

Referenced by SCH_SEXPR_PARSER::ParseSchematic().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

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

Returns
the current bounding box.

Implements KIGFX::VIEW_ITEM.

Reimplemented in PAD, FOOTPRINT, PCB_DIM_CENTER, EDIT_POINTS, PCB_DIMENSION_BASE, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, PCB_SHAPE, DS_PROXY_VIEW_ITEM, PCB_MARKER, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::RULER_ITEM, RATSNEST_VIEW_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 257 of file eda_item.cpp.

258 {
259  // Basic fallback
260  EDA_RECT bbox = GetBoundingBox();
261 
262  return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
263 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
const wxPoint GetOrigin() const
Definition: eda_rect.h:110
Handle the component boundary box.
Definition: eda_rect.h:42
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxSize GetSize() const
Definition: eda_rect.h:100

References EDA_ITEM::GetBoundingBox(), EDA_RECT::GetOrigin(), and EDA_RECT::GetSize().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), PCB_SHAPE::ViewBBox(), and PCB_DIMENSION_BASE::ViewBBox().

◆ 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 EDIT_POINTS, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::VIEW_GROUP, MY_DRAWING, KIGFX::VIEW_OVERLAY, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, and RATSNEST_VIEW_ITEM.

Definition at line 106 of file view_item.h.

107  {}

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

◆ ViewGetLayers()

void LIB_SYMBOL::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 EDA_ITEM.

Definition at line 904 of file lib_symbol.cpp.

905 {
906  aCount = 6;
907  aLayers[0] = LAYER_DEVICE;
908  aLayers[1] = LAYER_DEVICE_BACKGROUND;
909  aLayers[2] = LAYER_REFERENCEPART;
910  aLayers[3] = LAYER_VALUEPART;
911  aLayers[4] = LAYER_FIELDS;
912  aLayers[5] = LAYER_SELECTION_SHADOWS;
913 }

References LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_FIELDS, LAYER_REFERENCEPART, LAYER_SELECTION_SHADOWS, and LAYER_VALUEPART.

◆ 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 FP_ZONE, PAD, FOOTPRINT, PCB_VIA, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

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(), PCB_GRID_HELPER::queryVisible(), and PCB_SELECTION_TOOL::Selectable().

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT LIB_SYMBOL::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtual

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 scanTypes[], 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.
scanTypesWhich# KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 1214 of file lib_symbol.cpp.

1216 {
1217  // The part itself is never inspected, only its children
1218  for( LIB_ITEM& item : m_drawings )
1219  {
1220  if( item.IsType( aFilterTypes ) )
1221  {
1222  if( aInspector( &item, aTestData ) == SEARCH_RESULT::QUIT )
1223  return SEARCH_RESULT::QUIT;
1224  }
1225  }
1226 
1227  return SEARCH_RESULT::CONTINUE;
1228 }
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:698

References CONTINUE, m_drawings, and QUIT.

Member Data Documentation

◆ m_description

wxString LIB_SYMBOL::m_description
private

Definition at line 702 of file lib_symbol.h.

Referenced by Compare(), Flatten(), GetDescription(), LIB_SYMBOL(), operator=(), and SetDescription().

◆ m_drawings

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_fpFilters

wxArrayString LIB_SYMBOL::m_fpFilters
private

List of suitable footprint names for the symbol (wild card names accepted).

Definition at line 704 of file lib_symbol.h.

Referenced by Compare(), Flatten(), GetFPFilters(), LIB_SYMBOL(), operator=(), and SetFPFilters().

◆ m_includeInBom

bool LIB_SYMBOL::m_includeInBom
private

Definition at line 694 of file lib_symbol.h.

Referenced by Compare(), GetIncludeInBom(), LIB_SYMBOL(), operator=(), and SetIncludeInBom().

◆ m_includeOnBoard

bool LIB_SYMBOL::m_includeOnBoard
private

Definition at line 695 of file lib_symbol.h.

Referenced by Compare(), GetIncludeOnBoard(), LIB_SYMBOL(), operator=(), and SetIncludeOnBoard().

◆ m_keyWords

wxString LIB_SYMBOL::m_keyWords
private

Search keywords.

Definition at line 703 of file lib_symbol.h.

Referenced by Compare(), Flatten(), GetKeyWords(), LIB_SYMBOL(), operator=(), and SetKeyWords().

◆ m_lastModDate

timestamp_t LIB_SYMBOL::m_lastModDate
private

Definition at line 683 of file lib_symbol.h.

Referenced by GetLastModDate(), LIB_SYMBOL(), and operator=().

◆ m_libId

LIB_ID LIB_SYMBOL::m_libId
private

◆ m_library

SYMBOL_LIB* LIB_SYMBOL::m_library
private

Definition at line 700 of file lib_symbol.h.

Referenced by Duplicate(), GetLib(), GetLibraryName(), LIB_SYMBOL(), operator=(), and SetLib().

◆ m_me

LIB_SYMBOL_SPTR LIB_SYMBOL::m_me
private

Definition at line 680 of file lib_symbol.h.

Referenced by Compare(), and SharedPtr().

◆ m_name

wxString LIB_SYMBOL::m_name
private

Definition at line 701 of file lib_symbol.h.

Referenced by Compare(), Flatten(), GetName(), LIB_SYMBOL(), operator=(), and SetName().

◆ m_options

LIBRENTRYOPTIONS LIB_SYMBOL::m_options
private

Special symbol features such as POWER or NORMAL.)

Definition at line 696 of file lib_symbol.h.

Referenced by Compare(), IsNormal(), IsPower(), LIB_SYMBOL(), operator=(), SetNormal(), and SetPower().

◆ m_parent

LIB_SYMBOL_REF LIB_SYMBOL::m_parent
private

Use for inherited symbols.

Definition at line 681 of file lib_symbol.h.

Referenced by Compare(), Flatten(), GetDescription(), GetFPFilters(), GetKeyWords(), GetParent(), GetPins(), GetUnitCount(),