added "dash=n" (n=integer) attribute for lines, polygons, rectangles to set dashed line style. n is the dash length in pixels.

This commit is contained in:
Stefan Schippers 2020-09-02 18:28:20 +02:00
parent 331155b6f9
commit 3107c5b12a
13 changed files with 246 additions and 90 deletions

View File

@ -1619,32 +1619,32 @@ void new_wire(int what, double mx_snap, double my_snap)
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx2,yy1); ORDER(xx1,yy1,xx2,yy1);
storeobject(-1, xx1,yy1,xx2,yy1,WIRE,0,0,NULL); 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) { if(yy2!=yy1) {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx2,yy1,xx2,yy2); ORDER(xx2,yy1,xx2,yy2);
storeobject(-1, xx2,yy1,xx2,yy2,WIRE,0,0,NULL); 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) { } else if(manhattan_lines==2) {
if(yy2!=yy1) { if(yy2!=yy1) {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx1,yy2); ORDER(xx1,yy1,xx1,yy2);
storeobject(-1, xx1,yy1,xx1,yy2,WIRE,0,0,NULL); 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) { if(xx2!=xx1) {
xx1=x1;yy1=y1;xx2=x2;yy2=y2; xx1=x1;yy1=y1;xx2=x2;yy2=y2;
ORDER(xx1,yy2,xx2,yy2); ORDER(xx1,yy2,xx2,yy2);
storeobject(-1, xx1,yy2,xx2,yy2,WIRE,0,0,NULL); 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 { } else {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx2,yy2); ORDER(xx1,yy1,xx2,yy2);
storeobject(-1, xx1,yy1,xx2,yy2,WIRE,0,0,NULL); 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) { if(event_reporting) {
printf("xschem wire %g %g %g %g %d\n", xx1, yy1, xx2, yy2, -1); 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; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx2,yy1); ORDER(xx1,yy1,xx2,yy1);
storeobject(-1, xx1,yy1,xx2,yy1,LINE,rectcolor,0,NULL); 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) { if(yy2!=yy1) {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx2,yy1,xx2,yy2); ORDER(xx2,yy1,xx2,yy2);
storeobject(-1, xx2,yy1,xx2,yy2,LINE,rectcolor,0,NULL); 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) { } else if(manhattan_lines==2) {
if(yy2!=yy1) { if(yy2!=yy1) {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx1,yy2); ORDER(xx1,yy1,xx1,yy2);
storeobject(-1, xx1,yy1,xx1,yy2,LINE,rectcolor,0,NULL); 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) { if(xx2!=xx1) {
xx1=x1;yy1=y1;xx2=x2;yy2=y2; xx1=x1;yy1=y1;xx2=x2;yy2=y2;
ORDER(xx1,yy2,xx2,yy2); ORDER(xx1,yy2,xx2,yy2);
storeobject(-1, xx1,yy2,xx2,yy2,LINE,rectcolor,0,NULL); 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 { } else {
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2; xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
ORDER(xx1,yy1,xx2,yy2); ORDER(xx1,yy1,xx2,yy2);
storeobject(-1, xx1,yy1,xx2,yy2,LINE,rectcolor,0,NULL); 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; x1=x2=mousex_snap;y1=y2=mousey_snap;
@ -1950,7 +1950,7 @@ void new_rect(int what)
int save_draw; int save_draw;
RECTORDER(x1,y1,x2,y2); RECTORDER(x1,y1,x2,y2);
push_undo(); push_undo();
drawrect(rectcolor, NOW, x1,y1,x2,y2); drawrect(rectcolor, NOW, x1,y1,x2,y2, 0);
save_draw = draw_window; save_draw = draw_window;
draw_window = 1; /* 20181009 */ draw_window = 1; /* 20181009 */
filledrect(rectcolor, NOW, x1,y1,x2,y2); /* draw fill pattern even in XCopyArea mode */ 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); */ /* fprintf(errfp, "new_poly: finish: points=%d\n", points); */
drawtemppolygon(gc[rectcolor], NOW, x, y, points); drawtemppolygon(gc[rectcolor], NOW, x, y, points);
ui_state &= ~STARTPOLYGON; 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(711, &x);
my_free(712, &y); my_free(712, &y);
maxpoints = points = 0; maxpoints = points = 0;

View File

@ -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_x1,curr_y1,rx1,ry1);
ROTATION(x1,y1,curr_x2,curr_y2,rx2,ry2); ROTATION(x1,y1,curr_x2,curr_y2,rx2,ry2);
ORDER(rx1,ry1,rx2,ry2); ORDER(rx1,ry1,rx2,ry2);
drawline(layer, what, rx1, ry1, rx2, ry2); drawline(layer, what, rx1, ry1, rx2, ry2, 0);
} }
pos++; pos++;
a += FONTWIDTH+FONTWHITESPACE; 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.x1,line.y1,x1,y1);
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2); ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
ORDER(x1,y1,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 */ 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; x[k]+= x0;
y[k] += y0; 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(718, &x);
my_free(719, &y); 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.x1,box.y1,x1,y1);
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2); ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
RECTORDER(x1,y1,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); filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2);
} }
if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) || 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, flip^text.flip, text.hcenter, text.vcenter,
x0+x1, y0+y1, text.xscale, text.yscale); x0+x1, y0+y1, text.xscale, text.yscale);
#ifndef HAS_CAIRO #ifndef HAS_CAIRO
drawrect(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); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif #endif
#ifdef HAS_CAIRO #ifdef HAS_CAIRO
if(textfont && textfont[0]) { 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; static int i = 0;
#ifndef __unix__ #ifndef __unix__
@ -767,6 +767,9 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
static XSegment r[CADDRAWBUFFERSIZE]; static XSegment r[CADDRAWBUFFERSIZE];
double x1,y1,x2,y2; double x1,y1,x2,y2;
register XSegment *rr; register XSegment *rr;
char dash_arr[2];
if(dash) what = NOW;
if(!has_x) return; if(!has_x) return;
rr=r; 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(!only_probes && (x2-x1)< 0.3 && fabs(y2-y1)< 0.3) return; /* 20171206 */
if( clip(&x1,&y1,&x2,&y2) ) 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_window) XDrawLine(display, window, gc[c], x1, y1, x2, y2);
if(draw_pixmap) if(draw_pixmap)
XDrawLine(display, save_pixmap, gc[c], x1, y1, x2, y2); 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(!only_probes && (x2-x1)< 0.3 && fabs(y2-y1)< 0.3) return; /* 20171206 */
if( clip(&x1,&y1,&x2,&y2) ) 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], bus_width ,LineDoubleDash, CapRound , JoinRound);
} else {
XSetLineAttributes (display, gc[c], bus_width , LineSolid, CapRound , JoinRound); XSetLineAttributes (display, gc[c], bus_width , LineSolid, CapRound , JoinRound);
}
if(draw_window) XDrawLine(display, window, gc[c], x1, y1, x2, y2); 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(draw_pixmap) XDrawLine(display, save_pixmap, gc[c], x1, y1, x2, y2);
XSetLineAttributes (display, gc[c], lw, LineSolid, CapRound , JoinRound); XSetLineAttributes (display, gc[c], lw, LineSolid, CapRound , JoinRound);
@ -908,9 +925,6 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou
XSetLineAttributes (display, gc, bus_width, LineSolid, CapRound , JoinRound); /* 20150410 */ XSetLineAttributes (display, gc, bus_width, LineSolid, CapRound , JoinRound); /* 20150410 */
XDrawLine(display, window, gc, x1, y1, x2, y2); 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 */ /* Convex Nonconvex Complex */
#define Polygontype Nonconvex #define Polygontype Nonconvex
/* 20180914 added fill param */ /* 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; double x1,y1,x2,y2;
XPoint *p; 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].x = X_TO_SCREEN(x[i]);
p[i].y = Y_TO_SCREEN(y[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_window) XDrawLines(display, window, gc[c], p, points, CoordModeOrigin);
if(draw_pixmap) if(draw_pixmap)
XDrawLines(display, save_pixmap, gc[c], p, points, CoordModeOrigin); 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); XFillPolygon(display, save_pixmap, gcstipple[c], p, points, Polygontype, CoordModeOrigin);
} }
} }
if(dash) {
XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound);
}
my_free(722, &p); my_free(722, &p);
} }
@ -1356,13 +1380,15 @@ void drawtemppolygon(GC g, int what, double *x, double *y, int points)
my_free(723, &p); 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 int i=0;
static XRectangle r[CADDRAWBUFFERSIZE]; static XRectangle r[CADDRAWBUFFERSIZE];
double x1,y1,x2,y2; double x1,y1,x2,y2;
char dash_arr[2];
if(!has_x) return; if(!has_x) return;
if(dash) what = NOW;
if(what & NOW) if(what & NOW)
{ {
x1=X_TO_SCREEN(rectx1); 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(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) return; /* 20171206 */
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) 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, if(draw_window) XDrawRectangle(display, window, gc[c], (int)x1, (int)y1,
(unsigned int)x2 - (unsigned int)x1, (unsigned int)x2 - (unsigned int)x1,
(unsigned int)y2 - (unsigned int)y1); (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)x2 - (unsigned int)x1,
(unsigned int)y2 - (unsigned int)y1); (unsigned int)y2 - (unsigned int)y1);
} }
if(dash) {
XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound);
}
} }
} }
else if(what & BEGIN) i=0; else if(what & BEGIN) i=0;
@ -1508,10 +1542,10 @@ void draw(void)
if(draw_single_layer!=-1 && c != draw_single_layer) continue; /* 20151117 */ if(draw_single_layer!=-1 && c != draw_single_layer) continue; /* 20151117 */
for(i=0;i<lastline[c];i++) for(i=0;i<lastline[c];i++)
drawline(c, ADD, line[c][i].x1, line[c][i].y1, line[c][i].x2, line[c][i].y2); drawline(c, ADD, line[c][i].x1, line[c][i].y1, line[c][i].x2, line[c][i].y2, line[c][i].dash);
for(i=0;i<lastrect[c];i++) for(i=0;i<lastrect[c];i++)
{ {
drawrect(c, ADD, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2); drawrect(c, ADD, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2, rect[c][i].dash);
filledrect(c, ADD, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2); filledrect(c, ADD, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2);
} }
for(i=0;i<lastarc[c];i++) for(i=0;i<lastarc[c];i++)
@ -1520,7 +1554,7 @@ void draw(void)
} }
for(i=0;i<lastpolygon[c];i++) { for(i=0;i<lastpolygon[c];i++) {
/* 20180914 added fill */ /* 20180914 added fill */
drawpolygon(c, NOW, polygon[c][i].x, polygon[c][i].y, polygon[c][i].points, polygon[c][i].fill); drawpolygon(c, NOW, polygon[c][i].x, polygon[c][i].y, polygon[c][i].points, polygon[c][i].fill, polygon[c][i].dash);
} }
if(use_hash) { if(use_hash) {
@ -1597,8 +1631,8 @@ void draw(void)
filledrect(c, END, 0.0, 0.0, 0.0, 0.0); filledrect(c, END, 0.0, 0.0, 0.0, 0.0);
drawarc(c, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0); drawarc(c, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
drawrect(c, END, 0.0, 0.0, 0.0, 0.0); drawrect(c, END, 0.0, 0.0, 0.0, 0.0, 0);
drawline(c, END, 0.0, 0.0, 0.0, 0.0); drawline(c, END, 0.0, 0.0, 0.0, 0.0, 0);
} }
if(draw_single_layer==-1 || draw_single_layer==WIRELAYER){ /* 20151117 */ if(draw_single_layer==-1 || draw_single_layer==WIRELAYER){ /* 20151117 */
@ -1609,24 +1643,24 @@ void draw(void)
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) { for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
ii=wireptr->n; ii=wireptr->n;
if(wire[ii].bus) { 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 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 { } else {
for(i=0;i<lastwire;i++) for(i=0;i<lastwire;i++)
{ {
if(wire[i].bus) { if(wire[i].bus) {
drawline(WIRELAYER, THICK, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2); drawline(WIRELAYER, THICK, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2, 0);
} }
else else
drawline(WIRELAYER, ADD, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2); drawline(WIRELAYER, ADD, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2, 0);
} }
} }
update_conn_cues(1, draw_window); update_conn_cues(1, draw_window);
filledrect(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0); filledrect(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0);
drawline(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0); drawline(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0);
} }
if(draw_single_layer ==-1 || draw_single_layer==TEXTLAYER) { /* 20151117 */ if(draw_single_layer ==-1 || draw_single_layer==TEXTLAYER) { /* 20151117 */
for(i=0;i<lasttext;i++) for(i=0;i<lasttext;i++)
@ -1655,8 +1689,8 @@ void draw(void)
} }
#endif #endif
#ifndef HAS_CAIRO #ifndef HAS_CAIRO
drawrect(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); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif #endif
} }
} }

