KiCad PCB EDA Suite
base_struct.h File Reference

Basic classes for most KiCad items. More...

#include <core/typeinfo.h>
#include "common.h"
#include <bitmap_types.h>
#include <view/view_item.h>

Go to the source code of this file.

Classes

class  EDA_ITEM
 Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards. More...
 

Macros

#define IS_CHANGED   (1 << 0)
 std::function passed to nested users by ref, avoids copying std::function More...
 
#define IS_LINKED   (1 << 1)
 Used in calculation to mark linked items (temporary use) More...
 
#define IN_EDIT   (1 << 2)
 Item currently edited. More...
 
#define IS_MOVED   (1 << 3)
 Item being moved. More...
 
#define IS_NEW   (1 << 4)
 New item, just created. More...
 
#define IS_RESIZED   (1 << 5)
 Item being resized. More...
 
#define IS_DRAGGED   (1 << 6)
 Item being dragged. More...
 
#define IS_DELETED   (1 << 7)
 
#define IS_WIRE_IMAGE   (1 << 8)
 Item to be drawn as wireframe while editing. More...
 
#define STARTPOINT   (1 << 9)
 
#define ENDPOINT   (1 << 10)
 
#define SELECTED   (1 << 11)
 
#define SELECTEDNODE   (1 << 12)
 flag indicating that the structure has already selected More...
 
#define STRUCT_DELETED   (1 << 13)
 flag indication structures to be erased More...
 
#define CANDIDATE   (1 << 14)
 flag indicating that the structure is connected More...
 
#define SKIP_STRUCT   (1 << 15)
 flag indicating that the structure should be ignored More...
 
#define DO_NOT_DRAW   (1 << 16)
 Used to disable draw function. More...
 
#define IS_CANCELLED   (1 << 17)
 flag set when edit dialogs are canceled when editing a More...
 
#define TRACK_LOCKED   (1 << 18)
 Pcbnew: track locked: protected from global deletion. More...
 
#define TRACK_AR   (1 << 19)
 Pcbnew: autorouted track. More...
 
#define FLAG1   (1 << 20)
 Pcbnew: flag used in local computations. More...
 
#define FLAG0   (1 << 21)
 Pcbnew: flag used in local computations. More...
 
#define BEGIN_ONPAD   (1 << 22)
 Pcbnew: flag set for track segment starting on a pad. More...
 
#define END_ONPAD   (1 << 23)
 Pcbnew: flag set for track segment ending on a pad. More...
 
#define BUSY   (1 << 24)
 Pcbnew: flag indicating that the structure has. More...
 
#define HIGHLIGHTED   (1 << 25)
 item is drawn in normal colors, when the rest is darkened More...
 
#define BRIGHTENED   (1 << 26)
 item is drawn with a bright contour More...
 
#define DP_COUPLED   (1 << 27)
 item is coupled with another item making a differential pair More...
 
#define UR_TRANSIENT   (1 << 28)
 indicates the item is owned by the undo/redo stack More...
 
#define EDA_ITEM_ALL_FLAGS   -1
 

Typedefs

typedef std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
 Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a list or tree of KICAD_T objects. More...
 
typedef const INSPECTOR_FUNCINSPECTOR
 
typedef unsigned STATUS_FLAGS
 
typedef std::vector< EDA_ITEM * > EDA_ITEMS
 Define list of drawing items for screens. More...
 

Enumerations

enum  FILL_T { NO_FILL, FILLED_SHAPE, FILLED_WITH_BG_BODYCOLOR }
 Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas. More...
 
enum  SEARCH_RESULT { SEARCH_QUIT, SEARCH_CONTINUE }
 

Functions

EDA_ITEMnew_clone (const EDA_ITEM &aItem)
 Function new_clone provides cloning capabilities for all Boost pointer containers of EDA_ITEM pointers. More...
 

Detailed Description

Basic classes for most KiCad items.

Definition in file base_struct.h.

Macro Definition Documentation

◆ BEGIN_ONPAD

#define BEGIN_ONPAD   (1 << 22)

Pcbnew: flag set for track segment starting on a pad.

Definition at line 133 of file base_struct.h.

◆ BRIGHTENED

#define BRIGHTENED   (1 << 26)

item is drawn with a bright contour

Definition at line 138 of file base_struct.h.

◆ BUSY

#define BUSY   (1 << 24)

Pcbnew: flag indicating that the structure has.

already been edited, in some functions

Definition at line 135 of file base_struct.h.

◆ CANDIDATE

#define CANDIDATE   (1 << 14)

flag indicating that the structure is connected

Definition at line 124 of file base_struct.h.

◆ DO_NOT_DRAW

#define DO_NOT_DRAW   (1 << 16)

Used to disable draw function.

Definition at line 126 of file base_struct.h.

◆ DP_COUPLED

#define DP_COUPLED   (1 << 27)

item is coupled with another item making a differential pair

(applies to segments only)

Definition at line 140 of file base_struct.h.

◆ EDA_ITEM_ALL_FLAGS

#define EDA_ITEM_ALL_FLAGS   -1

Definition at line 145 of file base_struct.h.

◆ END_ONPAD

#define END_ONPAD   (1 << 23)

Pcbnew: flag set for track segment ending on a pad.

Definition at line 134 of file base_struct.h.

◆ ENDPOINT

#define ENDPOINT   (1 << 10)

Definition at line 120 of file base_struct.h.

◆ FLAG0

#define FLAG0   (1 << 21)

Pcbnew: flag used in local computations.

Definition at line 132 of file base_struct.h.

◆ FLAG1

#define FLAG1   (1 << 20)

Pcbnew: flag used in local computations.

Definition at line 131 of file base_struct.h.

◆ HIGHLIGHTED

#define HIGHLIGHTED   (1 << 25)

