KiCad PCB EDA Suite
LIB_PART Class Reference

Class LIB_PART defines a library part object. More...

#include <class_libentry.h>

Inheritance diagram for LIB_PART:
EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 LIB_PART (const wxString &aName, PART_LIB *aLibrary=NULL)
 
 LIB_PART (LIB_PART &aPart, PART_LIB *aLibrary=NULL)
 
virtual ~LIB_PART ()
 
PART_SPTR SharedPtr ()
 
virtual wxString GetClass () const override
 Function GetClass returns the class name. More...
 
virtual void SetName (const wxString &aName)
 
const wxString & GetName () const
 
const LIB_IDGetLibId () const
 
const wxString GetLibraryName ()
 
PART_LIBGetLib ()
 
void SetLib (PART_LIB *aLibrary)
 
wxArrayString GetAliasNames (bool aIncludeRoot=true) const
 
size_t GetAliasCount () const
 
LIB_ALIASGetAlias (size_t aIndex)
 
LIB_ALIASGetAlias (const wxString &aName)
 
void AddAlias (const wxString &aName)
 Function AddAlias. More...
 
bool HasAlias (const wxString &aName) const
 Test if alias aName is in part alias list. More...
 
void SetAliases (const wxArrayString &aAliasList)
 
void RemoveAlias (const wxString &aName)
 
LIB_ALIASRemoveAlias (LIB_ALIAS *aAlias)
 
void RemoveAllAliases ()
 
wxArrayString & GetFootPrints ()
 
const EDA_RECT GetUnitBoundingBox (int aUnit, int aConvert) const
 Function GetBoundingBox. More...
 
const EDA_RECT GetBodyBoundingBox (int aUnit, int aConvert) const
 Function GetBodyBoundingBox. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
bool SaveDateAndTime (OUTPUTFORMATTER &aFormatter)
 Function SaveDateAndTime write the date and time of part to aFile in the format: "Ti yy/mm/jj hh:mm:ss". More...
 
bool LoadDateAndTime (char *aLine)
 
bool Save (OUTPUTFORMATTER &aFormatter)
 Function Save writes the data structures out to aFormatter in the part library "*.lib" format. More...
 
bool Load (LINE_READER &aReader, wxString &aErrorMsg)
 Load part definition from aReader. More...
 
bool LoadField (LINE_READER &aReader, wxString &aErrorMsg)
 
bool LoadDrawEntries (LINE_READER &aReader, wxString &aErrorMsg)
 
bool LoadAliases (char *aLine, wxString &aErrorMsg)
 
bool LoadFootprints (LINE_READER &aReader, wxString &aErrorMsg)
 
bool IsPower () const
 
bool IsNormal () const
 
void SetPower ()
 
void SetNormal ()
 
void LockUnits (bool aLockUnits)
 
bool UnitsLocked () const
 
void SetFields (const std::vector< LIB_FIELD > &aFieldsList)
 Function SetFields overwrites all the existing in this part with fields supplied in aFieldsList. More...
 
void GetFields (LIB_FIELDS &aList)
 Function GetFields returns a list of fields withing this part. More...
 
LIB_FIELDFindField (const wxString &aFieldName)
 Function FindField finds a field within this part matching aFieldName and returns it or NULL if not found. More...
 
LIB_FIELDGetField (int aId)
 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 Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
 Draw 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, EDA_DRAW_PANEL *aPanel=NULL, wxDC *aDc=NULL)
 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)
 Function PinsConflictWith returns 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 ClearStatus ()
 Clears the status flag all draw objects in this part. More...
 
int SelectItems (EDA_RECT &aRect, int aUnit, int aConvert, bool aEditPinByPin)
 Checks all draw objects of part to see if they are with block. More...
 
void ClearSelectedItems ()
 Clears all the draw items marked by a block select. More...
 
void DeleteSelectedItems ()
 Deletes the select draw items marked by a block select. More...
 
void MoveSelectedItems (const wxPoint &aOffset)
 Move the selected draw items marked by a block select. More...
 
void CopySelectedItems (const wxPoint &aOffset)
 Make a copy of the selected draw items marked by a block select. More...
 
void MirrorSelectedItemsH (const wxPoint &aCenter)
 Horizontally (X axis) mirror selected draw items about a point. More...
 
void MirrorSelectedItemsV (const wxPoint &aCenter)
 Vertically (Y axis) mirror selected draw items about a point. More...
 
void RotateSelectedItems (const wxPoint &aCenter)
 Rotate CCW selected draw items about a point. More...
 
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...
 
void SetUnitCount (int count)
 Set the units per part count. More...
 
int GetUnitCount () const
 
bool IsMulti () const
 Function IsMulti. More...
 
void SetConversion (bool aSetConvert)
 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 ()
 
bool operator== (const LIB_PART *aPart) const
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () const
 
EDA_ITEMGetParent () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual void GetMsgPanelInfo (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) const
 Function HitTest tests if aPosition is contained within or on the bounding area 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 SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual wxString GetSelectMenuText () 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, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
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 ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. 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
 

Static Public Member Functions

static wxString SubReference (int aUnit, bool aAddSeparator=true)
 Function SubReference. More...
 
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...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Protected Member Functions

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

Protected Attributes

EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
time_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

void 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...
 
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...
 
long m_dateModified
 Date the part was last modified. 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...
 
LIB_ALIASES m_aliases
 List of alias object pointers associated with the part. More...
 
PART_LIBm_library
 Library the part belongs to if any. 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

Class LIB_PART defines a library part object.

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

Definition at line 225 of file class_libentry.h.

Constructor & Destructor Documentation

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

Definition at line 178 of file class_libentry.cpp.

References DATASHEET, ENTRY_NORMAL, FOOTPRINT, LIB_FIELD_T, m_dateModified, 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(), and VALUE.

Referenced by LIB_EDIT_FRAME::OnExportPart().

178  :
179  EDA_ITEM( LIB_PART_T ),
180  m_me( this, null_deleter() )
181 {
182  m_dateModified = 0;
183  m_unitCount = 1;
184  m_pinNameOffset = 40;
186  m_unitsLocked = false;
187  m_showPinNumbers = true;
188  m_showPinNames = true;
189 
190  // Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
191  // when the field editors are invoked.
196 
197  SetLib( aLibrary );
198  SetName( aName );
199 }
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.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
Field Name Module PCB, i.e. "16DIP300".
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.
void push_back(T *aItem)
Definition: multivector.h:169
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:66
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared ...
Field Value of part, i.e. "3.3K".
long m_dateModified
Date the part was last modified.
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 ...
LIB_PART::LIB_PART ( LIB_PART aPart,
PART_LIB aLibrary = NULL 
)

Definition at line 202 of file class_libentry.cpp.

References EDA_ITEM::Clone(), EDA_ITEM::IsNew(), m_aliases, m_dateModified, m_drawings, m_FootprintList, m_libId, m_library, m_options, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), and EDA_ITEM::SetParent().