View File

@ -396,7 +396,9 @@ void set_inst_prop(int i)
void edit_rect_property(void) void edit_rect_property(void)
{ {
int i; int i, c, n, old_dash;
int drw = 0;
const char *dash;
int preserve; int preserve;
char *oldprop=NULL; char *oldprop=NULL;
if(rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) { if(rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
@ -414,14 +416,33 @@ void edit_rect_property(void)
set_modify(1); set_modify(1);
for(i=0; i<lastselected; i++) { for(i=0; i<lastselected; i++) {
if(selectedgroup[i].type != xRECT) continue; if(selectedgroup[i].type != xRECT) continue;
c = selectedgroup[i].col;
n = selectedgroup[i].n;
if(preserve == 1) { if(preserve == 1) {
set_different_token(&rect[selectedgroup[i].col][selectedgroup[i].n].prop_ptr, set_different_token(&rect[c][n].prop_ptr,
(char *) tclgetvar("retval"), oldprop, 0, 0); (char *) tclgetvar("retval"), oldprop, 0, 0);
} else { } else {
my_strdup(99, &rect[selectedgroup[i].col][selectedgroup[i].n].prop_ptr, my_strdup(99, &rect[c][n].prop_ptr,
(char *) tclgetvar("retval")); (char *) tclgetvar("retval"));
} }
old_dash = rect[c][n].dash;
dash = get_tok_value(rect[c][n].prop_ptr,"dash",0);
if( strcmp(dash, "") )
rect[c][n].dash = atoi(dash);
else
rect[c][n].dash = 0;
if(old_dash != rect[c][n].dash) {
if(!drw) {
bbox(BEGIN,0.0,0.0,0.0,0.0);
drw = 1;
}
bbox(ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2);
}
}
if(drw) {
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
} }
my_free(725, &oldprop); my_free(725, &oldprop);
@ -430,7 +451,9 @@ void edit_rect_property(void)
void edit_line_property(void) void edit_line_property(void)
{ {
int i; int i, c, n, old_dash;
int drw=0;
const char *dash;
int preserve; int preserve;
char *oldprop=NULL; char *oldprop=NULL;
if(line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) { if(line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
@ -447,14 +470,33 @@ void edit_line_property(void)
set_modify(1); set_modify(1);
for(i=0; i<lastselected; i++) { for(i=0; i<lastselected; i++) {
if(selectedgroup[i].type != LINE) continue; if(selectedgroup[i].type != LINE) continue;
c = selectedgroup[i].col;
n = selectedgroup[i].n;
if(preserve == 1) { if(preserve == 1) {
set_different_token(&line[selectedgroup[i].col][selectedgroup[i].n].prop_ptr, set_different_token(&line[c][n].prop_ptr,
(char *) tclgetvar("retval"), oldprop, 0, 0); (char *) tclgetvar("retval"), oldprop, 0, 0);
} else { } else {
my_strdup(102, &line[selectedgroup[i].col][selectedgroup[i].n].prop_ptr, my_strdup(102, &line[c][n].prop_ptr,
(char *) tclgetvar("retval")); (char *) tclgetvar("retval"));
} }
old_dash = line[c][n].dash;
dash = get_tok_value(line[c][n].prop_ptr,"dash",0);
if( strcmp(dash, "") )
line[c][n].dash = atoi(dash);
else
line[c][n].dash = 0;
if(old_dash != line[c][n].dash) {
if(!drw) {
bbox(BEGIN,0.0,0.0,0.0,0.0);
drw = 1;
}
bbox(ADD, line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2);
}
}
if(drw) {
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
} }
my_free(726, &oldprop); my_free(726, &oldprop);
@ -579,8 +621,10 @@ void edit_polygon_property(void)
int old_fill; /* 20180914 */ int old_fill; /* 20180914 */
int k; int k;
double x1=0., y1=0., x2=0., y2=0.; double x1=0., y1=0., x2=0., y2=0.;
int c, i, ii; int c, i, ii, old_dash;
int drw = 0;
char *oldprop = NULL; char *oldprop = NULL;
const char *dash;
int preserve; int preserve;
dbg(1, "edit_property(): input property:\n"); dbg(1, "edit_property(): input property:\n");
@ -609,12 +653,21 @@ void edit_polygon_property(void)
my_strdup(113, &polygon[c][i].prop_ptr, (char *) tclgetvar("retval")); my_strdup(113, &polygon[c][i].prop_ptr, (char *) tclgetvar("retval"));
} }
old_fill = polygon[c][i].fill; old_fill = polygon[c][i].fill;
old_dash = polygon[c][i].dash;
if( !strcmp(get_tok_value(polygon[c][i].prop_ptr,"fill",0),"true") ) if( !strcmp(get_tok_value(polygon[c][i].prop_ptr,"fill",0),"true") )
polygon[c][i].fill =1; polygon[c][i].fill =1;
else else
polygon[c][i].fill =0; polygon[c][i].fill =0;
if(old_fill != polygon[c][i].fill) { dash = get_tok_value(polygon[c][i].prop_ptr,"dash",0);
if( strcmp(dash, "") )
polygon[c][i].dash = atoi(dash);
else
polygon[c][i].dash = 0;
if(old_fill != polygon[c][i].fill || old_dash != polygon[c][i].dash) {
if(!drw) {
bbox(BEGIN,0.0,0.0,0.0,0.0); bbox(BEGIN,0.0,0.0,0.0,0.0);
drw = 1;
}
for(k=0; k<polygon[c][i].points; k++) { for(k=0; k<polygon[c][i].points; k++) {
if(k==0 || polygon[c][i].x[k] < x1) x1 = polygon[c][i].x[k]; if(k==0 || polygon[c][i].x[k] < x1) x1 = polygon[c][i].x[k];
if(k==0 || polygon[c][i].y[k] < y1) y1 = polygon[c][i].y[k]; if(k==0 || polygon[c][i].y[k] < y1) y1 = polygon[c][i].y[k];
@ -622,13 +675,15 @@ void edit_polygon_property(void)
if(k==0 || polygon[c][i].y[k] > y2) y2 = polygon[c][i].y[k]; if(k==0 || polygon[c][i].y[k] > y2) y2 = polygon[c][i].y[k];
} }
bbox(ADD, x1, y1, x2, y2); bbox(ADD, x1, y1, x2, y2);
}
}
if(drw) {
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw(); draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0); bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
} }
} }
}
/* x=0 use text widget x=1 use vim editor */ /* x=0 use text widget x=1 use vim editor */

View File

@ -516,10 +516,10 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
if(what == NOW) { if(what == NOW) {
if(wire[i].bus) /* 20171201 */ if(wire[i].bus) /* 20171201 */
drawline(hilight_layer, THICK, 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 else
drawline(hilight_layer, NOW, 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(cadhalfdotsize*mooz>=0.7) {
if( wire[i].end1 >1 ) { if( wire[i].end1 >1 ) {
filledarc(hilight_layer, NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); 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( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) {
if(wire[i].bus) /* 20171201 */ if(wire[i].bus) /* 20171201 */
drawline(get_color(entry->value), THICK, 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 else
drawline(get_color(entry->value), NOW, 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(cadhalfdotsize*mooz>=0.7) {
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */ if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); 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( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) {
if(wire[i].bus) /* 20171201 */ if(wire[i].bus) /* 20171201 */
drawline(get_color(entry->value), THICK, 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 else
drawline(get_color(entry->value), NOW, 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(cadhalfdotsize*mooz>=0.7) {
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */ if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); 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); 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); 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); 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); drawline(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0);
} }
} }
} }

View File

@ -561,9 +561,9 @@ void copy_objects(int what)
else if(wire[n].sel == SELECTED2) wire[n].sel = SELECTED1; else if(wire[n].sel == SELECTED2) wire[n].sel = SELECTED1;
} }
if(wire[n].bus) /* 20171201 */ if(wire[n].bus) /* 20171201 */
drawline(k, THICK, rx1,ry1,rx2,ry2); drawline(k, THICK, rx1,ry1,rx2,ry2, 0);
else else
drawline(k, ADD, rx1,ry1,rx2,ry2); drawline(k, ADD, rx1,ry1,rx2,ry2, 0);
selectedgroup[i].n=lastwire; selectedgroup[i].n=lastwire;
storeobject(-1, rx1,ry1,rx2,ry2,WIRE,0,wire[n].sel,wire[n].prop_ptr); 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; if(line[c][n].sel == SELECTED1) line[c][n].sel = SELECTED2;
else if(line[c][n].sel == SELECTED2) line[c][n].sel = SELECTED1; 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]; selectedgroup[i].n=lastline[c];
storeobject(-1, rx1, ry1, rx2, ry2, LINE, c, line[c][n].sel, line[c][n].prop_ptr); storeobject(-1, rx1, ry1, rx2, ry2, LINE, c, line[c][n].sel, line[c][n].prop_ptr);
line[c][n].sel=0; line[c][n].sel=0;
@ -629,7 +629,7 @@ void copy_objects(int what)
} }
bbox(ADD, bx1, by1, bx2, by2); /* 20181009 */ 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]; selectedgroup[i].n=lastpolygon[c];
store_polygon(-1, x, y, polygon[c][n].points, c, polygon[c][n].sel, polygon[c][n].prop_ptr); store_polygon(-1, x, y, polygon[c][n].points, c, polygon[c][n].sel, polygon[c][n].prop_ptr);
polygon[c][n].sel=0; polygon[c][n].sel=0;
@ -680,7 +680,7 @@ void copy_objects(int what)
} }
RECTORDER(rx1,ry1,rx2,ry2); RECTORDER(rx1,ry1,rx2,ry2);
rect[c][n].sel=0; 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); filledrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay);
selectedgroup[i].n=lastrect[c]; selectedgroup[i].n=lastrect[c];
storeobject(-1, rx1+deltax, ry1+deltay, storeobject(-1, rx1+deltax, ry1+deltay,
@ -753,8 +753,8 @@ void copy_objects(int what)
rx1+deltax,ry1+deltay, rx1+deltax,ry1+deltay,
textelement[lasttext].xscale, textelement[lasttext].yscale); textelement[lasttext].xscale, textelement[lasttext].yscale);
#ifndef HAS_CAIRO #ifndef HAS_CAIRO
drawrect(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); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif #endif
#ifdef HAS_CAIRO #ifdef HAS_CAIRO
if(textfont && textfont[0]) { if(textfont && textfont[0]) {
@ -814,8 +814,8 @@ void copy_objects(int what)
} }
filledrect(k, END, 0.0, 0.0, 0.0, 0.0); 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); 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); drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0);
drawline(k, END, 0.0, 0.0, 0.0, 0.0); drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0);
} /* end for(k ... */ } /* end for(k ... */
check_collapsing_objects(); check_collapsing_objects();
@ -973,9 +973,9 @@ void move_objects(int what, int merge, double dx, double dy)
wire[n].x2=rx2; wire[n].x2=rx2;
wire[n].y2=ry2; wire[n].y2=ry2;
if(wire[n].bus) /* 20171201 */ 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 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; break;
case LINE: case LINE:
if(c!=k) break; 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].y1=ry1;
line[c][n].x2=rx2; line[c][n].x2=rx2;
line[c][n].y2=ry2; 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; break;
case POLYGON: /* 20171115 */ case POLYGON: /* 20171115 */
@ -1042,7 +1042,7 @@ void move_objects(int what, int merge, double dx, double dy)
bbox(ADD, bx1, by1, bx2, by2); bbox(ADD, bx1, by1, bx2, by2);
} }
/* 20180914 added fill */ /* 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; break;
case ARC: 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].y1 = ry1;
rect[c][n].x2 = rx2; rect[c][n].x2 = rx2;
rect[c][n].y2 = ry2; 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, filledrect(c, ADD, rect[c][n].x1, rect[c][n].y1,
rect[c][n].x2, rect[c][n].y2); 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].x0, textelement[n].y0,
textelement[n].xscale, textelement[n].yscale); textelement[n].xscale, textelement[n].yscale);
#ifndef HAS_CAIRO #ifndef HAS_CAIRO
drawrect(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); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif #endif
#ifdef HAS_CAIRO #ifdef HAS_CAIRO
if(textfont && textfont[0]) { 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); 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); 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); drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0);
drawline(k, END, 0.0, 0.0, 0.0, 0.0); drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0);
} /*end for(k ... */ } /*end for(k ... */
check_collapsing_objects(); check_collapsing_objects();
update_conn_cues(1, 1); update_conn_cues(1, 1);

