table_read(): read csv files

This commit is contained in:
stefan schippers 2024-02-27 10:24:21 +01:00
parent 354f027b9b
commit 1e3ac96085
8 changed files with 112 additions and 73 deletions

View File

@ -3299,7 +3299,7 @@ void new_polygon(int what)
/* closed poly */ /* closed poly */
if(what & END) { if(what & END) {
/* delete last rubber */ /* delete last rubber */
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1); drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
xctx->nl_polyx[xctx->nl_points] = xctx->nl_polyx[0]; xctx->nl_polyx[xctx->nl_points] = xctx->nl_polyx[0];
xctx->nl_polyy[xctx->nl_points] = xctx->nl_polyy[0]; xctx->nl_polyy[xctx->nl_points] = xctx->nl_polyy[0];
/* add point */ /* add point */
@ -3321,12 +3321,12 @@ void new_polygon(int what)
((what & ADD) && xctx->nl_polyx[xctx->nl_points-1] == xctx->nl_polyx[0] && ((what & ADD) && xctx->nl_polyx[xctx->nl_points-1] == xctx->nl_polyx[0] &&
xctx->nl_polyy[xctx->nl_points-1] == xctx->nl_polyy[0]) ) { xctx->nl_polyy[xctx->nl_points-1] == xctx->nl_polyy[0]) ) {
xctx->push_undo(); xctx->push_undo();
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1); drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
store_poly(-1, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, xctx->rectcolor, 0, NULL); store_poly(-1, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, xctx->rectcolor, 0, NULL);
/* fprintf(errfp, "new_poly: finish: nl_points=%d\n", xctx->nl_points); */ /* fprintf(errfp, "new_poly: finish: nl_points=%d\n", xctx->nl_points); */
drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points); drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0);
xctx->ui_state &= ~STARTPOLYGON; xctx->ui_state &= ~STARTPOLYGON;
drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0); drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0, 0);
my_free(_ALLOC_ID_, &xctx->nl_polyx); my_free(_ALLOC_ID_, &xctx->nl_polyx);
my_free(_ALLOC_ID_, &xctx->nl_polyy); my_free(_ALLOC_ID_, &xctx->nl_polyy);
xctx->nl_maxpoints = xctx->nl_points = 0; xctx->nl_maxpoints = xctx->nl_points = 0;
@ -3334,10 +3334,10 @@ void new_polygon(int what)
if(what & RUBBER) if(what & RUBBER)
{ {
/* fprintf(errfp, "new_poly: RUBBER\n"); */ /* fprintf(errfp, "new_poly: RUBBER\n"); */
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1); drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap; xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap;
xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap; xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap;
drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1); drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
} }
} }

View File

