KiCad PCB EDA Suite
LIB_PART Class Reference

Define a library symbol object. More...

#include <class_libentry.h>

Inheritance diagram for LIB_PART:
EDA_ITEM LIB_TREE_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 LIB_PART (const wxString &aName, LIB_PART *aParent=nullptr, PART_LIB *aLibrary=nullptr)
 
 LIB_PART (const LIB_PART &aPart, PART_LIB *aLibrary=NULL)
 Copy constructor. More...
 
virtual ~LIB_PART ()
 
PART_SPTR SharedPtr ()
 
void SetParent (LIB_PART *aParent=nullptr)
 
PART_REFGetParent ()
 
virtual wxString GetClass () const override
 Function GetClass returns the class name. More...
 
virtual void SetName (const wxString &aName)
 
wxString GetName () const override
 
LIB_ID GetLibId () const override
 
void SetLibId (const LIB_ID &aLibId)
 
wxString GetLibNickname () const override
 
void SetDescription (const wxString &aDescription)
 
wxString GetDescription () override
 
void SetKeyWords (const wxString &aKeyWords)
 
wxString GetKeyWords () const
 
void SetDocFileName (const wxString &aDocFileName)
 
wxString GetDocFileName () const
 
wxString GetSearchText () override
 
bool IsRoot () const override
 For symbols derived from other symbols, IsRoot() indicates no derivation. More...
 
bool IsAlias () const
 
const wxString GetLibraryName () const
 
PART_LIBGetLib ()
 
void SetLib (PART_LIB *aLibrary)
 
timestamp_t GetDateLastEdition () const
 
wxArrayString GetFootprints () const
 
void SetFootprintFilters (const wxArrayString &aFootprintFilters)
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
const EDA_RECT GetUnitBoundingBox (int aUnit, int aConvert) const
 Get the bounding box for the symbol. More...
 
const EDA_RECT GetBodyBoundingBox (int aUnit, int aConvert) const
 Get the symbol bounding box excluding fields. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns 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 part units. More...
 
bool UnitsLocked () const
 Check whether part 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 (LIB_FIELDS &aList)
 Return a list of fields within this part. More...
 
LIB_FIELDFindField (const wxString &aFieldName)
 Find a field within this part matching aFieldName and returns it or NULL if not found. More...
 
LIB_FIELDGetField (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...
 
void Print (wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
 Print part. More...
 
void Plot (PLOTTER *aPlotter, int aUnit, int aConvert, const wxPoint &aOffset, const TRANSFORM &aTransform)
 Plot lib part to plotter. More...
 
void PlotLibFields (PLOTTER *aPlotter, int aUnit, int aConvert, const wxPoint &aOffset, const TRANSFORM &aTransform)
 Plot Lib Fields only of the part to plotter. More...
 
void AddDrawItem (LIB_ITEM *aItem)
 Add a new draw aItem to the draw object list. More...
 
void RemoveDrawItem (LIB_ITEM *aItem)
 Remove draw aItem from list. More...
 
LIB_ITEMGetNextDrawItem (LIB_ITEM *aItem=NULL, KICAD_T aType=TYPE_NOT_INIT)
 Return the next draw object pointer. More...
 
LIB_PINGetNextPin (LIB_PIN *aItem=NULL)
 Return the next pin object from the draw list. More...
 
void GetPins (LIB_PINS &aList, int aUnit=0, int aConvert=0)
 Return a list of pin object pointers from the draw item list. More...
 
LIB_PINGetPin (const wxString &aNumber, int aUnit=0, int aConvert=0)
 Return pin object with the requested pin aNumber. More...
 
bool PinsConflictWith (LIB_PART &aOtherPart, bool aTestNums, bool aTestNames, bool aTestType, bool aTestOrientation, bool aTestLength)
 Return true if this part's pins do not match another part's pins. More...
 
void SetOffset (const wxPoint &aOffset)
 Move the part aOffset. More...
 
void RemoveDuplicateDrawItems ()
 Remove duplicate draw items from list. More...
 
bool HasConversion () const
 Test if part has more than one body conversion type (DeMorgan). More...
 
void ClearTempFlags ()
 Clears the status flag all draw objects in this part. More...
 
void ClearEditFlags ()
 
LIB_ITEMLocateDrawItem (int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint)
 Locate a draw object. More...
 
LIB_ITEMLocateDrawItem (int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint, const TRANSFORM &aTransform)
 Locate a draw object (overlaid) More...
 
LIB_ITEMS_CONTAINERGetDrawItems ()
 Return a reference to the draw item list. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 Function Visit 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 part count. More...
 
int GetUnitCount () const override
 For items with units, return the number of units. More...
 
wxString GetUnitReference (int aUnit) override
 Return an identifier for aUnit for symbols with units. More...
 
bool IsMulti () const
 
void SetConversion (bool aSetConvert, bool aDuplicatePins=true)
 Set or clear the alternate body style (DeMorgan) for the part. More...
 
void SetPinNameOffset (int aOffset)
 Set the offset in mils of the pin name text from the pin symbol. More...
 
int GetPinNameOffset ()
 
void SetShowPinNames (bool aShow)
 Set or clear the pin name visibility flag. More...
 
bool ShowPinNames ()
 
void SetShowPinNumbers (bool aShow)
 Set or clear the pin number visibility flag. More...
 
bool ShowPinNumbers ()
 
int Compare (const LIB_PART &aRhs) const
 Comparison test that can be used for operators. More...
 
bool operator== (const LIB_PART *aPart) const
 
bool operator== (const LIB_PART &aPart) const
 
const LIB_PARToperator= (const LIB_PART &aPart)
 
std::unique_ptr< LIB_PARTFlatten () const
 Return a flattened symbol inheritance to the caller. More...
 
std::vector< struct PART_UNITSGetUnitDrawItems ()
 Return a list of LIB_ITEM objects separated by unit and convert number. More...
 
std::vector< struct PART_UNITSGetUniqueUnits ()
 Return a list of unit numbers that are unique to this symbol. More...
 
std::vector< LIB_ITEM * > GetUnitItems (int aUnit, int aConvert)
 Return a list of item pointers for aUnit and aConvert for this symbol. More...
 
KICAD_T Type () const
 Function Type() More...
 
EDA_ITEMGetParent () const
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual void GetMsgPanelInfo (EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList)
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
virtual bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText (EDA_UNITS aUnits) const
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
virtual BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static wxString SubReference (int aUnit, bool aAddSeparator=true)
 
static int GetSubpartIdSeparator ()
 
static int * SubpartIdSeparatorPtr ()
 return a reference to m_subpartIdSeparator, only for read/save setting functions More...
 
static int GetSubpartFirstId ()
 
static int * SubpartFirstIdPtr ()
 return a reference to m_subpartFirstId, only for read/save setting functions More...
 
static void SetSubpartIdNotation (int aSep, int aFirstId)
 Set the separator char between the subpart id and the reference 0 (no separator) or '. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Protected Member Functions

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

Protected Attributes

EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

void deleteAllFields ()
 

Private Attributes

PART_SPTR m_me
 < http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared More...
 
PART_REF m_parent
 Use for inherited symbols. More...
 
LIB_ID m_libId
 
int m_pinNameOffset
 The offset in mils to draw the pin name. More...
 
bool m_unitsLocked
 True if part has multiple units and changing one unit does not automatically change another unit. More...
 
bool m_showPinNames
 Determines if part pin names are visible. More...
 
bool m_showPinNumbers
 Determines if part pin numbers are visible. More...
 
timestamp_t m_dateLastEdition
 Date of the last modification. More...
 
LIBRENTRYOPTIONS m_options
 Special part features such as POWER or NORMAL.) More...
 
int m_unitCount
 Number of units (parts) per package. More...
 
LIB_ITEMS_CONTAINER m_drawings
 Drawing items of this part. More...
 
wxArrayString m_FootprintList
 List of suitable footprint names for the part (wild card names accepted). More...
 
PART_LIBm_library
 Library the part belongs to if any. More...
 
wxString m_name
 Symbol name. More...
 
wxString m_description
 documentation for info More...
 
wxString m_keyWords
 keyword list (used for search for parts by keyword) More...
 
wxString m_docFileName
 Associate doc file name. More...
 

Static Private Attributes

static int m_subpartIdSeparator = 0
 the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or U1.A or U1-A More...
 
static int m_subpartFirstId = 'A'
 the ASCII char value to calculate the subpart symbol id from the part 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 part library file (.lib). Library symbols are different from schematic symbols.

Definition at line 99 of file class_libentry.h.

Constructor & Destructor Documentation

◆ LIB_PART() [1/2]

LIB_PART::LIB_PART ( const wxString &  aName,
LIB_PART aParent = nullptr,
PART_LIB aLibrary = nullptr 
)

Definition at line 88 of file class_libentry.cpp.

88  :
90  m_me( this, null_deleter() )
91 {
93  m_unitCount = 1;
96  m_unitsLocked = false;
97  m_showPinNumbers = true;
98  m_showPinNames = true;
99 
100  // Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
101  // when the field editors are invoked.
102  m_drawings[LIB_FIELD_T].reserve( 4 );
107 
108  SetName( aName );
109 
110  if( aParent )
111  SetParent( aParent );
112 
113  SetLib( aLibrary );
114 }
timestamp_t m_dateLastEdition
Date of the last modification.
void SetLib(PART_LIB *aLibrary)
name of datasheet
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
Field Reference of part, i.e. "IC21".
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.
int m_pinNameOffset
The offset in mils to draw the pin name.
#define VALUE
void push_back(T *aItem)
Definition: multivector.h:169
void SetParent(LIB_PART *aParent=nullptr)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:62
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
#define DEFAULT_PIN_NAME_OFFSET
The offset of the pin name string from the end of the pin in mils.
Definition: lib_pin.h:43
virtual void SetName(const wxString &aName)
bool m_showPinNames
Determines if part pin names are visible.
PART_SPTR m_me
< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared

References DATASHEET, DEFAULT_PIN_NAME_OFFSET, ENTRY_NORMAL, FOOTPRINT, LIB_FIELD_T, m_dateLastEdition, m_drawings, m_options, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), REFERENCE, SetLib(), SetName(), SetParent(), and VALUE.

Referenced by Flatten(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), LIB_MANAGER::PART_BUFFER::PART_BUFFER(), LIB_MANAGER::RevertPart(), LIB_MANAGER::LIB_BUFFER::SaveBuffer(), LIB_MANAGER::SaveLibrary(), and LIB_MANAGER::UpdatePart().

◆ LIB_PART() [2/2]

LIB_PART::LIB_PART ( const LIB_PART aPart,
PART_LIB aLibrary = NULL 
)

Copy constructor.

Definition at line 117 of file class_libentry.cpp.

