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
 
void ClearCaches ()
 
virtual wxString GetClass () const override
 Return the class name. More...
 
virtual void SetName (const wxString &aName)
 
wxString GetName () const override
 
LIB_IDLibId ()
 
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
 
wxString GetFootprint () override
 For items with footprint fields. More...
 
void GetChooserFields (std::map< wxString, wxString > &aColumnMap) override
 Retrieves a key/value map of the fields on this item that should be exposed to the library browser/chooser for displaying in columns, searching, etc. More...
 
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 BOX2I GetUnitBoundingBox (int aUnit, int aConvert) const
 Get the bounding box for the symbol. More...
 
const BOX2I GetBodyBoundingBox (int aUnit, int aConvert, bool aIncludePins, bool aIncludePrivateItems) const
 Get the symbol bounding box excluding fields. More...
 
const BOX2I 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 VECTOR2I &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
 Print symbol. More...
 
void Plot (PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
 Plot lib symbol to plotter. More...
 
void PlotLibFields (PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed)
 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 VECTOR2I &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...
 
int GetMaxPinNumber () const
 
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 VECTOR2I &aPoint)
 Locate a draw object. More...
 
LIB_ITEMLocateDrawItem (int aUnit, int aConvert, KICAD_T aType, const VECTOR2I &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
 
INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) 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 HasUnitDisplayName (int aUnit) override
 Return true if the given unit aUnit has a display name defined. More...
 
wxString GetUnitDisplayName (int aUnit) override
 Return the user-defined display name for aUnit for symbols with units. More...
 
void CopyUnitDisplayNames (std::map< int, wxString > &aTarget) const
 Copy all unit display names into the given map aTarget. More...
 
void SetUnitDisplayName (int aUnit, const wxString &aName)
 Set the user-defined display name for aUnit to aName 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...
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
virtual bool RenderAsBitmap (double aWorldScale) const
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
virtual bool IsType (const std::vector< KICAD_T > &aScanTypes) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual 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 VECTOR2I &aPosition, int aAccuracy=0) const
 Test if aPosition is inside or on the boundary of this item. More...
 
virtual bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects this item. More...
 
virtual VECTOR2I GetPosition () const
 
virtual void SetPosition (const VECTOR2I &aPos)
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
wxString GetTypeDesc ()
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual wxString GetSelectMenuText (UNITS_PROVIDER *aUnitsProvider) 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 EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
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) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

bool Matches (const wxString &aText, const EDA_SEARCH_DATA &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...
 
std::map< int, wxString > m_unitDisplayNames
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

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 97 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 100 of file lib_symbol.cpp.

100 :
102 m_me( this, null_deleter() ),
103 m_includeInBom( true ),
104 m_includeOnBoard( true )
105{
106 m_lastModDate = 0;
107 m_unitCount = 1;
110 m_unitsLocked = false;
111 m_showPinNumbers = true;
112 m_showPinNames = true;
113
114 // Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
115 // when the field editors are invoked.
116 m_drawings[LIB_FIELD_T].reserve( 4 );
121
122 SetName( aName );
123
124 if( aParent )
125 SetParent( aParent );
126
127 SetLib( aLibrary );
128}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: eda_item.cpp:36
Field object used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Definition: lib_symbol.h:742
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
Definition: lib_symbol.h:740
LIB_SYMBOL_SPTR m_me
Definition: lib_symbol.h:724
bool m_includeInBom
Definition: lib_symbol.h:738
void SetParent(LIB_SYMBOL *aParent=nullptr)
Definition: lib_symbol.cpp:451
int m_pinNameOffset
The offset in mils to draw the pin name.
Definition: lib_symbol.h:733
bool m_showPinNumbers
Definition: lib_symbol.h:736
timestamp_t m_lastModDate
Definition: lib_symbol.h:727
bool m_includeOnBoard
Definition: lib_symbol.h:739
void SetLib(SYMBOL_LIB *aLibrary)
Definition: lib_symbol.h:188
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
Definition: lib_symbol.h:730
int m_unitCount
Number of units (parts) per package.
Definition: lib_symbol.h:729
virtual void SetName(const wxString &aName)
Definition: lib_symbol.cpp:441
bool m_showPinNames
Definition: lib_symbol.h:735
void push_back(T *aItem)
Definition: multivector.h:174
#define DEFAULT_PIN_NAME_OFFSET
The intersheets references prefix string.
@ ENTRY_NORMAL
Definition: lib_symbol.h:53
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
Definition: lib_symbol.cpp:93
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ LIB_SYMBOL_T
Definition: typeinfo.h:197
@ LIB_FIELD_T
Definition: typeinfo.h:208

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, EDA_IU_SCALE::MilsToIU(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), REFERENCE_FIELD, schIUScale, 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 131 of file lib_symbol.cpp.

131 :
132 EDA_ITEM( aSymbol ),
133 m_me( this, null_deleter() )
134{
135 LIB_ITEM* newItem;
136
137 m_library = aLibrary;
138 m_name = aSymbol.m_name;
139 m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
140 m_unitCount = aSymbol.m_unitCount;
148 m_options = aSymbol.m_options;
149 m_libId = aSymbol.m_libId;
151 m_keyWords = aSymbol.m_keyWords;
152
154
156
157 for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
158 {
159 if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
160 continue;
161
162 try
163 {
164 newItem = (LIB_ITEM*) oldItem.Clone();
165 newItem->ClearSelected();
166 newItem->SetParent( this );
167 m_drawings.push_back( newItem );
168 }
169 catch( ... )
170 {
171 wxFAIL_MSG( "Failed to clone LIB_ITEM." );
172 return;
173 }
174 }
175
176 LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
177
178 if( parent )
179 SetParent( parent.get() );
180}
void ClearSelected()
Definition: eda_item.h:121
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:144
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
std::map< int, wxString > m_unitDisplayNames
Definition: lib_symbol.h:757
SYMBOL_LIB * m_library
Definition: lib_symbol.h:744
wxString m_name
Definition: lib_symbol.h:745
wxString m_keyWords
Search keywords.
Definition: lib_symbol.h:747
LIB_ID m_libId
Definition: lib_symbol.h:726
wxString m_description
Definition: lib_symbol.h:746
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
Definition: lib_symbol.h:748
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
Definition: lib_symbol.h:725
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
Definition: lib_symbol.cpp:416
#define IS_NEW
New item, just created.
#define STRUCT_DELETED
flag indication structures to be erased
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
Definition: lib_symbol.h:44

References EDA_ITEM::ClearSelected(), EDA_ITEM::Clone(), CopyUnitDisplayNames(), 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_unitDisplayNames, 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()

◆ AddField()

void LIB_SYMBOL::AddField ( LIB_FIELD aField)

Add a field.

Takes ownership of the pointer.

Definition at line 1051 of file lib_symbol.cpp.

1052{
1053 AddDrawItem( aField );
1054}
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:810

References AddDrawItem().

Referenced by SCH_DATABASE_PLUGIN::loadSymbolFromRow(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 122 of file eda_item.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearCaches()

void LIB_SYMBOL::ClearCaches ( )

Definition at line 530 of file lib_symbol.cpp.

531{
532 for( LIB_ITEM& item : m_drawings )
533 {
534 if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( &item ) )
535 {
536 eda_text->ClearBoundingBoxCache();
537 eda_text->ClearRenderCache();
538 }
539 }
540}
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72

References m_drawings.

Referenced by SYMBOL_EDIT_FRAME::CommonSettingsChanged(), and SYMBOL_EDIT_FRAME::HardRedraw().

◆ ClearEditFlags()

void LIB_SYMBOL::ClearEditFlags ( )

Definition at line 1279 of file lib_symbol.cpp.

1280{
1281 for( LIB_ITEM& item : m_drawings )
1282 item.ClearEditFlags();
1283}

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

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

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), 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(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE_ON_MOVE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void LIB_SYMBOL::ClearTempFlags ( )

Clears the status flag all draw objects in this symbol.

Definition at line 1272 of file lib_symbol.cpp.

1273{
1274 for( LIB_ITEM& item : m_drawings )
1275 item.ClearTempFlags();
1276}

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

Definition at line 82 of file eda_item.cpp.

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

References EDA_ITEM::GetClass().

Referenced by SCH_EDIT_FRAME::AddCopyForRepeatItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_DIMENSION_BASE::GetEffectiveShape(), LIB_SYMBOL(), new_clone(), operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SetConversion(), SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_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 237 of file lib_symbol.cpp.

238{
239 if( m_me == aRhs.m_me )
240 return 0;
241
242 int retv = 0;
243
244 if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 )
245 {
246 retv = m_name.Cmp( aRhs.m_name );
247
248 if( retv )
249 return retv;
250
251 retv = m_libId.compare( aRhs.m_libId );
252
253 if( retv )
254 return retv;
255 }
256
257 if( m_parent.lock() < aRhs.m_parent.lock() )
258 return -1;
259
260 if( m_parent.lock() > aRhs.m_parent.lock() )
261 return 1;
262
263 if( m_options != aRhs.m_options )
264 return ( m_options == ENTRY_NORMAL ) ? -1 : 1;
265
266 if( m_unitCount != aRhs.m_unitCount )
267 return m_unitCount - aRhs.m_unitCount;
268
269 if( m_drawings.size() != aRhs.m_drawings.size() )
270 return m_drawings.size() - aRhs.m_drawings.size();
271
274
275 while( lhsItemIt != m_drawings.end() )
276 {
277 const LIB_ITEM* lhsItem = static_cast<const LIB_ITEM*>( &(*lhsItemIt) );
278 const LIB_ITEM* rhsItem = static_cast<const LIB_ITEM*>( &(*rhsItemIt) );
279
280 wxCHECK( lhsItem && rhsItem, lhsItem - rhsItem );
281
282 if( lhsItem->Type() != rhsItem->Type() )
283 return lhsItem->Type() - rhsItem->Type();
284
285 // Non-mandatory fields are a special case. They can have different ordinal numbers
286 // and are compared separately below.
287 if( lhsItem->Type() == LIB_FIELD_T )
288 {
289 const LIB_FIELD* lhsField = static_cast<const LIB_FIELD*>( lhsItem );
290
291 if( lhsField->GetId() == VALUE_FIELD )
292 {
293 if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 || IsPower() )
294 retv = lhsItem->compare( *rhsItem, aCompareFlags );
295 }
296 else if( lhsField->IsMandatory() )
297 {
298 retv = lhsItem->compare( *rhsItem, aCompareFlags );
299 }
300 }
301 else
302 {
303 retv = lhsItem->compare( *rhsItem, aCompareFlags );
304 }
305
306 if( retv )
307 return retv;
308
309 ++lhsItemIt;
310 ++rhsItemIt;
311 }
312
313 // Compare the optional fields.
314 for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
315 {
316 const LIB_FIELD* field = dynamic_cast<const LIB_FIELD*>( &item );
317
318 wxCHECK2( field, continue );
319
320 // Mandatory fields were already compared above.
321 if( field->IsMandatory() )
322 continue;
323
324 const LIB_FIELD* foundField = aRhs.FindField( field->GetName() );
325
326 if( foundField == nullptr )
327 return 1;
328
329 retv = item.compare( static_cast<const LIB_ITEM&>( *foundField ), aCompareFlags );
330
331 if( retv )
332 return retv;
333 }
334
335 if( m_fpFilters.GetCount() != aRhs.m_fpFilters.GetCount() )
336 return m_fpFilters.GetCount() - aRhs.m_fpFilters.GetCount();
337
338 for( size_t i = 0; i < m_fpFilters.GetCount(); i++ )
339 {
340 retv = m_fpFilters[i].Cmp( aRhs.m_fpFilters[i] );
341
342 if( retv )
343 return retv;
344 }
345
346 retv = m_description.Cmp( aRhs.m_description );
347
348 if( retv )
349 return retv;
350
351 retv = m_keyWords.Cmp( aRhs.m_keyWords );
352
353 if( retv )
354 return retv;
355
356 if( m_pinNameOffset != aRhs.m_pinNameOffset )
357 return m_pinNameOffset - aRhs.m_pinNameOffset;
358
359 if( m_unitsLocked != aRhs.m_unitsLocked )
360 return ( m_unitsLocked ) ? 1 : -1;
361
362 if( ( aCompareFlags & LIB_ITEM::COMPARE_FLAGS::ERC ) == 0 )
363 {
364 if( m_showPinNames != aRhs.m_showPinNames )
365 return ( m_showPinNames ) ? 1 : -1;
366
368 return ( m_showPinNumbers ) ? 1 : -1;
369
370 if( m_includeInBom != aRhs.m_includeInBom )
371 return ( m_includeInBom ) ? 1 : -1;
372
374 return ( m_includeOnBoard ) ? 1 : -1;
375 }
376
377 // Compare unit display names
379 {
380 return -1;
381 }
382 else if( m_unitDisplayNames > aRhs.m_unitDisplayNames )
383 {
384 return 1;
385 }
386
387 return 0;
388}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
Definition: lib_field.cpp:459
bool IsMandatory() const
Definition: lib_field.cpp:563
int GetId() const
Definition: lib_field.h:115
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:220
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:159
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74
bool IsPower() const
Definition: lib_symbol.cpp:552
LIB_FIELD * FindField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:225
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
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:194
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:188

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), LIB_ID::compare(), LIB_ITEM::compare(), LIB_FIELD::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_unitDisplayNames, 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==().