@ -609,7 +609,9 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
for(j=0;j< symptr->polygons[layer]; ++j) for(j=0;j< symptr->polygons[layer]; ++j)
{ {
int dash; int dash;
int bezier;
polygon = &(symptr->poly[layer])[j]; polygon = &(symptr->poly[layer])[j];
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
dash = (disabled == 1) ? 3 : polygon->dash; dash = (disabled == 1) ? 3 : polygon->dash;
x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
@ -618,7 +620,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
x[k]+= x0; x[k]+= x0;
y[k] += y0; y[k] += y0;
} }
drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash); /* added fill */ drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash, bezier); /* added fill */
my_free(_ALLOC_ID_, &x); my_free(_ALLOC_ID_, &x);
my_free(_ALLOC_ID_, &y); my_free(_ALLOC_ID_, &y);
} }
@ -828,8 +830,9 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
} }
for(j=0;j< symptr->polygons[layer]; ++j) for(j=0;j< symptr->polygons[layer]; ++j)
{ {
int bezier;
polygon = &(symptr->poly[layer])[j]; polygon = &(symptr->poly[layer])[j];
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k; int k;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
@ -839,7 +842,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
x[k] += x0; x[k] += x0;
y[k] += y0; y[k] += y0;
} }
drawtemppolygon(gc, NOW, x, y, polygon->points); drawtemppolygon(gc, NOW, x, y, polygon->points, bezier);
my_free(_ALLOC_ID_, &x); my_free(_ALLOC_ID_, &x);
my_free(_ALLOC_ID_, &y); my_free(_ALLOC_ID_, &y);
} }
@ -1188,33 +1191,6 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
i=0; i=0;
} }
} }
void drawbezier(void)
{
XPoint p[512];
int i = 0;
double t;
double x1=100.0;
double y1=-400.0;
double x2=500.0;
double y2=-800.0;
double x3=800.0;
double y3=-200.0;
double x4=1100.0;
double y4=-400.0;
double x, y;
i = 0;
for(t = 0; t <= 1.0; t += 0.00390625 /* 1/256 */) {
x = pow(1-t, 3) * x1 + 3 * pow(1-t, 2) * t * x2 + 3 * (1-t) * pow(t, 2) * x3 + pow(t, 3) * x4;
y = pow(1-t, 3) * y1 + 3 * pow(1-t, 2) * t * y2 + 3 * (1-t) * pow(t, 2) * y3 + pow(t, 3) * y4;
p[i].x = (short)X_TO_SCREEN(x);
p[i].y = (short)Y_TO_SCREEN(y);
i++;
}
XDrawLines(display, xctx->window, xctx->gc[4], p, i, CoordModeOrigin);
XDrawLines(display, xctx->save_pixmap, xctx->gc[4], p, i, CoordModeOrigin);
}
void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,double liney2) void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,double liney2)
{ {
@ -1467,7 +1443,6 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
} }
} }
void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash) void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash)
{ {
static int i=0; static int i=0;
@ -1561,7 +1536,6 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
} }
} }
void filledrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2) void filledrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2)
{ {
static int i=0; static int i=0;
@ -1630,7 +1604,6 @@ void polygon_bbox(double *x, double *y, int points, double *bx1, double *by1, do
} }
} }
void arc_bbox(double x, double y, double r, double a, double b, void arc_bbox(double x, double y, double r, double a, double b,
double *bx1, double *by1, double *bx2, double *by2) double *bx1, double *by1, double *bx2, double *by2)
{ {
@ -1688,11 +1661,40 @@ 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
static void drawbezier(Drawable w, GC gc, int c, double *x, double *y, int points, int fill)
{
XPoint p[512];
int i = 0;
double t;
double xp, yp;
if(points == 4) {
if(gc == xctx->gc[SELLAYER]) for(i = 0; i < points; i++) {
drawtemparc(gc, NOW, x[i], y[i], cadhalfdotsize, 0., 360.);
}
i = 0;
for(t = 0; t <= 1.0; t += 0.0078125/* 1/128 */) {
xp = pow(1-t, 3) * x[0] + 3 * pow(1-t, 2) * t * x[1] + 3 * (1-t) * pow(t, 2) * x[2] + pow(t, 3) * x[3];
yp = pow(1-t, 3) * y[0] + 3 * pow(1-t, 2) * t * y[1] + 3 * (1-t) * pow(t, 2) * y[2] + pow(t, 3) * y[3];
p[i].x = (short)X_TO_SCREEN(xp);
p[i].y = (short)Y_TO_SCREEN(yp);
i++;
}
XDrawLines(display, w, gc, p, i, CoordModeOrigin);
if(fill) {
XFillPolygon(display, w, xctx->gcstipple[c], p, i, Polygontype, CoordModeOrigin);
}
}
}
/* Unused 'what' parameter used in spice data draw_graph() /* Unused 'what' parameter used in spice data draw_graph()
* to avoid unnecessary clipping (what = 0) */ * to avoid unnecessary clipping (what = 0) */
void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash) void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash, int flags)
{ {
double x1,y1,x2,y2; double x1,y1,x2,y2;
int fill, bezier;
XPoint *p; XPoint *p;
int i; int i;
short sx, sy; short sx, sy;
@ -1719,36 +1721,49 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
for(i=0;i<points; ++i) p[i].x = (short)X_TO_SCREEN(x[i]); for(i=0;i<points; ++i) p[i].x = (short)X_TO_SCREEN(x[i]);
for(i=0;i<points; ++i) p[i].y = (short)Y_TO_SCREEN(y[i]); for(i=0;i<points; ++i) p[i].y = (short)Y_TO_SCREEN(y[i]);
} }
fill = xctx->fill_pattern && xctx->fill_type[c] &&
poly_fill && (x[0] == x[points-1]) && (y[0] == y[points-1]);
bezier = flags && points == 4;
if(dash) { if(dash) {
char dash_arr[2]; char dash_arr[2];
dash_arr[0] = dash_arr[1] = (char)dash; dash_arr[0] = dash_arr[1] = (char)dash;
XSetDashes(display, xctx->gc[c], 0, dash_arr, 1); XSetDashes(display, xctx->gc[c], 0, dash_arr, 1);
XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw), xDashType, xCap, xJoin); XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw), xDashType, xCap, xJoin);
} }
if(xctx->draw_window) XDrawLines(display, xctx->window, xctx->gc[c], p, points, CoordModeOrigin); if(xctx->draw_window) {
if(xctx->draw_pixmap) if(bezier) {
XDrawLines(display, xctx->save_pixmap, xctx->gc[c], p, points, CoordModeOrigin); drawbezier(xctx->window, xctx->gc[c], c, x, y, points, fill);
if(xctx->fill_pattern && xctx->fill_type[c]){ } else {
if(poly_fill && (x[0] == x[points-1]) && (y[0] == y[points-1])) { XDrawLines(display, xctx->window, xctx->gc[c], p, points, 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);
} }
} }
if(xctx->draw_pixmap) {
if(bezier) {
drawbezier(xctx->save_pixmap, xctx->gc[c], c, x, y, points, fill);
} else {
XDrawLines(display, xctx->save_pixmap, xctx->gc[c], p, points, CoordModeOrigin);
}
}
if(fill && !bezier) {
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);
}
if(dash) { if(dash) {
XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN); XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN);
} }
my_free(_ALLOC_ID_, &p); my_free(_ALLOC_ID_, &p);
} }
void drawtemppolygon(GC gc, int what, double *x, double *y, int points) void drawtemppolygon(GC gc, int what, double *x, double *y, int points, int flags)
{ {
double x1,y1,x2,y2; double x1,y1,x2,y2;
double sx1,sy1,sx2,sy2; double sx1,sy1,sx2,sy2;
XPoint *p; XPoint *p;
int i; int i;
short sx, sy; short sx, sy;
int bezier;
if(!has_x) return; if(!has_x) return;
polygon_bbox(x, y, points, &x1,&y1,&x2,&y2); polygon_bbox(x, y, points, &x1,&y1,&x2,&y2);
sx1=X_TO_SCREEN(x1); sx1=X_TO_SCREEN(x1);
@ -1757,18 +1772,25 @@ void drawtemppolygon(GC gc, int what, double *x, double *y, int points)
sy2=Y_TO_SCREEN(y2); sy2=Y_TO_SCREEN(y2);
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&sx1,&sy1,&sx2,&sy2) ) { if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&sx1,&sy1,&sx2,&sy2) ) {
bezier = flags && points == 4;
if((fix_broken_tiled_fill || !_unix) && gc == xctx->gctiled) { if((fix_broken_tiled_fill || !_unix) && gc == xctx->gctiled) {
MyXCopyAreaDouble(display, xctx->save_pixmap, xctx->window, xctx->gc[0], MyXCopyAreaDouble(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
x1, y1, x2, y2, x1, y1, xctx->lw); x1 - cadhalfdotsize, y1 - cadhalfdotsize,
x2 + cadhalfdotsize, y2 + cadhalfdotsize,
x1 - cadhalfdotsize, y1 - cadhalfdotsize, xctx->lw);
} else { } else {
p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); if(bezier) {
for(i=0;i<points; ++i) { drawbezier(xctx->window, gc, 0, x, y, points, 0);
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy); } else {
p[i].x = sx; p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points);
p[i].y = sy; for(i=0;i<points; ++i) {
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy);
p[i].x = sx;
p[i].y = sy;
}
XDrawLines(display, xctx->window, gc, p, points, CoordModeOrigin);
my_free(_ALLOC_ID_, &p);
} }
XDrawLines(display, xctx->window, gc, p, points, CoordModeOrigin);
my_free(_ALLOC_ID_, &p);
} }
} }
} }
@ -4140,8 +4162,10 @@ void draw(void)
drawarc(cc, ADD, a->x, a->y, a->r, a->a, a->b, a->fill, a->dash); drawarc(cc, ADD, a->x, a->y, a->r, a->a, a->b, a->fill, a->dash);
} }
if(xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c]; ++i) { if(xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c]; ++i) {
int bezier;
xPoly *p = &xctx->poly[c][i]; xPoly *p = &xctx->poly[c][i];
drawpolygon(cc, NOW, p->x, p->y, p->points, p->fill, p->dash); bezier = !strboolcmp(get_tok_value(p->prop_ptr, "bezier", 0), "true");
drawpolygon(cc, NOW, p->x, p->y, p->points, p->fill, p->dash, bezier);
} }
if(use_hash) init_inst_iterator(&ctx, x1, y1, x2, y2); if(use_hash) init_inst_iterator(&ctx, x1, y1, x2, y2);
else i = -1; else i = -1;