item is drawn in normal colors, when the rest is darkened

Definition at line 137 of file base_struct.h.

◆ IN_EDIT

#define IN_EDIT   (1 << 2)

Item currently edited.

Definition at line 112 of file base_struct.h.

◆ IS_CANCELLED

#define IS_CANCELLED   (1 << 17)

flag set when edit dialogs are canceled when editing a

new object

Definition at line 127 of file base_struct.h.

◆ IS_CHANGED

#define IS_CHANGED   (1 << 0)

std::function passed to nested users by ref, avoids copying std::function

Item was edited, and modified

Definition at line 110 of file base_struct.h.

◆ IS_DELETED

#define IS_DELETED   (1 << 7)

Definition at line 117 of file base_struct.h.

◆ IS_DRAGGED

#define IS_DRAGGED   (1 << 6)

Item being dragged.

Definition at line 116 of file base_struct.h.

◆ IS_LINKED

#define IS_LINKED   (1 << 1)

Used in calculation to mark linked items (temporary use)

Definition at line 111 of file base_struct.h.

◆ IS_MOVED

#define IS_MOVED   (1 << 3)

Item being moved.

Definition at line 113 of file base_struct.h.

◆ IS_NEW

#define IS_NEW   (1 << 4)

New item, just created.

Definition at line 114 of file base_struct.h.

◆ IS_RESIZED

#define IS_RESIZED   (1 << 5)

Item being resized.

Definition at line 115 of file base_struct.h.

◆ IS_WIRE_IMAGE

#define IS_WIRE_IMAGE   (1 << 8)

Item to be drawn as wireframe while editing.

Definition at line 118 of file base_struct.h.

◆ SELECTED

#define SELECTED   (1 << 11)

Definition at line 121 of file base_struct.h.

◆ SELECTEDNODE

#define SELECTEDNODE   (1 << 12)

flag indicating that the structure has already selected

Definition at line 122 of file base_struct.h.

◆ SKIP_STRUCT

#define SKIP_STRUCT   (1 << 15)

flag indicating that the structure should be ignored

Definition at line 125 of file base_struct.h.

◆ STARTPOINT

#define STARTPOINT   (1 << 9)

Definition at line 119 of file base_struct.h.

◆ STRUCT_DELETED

#define STRUCT_DELETED   (1 << 13)

flag indication structures to be erased

Definition at line 123 of file base_struct.h.

◆ TRACK_AR

#define TRACK_AR   (1 << 19)

Pcbnew: autorouted track.

Definition at line 130 of file base_struct.h.

◆ TRACK_LOCKED

#define TRACK_LOCKED   (1 << 18)

Pcbnew: track locked: protected from global deletion.

Definition at line 129 of file base_struct.h.

◆ UR_TRANSIENT

#define UR_TRANSIENT   (1 << 28)

indicates the item is owned by the undo/redo stack

Definition at line 142 of file base_struct.h.

Typedef Documentation

◆ EDA_ITEMS

typedef std::vector< EDA_ITEM* > EDA_ITEMS

Define list of drawing items for screens.

The standard C++ container was chosen so the pointer can be removed from a list without it being destroyed.

Definition at line 550 of file base_struct.h.

◆ INSPECTOR

typedef const INSPECTOR_FUNC& INSPECTOR

Definition at line 102 of file base_struct.h.

◆ INSPECTOR_FUNC

typedef std::function< SEARCH_RESULT ( EDA_ITEM* aItem, void* aTestData ) > INSPECTOR_FUNC

Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a list or tree of KICAD_T objects.

Provide an implementation as needed to inspect EDA_ITEMs visited via EDA_ITEM::Visit() and EDA_ITEM::IterateForward().

FYI the std::function may hold a lambda, std::bind, pointer to func, or ptr to member function, per modern C++. It is used primarily for searching, but not limited to that. It can also collect or modify the scanned objects. 'Capturing' lambdas are particularly convenient because they can use context and this often means aTestData is not used.

Parameters
aItemAn EDA_ITEM to examine.
aTestDatais arbitrary data needed by the inspector to determine if the EDA_ITEM under test meets its match criteria, and is often NULL with the advent of capturing lambdas.
Returns
A SEARCH_RESULT type SEARCH_QUIT if the iterator function is to stop the scan, else SEARCH_CONTINUE;

Definition at line 77 of file base_struct.h.

◆ STATUS_FLAGS

typedef unsigned STATUS_FLAGS

Definition at line 147 of file base_struct.h.

Enumeration Type Documentation

◆ FILL_T

enum FILL_T

Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.

Enumerator
NO_FILL 
FILLED_SHAPE 
FILLED_WITH_BG_BODYCOLOR 

Definition at line 54 of file base_struct.h.

54  {
55  NO_FILL, // Poly, Square, Circle, Arc = option No Fill
56  FILLED_SHAPE, /* Poly, Square, Circle, Arc = option Fill
57  * with current color ("Solid shape") */
58  FILLED_WITH_BG_BODYCOLOR /* Poly, Square, Circle, Arc = option Fill
59  * with background body color, translucent
60  * (texts inside this shape can be seen)
61  * not filled in B&W mode when plotting or
62  * printing */
63 };

◆ SEARCH_RESULT

Enumerator
SEARCH_QUIT 
SEARCH_CONTINUE 

Definition at line 66 of file base_struct.h.

Function Documentation

◆ new_clone()

EDA_ITEM* new_clone ( const EDA_ITEM aItem)
inline

Function new_clone provides cloning capabilities for all Boost pointer containers of EDA_ITEM pointers.

Parameters
aItemEDA_ITEM to clone.
Returns
Clone of aItem.

Definition at line 541 of file base_struct.h.

541 { return aItem.Clone(); }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.

References EDA_ITEM::Clone().