◆ CopyUnitDisplayNames()

void LIB_SYMBOL::CopyUnitDisplayNames ( std::map< int, wxString > &  aTarget) const

Copy all unit display names into the given map aTarget.

Definition at line 416 of file lib_symbol.cpp.

417{
418 for( const auto& it : m_unitDisplayNames )
419 {
420 aTarget[it.first] = it.second;
421 }
422}

References m_unitDisplayNames.

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

◆ deleteAllFields()

void LIB_SYMBOL::deleteAllFields ( )
private

Definition at line 1045 of file lib_symbol.cpp.

1046{
1048}
void clear(int aType=UNDEFINED_TYPE)
Definition: multivector.h:212

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 113 of file lib_symbol.h.

114 {
115 LIB_SYMBOL* dupe = new LIB_SYMBOL( *this, m_library );
116 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
117
118 for( LIB_ITEM& item : dupe->m_drawings )
119 const_cast<KIID&>( item.m_Uuid ) = KIID();
120
121 return dupe;
122 }
const KIID m_Uuid
Definition: eda_item.h:492
Definition: kiid.h:47
Define a library symbol object.
Definition: lib_symbol.h:98
LIB_SYMBOL(const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
Definition: lib_symbol.cpp:100

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

Referenced by SCH_DATABASE_PLUGIN::loadSymbolFromRow().

◆ 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 1122 of file lib_symbol.cpp.

1123{
1124 for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1125 {
1126 if( static_cast<LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
1127 return static_cast<LIB_FIELD*>( &item );
1128 }
1129
1130 return nullptr;
1131}

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_LIB_PLUGIN_CACHE::removeSymbol(), and FOOTPRINT_INFO_GENERATOR::SetHtmlFieldTable().

◆ FindField() [2/2]

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

Definition at line 1134 of file lib_symbol.cpp.

1135{
1136 for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1137 {
1138 if( static_cast<const LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
1139 return static_cast<const LIB_FIELD*>( &item );
1140 }
1141
1142 return nullptr;
1143}

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 460 of file lib_symbol.cpp.

461{
462 std::unique_ptr< LIB_SYMBOL > retv;
463
464 if( IsAlias() )
465 {
466 LIB_SYMBOL_SPTR parent = m_parent.lock();
467
468 wxCHECK_MSG( parent, retv,
469 wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
470
471 // Copy the parent.
472 retv.reset( new LIB_SYMBOL( *parent.get() ) );
473
474 retv->m_name = m_name;
475 retv->SetLibId( m_libId );
476
477 // Now add the inherited part mandatory field (this) information.
478 for( int i = 0; i < MANDATORY_FIELDS; i++ )
479 {
480 wxString tmp = GetFieldById( i )->GetText();
481
482 // If the field isn't defined then inherit the parent field value.
483 if( tmp.IsEmpty() )
484 retv->GetFieldById( i )->SetText( parent->GetFieldById( i )->GetText() );
485 else
486 *retv->GetFieldById( i ) = *GetFieldById( i );
487 }
488
489 // Grab all the rest of derived symbol fields.
490 for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
491 {
492 const LIB_FIELD* aliasField = dynamic_cast<const LIB_FIELD*>( &item );
493
494 wxCHECK2( aliasField, continue );
495
496 // Mandatory fields were already resolved.
497 if( aliasField->IsMandatory() )
498 continue;
499
500 LIB_FIELD* newField = new LIB_FIELD( *aliasField );
501 newField->SetParent( retv.get() );
502
503 LIB_FIELD* parentField = retv->FindField( aliasField->GetName() );
504
505 if( !parentField ) // Derived symbol field does not exist in parent symbol.
506 {
507 retv->AddDrawItem( newField );
508 }
509 else // Derived symbol field overrides the parent symbol field.
510 {
511 retv->RemoveDrawItem( parentField );
512 retv->AddDrawItem( newField );
513 }
514 }
515
516 retv->SetKeyWords( m_keyWords.IsEmpty() ? parent->GetKeyWords() : m_keyWords );
517 retv->SetDescription( m_description.IsEmpty() ? parent->GetDescription() : m_description );
518 retv->SetFPFilters( m_fpFilters.IsEmpty() ? parent->GetFPFilters() : m_fpFilters );
519 retv->UpdateFieldOrdinals();
520 }
521 else
522 {
523 retv.reset( new LIB_SYMBOL( *this ) );
524 }
525
526 return retv;
527}
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
bool IsAlias() const
Definition: lib_symbol.h:183
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
@ MANDATORY_FIELDS
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.

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(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), 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]

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

Definition at line 104 of file inspectable.h.

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

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

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

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

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

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

◆ Get() [3/3]

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

Definition at line 92 of file inspectable.h.

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

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

◆ GetBodyBoundingBox()

const BOX2I LIB_SYMBOL::GetBodyBoundingBox ( int  aUnit,
int  aConvert,
bool  aIncludePins,
bool  aIncludePrivateItems 
) 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 1001 of file lib_symbol.cpp.

1003{
1004 BOX2I bbox;
1005
1006 for( const LIB_ITEM& item : m_drawings )
1007 {
1008 if( item.m_unit > 0 && aUnit > 0 && aUnit != item.m_unit )
1009 continue;
1010
1011 if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
1012 continue;
1013
1014 if( item.IsPrivate() && !aIncludePrivateItems )
1015 continue;
1016
1017 if( item.Type() == LIB_FIELD_T )
1018 continue;
1019
1020 if( item.Type() == LIB_PIN_T )
1021 {
1022 const LIB_PIN& pin = static_cast<const LIB_PIN&>( item );
1023
1024 if( pin.IsVisible() )
1025 {
1026 // Note: the roots of the pins are always included for symbols that don't have
1027 // a well-defined body.
1028
1029 if( aIncludePins )
1030 bbox.Merge( pin.GetBoundingBox( false, false, false ) );
1031 else
1032 bbox.Merge( pin.GetPinRoot() );
1033 }
1034 }
1035 else
1036 {
1037 bbox.Merge( item.GetBoundingBox() );
1038 }
1039 }
1040
1041 return bbox;
1042}
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
@ LIB_PIN_T
Definition: typeinfo.h:202

References LIB_FIELD_T, LIB_PIN_T, m_drawings, BOX2< Vec >::Merge(), and pin.

Referenced by SCH_SYMBOL::doGetBoundingBox().

◆ GetBoundingBox()

const BOX2I 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 232 of file lib_symbol.h.

233 {
234 return GetUnitBoundingBox( 0, 0 );
235 }
const BOX2I GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Definition: lib_symbol.cpp:962

References GetUnitBoundingBox().

◆ GetChooserFields()

void LIB_SYMBOL::GetChooserFields ( std::map< wxString, wxString > &  aColumnMap)
overridevirtual

Retrieves a key/value map of the fields on this item that should be exposed to the library browser/chooser for displaying in columns, searching, etc.

Reimplemented from LIB_TREE_ITEM.

Definition at line 73 of file lib_symbol.cpp.

74{
75 for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
76 {
77 LIB_FIELD* field = static_cast<LIB_FIELD*>( &item );
78
79 if( field->ShowInChooser() )
80 aColumnMap[field->GetName()] = field->EDA_TEXT::GetShownText();
81 }
82}
bool ShowInChooser() const
Definition: lib_field.h:187

References LIB_FIELD::GetName(), LIB_FIELD_T, m_drawings, and LIB_FIELD::ShowInChooser().

Referenced by GetSearchText().

◆ GetClass()

virtual wxString LIB_SYMBOL::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 130 of file lib_symbol.h.

131 {
132 return wxT( "LIB_SYMBOL" );
133 }

◆ GetDatasheetField()

LIB_FIELD & LIB_SYMBOL::GetDatasheetField ( )

◆ GetDescription()

wxString LIB_SYMBOL::GetDescription ( )
inlineoverridevirtual

◆ GetDrawItems() [1/2]

◆ GetDrawItems() [2/2]

const LIB_ITEMS_CONTAINER & LIB_SYMBOL::GetDrawItems ( ) const
inline

Definition at line 508 of file lib_symbol.h.

508{ return m_drawings; }

References m_drawings.

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 147 of file eda_item.h.

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

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

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

◆ 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 1108 of file lib_symbol.cpp.

1109{
1110 for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1111 {
1112 LIB_FIELD* field = ( LIB_FIELD* ) &item;
1113
1114 if( field->GetId() == aId )
1115 return field;
1116 }
1117
1118 return nullptr;
1119}

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(), SCH_EAGLE_PLUGIN::loadInstance(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), DIALOG_CHANGE_SYMBOLS::processSymbol(), SYMBOL_EDITOR_CONTROL::RenameSymbol(), and DIALOG_CHOOSE_SYMBOL::ShowFootprintFor().

◆ GetFieldCount()

size_t LIB_SYMBOL::GetFieldCount ( ) const
inline

◆ 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 1074 of file lib_symbol.cpp.

1075{
1076 // Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
1077 for( int id = 0; id < MANDATORY_FIELDS; ++id )
1078 aList.push_back( GetFieldById( id ) );
1079
1080 // Now grab all the rest of fields.
1081 for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1082 {
1083 LIB_FIELD* field = static_cast<LIB_FIELD*>( &item );
1084
1085 if( !field->IsMandatory() )
1086 aList.push_back( field );
1087 }
1088}

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

Referenced by SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SCH_EAGLE_PLUGIN::loadInstance(), 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 1091 of file lib_symbol.cpp.

1092{
1093 // Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
1094 for( int id = 0; id < MANDATORY_FIELDS; ++id )
1095 aList.push_back( *GetFieldById( id ) );
1096
1097 // Now grab all the rest of fields.
1098 for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1099 {
1100 LIB_FIELD* field = static_cast<LIB_FIELD*>( &item );
1101
1102 if( !field->IsMandatory() )
1103 aList.push_back( *field );
1104 }
1105}

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFootprint()

wxString LIB_SYMBOL::GetFootprint ( )
inlineoverridevirtual

For items with footprint fields.

Reimplemented from LIB_TREE_ITEM.

Definition at line 172 of file lib_symbol.h.

173 {
174 return GetFootprintField().GetText();
175 }
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.

References GetFootprintField(), and EDA_TEXT::GetText().

◆ GetFootprintField()

LIB_FIELD & LIB_SYMBOL::GetFootprintField ( )

Return reference to the footprint field.

Definition at line 1162 of file lib_symbol.cpp.

1163{
1165 wxASSERT( field != nullptr );
1166 return *field;
1167}

References FOOTPRINT_FIELD, and GetFieldById().

Referenced by GetFootprint(), GetSearchText(), SCH_DATABASE_PLUGIN::loadSymbolFromRow(), and CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ GetFPFilters()

wxArrayString LIB_SYMBOL::GetFPFilters ( ) const
inline

Definition at line 194 of file lib_symbol.h.

195 {
196 if( m_fpFilters.IsEmpty() && IsAlias() )
197 {
198 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
199 return parent->GetFPFilters();
200 }
201
202 return m_fpFilters;
203 }

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

◆ GetLastModDate()

timestamp_t LIB_SYMBOL::GetLastModDate ( ) const
inline

Definition at line 190 of file lib_symbol.h.

190{ return m_lastModDate; }

References m_lastModDate.

Referenced by SCH_LEGACY_PLUGIN_CACHE::SaveSymbol().

◆ GetLib()

SYMBOL_LIB * LIB_SYMBOL::GetLib ( ) const
inline

Definition at line 187 of file lib_symbol.h.

187{ return m_library; }

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 142 of file lib_symbol.h.

142{ return GetLibraryName(); }
const wxString GetLibraryName() const
Definition: lib_symbol.cpp:543

References GetLibraryName().

Referenced by SYMBOL_EDIT_FRAME::IsSymbolFromLegacyLibrary().

◆ GetLibraryName()

const wxString LIB_SYMBOL::GetLibraryName ( ) const

Definition at line 543 of file lib_symbol.cpp.

544{
545 if( m_library )
546 return m_library->GetName();
547
548 return m_libId.GetLibNickname();
549}
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
const wxString GetName() const
Return the file name without path or extension.

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

Referenced by GetLibNickname().

◆ GetMaxPinNumber()

int LIB_SYMBOL::GetMaxPinNumber ( ) const
Returns
the highest pin number of the symbol's pins. If none of the pins has pin number assigned it returns 0.

Definition at line 1250 of file lib_symbol.cpp.

1251{
1252 int maxPinNumber = 0;
1253 LIB_SYMBOL_SPTR parent = m_parent.lock();
1254 const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
1255
1256 for( const LIB_ITEM& item : drawItems[LIB_PIN_T] )
1257 {
1258 const LIB_PIN* pin = static_cast<const LIB_PIN*>( &item );
1259 long currentPinNumber = 0;
1260 bool isNum = pin->GetNumber().ToLong( &currentPinNumber );
1261
1262 if( isNum && currentPinNumber > maxPinNumber )
1263 {
1264 maxPinNumber = currentPinNumber;
1265 }
1266 }
1267
1268 return maxPinNumber;
1269}

References LIB_PIN_T, m_drawings, m_parent, and pin.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::Duplicate().

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

Definition at line 269 of file eda_item.cpp.

270{
271 return BITMAPS::dummy_item;
272}

References dummy_item.

Referenced by SELECTION_TOOL::doSelectionMenu().

◆ GetMsgPanelInfo()

◆ GetName()

wxString LIB_SYMBOL::GetName ( void  ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 136 of file lib_symbol.h.

136{ return m_name; }

References m_name.

Referenced by SCH_LIB_PLUGIN_CACHE::AddSymbol(), 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_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(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), SYMBOL_LIB::RemoveSymbol(), SYMBOL_LIB::ReplaceSymbol(), SYMBOL_LIBRARY_MANAGER::RevertSymbol(), 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 1206 of file lib_symbol.cpp.

1207{
1208 int retv = MANDATORY_FIELDS;
1209
1210 while( GetFieldById( retv ) )
1211 retv += 1;
1212
1213 return retv;
1214}

References GetFieldById(), and MANDATORY_FIELDS.

Referenced by SCH_DATABASE_PLUGIN::loadSymbolFromRow(), and 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 821 of file lib_symbol.cpp.

822{
823 if( aItem == nullptr )
824 {
826
827 return (it1 != m_drawings.end( aType ) ) ? &( *( m_drawings.begin( aType ) ) ) : nullptr;
828 }
829
830 // Search for the last item, assume aItem is of type aType
831 wxASSERT( ( aType == TYPE_NOT_INIT ) || ( aType == aItem->Type() ) );
833
834 while( ( it != m_drawings.end( aType ) ) && ( aItem != &( *it ) ) )
835 ++it;
836
837 // Search the next item
838 if( it != m_drawings.end( aType ) )
839 {
840 ++it;
841
842 if( it != m_drawings.end( aType ) )
843 return &( *it );
844 }
845
846 return nullptr;
847}
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
@ TYPE_NOT_INIT
Definition: typeinfo.h:81

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 400 of file lib_symbol.h.

401 {
402 return (LIB_PIN*) GetNextDrawItem( (LIB_ITEM*) aItem, LIB_PIN_T );
403 }
LIB_ITEM * GetNextDrawItem(const LIB_ITEM *aItem=nullptr, KICAD_T aType=TYPE_NOT_INIT)
Return the next draw object pointer.
Definition: lib_symbol.cpp:821

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 126 of file lib_symbol.h.

126{ return m_parent; }

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 877 of file lib_symbol.cpp.

878{
879 LIB_PINS pinList;
880
881 GetPins( pinList, aUnit, aConvert );
882
883 for( size_t i = 0; i < pinList.size(); i++ )
884 {
885 wxASSERT( pinList[i]->Type() == LIB_PIN_T );
886
887 if( aNumber == pinList[i]->GetNumber() )
888 return pinList[i];
889 }
890
891 return nullptr;
892}
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:850
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:54

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

◆ GetPinCount()

size_t LIB_SYMBOL::GetPinCount ( ) const
inline

◆ 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 850 of file lib_symbol.cpp.

851{
852 /* Notes:
853 * when aUnit == 0: no unit filtering
854 * when aConvert == 0: no convert (shape selection) filtering
855 * when m_unit == 0, the body item is common to units
856 * when m_convert == 0, the body item is common to shapes
857 */
858
859 LIB_SYMBOL_SPTR parent = m_parent.lock();
860 const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
861
862 for( const LIB_ITEM& item : drawItems[LIB_PIN_T] )
863 {
864 // Unit filtering:
865 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
866 continue;
867
868 // Shape filtering:
869 if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
870 continue;
871
872 aList.push_back( (LIB_PIN*) &item );
873 }
874}

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

Referenced by CheckLibSymbol(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), GetPin(), PinsConflictWith(), SCH_SYMBOL::Plot(), SCH_SYMBOL::PlotPins(), and DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector().

◆ GetPosition()

virtual VECTOR2I EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

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

Definition at line 249 of file eda_item.h.

249{ return VECTOR2I(); }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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

◆ GetReferenceField()

LIB_FIELD & LIB_SYMBOL::GetReferenceField ( )

◆ 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 // TODO(JE) rework this later so we can highlight matches in their column
63 std::map<wxString, wxString> fields;
64 GetChooserFields( fields );
65
66 for( const auto& it : fields )
67 text += discount + it.second;
68
69 return text;
70}
wxString GetKeyWords() const
Definition: lib_symbol.h:159
void GetChooserFields(std::map< wxString, wxString > &aColumnMap) override
Retrieves a key/value map of the fields on this item that should be exposed to the library browser/ch...
Definition: lib_symbol.cpp:73
wxString GetDescription() override
Definition: lib_symbol.h:146

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

◆ GetSelectMenuText()

wxString EDA_ITEM::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) 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 LIB_FIELD, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_WIRE_ENTRY, SCH_BUS_BUS_ENTRY, SCH_FIELD, SCH_JUNCTION, SCH_LABEL, SCH_DIRECTIVE_LABEL, SCH_GLOBALLABEL, SCH_HIERLABEL, SCH_LINE, SCH_MARKER, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, DELETED_SHEET_ITEM, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, GERBER_DRAW_ITEM, DELETED_BOARD_ITEM, DS_DRAW_ITEM_LINE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_PAGE, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, PCB_GROUP, BOARD, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_MARKER, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, and ZONE.

Definition at line 108 of file eda_item.cpp.

109{
110 wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
111 GetClass() );
112
113 return wxString( wxT( "Undefined menu text for " ) + GetClass() );
114}

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::collectAllDriverValues(), DIALOG_GROUP_PROPERTIES::DoAddMember(), SELECTION_TOOL::doSelectionMenu(), DRC_ENGINE::EvalRules(), BOARD_INSPECTION_TOOL::getItemDescription(), PCB_MARKER::GetMsgPanelInfo(), RC_TREE_MODEL::GetValue(), RC_ITEM::ShowReport(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and PCB_CONTROL::UpdateMessagePanel().

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

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

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

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 126 of file eda_item.h.

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

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 139 of file eda_item.h.

139{ return m_status; }

References EDA_ITEM::m_status.

◆ GetSubpartFirstId()

static int LIB_SYMBOL::GetSubpartFirstId ( )
inlinestatic

Definition at line 575 of file lib_symbol.h.

575{ 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:754

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 569 of file lib_symbol.h.

569{ 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:751

References m_subpartIdSeparator.

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

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( )
inherited

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

Definition at line 301 of file eda_item.cpp.

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

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

Referenced by PROPERTIES_PANEL::update().

◆ 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 1521 of file lib_symbol.cpp.

1522{
1523 int unitNum;
1524 size_t i;
1525 struct LIB_SYMBOL_UNIT unit;
1526 std::vector<LIB_ITEM*> compareDrawItems;
1527 std::vector<LIB_ITEM*> currentDrawItems;
1528 std::vector<struct LIB_SYMBOL_UNIT> uniqueUnits;
1529
1530 // The first unit is guaranteed to be unique so always include it.
1531 unit.m_unit = 1;
1532 unit.m_convert = 1;
1533 unit.m_items = GetUnitDrawItems( 1, 1 );
1534
1535 // There are no unique units if there are no draw items other than fields.
1536 if( unit.m_items.size() == 0 )
1537 return uniqueUnits;
1538
1539 uniqueUnits.emplace_back( unit );
1540
1541 if( ( GetUnitCount() == 1 || UnitsLocked() ) && !HasConversion() )
1542 return uniqueUnits;
1543
1544 currentDrawItems = unit.m_items;
1545
1546 for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1547 {
1548 compareDrawItems = GetUnitDrawItems( unitNum, 1 );
1549
1550 wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1551 "Multiple unit symbol defined with empty units." );
1552
1553 if( currentDrawItems.size() != compareDrawItems.size() )
1554 {
1555 unit.m_unit = unitNum;
1556 unit.m_convert = 1;
1557 unit.m_items = compareDrawItems;
1558 uniqueUnits.emplace_back( unit );
1559 }
1560 else
1561 {
1562 for( i = 0; i < currentDrawItems.size(); i++ )
1563 {
1564 if( currentDrawItems[i]->compare( *compareDrawItems[i],
1565 LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
1566 {
1567 unit.m_unit = unitNum;
1568 unit.m_convert = 1;
1569 unit.m_items = compareDrawItems;
1570 uniqueUnits.emplace_back( unit );
1571 }
1572 }
1573 }
1574 }
1575
1576 if( HasConversion() )
1577 {
1578 currentDrawItems = GetUnitDrawItems( 1, 2 );
1579
1580 if( ( GetUnitCount() == 1 || UnitsLocked() ) )
1581 {
1582 unit.m_unit = 1;
1583 unit.m_convert = 2;
1584 unit.m_items = currentDrawItems;
1585 uniqueUnits.emplace_back( unit );
1586
1587 return uniqueUnits;
1588 }
1589
1590 for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1591 {
1592 compareDrawItems = GetUnitDrawItems( unitNum, 2 );
1593
1594 wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1595 "Multiple unit symbol defined with empty units." );
1596
1597 if( currentDrawItems.size() != compareDrawItems.size() )
1598 {
1599 unit.m_unit = unitNum;
1600 unit.m_convert = 2;
1601 unit.m_items = compareDrawItems;
1602 uniqueUnits.emplace_back( unit );
1603 }
1604 else
1605 {
1606 for( i = 0; i < currentDrawItems.size(); i++ )
1607 {
1608 if( currentDrawItems[i]->compare( *compareDrawItems[i],
1609 LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
1610 {
1611 unit.m_unit = unitNum;
1612 unit.m_convert = 2;
1613 unit.m_items = compareDrawItems;
1614 uniqueUnits.emplace_back( unit );
1615 }
1616 }
1617 }
1618 }
1619 }
1620
1621 return uniqueUnits;
1622}
bool UnitsLocked() const
Check whether symbol units are interchangeable.
Definition: lib_symbol.h:253
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of LIB_ITEM objects separated by unit and convert number.
int GetUnitCount() const override
For items with units, return the number of units.
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
int m_unit
The unit number.
Definition: lib_symbol.h:85

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

◆ GetUnitBoundingBox()

const BOX2I 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 962 of file lib_symbol.cpp.

963{
964 BOX2I bBox; // Start with a fresh BOX2I so the Merge algorithm works
965
966 for( const LIB_ITEM& item : m_drawings )
967 {
968 if( item.m_unit > 0
969 && m_unitCount > 1
970 && aUnit > 0
971 && aUnit != item.m_unit )
972 {
973 continue;
974 }
975
976 if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
977 continue;
978
979 if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
980 continue;
981
982 bBox.Merge( item.GetBoundingBox() );
983 }
984
985 return bBox;
986}
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_field.cpp:408

References LIB_FIELD::GetBoundingBox(), LIB_FIELD_T, m_drawings, m_unitCount, and BOX2< Vec >::Merge().

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

◆ GetUnitCount()

◆ GetUnitDisplayName()

wxString LIB_SYMBOL::GetUnitDisplayName ( int  aUnit)
overridevirtual

Return the user-defined display name for aUnit for symbols with units.

Reimplemented from LIB_TREE_ITEM.

Definition at line 403 of file lib_symbol.cpp.

404{
405 if( HasUnitDisplayName( aUnit ) )
406 {
407 return m_unitDisplayNames[aUnit];
408 }
409 else
410 {
411 return wxString::Format( _( "Unit %s" ), GetUnitReference( aUnit ) );
412 }
413}
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
Definition: lib_symbol.cpp:397
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
Definition: lib_symbol.cpp:391
#define _(s)

References _, Format(), GetUnitReference(), HasUnitDisplayName(), and m_unitDisplayNames.

Referenced by SYMBOL_VIEWER_FRAME::onUpdateUnitChoice(), SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), and SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName().

◆ 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 1485 of file lib_symbol.cpp.

1486{
1487 std::vector<struct LIB_SYMBOL_UNIT> units;
1488
1489 for( LIB_ITEM& item : m_drawings )
1490 {
1491 if( item.Type() == LIB_FIELD_T )
1492 continue;
1493
1494 int unit = item.GetUnit();
1495 int convert = item.GetConvert();
1496
1497 auto it = std::find_if( units.begin(), units.end(),
1498 [unit, convert]( const LIB_SYMBOL_UNIT& a )
1499 {
1500 return a.m_unit == unit && a.m_convert == convert;
1501 } );
1502
1503 if( it == units.end() )
1504 {
1505 struct LIB_SYMBOL_UNIT newUnit;
1506 newUnit.m_unit = item.GetUnit();
1507 newUnit.m_convert = item.GetConvert();
1508 newUnit.m_items.push_back( &item );
1509 units.emplace_back( newUnit );
1510 }
1511 else
1512 {
1513 it->m_items.push_back( &item );
1514 }
1515 }
1516
1517 return units;
1518}

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 1464 of file lib_symbol.cpp.

1465{
1466 std::vector<LIB_ITEM*> unitItems;
1467
1468 for( LIB_ITEM& item : m_drawings )
1469 {
1470 if( item.Type() == LIB_FIELD_T )
1471 continue;
1472
1473 if( ( aConvert == -1 && item.GetUnit() == aUnit )
1474 || ( aUnit == -1 && item.GetConvert() == aConvert )
1475 || ( aUnit == item.GetUnit() && aConvert == item.GetConvert() ) )
1476 {
1477 unitItems.push_back( &item );
1478 }
1479 }
1480
1481 return unitItems;
1482}

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 391 of file lib_symbol.cpp.

392{
393 return LIB_SYMBOL::SubReference( aUnit, false );
394}
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Definition: lib_symbol.cpp:588

References SubReference().

Referenced by CheckLibSymbol(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), GetUnitDisplayName(), and SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName().

◆ GetValueField()

◆ 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 1230 of file lib_symbol.cpp.

1231{
1232 for( const LIB_ITEM& item : m_drawings )
1233 {
1234 if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
1235 return true;
1236 }
1237
1238 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
1239 {
1240 for( const LIB_ITEM& item : parent->GetDrawItems() )
1241 {
1242 if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
1243 return true;
1244 }
1245 }
1246
1247 return false;
1248}

References m_drawings, and m_parent.

Referenced by CheckLibSymbol(), 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()

◆ HasUnitDisplayName()

bool LIB_SYMBOL::HasUnitDisplayName ( int  aUnit)
overridevirtual

Return true if the given unit aUnit has a display name defined.

Reimplemented from LIB_TREE_ITEM.

Definition at line 397 of file lib_symbol.cpp.

398{
399 return ( m_unitDisplayNames.count( aUnit ) == 1 );
400}

References m_unitDisplayNames.

Referenced by GetUnitDisplayName(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), and SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName().

◆ HitTest() [1/2]

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

Test if aRect intersects this item.

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

Reimplemented in LIB_ITEM, LIB_PIN, LIB_SHAPE, LIB_TEXT, LIB_TEXTBOX, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_FIELD, SCH_JUNCTION, SCH_LABEL_BASE, SCH_LINE, SCH_NO_CONNECT, SCH_PIN, SCH_SHAPE, SCH_SHEET, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, DS_DRAW_ITEM_BASE, DS_DRAW_ITEM_POLYPOLYGONS, DS_DRAW_ITEM_RECT, DS_DRAW_ITEM_TEXT, DS_DRAW_ITEM_BITMAP, PCB_GROUP, FOOTPRINT, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_DIMENSION_BASE, PCB_SHAPE, PCB_TARGET, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, PCB_ARC, ZONE, and GERBER_DRAW_ITEM.

Definition at line 235 of file eda_item.h.

236 {
237 return false; // derived classes should override this function
238 }

◆ HitTest() [2/2]

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

◆ IsAlias()

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 105 of file eda_item.h.

105{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 108 of file eda_item.h.

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

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 203 of file eda_item.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsMulti()

◆ IsNew()

◆ IsNormal()

bool LIB_SYMBOL::IsNormal ( ) const

Definition at line 570 of file lib_symbol.cpp.

571{
572 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
573 return parent->m_options == ENTRY_NORMAL;
574
575 return m_options == ENTRY_NORMAL;
576}

References ENTRY_NORMAL, m_options, and m_parent.

◆ IsPower()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in LIB_TEXTBOX, SCH_FIELD, SCH_LABEL, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 420 of file eda_item.h.

420{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 109 of file eda_item.h.

109{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 112 of file eda_item.h.

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

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

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

◆ IsRoot()

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

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

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsType()

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

Check whether the item is one of the listed types.

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

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

Definition at line 183 of file eda_item.h.

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

References EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 302 of file eda_item.h.

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

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 322 of file eda_item.h.

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

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

◆ LibId()

LIB_ID & LIB_SYMBOL::LibId ( )
inline

Definition at line 138 of file lib_symbol.h.

138{ return m_libId; }

References m_libId.

Referenced by SCH_DATABASE_PLUGIN::loadSymbolFromRow().

◆ LocateDrawItem() [1/2]

LIB_ITEM * LIB_SYMBOL::LocateDrawItem ( int  aUnit,
int  aConvert,
KICAD_T  aType,
const VECTOR2I 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 1286 of file lib_symbol.cpp.

1288{
1289 for( LIB_ITEM& item : m_drawings )
1290 {
1291 if( ( aUnit && item.m_unit && aUnit != item.m_unit )
1292 || ( aConvert && item.m_convert && aConvert != item.m_convert )
1293 || ( item.Type() != aType && aType != TYPE_NOT_INIT ) )
1294 {
1295 continue;
1296 }
1297
1298 if( item.HitTest( aPoint ) )
1299 return &item;
1300 }
1301
1302 return nullptr;
1303}

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 VECTOR2I 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 1306 of file lib_symbol.cpp.

1308{
1309 /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
1310 * VECTOR2I& pt ) to search items.
1311 * because this function uses DefaultTransform as orient/mirror matrix
1312 * we temporary copy aTransform in DefaultTransform
1313 */
1314 LIB_ITEM* item;
1315 TRANSFORM transform = DefaultTransform;
1316 DefaultTransform = aTransform;
1317
1318 item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
1319
1320 // Restore matrix
1321 DefaultTransform = transform;
1322
1323 return item;
1324}
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
TRANSFORM DefaultTransform
Definition: eeschema.cpp:66

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 247 of file lib_symbol.h.

247{ m_unitsLocked = aLockUnits; }

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 EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

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

Definition at line 382 of file eda_item.h.

383 {
384 return false;
385 }

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

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 117 of file eda_item.cpp.

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

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

◆ operator!=()

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

Definition at line 667 of file lib_symbol.h.

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

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

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

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

◆ operator=()

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

Definition at line 188 of file lib_symbol.cpp.

189{
190 if( &aSymbol == this )
191 return aSymbol;
192
193 LIB_ITEM* newItem;
194
195 m_library = aSymbol.m_library;
196 m_name = aSymbol.m_name;
197 m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
198 m_unitCount = aSymbol.m_unitCount;
206 m_options = aSymbol.m_options;
207 m_libId = aSymbol.m_libId;
209 m_keyWords = aSymbol.m_keyWords;
210
211 m_unitDisplayNames.clear();
213
215
216 for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
217 {
218 if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
219 continue;
220
221 newItem = (LIB_ITEM*) oldItem.Clone();
222 newItem->SetParent( this );
223 m_drawings.push_back( newItem );
224 }
225
227
228 LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
229
230 if( parent )
231 SetParent( parent.get() );
232
233 return *this;
234}

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::clear(), EDA_ITEM::Clone(), CopyUnitDisplayNames(), 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_unitDisplayNames, 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 662 of file lib_symbol.h.

663 {
664 return Compare( aSymbol, LIB_ITEM::COMPARE_FLAGS::EQUALITY ) == 0;
665 }

References Compare().

◆ operator==() [2/2]

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

Definition at line 661 of file lib_symbol.h.

661{ return this == aSymbol; }

◆ 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 895 of file lib_symbol.cpp.

897{
898 LIB_PINS thisPinList;
899 GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
900
901 for( const LIB_PIN* eachThisPin : thisPinList )
902 {
903 wxASSERT( eachThisPin );
904 LIB_PINS otherPinList;
905 aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
906 bool foundMatch = false;
907
908 for( const LIB_PIN* eachOtherPin : otherPinList )
909 {
910 wxASSERT( eachOtherPin );
911
912 // Same unit?
913 if( eachThisPin->GetUnit() != eachOtherPin->GetUnit() )
914 continue;
915
916 // Same body stype?
917 if( eachThisPin->GetConvert() != eachOtherPin->GetConvert() )
918 continue;
919
920 // Same position?
921 if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
922 continue;
923
924 // Same number?
925 if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ) )
926 continue;
927
928 // Same name?
929 if( aTestNames && ( eachThisPin->GetName() != eachOtherPin->GetName() ) )
930 continue;
931
932 // Same electrical type?
933 if( aTestType && ( eachThisPin->GetType() != eachOtherPin->GetType() ) )
934 continue;
935
936 // Same orientation?
937 if( aTestOrientation
938 && ( eachThisPin->GetOrientation() != eachOtherPin->GetOrientation() ) )
939 continue;
940
941 // Same length?
942 if( aTestLength && ( eachThisPin->GetLength() != eachOtherPin->GetLength() ) )
943 continue;
944
945 foundMatch = true;
946 break; // Match found so search is complete.
947 }
948
949 if( !foundMatch )
950 {
951 // This means there was not an identical (according to the arguments)
952 // pin at the same position in the other symbol.
953 return true;
954 }
955 }
956
957 // The loop never gave up, so no conflicts were found.
958 return false;
959}

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,
bool  aBackground,
const VECTOR2I aOffset,
const TRANSFORM aTransform,
bool  aDimmed 
) 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.
aBackground- A poor-man's Z-order.
aOffset- Distance to shift the plot coordinates.
aTransform- Symbol plot transform matrix.
aDimmed- Reduce brightness of symbol

Definition at line 701 of file lib_symbol.cpp.

703{
704 wxASSERT( aPlotter != nullptr );
705
707 COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
708
709 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
710 bg = COLOR4D::WHITE;
711
712 if( aDimmed )
713 color = color.Mix( bg, 0.5f );
714
715 aPlotter->SetColor( color );
716
717 for( const LIB_ITEM& item : m_drawings )
718 {
719 // Do not plot private items
720 if( item.IsPrivate() )
721 continue;
722
723 // Lib Fields are not plotted here, because this plot function
724 // is used to plot schematic items, which have they own fields
725 if( item.Type() == LIB_FIELD_T )
726 continue;
727
728 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
729 continue;
730
731 if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
732 continue;
733
734 item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
735 }
736}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
bool GetColorMode() const
Definition: plotter.h:138
virtual void SetColor(const COLOR4D &color)=0
@ WHITE
Definition: color4d.h:48
@ LAYER_DEVICE
Definition: layer_ids.h:357

References color, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), PLOTTER::GetColorMode(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LAYER_DEVICE, LIB_FIELD_T, m_drawings, PLOTTER::RenderSettings(), PLOTTER::SetColor(), and WHITE.

Referenced by SCH_SYMBOL::Plot(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ PlotLibFields()

void LIB_SYMBOL::PlotLibFields ( PLOTTER aPlotter,
int  aUnit,
int  aConvert,
bool  aBackground,
const VECTOR2I aOffset,
const TRANSFORM aTransform,
bool  aDimmed 
)

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.
aBackground- A poor-man's Z-order.
aOffset- Distance to shift the plot coordinates.
aTransform- Symbol plot transform matrix.
aDimmed- reduce brightness of fields

Definition at line 739 of file lib_symbol.cpp.

741{
742 wxASSERT( aPlotter != nullptr );
743
745 COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
746
747 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
748 bg = COLOR4D::WHITE;
749
750 if( aDimmed )
751 color = color.Mix( bg, 0.5f );
752
753 aPlotter->SetColor( color );
754
755 for( LIB_ITEM& item : m_drawings )
756 {
757 if( item.Type() != LIB_FIELD_T )
758 continue;
759
760 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
761 continue;
762
763 if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
764 continue;
765
766 LIB_FIELD& field = (LIB_FIELD&) item;
767
768 // The reference is a special case: we should change the basic text
769 // to add '?' and the part id
770 wxString tmp = field.GetShownText();
771
772 if( field.GetId() == REFERENCE_FIELD )
773 {
774 wxString text = field.GetFullText( aUnit );
775 field.SetText( text );
776 }
777
778 item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
779 field.SetText( tmp );
780 }
781}
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: lib_field.cpp:397
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:380
@ LAYER_FIELDS
Definition: layer_ids.h:354

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

Referenced by SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ Print()

void LIB_SYMBOL::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset,
int  aMulti,
int  aConvert,
const LIB_SYMBOL_OPTIONS aOpts,
bool  aDimmed 
)

Print symbol.

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

Definition at line 622 of file lib_symbol.cpp.

624{
625 /* draw background for filled items using background option
626 * Solid lines will be drawn after the background
627 * Note also, background is not drawn when printing in black and white
628 */
630 {
631 for( LIB_ITEM& item : m_drawings )
632 {
633 // Do not print private items
634 if( item.IsPrivate() )
635 continue;
636
637 if( item.Type() == LIB_SHAPE_T )
638 {
639 LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
640
641 // Do not draw items not attached to the current part
642 if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
643 continue;
644
645 if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
646 continue;
647
649 shape.Print( aSettings, aOffset, (void*) false, aOpts.transform, aDimmed );
650 }
651 }
652 }
653
654 for( LIB_ITEM& item : m_drawings )
655 {
656 // Do not print private items
657 if( item.IsPrivate() )
658 continue;
659
660 // Do not draw items not attached to the current part
661 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
662 continue;
663
664 if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
665 continue;
666
667 if( item.Type() == LIB_FIELD_T )
668 {
669 LIB_FIELD& field = static_cast<LIB_FIELD&>( item );
670
671 if( field.IsVisible() && !aOpts.draw_visible_fields )
672 continue;
673
674 if( !field.IsVisible() && !aOpts.draw_hidden_fields )
675 continue;
676 }
677
678 if( item.Type() == LIB_PIN_T )
679 {
680 item.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform, aDimmed );
681 }
682 else if( item.Type() == LIB_FIELD_T )
683 {
684 item.Print( aSettings, aOffset, (void*) NULL, aOpts.transform, aDimmed );
685 }
686 else if( item.Type() == LIB_SHAPE_T )
687 {
688 LIB_SHAPE& shape = static_cast<LIB_SHAPE&>( item );
689 bool forceNoFill = shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
690
691 shape.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform, aDimmed );
692 }
693 else
694 {
695 item.Print( aSettings, aOffset, (void*) false, aOpts.transform, aDimmed );
696 }
697 }
698}
FILL_T GetFillMode() const
Definition: eda_shape.h:101
virtual bool IsVisible() const
Definition: eda_text.h:126
int m_convert
Shape identification for alternate body styles.
Definition: lib_item.h:333
virtual void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed)
Draw an item.
Definition: lib_item.cpp:136
int m_unit
Unit identification for multiple parts per package.
Definition: lib_item.h:327
@ FILLED_WITH_BG_BODYCOLOR
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156
bool draw_visible_fields
Definition: lib_symbol.h:65
TRANSFORM transform
Definition: lib_symbol.h:63
@ LIB_SHAPE_T
Definition: typeinfo.h:199

References LIB_SYMBOL_OPTIONS::draw_hidden_fields, LIB_SYMBOL_OPTIONS::draw_visible_fields, FILLED_WITH_BG_BODYCOLOR, EDA_SHAPE::GetFillMode(), 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 784 of file lib_symbol.cpp.

785{
786 wxASSERT( aItem != nullptr );
787
788 // none of the MANDATORY_FIELDS may be removed in RAM, but they may be
789 // omitted when saving to disk.
790 if( aItem->Type() == LIB_FIELD_T )
791 {
792 if( static_cast<LIB_FIELD*>( aItem )->IsMandatory() )
793 return;
794 }
795
796 LIB_ITEMS& items = m_drawings[ aItem->Type() ];
797
798 for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
799 {
800 if( &*i == aItem )
801 {
802 items.erase( i );
803 SetModified();
804 break;
805 }
806 }
807}
void SetModified()
Definition: eda_item.cpp:64
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:179
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
Definition: lib_symbol.h:47

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 1224 of file lib_symbol.cpp.

1225{
1227}
void unique()
Remove duplicate elements in list.
Definition: multivector.h:256

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

◆ RenderAsBitmap()

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

Reimplemented in SCH_ITEM.

Definition at line 165 of file eda_item.h.

165{ return false; }

◆ Replace() [1/2]

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

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

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

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

Reimplemented in LIB_TEXTBOX, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ Replace() [2/2]

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

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 168 of file eda_item.cpp.

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

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

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

◆ Set() [1/3]

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

Definition at line 66 of file inspectable.h.

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

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

◆ Set() [2/3]

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

Definition at line 54 of file inspectable.h.

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

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

◆ Set() [3/3]

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

Definition at line 42 of file inspectable.h.

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

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

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetBrightened()

◆ 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 1401 of file lib_symbol.cpp.

1402{
1403 if( aSetConvert == HasConversion() )
1404 return;
1405
1406 // Duplicate items to create the converted shape
1407 if( aSetConvert )
1408 {
1409 if( aDuplicatePins )
1410 {
1411 std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
1412
1413 for( LIB_ITEM& item : m_drawings )
1414 {
1415 // Only pins are duplicated.
1416 if( item.Type() != LIB_PIN_T )
1417 continue;
1418
1419 if( item.m_convert == 1 )
1420 {
1421 LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1422 newItem->m_convert = 2;
1423 tmp.push_back( newItem );
1424 }
1425 }
1426
1427 // Transfer the new pins to the LIB_SYMBOL.
1428 for( unsigned i = 0; i < tmp.size(); i++ )
1429 m_drawings.push_back( tmp[i] );
1430 }
1431 }
1432 else
1433 {
1434 // Delete converted shape items because the converted shape does
1435 // not exist
1437
1438 while( i != m_drawings.end() )
1439 {
1440 if( i->m_convert > 1 )
1441 i = m_drawings.erase( i );
1442 else
1443 ++i;
1444 }
1445 }
1446
1447 m_drawings.sort();
1448}

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 1057 of file lib_symbol.cpp.

1058{
1060
1061 for( unsigned i=0; i<aFields.size(); ++i )
1062 {
1063 // drawings is a ptr_vector, new and copy an object on the heap.
1064 LIB_FIELD* field = new LIB_FIELD( aFields[i] );
1065
1066 field->SetParent( this );
1067 m_drawings.push_back( field );
1068 }
1069
1070 m_drawings.sort();
1071}
void deleteAllFields()

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

142{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

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

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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

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

Definition at line 201 of file eda_item.h.

201{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetFPFilters()

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

◆ 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 639 of file lib_symbol.h.

639{ m_includeInBom = aIncludeInBom; }

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 647 of file lib_symbol.h.

647{ m_includeOnBoard = aIncludeOnBoard; }

References m_includeOnBoard.

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

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 167 of file eda_item.h.

168 {
169 if( aBitmap )
171 else
173 }

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

◆ SetKeyWords()

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

◆ SetLib()

void LIB_SYMBOL::SetLib ( SYMBOL_LIB aLibrary)
inline

Definition at line 188 of file lib_symbol.h.

188{ m_library = aLibrary; }

References m_library.

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

◆ SetLibId()

◆ SetModified()

◆ SetName()

◆ SetNormal()

void LIB_SYMBOL::SetNormal ( )

Definition at line 579 of file lib_symbol.cpp.

580{
581 if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
582 parent->m_options = ENTRY_NORMAL;
583
585}

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 VECTOR2I aOffset)

Move the symbol aOffset.

Parameters
aOffset- Offset displacement.

Definition at line 1217 of file lib_symbol.cpp.

1218{
1219 for( LIB_ITEM& item : m_drawings )
1220 item.Offset( aOffset );
1221}

References m_drawings.

Referenced by SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor().

◆ SetParent() [1/2]

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineprivatevirtual

Reimplemented from EDA_ITEM.

Definition at line 100 of file eda_item.h.

100{ m_parent = aParent; }

◆ SetParent() [2/2]

◆ 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 615 of file lib_symbol.h.

615{ m_pinNameOffset = aOffset; }

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

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

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

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ 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 1451 of file lib_symbol.cpp.

1452{
1453 m_subpartFirstId = 'A';
1455
1456 if( aSep == '.' || aSep == '-' || aSep == '_' )
1457 m_subpartIdSeparator = aSep;
1458
1459 if( aFirstId == '1' && aSep != 0 )
1460 m_subpartFirstId = aFirstId;
1461}

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 1344 of file lib_symbol.cpp.

1345{
1346 if( m_unitCount == aCount )
1347 return;
1348
1349 if( aCount < m_unitCount )
1350 {
1352
1353 while( i != m_drawings.end() )
1354 {
1355 if( i->m_unit > aCount )
1356 i = m_drawings.erase( i );
1357 else
1358 ++i;
1359 }
1360 }
1361 else if( aDuplicateDrawItems )
1362 {
1363 int prevCount = m_unitCount;
1364
1365 // Temporary storage for new items, as adding new items directly to
1366 // m_drawings may cause the buffer reallocation which invalidates the
1367 // iterators
1368 std::vector< LIB_ITEM* > tmp;
1369
1370 for( LIB_ITEM& item : m_drawings )
1371 {
1372 if( item.m_unit != 1 )
1373 continue;
1374
1375 for( int j = prevCount + 1; j <= aCount; j++ )
1376 {
1377 LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1378 newItem->m_unit = j;
1379 tmp.push_back( newItem );
1380 }
1381 }
1382
1383 for( LIB_ITEM* item : tmp )
1384 m_drawings.push_back( item );
1385 }
1386
1387 m_drawings.sort();
1388 m_unitCount = aCount;
1389}

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

◆ SetUnitDisplayName()

void LIB_SYMBOL::SetUnitDisplayName ( int  aUnit,
const wxString &  aName 
)

Set the user-defined display name for aUnit to aName for symbols with units.

Definition at line 425 of file lib_symbol.cpp.

426{
427 if( aUnit <= GetUnitCount() )
428 {
429 if( aName.Length() > 0 )
430 {
431 m_unitDisplayNames[aUnit] = aName;
432 }
433 else
434 {
435 m_unitDisplayNames.erase( aUnit );
436 }
437 }
438}

References GetUnitCount(), and m_unitDisplayNames.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 117 of file eda_item.h.

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

438{ 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 580 of file lib_symbol.h.

580{ return &m_subpartFirstId; }

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 574 of file lib_symbol.h.

574{ return &m_subpartIdSeparator; }

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 588 of file lib_symbol.cpp.

589{
590 wxString subRef;
591
592 if( m_subpartIdSeparator != 0 && aAddSeparator )
593 subRef << wxChar( m_subpartIdSeparator );
594
595 if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
596 {
597 subRef << aUnit;
598 }
599 else
600 {
601 // use letters as notation. To allow more than 26 units, the sub ref
602 // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise
603 // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available)
604 int u;
605 aUnit -= 1; // Unit number starts to 1. now to 0.
606
607 while( aUnit >= 26 ) // more than one letter are needed
608 {
609 u = aUnit / 26;
610 subRef << wxChar( m_subpartFirstId + u -1 );
611 aUnit %= 26;
612 }
613
614 u = m_subpartFirstId + aUnit;
615 subRef << wxChar( u );
616 }
617
618 return subRef;
619}

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols(), SCH_REFERENCE_LIST::CheckAnnotation(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), SCH_REFERENCE::GetFullRef(), LIB_FIELD::GetFullText(), LIB_ITEM::GetMsgPanelInfo(), SCH_SYMBOL::GetRef(), SCH_FIELD::GetShownText(), SCH_SYMBOL::GetUnitDisplayName(), GetUnitReference(), PIN_TABLE_DATA_MODEL::GetValue(), SCH_FIELD::Matches(), SCH_SYMBOL::ResolveTextVar(), PIN_TABLE_DATA_MODEL::SetValue(), 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 97 of file eda_item.h.

97{ return m_structType; }

References EDA_ITEM::m_structType.

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

◆ UnitsLocked()

◆ 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 1178 of file lib_symbol.cpp.

1179{
1180 int retv = 0;
1181 int lastOrdinal = MANDATORY_FIELDS;
1182
1183 for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1184 {
1185 LIB_FIELD* field = dynamic_cast<LIB_FIELD*>( &item );
1186
1187 wxCHECK2( field, continue );
1188
1189 // Mandatory fields were already resolved always have the same ordinal values.
1190 if( field->IsMandatory() )
1191 continue;
1192
1193 if( field->GetId() != lastOrdinal )
1194 {
1195 field->SetId( lastOrdinal );
1196 retv += 1;
1197 }
1198
1199 lastOrdinal += 1;
1200 }
1201
1202 return retv;
1203}
void SetId(int aId)
Definition: lib_field.cpp:113

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 LIB_PIN, SCH_PIN, GERBER_DRAW_ITEM, DS_PROXY_VIEW_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, EDIT_POINTS, FOOTPRINT, FP_TEXT, PAD, PCB_DIMENSION_BASE, PCB_DIM_CENTER, PCB_MARKER, PCB_SHAPE, PCB_TRACK, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, and MY_DRAWING.

Definition at line 254 of file eda_item.cpp.

255{
256 // Basic fallback
257 return GetBoundingBox();
258}
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74

References EDA_ITEM::GetBoundingBox().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), EDIT_TOOL::Rotate(), PCB_DIMENSION_BASE::ViewBBox(), and PCB_SHAPE::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 DS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, EDIT_POINTS, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::VIEW_GROUP, and KIGFX::VIEW_OVERLAY.

Definition at line 106 of file view_item.h.

107 {}

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

◆ ViewGetLayers()

void LIB_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 989 of file lib_symbol.cpp.

990{
991 aCount = 6;
992 aLayers[0] = LAYER_DEVICE;
993 aLayers[1] = LAYER_DEVICE_BACKGROUND;
994 aLayers[2] = LAYER_REFERENCEPART;
995 aLayers[3] = LAYER_VALUEPART;
996 aLayers[4] = LAYER_FIELDS;
997 aLayers[5] = LAYER_SELECTION_SHADOWS;
998}
@ LAYER_VALUEPART
Definition: layer_ids.h:353
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:372
@ LAYER_REFERENCEPART
Definition: layer_ids.h:352
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381

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 GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

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

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

◆ viewPrivData()

◆ Visit()

INSPECT_RESULT LIB_SYMBOL::Visit ( INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  aScanTypes 
)
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 aScanTypes, and may use IterateForward() to do so on lists of such data.

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

Reimplemented from EDA_ITEM.

Definition at line 1327 of file lib_symbol.cpp.

1329{
1330 // The part itself is never inspected, only its children
1331 for( LIB_ITEM& item : m_drawings )
1332 {
1333 if( item.IsType( aScanTypes ) )
1334 {
1335 if( aInspector( &item, aTestData ) == INSPECT_RESULT::QUIT )
1336 return INSPECT_RESULT::QUIT;
1337 }
1338 }
1339
1341}

References CONTINUE, m_drawings, and QUIT.

Member Data Documentation

◆ m_description

wxString LIB_SYMBOL::m_description
private

Definition at line 746 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 748 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 738 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 739 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 747 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 727 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 744 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 724 of file lib_symbol.h.

Referenced by Compare(), and SharedPtr().

◆ m_name

wxString LIB_SYMBOL::m_name
private

Definition at line 745 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 740 of file lib_symbol.h.

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

◆ m_parent

◆ m_pinNameOffset

int LIB_SYMBOL::m_pinNameOffset
private

The offset in mils to draw the pin name.

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

Definition at line 733 of file lib_symbol.h.

Referenced by Compare(), GetPinNameOffset(), LIB_SYMBOL(), operator=(), and SetPinNameOffset().

◆ m_showPinNames

bool LIB_SYMBOL::m_showPinNames
private

Definition at line 735 of file lib_symbol.h.

Referenced by Compare(), LIB_SYMBOL(), operator=(), SetShowPinNames(), and ShowPinNames().

◆ m_showPinNumbers

bool LIB_SYMBOL::m_showPinNumbers
private

Definition at line 736 of file lib_symbol.h.

Referenced by Compare(), LIB_SYMBOL(), operator=(), SetShowPinNumbers(), and ShowPinNumbers().

◆ m_status

◆ m_structType

KICAD_T EDA_ITEM::m_structType
privateinherited

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

See comment near SetType() regarding virtual functions.

Definition at line 505 of file eda_item.h.

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

◆ m_subpartFirstId

int LIB_SYMBOL::m_subpartFirstId = 'A'
staticprivate

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.

Definition at line 754 of file lib_symbol.h.

Referenced by GetSubpartFirstId(), SetSubpartIdNotation(), SubpartFirstIdPtr(), and SubReference().

◆ m_subpartIdSeparator

int LIB_SYMBOL::m_subpartIdSeparator = 0
staticprivate

the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or U1.A or U1-A

Definition at line 751 of file lib_symbol.h.

Referenced by GetSubpartIdSeparator(), SetSubpartIdNotation(), SubpartIdSeparatorPtr(), and SubReference().

◆ m_unitCount

int LIB_SYMBOL::m_unitCount
private

Number of units (parts) per package.

Definition at line 729 of file lib_symbol.h.

Referenced by Compare(), GetUnitBoundingBox(), GetUnitCount(), IsMulti(), LIB_SYMBOL(), operator=(), and SetUnitCount().

◆ m_unitDisplayNames

std::map<int, wxString> LIB_SYMBOL::m_unitDisplayNames
private

◆ m_unitsLocked

bool LIB_SYMBOL::m_unitsLocked
private

True if symbol has multiple units and changing one unit does not automatically change another unit.

Definition at line 730 of file lib_symbol.h.

Referenced by Compare(), LIB_SYMBOL(), LockUnits(), operator=(), and UnitsLocked().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 492 of file eda_item.h.

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

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

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