View File

@ -1131,6 +1131,7 @@ static int edit_arc_property(void)
static int edit_polygon_property(void) static int edit_polygon_property(void)
{ {
int old_fill; int old_fill;
int oldbezier, bezier;
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, old_dash; int c, i, ii, old_dash;
@ -1159,6 +1160,7 @@ static int edit_polygon_property(void)
i = xctx->sel_array[ii].n; i = xctx->sel_array[ii].n;
c = xctx->sel_array[ii].col; c = xctx->sel_array[ii].col;
oldbezier = !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr,"bezier",0),"true") ;
if(oldprop && preserve == 1) { if(oldprop && preserve == 1) {
set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
@ -1166,6 +1168,7 @@ static int edit_polygon_property(void)
} }
old_fill = xctx->poly[c][i].fill; old_fill = xctx->poly[c][i].fill;
old_dash = xctx->poly[c][i].dash; old_dash = xctx->poly[c][i].dash;
bezier = !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr,"bezier",0),"true") ;
if( !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr,"fill",0),"true") ) if( !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr,"fill",0),"true") )
xctx->poly[c][i].fill =1; xctx->poly[c][i].fill =1;
else else
@ -1176,7 +1179,7 @@ static int edit_polygon_property(void)
xctx->poly[c][i].dash = (short)(d >= 0 ? d : 0); xctx->poly[c][i].dash = (short)(d >= 0 ? d : 0);
} else } else
xctx->poly[c][i].dash = 0; xctx->poly[c][i].dash = 0;
if(old_fill != xctx->poly[c][i].fill || old_dash != xctx->poly[c][i].dash) { if(old_fill != xctx->poly[c][i].fill || old_dash != xctx->poly[c][i].dash || oldbezier != bezier) {
if(!drw) { if(!drw) {
bbox(START,0.0,0.0,0.0,0.0); bbox(START,0.0,0.0,0.0,0.0);
drw = 1; drw = 1;
@ -1187,7 +1190,7 @@ static int edit_polygon_property(void)
if(k==0 || xctx->poly[c][i].x[k] > x2) x2 = xctx->poly[c][i].x[k]; if(k==0 || xctx->poly[c][i].x[k] > x2) x2 = xctx->poly[c][i].x[k];
if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k]; if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k];
} }
bbox(ADD, x1, y1, x2, y2); bbox(ADD, x1-cadhalfdotsize, y1-cadhalfdotsize, x2+cadhalfdotsize, y2+cadhalfdotsize);
} }
} }
if(drw) { if(drw) {

View File

@ -305,8 +305,10 @@ void draw_selection(GC g, int interruptable)
break; break;
case POLYGON: case POLYGON:
{ {
int bezier;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points);
bezier = !strboolcmp(get_tok_value(xctx->poly[c][n].prop_ptr, "bezier", 0), "true");
if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) { if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) {
for(k=0;k<xctx->poly[c][n].points; ++k) { for(k=0;k<xctx->poly[c][n].points; ++k) {
if( xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].selected_point[k]) { if( xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].selected_point[k]) {
@ -324,7 +326,7 @@ void draw_selection(GC g, int interruptable)
y[k] = xctx->poly[c][n].y[k]; y[k] = xctx->poly[c][n].y[k];
} }
} }
drawtemppolygon(g, NOW, x, y, xctx->poly[c][n].points); drawtemppolygon(g, NOW, x, y, xctx->poly[c][n].points, bezier);
} }
my_free(_ALLOC_ID_, &x); my_free(_ALLOC_ID_, &x);
my_free(_ALLOC_ID_, &y); my_free(_ALLOC_ID_, &y);