View File

@ -552,6 +552,7 @@ static void load_polygon(FILE *fd)
{ {
int i,c, j, points; int i,c, j, points;
xPolygon *ptr; xPolygon *ptr;
const char *dash;
dbg(3, "load_polygon(): start\n"); dbg(3, "load_polygon(): start\n");
if(fscanf(fd, "%d %d",&c, &points)<2) { if(fscanf(fd, "%d %d",&c, &points)<2) {
@ -592,6 +593,12 @@ static void load_polygon(FILE *fd)
ptr[i].fill =1; ptr[i].fill =1;
else else
ptr[i].fill =0; 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]++; lastpolygon[c]++;
} }
@ -631,6 +638,7 @@ static void load_box(FILE *fd)
{ {
int i,c; int i,c;
Box *ptr; Box *ptr;
const char *dash;
dbg(3, "load_box(): start\n"); dbg(3, "load_box(): start\n");
fscanf(fd, "%d",&c); fscanf(fd, "%d",&c);
@ -652,6 +660,12 @@ static void load_box(FILE *fd)
ptr[i].prop_ptr=NULL; ptr[i].prop_ptr=NULL;
ptr[i].sel=0; ptr[i].sel=0;
load_ascii_string( &ptr[i].prop_ptr, fd); 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]++; lastrect[c]++;
} }
@ -659,6 +673,7 @@ static void load_line(FILE *fd)
{ {
int i,c; int i,c;
Line *ptr; Line *ptr;
const char *dash;
dbg(3, "load_line(): start\n"); dbg(3, "load_line(): start\n");
fscanf(fd, "%d",&c); fscanf(fd, "%d",&c);
@ -680,6 +695,12 @@ static void load_line(FILE *fd)
ptr[i].prop_ptr=NULL; ptr[i].prop_ptr=NULL;
ptr[i].sel=0; ptr[i].sel=0;
load_ascii_string( &ptr[i].prop_ptr, fd); 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]++; lastline[c]++;
} }
@ -1241,6 +1262,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
const char *label; const char *label;
char *pin_label = NULL, *recover_str=NULL; char *pin_label = NULL, *recover_str=NULL;
char *skip_line; char *skip_line;
const char *dash;
dbg(1, "load_sym_def(): recursion_counter=%d\n", recursion_counter); dbg(1, "load_sym_def(): recursion_counter=%d\n", recursion_counter);
recursion_counter++; recursion_counter++;
@ -1366,6 +1388,13 @@ int load_sym_def(const char *name, FILE *embed_fd)
ll[c][i].prop_ptr=NULL; ll[c][i].prop_ptr=NULL;
load_ascii_string( &ll[c][i].prop_ptr, lcc[level].fd); 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]++; lastl[c]++;
break; break;
case 'P': /* 20171115 */ case 'P': /* 20171115 */
@ -1403,6 +1432,13 @@ int load_sym_def(const char *name, FILE *embed_fd)
else else
pp[c][i].fill =0; 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]); dbg(2, "l_d_s(): loaded polygon: ptr=%lx\n", (unsigned long)pp[c]);
lastp[c]++; lastp[c]++;
break; break;
@ -1468,6 +1504,13 @@ int load_sym_def(const char *name, FILE *embed_fd)
bb[c][i].prop_ptr=NULL; bb[c][i].prop_ptr=NULL;
load_ascii_string( &bb[c][i].prop_ptr, lcc[level].fd); 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]); 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]++; lastr[c]++;
break; break;
case 'T': case 'T':
@ -1522,6 +1565,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
ll[WIRELAYER][i].prop_ptr=NULL; ll[WIRELAYER][i].prop_ptr=NULL;
load_ascii_string( &ll[WIRELAYER][i].prop_ptr, lcc[level].fd); 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]++; lastl[WIRELAYER]++;
break; break;
case 'C': case 'C':

