From 3107c5b12a3b94b6710822c82f63ed8c7f447d6a Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Wed, 2 Sep 2020 18:28:20 +0200 Subject: [PATCH] added "dash=n" (n=integer) attribute for lines, polygons, rectangles to set dashed line style. n is the dash length in pixels. --- src/actions.c | 24 +++---- src/draw.c | 86 ++++++++++++++++------- src/editprop.c | 83 ++++++++++++++++++---- src/hilight.c | 16 ++--- src/move.c | 36 +++++----- src/save.c | 49 ++++++++++++- src/scheduler.c | 6 +- src/store.c | 19 ++++- src/xinit.c | 1 + src/xschem.h | 9 ++- xschem_library/examples/LCC_instances.sch | 3 +- xschem_library/examples/bus_keeper.sch | 2 +- xschem_library/examples/cmos_inv.sch | 2 +- 13 files changed, 246 insertions(+), 90 deletions(-) diff --git a/src/actions.c b/src/actions.c index 11974f03..1a03c18e 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1619,32 +1619,32 @@ void new_wire(int what, double mx_snap, double my_snap) xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx2,yy1); storeobject(-1, xx1,yy1,xx2,yy1,WIRE,0,0,NULL); - drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy1); + drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy1, 0); } if(yy2!=yy1) { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx2,yy1,xx2,yy2); storeobject(-1, xx2,yy1,xx2,yy2,WIRE,0,0,NULL); - drawline(WIRELAYER,NOW, xx2,yy1,xx2,yy2); + drawline(WIRELAYER,NOW, xx2,yy1,xx2,yy2, 0); } } else if(manhattan_lines==2) { if(yy2!=yy1) { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx1,yy2); storeobject(-1, xx1,yy1,xx1,yy2,WIRE,0,0,NULL); - drawline(WIRELAYER,NOW, xx1,yy1,xx1,yy2); + drawline(WIRELAYER,NOW, xx1,yy1,xx1,yy2, 0); } if(xx2!=xx1) { xx1=x1;yy1=y1;xx2=x2;yy2=y2; ORDER(xx1,yy2,xx2,yy2); storeobject(-1, xx1,yy2,xx2,yy2,WIRE,0,0,NULL); - drawline(WIRELAYER,NOW, xx1,yy2,xx2,yy2); + drawline(WIRELAYER,NOW, xx1,yy2,xx2,yy2, 0); } } else { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx2,yy2); storeobject(-1, xx1,yy1,xx2,yy2,WIRE,0,0,NULL); - drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy2); + drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy2, 0); } if(event_reporting) { printf("xschem wire %g %g %g %g %d\n", xx1, yy1, xx2, yy2, -1); @@ -1851,32 +1851,32 @@ void new_line(int what) xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx2,yy1); storeobject(-1, xx1,yy1,xx2,yy1,LINE,rectcolor,0,NULL); - drawline(rectcolor,NOW, xx1,yy1,xx2,yy1); + drawline(rectcolor,NOW, xx1,yy1,xx2,yy1, 0); } if(yy2!=yy1) { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx2,yy1,xx2,yy2); storeobject(-1, xx2,yy1,xx2,yy2,LINE,rectcolor,0,NULL); - drawline(rectcolor,NOW, xx2,yy1,xx2,yy2); + drawline(rectcolor,NOW, xx2,yy1,xx2,yy2, 0); } } else if(manhattan_lines==2) { if(yy2!=yy1) { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx1,yy2); storeobject(-1, xx1,yy1,xx1,yy2,LINE,rectcolor,0,NULL); - drawline(rectcolor,NOW, xx1,yy1,xx1,yy2); + drawline(rectcolor,NOW, xx1,yy1,xx1,yy2, 0); } if(xx2!=xx1) { xx1=x1;yy1=y1;xx2=x2;yy2=y2; ORDER(xx1,yy2,xx2,yy2); storeobject(-1, xx1,yy2,xx2,yy2,LINE,rectcolor,0,NULL); - drawline(rectcolor,NOW, xx1,yy2,xx2,yy2); + drawline(rectcolor,NOW, xx1,yy2,xx2,yy2, 0); } } else { xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; ORDER(xx1,yy1,xx2,yy2); storeobject(-1, xx1,yy1,xx2,yy2,LINE,rectcolor,0,NULL); - drawline(rectcolor,NOW, xx1,yy1,xx2,yy2); + drawline(rectcolor,NOW, xx1,yy1,xx2,yy2, 0); } } x1=x2=mousex_snap;y1=y2=mousey_snap; @@ -1950,7 +1950,7 @@ void new_rect(int what) int save_draw; RECTORDER(x1,y1,x2,y2); push_undo(); - drawrect(rectcolor, NOW, x1,y1,x2,y2); + drawrect(rectcolor, NOW, x1,y1,x2,y2, 0); save_draw = draw_window; draw_window = 1; /* 20181009 */ filledrect(rectcolor, NOW, x1,y1,x2,y2); /* draw fill pattern even in XCopyArea mode */ @@ -2030,7 +2030,7 @@ void new_polygon(int what) /* 20171115 */ /* fprintf(errfp, "new_poly: finish: points=%d\n", points); */ drawtemppolygon(gc[rectcolor], NOW, x, y, points); ui_state &= ~STARTPOLYGON; - drawpolygon(rectcolor, NOW, x, y, points, 0); /* 20180914 added fill param */ + drawpolygon(rectcolor, NOW, x, y, points, 0, 0); my_free(711, &x); my_free(712, &y); maxpoints = points = 0; diff --git a/src/draw.c b/src/draw.c index bf84c927..38cefe10 100644 --- a/src/draw.c +++ b/src/draw.c @@ -425,7 +425,7 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc ROTATION(x1,y1,curr_x1,curr_y1,rx1,ry1); ROTATION(x1,y1,curr_x2,curr_y2,rx2,ry2); ORDER(rx1,ry1,rx2,ry2); - drawline(layer, what, rx1, ry1, rx2, ry2); + drawline(layer, what, rx1, ry1, rx2, ry2, 0); } pos++; a += FONTWIDTH+FONTWHITESPACE; @@ -504,7 +504,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, ROTATION(0.0,0.0,line.x1,line.y1,x1,y1); ROTATION(0.0,0.0,line.x2,line.y2,x2,y2); ORDER(x1,y1,x2,y2); - drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2); + drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); } for(j=0;j< symptr->polygons[layer];j++) /* 20171115 */ { @@ -518,7 +518,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, x[k]+= x0; y[k] += y0; } - drawpolygon(c, NOW, x, y, polygon.points, polygon.fill); /* 20180914 added fill */ + drawpolygon(c, NOW, x, y, polygon.points, polygon.fill, polygon.dash); /* 20180914 added fill */ my_free(718, &x); my_free(719, &y); } @@ -544,7 +544,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, ROTATION(0.0,0.0,box.x1,box.y1,x1,y1); ROTATION(0.0,0.0,box.x2,box.y2,x2,y2); RECTORDER(x1,y1,x2,y2); - drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); + drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, box.dash); filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); } if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) || @@ -578,8 +578,8 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, text.xscale, text.yscale); #ifndef HAS_CAIRO - drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0); - drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0); + drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); #endif #ifdef HAS_CAIRO if(textfont && textfont[0]) { @@ -758,7 +758,7 @@ void drawgrid() } -void drawline(int c, int what, double linex1, double liney1, double linex2, double liney2) +void drawline(int c, int what, double linex1, double liney1, double linex2, double liney2, int dash) { static int i = 0; #ifndef __unix__ @@ -767,6 +767,9 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub static XSegment r[CADDRAWBUFFERSIZE]; double x1,y1,x2,y2; register XSegment *rr; + char dash_arr[2]; + + if(dash) what = NOW; if(!has_x) return; rr=r; @@ -811,9 +814,17 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub if(!only_probes && (x2-x1)< 0.3 && fabs(y2-y1)< 0.3) return; /* 20171206 */ if( clip(&x1,&y1,&x2,&y2) ) { + if(dash) { + dash_arr[0] = dash_arr[1] = dash; + XSetDashes(display, gc[c], 0, dash_arr, 2); + XSetLineAttributes (display, gc[c], lw ,LineDoubleDash, CapRound , JoinRound); + } if(draw_window) XDrawLine(display, window, gc[c], x1, y1, x2, y2); if(draw_pixmap) XDrawLine(display, save_pixmap, gc[c], x1, y1, x2, y2); + if(dash) { + XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound); + } } } @@ -826,7 +837,13 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub if(!only_probes && (x2-x1)< 0.3 && fabs(y2-y1)< 0.3) return; /* 20171206 */ if( clip(&x1,&y1,&x2,&y2) ) { - XSetLineAttributes (display, gc[c], bus_width , LineSolid, CapRound , JoinRound); + if(dash) { + dash_arr[0] = dash_arr[1] = dash; + XSetDashes(display, gc[c], 0, dash_arr, 2); + XSetLineAttributes (display, gc[c], bus_width ,LineDoubleDash, CapRound , JoinRound); + } else { + XSetLineAttributes (display, gc[c], bus_width , LineSolid, CapRound , JoinRound); + } if(draw_window) XDrawLine(display, window, gc[c], x1, y1, x2, y2); if(draw_pixmap) XDrawLine(display, save_pixmap, gc[c], x1, y1, x2, y2); XSetLineAttributes (display, gc[c], lw, LineSolid, CapRound , JoinRound); @@ -908,10 +925,7 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou XSetLineAttributes (display, gc, bus_width, LineSolid, CapRound , JoinRound); /* 20150410 */ XDrawLine(display, window, gc, x1, y1, x2, y2); - if(gc==gctiled) - XSetLineAttributes (display, gc, lw, LineSolid, CapRound , JoinRound); - else - XSetLineAttributes (display, gc, lw, LineSolid, CapRound , JoinRound); + XSetLineAttributes (display, gc, lw, LineSolid, CapRound , JoinRound); } } @@ -1299,7 +1313,7 @@ void arc_bbox(double x, double y, double r, double a, double b, /* Convex Nonconvex Complex */ #define Polygontype Nonconvex /* 20180914 added fill param */ -void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill) +void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash) { double x1,y1,x2,y2; XPoint *p; @@ -1321,6 +1335,12 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil p[i].x = X_TO_SCREEN(x[i]); p[i].y = Y_TO_SCREEN(y[i]); } + if(dash) { + char dash_arr[2]; + dash_arr[0] = dash_arr[1] = dash; + XSetDashes(display, gc[c], 0, dash_arr, 2); + XSetLineAttributes (display, gc[c], lw ,LineDoubleDash, CapRound , JoinRound); + } if(draw_window) XDrawLines(display, window, gc[c], p, points, CoordModeOrigin); if(draw_pixmap) XDrawLines(display, save_pixmap, gc[c], p, points, CoordModeOrigin); @@ -1331,6 +1351,10 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil XFillPolygon(display, save_pixmap, gcstipple[c], p, points, Polygontype, CoordModeOrigin); } } + if(dash) { + XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound); + } + my_free(722, &p); } @@ -1356,13 +1380,15 @@ void drawtemppolygon(GC g, int what, double *x, double *y, int points) my_free(723, &p); } -void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2) +void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int dash) { static int i=0; static XRectangle r[CADDRAWBUFFERSIZE]; double x1,y1,x2,y2; + char dash_arr[2]; if(!has_x) return; + if(dash) what = NOW; if(what & NOW) { x1=X_TO_SCREEN(rectx1); @@ -1372,6 +1398,11 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) return; /* 20171206 */ if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) { + if(dash) { + dash_arr[0] = dash_arr[1] = dash; + XSetDashes(display, gc[c], 0, dash_arr, 2); + XSetLineAttributes (display, gc[c], lw ,LineDoubleDash, CapRound , JoinRound); + } if(draw_window) XDrawRectangle(display, window, gc[c], (int)x1, (int)y1, (unsigned int)x2 - (unsigned int)x1, (unsigned int)y2 - (unsigned int)y1); @@ -1381,6 +1412,9 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double (unsigned int)x2 - (unsigned int)x1, (unsigned int)y2 - (unsigned int)y1); } + if(dash) { + XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound); + } } } else if(what & BEGIN) i=0; @@ -1508,10 +1542,10 @@ void draw(void) if(draw_single_layer!=-1 && c != draw_single_layer) continue; /* 20151117 */ for(i=0;in; if(wire[ii].bus) { - drawline(WIRELAYER, THICK, wire[ii].x1,wire[ii].y1,wire[ii].x2,wire[ii].y2); + drawline(WIRELAYER, THICK, wire[ii].x1,wire[ii].y1,wire[ii].x2,wire[ii].y2, 0); } else - drawline(WIRELAYER, ADD, wire[ii].x1,wire[ii].y1,wire[ii].x2,wire[ii].y2); + drawline(WIRELAYER, ADD, wire[ii].x1,wire[ii].y1,wire[ii].x2,wire[ii].y2, 0); } } else { for(i=0;i y2) y2 = polygon[c][i].y[k]; } bbox(ADD, x1, y1, x2, y2); - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - draw(); - bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } } + if(drw) { + bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); + draw(); + bbox(END , 0.0 , 0.0 , 0.0 , 0.0); + } } } diff --git a/src/hilight.c b/src/hilight.c index 318f8965..526d04d5 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -516,10 +516,10 @@ int search(const char *tok, const char *val, int sub, int sel, int what) if(what == NOW) { if(wire[i].bus) /* 20171201 */ drawline(hilight_layer, THICK, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); else drawline(hilight_layer, NOW, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); if(cadhalfdotsize*mooz>=0.7) { if( wire[i].end1 >1 ) { filledarc(hilight_layer, NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); @@ -852,10 +852,10 @@ void draw_hilight_net(int on_window) if( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) { if(wire[i].bus) /* 20171201 */ drawline(get_color(entry->value), THICK, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); else drawline(get_color(entry->value), NOW, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); if(cadhalfdotsize*mooz>=0.7) { if( wire[i].end1 >1 ) { /* 20150331 draw_dots */ filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); @@ -870,10 +870,10 @@ void draw_hilight_net(int on_window) if( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) { if(wire[i].bus) /* 20171201 */ drawline(get_color(entry->value), THICK, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); else drawline(get_color(entry->value), NOW, - wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); + wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0); if(cadhalfdotsize*mooz>=0.7) { if( wire[i].end1 >1 ) { /* 20150331 draw_dots */ filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); @@ -955,8 +955,8 @@ void draw_hilight_net(int on_window) } filledrect(inst_color[i], END, 0.0, 0.0, 0.0, 0.0); drawarc(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0.0, 0); - drawrect(inst_color[i], END, 0.0, 0.0, 0.0, 0.0); - drawline(inst_color[i], END, 0.0, 0.0, 0.0, 0.0); + drawrect(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0); } } } diff --git a/src/move.c b/src/move.c index a908714e..566b980e 100644 --- a/src/move.c +++ b/src/move.c @@ -561,9 +561,9 @@ void copy_objects(int what) else if(wire[n].sel == SELECTED2) wire[n].sel = SELECTED1; } if(wire[n].bus) /* 20171201 */ - drawline(k, THICK, rx1,ry1,rx2,ry2); + drawline(k, THICK, rx1,ry1,rx2,ry2, 0); else - drawline(k, ADD, rx1,ry1,rx2,ry2); + drawline(k, ADD, rx1,ry1,rx2,ry2, 0); selectedgroup[i].n=lastwire; storeobject(-1, rx1,ry1,rx2,ry2,WIRE,0,wire[n].sel,wire[n].prop_ptr); @@ -597,7 +597,7 @@ void copy_objects(int what) if(line[c][n].sel == SELECTED1) line[c][n].sel = SELECTED2; else if(line[c][n].sel == SELECTED2) line[c][n].sel = SELECTED1; } - drawline(k, ADD, rx1,ry1,rx2,ry2); + drawline(k, ADD, rx1,ry1,rx2,ry2, line[c][n].dash); selectedgroup[i].n=lastline[c]; storeobject(-1, rx1, ry1, rx2, ry2, LINE, c, line[c][n].sel, line[c][n].prop_ptr); line[c][n].sel=0; @@ -629,7 +629,7 @@ void copy_objects(int what) } bbox(ADD, bx1, by1, bx2, by2); /* 20181009 */ } - drawpolygon(k, NOW, x, y, polygon[c][n].points, polygon[c][n].fill); /* 20180914 added fill */ + drawpolygon(k, NOW, x, y, polygon[c][n].points, polygon[c][n].fill, polygon[c][n].dash); /* 20180914 added fill */ selectedgroup[i].n=lastpolygon[c]; store_polygon(-1, x, y, polygon[c][n].points, c, polygon[c][n].sel, polygon[c][n].prop_ptr); polygon[c][n].sel=0; @@ -680,7 +680,7 @@ void copy_objects(int what) } RECTORDER(rx1,ry1,rx2,ry2); rect[c][n].sel=0; - drawrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay); + drawrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay, rect[c][n].dash); filledrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay); selectedgroup[i].n=lastrect[c]; storeobject(-1, rx1+deltax, ry1+deltay, @@ -753,8 +753,8 @@ void copy_objects(int what) rx1+deltax,ry1+deltay, textelement[lasttext].xscale, textelement[lasttext].yscale); #ifndef HAS_CAIRO - drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0); - drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0); + drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); #endif #ifdef HAS_CAIRO if(textfont && textfont[0]) { @@ -814,8 +814,8 @@ void copy_objects(int what) } filledrect(k, END, 0.0, 0.0, 0.0, 0.0); drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0); - drawrect(k, END, 0.0, 0.0, 0.0, 0.0); - drawline(k, END, 0.0, 0.0, 0.0, 0.0); + drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0); } /* end for(k ... */ check_collapsing_objects(); @@ -973,9 +973,9 @@ void move_objects(int what, int merge, double dx, double dy) wire[n].x2=rx2; wire[n].y2=ry2; if(wire[n].bus) /* 20171201 */ - drawline(k, THICK, wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2); + drawline(k, THICK, wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, 0); else - drawline(k, ADD, wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2); + drawline(k, ADD, wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, 0); break; case LINE: if(c!=k) break; @@ -1010,7 +1010,7 @@ void move_objects(int what, int merge, double dx, double dy) line[c][n].y1=ry1; line[c][n].x2=rx2; line[c][n].y2=ry2; - drawline(k, ADD, line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2); + drawline(k, ADD, line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2, line[c][n].dash); break; case POLYGON: /* 20171115 */ @@ -1042,7 +1042,7 @@ void move_objects(int what, int merge, double dx, double dy) bbox(ADD, bx1, by1, bx2, by2); } /* 20180914 added fill */ - drawpolygon(k, NOW, polygon[c][n].x, polygon[c][n].y, polygon[c][n].points, polygon[c][n].fill); + drawpolygon(k, NOW, polygon[c][n].x, polygon[c][n].y, polygon[c][n].points, polygon[c][n].fill, polygon[c][n].dash); break; case ARC: @@ -1169,7 +1169,7 @@ void move_objects(int what, int merge, double dx, double dy) rect[c][n].y1 = ry1; rect[c][n].x2 = rx2; rect[c][n].y2 = ry2; - drawrect(k, ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2); + drawrect(k, ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2, rect[c][n].dash); filledrect(c, ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2); @@ -1217,8 +1217,8 @@ void move_objects(int what, int merge, double dx, double dy) textelement[n].x0, textelement[n].y0, textelement[n].xscale, textelement[n].yscale); #ifndef HAS_CAIRO - drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0); - drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0); + drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0); #endif #ifdef HAS_CAIRO if(textfont && textfont[0]) { @@ -1257,8 +1257,8 @@ void move_objects(int what, int merge, double dx, double dy) filledrect(k, END, 0.0, 0.0, 0.0, 0.0); drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0); - drawrect(k, END, 0.0, 0.0, 0.0, 0.0); - drawline(k, END, 0.0, 0.0, 0.0, 0.0); + drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0); + drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0); } /*end for(k ... */ check_collapsing_objects(); update_conn_cues(1, 1); diff --git a/src/save.c b/src/save.c index 27d05fe2..5ef6ff0c 100644 --- a/src/save.c +++ b/src/save.c @@ -552,6 +552,7 @@ static void load_polygon(FILE *fd) { int i,c, j, points; xPolygon *ptr; + const char *dash; dbg(3, "load_polygon(): start\n"); if(fscanf(fd, "%d %d",&c, &points)<2) { @@ -592,6 +593,12 @@ static void load_polygon(FILE *fd) ptr[i].fill =1; else ptr[i].fill =0; + dash = get_tok_value(ptr[i].prop_ptr,"dash",0); + if(strcmp(dash, "")) { + ptr[i].dash = atoi(dash); + } else { + ptr[i].dash = 0; + } lastpolygon[c]++; } @@ -631,6 +638,7 @@ static void load_box(FILE *fd) { int i,c; Box *ptr; + const char *dash; dbg(3, "load_box(): start\n"); fscanf(fd, "%d",&c); @@ -652,6 +660,12 @@ static void load_box(FILE *fd) ptr[i].prop_ptr=NULL; ptr[i].sel=0; load_ascii_string( &ptr[i].prop_ptr, fd); + dash = get_tok_value(ptr[i].prop_ptr,"dash",0); + if(strcmp(dash, "")) { + ptr[i].dash = atoi(dash); + } else { + ptr[i].dash = 0; + } lastrect[c]++; } @@ -659,6 +673,7 @@ static void load_line(FILE *fd) { int i,c; Line *ptr; + const char *dash; dbg(3, "load_line(): start\n"); fscanf(fd, "%d",&c); @@ -680,6 +695,12 @@ static void load_line(FILE *fd) ptr[i].prop_ptr=NULL; ptr[i].sel=0; load_ascii_string( &ptr[i].prop_ptr, fd); + dash = get_tok_value(ptr[i].prop_ptr,"dash",0); + if(strcmp(dash, "")) { + ptr[i].dash = atoi(dash); + } else { + ptr[i].dash = 0; + } lastline[c]++; } @@ -1241,6 +1262,7 @@ int load_sym_def(const char *name, FILE *embed_fd) const char *label; char *pin_label = NULL, *recover_str=NULL; char *skip_line; + const char *dash; dbg(1, "load_sym_def(): recursion_counter=%d\n", recursion_counter); recursion_counter++; @@ -1365,7 +1387,14 @@ int load_sym_def(const char *name, FILE *embed_fd) ORDER(ll[c][i].x1, ll[c][i].y1, ll[c][i].x2, ll[c][i].y2); /* 20180108 */ ll[c][i].prop_ptr=NULL; load_ascii_string( &ll[c][i].prop_ptr, lcc[level].fd); - dbg(2, "l_d_s(): loaded line: ptr=%lx\n", (unsigned long)ll[c]); + dbg(2, "l_d_s(): loaded line: ptr=%lx\n", (unsigned long)ll[c]); + + dash = get_tok_value(ll[c][i].prop_ptr,"dash", 0); + if( strcmp(dash, "") ) + ll[c][i].dash = atoi(dash); + else + ll[c][i].dash = 0; + ll[c][i].sel = 0; lastl[c]++; break; case 'P': /* 20171115 */ @@ -1403,6 +1432,13 @@ int load_sym_def(const char *name, FILE *embed_fd) else pp[c][i].fill =0; + dash = get_tok_value(pp[c][i].prop_ptr,"dash", 0); + if( strcmp(dash, "") ) + pp[c][i].dash = atoi(dash); + else + pp[c][i].dash = 0; + pp[c][i].sel = 0; + dbg(2, "l_d_s(): loaded polygon: ptr=%lx\n", (unsigned long)pp[c]); lastp[c]++; break; @@ -1468,6 +1504,13 @@ int load_sym_def(const char *name, FILE *embed_fd) bb[c][i].prop_ptr=NULL; load_ascii_string( &bb[c][i].prop_ptr, lcc[level].fd); dbg(2, "l_d_s(): loaded rect: ptr=%lx\n", (unsigned long)bb[c]); + dash = get_tok_value(bb[c][i].prop_ptr,"dash", 0); + if( strcmp(dash, "") ) + bb[c][i].dash = atoi(dash); + else + bb[c][i].dash = 0; + bb[c][i].sel = 0; + lastr[c]++; break; case 'T': @@ -1521,7 +1564,9 @@ int load_sym_def(const char *name, FILE *embed_fd) ORDER(ll[WIRELAYER][i].x1, ll[WIRELAYER][i].y1, ll[WIRELAYER][i].x2, ll[WIRELAYER][i].y2); /* 20180108 */ ll[WIRELAYER][i].prop_ptr=NULL; load_ascii_string( &ll[WIRELAYER][i].prop_ptr, lcc[level].fd); - dbg(2, "l_d_s(): loaded line: ptr=%lx\n", (unsigned long)ll[WIRELAYER]); + dbg(2, "l_d_s(): loaded line: ptr=%lx\n", (unsigned long)ll[WIRELAYER]); + ll[WIRELAYER][i].dash = 0; + ll[WIRELAYER][i].sel = 0; lastl[WIRELAYER]++; break; case 'C': diff --git a/src/scheduler.c b/src/scheduler.c index a4981c15..7ddc6c94 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -840,7 +840,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg push_undo(); storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop); save = draw_window; draw_window = 1; - drawline(WIRELAYER,NOW, x1,y1,x2,y2); + drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0); draw_window = save; } else ui_state |= MENUSTARTWIRE; @@ -857,7 +857,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc==7) pos=atol(argv[6]); storeobject(pos, x1,y1,x2,y2,LINE,rectcolor,0,NULL); save = draw_window; draw_window = 1; - drawline(rectcolor,NOW, x1,y1,x2,y2); + drawline(rectcolor,NOW, x1,y1,x2,y2, 0); draw_window = save; } else ui_state |= MENUSTARTLINE; @@ -874,7 +874,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc==7) pos=atol(argv[6]); storeobject(pos, x1,y1,x2,y2,xRECT,rectcolor,0,NULL); save = draw_window; draw_window = 1; - drawrect(rectcolor,NOW, x1,y1,x2,y2); + drawrect(rectcolor,NOW, x1,y1,x2,y2, 0); draw_window = save; } else ui_state |= MENUSTARTRECT; diff --git a/src/store.c b/src/store.c index 1c569e96..988ece87 100644 --- a/src/store.c +++ b/src/store.c @@ -180,6 +180,7 @@ void store_arc(int pos, double x, double y, double r, double a, double b, void store_polygon(int pos, double *x, double *y, int points, unsigned int rectcolor, unsigned short sel, char *prop_ptr) { int n, j; + const char *dash; check_polygon_storage(rectcolor); if(pos==-1) n=lastpolygon[rectcolor]; else @@ -212,6 +213,11 @@ void store_polygon(int pos, double *x, double *y, int points, unsigned int rectc polygon[rectcolor][n].fill =1; else polygon[rectcolor][n].fill =0; + dash = get_tok_value(polygon[rectcolor][n].prop_ptr,"dash",0); + if( strcmp(dash, "") ) + polygon[rectcolor][n].dash = atoi(dash); + else + polygon[rectcolor][n].dash = 0; lastpolygon[rectcolor]++; @@ -223,6 +229,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; if(type == LINE) { check_line_storage(rectcolor); @@ -244,6 +251,11 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, line[rectcolor][n].prop_ptr=NULL; my_strdup(412, &line[rectcolor][n].prop_ptr, prop_ptr); line[rectcolor][n].sel=sel; + dash = get_tok_value(line[rectcolor][n].prop_ptr,"dash",0); + if( strcmp(dash, "") ) + line[rectcolor][n].dash = atoi(dash); + else + line[rectcolor][n].dash = 0; lastline[rectcolor]++; set_modify(1); } @@ -259,7 +271,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, } n=pos; } - dbg(2, "storeobject(): storing LINE %d\n",n); + dbg(2, "storeobject(): storing RECT %d\n",n); rect[rectcolor][n].x1=x1; rect[rectcolor][n].x2=x2; rect[rectcolor][n].y1=y1; @@ -267,6 +279,11 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, rect[rectcolor][n].prop_ptr=NULL; my_strdup(413, &rect[rectcolor][n].prop_ptr, prop_ptr); rect[rectcolor][n].sel=sel; + dash = get_tok_value(rect[rectcolor][n].prop_ptr,"dash",0); + if( strcmp(dash, "") ) + rect[rectcolor][n].dash = atoi(dash); + else + rect[rectcolor][n].dash = 0; lastrect[rectcolor]++; set_modify(1); } diff --git a/src/xinit.c b/src/xinit.c index 6e2f9bb1..ba2c3600 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -696,6 +696,7 @@ int build_colors(double dim) /* 20171113 */ } for(i=0;i