typedef struct
{
unsigned short type;
int n;
unsigned int col;
} Selected;
The 'Selected' struct array tells what are the selected objects.
A line in xschem is identified as xctx->line[col][n]
the same for arcs, polygons, rectangles:
xctx->arc[col][n]
xctx->poly[col][n]
xctx->rect[col][n]
col identifies tha layer the object is drawn to (col-or). Layers
have own colors and fill styles.
'n' identifies the position in the object array (n-umber). the
first rectangle on layer 4 will be xctx->rect[4][0].
Instances are not layered (there is no 'color' for an instance).
So an instance is identified as xctx->inst[n].
Same for wires and texts.
xctx->wire[n]
xctx->text[n]
For these 'unlayered' objects the col field in the Selected
struct is not used.
The 'type' field in the Selected struct tells the type of the
selected object:
#define WIRE 1 /* types of defined objects */
#define xRECT 2
#define LINE 4
#define ELEMENT 8
#define xTEXT 16
#define POLYGON 32
#define ARC 64
The Selected array (Selected *sel_array) is built when we need to
iterate quickly over selected items. Since selected items may be
sparse and we do not want to iterate over all object arrays
multiple times this sel_array is built when needed
(rebuild_selected_array()).
One of the usages of sel_array is when drawing in grey selected
objects. This needs to be done many times when the screen needs
to be repainted.
No comments:
Post a Comment