View File

@ -840,7 +840,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
push_undo(); push_undo();
storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop); storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop);
save = draw_window; draw_window = 1; save = draw_window; draw_window = 1;
drawline(WIRELAYER,NOW, x1,y1,x2,y2); drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0);
draw_window = save; draw_window = save;
} }
else ui_state |= MENUSTARTWIRE; 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]); if(argc==7) pos=atol(argv[6]);
storeobject(pos, x1,y1,x2,y2,LINE,rectcolor,0,NULL); storeobject(pos, x1,y1,x2,y2,LINE,rectcolor,0,NULL);
save = draw_window; draw_window = 1; save = draw_window; draw_window = 1;
drawline(rectcolor,NOW, x1,y1,x2,y2); drawline(rectcolor,NOW, x1,y1,x2,y2, 0);
draw_window = save; draw_window = save;
} }
else ui_state |= MENUSTARTLINE; 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]); if(argc==7) pos=atol(argv[6]);
storeobject(pos, x1,y1,x2,y2,xRECT,rectcolor,0,NULL); storeobject(pos, x1,y1,x2,y2,xRECT,rectcolor,0,NULL);
save = draw_window; draw_window = 1; save = draw_window; draw_window = 1;
drawrect(rectcolor,NOW, x1,y1,x2,y2); drawrect(rectcolor,NOW, x1,y1,x2,y2, 0);
draw_window = save; draw_window = save;
} }
else ui_state |= MENUSTARTRECT; else ui_state |= MENUSTARTRECT;

