diff --git a/src/draw.c b/src/draw.c index 32cf2937..fdadab2c 100644 --- a/src/draw.c +++ b/src/draw.c @@ -545,7 +545,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, { RECTORDER(x1,y1,x2,y2); drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, rect->dash); - filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); + if(rect->fill) filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); } } } @@ -3345,7 +3345,7 @@ void draw(void) #endif { drawrect(c, ADD, r->x1, r->y1, r->x2, r->y2, r->dash); - filledrect(c, ADD, r->x1, r->y1, r->x2, r->y2); + if(r->fill) filledrect(c, ADD, r->x1, r->y1, r->x2, r->y2); } } if(xctx->enable_layer[c]) for(i=0;iarcs[c];i++) { diff --git a/src/editprop.c b/src/editprop.c index 432c6c97..9a86ab14 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -529,7 +529,6 @@ void my_realloc(int id, void *ptr,size_t size) dbg(3, "\nmy_realloc(%d,): reallocating %p --> %p to %lu bytes\n", id, a, *(void **)ptr,(unsigned long) size); } - } char *my_free(int id, void *ptr) @@ -598,7 +597,7 @@ static void edit_rect_property(int x) { int i, c, n; int drw = 0; - const char *dash; + const char *dash, *fill; int preserve; char *oldprop=NULL; my_strdup(67, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); @@ -642,8 +641,13 @@ static void edit_rect_property(int x) xctx->rect[c][n].dash = (short)(d >= 0? d : 0); } else xctx->rect[c][n].dash = 0; + + fill = get_tok_value(xctx->rect[c][n].prop_ptr,"fill", 0); + if(!strcmp(fill, "false")) xctx->rect[c][n].fill = 0; + else xctx->rect[c][n].fill = 1; + if( (oldprop && xctx->rect[c][n].prop_ptr && strcmp(oldprop, xctx->rect[c][n].prop_ptr)) || - (!oldprop && xctx->rect[c][n].prop_ptr) ) { + (!oldprop && xctx->rect[c][n].prop_ptr) || (oldprop && !xctx->rect[c][n].prop_ptr)) { if(!drw) { bbox(START,0.0,0.0,0.0,0.0); drw = 1; @@ -761,7 +765,7 @@ static void edit_wire_property(void) double ov, y1, y2; ov = INT_BUS_WIDTH(xctx->lw) > cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE; if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; } - else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; } + else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; } bbox(ADD, xctx->wire[k].x1-ov, y1 , xctx->wire[k].x2+ov , y2 ); xctx->wire[k].bus=1; } else { diff --git a/src/paste.c b/src/paste.c index 3e11221d..5861c975 100644 --- a/src/paste.c +++ b/src/paste.c @@ -122,6 +122,10 @@ static void merge_box(FILE *fd) } else { ptr[i].dash = 0; } + if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"false") ) + ptr[i].fill =0; + else + ptr[i].fill =1; set_rect_flags(&xctx->rect[c][i]); /* set cached .flags bitmask from on attributes */ select_box(c,i, SELECTED, 1, 1); xctx->rects[c]++; diff --git a/src/psprint.c b/src/psprint.c index f4a8b2d1..5e69c19c 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -137,10 +137,10 @@ static void ps_xdrawpoint(int layer, double x1, double y1) } static void ps_xfillrectange(int layer, double x1, double y1, double x2, - double y2) + double y2, int fill) { fprintf(fd, "%g %g %g %g R\n", x1,y1,x2-x1,y2-y1); - if( (xctx->fill_type[layer] == 1) && xctx->fill_pattern) { + if(fill && (xctx->fill_type[layer] == 1) && xctx->fill_pattern) { fprintf(fd, "%g %g %g %g RF\n", x1,y1,x2-x1,y2-y1); /* fprintf(fd,"fill\n"); */ } @@ -187,7 +187,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in } -static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash) +static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash, int fill) { double x1,y1,x2,y2; double psdash; @@ -202,7 +202,7 @@ static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,doub if(dash) { fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash); } - ps_xfillrectange(gc, x1,y1,x2,y2); + ps_xfillrectange(gc, x1,y1,x2,y2, fill); if(dash) { fprintf(fd, "[] 0 setdash\n"); } @@ -605,7 +605,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, ROTATION(rot, flip, 0.0,0.0,rect.x1,rect.y1,x1,y1); ROTATION(rot, flip, 0.0,0.0,rect.x2,rect.y2,x2,y2); RECTORDER(x1,y1,x2,y2); - ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, rect.dash); + ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, rect.dash, rect.fill); } if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) || (xctx->sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) @@ -865,7 +865,7 @@ void create_ps(char **psfile, int what) { if(c != GRIDLAYER || !(xctx->rect[c][i].flags & 1) ) { ps_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1, - xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash); + xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash, xctx->rect[c][i].fill); } } for(i=0;iarcs[c];i++) diff --git a/src/save.c b/src/save.c index f8f50623..9a97c970 100644 --- a/src/save.c +++ b/src/save.c @@ -1776,6 +1776,10 @@ static void load_box(FILE *fd) ptr[i].prop_ptr=NULL; ptr[i].sel=0; load_ascii_string( &ptr[i].prop_ptr, fd); + if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"false") ) + ptr[i].fill =0; + else + ptr[i].fill =1; dash = get_tok_value(ptr[i].prop_ptr,"dash",0); if(strcmp(dash, "")) { int d = atoi(dash); @@ -3101,6 +3105,10 @@ int load_sym_def(const char *name, FILE *embed_fd) continue; } dbg(2, "l_s_d(): loaded rect: ptr=%lx\n", (unsigned long)bb[c]); + if( !strcmp(get_tok_value(bb[c][i].prop_ptr,"fill",0),"false") ) + bb[c][i].fill =0; + else + bb[c][i].fill =1; dash = get_tok_value(bb[c][i].prop_ptr,"dash", 0); if( strcmp(dash, "") ) { int d = atoi(dash); diff --git a/src/store.c b/src/store.c index b27d8d93..542391ce 100644 --- a/src/store.c +++ b/src/store.c @@ -316,6 +316,10 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, xctx->rect[rectc][n].dash = (char) (d >= 0 ? d : 0); } else xctx->rect[rectc][n].dash = 0; + if(!strcmp(get_tok_value(xctx->rect[rectc][n].prop_ptr,"fill",0),"false") ) + xctx->rect[rectc][n].fill =0; + else + xctx->rect[rectc][n].fill =1; set_rect_flags(&xctx->rect[rectc][n]); /* set cached .flags bitmask from on attributes */ if(rectc == GRIDLAYER && (xctx->rect[rectc][n].flags & 1024)) { xRect *r = &xctx->rect[GRIDLAYER][n]; diff --git a/src/svgdraw.c b/src/svgdraw.c index f852f605..7d07f897 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -56,11 +56,14 @@ static void svg_xdrawpoint(int layer, double x1, double y1) fprintf(fd,"M%g %gL%g %gL%g%gL%g %gL%g %gz\"/>\n", x1, y1, x1+1.0, y1, x1+1.0, y1+1.0, x1, y1+1.0, x1, y1); } -static void svg_xfillrectangle(int layer, double x1, double y1, double x2, double y2, int dash) +static void svg_xfillrectangle(int layer, double x1, double y1, double x2, double y2, int dash, int fill) { - fprintf(fd,"zoom, 1.4*dash/xctx->zoom); - fprintf(fd,"d=\"M%g %gL%g %gL%g %gL%g %gL%g %gz\"/>\n", x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); + fprintf(fd,"zoom, 1.4*dash/xctx->zoom); + if(!fill) { + fprintf(fd,"style=\"fill:none;\" "); + } + fprintf(fd,"d=\"M%g %gL%g %gL%g %gL%g %gL%g %gz\"/>\n", x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); } static void svg_drawpolygon(int c, int what, double *x, double *y, int points, int fill, int dash) @@ -92,7 +95,7 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points, i fprintf(fd, "\"/>\n"); } -static void svg_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash) +static void svg_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash, int fill) { double x1,y1,x2,y2; @@ -102,7 +105,7 @@ static void svg_filledrect(int gc, double rectx1,double recty1,double rectx2,dou y2=Y_TO_SVG(recty2); if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) { - svg_xfillrectangle(gc, x1,y1,x2,y2, dash); + svg_xfillrectangle(gc, x1,y1,x2,y2, dash, fill); } } @@ -525,7 +528,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot, svg_embedded_image(rect, xx1, yy1, xx2, yy2, rot, flip); } else { RECTORDER(x1,y1,x2,y2); - svg_filledrect(c, x0+x1, y0+y1, x0+x2, y0+y2, rect->dash); + svg_filledrect(c, x0+x1, y0+y1, x0+x2, y0+y2, rect->dash, rect->fill); } } if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) || @@ -816,7 +819,8 @@ void svg_draw(void) svg_embedded_image(r, r->x1, r->y1, r->x2, r->y2, 0, 0); } else { svg_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1, - xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash); + xctx->rect[c][i].x2, xctx->rect[c][i].y2, + xctx->rect[c][i].dash, xctx->rect[c][i].fill); } } for(i=0;iarcs[c];i++) diff --git a/src/xschem.h b/src/xschem.h index c7deaee3..21c52684 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -419,6 +419,7 @@ typedef struct unsigned short sel; char *prop_ptr; void *extraptr; /* generic data pointer (images) */ + short fill; short dash; /* bit0=1 for graph function, bit1=1 for unlocked x axis * bit10: image embedding (png)