117  :
118  EDA_ITEM( aPart ),
119  m_me( this, null_deleter() )
120 {
121  LIB_ITEM* newItem;
122 
123  m_library = aLibrary;
124  m_name = aPart.m_name;
125  m_FootprintList = wxArrayString( aPart.m_FootprintList );
126  m_unitCount = aPart.m_unitCount;
132  m_options = aPart.m_options;
133  m_libId = aPart.m_libId;
135  m_keyWords = aPart.m_keyWords;
137 
138  for( const LIB_ITEM& oldItem : aPart.m_drawings )
139  {
140  if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
141  continue;
142 
143  try
144  {
145  newItem = (LIB_ITEM*) oldItem.Clone();
146  newItem->SetParent( this );
147  m_drawings.push_back( newItem );
148  }
149  catch( ... )
150  {
151  wxFAIL_MSG( "Failed to clone LIB_ITEM." );
152  }
153  }
154 
155  PART_SPTR parent = aPart.m_parent.lock();
156 
157  if( parent )
158  SetParent( parent.get() );
159 }
timestamp_t m_dateLastEdition
Date of the last modification.
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
PART_LIB * m_library
Library the part belongs to if any.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
wxString m_docFileName
Associate doc file name.
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define IS_NEW
New item, just created.
Definition: base_struct.h:120
int m_pinNameOffset
The offset in mils to draw the pin name.
PART_REF m_parent
Use for inherited symbols.
wxString m_name
Symbol name.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
void push_back(T *aItem)
Definition: multivector.h:169
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
void SetParent(LIB_PART *aParent=nullptr)
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:129
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
LIB_ID m_libId
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:62
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
wxString m_keyWords
keyword list (used for search for parts by keyword)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:259
bool m_showPinNames
Determines if part pin names are visible.
wxString m_description
documentation for info
PART_SPTR m_me
< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared

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

◆ ~LIB_PART()

LIB_PART::~LIB_PART ( )
virtual

Definition at line 162 of file class_libentry.cpp.

163 {
164 }

Member Function Documentation

◆ AddDrawItem()

void LIB_PART::AddDrawItem ( LIB_ITEM aItem)

Add a new draw aItem to the draw object list.

Parameters
aItem- New draw object to add to part.

Definition at line 609 of file class_libentry.cpp.