View File

@ -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) void store_polygon(int pos, double *x, double *y, int points, unsigned int rectcolor, unsigned short sel, char *prop_ptr)
{ {
int n, j; int n, j;
const char *dash;
check_polygon_storage(rectcolor); check_polygon_storage(rectcolor);
if(pos==-1) n=lastpolygon[rectcolor]; if(pos==-1) n=lastpolygon[rectcolor];
else else
@ -212,6 +213,11 @@ void store_polygon(int pos, double *x, double *y, int points, unsigned int rectc
polygon[rectcolor][n].fill =1; polygon[rectcolor][n].fill =1;
else else
polygon[rectcolor][n].fill =0; 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]++; 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) unsigned short sel, const char *prop_ptr)
{ {
int n, j; int n, j;
const char * dash;
if(type == LINE) if(type == LINE)
{ {
check_line_storage(rectcolor); 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; line[rectcolor][n].prop_ptr=NULL;
my_strdup(412, &line[rectcolor][n].prop_ptr, prop_ptr); my_strdup(412, &line[rectcolor][n].prop_ptr, prop_ptr);
line[rectcolor][n].sel=sel; 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]++; lastline[rectcolor]++;
set_modify(1); set_modify(1);
} }
@ -259,7 +271,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
} }
n=pos; 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].x1=x1;
rect[rectcolor][n].x2=x2; rect[rectcolor][n].x2=x2;
rect[rectcolor][n].y1=y1; 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; rect[rectcolor][n].prop_ptr=NULL;
my_strdup(413, &rect[rectcolor][n].prop_ptr, prop_ptr); my_strdup(413, &rect[rectcolor][n].prop_ptr, prop_ptr);
rect[rectcolor][n].sel=sel; 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]++; lastrect[rectcolor]++;
set_modify(1); set_modify(1);
} }