202  :
203  EDA_ITEM( aPart ),
204  m_me( this, null_deleter() )
205 {
206  LIB_ITEM* newItem;
207 
208  m_library = aLibrary;
210  m_unitCount = aPart.m_unitCount;
216  m_options = aPart.m_options;
217  m_libId = aPart.m_libId;
218 
219  for( LIB_ITEM& oldItem : aPart.m_drawings )
220  {
221  if( oldItem.IsNew() )
222  continue;
223 
224  newItem = (LIB_ITEM*) oldItem.Clone();
225  newItem->SetParent( this );
226  m_drawings.push_back( newItem );
227  }
228 
229  for( size_t i = 0; i < aPart.m_aliases.size(); i++ )
230  {
231  LIB_ALIAS* alias = new LIB_ALIAS( *aPart.m_aliases[i], this );
232  m_aliases.push_back( alias );
233  }
234 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
bool m_showPinNumbers
Determines if part pin numbers are visible.
bool IsNew() const
Definition: base_struct.h:230
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
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.
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...
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_pinNameOffset
The offset in mils to draw the pin name.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
void push_back(T *aItem)
Definition: multivector.h:169
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:66
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared ...
long m_dateModified
Date the part was last modified.
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 ...
LIB_PART::~LIB_PART ( )
virtual

Definition at line 237 of file class_libentry.cpp.

References GetChars(), GetName(), m_aliases, and traceSchLibMem.

238 {
239  wxLogTrace( traceSchLibMem,
240  wxT( "%s: destroying part '%s' with alias list count of %llu." ),
241  GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ),
242  (long long unsigned) m_aliases.size() );
243 
244  // If the part is being deleted directly rather than through the library,
245  // delete all of the aliases.
246  while( m_aliases.size() )
247  {
248  LIB_ALIAS* alias = m_aliases.back();
249  m_aliases.pop_back();
250  delete alias;
251  }
252 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
const wxString & GetName() const
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxChar traceSchLibMem[]
Flag to enable schematic library memory deletion debug output.

Member Function Documentation

void LIB_PART::AddAlias ( const wxString &  aName)

Function AddAlias.

Add an alias aName to the part.

Duplicate alias names are not added to the alias list. Debug builds will raise an assertion. Release builds will fail silently.

Parameters
aName- Name of alias to add.

Definition at line 1840 of file class_libentry.cpp.

References GetName(), HasAlias(), and m_aliases.

1841 {
1842  wxCHECK_RET( !HasAlias( aName ),
1843  wxT( "Part <" ) + GetName() + wxT( "> already has an alias <" ) +
1844  aName + wxT( ">. Bad programmer." ) );
1845 
1846  m_aliases.push_back( new LIB_ALIAS( aName, this ) );
1847 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
const wxString & GetName() const
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 573 of file class_libentry.cpp.

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

Referenced by LIB_EDIT_FRAME::CreateImagePins(), dummy(), LIB_EDIT_FRAME::LoadOneSymbol(), LIB_EDIT_FRAME::pasteClipboard(), and LIB_EDIT_FRAME::PlacePin().

574 {
575  wxASSERT( aItem != NULL );
576 
577  m_drawings.push_back( aItem );
578 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void push_back(T *aItem)
Definition: multivector.h:169
EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

References EDA_ITEM::Pback.

Referenced by DHEAD::insert(), and DHEAD::remove().

221 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

247 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 268 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_EAGLE_PLUGIN::loadSheet(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

268 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 246 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

246 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearSelected ( )
inlineinherited
void LIB_PART::ClearSelectedItems ( )

Clears all the draw items marked by a block select.

Definition at line 1424 of file class_libentry.cpp.

References m_drawings.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd(), and LIB_EDIT_FRAME::LoadOneSymbol().

1425 {
1426  for( LIB_ITEM& item : m_drawings )
1427  {
1428  item.m_Flags = 0;
1429  }
1430 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void LIB_PART::ClearStatus ( )

Clears the status flag all draw objects in this part.

Definition at line 1371 of file class_libentry.cpp.

References m_drawings.

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

1372 {
1373  for( LIB_ITEM& item : m_drawings )
1374  {
1375  item.m_Flags = 0;
1376  }
1377 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
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 D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, SCH_LINE, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, TEXTE_PCB, LIB_TEXT, EDGE_MODULE, LIB_POLYLINE, LIB_RECTANGLE, LIB_CIRCLE, SCH_MARKER, PCB_TARGET, LIB_BEZIER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 125 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Duplicate(), CopyMarkedItems(), CopySelectedItems(), LIB_EDIT_FRAME::copySelectedItems(), BOARD::Duplicate(), DuplicateStruct(), SCH_SCREEN::ExtractWires(), LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::pasteClipboard(), SCH_EDIT_FRAME::RepeatDrawItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SetConversion(), SCH_EDIT_FRAME::SetRepeatItem(), SCH_EDIT_FRAME::SetUndoItem(), SetUnitCount(), and COMMIT::Stage().

126 {
127  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
128  wxT( ". Bad programmer!" ) );
129 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void LIB_PART::CopySelectedItems ( const wxPoint aOffset)

Make a copy of the selected draw items marked by a block select.

Fields are not copied. Only part body items are copied. Copying fields would result in duplicate fields which does not make sense in this context.

Definition at line 1463 of file class_libentry.cpp.

References EDA_ITEM::Clone(), LIB_FIELD_T, m_drawings, MoveSelectedItems(), SELECTED, and EDA_ITEM::SetFlags().

Referenced by LIB_EDIT_FRAME::HandleBlockPlace().

1464 {
1465  std::vector< LIB_ITEM* > tmp;
1466 
1467  for( LIB_ITEM& item : m_drawings )
1468  {
1469  // We *do not* copy fields because they are unique for the whole component
1470  // so skip them (do not duplicate) if they are flagged selected.
1471  if( item.Type() == LIB_FIELD_T )
1472  item.ClearFlags( SELECTED );
1473 
1474  if( !item.IsSelected() )
1475  continue;
1476 
1477  item.ClearFlags( SELECTED );
1478  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1479  newItem->SetFlags( SELECTED );
1480 
1481  // When push_back elements in buffer, a memory reallocation can happen
1482  // and will break pointers.
1483  // So, push_back later.
1484  tmp.push_back( newItem );
1485  }
1486 
1487  for( auto item : tmp )
1488  m_drawings.push_back( item );
1489 
1490  MoveSelectedItems( aOffset );
1491 }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void MoveSelectedItems(const wxPoint &aOffset)
Move the selected draw items marked by a block select.
void LIB_PART::deleteAllFields ( )
private

Definition at line 1202 of file class_libentry.cpp.

References LIB_FIELD_T, and m_drawings.

Referenced by SetFields().

1203 {
1204  m_drawings[ LIB_FIELD_T ].clear();
1205 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void LIB_PART::DeleteSelectedItems ( )

Deletes the select draw items marked by a block select.

The name and reference field will not be deleted. They are the minimum drawing items required for any part. Their properties can be changed but the cannot be removed.

Definition at line 1433 of file class_libentry.cpp.

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), EDA_ITEM::ClearFlags(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), LIB_FIELD::GetId(), LIB_FIELD_T, m_drawings, REFERENCE, SELECTED, and VALUE.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd().

1434 {
1436 
1437  // We *do not* remove the 2 mandatory fields: reference and value
1438  // so skip them (do not remove) if they are flagged selected.
1439  // Skip also not visible items.
1440  // But I think fields must not be deleted by a block delete command or other global command
1441  // because they are not really graphic items
1442  while( item != m_drawings.end() )
1443  {
1444  if( item->Type() == LIB_FIELD_T )
1445  {
1446 #if 0 // Set to 1 to allows fields deletion on block delete or other global command
1447  LIB_FIELD& field = ( LIB_FIELD& ) *item;
1448 
1449  if( (field.GetId() == REFERENCE) || (field.m_FieldId == VALUE) ||
1450  (field.m_Attributs & TEXT_NO_VISIBLE) )
1451 #endif
1452  item->ClearFlags( SELECTED );
1453  }
1454 
1455  if( !item->IsSelected() )
1456  ++item;
1457  else
1458  item = m_drawings.erase( item );
1459  }
1460 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Field Reference of part, i.e. "IC21".
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
#define SELECTED
Definition: base_struct.h:134
int GetId() const
Definition: lib_field.h:136
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
Field Value of part, i.e. "3.3K".
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void LIB_PART::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDc,
const wxPoint aOffset,
int  aMulti,
int  aConvert,
const PART_DRAW_OPTIONS aOpts 
)

Draw part.

Parameters
aPanel- Window to draw on. Can be NULL if not available.
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 316 of file class_libentry.cpp.

References PART_DRAW_OPTIONS::color, PART_DRAW_OPTIONS::draw_hidden_fields, PART_DRAW_OPTIONS::draw_mode, PART_DRAW_OPTIONS::draw_visible_fields, FILLED_WITH_BG_BODYCOLOR, EDA_DRAW_PANEL::GetClipBox(), GetGRForceBlackPenState(), EDA_DRAW_PANEL::GetScreen(), GetUnitBoundingBox(), GRLine(), GRRect(), GRSetDrawMode(), IS_MOVED, IsPower(), LIB_PIN::IsPowerConnection(), LIB_FIELD::IsVisible(), LIB_FIELD_T, LIB_PIN_T, LIGHTMAGENTA, m_drawings, BASE_SCREEN::m_IsPrinting, EDA_RECT::Move(), PART_DRAW_OPTIONS::only_selected, PIN_DANGLING_HIDDEN, PIN_DRAW_DANGLING, PIN_DRAW_ELECTRICAL_TYPE_NAME, PIN_DRAW_TEXTS, PART_DRAW_OPTIONS::PinIsDangling(), EDA_RECT::RevertYAxis(), PART_DRAW_OPTIONS::show_elec_type, PART_DRAW_OPTIONS::show_pin_text, PART_DRAW_OPTIONS::transform, TRANSFORM::TransformCoordinate(), wxPoint::x, and wxPoint::y.

Referenced by SCH_COMPONENT::Draw(), DrawMovingBlockOutlines(), LIB_EDIT_FRAME::PrintPage(), LIB_VIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::RedrawComponent(), DIALOG_RESCUE_EACH::renderPreview(), and DIALOG_CHOOSE_COMPONENT::RenderPreview().

318 {
319  BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
320 
321  GRSetDrawMode( aDc, aOpts.draw_mode );
322 
323  /* draw background for filled items using background option
324  * Solid lines will be drawn after the background
325  * Note also, background is not drawn when:
326  * printing in black and white
327  * If the color is not the default color (aColor != -1 )
328  */
329  if( ! ( screen && screen->m_IsPrinting && GetGRForceBlackPenState() )
330  && ( aOpts.color == COLOR4D::UNSPECIFIED ) )
331  {
332  for( LIB_ITEM& drawItem : m_drawings )
333  {
334  if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR )
335  continue;
336 
337  if( aOpts.only_selected && !drawItem.IsSelected() )
338  continue;
339 
340  // Do not draw an item while moving (the cursor handler does that)
341  if( drawItem.m_Flags & IS_MOVED )
342  continue;
343 
344  // Do not draw items not attached to the current part
345  if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
346  continue;
347 
348  if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
349  continue;
350 
351  if( drawItem.Type() == LIB_FIELD_T )
352  continue;
353 
354  if( drawItem.Type() == LIB_FIELD_T ) // TODO dead code?
355  {
356  drawItem.Draw( aPanel, aDc, aOffset, aOpts.color,
357  aOpts.draw_mode, (void*) NULL, aOpts.transform );
358  }
359 
360  // Now, draw only the background for items with
361  // m_Fill == FILLED_WITH_BG_BODYCOLOR:
362  drawItem.Draw( aPanel, aDc, aOffset, aOpts.color,
363  aOpts.draw_mode, (void*) false, aOpts.transform );
364  }
365  }
366 
367  // Track the index into the dangling pins list
368  size_t pin_index = 0;
369 
370  for( LIB_ITEM& drawItem : m_drawings )
371  {
372  if( aOpts.only_selected && !drawItem.IsSelected() )
373  continue;
374 
375  // Do not draw an item while moving (the cursor handler does that)
376  if( drawItem.m_Flags & IS_MOVED )
377  continue;
378 
379  // Do not draw items not attached to the current part
380  if( aMulti && drawItem.m_Unit && ( drawItem.m_Unit != aMulti ) )
381  continue;
382 
383  if( aConvert && drawItem.m_Convert && ( drawItem.m_Convert != aConvert ) )
384  continue;
385 
386  if( drawItem.Type() == LIB_FIELD_T )
387  {
388  LIB_FIELD& field = dynamic_cast<LIB_FIELD&>( drawItem );
389 
390  if( field.IsVisible() && !aOpts.draw_visible_fields )
391  continue;
392 
393  if( !field.IsVisible() && !aOpts.draw_hidden_fields )
394  continue;
395  }
396 
397  if( drawItem.Type() == LIB_PIN_T )
398  {
399  LIB_PIN& pin = dynamic_cast<LIB_PIN&>( drawItem );
400 
401  uintptr_t flags = 0;
402  if( aOpts.show_pin_text )
403  flags |= PIN_DRAW_TEXTS;
404 
405  if( aOpts.show_elec_type )
407 
408  if( aOpts.PinIsDangling( pin_index ) )
409  flags |= PIN_DRAW_DANGLING;
410 
411  if( pin.IsPowerConnection() && IsPower() )
412  flags |= PIN_DANGLING_HIDDEN;
413 
414  drawItem.Draw( aPanel, aDc, aOffset, aOpts.color,
415  aOpts.draw_mode, (void*) flags, aOpts.transform );
416 
417  ++pin_index;
418  }
419  else if( drawItem.Type() == LIB_FIELD_T )
420  {
421  drawItem.Draw( aPanel, aDc, aOffset, aOpts.color,
422  aOpts.draw_mode, (void*) NULL, aOpts.transform );
423  }
424  else
425  {
426  bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
427  drawItem.Draw( aPanel, aDc, aOffset, aOpts.color,
428  aOpts.draw_mode, (void*) forceNoFill,
429  aOpts.transform );
430  }
431  }
432 
433  // Enable this to draw the anchor of the component.
434 #if 0
435  int len = aDc->DeviceToLogicalXRel( 3 );
436  EDA_RECT* const clipbox = aPanel ? aPanel->GetClipBox() : NULL;
437 
438  GRLine( clipbox, aDc, aOffset.x, aOffset.y - len, aOffset.x,
439  aOffset.y + len, 0, aOpts.color );
440  GRLine( clipbox, aDc, aOffset.x - len, aOffset.y, aOffset.x + len,
441  aOffset.y, 0, aOpts.color );
442 #endif
443 
444  /* Enable this to draw the bounding box around the component to validate
445  * the bounding box calculations. */
446 #if 0
447  EDA_RECT bBox = GetUnitBoundingBox( aMulti, aConvert );
448  bBox.RevertYAxis();
449  bBox = aOpts.transform.TransformCoordinate( bBox );
450  bBox.Move( aOffset );
451  GRRect( aPanel ? aPanel->GetClipBox() : NULL, aDc, bBox, 0, LIGHTMAGENTA );
452 #endif
453 }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Function GetBoundingBox.
bool PinIsDangling(size_t aPin) const
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
bool IsPower() const
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void RevertYAxis()
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) ...
bool draw_hidden_fields
Whether to draw "hidden" fields.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1076
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
EDA_RECT * GetClipBox()
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:358
GR_DRAWMODE draw_mode
Device context drawing mode, see wxDC.
COLOR4D color
Color to draw part in.
bool IsVisible() const
Function IsVisible.
Definition: lib_field.h:168
Class EDA_RECT handles the component boundary box.
bool show_pin_text
Whether to show pin texts.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
bool only_selected
Draws only the body items that are selected, for block moves.
bool show_elec_type
Whether to show the pin electrical type.
bool IsPowerConnection() const
Return whether this pin forms an implicit power connection: i.e., is hidden and of type POWER_IN...
Definition: lib_pin.h:366
bool draw_visible_fields
Whether to draw "visible" fields.
bool GetGRForceBlackPenState(void)
Function GetGRForceBlackPenState.
Definition: gr_basic.cpp:287
TRANSFORM transform
Coordinate adjustment settings.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:126
LIB_FIELD * LIB_PART::FindField ( const wxString &  aFieldName)

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

Definition at line 1269 of file class_libentry.cpp.

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

1270 {
1271  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1272  {
1273  LIB_FIELD* field = ( LIB_FIELD* ) &item;
1274 
1275  if( field->GetName() == aFieldName )
1276  return field;
1277  }
1278 
1279  return NULL;
1280 }
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
wxString GetName(bool aTranslate=true) const
Returns the field name.
Definition: lib_field.cpp:605
LIB_ALIAS * LIB_PART::GetAlias ( const wxString &  aName)

Definition at line 1816 of file class_libentry.cpp.

References GetName(), and m_aliases.

1817 {
1818  wxCHECK2_MSG( !aName.IsEmpty(), return NULL,
1819  wxT( "Cannot get alias with an empty name. Bad programmer!" ) );
1820 
1821  for( size_t i = 0; i < m_aliases.size(); i++ )
1822  {
1823  if( aName == m_aliases[i]->GetName() )
1824  return m_aliases[i];
1825  }
1826 
1827  return NULL;
1828 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
const wxString & GetName() const
wxArrayString LIB_PART::GetAliasNames ( bool  aIncludeRoot = true) const

Definition at line 1673 of file class_libentry.cpp.

References m_aliases.

Referenced by SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), LIB_EDIT_FRAME::EditField(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg(), NETLIST_EXPORTER_GENERIC::makeLibParts(), SetAliases(), and LIB_EDIT_FRAME::UpdateAliasSelectList().

1674 {
1675  wxArrayString names;
1676 
1677  LIB_ALIASES::const_iterator it;
1678 
1679  for( it=m_aliases.begin(); it != m_aliases.end(); ++it )
1680  {
1681  if( !aIncludeRoot && (*it)->IsRoot() )
1682  continue;
1683 
1684  names.Add( (*it)->GetName() );
1685  }
1686 
1687  return names;
1688 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
const EDA_RECT LIB_PART::GetBodyBoundingBox ( int  aUnit,
int  aConvert 
) const

Function GetBodyBoundingBox.

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 1172 of file class_libentry.cpp.

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

Referenced by SCH_COMPONENT::GetBodyBoundingBox().

1173 {
1174  EDA_RECT bBox;
1175  bool initialized = false;
1176 
1177  for( const LIB_ITEM& item : m_drawings )
1178  {
1179  if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
1180  && ( aUnit != item.m_Unit ) ) )
1181  continue;
1182 
1183  if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
1184  continue;
1185 
1186  if( item.Type() == LIB_FIELD_T )
1187  continue;
1188 
1189  if( initialized )
1190  bBox.Merge( item.GetBoundingBox() );
1191  else
1192  {
1193  bBox = item.GetBoundingBox();
1194  initialized = true;
1195  }
1196  }
1197 
1198  return bBox;
1199 }
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.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
Class EDA_RECT handles the component boundary box.
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 347 of file class_libentry.h.

References GetUnitBoundingBox().

348  {
349  return GetUnitBoundingBox( 0, 0 );
350  }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Function GetBoundingBox.
virtual wxString LIB_PART::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 269 of file class_libentry.h.

270  {
271  return wxT( "LIB_PART" );
272  }
LIB_ITEMS_CONTAINER& LIB_PART::GetDrawItems ( )
inline

Return a reference to the draw item list.

Returns
LIB_ITEMS_CONTAINER& - Reference to the draw item object container.

Definition at line 685 of file class_libentry.h.

References m_drawings.

Referenced by LIB_EDIT_FRAME::copySelectedItems(), LIB_EDIT_FRAME::locateItem(), and LIB_EDIT_FRAME::SaveOneSymbol().

686  {
687  return m_drawings;
688  }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
LIB_FIELD * LIB_PART::GetField ( int  aId)

Return pointer to the requested field.

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

Definition at line 1255 of file class_libentry.cpp.

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

Referenced by GetFields(), GetFootprintField(), GetReferenceField(), GetValueField(), LoadField(), SCH_EAGLE_PLUGIN::loadInstance(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), LIB_EDIT_FRAME::RedrawComponent(), and DIALOG_CHOOSE_COMPONENT::ShowFootprintFor().

1256 {
1257  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1258  {
1259  LIB_FIELD* field = ( LIB_FIELD* ) &item;
1260 
1261  if( field->GetId() == aId )
1262  return field;
1263  }
1264 
1265  return NULL;
1266 }
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int GetId() const
Definition: lib_field.h:136
void LIB_PART::GetFields ( LIB_FIELDS aList)

Function GetFields returns a list of fields withing this part.

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

Parameters
aList- List to add fields to

Definition at line 1223 of file class_libentry.cpp.

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

Referenced by DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EAGLE_PLUGIN::loadInstance(), NETLIST_EXPORTER_GENERIC::makeLibParts(), Save(), and ALIAS_INFO_GENERATOR::SetHtmlFieldTable().

1224 {
1225  LIB_FIELD* field;
1226 
1227  // The only caller of this function is the library field editor, so it
1228  // establishes policy here.
1229 
1230  // Grab the MANDATORY_FIELDS first, in expected order given by
1231  // enum NumFieldType
1232  for( int id=0; id<MANDATORY_FIELDS; ++id )
1233  {
1234  field = GetField( id );
1235 
1236  // the MANDATORY_FIELDS are exactly that in RAM.
1237  wxASSERT( field );
1238 
1239  aList.push_back( *field );
1240  }
1241 
1242  // Now grab all the rest of fields.
1243  for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
1244  {
1245  field = ( LIB_FIELD* ) &item;
1246 
1247  if( (unsigned) field->GetId() < MANDATORY_FIELDS )
1248  continue; // was added above
1249 
1250  aList.push_back( *field );
1251  }
1252 }
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int GetId() const
Definition: lib_field.h:136
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 269 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow().

269 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
LIB_FIELD & LIB_PART::GetFootprintField ( )

Return reference to the footprint field.

Definition at line 1299 of file class_libentry.cpp.

References FOOTPRINT, and GetField().

Referenced by CMP_TREE_NODE_LIB_ID::CMP_TREE_NODE_LIB_ID().

1300 {
1301  LIB_FIELD* field = GetField( FOOTPRINT );
1302  wxASSERT( field != NULL );
1303  return *field;
1304 }
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
Field Name Module PCB, i.e. "16DIP300".
wxArrayString& LIB_PART::GetFootPrints ( )
inline

Definition at line 323 of file class_libentry.h.

References m_FootprintList.

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg(), NETLIST_EXPORTER_GENERIC::makeLibParts(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick(), and DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector().

323 { return m_FootprintList; }
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
PART_LIB* LIB_PART::GetLib ( )
inline

Definition at line 282 of file class_libentry.h.

References m_library.

Referenced by LIB_MANAGER::LIB_BUFFER::CreateBuffer(), PART_LIB::FindAlias(), and LIB_ALIAS::GetLib().

282 { return m_library; }
PART_LIB * m_library
Library the part belongs to if any.
const wxString LIB_PART::GetLibraryName ( )

Definition at line 255 of file class_libentry.cpp.

References PART_LIB::GetName(), and m_library.

Referenced by LIB_ALIAS::GetLibraryName(), and RemoveDrawItem().

256 {
257  if( m_library )
258  return m_library->GetName();
259 
260  return wxString( _( "none" ) );
261 }
PART_LIB * m_library
Library the part belongs to if any.
const wxString GetName() const
Return the file name without path or extension.
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
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, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_SHEET_PIN, SCH_TEXT, SCH_FIELD, LIB_ARC, SCH_LINE, TEXTE_PCB, LIB_TEXT, SCH_BITMAP, EDGE_MODULE, LIB_POLYLINE, MARKER_PCB, SCH_BUS_ENTRY_BASE, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 282 of file base_struct.cpp.

References dummy_xpm.

Referenced by FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

283 {
284  return dummy_xpm;
285 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56
virtual void EDA_ITEM::GetMsgPanelInfo ( 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_COMPONENT, LIB_ITEM, GERBER_DRAW_ITEM, NETINFO_ITEM, TRACK, DIMENSION, SCH_TEXT, DRAWSEGMENT, TEXTE_MODULE, LIB_FIELD, LIB_PIN, ZONE_CONTAINER, EDGE_MODULE, MARKER_PCB, LIB_ARC, LIB_BEZIER, LIB_TEXT, SCH_MARKER, LIB_POLYLINE, TEXTE_PCB, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 291 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::LocateItem(), EDA_DRAW_FRAME::SetMsgPanel(), and PCB_BASE_FRAME::UpdateMsgPanel().

292  {
293  }
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 581 of file class_libentry.cpp.

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

Referenced by GetNextPin().

582 {
583  if( m_drawings.empty( aType ) )
584  return NULL;
585 
586  if( aItem == NULL )
587  return &( *( m_drawings.begin( aType ) ) );
588 
589  // Search for the last item, assume aItem is of type aType
590  wxASSERT( ( aType == TYPE_NOT_INIT ) || ( aType == aItem->Type() ) );
592 
593  while( ( it != m_drawings.end( aType ) ) && ( aItem != &( *it ) ) )
594  ++it;
595 
596  // Search the next item
597  if( it != m_drawings.end( aType ) )
598  {
599  ++it;
600 
601  if( it != m_drawings.end( aType ) )
602  return &( *it );
603  }
604 
605  return NULL;
606 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
bool empty(int aType=UNDEFINED_TYPE)
Definition: multivector.h:224
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
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
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 518 of file class_libentry.h.

References GetNextDrawItem(), and LIB_PIN_T.

Referenced by LIB_EDIT_FRAME::deleteItem(), NETLIST_EXPORTER::findAllUnitsOfComponent(), LIB_EDIT_FRAME::GlobalSetPins(), LIB_EDIT_FRAME::PlacePin(), LIB_PIN::SetConversion(), LIB_PIN::SetPartNumber(), and LIB_EDIT_FRAME::StartMovePin().

519  {
520  return (LIB_PIN*) GetNextDrawItem( (LIB_ITEM*) aItem, LIB_PIN_T );
521  }
LIB_ITEM * GetNextDrawItem(LIB_ITEM *aItem=NULL, KICAD_T aType=TYPE_NOT_INIT)
Return the next draw object pointer.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
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 635 of file class_libentry.cpp.

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

636 {
637  LIB_PINS pinList;
638 
639  GetPins( pinList, aUnit, aConvert );
640 
641  for( size_t i = 0; i < pinList.size(); i++ )
642  {
643  wxASSERT( pinList[i]->Type() == LIB_PIN_T );
644 
645  if( aNumber == pinList[i]->GetNumber() )
646  return pinList[i];
647  }
648 
649  return NULL;
650 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
int LIB_PART::GetPinNameOffset ( )
inline
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 609 of file class_libentry.cpp.

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

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::DataViewModel(), LIB_PIN::EnableEditMode(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), GetPin(), NETLIST_EXPORTER_GENERIC::makeLibParts(), LIB_EDIT_FRAME::OnCheckComponent(), 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().

610 {
611  if( m_drawings.empty( LIB_PIN_T ) )
612  return;
613 
614  /* Notes:
615  * when aUnit == 0: no unit filtering
616  * when aConvert == 0: no convert (shape selection) filtering
617  * when .m_Unit == 0, the body item is common to units
618  * when .m_Convert == 0, the body item is common to shapes
619  */
620  for( LIB_ITEM& item : m_drawings[ LIB_PIN_T ] )
621  {
622  // Unit filtering:
623  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
624  continue;
625 
626  // Shape filtering:
627  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
628  continue;
629 
630  aList.push_back( (LIB_PIN*) &item );
631  }
632 }
bool empty(int aType=UNDEFINED_TYPE)
Definition: multivector.h:224
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
LIB_FIELD & LIB_PART::GetReferenceField ( )

Return reference to the reference designator field.

Definition at line 1291 of file class_libentry.cpp.

References GetField(), and REFERENCE.

Referenced by Load(), LIB_EDIT_FRAME::OnCreateNewPart(), Save(), LIB_EDIT_FRAME::SaveOneSymbol(), and SCH_COMPONENT::SCH_COMPONENT().

1292 {
1293  LIB_FIELD* field = GetField( REFERENCE );
1294  wxASSERT( field != NULL );
1295  return *field;
1296 }
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
Field Reference of part, i.e. "IC21".
wxString EDA_ITEM::GetSelectMenuText ( ) 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, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, GERBER_DRAW_ITEM, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_SHEET_PIN, SCH_TEXT, SCH_FIELD, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_LINE, SCH_BUS_WIRE_ENTRY, TEXTE_PCB, LIB_TEXT, SCH_BITMAP, EDGE_MODULE, LIB_POLYLINE, MARKER_PCB, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 175 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), DRC::fillMarker(), SCH_FIND_COLLECTOR::GetText(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

176 {
177  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
178  GetClass() );
179 
180  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
181 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 264 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

264 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:175
static int LIB_PART::GetSubpartFirstId ( )
inlinestatic

Definition at line 730 of file class_libentry.h.

References m_subpartFirstId.

Referenced by SCH_EDIT_FRAME::LoadProjectFile(), and SCH_EDIT_FRAME::OnPreferencesOptions().

730 { return m_subpartFirstId; }
static int m_subpartFirstId
the ascii char value to calculate the subpart symbol id from the part number: only 'A'...
static int LIB_PART::GetSubpartIdSeparator ( )
inlinestatic

Definition at line 723 of file class_libentry.h.

References m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::LoadProjectFile(), and SCH_EDIT_FRAME::OnPreferencesOptions().

723 { return m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
const EDA_RECT LIB_PART::GetUnitBoundingBox ( int  aUnit,
int  aConvert 
) const

Function GetBoundingBox.

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 1142 of file class_libentry.cpp.

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

Referenced by LIB_VIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), Draw(), GetBoundingBox(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_RESCUE_EACH::renderPreview(), and DIALOG_CHOOSE_COMPONENT::RenderPreview().

1143 {
1144  EDA_RECT bBox;
1145  bool initialized = false;
1146 
1147  for( const LIB_ITEM& item : m_drawings )
1148  {
1149  if( ( item.m_Unit > 0 ) && ( ( m_unitCount > 1 ) && ( aUnit > 0 )
1150  && ( aUnit != item.m_Unit ) ) )
1151  continue;
1152 
1153  if( item.m_Convert > 0 && ( ( aConvert > 0 ) && ( aConvert != item.m_Convert ) ) )
1154  continue;
1155 
1156  if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
1157  continue;
1158 
1159  if( initialized )
1160  bBox.Merge( item.GetBoundingBox() );
1161  else
1162  {
1163  bBox = item.GetBoundingBox();
1164  initialized = true;
1165  }
1166  }
1167 
1168  return bBox;
1169 }
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.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
Class EDA_RECT handles the component boundary box.
LIB_FIELD & LIB_PART::GetValueField ( )

Return reference to the value field.

Definition at line 1283 of file class_libentry.cpp.

References GetField(), and VALUE.

Referenced by Load(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), Save(), LIB_EDIT_FRAME::SaveOneSymbol(), and SetName().

1284 {
1285  LIB_FIELD* field = GetField( VALUE );
1286  wxASSERT( field != NULL );
1287  return *field;
1288 }
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
Field Value of part, i.e. "3.3K".
bool LIB_PART::HasAlias ( const wxString &  aName) const

Test if alias aName is in part alias list.

Alias name comparisons are case insensitive.

Parameters
aName- Name of alias.
Returns
True if alias name in alias list.

Definition at line 1691 of file class_libentry.cpp.

References GetName(), and m_aliases.

Referenced by AddAlias(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), and SetAliases().

1692 {
1693  wxCHECK2_MSG( !aName.IsEmpty(), return false,
1694  wxT( "Cannot get alias with an empty name, bad programmer." ) );
1695 
1696  for( size_t i = 0; i < m_aliases.size(); i++ )
1697  {
1698  if( aName == m_aliases[i]->GetName() )
1699  return true;
1700  }
1701 
1702  return false;
1703 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
const wxString & GetName() const
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 1359 of file class_libentry.cpp.

References m_drawings.

Referenced by AddMenusForEditComponent(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel(), LIB_EDIT_FRAME::EditGraphicSymbol(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), LIB_VIEW_FRAME::onUpdateAlternateBodyStyleButton(), LIB_EDIT_FRAME::OnUpdateDeMorganConvert(), LIB_EDIT_FRAME::OnUpdateDeMorganNormal(), LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton(), SetConversion(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), and LIB_EDIT_FRAME::SynchronizePins().

1360 {
1361  for( const LIB_ITEM& item : m_drawings )
1362  {
1363  if( item.m_Convert > 1 )
1364  return true;
1365  }
1366 
1367  return false;
1368 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
virtual bool EDA_ITEM::HitTest ( const wxPoint aPosition) const
inlinevirtualinherited

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

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
Returns
True if aPosition is within or on the item bounding area.

Reimplemented in D_PAD, MODULE, VIA, SCH_ITEM, BOARD_ITEM, ZONE_CONTAINER, GERBER_DRAW_ITEM, LIB_ITEM, TRACK, DIMENSION, TEXTE_MODULE, DRAWSEGMENT, LIB_FIELD, LIB_PIN, MARKER_PCB, LIB_ARC, PCB_TARGET, LIB_TEXT, TEXTE_PCB, LIB_POLYLINE, LIB_BEZIER, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 302 of file base_struct.h.

Referenced by LIB_ITEM::HitTest(), BOARD_ITEM::HitTest(), GERBER_COLLECTOR::Inspect(), and SCH_COLLECTOR::Inspect().

303  {
304  return false; // derived classes should override this function
305  }
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

238 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

References HIGHLIGHTED.

237 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

231 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool LIB_PART::IsMulti ( ) const
inline

Function IsMulti.

Returns
true if the part has multiple units per part. When happens, the reference has a sub reference ti identify part

Definition at line 709 of file class_libentry.h.

Referenced by CMP_TREE_NODE_LIB_ID::CMP_TREE_NODE_LIB_ID(), LIB_FIELD::GetFullText(), and LIB_EDIT_FRAME::SynchronizePins().

709 { return m_unitCount > 1; }
int m_unitCount
Number of units (parts) per package.
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 230 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

230 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool LIB_PART::IsNormal ( ) const
inline

Definition at line 389 of file class_libentry.h.

References ENTRY_NORMAL.

Referenced by AddMenusForEditComponent().

389 { return m_options == ENTRY_NORMAL; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 458 of file base_struct.h.

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

458 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 236 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

236 { 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:128
bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

References SELECTED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForPin(), KIGFX::PCB_PAINTER::draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), DrawMovingBlockOutlines(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), LIB_EDIT_FRAME::GlobalSetPins(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), MirrorMarkedItems(), MoveMarkedItems(), MoveMarkedItemsExactly(), LIB_TEXT::Plot(), RotateMarkedItems(), SELECTION_TOOL::SanitizeSelection(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::select(), SCH_SCREEN::SelectBlockItems(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), GERBVIEW_SELECTION_TOOL::unselect(), and SELECTION_TOOL::unselect().

235 { return m_Flags & SELECTED; }
#define SELECTED
Definition: base_struct.h:134
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by abortMoveItem(), and SCH_FIELD::Draw().

234 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 132 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
bool LIB_PART::Load ( LINE_READER aReader,
wxString &  aErrorMsg 
)

Load part definition from aReader.

Parameters
aReaderA LINE_READER object to load file from.
aErrorMsg- Description of error on load failure.
Returns
True if the load was successful, false if there was an error.

Definition at line 836 of file class_libentry.cpp.

References EDA_TEXT::Empty(), ENTRY_POWER, FROM_UTF8(), GetChars(), GetReferenceField(), GetValueField(), LINE_READER::Line(), LINE_READER::LineNumber(), LoadAliases(), LoadDateAndTime(), LoadDrawEntries(), LoadField(), LoadFootprints(), m_options, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, LINE_READER::ReadLine(), SetName(), LIB_FIELD::SetText(), and EDA_TEXT::SetVisible().

837 {
838  int unused;
839  char* p;
840  char* componentName;
841  char* prefix = NULL;
842  char* line;
843 
844  bool result;
845  wxString Msg;
846 
847  line = aLineReader.Line();
848 
849  p = strtok( line, " \t\r\n" );
850 
851  if( strcmp( p, "DEF" ) != 0 )
852  {
853  aErrorMsg.Printf( wxT( "DEF command expected in line %d, aborted." ),
854  aLineReader.LineNumber() );
855  return false;
856  }
857 
858  // Read DEF line:
859  char drawnum = 0;
860  char drawname = 0;
861 
862  if( ( componentName = strtok( NULL, " \t\n" ) ) == NULL // Part name:
863  || ( prefix = strtok( NULL, " \t\n" ) ) == NULL // Prefix name:
864  || ( p = strtok( NULL, " \t\n" ) ) == NULL // NumOfPins:
865  || sscanf( p, "%d", &unused ) != 1
866  || ( p = strtok( NULL, " \t\n" ) ) == NULL // TextInside:
867  || sscanf( p, "%d", &m_pinNameOffset ) != 1
868  || ( p = strtok( NULL, " \t\n" ) ) == NULL // DrawNums:
869  || sscanf( p, "%c", &drawnum ) != 1
870  || ( p = strtok( NULL, " \t\n" ) ) == NULL // DrawNums:
871  || sscanf( p, "%c", &drawname ) != 1
872  || ( p = strtok( NULL, " \t\n" ) ) == NULL // m_unitCount:
873  || sscanf( p, "%d", &m_unitCount ) != 1 )
874  {
875  aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
876  aLineReader.LineNumber() );
877 
878  while( (line = aLineReader.ReadLine()) != NULL )
879  {
880  p = strtok( line, " \t\n" );
881 
882  if( p && strcasecmp( p, "ENDDEF" ) == 0 )
883  break;
884  }
885 
886  return false;
887  }
888 
889  // Ensure m_unitCount is >= 1 (could be read as 0 in old libraries)
890  if( m_unitCount < 1 )
891  m_unitCount = 1;
892 
893  m_showPinNumbers = ( drawnum == 'N' ) ? false : true;
894  m_showPinNames = ( drawname == 'N' ) ? false : true;
895 
896  // Copy part name and prefix.
897  if( componentName[0] != '~' )
898  {
899  SetName( FROM_UTF8( componentName ) );
900  }
901  else
902  {
903  SetName( FROM_UTF8( &componentName[1] ) );
904  GetValueField().SetVisible( false );
905  }
906 
907  LIB_FIELD& reference = GetReferenceField();
908 
909  if( strcmp( prefix, "~" ) == 0 )
910  {
911  reference.Empty();
912  reference.SetVisible( false );
913  }
914  else
915  {
916  reference.SetText( FROM_UTF8( prefix ) );
917  }
918 
919  // Copy optional infos
920  if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
921  m_unitsLocked = true;
922 
923  if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
925 
926  // Read next lines, until "ENDDEF" is found
927  while( ( line = aLineReader.ReadLine() ) != NULL )
928  {
929  p = strtok( line, " \t\r\n" );
930 
931  // This is the error flag ( if an error occurs, result = false)
932  result = true;
933 
934  if( *line == '#' ) // a comment
935  continue;
936 
937  if( p == NULL ) // empty line
938  continue;
939 
940  if( line[0] == 'T' && line[1] == 'i' )
941  result = LoadDateAndTime( aLineReader );
942  else if( *line == 'F' )
943  result = LoadField( aLineReader, Msg );
944  else if( strcmp( p, "ENDDEF" ) == 0 ) // End of component description
945  goto ok;
946  else if( strcmp( p, "DRAW" ) == 0 )
947  result = LoadDrawEntries( aLineReader, Msg );
948  else if( strncmp( p, "ALIAS", 5 ) == 0 )
949  {
950  p = strtok( NULL, "\r\n" );
951  result = LoadAliases( p, aErrorMsg );
952  }
953  else if( strncmp( p, "$FPLIST", 5 ) == 0 )
954  result = LoadFootprints( aLineReader, Msg );
955 
956  // End line or block analysis: test for an error
957  if( !result )
958  {
959  if( Msg.IsEmpty() )
960  aErrorMsg.Printf( wxT( "error occurred at line %d " ), aLineReader.LineNumber() );
961  else
962  aErrorMsg.Printf( wxT( "error <%s> occurred at line %d " ),
963  GetChars( Msg ), aLineReader.LineNumber() );
964 
965  return false;
966  }
967  }
968 
969  return false;
970 
971 ok:
972  // If we are here, this part is O.k. - put it in:
973 
974  return true;
975 }
bool LoadFootprints(LINE_READER &aReader, wxString &aErrorMsg)
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
void SetVisible(bool aVisible)
Definition: eda_text.h:175
bool LoadDrawEntries(LINE_READER &aReader, wxString &aErrorMsg)
LIB_FIELD & GetValueField()
Return reference to the value field.
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...
bool LoadDateAndTime(char *aLine)
int m_pinNameOffset
The offset in mils to draw the pin name.
bool LoadField(LINE_READER &aReader, wxString &aErrorMsg)
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetText(const wxString &aText) override
Sets the field text to aText.
Definition: lib_field.cpp:675
void Empty()
Definition: eda_text.h:231
bool LoadAliases(char *aLine, wxString &aErrorMsg)
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual void SetName(const wxString &aName)
bool m_showPinNames
Determines if part pin names are visible.
bool LIB_PART::LoadAliases ( char *  aLine,
wxString &  aErrorMsg 
)

Definition at line 1068 of file class_libentry.cpp.

References FROM_UTF8(), and m_aliases.

Referenced by Load().

1069 {
1070  char* text = strtok( aLine, " \t\r\n" );
1071 
1072  while( text )
1073  {
1074  m_aliases.push_back( new LIB_ALIAS( FROM_UTF8( text ), this ) );
1075  text = strtok( NULL, " \t\r\n" );
1076  }
1077 
1078  return true;
1079 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
bool LIB_PART::LoadDateAndTime ( char *  aLine)

Definition at line 1327 of file class_libentry.cpp.

References m_dateModified, and min.

Referenced by Load().

1328 {
1329  int year, mon, day, hour, min, sec;
1330 
1331  year = mon = day = hour = min = sec = 0;
1332  strtok( aLine, " \r\t\n" );
1333  strtok( NULL, " \r\t\n" );
1334 
1335  if( sscanf( aLine, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 )
1336  return false;
1337 
1338  m_dateModified = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
1339  ( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) +
1340  ( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 );
1341 
1342  return true;
1343 }
long m_dateModified
Date the part was last modified.
#define min(a, b)
Definition: auxiliary.h:85
bool LIB_PART::LoadDrawEntries ( LINE_READER aReader,
wxString &  aErrorMsg 
)

Definition at line 978 of file class_libentry.cpp.

References GetChars(), LIB_ITEM::Load(), m_drawings, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), and LINE_READER::ReadLine().

Referenced by Load().

979 {
980  char* line;
981  LIB_ITEM* newEntry = NULL;
982 
983  while( true )
984  {
985  if( !( line = aLineReader.ReadLine() ) )
986  {
987  aErrorMsg = wxT( "file ended prematurely loading component draw element" );
988  return false;
989  }
990 
991  if( strncmp( line, "ENDDRAW", 7 ) == 0 )
992  break;
993 
994  newEntry = NULL;
995 
996  switch( line[0] )
997  {
998  case 'A': // Arc
999  newEntry = ( LIB_ITEM* ) new LIB_ARC( this );
1000  break;
1001 
1002  case 'C': // Circle
1003  newEntry = ( LIB_ITEM* ) new LIB_CIRCLE( this );
1004  break;
1005 
1006  case 'T': // Text
1007  newEntry = ( LIB_ITEM* ) new LIB_TEXT( this );
1008  break;
1009 
1010  case 'S': // Square
1011  newEntry = ( LIB_ITEM* ) new LIB_RECTANGLE( this );
1012  break;
1013 
1014  case 'X': // Pin Description
1015  newEntry = ( LIB_ITEM* ) new LIB_PIN( this );
1016  break;
1017 
1018  case 'P': // Polyline
1019  newEntry = ( LIB_ITEM* ) new LIB_POLYLINE( this );
1020  break;
1021 
1022  case 'B': // Bezier Curves
1023  newEntry = ( LIB_ITEM* ) new LIB_BEZIER( this );
1024  break;
1025 
1026  case '#': // Comment
1027  continue;
1028 
1029  case '\n':
1030  case '\r':
1031  case 0: // empty line
1032  continue;
1033 
1034  default:
1035  aErrorMsg.Printf( wxT( "undefined DRAW command %c" ), line[0] );
1036  return false;
1037  }
1038 
1039  if( !newEntry->Load( aLineReader, aErrorMsg ) )
1040  {
1041  aErrorMsg.Printf( wxT( "error '%s' in DRAW command %c" ),
1042  GetChars( aErrorMsg ), line[0] );
1043  delete newEntry;
1044 
1045  // Flush till end of draw section
1046  do
1047  {
1048  if( !aLineReader.ReadLine() )
1049  {
1050  aErrorMsg = wxT( "file ended prematurely while attempting "
1051  "to flush to end of drawing section." );
1052  return false;
1053  }
1054  } while( strncmp( line, "ENDDRAW", 7 ) != 0 );
1055 
1056  return false;
1057  }
1058  else
1059  {
1060  m_drawings.push_back( newEntry );
1061  }
1062  }
1063 
1064  return true;
1065 }
Class LIB_TEXT defines a component library graphical text item.
Definition: lib_text.h:45
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void push_back(T *aItem)
Definition: multivector.h:169
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual bool Load(LINE_READER &aLine, wxString &aErrorMsg)=0
Class LIB_BEZIER defines bezier curve graphic body item.
Definition: lib_bezier.h:39
bool LIB_PART::LoadField ( LINE_READER aReader,
wxString &  aErrorMsg 
)

Definition at line 1082 of file class_libentry.cpp.

References GetField(), LIB_FIELD::GetId(), EDA_TEXT::GetText(), LIB_FIELD::Load(), m_drawings, MANDATORY_FIELDS, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), SetName(), and VALUE.

Referenced by Load().

1083 {
1084  LIB_FIELD* field = new LIB_FIELD( this );
1085 
1086  if( !field->Load( aLineReader, aErrorMsg ) )
1087  {
1088  delete field;
1089  return false;
1090  }
1091 
1092  if( (unsigned) field->GetId() < MANDATORY_FIELDS )
1093  {
1094  LIB_FIELD* fixedField = GetField( field->GetId() );
1095 
1096  // this will fire only if somebody broke a constructor or editor.
1097  // MANDATORY_FIELDS are always present in ram resident components, no
1098  // exceptions, and they always have their names set, even fixed fields.
1099  wxASSERT( fixedField );
1100 
1101  *fixedField = *field;
1102 
1103  if( field->GetId() == VALUE )
1104  SetName( field->GetText() );
1105 
1106  delete field;
1107  }
1108  else
1109  {
1110  m_drawings.push_back( field );
1111  }
1112 
1113  return true;
1114 }
LIB_FIELD * GetField(int aId)
Return pointer to the requested field.
bool Load(LINE_READER &aLineReader, wxString &errorMsg) override
Definition: lib_field.cpp:157
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
int GetId() const
Definition: lib_field.h:136
void push_back(T *aItem)
Definition: multivector.h:169
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
Field Value of part, i.e. "3.3K".
virtual void SetName(const wxString &aName)
bool LIB_PART::LoadFootprints ( LINE_READER aReader,
wxString &  aErrorMsg 
)

Definition at line 1117 of file class_libentry.cpp.

References FROM_UTF8(), m_FootprintList, and LINE_READER::ReadLine().

Referenced by Load().

1118 {
1119  char* line;
1120  char* p;
1121 
1122  while( true )
1123  {
1124  if( !( line = aLineReader.ReadLine() ) )
1125  {
1126  aErrorMsg = wxT( "file ended prematurely while loading footprints" );
1127  return false;
1128  }
1129 
1130  p = strtok( line, " \t\r\n" );
1131 
1132  if( strcasecmp( p, "$ENDFPLIST" ) == 0 )
1133  break;
1134 
1135  m_FootprintList.Add( FROM_UTF8( p ) );
1136  }
1137 
1138  return true;
1139 }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
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 1533 of file class_libentry.cpp.

References m_drawings, and TYPE_NOT_INIT.

Referenced by LocateDrawItem().

1535 {
1536  for( LIB_ITEM& item : m_drawings )
1537  {
1538  if( ( aUnit && item.m_Unit && ( aUnit != item.m_Unit) )
1539  || ( aConvert && item.m_Convert && ( aConvert != item.m_Convert ) )
1540  || ( ( item.Type() != aType ) && ( aType != TYPE_NOT_INIT ) ) )
1541  continue;
1542 
1543  if( item.HitTest( aPoint ) )
1544  return &item;
1545  }
1546 
1547  return NULL;
1548 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
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 1551 of file class_libentry.cpp.

References DefaultTransform, and LocateDrawItem().

1553 {
1554  /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
1555  * wxPoint& pt ) to search items.
1556  * because this function uses DefaultTransform as orient/mirror matrix
1557  * we temporary copy aTransform in DefaultTransform
1558  */
1559  LIB_ITEM* item;
1560  TRANSFORM transform = DefaultTransform;
1561  DefaultTransform = aTransform;
1562 
1563  item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
1564 
1565  // Restore matrix
1566  DefaultTransform = transform;
1567 
1568  return item;
1569 }
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
Class for tranforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const wxPoint &aPoint)
Locate a draw object.
void LIB_PART::LockUnits ( bool  aLockUnits)
inline

Definition at line 394 of file class_libentry.h.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

394 { m_unitsLocked = aLockUnits; }
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit...
virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint aFindLocation 
)
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.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 414 of file base_struct.h.

Referenced by SCH_FIND_COLLECTOR::Inspect(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), and SCH_SHEET::Matches().

415  {
416  return false;
417  }
bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 184 of file base_struct.cpp.

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

185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
void LIB_PART::MirrorSelectedItemsH ( const wxPoint aCenter)

Horizontally (X axis) mirror selected draw items about a point.

Parameters
aCenter- Center point to mirror around.

Definition at line 1494 of file class_libentry.cpp.

References m_drawings.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd(), and LIB_EDIT_FRAME::HandleBlockPlace().

1495 {
1496  for( LIB_ITEM& item : m_drawings )
1497  {
1498  if( !item.IsSelected() )
1499  continue;
1500 
1501  item.MirrorHorizontal( aCenter );
1502  item.m_Flags = 0;
1503  }
1504 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void LIB_PART::MirrorSelectedItemsV ( const wxPoint aCenter)

Vertically (Y axis) mirror selected draw items about a point.

Parameters
aCenter- Center point to mirror around.

Definition at line 1507 of file class_libentry.cpp.

References m_drawings.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd(), and LIB_EDIT_FRAME::HandleBlockPlace().

1508 {
1509  for( LIB_ITEM& item : m_drawings )
1510  {
1511  if( !item.IsSelected() )
1512  continue;
1513 
1514  item.MirrorVertical( aCenter );
1515  item.m_Flags = 0;
1516  }
1517 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void LIB_PART::MoveSelectedItems ( const wxPoint aOffset)

Move the selected draw items marked by a block select.

Definition at line 1411 of file class_libentry.cpp.

References m_drawings.

Referenced by CopySelectedItems(), LIB_EDIT_FRAME::HandleBlockPlace(), and LIB_EDIT_FRAME::pasteClipboard().

1412 {
1413  for( LIB_ITEM& item : m_drawings )
1414  {
1415  if( !item.IsSelected() )
1416  continue;
1417 
1418  item.SetOffset( aOffset );
1419  item.m_Flags = 0;
1420  }
1421 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 241 of file base_struct.cpp.

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

242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool LIB_PART::operator== ( const LIB_PART aPart) const
inline

Definition at line 789 of file class_libentry.h.

789 { return this == aPart; }
bool LIB_PART::PinsConflictWith ( LIB_PART aOtherPart,
bool  aTestNums,
bool  aTestNames,
bool  aTestType,
bool  aTestOrientation,
bool  aTestLength 
)

Function PinsConflictWith returns 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 653 of file class_libentry.cpp.

References GetPins().

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

655 {
656  LIB_PINS thisPinList;
657  GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
658 
659  for( LIB_PIN* eachThisPin : thisPinList )
660  {
661  wxASSERT( eachThisPin );
662  LIB_PINS otherPinList;
663  aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
664  bool foundMatch = false;
665 
666  for( LIB_PIN* eachOtherPin : otherPinList )
667  {
668  wxASSERT( eachOtherPin );
669  // Same position?
670  if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
671  continue;
672 
673  // Same number?
674  if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ))
675  continue;
676 
677  // Same name?
678  if( aTestNames && ( eachThisPin->GetName() != eachOtherPin->GetName() ))
679  continue;
680 
681  // Same electrical type?
682  if( aTestType && ( eachThisPin->GetType() != eachOtherPin->GetType() ))
683  continue;
684 
685  // Same orientation?
686  if( aTestOrientation && ( eachThisPin->GetOrientation() != eachOtherPin->GetOrientation() ))
687  continue;
688 
689  // Same length?
690  if( aTestLength && ( eachThisPin->GetLength() != eachOtherPin->GetLength() ))
691  continue;
692 
693  foundMatch = true;
694  }
695 
696  if( !foundMatch )
697  {
698  // This means there was not an identical (according to the arguments)
699  // pin at the same position in the other component.
700  return true;
701  }
702  }
703 
704  // The loop never gave up, so no conflicts were found.
705  return false;
706 }
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:60
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 456 of file class_libentry.cpp.

References FILLED_WITH_BG_BODYCOLOR, PLOTTER::GetColorMode(), GetLayerColor(), LAYER_DEVICE, LIB_FIELD_T, m_drawings, and PLOTTER::SetColor().

Referenced by LIB_EDIT_FRAME::SVG_PlotComponent().

458 {
459  wxASSERT( aPlotter != NULL );
460 
461  aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) );
462  bool fill = aPlotter->GetColorMode();
463 
464  // draw background for filled items using background option
465  // Solid lines will be drawn after the background
466  for( LIB_ITEM& item : m_drawings )
467  {
468  // Lib Fields are not plotted here, because this plot function
469  // is used to plot schematic items, which have they own fields
470  if( item.Type() == LIB_FIELD_T )
471  continue;
472 
473  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
474  continue;
475 
476  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
477  continue;
478 
479  if( item.m_Fill == FILLED_WITH_BG_BODYCOLOR )
480  item.Plot( aPlotter, aOffset, fill, aTransform );
481  }
482 
483  // Not filled items and filled shapes are now plotted
484  // (plot only items which are not already plotted)
485  for( LIB_ITEM& item : m_drawings )
486  {
487  if( item.Type() == LIB_FIELD_T )
488  continue;
489 
490  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
491  continue;
492 
493  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
494  continue;
495 
496  if( item.m_Fill != FILLED_WITH_BG_BODYCOLOR )
497  item.Plot( aPlotter, aOffset, fill, aTransform );
498  }
499 }
virtual void SetColor(COLOR4D color)=0
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool GetColorMode() const
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 501 of file class_libentry.cpp.

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

Referenced by LIB_EDIT_FRAME::SVG_PlotComponent().

503 {
504  wxASSERT( aPlotter != NULL );
505 
506  aPlotter->SetColor( GetLayerColor( LAYER_FIELDS ) );
507  bool fill = aPlotter->GetColorMode();
508 
509  for( LIB_ITEM& item : m_drawings )
510  {
511  if( item.Type() != LIB_FIELD_T )
512  continue;
513 
514  if( aUnit && item.m_Unit && ( item.m_Unit != aUnit ) )
515  continue;
516 
517  if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
518  continue;
519 
520  // The reference is a special case: we should change the basic text
521  // to add '?' and the part id
522  LIB_FIELD& field = (LIB_FIELD&) item;
523  wxString tmp = field.GetShownText();
524  if( field.GetId() == REFERENCE )
525  {
526  wxString text = field.GetFullText( aUnit );
527  field.SetText( text );
528  }
529  item.Plot( aPlotter, aOffset, fill, aTransform );
530  field.SetText( tmp );
531  }
532 }
virtual void SetColor(COLOR4D color)=0
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
wxString GetFullText(int unit=1) const
Return the text of a field.
Definition: lib_field.cpp:529
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
Field Reference of part, i.e. "IC21".
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
void SetText(const wxString &aText) override
Sets the field text to aText.
Definition: lib_field.cpp:675
int GetId() const
Definition: lib_field.h:136
bool GetColorMode() const
void LIB_PART::RemoveAlias ( const wxString &  aName)

Definition at line 1760 of file class_libentry.cpp.

References GetAlias().

Referenced by SCH_LEGACY_PLUGIN_CACHE::DeleteAlias(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), LIB_EDIT_FRAME::EditField(), SCH_LEGACY_PLUGIN_CACHE::removeAlias(), and LIB_ALIAS::~LIB_ALIAS().

1761 {
1762  LIB_ALIAS* a = GetAlias( aName );
1763 
1764  if( a )
1765  RemoveAlias( a );
1766 }
Part library alias object definition.
LIB_ALIAS * GetAlias(size_t aIndex)
void RemoveAlias(const wxString &aName)
LIB_ALIAS * LIB_PART::RemoveAlias ( LIB_ALIAS aAlias)

Definition at line 1770 of file class_libentry.cpp.

References GetChars(), LIB_ALIAS::GetName(), GetName(), LIB_ALIAS::IsRoot(), m_aliases, m_me, SetName(), and traceSchLibMem.

1771 {
1772  wxCHECK_MSG( aAlias, NULL, wxT( "Cannot remove alias by NULL pointer." ) );
1773 
1774  LIB_ALIAS* nextAlias = NULL;
1775 
1776  LIB_ALIASES::iterator it = find( m_aliases.begin(), m_aliases.end(), aAlias );
1777 
1778  if( it != m_aliases.end() )
1779  {
1780  bool rename = aAlias->IsRoot();
1781 
1782  wxLogTrace( traceSchLibMem,
1783  wxT( "%s: part:'%s', alias:'%s', alias count %llu, reference count %ld." ),
1784  GetChars( wxString::FromAscii( __WXFUNCTION__ ) ),
1785  GetChars( GetName() ),
1786  GetChars( aAlias->GetName() ),
1787  (long long unsigned) m_aliases.size(),
1788  m_me.use_count() );
1789 
1790  it = m_aliases.erase( it );
1791 
1792  if( !m_aliases.empty() )
1793  {
1794  if( it == m_aliases.end() )
1795  it = m_aliases.begin();
1796 
1797  nextAlias = *it;
1798 
1799  if( rename )
1800  SetName( nextAlias->GetName() );
1801  }
1802  }
1803 
1804  return nextAlias;
1805 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
bool IsRoot() const
const wxString & GetName() const
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxChar traceSchLibMem[]
Flag to enable schematic library memory deletion debug output.
const wxString & GetName() const
virtual void SetName(const wxString &aName)
PART_SPTR m_me
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared ...
void LIB_PART::RemoveAllAliases ( )

Definition at line 1808 of file class_libentry.cpp.

References m_aliases.

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

1809 {
1810  // Remove all of the aliases except the root alias.
1811  while( m_aliases.size() > 1 )
1812  m_aliases.pop_back();
1813 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
void LIB_PART::RemoveDrawItem ( LIB_ITEM aItem,
EDA_DRAW_PANEL aPanel = NULL,
wxDC *  aDc = NULL 
)

Remove draw aItem from list.

Parameters
aItem- Draw item to remove from list.
aPanel- Panel to remove part from.
aDc- Device context to remove part from.

Definition at line 535 of file class_libentry.cpp.

References DefaultTransform, LIB_ITEM::Draw(), g_XorMode, GetChars(), LIB_FIELD::GetId(), GetLibraryName(), LIB_FIELD::GetName(), GetName(), LIB_FIELD_T, m_drawings, MANDATORY_FIELDS, EDA_ITEM::SetModified(), and EDA_ITEM::Type().

Referenced by LIB_EDIT_FRAME::deleteItem(), LIB_PIN::SetConversion(), and LIB_PIN::SetPartNumber().

536 {
537  wxASSERT( aItem != NULL );
538 
539  // none of the MANDATORY_FIELDS may be removed in RAM, but they may be
540  // omitted when saving to disk.
541  if( aItem->Type() == LIB_FIELD_T )
542  {
543  LIB_FIELD* field = (LIB_FIELD*) aItem;
544 
545  if( field->GetId() < MANDATORY_FIELDS )
546  {
547  wxLogWarning( _(
548  "An attempt was made to remove the %s field from component %s in library %s." ),
549  GetChars( field->GetName() ), GetChars( GetName() ),
550  GetChars( GetLibraryName() ) );
551  return;
552  }
553  }
554 
555  LIB_ITEMS& items = m_drawings[ aItem->Type() ];
556 
557  for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
558  {
559  if( *i == aItem )
560  {
561  if( aDc != NULL )
562  aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED,
563  g_XorMode, NULL, DefaultTransform );
564 
565  items.erase( i );
566  SetModified();
567  break;
568  }
569  }
570 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void SetModified()
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
int GetId() const
Definition: lib_field.h:136
const wxString & GetName() const
wxString GetName(bool aTranslate=true) const
Returns the field name.
Definition: lib_field.cpp:605
const wxString GetLibraryName()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform)
Draw an item.
void LIB_PART::RemoveDuplicateDrawItems ( )

Remove duplicate draw items from list.

Definition at line 1353 of file class_libentry.cpp.

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

Referenced by LIB_EDIT_FRAME::LoadOneSymbol().

1354 {
1355  m_drawings.unique();
1356 }
void unique()
Remove duplicate elements in list.
Definition: multivector.h:238
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

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

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

Definition at line 211 of file base_struct.cpp.

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

Referenced by SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

212 {
213  wxCHECK_MSG( IsReplaceable(), false,
214  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
215 
216  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
217 
218  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
219  aSearchData.GetFindString() :
220  aSearchData.GetFindString().Upper() );
221 
222  if( result == wxNOT_FOUND )
223  return false;
224 
225  wxString prefix = aText.Left( result );
226  wxString suffix;
227 
228  if( aSearchData.GetFindString().length() + result < aText.length() )
229  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
230 
231  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
232  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
233  GetChars( suffix ) );
234 
235  aText = prefix + aSearchData.GetReplaceString() + suffix;
236 
237  return true;
238 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
const wxString traceFindReplace
Flag to enable find and replace debug tracing.
Definition: base_struct.cpp:58
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

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

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

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

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 446 of file base_struct.h.

446 { return false; }
void LIB_PART::RotateSelectedItems ( const wxPoint aCenter)

Rotate CCW selected draw items about a point.

Parameters
aCenter- Center point to mirror around.

Definition at line 1520 of file class_libentry.cpp.

References m_drawings.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd(), and LIB_EDIT_FRAME::HandleBlockPlace().

1521 {
1522  for( LIB_ITEM& item : m_drawings )
1523  {
1524  if( !item.IsSelected() )
1525  continue;
1526 
1527  item.Rotate( aCenter );
1528  item.m_Flags = 0;
1529  }
1530 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool LIB_PART::Save ( OUTPUTFORMATTER aFormatter)

Function Save writes the data structures out to aFormatter in the part library "*.lib" format.

Parameters
aFormatterA reference to an OUTPUTFORMATTER to write to.
Returns
True if success writing else false.

Definition at line 709 of file class_libentry.cpp.

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::empty(), ENTRY_POWER, GetFields(), GetName(), GetReferenceField(), GetText(), EDA_TEXT::GetText(), GetValueField(), LIB_FIELD::IsVisible(), LIB_FIELD_T, m_aliases, m_drawings, m_FootprintList, m_options, m_pinNameOffset, m_showPinNames, m_showPinNumbers, m_unitCount, m_unitsLocked, MANDATORY_FIELDS, OUTPUTFORMATTER::Print(), SaveDateAndTime(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::sort(), and TO_UTF8.

710 {
711  LIB_FIELD& value = GetValueField();
712 
713  // First line: it s a comment (component name for readers)
714  aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.GetText() ) );
715 
716  // Save data
717  aFormatter.Print( 0, "DEF" );
718 
719  if( value.IsVisible() )
720  {
721  aFormatter.Print( 0, " %s", TO_UTF8( value.GetText() ) );
722  }
723  else
724  {
725  aFormatter.Print( 0, " ~%s", TO_UTF8( value.GetText() ) );
726  }
727 
728  LIB_FIELD& reference = GetReferenceField();
729 
730  if( !reference.GetText().IsEmpty() )
731  {
732  aFormatter.Print( 0, " %s", TO_UTF8( reference.GetText() ) );
733  }
734  else
735  {
736  aFormatter.Print( 0, " ~" );
737  }
738 
739  aFormatter.Print( 0, " %d %d %c %c %d %c %c\n",
740  0, m_pinNameOffset,
741  m_showPinNumbers ? 'Y' : 'N',
742  m_showPinNames ? 'Y' : 'N',
743  m_unitCount, m_unitsLocked ? 'L' : 'F',
744  m_options == ENTRY_POWER ? 'P' : 'N' );
745 
746  if( !SaveDateAndTime( aFormatter ) )
747  return false;
748 
749  LIB_FIELDS fields;
750  GetFields( fields );
751 
752  // Mandatory fields:
753  // may have their own save policy so there is a separate loop for them.
754  // Empty fields are saved, because the user may have set visibility,
755  // size and orientation
756  for( int i = 0; i < MANDATORY_FIELDS; ++i )
757  {
758  if( !fields[i].Save( aFormatter ) )
759  return false;
760  }
761 
762  // User defined fields:
763  // may have their own save policy so there is a separate loop for them.
764 
765  int fieldId = MANDATORY_FIELDS; // really wish this would go away.
766 
767  for( unsigned i = MANDATORY_FIELDS; i < fields.size(); ++i )
768  {
769  // There is no need to save empty fields, i.e. no reason to preserve field
770  // names now that fields names come in dynamically through the template
771  // fieldnames.
772  if( !fields[i].GetText().IsEmpty() )
773  {
774  fields[i].SetId( fieldId++ );
775 
776  if( !fields[i].Save( aFormatter ) )
777  return false;
778  }
779  }
780 
781  // Save the alias list: a line starting by "ALIAS". The first alias is the root
782  // and has the same name as the component. In the old library file format this
783  // alias does not get added to the alias list.
784  if( m_aliases.size() > 1 )
785  {
786  aFormatter.Print( 0, "ALIAS" );
787 
788  for( unsigned i = 1; i < m_aliases.size(); i++ )
789  {
790  aFormatter.Print( 0, " %s", TO_UTF8( m_aliases[i]->GetName() ) );
791  }
792 
793  aFormatter.Print( 0, "\n" );
794  }
795 
796  // Write the footprint filter list
797  if( m_FootprintList.GetCount() != 0 )
798  {
799  aFormatter.Print( 0, "$FPLIST\n" );
800 
801  for( unsigned i = 0; i < m_FootprintList.GetCount(); i++ )
802  {
803  aFormatter.Print( 0, " %s\n", TO_UTF8( m_FootprintList[i] ) );
804  }
805 
806  aFormatter.Print( 0, "$ENDFPLIST\n" );
807  }
808 
809  // Save graphics items (including pins)
810  if( !m_drawings.empty() )
811  {
812  /* we sort the draw items, in order to have an edition more easy,
813  * when a file editing "by hand" is made */
814  m_drawings.sort();
815 
816  aFormatter.Print( 0, "DRAW\n" );
817 
818  for( LIB_ITEM& item : m_drawings )
819  {
820  if( item.Type() == LIB_FIELD_T )
821  continue;
822 
823  if( !item.Save( aFormatter ) )
824  return false;
825  }
826 
827  aFormatter.Print( 0, "ENDDRAW\n" );
828  }
829 
830  aFormatter.Print( 0, "ENDDEF\n" );
831 
832  return true;
833 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
bool m_showPinNumbers
Determines if part pin numbers are visible.
int m_unitCount
Number of units (parts) per package.
bool empty(int aType=UNDEFINED_TYPE)
Definition: multivector.h:224
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void sort()
Definition: multivector.h:229
LIB_FIELD & GetValueField()
Return reference to the value field.
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...
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
int m_pinNameOffset
The offset in mils to draw the pin name.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
bool Save(OUTPUTFORMATTER &aFormatter)
Function Save writes the data structures out to aFormatter in the part library "*.lib" format.
const wxString & GetName() const
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
wxArrayString m_FootprintList
List of suitable footprint names for the part (wild card names accepted).
bool IsVisible() const
Function IsVisible.
Definition: lib_field.h:168
std::vector< LIB_FIELD > LIB_FIELDS
Definition: lib_field.h:261
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
bool m_showPinNames
Determines if part pin names are visible.
void GetFields(LIB_FIELDS &aList)
Function GetFields returns a list of fields withing this part.
bool SaveDateAndTime(OUTPUTFORMATTER &aFormatter)
Function SaveDateAndTime write the date and time of part to aFile in the format: "Ti yy/mm/jj hh:mm:s...
bool LIB_PART::SaveDateAndTime ( OUTPUTFORMATTER aFormatter)

Function SaveDateAndTime write the date and time of part to aFile in the format: "Ti yy/mm/jj hh:mm:ss".

Parameters
aFormatterA reference to an OUTPUTFORMATTER object containing the output format to write to.
Returns
True if the date and time were successfully written to aFormatter.

Definition at line 1307 of file class_libentry.cpp.

References m_dateModified, min, and OUTPUTFORMATTER::Print().

Referenced by Save().

1308 {
1309  int year, mon, day, hour, min, sec;
1310 
1311  if( m_dateModified == 0 )
1312  return true;
1313 
1314  sec = m_dateModified & 63;
1315  min = ( m_dateModified >> 6 ) & 63;
1316  hour = ( m_dateModified >> 12 ) & 31;
1317  day = ( m_dateModified >> 17 ) & 31;
1318  mon = ( m_dateModified >> 22 ) & 15;
1319  year = ( m_dateModified >> 26 ) + 1990;
1320 
1321  aFormatter.Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
1322 
1323  return true;
1324 }
long m_dateModified
Date the part was last modified.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
#define min(a, b)
Definition: auxiliary.h:85
int LIB_PART::SelectItems ( EDA_RECT aRect,
int  aUnit,
int  aConvert,
bool  aEditPinByPin 
)

Checks all draw objects of part to see if they are with block.

Use this method to mark draw objects as selected during block functions.

Parameters
aRect- The bounding rectangle to test in draw items are inside.
aUnit- The current unit number to test against.
aConvert- Are the draw items being selected a conversion.
aEditPinByPin- Used to ignore pin selections when in edit pin by pin mode is enabled.
Returns
The number of draw objects found inside the block select rectangle.

Definition at line 1380 of file class_libentry.cpp.

References LIB_PIN_T, m_drawings, m_unitsLocked, and SELECTED.

Referenced by LIB_EDIT_FRAME::HandleBlockEnd().

1381 {
1382  int itemCount = 0;
1383 
1384  for( LIB_ITEM& item : m_drawings )
1385  {
1386  item.ClearFlags( SELECTED );
1387 
1388  if( ( item.m_Unit && item.m_Unit != aUnit )
1389  || ( item.m_Convert && item.m_Convert != aConvert ) )
1390  {
1391  if( item.Type() != LIB_PIN_T )
1392  continue;
1393 
1394  // Specific rules for pins.
1395  if( aEditPinByPin || m_unitsLocked
1396  || ( item.m_Convert && item.m_Convert != aConvert ) )
1397  continue;
1398  }
1399 
1400  if( item.Inside( aRect ) )
1401  {
1402  item.SetFlags( SELECTED );
1403  itemCount++;
1404  }
1405  }
1406 
1407  return itemCount;
1408 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit...
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
#define SELECTED
Definition: base_struct.h:134
void LIB_PART::SetAliases ( const wxArrayString &  aAliasList)

Definition at line 1706 of file class_libentry.cpp.

References GetAliasNames(), HasAlias(), m_aliases, and m_library.

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

1707 {
1708  wxCHECK_RET( !m_library,
1709  wxT( "Part aliases cannot be changed when they are owned by a library." ) );
1710  wxCHECK_RET( !aAliasList.IsEmpty(), wxT( "Alias list cannot be empty" ) );
1711 
1712  if( aAliasList == GetAliasNames() )
1713  return;
1714 
1715  // Add names not existing in the current component alias list.
1716  for( size_t i = 0; i < aAliasList.GetCount(); i++ )
1717  {
1718  if( HasAlias( aAliasList[ i ] ) )
1719  continue;
1720 
1721  m_aliases.push_back( new LIB_ALIAS( aAliasList[ i ], this ) );
1722  }
1723 
1724  // Remove names in the current component that are not in the new alias list.
1725  LIB_ALIASES::iterator it = m_aliases.begin();
1726 
1727  while( it != m_aliases.end() )
1728  {
1729  int index = aAliasList.Index( (*it)->GetName(), false );
1730 
1731  if( index != wxNOT_FOUND || (*it)->IsRoot() )
1732  ++it;
1733  else
1734  it = m_aliases.erase( it );
1735  }
1736 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
PART_LIB * m_library
Library the part belongs to if any.
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
wxArrayString GetAliasNames(bool aIncludeRoot=true) const
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 226 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

226 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 243 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

243 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void LIB_PART::SetConversion ( bool  aSetConvert)

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.

Definition at line 1619 of file class_libentry.cpp.

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, and m_drawings.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert().

1620 {
1621  if( aSetConvert == HasConversion() )
1622  return;
1623 
1624  // Duplicate items to create the converted shape
1625  if( aSetConvert )
1626  {
1627  std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
1628 
1629  for( LIB_ITEM& item : m_drawings )
1630  {
1631  // Only pins are duplicated.
1632  if( item.Type() != LIB_PIN_T )
1633  continue;
1634 
1635  if( item.m_Convert == 1 )
1636  {
1637  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1638  newItem->m_Convert = 2;
1639  tmp.push_back( newItem );
1640  }
1641  }
1642 
1643  // Transfer the new pins to the LIB_PART.
1644  for( unsigned i = 0; i < tmp.size(); i++ )
1645  m_drawings.push_back( tmp[i] );
1646  }
1647  else
1648  {
1649  // Delete converted shape items because the converted shape does
1650  // not exist
1651  LIB_ITEMS_CONTAINER::ITERATOR i = m_drawings.begin();
1652 
1653  while( i != m_drawings.end() )
1654  {
1655  if( i->m_Convert > 1 )
1656  i = m_drawings.erase( i );
1657  else
1658  ++i;
1659  }
1660  }
1661 }
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
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.
void LIB_PART::SetFields ( const std::vector< LIB_FIELD > &  aFieldsList)

Function SetFields overwrites all the existing in this part 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 1208 of file class_libentry.cpp.

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

Referenced by DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick().

1209 {
1210  deleteAllFields();
1211 
1212  for( unsigned i=0; i<aFields.size(); ++i )
1213  {
1214  // drawings is a ptr_vector, new and copy an object on the heap.
1215  LIB_FIELD* field = new LIB_FIELD( aFields[i] );
1216 
1217  field->SetParent( this );
1218  m_drawings.push_back( field );
1219  }
1220 }
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
void deleteAllFields()
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
void push_back(T *aItem)
Definition: multivector.h:169
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 267 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), CopySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::EditDimension(), LIB_PIN::EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

267 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 279 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

279 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 242 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

242 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void LIB_PART::SetLib ( PART_LIB aLibrary)

Definition at line 1664 of file class_libentry.cpp.

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

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

1665 {
1666  m_library = aLibrary;
1667 
1668  if( aLibrary )
1669  m_libId.SetLibNickname( aLibrary->GetName() );
1670 }
PART_LIB * m_library
Library the part belongs to if any.
const wxString GetName() const
Return the file name without path or extension.
LIB_ID m_libId
int SetLibNickname(const UTF8 &aNickname)
Function SetLibNickname.
Definition: lib_id.cpp:219
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

228 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:180
void EDA_ITEM::SetModified ( )
inherited

Definition at line 102 of file base_struct.cpp.

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

Referenced by SCH_COMPONENT::ClearAnnotation(), SCH_LINE::Move(), LIB_PIN::Move(), SCH_COMPONENT::Move(), RemoveDrawItem(), SCH_COMPONENT::SetConvert(), LIB_PIN::SetLength(), SCH_COMPONENT::SetLibId(), EDA_ITEM::SetModified(), LIB_FIELD::SetName(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), SCH_COMPONENT::SetTransform(), LIB_PIN::SetType(), SCH_COMPONENT::SetUnit(), LIB_PIN::SetVisible(), and LIB_PIN::SetWidth().

103 {
104  SetFlags( IS_CHANGED );
105 
106  // If this a child object, then the parent modification state also needs to be set.
107  if( m_Parent )
109 }
void SetModified()
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void LIB_PART::SetName ( const wxString &  aName)
virtual

Definition at line 296 of file class_libentry.cpp.

References EDA_TEXT::GetText(), GetValueField(), m_aliases, m_libId, LIB_ID::SetLibItemName(), and LIB_FIELD::SetText().

Referenced by LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::fixDuplicateAliases(), LIB_PART(), Load(), LoadField(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), RESCUE_CACHE_CANDIDATE::PerformAction(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction(), LIB_VIEW_FRAME::RedrawActiveWindow(), RemoveAlias(), and LIB_FIELD::SetText().

297 {
298  m_libId.SetLibItemName( aName, false );
299 
300  // The LIB_ALIAS that is the LIB_PART name has to be created so create it.
301  if( m_aliases.size() == 0 )
302  m_aliases.push_back( new LIB_ALIAS( aName, this ) );
303  else
304  m_aliases[0]->SetName( aName );
305 
306  LIB_FIELD& valueField = GetValueField();
307 
308  // LIB_FIELD::SetText() calls LIB_PART::SetName(),
309  // the following if-clause is to break an infinite loop
310  if( valueField.GetText() != aName )
311  valueField.SetText( aName );
312 
313 }
LIB_ALIASES m_aliases
List of alias object pointers associated with the part.
Part library alias object definition.
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
LIB_FIELD & GetValueField()
Return reference to the value field.
void SetText(const wxString &aText) override
Sets the field text to aText.
Definition: lib_field.cpp:675
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
LIB_ID m_libId
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Function SetLibItemName.
Definition: lib_id.cpp:232
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 225 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

225 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
void LIB_PART::SetNormal ( )
inline

Definition at line 392 of file class_libentry.h.

References ENTRY_NORMAL.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

392 { m_options = ENTRY_NORMAL; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
void LIB_PART::SetOffset ( const wxPoint aOffset)

Move the part aOffset.

Parameters
aOffset- Offset displacement.

Definition at line 1346 of file class_libentry.cpp.

References m_drawings.

1347 {
1348  for( LIB_ITEM& item : m_drawings )
1349  item.SetOffset( aOffset );
1350 }
LIB_ITEMS_CONTAINER m_drawings
Drawing items of this part.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 227 of file base_struct.h.

Referenced by MODULE::Add(), BOARD::Add(), BOARD_NETLIST_UPDATER::addNewComponent(), LIB_FIELD::Copy(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateSheet(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), SCH_COMPONENT::operator=(), PCB_PARSER::parseMODULE_unchecked(), LIB_EDIT_FRAME::pasteClipboard(), PCBNEW_CONTROL::PasteItemsFromClipboard(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), SCH_COMPONENT::SCH_COMPONENT(), SCH_SHEET::SCH_SHEET(), SCH_SHEET_PIN::SCH_SHEET_PIN(), SetFields(), SetSchItemParent(), PCB_EDIT_FRAME::StartMoveModule(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), and SwapItemData().

227 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
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 767 of file class_libentry.h.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

767 { m_pinNameOffset = aOffset; }
int m_pinNameOffset
The offset in mils to draw the pin name.
void LIB_PART::SetPower ( )
inline

Definition at line 391 of file class_libentry.h.

References ENTRY_POWER.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

391 { m_options = ENTRY_POWER; }
LIBRENTRYOPTIONS m_options
Special part features such as POWER or NORMAL.)
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 241 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by LIB_EDIT_FRAME::pasteClipboard(), GERBVIEW_SELECTION_TOOL::selectVisually(), and SELECTION_TOOL::selectVisually().

241 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
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 776 of file class_libentry.h.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

776 { m_showPinNames = aShow; }
bool m_showPinNames
Determines if part pin names are visible.
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 785 of file class_libentry.h.

Referenced by LIB_EDIT_FRAME::OnCreateNewPart(), and DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick().

785 { m_showPinNumbers = aShow; }
bool m_showPinNumbers
Determines if part pin numbers are visible.
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
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 1850 of file class_libentry.cpp.

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::LoadProjectFile(), and SCH_EDIT_FRAME::OnPreferencesOptions().

1851 {
1852  m_subpartFirstId = 'A';
1854 
1855  if( aSep == '.' || aSep == '-' || aSep == '_' )
1856  m_subpartIdSeparator = aSep;
1857 
1858  if( aFirstId == '1' && aSep != 0 )
1859  m_subpartFirstId = aFirstId;
1860 }
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'...
void EDA_ITEM::SetTimeStamp ( time_t  aNewTimeStamp)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), DuplicateStruct(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), PCB_BASE_FRAME::LoadModuleFromLibrary(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), SCH_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), and TestDuplicateSheetNames().

217 { m_TimeStamp = aNewTimeStamp; }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
void LIB_PART::SetUnitCount ( int  count)

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
count- Number of units per package.

Definition at line 1572 of file class_libentry.cpp.

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, and m_unitCount.

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), and LIB_EDIT_FRAME::OnCreateNewPart().

1573 {
1574  if( m_unitCount == aCount )
1575  return;
1576 
1577  if( aCount < m_unitCount )
1578  {
1580 
1581  while( i != m_drawings.end() )
1582  {
1583  if( i->m_Unit > aCount )
1584  i = m_drawings.erase( i );
1585  else
1586  ++i;
1587  }
1588  }
1589  else
1590  {
1591  int prevCount = m_unitCount;
1592 
1593  // Temporary storage for new items, as adding new items directly to
1594  // m_drawings may cause the buffer reallocation which invalidates the
1595  // iterators
1596  std::vector< LIB_ITEM* > tmp;
1597 
1598  for( LIB_ITEM& item : m_drawings )
1599  {
1600  if( item.m_Unit != 1 )
1601  continue;
1602 
1603  for( int j = prevCount + 1; j <= aCount; j++ )
1604  {
1605  LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
1606  newItem->m_Unit = j;
1607  tmp.push_back( newItem );
1608  }
1609  }
1610 
1611  for( auto item : tmp )
1612  m_drawings.push_back( item );
1613  }
1614 
1615  m_unitCount = aCount;
1616 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
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.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
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
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 240 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

240 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
PART_SPTR LIB_PART::SharedPtr ( )
inline

Definition at line 263 of file class_libentry.h.

References m_me.

Referenced by SCH_COMPONENT::Resolve(), SCH_COMPONENT::SCH_COMPONENT(), and SCH_COMPONENT::SetLibId().

264  {
265  // clone a shared pointer
266  return m_me;
267  }
PART_SPTR m_me
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared ...
bool LIB_PART::ShowPinNames ( )
inline

Definition at line 778 of file class_libentry.h.

References m_showPinNames.

Referenced by LIB_PIN::drawGraphic(), LIB_PIN::GetBoundingBox(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel(), and LIB_EDIT_FRAME::SaveOneSymbol().

778 { return m_showPinNames; }
bool m_showPinNames
Determines if part pin names are visible.
bool LIB_PART::ShowPinNumbers ( )
inline

Definition at line 787 of file class_libentry.h.

References m_showPinNumbers.

Referenced by LIB_PIN::drawGraphic(), LIB_PIN::GetBoundingBox(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel(), and LIB_EDIT_FRAME::SaveOneSymbol().

787 { return m_showPinNumbers; }
bool m_showPinNumbers
Determines if part pin numbers are visible.
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 477 of file base_struct.h.

Referenced by PART_LIB::GetEntryTypePowerNames().

477 { return *aLeft < *aRight; }
static int* LIB_PART::SubpartFirstIdPtr ( )
inlinestatic

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

Definition at line 734 of file class_libentry.h.

References m_subpartFirstId.

Referenced by SCH_EDIT_FRAME::GetProjectFileParametersList().

734 { return &m_subpartFirstId; }
static int m_subpartFirstId
the ascii char value to calculate the subpart symbol id from the part number: only 'A'...
static int* LIB_PART::SubpartIdSeparatorPtr ( )
inlinestatic

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

Definition at line 728 of file class_libentry.h.

References m_subpartIdSeparator.

Referenced by SCH_EDIT_FRAME::GetProjectFileParametersList().

728 { return &m_subpartIdSeparator; }
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
wxString LIB_PART::SubReference ( int  aUnit,
bool  aAddSeparator = true 
)
static

Function SubReference.

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 prpebd the sub ref by the separator symbol (if any) Note: this is a static function.

Definition at line 264 of file class_libentry.cpp.

References m_subpartFirstId, and m_subpartIdSeparator.

Referenced by AddMenusForEditComponent(), SCH_REFERENCE_LIST::CheckAnnotation(), CMP_TREE_NODE_UNIT::CMP_TREE_NODE_UNIT(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel(), LIB_FIELD::GetFullText(), SCH_FIELD::GetFullyQualifiedText(), SCH_FIELD::Matches(), and LIB_EDIT_FRAME::UpdatePartSelectList().

265 {
266  wxString subRef;
267 
268  if( m_subpartIdSeparator != 0 && aAddSeparator )
269  subRef << wxChar( m_subpartIdSeparator );
270 
271  if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
272  subRef << aUnit;
273  else
274  {
275  // use letters as notation. To allow more than 26 units, the sub ref
276  // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise
277  // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available)
278  int u;
279  aUnit -= 1; // Unit number starts to 1. now to 0.
280 
281  while( aUnit >= 26 ) // more than one letter are needed
282  {
283  u = aUnit / 26;
284  subRef << wxChar( m_subpartFirstId + u -1 );
285  aUnit %= 26;
286  }
287 
288  u = m_subpartFirstId + aUnit;
289  subRef << wxChar( u );
290  }
291 
292  return subRef;
293 }
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'...
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.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CLUSTER::Add(), BOARD::Add(), CN_CONNECTIVITY_ALGO::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), HIERARCHY_NAVIG_DLG::BuildTree(), calcArea(), calcMaxArea(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), Collect_TrackSegmentsToDrag(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), LIB_EDIT_FRAME::CreateGraphicItem(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteItemsInList(), DeleteNullTrackSegments(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), POINT_EDITOR::finishItem(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), getAnchorPoint(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsDraggableJunction(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), CN_CONNECTIVITY_ALGO::searchConnections(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_NO_CONNECT::SwapData(), SCH_JUNCTION::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), VIA::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), ZONE_CONTAINER::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and SCH_COMPONENT::Visit().

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:174
bool LIB_PART::UnitsLocked ( ) const
inline

Definition at line 395 of file class_libentry.h.

References m_unitsLocked.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel(), SCH_REFERENCE::IsUnitsLocked(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), and LIB_EDIT_FRAME::OnEditComponentProperties().

395 { return m_unitsLocked; }
bool m_unitsLocked
True if part has multiple units and changing one unit does not automatically change another unit...
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, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 267 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

Referenced by SELECTION_TOOL::selectMultiple(), BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), BRIGHT_BOX::ViewDraw(), and COMMON_TOOLS::ZoomFitScreen().

268 {
269  // Basic fallback
270  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
271  VECTOR2I( GetBoundingBox().GetSize() ) );
272 }
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
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::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 115 of file view_item.h.

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

116  {}
void EDA_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

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[]

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, VIA, BOARD_ITEM, GERBER_DRAW_ITEM, TRACK, TEXTE_MODULE, ZONE_CONTAINER, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, and KIGFX::PREVIEW::RULER_ITEM.

Definition at line 275 of file base_struct.cpp.

276 {
277  // Basic fallback
278  aCount = 1;
279  aLayers[0] = 0;
280 }
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 D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TRACK, and TEXTE_MODULE.

Definition at line 139 of file view_item.h.

Referenced by KIGFX::VIEW::drawItem::operator()().

140  {
141  // By default always show the item
142  return 0;
143  }
SEARCH_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
virtualinherited

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 in BOARD, SCH_COMPONENT, MODULE, SCH_SHEET, GERBER_FILE_IMAGE, GERBER_DRAW_ITEM, TRACK, and GBR_LAYOUT.

Definition at line 151 of file base_struct.cpp.

References EOT, EDA_ITEM::GetClass(), SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Type().

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

152 {
153  KICAD_T stype;
154 
155 #if 0 && defined(DEBUG)
156  std::cout << GetClass().mb_str() << ' ';
157 #endif
158 
159  for( const KICAD_T* p = scanTypes; (stype = *p) != EOT; ++p )
160  {
161  // If caller wants to inspect my type
162  if( stype == Type() )
163  {
164  if( SEARCH_QUIT == inspector( this, testData ) )
165  return SEARCH_QUIT;
166 
167  break;
168  }
169  }
170 
171  return SEARCH_CONTINUE;
172 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
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
virtual wxString GetClass() const =0
Function GetClass returns the class name.

Member Data Documentation

LIB_ALIASES LIB_PART::m_aliases
private

List of alias object pointers associated with the part.

Definition at line 241 of file class_libentry.h.

Referenced by AddAlias(), GetAlias(), GetAliasNames(), HasAlias(), LIB_PART(), LoadAliases(), RemoveAlias(), RemoveAllAliases(), Save(), SetAliases(), SetName(), and ~LIB_PART().

long LIB_PART::m_dateModified
private

Date the part was last modified.

Definition at line 235 of file class_libentry.h.

Referenced by LIB_PART(), LoadDateAndTime(), and SaveDateAndTime().

STATUS_FLAGS EDA_ITEM::m_Flags
protectedinherited

Flag bits for editing and other uses.

Definition at line 189 of file base_struct.h.

Referenced by LIB_CIRCLE::BeginEdit(), LIB_RECTANGLE::BeginEdit(), LIB_POLYLINE::BeginEdit(), LIB_TEXT::BeginEdit(), LIB_ARC::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_CIRCLE::calcEdit(), LIB_POLYLINE::calcEdit(), LIB_RECTANGLE::calcEdit(), LIB_TEXT::calcEdit(), LIB_ARC::calcEdit(), LIB_FIELD::calcEdit(), LIB_TEXT::Clone(), LIB_CIRCLE::ContinueEdit(), LIB_RECTANGLE::ContinueEdit(), LIB_POLYLINE::ContinueEdit(), LIB_TEXT::ContinueEdit(), LIB_ARC::ContinueEdit(), LIB_FIELD::ContinueEdit(), SCH_LINE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), SEGZONE::Draw(), D_PAD::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_ARC::drawGraphic(), DRAWSEGMENT::DRAWSEGMENT(), LIB_CIRCLE::EndEdit(), LIB_RECTANGLE::EndEdit(), LIB_POLYLINE::EndEdit(), LIB_TEXT::EndEdit(), LIB_ARC::EndEdit(), LIB_ITEM::EndEdit(), LIB_FIELD::EndEdit(), EDA_ITEM::GetFlags(), TRACK::GetMsgPanelInfoBase_Common(), SCH_JUNCTION::HitTest(), SCH_LINE::HitTest(), SCH_COMPONENT::HitTest(), LIB_ITEM::InEditMode(), EDA_ITEM::initVars(), SCH_ITEM::IsConnected(), SCH_LINE::Move(), EDA_ITEM::operator=(), SCH_COMPONENT::SCH_COMPONENT(), LIB_PIN::SetConversion(), LIB_PIN::SetLength(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), LIB_PIN::SetType(), and LIB_PIN::SetVisible().

wxArrayString LIB_PART::m_FootprintList
private

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

Definition at line 239 of file class_libentry.h.

Referenced by GetFootPrints(), LIB_PART(), LoadFootprints(), and Save().

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 SCH_FIELD::Draw(), EDA_ITEM::initVars(), and EDA_ITEM::operator=().

LIB_ID LIB_PART::m_libId
private

Definition at line 228 of file class_libentry.h.

Referenced by GetLibId(), LIB_PART(), SetLib(), and SetName().

PART_LIB* LIB_PART::m_library
private

Library the part belongs to if any.

Definition at line 243 of file class_libentry.h.

Referenced by GetLib(), GetLibraryName(), LIB_PART(), SetAliases(), and SetLib().

DHEAD* EDA_ITEM::m_List
protectedinherited

which DLIST I am on.

Definition at line 180 of file base_struct.h.

Referenced by EDA_ITEM::GetList(), and EDA_ITEM::initVars().

LIBRENTRYOPTIONS LIB_PART::m_options
private

Special part features such as POWER or NORMAL.)

Definition at line 236 of file class_libentry.h.

Referenced by LIB_PART(), Load(), and Save().

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 229 of file class_libentry.h.

Referenced by GetPinNameOffset(), LIB_PART(), Load(), and Save().

bool LIB_PART::m_showPinNames
private

Determines if part pin names are visible.

Definition at line 233 of file class_libentry.h.

Referenced by LIB_PART(), Load(), Save(), and ShowPinNames().

bool LIB_PART::m_showPinNumbers
private

Determines if part pin numbers are visible.

Definition at line 234 of file class_libentry.h.

Referenced by LIB_PART(), Load(), Save(), and ShowPinNumbers().

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 248 of file class_libentry.h.

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

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 245 of file class_libentry.h.

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

int LIB_PART::m_unitCount
private

Number of units (parts) per package.

Definition at line 237 of file class_libentry.h.

Referenced by GetBodyBoundingBox(), GetUnitBoundingBox(), GetUnitCount(), LIB_PART(), Load(), Save(), and SetUnitCount().

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 231 of file class_libentry.h.

Referenced by LIB_PART(), Load(), Save(), SelectItems(), and UnitsLocked().


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