610 {
611  if( !aItem )
612  return;
613 
614  m_drawings.push_back( aItem );
615 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void push_back(T *aItem)
Definition: multivector.h:169

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

Referenced by BOOST_AUTO_TEST_CASE(), LIB_PIN_TOOL::CreateImagePins(), LIB_DRAWING_TOOLS::DrawShape(), dummy(), KIGFX::dummy(), LIB_EDIT_FRAME::LoadOneSymbol(), LIB_EDIT_TOOL::Paste(), LIB_PIN_TOOL::PlacePin(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow(), and LIB_DRAWING_TOOLS::TwoClickPlace().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 237 of file base_struct.h.

237 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

void LIB_PART::ClearEditFlags ( )

Definition at line 953 of file class_libentry.cpp.

954 {
955  for( LIB_ITEM& item : m_drawings )
956  item.ClearEditFlags();
957 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References m_drawings.

Referenced by LIB_EDIT_FRAME::SaveCopyInUndoList().

◆ ClearFlags()

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

Definition at line 258 of file base_struct.h.

258 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::CreateMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 236 of file base_struct.h.

236 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void LIB_PART::ClearTempFlags ( )

Clears the status flag all draw objects in this part.

Definition at line 946 of file class_libentry.cpp.

947 {
948  for( LIB_ITEM& item : m_drawings )
949  item.ClearTempFlags();
950 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References m_drawings.

Referenced by LIB_PIN_TOOL::CreatePin(), and LIB_EDIT_FRAME::SaveCopyInUndoList().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented in MODULE_ZONE_CONTAINER, D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, VIA, SCH_LABEL, ARC, SCH_TEXT, DRAWSEGMENT, DIMENSION, SCH_LINE, TEXTE_MODULE, TRACK, SCH_SHEET_PIN, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, LIB_ARC, EDGE_MODULE, TEXTE_PCB, SCH_NO_CONNECT, LIB_POLYLINE, SCH_JUNCTION, SCH_MARKER, LIB_TEXT, PCB_TARGET, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 117 of file base_struct.cpp.

118 {
119  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
120  wxT( ". Bad programmer!" ) );
121 }
#define NULL
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), operator=(), LIB_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SetConversion(), SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ Compare()

int LIB_PART::Compare ( const LIB_PART aRhs) 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 210 of file class_libentry.cpp.

211 {
212  if( m_me == aRhs.m_me )
213  return 0;
214 
215  int retv = m_name.Cmp( aRhs.m_name );
216 
217  if( retv )
218  return retv;
219 
220  retv = m_libId.compare( aRhs.m_libId );
221 
222  if( retv )
223  return retv;
224 
225  if( m_parent.lock() < aRhs.m_parent.lock() )
226  return -1;
227 
228  if( m_parent.lock() > aRhs.m_parent.lock() )
229  return 1;
230 
231  if( m_options != aRhs.m_options )
232  return ( m_options == ENTRY_NORMAL ) ? -1 : 1;
233 
234  if( m_unitCount != aRhs.m_unitCount )
235  return m_unitCount - aRhs.m_unitCount;
236 
237  if( m_drawings.size() != aRhs.m_drawings.size() )
238  return m_drawings.size() - aRhs.m_drawings.size();
239 
242 
243  while( lhsItem != m_drawings.end() )
244  {
245  if( lhsItem->Type() != rhsItem->Type() )
246  return lhsItem->Type() - rhsItem->Type();
247 
248  retv = lhsItem->compare( *rhsItem );
249 
250  if( retv )
251  return retv;
252 
253  ++lhsItem;
254  ++rhsItem;
255  }
256 
257  if( m_FootprintList.GetCount() != aRhs.m_FootprintList.GetCount() )
258  return m_FootprintList.GetCount() - aRhs.m_FootprintList.GetCount();
259 
260  for( size_t i = 0; i < m_FootprintList.GetCount(); i++ )
261  {
262  retv = m_FootprintList[i].Cmp( aRhs.m_FootprintList[i] );
263 
264  if( retv )
265  return retv;
266  }
267 
268  retv = m_description.Cmp( aRhs.m_description );
269 
270  if( retv )
271  return retv;
272 
273  retv = m_keyWords.Cmp( aRhs.m_keyWords );
274 
275  if( retv )
276  return retv;
277 
278  retv = m_docFileName.Cmp( aRhs.m_docFileName );
279 
280  if( retv )
281  return retv;
282 
283  if( m_pinNameOffset != aRhs.m_pinNameOffset )
284  return m_pinNameOffset - aRhs.m_pinNameOffset;
285 
286  if( m_unitsLocked != aRhs.m_unitsLocked )
287  return ( m_unitsLocked ) ? 1 : -1;
288 
289  if( m_showPinNames != aRhs.m_showPinNames )
290  return ( m_showPinNames ) ? 1 : -1;
291 
292  if( m_showPinNumbers != aRhs.m_showPinNumbers )
293  return ( m_showPinNumbers ) ? 1 : -1;
294 
295  return 0;
296 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
wxString m_docFileName
Associate doc file name.
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
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:316
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
int m_pinNameOffset
The offset in mils to draw the pin name.
PART_REF m_parent
Use for inherited symbols.
wxString m_name
Symbol name.
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
LIB_ID m_libId
ITERATOR_BASE< const LIB_ITEM, const MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::const_iterator > CONST_ITERATOR
The const iterator
Definition: multivector.h:162
wxString m_keyWords
keyword list (used for search for parts by keyword)
bool m_showPinNames
Determines if part pin names are visible.
wxString m_description
documentation for info
size_t size(int aType=UNDEFINED_TYPE) const
Definition: multivector.h:220
PART_SPTR m_me
< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), LIB_ID::compare(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), ENTRY_NORMAL, m_description, m_docFileName, m_drawings, m_FootprintList, m_keyWords, m_libId, m_me, m_name, m_options, m_parent, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::size().

Referenced by operator==().

◆ deleteAllFields()

void LIB_PART::deleteAllFields ( )
private

Definition at line 810 of file class_libentry.cpp.

811 {
813 }
void clear(int aType=UNDEFINED_TYPE)
Definition: multivector.h:207
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.

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

Referenced by SetFields().

◆ FindField()

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

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

Definition at line 874 of file class_libentry.cpp.

875 {
876  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
877  {
878  LIB_FIELD* field = ( LIB_FIELD* ) &item;
879 
880  if( field->GetName( NATIVE_FIELD_NAME ) == aFieldName )
881  return field;
882  }
883 
884  return NULL;
885 }
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define NULL
wxString GetName(bool aTranslate) const
Definition: lib_field.cpp:387
#define NATIVE_FIELD_NAME
Definition: lib_field.h:125

References LIB_FIELD::GetName(), LIB_FIELD_T, m_drawings, NATIVE_FIELD_NAME, and NULL.

Referenced by SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), and FOOTPRINT_INFO_GENERATOR::SetHtmlFieldTable().

◆ Flatten()

std::unique_ptr< LIB_PART > LIB_PART::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 353 of file class_libentry.cpp.

354 {
355  std::unique_ptr< LIB_PART > retv;
356 
357  if( IsAlias() )
358  {
359  PART_SPTR parent = m_parent.lock();
360 
361  wxCHECK_MSG( parent, retv,
362  wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
363 
364  // Copy the parent.
365  retv.reset( new LIB_PART( *parent.get() ) );
366 
367  // Now add the inherited part (this) information.
368  retv->SetName( m_name );
369 
370  const LIB_FIELD* datasheetField = GetField( DATASHEET );
371  retv->GetField( DATASHEET )->SetText( datasheetField->GetText() );
372  retv->SetDocFileName( m_docFileName );
373  retv->SetKeyWords( m_keyWords );
374  retv->SetDescription( m_description );
375  }
376  else
377  {
378  retv.reset( new LIB_PART( *this ) );
379  }
380 
381  return retv;
382 }
name of datasheet
Field object used in symbol libraries.
Definition: lib_field.h:59
wxString m_docFileName
Associate doc file name.
PART_REF m_parent
Use for inherited symbols.
wxString m_name
Symbol name.
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
LIB_PART(const wxString &aName, LIB_PART *aParent=nullptr, PART_LIB *aLibrary=nullptr)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool IsAlias() const
wxString m_keyWords
keyword list (used for search for parts by keyword)
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.
wxString m_description
documentation for info
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123

References DATASHEET, Format(), GetField(), EDA_TEXT::GetText(), IsAlias(), LIB_PART(), m_description, m_docFileName, m_keyWords, m_name, and m_parent.

Referenced by SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_FRAME::GetDocumentExtents(), SCH_COMPONENT::Resolve(), SCH_COMPONENT::SCH_COMPONENT(), and SCH_COMPONENT::SetLibId().

◆ GetBodyBoundingBox()

const EDA_RECT LIB_PART::GetBodyBoundingBox ( int  aUnit,
int  aConvert 
) const

Get the symbol bounding box excluding fields.

Returns
the part 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 787 of file class_libentry.cpp.

788 {
789  EDA_RECT bbox;
790 
791  for( const LIB_ITEM& item : m_drawings )
792  {
793  if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
794  && ( aUnit != item.m_Unit ) ) )
795  continue;
796 
797  if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
798  continue;
799 
800  if( item.Type() == LIB_FIELD_T )
801  continue;
802 
803  bbox.Merge( item.GetBoundingBox() );
804  }
805 
806  return bbox;
807 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
int m_unitCount
Number of units (parts) per package.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

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

Referenced by SCH_COMPONENT::GetBodyBoundingBox().

◆ GetBoundingBox()

const EDA_RECT LIB_PART::GetBoundingBox ( ) const
inlineoverridevirtual

Function GetBoundingBox returns 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 230 of file class_libentry.h.

231  {
232  return GetUnitBoundingBox( 0, 0 );
233  }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.

References GetUnitBoundingBox().

◆ GetClass()

virtual wxString LIB_PART::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 149 of file class_libentry.h.

150  {
151  return wxT( "LIB_PART" );
152  }

◆ GetDateLastEdition()

timestamp_t LIB_PART::GetDateLastEdition ( ) const
inline

Definition at line 196 of file class_libentry.h.

196 { return m_dateLastEdition; }
timestamp_t m_dateLastEdition
Date of the last modification.

References m_dateLastEdition.

Referenced by SCH_LEGACY_PLUGIN_CACHE::SaveSymbol().

◆ GetDescription()

wxString LIB_PART::GetDescription ( )
inlineoverridevirtual

◆ GetDocFileName()

◆ GetDrawItems()

LIB_ITEMS_CONTAINER& LIB_PART::GetDrawItems ( )
inline

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 262 of file base_struct.h.

263  {
267  return m_Flags & mask;
268  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:157
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetField()

LIB_FIELD * LIB_PART::GetField ( 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 860 of file class_libentry.cpp.

861 {
862  for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
863  {
864  LIB_FIELD* field = ( LIB_FIELD* ) &item;
865 
866  if( field->GetId() == aId )
867  return field;
868  }
869 
870  return NULL;
871 }
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int GetId() const
Definition: lib_field.h:139
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define NULL

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

Referenced by Flatten(), GetFields(), GetFootprintField(), GetReferenceField(), GetValueField(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), LIB_EDIT_FRAME::SetCurPart(), SetParent(), and DIALOG_CHOOSE_COMPONENT::ShowFootprintFor().

◆ GetFields()

void LIB_PART::GetFields ( LIB_FIELDS aList)

Return a list of fields within this part.

Parameters
aList- List to add fields to

Definition at line 831 of file class_libentry.cpp.

832 {
833  LIB_FIELD* field;
834 
835  // Grab the MANDATORY_FIELDS first, in expected order given by
836  // enum NumFieldType
837  for( int id=0; id<MANDATORY_FIELDS; ++id )
838  {
839  field = GetField( id );
840 
841  // the MANDATORY_FIELDS are exactly that in RAM.
842  wxASSERT( field );
843 
844  aList.push_back( *field );
845  }
846 
847  // Now grab all the rest of fields.
848  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
849  {
850  field = ( LIB_FIELD* ) &item;
851 
852  if( (unsigned) field->GetId() < MANDATORY_FIELDS )
853  continue; // was added above
854 
855  aList.push_back( *field );
856  }
857 }
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int GetId() const
Definition: lib_field.h:139
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.

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

Referenced by SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), FOOTPRINT_INFO_GENERATOR::SetHtmlFieldTable(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow().

◆ GetFlags()

◆ GetFootprintField()

LIB_FIELD & LIB_PART::GetFootprintField ( )

Return reference to the footprint field.

Definition at line 904 of file class_libentry.cpp.

905 {
906  LIB_FIELD* field = GetField( FOOTPRINT );
907  wxASSERT( field != NULL );
908  return *field;
909 }
Field object used in symbol libraries.
Definition: lib_field.h:59
#define NULL
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.

References FOOTPRINT, GetField(), and NULL.

Referenced by GetSearchText().

◆ GetFootprints()

wxArrayString LIB_PART::GetFootprints ( ) const
inline

Definition at line 198 of file class_libentry.h.

198 { return m_FootprintList; }
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).

References m_FootprintList.

Referenced by DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow().

◆ GetKeyWords()

wxString LIB_PART::GetKeyWords ( ) const
inline

◆ GetLib()

PART_LIB* LIB_PART::GetLib ( )
inline

Definition at line 193 of file class_libentry.h.

193 { return m_library; }
PART_LIB * m_library
Library the part belongs to if any.

References m_library.

Referenced by LIB_MANAGER::LIB_BUFFER::CreateBuffer(), and PART_LIB::FindPart().

◆ GetLibId()

◆ GetLibNickname()

wxString LIB_PART::GetLibNickname ( ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 160 of file class_libentry.h.

160 { return GetLibraryName(); }
const wxString GetLibraryName() const

References GetLibraryName().

◆ GetLibraryName()

const wxString LIB_PART::GetLibraryName ( ) const

Definition at line 385 of file class_libentry.cpp.

386 {
387  if( m_library )
388  return m_library->GetName();
389 
390  return m_libId.GetLibNickname();
391 }
const wxString GetName() const
Return the file name without path or extension.
PART_LIB * m_library
Library the part belongs to if any.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
LIB_ID m_libId

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

Referenced by GetLibNickname(), and RemoveDrawItem().

◆ GetMenuImage()

BITMAP_DEF EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, VIA, SCH_LABEL, SCH_TEXT, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, TRACK, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, SCH_BUS_WIRE_ENTRY, MARKER_PCB, LIB_ARC, SCH_BITMAP, EDGE_MODULE, TEXTE_PCB, LIB_POLYLINE, SCH_NO_CONNECT, LIB_TEXT, PCB_TARGET, SCH_MARKER, LIB_CIRCLE, SCH_JUNCTION, and LIB_RECTANGLE.

Definition at line 242 of file base_struct.cpp.

243 {
244  return dummy_xpm;
245 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:54

References dummy_xpm.

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

◆ GetMsgPanelInfo()

virtual void EDA_ITEM::GetMsgPanelInfo ( EDA_UNITS  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
inlinevirtualinherited

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented in BOARD, D_PAD, MODULE, SCH_SHEET, SCH_TEXT, SCH_COMPONENT, GERBER_DRAW_ITEM, NETINFO_ITEM, DIMENSION, SCH_LINE, DRAWSEGMENT, LIB_ITEM, TEXTE_MODULE, TRACK, LIB_FIELD, SCH_BITMAP, MARKER_PCB, EDGE_MODULE, LIB_PIN, SCH_BUS_ENTRY_BASE, ZONE_CONTAINER, LIB_BEZIER, SCH_MARKER, TEXTE_PCB, LIB_POLYLINE, LIB_ARC, LIB_TEXT, LIB_CIRCLE, and LIB_RECTANGLE.

Definition at line 320 of file base_struct.h.

321  {
322  }

Referenced by EDA_DRAW_FRAME::SetMsgPanel(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), and FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel().

◆ GetName()

wxString LIB_PART::GetName ( void  ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 155 of file class_libentry.h.

155 { return m_name; }
wxString m_name
Symbol name.

References m_name.

Referenced by SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), SCH_EDIT_FRAME::CreateArchiveLibrary(), LIB_EDIT_FRAME::DisplayCmpDoc(), LIB_EDIT_FRAME::DuplicatePart(), LIB_EDIT_TOOL::editSymbolProperties(), LIB_EDIT_FRAME::ExportPart(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), LIB_EDIT_FRAME::fixDuplicateAliases(), LIB_MANAGER::GetBufferedPart(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_LEGACY_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), LIB_EDIT_FRAME::LoadOneLibraryPartAux(), operator<(), SCH_SEXPR_PARSER::ParseLib(), RemoveDrawItem(), PART_LIB::RemovePart(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PART_LIB::ReplacePart(), LIB_MANAGER::LIB_BUFFER::SaveBuffer(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), LIB_EDIT_FRAME::SetCurPart(), FOOTPRINT_INFO_GENERATOR::SetHtmlName(), LIB_EDIT_FRAME::SyncLibraries(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow(), LIB_EDIT_FRAME::UpdateAfterSymbolProperties(), DIALOG_UPDATE_FIELDS::updateFields(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), LIB_MANAGER::UpdatePart(), LIB_MANAGER::UpdatePartAfterRename(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ GetNextDrawItem()

LIB_ITEM * LIB_PART::GetNextDrawItem ( LIB_ITEM aItem = NULL,
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 618 of file class_libentry.cpp.

619 {
620  if( aItem == NULL )
621  {
623 
624  return (it1 != m_drawings.end( aType ) ) ? &( *( m_drawings.begin( aType ) ) ) : nullptr;
625  }
626 
627  // Search for the last item, assume aItem is of type aType
628  wxASSERT( ( aType == TYPE_NOT_INIT ) || ( aType == aItem->Type() ) );
630 
631  while( ( it != m_drawings.end( aType ) ) && ( aItem != &( *it ) ) )
632  ++it;
633 
634  // Search the next item
635  if( it != m_drawings.end( aType ) )
636  {
637  ++it;
638 
639  if( it != m_drawings.end( aType ) )
640  return &( *it );
641  }
642 
643  return NULL;
644 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
#define NULL
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The non-const iterator
Definition: multivector.h:160
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

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

Referenced by BOOST_AUTO_TEST_CASE(), and GetNextPin().

◆ GetNextPin()

LIB_PIN* LIB_PART::GetNextPin ( LIB_PIN aItem = NULL)
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 367 of file class_libentry.h.

368  {
369  return (LIB_PIN*) GetNextDrawItem( (LIB_ITEM*) aItem, LIB_PIN_T );
370  }
LIB_ITEM * GetNextDrawItem(LIB_ITEM *aItem=NULL, KICAD_T aType=TYPE_NOT_INIT)
Return the next draw object pointer.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References GetNextDrawItem(), and LIB_PIN_T.

Referenced by LIB_EDIT_TOOL::DoDelete(), NETLIST_EXPORTER::findAllUnitsOfComponent(), LIB_MOVE_TOOL::Main(), LIB_PIN_TOOL::PlacePin(), LIB_PIN_TOOL::PushPinProperties(), LIB_PIN::SetConversion(), LIB_PIN::SetPartNumber(), DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow(), and DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow().

◆ GetParent() [1/2]

◆ GetParent() [2/2]

◆ GetPin()

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

Return pin object with the requested pin aNumber.

Parameters
aNumber- Number of the pin to find.
aUnit- Unit of the part 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 670 of file class_libentry.cpp.

671 {
672  LIB_PINS pinList;
673 
674  GetPins( pinList, aUnit, aConvert );
675 
676  for( size_t i = 0; i < pinList.size(); i++ )
677  {
678  wxASSERT( pinList[i]->Type() == LIB_PIN_T );
679 
680  if( aNumber == pinList[i]->GetNumber() )
681  return pinList[i];
682  }
683 
684  return NULL;
685 }
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:54
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
#define NULL
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

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

◆ GetPinNameOffset()

◆ GetPins()

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

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

Note pin objects are owned by the draw list of the part. 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 part unit.
aConvert- Convert number of pin to add to list. Set to 0 to get pins from any convert of part.

Definition at line 647 of file class_libentry.cpp.

648 {
649  /* Notes:
650  * when aUnit == 0: no unit filtering
651  * when aConvert == 0: no convert (shape selection) filtering
652  * when .m_Unit == 0, the body item is common to units
653  * when .m_Convert == 0, the body item is common to shapes
654  */
655  for( LIB_ITEM& item : m_drawings[ LIB_PIN_T ] )
656  {
657  // Unit filtering:
658  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
659  continue;
660 
661  // Shape filtering:
662  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
663  continue;
664 
665  aList.push_back( (LIB_PIN*) &item );
666  }
667 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References LIB_PIN_T, and m_drawings.

Referenced by EE_INSPECTION_TOOL::checkPart(), KIGFX::SCH_PAINTER::draw(), LIB_PIN::EnableEditMode(), GetPin(), PinsConflictWith(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), LIB_PIN::SetLength(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), LIB_PIN::SetType(), and LIB_PIN::SetVisible().

◆ GetReferenceField()

LIB_FIELD & LIB_PART::GetReferenceField ( )

Return reference to the reference designator field.

Definition at line 896 of file class_libentry.cpp.

897 {
898  LIB_FIELD* field = GetField( REFERENCE );
899  wxASSERT( field != NULL );
900  return *field;
901 }
Field object used in symbol libraries.
Definition: lib_field.h:59
Field Reference of part, i.e. "IC21".
#define NULL
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.

References GetField(), NULL, and REFERENCE.

Referenced by LIB_EDIT_FRAME::CreateNewPart(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and SCH_COMPONENT::SCH_COMPONENT().

◆ GetSearchText()

wxString LIB_PART::GetSearchText ( )
overridevirtual

Reimplemented from LIB_TREE_ITEM.

Definition at line 55 of file class_libentry.cpp.

56 {
57  // Matches are scored by offset from front of string, so inclusion of this spacer
58  // discounts matches found after it.
59  static const wxString discount( wxT( " " ) );
60 
61  wxString text = GetKeyWords() + discount + GetDescription();
62  wxString footprint = GetFootprintField().GetText();
63 
64  if( !footprint.IsEmpty() )
65  {
66  text += discount + footprint;
67  }
68 
69  return text;
70 }
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
wxString GetKeyWords() const
wxString GetDescription() override
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123

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

◆ GetSelectMenuText()

wxString EDA_ITEM::GetSelectMenuText ( EDA_UNITS  aUnits) const
virtualinherited

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, BOARD, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, VIA, SCH_LABEL, WS_DRAW_ITEM_BITMAP, SCH_TEXT, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, WS_DRAW_ITEM_PAGE, DRAWSEGMENT, DIMENSION, WS_DRAW_ITEM_RECT, TEXTE_MODULE, TRACK, SCH_LINE, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BUS_WIRE_ENTRY, MARKER_PCB, LIB_ARC, WS_DRAW_ITEM_LINE, SCH_BITMAP, EDGE_MODULE, TEXTE_PCB, LIB_POLYLINE, LIB_TEXT, SCH_NO_CONNECT, PCB_TARGET, LIB_CIRCLE, SCH_MARKER, LIB_RECTANGLE, SCH_JUNCTION, SCH_PIN, and DELETED_BOARD_ITEM.

Definition at line 143 of file base_struct.cpp.

144 {
145  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
146  GetClass() );
147 
148  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
149 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::buildConnectionGraph(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), RC_ITEM::SetData(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 241 of file base_struct.h.

242  {
243  return m_Status & type;
244  }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 254 of file base_struct.h.

254 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetSubpartFirstId()

static int LIB_PART::GetSubpartFirstId ( )
inlinestatic

Definition at line 514 of file class_libentry.h.

514 { return m_subpartFirstId; }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the part number: only 'A',...

References m_subpartFirstId.

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

◆ GetSubpartIdSeparator()

static int LIB_PART::GetSubpartIdSeparator ( )
inlinestatic

Definition at line 508 of file class_libentry.h.

508 { return m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...

References m_subpartIdSeparator.

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

◆ GetUniqueUnits()

std::vector< struct PART_UNITS > LIB_PART::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 1186 of file class_libentry.cpp.

1187 {
1188  int unitNum;
1189  size_t i;
1190  struct PART_UNITS unit;
1191  std::vector<LIB_ITEM*> compareDrawItems;
1192  std::vector<LIB_ITEM*> currentDrawItems;
1193  std::vector<struct PART_UNITS> uniqueUnits;
1194 
1195  // The first unit is guarenteed to be unique so always include it.
1196  unit.m_unit = 1;
1197  unit.m_convert = 1;
1198  unit.m_items = GetUnitItems( 1, 1 );
1199 
1200  // There are no unique units if there are no draw items other than fields.
1201  if( unit.m_items.size() == 0 )
1202  return uniqueUnits;
1203 
1204  uniqueUnits.emplace_back( unit );
1205 
1206  if( ( GetUnitCount() == 1 || UnitsLocked() ) && !HasConversion() )
1207  return uniqueUnits;
1208 
1209  currentDrawItems = unit.m_items;
1210 
1211  for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1212  {
1213  compareDrawItems = GetUnitItems( unitNum, 1 );
1214 
1215  wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1216  "Multiple unit symbol defined with empty units." );
1217 
1218  if( currentDrawItems.size() != compareDrawItems.size() )
1219  {
1220  unit.m_unit = unitNum;
1221  unit.m_convert = 1;
1222  unit.m_items = compareDrawItems;
1223  uniqueUnits.emplace_back( unit );
1224  }
1225  else
1226  {
1227  for( i = 0; i < currentDrawItems.size(); i++ )
1228  {
1229  if( currentDrawItems[i]->compare( *compareDrawItems[i],
1231  {
1232  unit.m_unit = unitNum;
1233  unit.m_convert = 1;
1234  unit.m_items = compareDrawItems;
1235  uniqueUnits.emplace_back( unit );
1236  }
1237  }
1238  }
1239  }
1240 
1241  if( HasConversion() )
1242  {
1243  currentDrawItems = GetUnitItems( 1, 2 );
1244 
1245  if( ( GetUnitCount() == 1 || UnitsLocked() ) )
1246  {
1247  unit.m_unit = 1;
1248  unit.m_convert = 2;
1249  unit.m_items = currentDrawItems;
1250  uniqueUnits.emplace_back( unit );
1251 
1252  return uniqueUnits;
1253  }
1254 
1255  for( unitNum = 2; unitNum <= GetUnitCount(); unitNum++ )
1256  {
1257  compareDrawItems = GetUnitItems( unitNum, 2 );
1258 
1259  wxCHECK2_MSG( compareDrawItems.size() != 0, continue,
1260  "Multiple unit symbol defined with empty units." );
1261 
1262  if( currentDrawItems.size() != compareDrawItems.size() )
1263  {
1264  unit.m_unit = unitNum;
1265  unit.m_convert = 2;
1266  unit.m_items = compareDrawItems;
1267  uniqueUnits.emplace_back( unit );
1268  }
1269  else
1270  {
1271  for( i = 0; i < currentDrawItems.size(); i++ )
1272  {
1273  if( currentDrawItems[i]->compare( *compareDrawItems[i],
1275  {
1276  unit.m_unit = unitNum;
1277  unit.m_convert = 2;
1278  unit.m_items = compareDrawItems;
1279  uniqueUnits.emplace_back( unit );
1280  }
1281  }
1282  }
1283  }
1284  }
1285 
1286  return uniqueUnits;
1287 }
#define UNIT
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
int m_unit
The unit number.
std::vector< LIB_ITEM * > GetUnitItems(int aUnit, int aConvert)
Return a list of item pointers for aUnit and aConvert for this symbol.
int GetUnitCount() const override
For items with units, return the number of units.
bool UnitsLocked() const
Check whether part units are interchangeable.

References GetUnitCount(), GetUnitItems(), HasConversion(), PART_UNITS::m_convert, PART_UNITS::m_items, PART_UNITS::m_unit, UNIT, and UnitsLocked().

◆ GetUnitBoundingBox()

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

Get the bounding box for the symbol.

Returns
the part 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 745 of file class_libentry.cpp.

746 {
747  EDA_RECT bBox;
748  bool initialized = false;
749 
750  for( const LIB_ITEM& item : m_drawings )
751  {
752  if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
753  && ( aUnit != item.m_Unit ) ) )
754  continue;
755 
756  if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
757  continue;
758 
759  if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
760  continue;
761 
762  if( initialized )
763  bBox.Merge( item.GetBoundingBox() );
764  else
765  {
766  bBox = item.GetBoundingBox();
767  initialized = true;
768  }
769  }
770 
771  return bBox;
772 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
int m_unitCount
Number of units (parts) per package.
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

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

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

◆ GetUnitCount()

int LIB_PART::GetUnitCount ( ) const
overridevirtual

◆ GetUnitDrawItems()

std::vector< struct PART_UNITS > LIB_PART::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 1151 of file class_libentry.cpp.

1152 {
1153  std::vector<struct PART_UNITS> units;
1154 
1155  for( LIB_ITEM& item : m_drawings )
1156  {
1157  if( item.Type() == LIB_FIELD_T )
1158  continue;
1159 
1160  int unit = item.GetUnit();
1161  int convert = item.GetConvert();
1162 
1163  auto it = std::find_if( units.begin(), units.end(),
1164  [unit, convert] ( const auto& a ) {
1165  return a.m_unit == unit && a.m_convert == convert;
1166  } );
1167 
1168  if( it == units.end() )
1169  {
1170  struct PART_UNITS newUnit;
1171  newUnit.m_unit = item.GetUnit();
1172  newUnit.m_convert = item.GetConvert();
1173  newUnit.m_items.push_back( &item );
1174  units.emplace_back( newUnit );
1175  }
1176  else
1177  {
1178  it->m_items.push_back( &item );
1179  }
1180  }
1181 
1182  return units;
1183 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int m_unit
The unit number.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References LIB_FIELD_T, PART_UNITS::m_convert, m_drawings, PART_UNITS::m_items, and PART_UNITS::m_unit.

Referenced by SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().

◆ GetUnitItems()

std::vector< LIB_ITEM * > LIB_PART::GetUnitItems ( 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 1132 of file class_libentry.cpp.

1133 {
1134  std::vector<LIB_ITEM*> unitItems;
1135 
1136  for( LIB_ITEM& item : m_drawings )
1137  {
1138  if( item.Type() == LIB_FIELD_T )
1139  continue;
1140 
1141  if( ( aConvert == -1 && item.GetUnit() == aUnit )
1142  || ( aUnit == -1 && item.GetConvert() == aConvert )
1143  || ( aUnit == item.GetUnit() && aConvert == item.GetConvert() ) )
1144  unitItems.push_back( &item );
1145  }
1146 
1147  return unitItems;
1148 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References LIB_FIELD_T, and m_drawings.

Referenced by GetUniqueUnits().

◆ GetUnitReference()

wxString LIB_PART::GetUnitReference ( int  aUnit)
overridevirtual

Return an identifier for aUnit for symbols with units.

Reimplemented from LIB_TREE_ITEM.

Definition at line 299 of file class_libentry.cpp.

300 {
301  return LIB_PART::SubReference( aUnit, false );
302 }
static wxString SubReference(int aUnit, bool aAddSeparator=true)

References SubReference().

◆ GetValueField()

LIB_FIELD & LIB_PART::GetValueField ( )

Return reference to the value field.

Definition at line 888 of file class_libentry.cpp.

889 {
890  LIB_FIELD* field = GetField( VALUE );
891  wxASSERT( field != NULL );
892  return *field;
893 }
Field object used in symbol libraries.
Definition: lib_field.h:59
#define VALUE
#define NULL
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.

References GetField(), NULL, and VALUE.

Referenced by SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and SetName().

◆ HasConversion()

bool LIB_PART::HasConversion ( ) const

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

Returns
True if part has more than one conversion.

Definition at line 925 of file class_libentry.cpp.

926 {
927  for( const LIB_ITEM& item : m_drawings )
928  {
929  if( item.m_Convert > LIB_ITEM::LIB_CONVERT::BASE )
930  return true;
931  }
932 
933  if( PART_SPTR parent = m_parent.lock() )
934  {
935  for( const LIB_ITEM& item : parent->GetDrawItems() )
936  {
937  if( item.m_Convert > LIB_ITEM::LIB_CONVERT::BASE )
938  return true;
939  }
940  }
941 
942  return false;
943 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
PART_REF m_parent
Use for inherited symbols.
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART

References m_drawings, and m_parent.

Referenced by EE_INSPECTION_TOOL::checkPart(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), GetUniqueUnits(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SetConversion(), LIB_VIEW_FRAME::SyncToolbars(), DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate().

◆ HasFlag()

◆ HitTest() [1/2]

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

Function HitTest tests if aPosition is contained within or on the bounding box of an item.

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

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, VIA, WS_DRAW_ITEM_BITMAP, SCH_TEXT, ARC, WS_DRAW_ITEM_TEXT, ZONE_CONTAINER, GERBER_DRAW_ITEM, WS_DRAW_ITEM_PAGE, DIMENSION, DRAWSEGMENT, WS_DRAW_ITEM_RECT, SCH_LINE, SCH_SHEET_PIN, TEXTE_MODULE, SCH_FIELD, LIB_ITEM, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, SCH_BITMAP, WS_DRAW_ITEM_LINE, MARKER_PCB, LIB_PIN, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, SCH_MARKER, SCH_JUNCTION, PCB_TARGET, WS_DRAW_ITEM_BASE, SCH_PIN, TEXTE_PCB, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, LIB_RECTANGLE, LIB_CIRCLE, and KIGFX::RATSNEST_VIEWITEM.

Definition at line 332 of file base_struct.h.

333  {
334  return false; // derived classes should override this function
335  }

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), EE_SELECTION_TOOL::GuessSelectionCandidates(), WS_DRAW_ITEM_BASE::HitTest(), LIB_ITEM::HitTest(), EE_COLLECTOR::Inspect(), GERBER_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), EE_SELECTION_TOOL::selectMultiple(), and SELECTION_TOOL::selectMultiple().

◆ HitTest() [2/2]

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

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

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

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, VIA, ZONE_CONTAINER, WS_DRAW_ITEM_BITMAP, SCH_TEXT, ARC, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DIMENSION, DRAWSEGMENT, SCH_LINE, TEXTE_MODULE, LIB_ITEM, SCH_FIELD, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, SCH_JUNCTION, WS_DRAW_ITEM_BASE, PCB_TARGET, TEXTE_PCB, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, and LIB_CIRCLE.

Definition at line 346 of file base_struct.h.

347  {
348  return false; // derived classes should override this function
349  }

◆ IsAlias()

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

223 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), KIGFX::SCH_PAINTER::setDeviceColors(), and ShowClearance().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

227 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsMulti()

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

Definition at line 495 of file class_libentry.h.

495 { return m_unitCount > 1; }
int m_unitCount
Number of units (parts) per package.

References m_unitCount.

Referenced by SYMBOL_PREVIEW_WIDGET::DisplayPart(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), LIB_EDIT_FRAME::SetCurPart(), LIB_EDIT_FRAME::SynchronizePins(), and LIB_EDIT_FRAME::SyncToolbars().

◆ IsNew()

◆ IsNormal()

bool LIB_PART::IsNormal ( ) const
inline

Definition at line 236 of file class_libentry.h.

236 { return m_options == ENTRY_NORMAL; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)

References ENTRY_NORMAL, and m_options.

◆ IsPower()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

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

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 517 of file base_struct.h.

517 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

226 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsRoot()

◆ IsSelected()

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

Function IsType Checks 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_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 286 of file base_struct.h.

287  {
288  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
289  return true;
290 
291  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
292  {
293  if( m_StructType == *p )
294  return true;
295  }
296 
297  return false;
298  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:178
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

224 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

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

Definition at line 399 of file base_struct.h.

403  {
404  for( auto it : aList )
405  {
406  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
408  return SEARCH_RESULT::QUIT;
409  }
410 
412  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/2]

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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 420 of file base_struct.h.

422  {
423  for( auto it : aList )
424  {
425  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
427  return SEARCH_RESULT::QUIT;
428  }
429 
431  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ LocateDrawItem() [1/2]

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

Locate a draw object.

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

Definition at line 960 of file class_libentry.cpp.

962 {
963  for( LIB_ITEM& item : m_drawings )
964  {
965  if( ( aUnit && item.m_Unit && ( aUnit != item.m_Unit) )
966  || ( aConvert && item.m_Convert && ( aConvert != item.m_Convert ) )
967  || ( ( item.Type() != aType ) && ( aType != TYPE_NOT_INIT ) ) )
968  continue;
969 
970  if( item.HitTest( aPoint ) )
971  return &item;
972  }
973 
974  return NULL;
975 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define NULL

References m_drawings, NULL, and TYPE_NOT_INIT.

Referenced by LocateDrawItem().

◆ LocateDrawItem() [2/2]

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

Locate a draw object (overlaid)

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

Definition at line 978 of file class_libentry.cpp.

980 {
981  /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
982  * wxPoint& pt ) to search items.
983  * because this function uses DefaultTransform as orient/mirror matrix
984  * we temporary copy aTransform in DefaultTransform
985  */
986  LIB_ITEM* item;
987  TRANSFORM transform = DefaultTransform;
988  DefaultTransform = aTransform;
989 
990  item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
991 
992  // Restore matrix
993  DefaultTransform = transform;
994 
995  return item;
996 }
TRANSFORM DefaultTransform
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint)
Locate a draw object.

References DefaultTransform, and LocateDrawItem().

◆ LockUnits()

void LIB_PART::LockUnits ( bool  aLockUnits)
inline

Set interchangeable the property for part units.

Parameters
aLockUnitswhen true then units are set as not interchangeable.

Definition at line 245 of file class_libentry.h.

245 { m_unitsLocked = aLockUnits; }
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.

References m_unitsLocked.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares the item against the search criteria in aSearchData.

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

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

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, MARKER_PCB, LIB_PIN, SCH_PIN, SCH_MARKER, TEXTE_MODULE, and TEXTE_PCB.

Definition at line 473 of file base_struct.h.

474  {
475  return false;
476  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), LIB_PIN::Matches(), MARKER_PCB::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 152 of file base_struct.cpp.

153 {
154  wxString text = aText;
155  wxString searchText = aSearchData.GetFindString();
156 
157  // Don't match if searching for replaceable item and the item doesn't support text replace.
158  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
159  return false;
160 
161  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
162  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
163 
164  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
165  {
166  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
167  return text.Matches( searchText );
168 
169  return text.MakeUpper().Matches( searchText.MakeUpper() );
170  }
171 
172  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
173  return aText.Find( searchText ) != wxNOT_FOUND;
174 
175  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
176 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:517

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

◆ 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 206 of file base_struct.cpp.

207 {
208  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
209  GetChars( GetClass() ) ) );
210 
211  return false;
212 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

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

◆ operator=()

const LIB_PART & LIB_PART::operator= ( const LIB_PART aPart)

Definition at line 167 of file class_libentry.cpp.

168 {
169  if( &aPart == this )
170  return aPart;
171 
172  LIB_ITEM* newItem;
173 
174  m_library = aPart.m_library;
175  m_name = aPart.m_name;
176  m_FootprintList = wxArrayString( aPart.m_FootprintList );
177  m_unitCount = aPart.m_unitCount;
183  m_options = aPart.m_options;
184  m_libId = aPart.m_libId;
186  m_keyWords = aPart.m_keyWords;
188 
189  m_drawings.clear();
190 
191  for( const LIB_ITEM& oldItem : aPart.m_drawings )
192  {
193  if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
194  continue;
195 
196  newItem = (LIB_ITEM*) oldItem.Clone();
197  newItem->SetParent( this );
198  m_drawings.push_back( newItem );
199  }
200 
201  PART_SPTR parent = aPart.m_parent.lock();
202 
203  if( parent )
204  SetParent( parent.get() );
205 
206  return *this;
207 }
timestamp_t m_dateLastEdition
Date of the last modification.
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
PART_LIB * m_library
Library the part belongs to if any.
void clear(int aType=UNDEFINED_TYPE)
Definition: multivector.h:207
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
wxString m_docFileName
Associate doc file name.
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define IS_NEW
New item, just created.
Definition: base_struct.h:120
int m_pinNameOffset
The offset in mils to draw the pin name.
PART_REF m_parent
Use for inherited symbols.
wxString m_name
Symbol name.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
void push_back(T *aItem)
Definition: multivector.h:169
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
void SetParent(LIB_PART *aParent=nullptr)
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:129
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
LIB_ID m_libId
wxString m_keyWords
keyword list (used for search for parts by keyword)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:259
bool m_showPinNames
Determines if part pin names are visible.
wxString m_description
documentation for info

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

◆ operator==() [1/2]

bool LIB_PART::operator== ( const LIB_PART aPart) const
inline

Definition at line 583 of file class_libentry.h.

583 { return this == aPart; }

◆ operator==() [2/2]

bool LIB_PART::operator== ( const LIB_PART aPart) const
inline

Definition at line 584 of file class_libentry.h.

584 { return Compare( aPart ) == 0; }
int Compare(const LIB_PART &aRhs) const
Comparison test that can be used for operators.

References Compare().

◆ PinsConflictWith()

bool LIB_PART::PinsConflictWith ( LIB_PART aOtherPart,
bool  aTestNums,
bool  aTestNames,
bool  aTestType,
bool  aTestOrientation,
bool  aTestLength 
)

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

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

Parameters
aOtherPart- The other library part 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 688 of file class_libentry.cpp.

690 {
691  LIB_PINS thisPinList;
692  GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
693 
694  for( LIB_PIN* eachThisPin : thisPinList )
695  {
696  wxASSERT( eachThisPin );
697  LIB_PINS otherPinList;
698  aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
699  bool foundMatch = false;
700 
701  for( LIB_PIN* eachOtherPin : otherPinList )
702  {
703  wxASSERT( eachOtherPin );
704  // Same position?
705  if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
706  continue;
707 
708  // Same number?
709  if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ) )
710  continue;
711 
712  // Same name?
713  if( aTestNames && ( eachThisPin->GetName() != eachOtherPin->GetName() ) )
714  continue;
715 
716  // Same electrical type?
717  if( aTestType && ( eachThisPin->GetType() != eachOtherPin->GetType() ) )
718  continue;
719 
720  // Same orientation?
721  if( aTestOrientation
722  && ( eachThisPin->GetOrientation() != eachOtherPin->GetOrientation() ) )
723  continue;
724 
725  // Same length?
726  if( aTestLength && ( eachThisPin->GetLength() != eachOtherPin->GetLength() ) )
727  continue;
728 
729  foundMatch = true;
730  }
731 
732  if( !foundMatch )
733  {
734  // This means there was not an identical (according to the arguments)
735  // pin at the same position in the other component.
736  return true;
737  }
738  }
739 
740  // The loop never gave up, so no conflicts were found.
741  return false;
742 }
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_item.h:54
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.

References GetPins().

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

◆ Plot()

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

Plot lib part 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- Component part to plot.
aConvert- Component alternate body style to plot.
aOffset- Distance to shift the plot coordinates.
aTransform- Component plot transform matrix.

Definition at line 493 of file class_libentry.cpp.

495 {
496  wxASSERT( aPlotter != NULL );
497 
498  aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
499  bool fill = aPlotter->GetColorMode();
500 
501  // draw background for filled items using background option
502  // Solid lines will be drawn after the background
503  for( LIB_ITEM& item : m_drawings )
504  {
505  // Lib Fields are not plotted here, because this plot function
506  // is used to plot schematic items, which have they own fields
507  if( item.Type() == LIB_FIELD_T )
508  continue;
509 
510  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
511  continue;
512 
513  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
514  continue;
515 
516  if( item.m_Fill == FILLED_WITH_BG_BODYCOLOR )
517  item.Plot( aPlotter, aOffset, fill, aTransform );
518  }
519 
520  // Not filled items and filled shapes are now plotted
521  // Items that have BG fills only get re-stroked to ensure the edges are in the foreground
522  for( LIB_ITEM& item : m_drawings )
523  {
524  if( item.Type() == LIB_FIELD_T )
525  continue;
526 
527  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
528  continue;
529 
530  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
531  continue;
532 
533  item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILLED_WITH_BG_BODYCOLOR ),
534  aTransform );
535  }
536 }
virtual void SetColor(COLOR4D color)=0
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define NULL
COLOR_SETTINGS * ColorSettings()
Definition: plotter.h:145
COLOR4D GetColor(int aLayer) const
bool GetColorMode() const
Definition: plotter.h:138

References PLOTTER::ColorSettings(), FILLED_WITH_BG_BODYCOLOR, COLOR_SETTINGS::GetColor(), PLOTTER::GetColorMode(), LAYER_DEVICE, LIB_FIELD_T, m_drawings, NULL, and PLOTTER::SetColor().

Referenced by LIB_EDIT_FRAME::SVG_PlotComponent().

◆ PlotLibFields()

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

Plot Lib Fields only of the part to plotter.

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

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

Definition at line 539 of file class_libentry.cpp.

541 {
542  wxASSERT( aPlotter != NULL );
543 
544  aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_FIELDS ) );
545  bool fill = aPlotter->GetColorMode();
546 
547  for( LIB_ITEM& item : m_drawings )
548  {
549  if( item.Type() != LIB_FIELD_T )
550  continue;
551 
552  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
553  continue;
554 
555  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
556  continue;
557 
558  LIB_FIELD& field = (LIB_FIELD&) item;
559 
560  // The reference is a special case: we should change the basic text
561  // to add '?' and the part id
562  wxString tmp = field.GetShownText();
563 
564  if( field.GetId() == REFERENCE )
565  {
566  wxString text = field.GetFullText( aUnit );
567  field.SetText( text );
568  }
569 
570  item.Plot( aPlotter, aOffset, fill, aTransform );
571  field.SetText( tmp );
572  }
573 }
virtual void SetColor(COLOR4D color)=0
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int GetId() const
Definition: lib_field.h:139
Field Reference of part, i.e. "IC21".
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
#define NULL
COLOR_SETTINGS * ColorSettings()
Definition: plotter.h:145
COLOR4D GetColor(int aLayer) const
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:315
virtual wxString GetShownText() const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:129
bool GetColorMode() const
Definition: plotter.h:138

References PLOTTER::ColorSettings(), COLOR_SETTINGS::GetColor(), PLOTTER::GetColorMode(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), EDA_TEXT::GetShownText(), LAYER_FIELDS, LIB_FIELD_T, m_drawings, NULL, REFERENCE, PLOTTER::SetColor(), and EDA_TEXT::SetText().

Referenced by LIB_EDIT_FRAME::SVG_PlotComponent().

◆ Print()

void LIB_PART::Print ( wxDC *  aDc,
const wxPoint aOffset,
int  aMulti,
int  aConvert,
const PART_DRAW_OPTIONS aOpts 
)

Print part.

Parameters
aDc- Device context to draw on.
aOffset- Position of part.
aMulti- unit if multiple units per part.
aConvert- Component conversion (DeMorgan) if available.
aOpts- Drawing options

Definition at line 426 of file class_libentry.cpp.

428 {
429  /* draw background for filled items using background option
430  * Solid lines will be drawn after the background
431  * Note also, background is not drawn when printing in black and white
432  */
433  if( !GetGRForceBlackPenState() )
434  {
435  for( LIB_ITEM& drawItem : m_drawings )
436  {
437  if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR )
438  continue;
439 
440  // Do not draw items not attached to the current part
441  if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
442  continue;
443 
444  if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
445  continue;
446 
447  if( drawItem.Type() == LIB_FIELD_T )
448  continue;
449 
450  // Now, draw only the background for items with
451  // m_Fill == FILLED_WITH_BG_BODYCOLOR:
452  drawItem.Print( aDc, aOffset, (void*) false, aOpts.transform );
453  }
454  }
455 
456  for( LIB_ITEM& drawItem : m_drawings )
457  {
458  // Do not draw items not attached to the current part
459  if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
460  continue;
461 
462  if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
463  continue;
464 
465  if( drawItem.Type() == LIB_FIELD_T )
466  {
467  LIB_FIELD& field = static_cast<LIB_FIELD&>( drawItem );
468 
469  if( field.IsVisible() && !aOpts.draw_visible_fields )
470  continue;
471 
472  if( !field.IsVisible() && !aOpts.draw_hidden_fields )
473  continue;
474  }
475 
476  if( drawItem.Type() == LIB_PIN_T )
477  {
478  drawItem.Print( aDc, aOffset, (void*) &aOpts, aOpts.transform );
479  }
480  else if( drawItem.Type() == LIB_FIELD_T )
481  {
482  drawItem.Print( aDc, aOffset, (void*) NULL, aOpts.transform );
483  }
484  else
485  {
486  bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
487  drawItem.Print( aDc, aOffset, (void*) forceNoFill, aOpts.transform );
488  }
489  }
490 }
bool IsVisible() const
Definition: eda_text.h:170
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
bool draw_hidden_fields
Whether to draw "hidden" fields.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
#define NULL
bool draw_visible_fields
Whether to draw "visible" fields.
bool GetGRForceBlackPenState(void)
Function GetGRForceBlackPenState.
Definition: gr_basic.cpp:211
TRANSFORM transform
Coordinate adjustment settings.

References PART_DRAW_OPTIONS::draw_hidden_fields, PART_DRAW_OPTIONS::draw_visible_fields, FILLED_WITH_BG_BODYCOLOR, GetGRForceBlackPenState(), EDA_TEXT::IsVisible(), LIB_FIELD_T, LIB_PIN_T, m_drawings, NULL, and PART_DRAW_OPTIONS::transform.

Referenced by SCH_COMPONENT::Print(), and LIB_EDIT_FRAME::PrintPage().

◆ RemoveDrawItem()

void LIB_PART::RemoveDrawItem ( LIB_ITEM aItem)

Remove draw aItem from list.

Parameters
aItem- Draw item to remove from list.

Definition at line 576 of file class_libentry.cpp.

577 {
578  wxASSERT( aItem != NULL );
579 
580  // none of the MANDATORY_FIELDS may be removed in RAM, but they may be
581  // omitted when saving to disk.
582  if( aItem->Type() == LIB_FIELD_T )
583  {
584  LIB_FIELD* field = (LIB_FIELD*) aItem;
585 
586  if( field->GetId() < MANDATORY_FIELDS )
587  {
588  wxLogWarning( _(
589  "An attempt was made to remove the %s field from component %s in library %s." ),
591  return;
592  }
593  }
594 
595  LIB_ITEMS& items = m_drawings[ aItem->Type() ];
596 
597  for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
598  {
599  if( *i == aItem )
600  {
601  items.erase( i );
602  SetModified();
603  break;
604  }
605  }
606 }
void SetModified()
Definition: base_struct.cpp:94
wxString GetName() const override
const wxString GetLibraryName() const
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int GetId() const
Definition: lib_field.h:139
#define TRANSLATE_FIELD_NAME
Returns the field name.
Definition: lib_field.h:124
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
#define NULL
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
wxString GetName(bool aTranslate) const
Definition: lib_field.cpp:387
#define _(s)
Definition: 3d_actions.cpp:33
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

References _, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), LIB_FIELD::GetId(), GetLibraryName(), LIB_FIELD::GetName(), GetName(), LIB_FIELD_T, m_drawings, MANDATORY_FIELDS, NULL, EDA_ITEM::SetModified(), TRANSLATE_FIELD_NAME, and EDA_ITEM::Type().

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_TOOL::DoDelete(), LIB_PIN::SetConversion(), LIB_PIN::SetPartNumber(), and DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow().

◆ RemoveDuplicateDrawItems()

void LIB_PART::RemoveDuplicateDrawItems ( )

Remove duplicate draw items from list.

Definition at line 919 of file class_libentry.cpp.

920 {
921  m_drawings.unique();
922 }
void unique()
Remove duplicate elements in list.
Definition: multivector.h:251
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.

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

Referenced by LIB_EDIT_FRAME::LoadOneSymbol().

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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

Definition at line 179 of file base_struct.cpp.

180 {
181  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
182 
183  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
184  aSearchData.GetFindString() :
185  aSearchData.GetFindString().Upper() );
186 
187  if( result == wxNOT_FOUND )
188  return false;
189 
190  wxString prefix = aText.Left( result );
191  wxString suffix;
192 
193  if( aSearchData.GetFindString().length() + result < aText.length() )
194  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
195 
196  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
197  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
198  GetChars( suffix ) );
199 
200  aText = prefix + aSearchData.GetReplaceString() + suffix;
201 
202  return true;
203 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

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

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

Reimplemented in SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 505 of file base_struct.h.

505 { return false; }

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetConversion()

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

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

If the part 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 part.

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

Definition at line 1071 of file class_libentry.cpp.

1072 {
1073  if( aSetConvert == HasConversion() )
1074  return;
1075 
1076  // Duplicate items to create the converted shape
1077  if( aSetConvert )
1078  {
1079  if( aDuplicatePins )
1080  {
1081  std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
1082 
1083  for( LIB_ITEM& item : m_drawings )
1084  {
1085  // Only pins are duplicated.
1086  if( item.Type() != LIB_PIN_T )
1087  continue;
1088 
1089  if( item.m_Convert == 1 )
1090  {
1091  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1092  newItem->m_Convert = 2;
1093  tmp.push_back( newItem );
1094  }
1095  }
1096 
1097  // Transfer the new pins to the LIB_PART.
1098  for( unsigned i = 0; i < tmp.size(); i++ )
1099  m_drawings.push_back( tmp[i] );
1100  }
1101  }
1102  else
1103  {
1104  // Delete converted shape items because the converted shape does
1105  // not exist
1107 
1108  while( i != m_drawings.end() )
1109  {
1110  if( i->m_Convert > 1 )
1111  i = m_drawings.erase( i );
1112  else
1113  ++i;
1114  }
1115  }
1116 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
void push_back(T *aItem)
Definition: multivector.h:169
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The non-const iterator
Definition: multivector.h:160
int m_Convert
Shape identification for alternate body styles.
Definition: lib_item.h:87

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, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back().

Referenced by LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetDescription()

void LIB_PART::SetDescription ( const wxString &  aDescription)
inline

Definition at line 162 of file class_libentry.h.

163  {
164  m_description = aDescription;
165  }
wxString m_description
documentation for info

References m_description.

Referenced by BOOST_AUTO_TEST_CASE(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetDocFileName()

void LIB_PART::SetDocFileName ( const wxString &  aDocFileName)
inline

Definition at line 176 of file class_libentry.h.

177  {
178  m_docFileName = aDocFileName;
179  }
wxString m_docFileName
Associate doc file name.

References m_docFileName.

Referenced by BOOST_AUTO_TEST_CASE(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetFields()

void LIB_PART::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 part field editor, and it establishes needed behavior.

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

Definition at line 816 of file class_libentry.cpp.

817 {
818  deleteAllFields();
819 
820  for( unsigned i=0; i<aFields.size(); ++i )
821  {
822  // drawings is a ptr_vector, new and copy an object on the heap.
823  LIB_FIELD* field = new LIB_FIELD( aFields[i] );
824 
825  field->SetParent( this );
826  m_drawings.push_back( field );
827  }
828 }
Field object used in symbol libraries.
Definition: lib_field.h:59
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void deleteAllFields()
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
void push_back(T *aItem)
Definition: multivector.h:169

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

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 257 of file base_struct.h.

257 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::CreateNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), LIB_DRAWING_TOOLS::DrawShape(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetFootprintFilters()

void LIB_PART::SetFootprintFilters ( const wxArrayString &  aFootprintFilters)
inline

Definition at line 199 of file class_libentry.h.

200  {
201  m_FootprintList = aFootprintFilters;
202  }
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).

References m_FootprintList.

Referenced by BOOST_AUTO_TEST_CASE(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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

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

Definition at line 308 of file base_struct.h.

308 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186

References EDA_ITEM::m_forceVisible.

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 232 of file base_struct.h.

232 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:257
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetKeyWords()

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

Definition at line 169 of file class_libentry.h.

170  {
171  m_keyWords = aKeyWords;
172  }
wxString m_keyWords
keyword list (used for search for parts by keyword)

References m_keyWords.

Referenced by BOOST_AUTO_TEST_CASE(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetLib()

void LIB_PART::SetLib ( PART_LIB aLibrary)
inline

Definition at line 194 of file class_libentry.h.

194 { m_library = aLibrary; }
PART_LIB * m_library
Library the part belongs to if any.

References m_library.

Referenced by LEGACY_RESCUER::AddPart(), PART_LIB::FindPart(), LIB_PART(), and PART_LIB::LoadLibrary().

◆ SetLibId()

◆ SetModified()

◆ SetName()

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

Definition at line 305 of file class_libentry.cpp.

306 {
307  wxString validatedName = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
308 
309  m_name = validatedName;
310  m_libId.SetLibItemName( validatedName, false );
311 
312  GetValueField().SetText( validatedName );
313 }
LIB_FIELD & GetValueField()
Return reference to the value field.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
wxString m_name
Symbol name.
LIB_ID m_libId
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:206
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, LIB_ID_TYPE aType, bool aLib=false)
Replace illegal LIB_ID item name characters with underscores '_'.
Definition: lib_id.cpp:352

References LIB_ID::FixIllegalChars(), GetValueField(), LIB_ID::ID_SCH, m_libId, m_name, LIB_ID::SetLibItemName(), and EDA_TEXT::SetText().

Referenced by BOOST_AUTO_TEST_CASE(), SCH_EDIT_FRAME::CreateArchiveLibrary(), LIB_EDIT_TOOL::editFieldProperties(), LIB_EDIT_FRAME::fixDuplicateAliases(), LIB_PART(), RESCUE_CACHE_CANDIDATE::PerformAction(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction(), LIB_EDIT_FRAME::savePartAs(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow(), LIB_EDIT_FRAME::UpdateAfterSymbolProperties(), and DIALOG_LIB_EDIT_ONE_FIELD::UpdateField().

◆ SetNormal()

void LIB_PART::SetNormal ( )
inline

Definition at line 239 of file class_libentry.h.

239 { m_options = ENTRY_NORMAL; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)

References ENTRY_NORMAL, and m_options.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetOffset()

void LIB_PART::SetOffset ( const wxPoint aOffset)

Move the part aOffset.

Parameters
aOffset- Offset displacement.

Definition at line 912 of file class_libentry.cpp.

913 {
914  for( LIB_ITEM& item : m_drawings )
915  item.Offset( aOffset );
916 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References m_drawings.

Referenced by LIB_DRAWING_TOOLS::PlaceAnchor().

◆ SetParent() [1/2]

void LIB_PART::SetParent ( LIB_PART aParent = nullptr)

Definition at line 316 of file class_libentry.cpp.

317 {
318  if( aParent )
319  {
320  m_parent = aParent->SharedPtr();
321 
322  // Inherit the parent mandatory field attributes.
323  for( int id=0; id<MANDATORY_FIELDS; ++id )
324  {
325  LIB_FIELD* field = GetField( id );
326 
327  // the MANDATORY_FIELDS are exactly that in RAM.
328  wxASSERT( field );
329 
330  LIB_FIELD* parentField = aParent->GetField( id );
331 
332  wxASSERT( parentField );
333 
334  wxString name = field->GetText();
335 
336  *field = *parentField;
337 
338  if( id == VALUE )
339  field->SetText( name );
340  else if( id == DATASHEET && !GetDocFileName().IsEmpty() )
341  field->SetText( GetDocFileName() );
342 
343  field->SetParent( this );
344  }
345  }
346  else
347  {
348  m_parent.reset();
349  }
350 }
name of datasheet
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
Field object used in symbol libraries.
Definition: lib_field.h:59
PART_REF m_parent
Use for inherited symbols.
#define VALUE
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:111
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
PART_SPTR SharedPtr()
wxString GetDocFileName() const
const char * name
Definition: DXF_plotter.cpp:60
LIB_FIELD * GetField(int aId) const
Return pointer to the requested field.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:123

References DATASHEET, GetDocFileName(), GetField(), EDA_TEXT::GetText(), m_parent, MANDATORY_FIELDS, name, EDA_ITEM::SetParent(), EDA_TEXT::SetText(), SharedPtr(), and VALUE.

Referenced by LIB_EDIT_FRAME::CreateNewPart(), LIB_EDIT_FRAME::DuplicatePart(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), LIB_PART(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), operator=(), LIB_MANAGER::LIB_BUFFER::SaveBuffer(), and LIB_MANAGER::SaveLibrary().

◆ SetParent() [2/2]

◆ SetPinNameOffset()

void LIB_PART::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 553 of file class_libentry.h.

553 { m_pinNameOffset = aOffset; }
int m_pinNameOffset
The offset in mils to draw the pin name.

References m_pinNameOffset.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetPower()

void LIB_PART::SetPower ( )
inline

Definition at line 238 of file class_libentry.h.

238 { m_options = ENTRY_POWER; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)

References ENTRY_POWER, and m_options.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

◆ SetShowPinNames()

void LIB_PART::SetShowPinNames ( bool  aShow)
inline

Set or clear the pin name visibility flag.

Parameters
aShow- True to make the part pin names visible.

Definition at line 561 of file class_libentry.h.

561 { m_showPinNames = aShow; }
bool m_showPinNames
Determines if part pin names are visible.

References m_showPinNames.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetShowPinNumbers()

void LIB_PART::SetShowPinNumbers ( bool  aShow)
inline

Set or clear the pin number visibility flag.

Parameters
aShow- True to make the part pin numbers visible.

Definition at line 569 of file class_libentry.h.

569 { m_showPinNumbers = aShow; }
bool m_showPinNumbers
Determines if part pin numbers are visible.

References m_showPinNumbers.

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetState()

void EDA_ITEM::SetState ( int  type,
int  state 
)
inlineinherited

Definition at line 246 of file base_struct.h.

247  {
248  if( state )
249  m_Status |= type; // state = ON or OFF
250  else
251  m_Status &= ~type;
252  }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), SELECTION_TOOL::selectConnectedTracks(), and TRACK::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 255 of file base_struct.h.

255 { m_Status = aStatus; }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetSubpartIdNotation()

void LIB_PART::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 part 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 part ('A' or '1')

Definition at line 1119 of file class_libentry.cpp.

1120 {
1121  m_subpartFirstId = 'A';
1123 
1124  if( aSep == '.' || aSep == '-' || aSep == '_' )
1125  m_subpartIdSeparator = aSep;
1126 
1127  if( aFirstId == '1' && aSep != 0 )
1128  m_subpartFirstId = aFirstId;
1129 }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the part number: only 'A',...

References m_subpartFirstId, and m_subpartIdSeparator.

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

◆ SetUnitCount()

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

Set the units per part count.

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

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

Definition at line 1015 of file class_libentry.cpp.

1016 {
1017  if( m_unitCount == aCount )
1018  return;
1019 
1020  if( aCount < m_unitCount )
1021  {
1023 
1024  while( i != m_drawings.end() )
1025  {
1026  if( i->m_Unit > aCount )
1027  i = m_drawings.erase( i );
1028  else
1029  ++i;
1030  }
1031  }
1032  else if( aDuplicateDrawItems )
1033  {
1034  int prevCount = m_unitCount;
1035 
1036  // Temporary storage for new items, as adding new items directly to
1037  // m_drawings may cause the buffer reallocation which invalidates the
1038  // iterators
1039  std::vector< LIB_ITEM* > tmp;
1040 
1041  for( LIB_ITEM& item : m_drawings )
1042  {
1043  if( item.m_Unit != 1 )
1044  continue;
1045 
1046  for( int j = prevCount + 1; j <= aCount; j++ )
1047  {
1048  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1049  newItem->m_Unit = j;
1050  tmp.push_back( newItem );
1051  }
1052  }
1053 
1054  for( auto item : tmp )
1055  m_drawings.push_back( item );
1056  }
1057 
1058  m_unitCount = aCount;
1059 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
int m_unitCount
Number of units (parts) per package.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int m_Unit
Unit identification for multiple parts per package.
Definition: lib_item.h:81
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
void push_back(T *aItem)
Definition: multivector.h:169
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The non-const iterator
Definition: multivector.h:160

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, and MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back().

Referenced by BOOST_AUTO_TEST_CASE(), LIB_EDIT_FRAME::CreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 230 of file base_struct.h.

230 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:257
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SharedPtr()

PART_SPTR LIB_PART::SharedPtr ( )
inline

Definition at line 144 of file class_libentry.h.

144 { return m_me; }
PART_SPTR m_me
< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared

References m_me.

Referenced by PART_LIB::AddPart(), SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), LIB_VIEW_FRAME::GetDocumentExtents(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), and SetParent().

◆ ShowPinNames()

bool LIB_PART::ShowPinNames ( )
inline

◆ ShowPinNumbers()

bool LIB_PART::ShowPinNumbers ( )
inline

◆ Sort()

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

Function Sort is a 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 536 of file base_struct.h.

536 { return *aLeft < *aRight; }

◆ SubpartFirstIdPtr()

static int* LIB_PART::SubpartFirstIdPtr ( )
inlinestatic

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

Definition at line 518 of file class_libentry.h.

518 { return &m_subpartFirstId; }
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the part number: only 'A',...

References m_subpartFirstId.

Referenced by SCH_EDIT_FRAME::AddFormattingParameters().

◆ SubpartIdSeparatorPtr()

static int* LIB_PART::SubpartIdSeparatorPtr ( )
inlinestatic

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

Definition at line 513 of file class_libentry.h.

513 { return &m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...

References m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::AddFormattingParameters().

◆ SubReference()

wxString LIB_PART::SubReference ( int  aUnit,
bool  aAddSeparator = true 
)
static
Returns
the sub reference for part having multiple units per part. The sub reference identify the part (or unit)
Parameters
aUnit= the part 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 394 of file class_libentry.cpp.

395 {
396  wxString subRef;
397 
398  if( m_subpartIdSeparator != 0 && aAddSeparator )
399  subRef << wxChar( m_subpartIdSeparator );
400 
401  if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
402  subRef << aUnit;
403  else
404  {
405  // use letters as notation. To allow more than 26 units, the sub ref
406  // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise
407  // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available)
408  int u;
409  aUnit -= 1; // Unit number starts to 1. now to 0.
410 
411  while( aUnit >= 26 ) // more than one letter are needed
412  {
413  u = aUnit / 26;
414  subRef << wxChar( m_subpartFirstId + u -1 );
415  aUnit %= 26;
416  }
417 
418  u = m_subpartFirstId + aUnit;
419  subRef << wxChar( u );
420  }
421 
422  return subRef;
423 }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the part number: only 'A',...

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_REFERENCE_LIST::CheckAnnotation(), SCH_REFERENCE::GetFullRef(), LIB_FIELD::GetFullText(), SCH_FIELD::GetFullyQualifiedText(), SCH_COMPONENT::GetRef(), GetUnitReference(), mapExistingAnnotation(), SCH_FIELD::Matches(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary(), LIB_EDIT_FRAME::RebuildSymbolUnitsList(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), and SYMBOL_UNIT_MENU::update().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 212 of file base_struct.h.

213  {
214  return m_StructType;
215  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:178

References EDA_ITEM::m_StructType.

Referenced by MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_SCREENS::buildScreenList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), TEXTE_PCB::ClassOf(), SCH_NO_CONNECT::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_PIN::ClassOf(), EDGE_MODULE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), SCH_FIELD::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), ZONE_CONTAINER::ClassOf(), SCH_BITMAP::ClassOf(), TRACK::ClassOf(), DIMENSION::ClassOf(), NETINFO_ITEM::ClassOf(), MARKER_PCB::ClassOf(), SCH_SHEET_PIN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_SCREEN::ClassOf(), D_PAD::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), SCH_TEXT::ClassOf(), SCH_SHEET::ClassOf(), ARC::ClassOf(), SCH_LABEL::ClassOf(), VIA::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), LIB_RECTANGLE::compare(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_ITEM::compare(), LIB_PIN::compare(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), SCH_EDIT_FRAME::ConvertTextType(), MODULE::CoverageRatio(), CINFO3D_VISU::createLayers(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), NETLIST_EXPORTER::CreatePinList(), D_PAD::D_PAD(), SCH_SCREEN::DeleteItem(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), 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(), DRC::doTrackDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), MODULE::DuplicateItem(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckLabels(), NETLIST_EXPORTER::findNextComponent(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), TRACK::GetBoundingBox(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), CONNECTION_GRAPH::getDefaultConnection(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), SCH_FIELD::GetFullyQualifiedText(), SCH_FIELD::GetMenuImage(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTIVITY_DATA::GetNetItems(), GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_FIELD::GetParentPosition(), GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), getRect(), KIGFX::SCH_PAINTER::getRenderColor(), PCBNEW_SELECTION::GetTopLeftItem(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hash_eda(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_FIELD::IsReplaceable(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), SCH_MOVE_TOOL::moveItem(), SCH_CONNECTION::Name(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), POINT_EDITOR::OnSelectionChange(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_TEXT::operator<(), SCH_ITEM::operator<(), SCH_SHEET::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_FIELD::Print(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SELECTION_TOOL::RebuildSelection(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RefreshSelection(), EE_RTREE::remove(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), WS_PROXY_UNDO_ITEM::Restore(), SCH_EDIT_TOOL::Rotate(), SCH_TEXT::Rotate(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_SEXPR_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_SEXPR_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_SEXPR_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectConnectedTracks(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), ShowClearance(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), TEXTE_PCB::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_FIELD::SwapData(), TRACK::SwapData(), DIMENSION::SwapData(), ARC::SwapData(), SCH_SHEET::SwapData(), VIA::SwapData(), SCH_COMPONENT::SwapData(), MODULE::SwapData(), ZONE_CONTAINER::SwapData(), D_PAD::SwapData(), SwapItemData(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), LIB_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), SCH_TEXT::UpdateDanglingState(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), EE_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), CONNECTION_GRAPH::updateItemConnectivity(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_SHEET::Visit(), SCH_COMPONENT::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ UnitsLocked()

bool LIB_PART::UnitsLocked ( ) const
inline

Check whether part units are interchangeable.

Returns
False when interchangeable, true otherwise.

Definition at line 251 of file class_libentry.h.

251 { return m_unitsLocked; }
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit.

References m_unitsLocked.

Referenced by LIB_EDIT_TOOL::editSymbolProperties(), GetUniqueUnits(), SCH_REFERENCE::IsUnitsLocked(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::LoadPart(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), LIB_EDIT_FRAME::SetCurPart(), LIB_EDIT_FRAME::SynchronizePins(), LIB_EDIT_FRAME::SyncToolbars(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Function ViewBBox() returns the bounding box of the item covering all its layers.

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, TRACK, MARKER_PCB, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 227 of file base_struct.cpp.

228 {
229  // Basic fallback
230  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
231  VECTOR2I( GetBoundingBox().GetSize() ) );
232 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References EDA_ITEM::GetBoundingBox().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), and BRIGHT_BOX::ViewDraw().

◆ ViewDraw()

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

Function ViewDraw() Draws the parts of the object belonging to layer aLayer.

viewDraw() is an alternative way for drawing objects if 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
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on

Reimplemented in EDIT_POINTS, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::VIEW_OVERLAY, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 116 of file view_item.h.

117  {}

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

◆ ViewGetLayers()

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

Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.

For instance, a D_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[]output layer index array
aCountnumber of layer indices in aLayers[]

Reimplemented from EDA_ITEM.

Definition at line 775 of file class_libentry.cpp.

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

◆ ViewGetLOD()

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

Function ViewGetLOD() Returns 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
aLayercurrent drawing layer
aViewpointer 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 MODULE_ZONE_CONTAINER, D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TEXTE_MODULE, TRACK, and EDGE_MODULE.

Definition at line 140 of file view_item.h.

141  {
142  // By default always show the item
143  return 0;
144  }

Referenced by KIGFX::VIEW::drawItem::operator()(), GRID_HELPER::queryVisible(), and SELECTION_TOOL::Selectable().

◆ viewPrivData()

◆ Visit()

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

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

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

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 999 of file class_libentry.cpp.

1000 {
1001  // The part itself is never inspected, only its children
1002  for( LIB_ITEM& item : m_drawings )
1003  {
1004  if( item.IsType( aFilterTypes ) )
1005  {
1006  if( aInspector( &item, aTestData ) == SEARCH_RESULT::QUIT )
1007  return SEARCH_RESULT::QUIT;
1008  }
1009  }
1010 
1011  return SEARCH_RESULT::CONTINUE;
1012 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
The base class for drawable items used by schematic library components.
Definition: lib_item.h:60

References CONTINUE, m_drawings, and QUIT.

Member Data Documentation

◆ m_dateLastEdition

timestamp_t LIB_PART::m_dateLastEdition
private

Date of the last modification.

Definition at line 113 of file class_libentry.h.

Referenced by GetDateLastEdition(), LIB_PART(), and operator=().

◆ m_description

wxString LIB_PART::m_description
private

documentation for info

Definition at line 121 of file class_libentry.h.

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

◆ m_docFileName

wxString LIB_PART::m_docFileName
private

Associate doc file name.

Definition at line 123 of file class_libentry.h.

Referenced by Compare(), Flatten(), GetDocFileName(), LIB_PART(), operator=(), and SetDocFileName().

◆ m_drawings

◆ m_Flags

◆ m_FootprintList

wxArrayString LIB_PART::m_FootprintList
private

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

Definition at line 117 of file class_libentry.h.

Referenced by Compare(), GetFootprints(), LIB_PART(), operator=(), and SetFootprintFilters().

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

Set to true to override the visibility setting of the item.

Definition at line 186 of file base_struct.h.

Referenced by ZONE_CONTAINER::initDataFromSrcInCopyCtor(), EDA_ITEM::initVars(), EDA_ITEM::operator=(), SCH_FIELD::Print(), and EDA_ITEM::SetForceVisible().

◆ m_keyWords

wxString LIB_PART::m_keyWords
private

keyword list (used for search for parts by keyword)

Definition at line 122 of file class_libentry.h.

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

◆ m_libId

LIB_ID LIB_PART::m_libId
private

Definition at line 105 of file class_libentry.h.

Referenced by Compare(), GetLibId(), GetLibraryName(), LIB_PART(), operator=(), SetLibId(), and SetName().

◆ m_library

PART_LIB* LIB_PART::m_library
private

Library the part belongs to if any.

Definition at line 119 of file class_libentry.h.

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

◆ m_me

◆ m_name

wxString LIB_PART::m_name
private

Symbol name.

Definition at line 120 of file class_libentry.h.

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

◆ m_options

LIBRENTRYOPTIONS LIB_PART::m_options
private

Special part features such as POWER or NORMAL.)

Definition at line 114 of file class_libentry.h.

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

◆ m_parent

PART_REF LIB_PART::m_parent
private

Use for inherited symbols.

Definition at line 103 of file class_libentry.h.

Referenced by Compare(), Flatten(), GetParent(), GetUnitCount(), HasConversion(), IsAlias(), IsRoot(), LIB_PART(), operator=(), and SetParent().

◆ m_Parent

◆ m_pinNameOffset

int LIB_PART::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 107 of file class_libentry.h.

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

◆ m_showPinNames

bool LIB_PART::m_showPinNames
private

Determines if part pin names are visible.

Definition at line 111 of file class_libentry.h.

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

◆ m_showPinNumbers

bool LIB_PART::m_showPinNumbers
private

Determines if part pin numbers are visible.

Definition at line 112 of file class_libentry.h.

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

◆ m_subpartFirstId

int LIB_PART::m_subpartFirstId = 'A'
staticprivate

the ASCII char value to calculate the subpart symbol id from the part number: only 'A', 'a' or '1' can be used, other values have no sense.

Definition at line 128 of file class_libentry.h.

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

◆ m_subpartIdSeparator

int LIB_PART::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 125 of file class_libentry.h.

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

◆ m_unitCount

int LIB_PART::m_unitCount
private

Number of units (parts) per package.

Definition at line 115 of file class_libentry.h.

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

◆ m_unitsLocked

bool LIB_PART::m_unitsLocked
private

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

Definition at line 109 of file class_libentry.h.

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

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 169 of file base_struct.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_EDIT_FRAME::AnnotateComponents(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_SHEET_PATH::Cmp(), Diagnose(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), CONNECTION_GRAPH::ercCheckNoConnects(), PCB_EDIT_FRAME::Exchange_Module(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), PCB_IO::format(), FormatProbeItem(), SCH_PIN::GetDefaultNetName(), SCH_SHEET::GetMsgPanelInfo(), SCH_REFERENCE::GetPath(), SCH_MARKER::GetUUID(), MARKER_PCB::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), LEGACY_PLUGIN::loadTrackList(), NETLIST_EXPORTER_GENERIC::makeComponents(), mapExistingAnnotation(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_COMPONENT::SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), RC_ITEM::SetData(), SwapItemData(), TestMultiunitFootprints(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().


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