View File

@ -696,6 +696,7 @@ int build_colors(double dim) /* 20171113 */
} }
for(i=0;i<cadlayers;i++) for(i=0;i<cadlayers;i++)
{ {
XSetBackground(display, gc[i], color_index[0]); /* for dashed lines 'off' color */
XSetForeground(display, gc[i], color_index[i]); XSetForeground(display, gc[i], color_index[i]);
XSetForeground(display, gcstipple[i], color_index[i]); XSetForeground(display, gcstipple[i], color_index[i]);
} }

View File

@ -314,6 +314,7 @@ typedef struct
double y2; double y2;
unsigned short sel; unsigned short sel;
char *prop_ptr; char *prop_ptr;
int dash;
} Line; } Line;
typedef struct typedef struct
@ -324,6 +325,7 @@ typedef struct
double y2; double y2;
unsigned short sel; unsigned short sel;
char *prop_ptr; char *prop_ptr;
int dash;
} Box; } Box;
typedef struct /* 20171115 */ typedef struct /* 20171115 */
@ -337,6 +339,7 @@ typedef struct /* 20171115 */
unsigned short sel; unsigned short sel;
char *prop_ptr; char *prop_ptr;
int fill; /* 20180914 */ int fill; /* 20180914 */
int dash;
} xPolygon; } xPolygon;
typedef struct /* 20181012 */ typedef struct /* 20181012 */
@ -758,13 +761,13 @@ extern void find_closest_text(double mx,double my);
extern Selected find_closest_obj(double mx,double my); extern Selected find_closest_obj(double mx,double my);
extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y); extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y);
extern void drawline(int c, int what, double x1,double y1,double x2,double y2); extern void drawline(int c, int what, double x1,double y1,double x2,double y2, int dash);
extern void draw_string(int layer,int what, const char *str, int rot, int flip, int hcenter, int vcenter, extern void draw_string(int layer,int what, const char *str, int rot, int flip, int hcenter, int vcenter,
double x1, double y1, double xscale, double yscale); double x1, double y1, double xscale, double yscale);
extern void draw_symbol(int what,int c, int n,int layer, extern void draw_symbol(int what,int c, int n,int layer,
int tmp_flip, int tmp_rot, double xoffset, double yoffset); int tmp_flip, int tmp_rot, double xoffset, double yoffset);
extern void drawrect(int c, int what, double rectx1,double recty1, extern void drawrect(int c, int what, double rectx1,double recty1,
double rectx2,double recty2); double rectx2,double recty2, int dash);
extern void filledrect(int c, int what, double rectx1,double recty1, extern void filledrect(int c, int what, double rectx1,double recty1,
double rectx2,double recty2); double rectx2,double recty2);
@ -777,7 +780,7 @@ extern void drawtemparc(GC gc, int what, double x, double y, double r, double a,
extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill); extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill);
extern void filledarc(int c, int what, double x, double y, double r, double a, double b); extern void filledarc(int c, int what, double x, double y, double r, double a, double b);
extern void drawtemppolygon(GC gc, int what, double *x, double *y, int points); extern void drawtemppolygon(GC gc, int what, double *x, double *y, int points);
extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill); extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash);
extern void draw_temp_symbol(int what, GC gc, int n,int layer, extern void draw_temp_symbol(int what, GC gc, int n,int layer,
int tmp_flip, int tmp_rot, double xoffset, double yoffset); int tmp_flip, int tmp_rot, double xoffset, double yoffset);
extern void draw_temp_string(GC gc,int what, const char *str, int rot, int flip, int hcenter, int vcenter, extern void draw_temp_string(GC gc,int what, const char *str, int rot, int flip, int hcenter, int vcenter,

View File

@ -14,11 +14,12 @@ L 4 270 -340 270 -280 {}
L 4 350 -620 370 -600 {} L 4 350 -620 370 -600 {}
L 4 370 -640 370 -600 {} L 4 370 -640 370 -600 {}
L 4 350 -620 370 -640 {} L 4 350 -620 370 -640 {}
L 4 370 -620 530 -620 {} L 4 370 -620 530 -620 {dash=3}
L 4 1400 -290 1420 -310 {} L 4 1400 -290 1420 -310 {}
L 4 1400 -330 1400 -290 {} L 4 1400 -330 1400 -290 {}
L 4 1400 -330 1420 -310 {} L 4 1400 -330 1420 -310 {}
L 4 1240 -310 1400 -310 {} L 4 1240 -310 1400 -310 {}
P 4 7 530 -860 1130 -860 1130 -690 1390 -690 1390 -580 530 -580 530 -860 {dash=3}
T {These 2 instances are equivalent} 290 -320 0 0 0.4 0.4 {} T {These 2 instances are equivalent} 290 -320 0 0 0.4 0.4 {}
T {Example of using a schematic as a T {Example of using a schematic as a
component instance instead of the component instance instead of the

View File

@ -6,7 +6,7 @@ template="name=X1 WN_FB=1u WP_FB=2u"}
V {} V {}
S {} S {}
E {} E {}
P 4 5 250 -880 250 -120 480 -120 480 -880 250 -880 {} P 4 5 250 -880 250 -120 480 -120 480 -880 250 -880 {dash=5}
T {@name} 250 -915 0 0 0.5 0.5 {} T {@name} 250 -915 0 0 0.5 0.5 {}
T {@symname} 253.75 -115 0 0 0.5 0.5 {} T {@symname} 253.75 -115 0 0 0.5 0.5 {}
N 250 -300 300 -300 {lab=A} N 250 -300 300 -300 {lab=A}

View File

@ -7,7 +7,7 @@ template="name=X1 WN=15u WP=45u LLN=3u LLP=3u m=1"
V {} V {}
S {} S {}
E {} E {}
P 4 5 60 -390 60 -90 190 -90 190 -390 60 -390 {} P 4 5 60 -390 60 -90 190 -90 190 -390 60 -390 {dash=5}
T {@name} 60 -405 0 0 0.2 0.2 {} T {@name} 60 -405 0 0 0.2 0.2 {}
T {@symname} 63.75 -85 0 0 0.2 0.2 {} T {@symname} 63.75 -85 0 0 0.2 0.2 {}
N 140 -260 140 -200 {lab=Z} N 140 -260 140 -200 {lab=Z}