View File

@ -1300,7 +1300,10 @@ int table_read(const char *f)
} }
line_ptr = line; line_ptr = line;
while(*line_ptr) { /* non empty line ? */ while(*line_ptr) { /* non empty line ? */
if(*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\n') empty = 0; if(*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\n') {
empty = 0;
break;
}
line_ptr++; line_ptr++;
} }
if(empty) { if(empty) {
@ -1317,9 +1320,9 @@ int table_read(const char *f)
line_ptr = line; line_ptr = line;
field = 0; field = 0;
#ifdef __unix__ #ifdef __unix__
while( (line_tok = strtok_r(line_ptr, " \t\n", &line_save)) ) { while( (line_tok = strtok_r(line_ptr, ", \t\n", &line_save)) ) {
#else #else
while( (line_tok = my_strtok_r(line_ptr, " \t\n", "", 0, &line_save)) ) { while( (line_tok = my_strtok_r(line_ptr, ", \t\n", "", 0, &line_save)) ) {
#endif #endif
line_ptr = NULL; line_ptr = NULL;
/* dbg(1,"%s ", line_tok); */ /* dbg(1,"%s ", line_tok); */

View File

@ -5212,7 +5212,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* test /* test
* Testmode ... */ * Testmode ... */
else if(0 && !strcmp(argv[1], "test") ) else if(1 && !strcmp(argv[1], "test") )
{ {
Iterator_ctx ctx; Iterator_ctx ctx;
Objectentry *objectptr; Objectentry *objectptr;
@ -5264,7 +5264,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }
else if(argc > 2 && atoi(argv[2]) == 3) { else if(argc > 2 && atoi(argv[2]) == 3) {
drawbezier();
} }
} }

View File

@ -867,9 +867,13 @@ void unselect_all(int dr)
if(xctx->poly[c][i].sel) if(xctx->poly[c][i].sel)
{ {
int k; int k;
int bezier = !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr, "bezier", 0), "true");
for(k=0;k<xctx->poly[c][i].points; ++k) xctx->poly[c][i].selected_point[k] = 0; for(k=0;k<xctx->poly[c][i].points; ++k) xctx->poly[c][i].selected_point[k] = 0;
xctx->poly[c][i].sel = 0; xctx->poly[c][i].sel = 0;
if(dr) drawtemppolygon(xctx->gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points); if(dr) {
drawtemppolygon(xctx->gctiled, NOW,
xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, bezier);
}
} }
} }
} }
@ -1094,6 +1098,7 @@ void select_polygon(int c, int i, unsigned short select_mode, int fast )
{ {
char str[1024]; /* overflow safe */ char str[1024]; /* overflow safe */
char s[256]; /* overflow safe */ char s[256]; /* overflow safe */
int bezier;
if(!fast) if(!fast)
{ {
my_strncpy(s,xctx->poly[c][i].prop_ptr!=NULL?xctx->poly[c][i].prop_ptr:"<NULL>",S(s)); my_strncpy(s,xctx->poly[c][i].prop_ptr!=NULL?xctx->poly[c][i].prop_ptr:"<NULL>",S(s));
@ -1104,12 +1109,15 @@ void select_polygon(int c, int i, unsigned short select_mode, int fast )
my_snprintf(str, S(str), "n=%4d x0 = %.16g y0 = %.16g ...", i, xctx->poly[c][i].x[0], xctx->poly[c][i].y[0]); my_snprintf(str, S(str), "n=%4d x0 = %.16g y0 = %.16g ...", i, xctx->poly[c][i].x[0], xctx->poly[c][i].y[0]);
statusmsg(str,1); statusmsg(str,1);
} }
bezier = !strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr, "bezier", 0), "true");
xctx->poly[c][i].sel = select_mode; xctx->poly[c][i].sel = select_mode;
if(select_mode) { if(select_mode) {
drawtemppolygon(xctx->gc[SELLAYER], NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points); drawtemppolygon(xctx->gc[SELLAYER], NOW,
xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, bezier);
} }
else { else {
drawtemppolygon(xctx->gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points); drawtemppolygon(xctx->gctiled, NOW,
xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, bezier);
} }
if(xctx->poly[c][i].sel == SELECTED) set_first_sel(POLYGON, i, c); if(xctx->poly[c][i].sel == SELECTED) set_first_sel(POLYGON, i, c);
xctx->need_reb_sel_arr=1; xctx->need_reb_sel_arr=1;

View File

@ -1389,9 +1389,8 @@ extern void drawtemprect(GC gc, int what, double rectx1,double recty1,
extern void drawtemparc(GC gc, int what, double x, double y, double r, double a, double b); extern void drawtemparc(GC gc, int what, double x, double y, double r, double a, double b);
extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash); extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash);
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, int flags);
extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash); extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash, int flags);
extern void drawbezier(void);
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,
short tmp_flip, short tmp_rot, double xoffset, double yoffset); short tmp_flip, short tmp_rot, double xoffset, double yoffset);
extern void draw_temp_string(GC gc,int what, const char *str, short rot, short flip, int hcenter, int vcenter, extern void draw_temp_string(GC gc,int what, const char *str, short rot, short flip, int hcenter, int vcenter,