add flags member field in xRect struct for future additions

This commit is contained in:
Stefan Frederik 2021-12-19 20:53:52 +01:00
parent 5c0437a443
commit 61e9c0e4e3
4 changed files with 26 additions and 7 deletions

View File

@ -397,14 +397,14 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
}
else if(!xctx->only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
(xctx->inst[n].y2 - xctx->inst[n].y1) * xctx->mooz < 3) {
drawrect(4, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 0);
drawrect(SYMLAYER, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 0);
xctx->inst[n].flags|=1;
return;
}
else {
xctx->inst[n].flags&=~1;
}
if(hide) drawrect(4, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 2);
if(hide) drawrect(SYMLAYER, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 2);
} else if(xctx->inst[n].flags&1) {
dbg(2, "draw_symbol(): skipping inst %d\n", n);
return;
@ -1323,7 +1323,8 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
XDrawLines(display, xctx->save_pixmap, xctx->gc[c], p, points, CoordModeOrigin);
if(xctx->fill_pattern && xctx->fill_type[c]){
if(poly_fill && (x[0] == x[points-1]) && (y[0] == y[points-1])) {
if(xctx->draw_window) XFillPolygon(display, xctx->window, xctx->gcstipple[c], p, points, Polygontype, CoordModeOrigin);
if(xctx->draw_window)
XFillPolygon(display, xctx->window, xctx->gcstipple[c], p, points, Polygontype, CoordModeOrigin);
if(xctx->draw_pixmap)
XFillPolygon(display, xctx->save_pixmap, xctx->gcstipple[c], p, points, Polygontype, CoordModeOrigin);
}
@ -1331,7 +1332,6 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
if(dash) {
XSetLineAttributes (display, xctx->gc[c], INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
}
my_free(722, &p);
}

View File

@ -394,8 +394,9 @@ void set_inst_prop(int i)
void edit_rect_property(void)
{
int i, c, n, old_dash;
unsigned short old_flags;
int drw = 0;
const char *dash;
const char *dash, *flags;
int preserve;
char *oldprop=NULL;
if(xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr!=NULL) {
@ -422,6 +423,15 @@ void edit_rect_property(void)
my_strdup(99, &xctx->rect[c][n].prop_ptr,
(char *) tclgetvar("retval"));
}
old_flags = xctx->rect[c][n].flags;
flags = get_tok_value(xctx->rect[c][n].prop_ptr,"flags",0);
if( strcmp(flags, "") ) {
int d = atoi(flags);
xctx->rect[c][n].flags = d >= 0? d : 0;
} else
xctx->rect[c][n].flags = 0;
old_dash = xctx->rect[c][n].dash;
dash = get_tok_value(xctx->rect[c][n].prop_ptr,"dash",0);
if( strcmp(dash, "") ) {
@ -429,7 +439,7 @@ void edit_rect_property(void)
xctx->rect[c][n].dash = d >= 0? d : 0;
} else
xctx->rect[c][n].dash = 0;
if(old_dash != xctx->rect[c][n].dash) {
if(old_dash != xctx->rect[c][n].dash || old_flags != xctx->rect[c][n].flags) {
if(!drw) {
bbox(START,0.0,0.0,0.0,0.0);
drw = 1;

View File

@ -239,7 +239,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
unsigned short sel, const char *prop_ptr)
{
int n, j;
const char * dash;
const char *dash, *flags;
if(type == LINE)
{
check_line_storage(rectc);
@ -298,6 +298,13 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
xctx->rect[rectc][n].dash = d >= 0 ? d : 0;
} else
xctx->rect[rectc][n].dash = 0;
if(prop_ptr && (flags = get_tok_value(prop_ptr,"flags",0))[0]) {
int d = atoi(flags);
xctx->rect[rectc][n].flags = d >= 0 ? d : 0;
} else
xctx->rect[rectc][n].flags = 0;
xctx->rects[rectc]++;
set_modify(1);
}

View File

@ -132,6 +132,7 @@ extern char win_temp_dir[PATH_MAX];
#define PROPERTYLAYER 1
#define TEXTLAYER 3
#define TEXTWIRELAYER 1 /* color for wire name labels / pins */
#define SYMLAYER 4
#define PINLAYER 5
#define GENERICLAYER 3
@ -371,6 +372,7 @@ typedef struct
unsigned short sel;
char *prop_ptr;
short dash;
unsigned short flags;
} xRect;
typedef struct