transform get_attr_val() to return a double instead of an int, use -1.0 for "bus" attribute, otherwise use positive double values to indicate actual line widths. This allows specifying custom widths in the future, but still maintaining compatibility with bus=1. "bus" struct members are thus doubles now
This commit is contained in:
parent
86ec0d567f
commit
cf7a74bc99
|
|
@ -2812,7 +2812,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
||||||
if(!xctx->hilight_nets || !xctx->wire[i].node ||
|
if(!xctx->hilight_nets || !xctx->wire[i].node ||
|
||||||
!xctx->wire[i].node[0] || !bus_hilight_hash_lookup(xctx->wire[i].node, 0,XLOOKUP)) continue;
|
!xctx->wire[i].node[0] || !bus_hilight_hash_lookup(xctx->wire[i].node, 0,XLOOKUP)) continue;
|
||||||
}
|
}
|
||||||
if(xctx->wire[i].bus){
|
if(xctx->wire[i].bus == -1.0){
|
||||||
ov = INT_BUS_WIDTH(xctx->lw)> xctx->cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
ov = INT_BUS_WIDTH(xctx->lw)> xctx->cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
||||||
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
|
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
|
||||||
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
|
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
|
||||||
|
|
|
||||||
14
src/draw.c
14
src/draw.c
|
|
@ -733,7 +733,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
||||||
ROTATION(rot, flip, 0.0, 0.0,line->x1,line->y1,x1,y1);
|
ROTATION(rot, flip, 0.0, 0.0,line->x1,line->y1,x1,y1);
|
||||||
ROTATION(rot, flip, 0.0, 0.0,line->x2,line->y2,x2,y2);
|
ROTATION(rot, flip, 0.0, 0.0,line->x2,line->y2,x2,y2);
|
||||||
ORDER(x1,y1,x2,y2);
|
ORDER(x1,y1,x2,y2);
|
||||||
if(line->bus)
|
if(line->bus == -1.0)
|
||||||
drawline(c,THICK, x0+x1, y0+y1, x0+x2, y0+y2, dash, NULL);
|
drawline(c,THICK, x0+x1, y0+y1, x0+x2, y0+y2, dash, NULL);
|
||||||
else
|
else
|
||||||
drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, dash, NULL);
|
drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, dash, NULL);
|
||||||
|
|
@ -744,7 +744,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
||||||
int bezier;
|
int bezier;
|
||||||
int bus;
|
int bus;
|
||||||
polygon = &(symptr->poly[layer])[j];
|
polygon = &(symptr->poly[layer])[j];
|
||||||
bus = polygon->bus ? THICK : NOW;
|
bus = (polygon->bus == -1.0) ? THICK : NOW;
|
||||||
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
|
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);
|
||||||
|
|
@ -984,7 +984,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
||||||
ROTATION(rot, flip, 0.0, 0.0,line->x1,line->y1,x1,y1);
|
ROTATION(rot, flip, 0.0, 0.0,line->x1,line->y1,x1,y1);
|
||||||
ROTATION(rot, flip, 0.0, 0.0,line->x2,line->y2,x2,y2);
|
ROTATION(rot, flip, 0.0, 0.0,line->x2,line->y2,x2,y2);
|
||||||
ORDER(x1,y1,x2,y2);
|
ORDER(x1,y1,x2,y2);
|
||||||
if(line->bus)
|
if(line->bus == -1.0)
|
||||||
drawtempline(gc,THICK, x0+x1, y0+y1, x0+x2, y0+y2);
|
drawtempline(gc,THICK, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||||
else
|
else
|
||||||
drawtempline(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
drawtempline(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||||
|
|
@ -5157,7 +5157,7 @@ void draw(void)
|
||||||
cc = c; if(xctx->only_probes) cc = GRIDLAYER;
|
cc = c; if(xctx->only_probes) cc = GRIDLAYER;
|
||||||
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->lines[c]; ++i) {
|
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->lines[c]; ++i) {
|
||||||
xLine *l = &xctx->line[c][i];
|
xLine *l = &xctx->line[c][i];
|
||||||
if(l->bus) drawline(cc, THICK, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
if(l->bus == -1.0) drawline(cc, THICK, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
||||||
else drawline(cc, ADD, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
else drawline(cc, ADD, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
||||||
}
|
}
|
||||||
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->rects[c]; ++i) {
|
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->rects[c]; ++i) {
|
||||||
|
|
@ -5180,9 +5180,9 @@ void draw(void)
|
||||||
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c]; ++i) {
|
if(draw_layer && xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c]; ++i) {
|
||||||
int bezier;
|
int bezier;
|
||||||
xPoly *p = &xctx->poly[c][i];
|
xPoly *p = &xctx->poly[c][i];
|
||||||
int bus = p->bus ? THICK : NOW;
|
int what = (p->bus == -1.0) ? THICK : NOW;
|
||||||
bezier = 2 + !strboolcmp(get_tok_value(p->prop_ptr, "bezier", 0), "true");
|
bezier = 2 + !strboolcmp(get_tok_value(p->prop_ptr, "bezier", 0), "true");
|
||||||
drawpolygon(cc, bus, p->x, p->y, p->points, p->fill, p->dash, bezier);
|
drawpolygon(cc, what, 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;
|
||||||
|
|
@ -5232,7 +5232,7 @@ void draw(void)
|
||||||
++i;
|
++i;
|
||||||
if(i >= xctx->wires) break;
|
if(i >= xctx->wires) break;
|
||||||
}
|
}
|
||||||
if(xctx->wire[i].bus) {
|
if(xctx->wire[i].bus == -1.0) {
|
||||||
drawline(cc, THICK, xctx->wire[i].x1,xctx->wire[i].y1,
|
drawline(cc, THICK, xctx->wire[i].x1,xctx->wire[i].y1,
|
||||||
xctx->wire[i].x2,xctx->wire[i].y2, 0, NULL);
|
xctx->wire[i].x2,xctx->wire[i].y2, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,23 +79,27 @@ int my_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
return tolower(*s1) - tolower(*s2);
|
return tolower(*s1) - tolower(*s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if s is an integer return integer value
|
/* if s is an double return double value
|
||||||
* else if s == (true | on | yes) return 1
|
* else if s == ( 1 | true | on | yes) return -1.0
|
||||||
* else if s == (false | off | no) return 0
|
* else if s == (false | off | no) return 0.0
|
||||||
* else return 0
|
* else return 0.0
|
||||||
*/
|
*/
|
||||||
int get_attr_val(const char *str)
|
double get_attr_val(const char *str)
|
||||||
{
|
{
|
||||||
int s = 0;
|
double s = 0.0;
|
||||||
if(isonlydigit(str)) {
|
char *endptr;
|
||||||
s = atoi(str);
|
|
||||||
}
|
if(!str) return 0.0;
|
||||||
else if(!my_strcasecmp(str, "true") ||
|
else if(!my_strcasecmp(str, "true") ||
|
||||||
|
!my_strcasecmp(str, "1") ||
|
||||||
!my_strcasecmp(str, "on") ||
|
!my_strcasecmp(str, "on") ||
|
||||||
!my_strcasecmp(str, "yes")) s = 1;
|
!my_strcasecmp(str, "yes")) s = -1.0;
|
||||||
else if(!my_strcasecmp(str, "false") ||
|
else if(!my_strcasecmp(str, "false") ||
|
||||||
!my_strcasecmp(str, "off") ||
|
!my_strcasecmp(str, "off") ||
|
||||||
!my_strcasecmp(str, "no")) s = 0;
|
!my_strcasecmp(str, "no")) s = 0.0;
|
||||||
|
else if((strtod(str, &endptr), endptr) > str) { /* NUMBER */
|
||||||
|
s = atof(str);
|
||||||
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
@ -1156,7 +1160,7 @@ static int edit_wire_property(void)
|
||||||
int i, modified = 0;
|
int i, modified = 0;
|
||||||
int preserve;
|
int preserve;
|
||||||
char *oldprop=NULL;
|
char *oldprop=NULL;
|
||||||
int bus;
|
double bus;
|
||||||
|
|
||||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr);
|
my_strdup(_ALLOC_ID_, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr);
|
||||||
if(oldprop && oldprop[0]) {
|
if(oldprop && oldprop[0]) {
|
||||||
|
|
@ -1173,7 +1177,7 @@ static int edit_wire_property(void)
|
||||||
xctx->push_undo();
|
xctx->push_undo();
|
||||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||||
for(i=0; i<xctx->lastsel; ++i) {
|
for(i=0; i<xctx->lastsel; ++i) {
|
||||||
int oldbus=0;
|
double oldbus=0.0;
|
||||||
int k = xctx->sel_array[i].n;
|
int k = xctx->sel_array[i].n;
|
||||||
if(xctx->sel_array[i].type != WIRE) continue;
|
if(xctx->sel_array[i].type != WIRE) continue;
|
||||||
/* does not seem to be necessary */
|
/* does not seem to be necessary */
|
||||||
|
|
@ -1187,7 +1191,7 @@ static int edit_wire_property(void)
|
||||||
my_strdup(_ALLOC_ID_, &xctx->wire[k].prop_ptr,(char *) tclgetvar("tctx::retval"));
|
my_strdup(_ALLOC_ID_, &xctx->wire[k].prop_ptr,(char *) tclgetvar("tctx::retval"));
|
||||||
}
|
}
|
||||||
xctx->wire[k].bus = bus = get_attr_val(get_tok_value(xctx->wire[k].prop_ptr,"bus",0));
|
xctx->wire[k].bus = bus = get_attr_val(get_tok_value(xctx->wire[k].prop_ptr,"bus",0));
|
||||||
if(bus) {
|
if(bus == -1.0) {
|
||||||
double ov, y1, y2;
|
double ov, y1, y2;
|
||||||
ov = INT_BUS_WIDTH(xctx->lw) > xctx->cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
ov = INT_BUS_WIDTH(xctx->lw) > xctx->cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
||||||
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
|
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
|
||||||
|
|
@ -1288,8 +1292,8 @@ static int edit_polygon_property(void)
|
||||||
int old_fill;
|
int old_fill;
|
||||||
int oldbezier, bezier;
|
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., oldbus = 0.0, bus = 0.0;
|
||||||
int c, i, ii, old_dash, oldbus, bus;
|
int c, i, ii, old_dash;
|
||||||
int drw = 0;
|
int drw = 0;
|
||||||
char *oldprop = NULL;
|
char *oldprop = NULL;
|
||||||
const char *dash;
|
const char *dash;
|
||||||
|
|
|
||||||
|
|
@ -2226,7 +2226,7 @@ void draw_hilight_net(int on_window)
|
||||||
if(i >= xctx->wires) break;
|
if(i >= xctx->wires) break;
|
||||||
}
|
}
|
||||||
if( (entry = bus_hilight_hash_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
if( (entry = bus_hilight_hash_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
||||||
if(xctx->wire[i].bus)
|
if(xctx->wire[i].bus == -1.0)
|
||||||
drawline(get_color(entry->value), THICK,
|
drawline(get_color(entry->value), THICK,
|
||||||
xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0, NULL);
|
xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0, NULL);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
12
src/move.c
12
src/move.c
|
|
@ -382,7 +382,7 @@ void draw_selection(GC g, int interruptable)
|
||||||
double x2 = xctx->rx2 + xctx->deltax;
|
double x2 = xctx->rx2 + xctx->deltax;
|
||||||
double y2 = xctx->ry2 + xctx->deltay;
|
double y2 = xctx->ry2 + xctx->deltay;
|
||||||
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
||||||
if(xctx->wire[n].bus) {
|
if(xctx->wire[n].bus == -1.0) {
|
||||||
drawtemp_manhattanline(g, THICK, x1, y1, x2, y2, 1);
|
drawtemp_manhattanline(g, THICK, x1, y1, x2, y2, 1);
|
||||||
} else {
|
} else {
|
||||||
drawtemp_manhattanline(g, ADD, x1, y1, x2, y2, 1);
|
drawtemp_manhattanline(g, ADD, x1, y1, x2, y2, 1);
|
||||||
|
|
@ -395,7 +395,7 @@ void draw_selection(GC g, int interruptable)
|
||||||
double x2 = xctx->rx2;
|
double x2 = xctx->rx2;
|
||||||
double y2 = xctx->ry2;
|
double y2 = xctx->ry2;
|
||||||
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
||||||
if(xctx->wire[n].bus) {
|
if(xctx->wire[n].bus == -1.0) {
|
||||||
drawtemp_manhattanline(g, THICK, x2, y2, x1, y1, 1);
|
drawtemp_manhattanline(g, THICK, x2, y2, x1, y1, 1);
|
||||||
} else {
|
} else {
|
||||||
drawtemp_manhattanline(g, ADD, x2, y2, x1, y1, 1);
|
drawtemp_manhattanline(g, ADD, x2, y2, x1, y1, 1);
|
||||||
|
|
@ -408,7 +408,7 @@ void draw_selection(GC g, int interruptable)
|
||||||
double x2 = xctx->rx2 + xctx->deltax;
|
double x2 = xctx->rx2 + xctx->deltax;
|
||||||
double y2 = xctx->ry2 + xctx->deltay;
|
double y2 = xctx->ry2 + xctx->deltay;
|
||||||
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
dbg(1, "draw_selection() wire: %g %g - %g %g manhattan=%d\n", x1, y1, x2, y2, xctx->manhattan_lines);
|
||||||
if(xctx->wire[n].bus) {
|
if(xctx->wire[n].bus == -1.0) {
|
||||||
drawtemp_manhattanline(g, THICK, x1, y1, x2, y2, 1);
|
drawtemp_manhattanline(g, THICK, x1, y1, x2, y2, 1);
|
||||||
} else {
|
} else {
|
||||||
drawtemp_manhattanline(g, ADD, x1, y1, x2, y2, 1);
|
drawtemp_manhattanline(g, ADD, x1, y1, x2, y2, 1);
|
||||||
|
|
@ -430,7 +430,7 @@ void draw_selection(GC g, int interruptable)
|
||||||
ORDER(xctx->rx1,xctx->ry1,xctx->rx2,xctx->ry2);
|
ORDER(xctx->rx1,xctx->ry1,xctx->rx2,xctx->ry2);
|
||||||
if(xctx->line[c][n].sel==SELECTED)
|
if(xctx->line[c][n].sel==SELECTED)
|
||||||
{
|
{
|
||||||
if(xctx->line[c][n].bus)
|
if(xctx->line[c][n].bus == -1.0)
|
||||||
drawtempline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
drawtempline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||||
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
||||||
else
|
else
|
||||||
|
|
@ -439,14 +439,14 @@ void draw_selection(GC g, int interruptable)
|
||||||
}
|
}
|
||||||
else if(xctx->line[c][n].sel==SELECTED1)
|
else if(xctx->line[c][n].sel==SELECTED1)
|
||||||
{
|
{
|
||||||
if(xctx->line[c][n].bus)
|
if(xctx->line[c][n].bus == -1.0)
|
||||||
drawtempline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
|
drawtempline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
|
||||||
else
|
else
|
||||||
drawtempline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
|
drawtempline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
|
||||||
}
|
}
|
||||||
else if(xctx->line[c][n].sel==SELECTED2)
|
else if(xctx->line[c][n].sel==SELECTED2)
|
||||||
{
|
{
|
||||||
if(xctx->line[c][n].bus)
|
if(xctx->line[c][n].bus == -1.0)
|
||||||
drawtempline(g, THICK, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
drawtempline(g, THICK, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
||||||
else
|
else
|
||||||
drawtempline(g, ADD, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
drawtempline(g, ADD, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ static void ps_drawbezier(double *x, double *y, int points)
|
||||||
/* Convex Nonconvex Complex */
|
/* Convex Nonconvex Complex */
|
||||||
#define Polygontype Nonconvex
|
#define Polygontype Nonconvex
|
||||||
static void ps_drawpolygon(int c, int what, double *x, double *y, int points,
|
static void ps_drawpolygon(int c, int what, double *x, double *y, int points,
|
||||||
int poly_fill, int dash, int flags, int bus)
|
int poly_fill, int dash, int flags, double bus)
|
||||||
{
|
{
|
||||||
double x1,y1,x2,y2;
|
double x1,y1,x2,y2;
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
|
|
@ -539,7 +539,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points,
|
||||||
if(dash) {
|
if(dash) {
|
||||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||||
}
|
}
|
||||||
if(bus) set_lw(BUS_WIDTH * xctx->lw);
|
if(bus == -1.0) set_lw(BUS_WIDTH * xctx->lw);
|
||||||
bezier = flags && (points > 2);
|
bezier = flags && (points > 2);
|
||||||
if(bezier) {
|
if(bezier) {
|
||||||
ps_drawbezier(x, y, points);
|
ps_drawbezier(x, y, points);
|
||||||
|
|
@ -559,7 +559,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points,
|
||||||
if(dash) {
|
if(dash) {
|
||||||
fprintf(fd, "[] 0 setdash\n");
|
fprintf(fd, "[] 0 setdash\n");
|
||||||
}
|
}
|
||||||
if(bus) set_lw(xctx->lw);
|
if(bus == -1.0) set_lw(xctx->lw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -634,7 +634,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ps_drawline(int gc, double linex1,double liney1,double linex2,double liney2, int dash, int bus)
|
static void ps_drawline(int gc, double linex1,double liney1,double linex2,double liney2, int dash, double bus)
|
||||||
{
|
{
|
||||||
double x1,y1,x2,y2;
|
double x1,y1,x2,y2;
|
||||||
double psdash;
|
double psdash;
|
||||||
|
|
@ -647,10 +647,10 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double
|
||||||
{
|
{
|
||||||
psdash = dash / xctx->zoom;
|
psdash = dash / xctx->zoom;
|
||||||
if(dash) fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
if(dash) fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||||
if(bus) set_lw(xctx->lw * BUS_WIDTH);
|
if(bus == -1.0) set_lw(xctx->lw * BUS_WIDTH);
|
||||||
ps_xdrawline(gc, x1, y1, x2, y2);
|
ps_xdrawline(gc, x1, y1, x2, y2);
|
||||||
if(dash) fprintf(fd, "[] 0 setdash\n");
|
if(dash) fprintf(fd, "[] 0 setdash\n");
|
||||||
if(bus) set_lw(xctx->lw);
|
if(bus == -1.0) set_lw(xctx->lw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1904,7 +1904,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c
|
||||||
else if(!strcmp(n, "exch()")) stack1[stackptr1++].i = EXCH;
|
else if(!strcmp(n, "exch()")) stack1[stackptr1++].i = EXCH;
|
||||||
else if(!strcmp(n, "dup()")) stack1[stackptr1++].i = DUP;
|
else if(!strcmp(n, "dup()")) stack1[stackptr1++].i = DUP;
|
||||||
else if(!strcmp(n, "idx()")) stack1[stackptr1++].i = IDX;
|
else if(!strcmp(n, "idx()")) stack1[stackptr1++].i = IDX;
|
||||||
else if( (strtod(n, &endptr)), endptr > n) { /* NUMBER */
|
else if( (strtod(n, &endptr), endptr) > n) { /* NUMBER */
|
||||||
stack1[stackptr1].i = NUMBER;
|
stack1[stackptr1].i = NUMBER;
|
||||||
stack1[stackptr1++].d = atof_spice(n);
|
stack1[stackptr1++].d = atof_spice(n);
|
||||||
}
|
}
|
||||||
|
|
@ -2812,7 +2812,7 @@ static void load_wire(FILE *fd)
|
||||||
}
|
}
|
||||||
ptr[i].prop_ptr = NULL;
|
ptr[i].prop_ptr = NULL;
|
||||||
ptr[i].end1 = ptr[i].end2 = ptr[i].sel = 0;
|
ptr[i].end1 = ptr[i].end2 = ptr[i].sel = 0;
|
||||||
ptr[i].bus = 0;
|
ptr[i].bus = 0.0;
|
||||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||||
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
||||||
ptr[i].bus = get_attr_val(get_tok_value(ptr[i].prop_ptr, "bus", 0));
|
ptr[i].bus = get_attr_val(get_tok_value(ptr[i].prop_ptr, "bus", 0));
|
||||||
|
|
|
||||||
12
src/select.c
12
src/select.c
|
|
@ -795,7 +795,7 @@ void unselect_all(int dr)
|
||||||
xctx->wire[i].sel = 0;
|
xctx->wire[i].sel = 0;
|
||||||
{
|
{
|
||||||
if(dr) {
|
if(dr) {
|
||||||
if(xctx->wire[i].bus)
|
if(xctx->wire[i].bus == -1.0)
|
||||||
drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
||||||
xctx->wire[i].x2, xctx->wire[i].y2);
|
xctx->wire[i].x2, xctx->wire[i].y2);
|
||||||
else
|
else
|
||||||
|
|
@ -861,7 +861,7 @@ void unselect_all(int dr)
|
||||||
{
|
{
|
||||||
xctx->line[c][i].sel = 0;
|
xctx->line[c][i].sel = 0;
|
||||||
if(dr) {
|
if(dr) {
|
||||||
if(xctx->line[c][i].bus)
|
if(xctx->line[c][i].bus == -1.0)
|
||||||
drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||||
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
||||||
else
|
else
|
||||||
|
|
@ -926,7 +926,7 @@ void select_wire(int i,unsigned short select_mode, int fast, int override_lock)
|
||||||
if( xctx->wire[i].sel == SELECTED) set_first_sel(WIRE, i, 0);
|
if( xctx->wire[i].sel == SELECTED) set_first_sel(WIRE, i, 0);
|
||||||
if(select_mode) {
|
if(select_mode) {
|
||||||
dbg(1, "select(): wire[%d].end1=%d, ,end2=%d\n", i, xctx->wire[i].end1, xctx->wire[i].end2);
|
dbg(1, "select(): wire[%d].end1=%d, ,end2=%d\n", i, xctx->wire[i].end1, xctx->wire[i].end2);
|
||||||
if(xctx->wire[i].bus) {
|
if(xctx->wire[i].bus == -1.0) {
|
||||||
if(!(fast & 2)) drawtempline(xctx->gc[SELLAYER], THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
if(!(fast & 2)) drawtempline(xctx->gc[SELLAYER], THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
||||||
xctx->wire[i].x2, xctx->wire[i].y2);
|
xctx->wire[i].x2, xctx->wire[i].y2);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -935,7 +935,7 @@ void select_wire(int i,unsigned short select_mode, int fast, int override_lock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(xctx->wire[i].bus) {
|
if(xctx->wire[i].bus == -1.0) {
|
||||||
if(!(fast & 2)) drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
if(!(fast & 2)) drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
|
||||||
xctx->wire[i].x2, xctx->wire[i].y2);
|
xctx->wire[i].x2, xctx->wire[i].y2);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1253,7 +1253,7 @@ void select_line(int c, int i, unsigned short select_mode, int fast, int overrid
|
||||||
}
|
}
|
||||||
if(xctx->line[c][i].sel == SELECTED) set_first_sel(LINE, i, c);
|
if(xctx->line[c][i].sel == SELECTED) set_first_sel(LINE, i, c);
|
||||||
if(select_mode) {
|
if(select_mode) {
|
||||||
if(xctx->line[c][i].bus) {
|
if(xctx->line[c][i].bus == -1.0) {
|
||||||
if(!(fast & 2)) drawtempline(xctx->gc[SELLAYER], THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
if(!(fast & 2)) drawtempline(xctx->gc[SELLAYER], THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||||
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1262,7 +1262,7 @@ void select_line(int c, int i, unsigned short select_mode, int fast, int overrid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(xctx->line[c][i].bus) {
|
if(xctx->line[c][i].bus == -1.0) {
|
||||||
if(!(fast & 2)) drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
if(!(fast & 2)) drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||||
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||||
my_strdup(_ALLOC_ID_, &xctx->line[rectc][n].prop_ptr, prop_ptr);
|
my_strdup(_ALLOC_ID_, &xctx->line[rectc][n].prop_ptr, prop_ptr);
|
||||||
xctx->line[rectc][n].sel=sel;
|
xctx->line[rectc][n].sel=sel;
|
||||||
if(sel == SELECTED) set_first_sel(LINE, n, rectc);
|
if(sel == SELECTED) set_first_sel(LINE, n, rectc);
|
||||||
xctx->line[rectc][n].bus = 0;
|
xctx->line[rectc][n].bus = 0.0;
|
||||||
if(prop_ptr) {
|
if(prop_ptr) {
|
||||||
xctx->line[rectc][n].bus = get_attr_val(get_tok_value(prop_ptr, "bus", 0));
|
xctx->line[rectc][n].bus = get_attr_val(get_tok_value(prop_ptr, "bus", 0));
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +342,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||||
xctx->wire[n].end1=0;
|
xctx->wire[n].end1=0;
|
||||||
xctx->wire[n].end2=0;
|
xctx->wire[n].end2=0;
|
||||||
my_strdup(_ALLOC_ID_, &xctx->wire[n].prop_ptr, prop_ptr);
|
my_strdup(_ALLOC_ID_, &xctx->wire[n].prop_ptr, prop_ptr);
|
||||||
xctx->wire[n].bus = 0;
|
xctx->wire[n].bus = 0.0;
|
||||||
if(prop_ptr) {
|
if(prop_ptr) {
|
||||||
xctx->wire[n].bus = get_attr_val(get_tok_value(prop_ptr,"bus",0));
|
xctx->wire[n].bus = get_attr_val(get_tok_value(prop_ptr,"bus",0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ static void svg_restore_lw(void)
|
||||||
svg_linew = (xctx->lw <= 0.01 ? 0.2 : xctx->lw) * 1.2;
|
svg_linew = (xctx->lw <= 0.01 ? 0.2 : xctx->lw) * 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void svg_xdrawline(int layer, int bus, double x1, double y1, double x2, double y2, int dash)
|
static void svg_xdrawline(int layer, double bus, double x1, double y1, double x2, double y2, int dash)
|
||||||
{
|
{
|
||||||
fprintf(fd,"<path class=\"l%d\" ", layer);
|
fprintf(fd,"<path class=\"l%d\" ", layer);
|
||||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||||
if(bus) fprintf(fd, "style=\"stroke-width:%g;\" ", BUS_WIDTH * svg_linew);
|
if(bus == -1.0) fprintf(fd, "style=\"stroke-width:%g;\" ", BUS_WIDTH * svg_linew);
|
||||||
fprintf(fd,"d=\"M%g %gL%g %g\"/>\n", x1, y1, x2, y2);
|
fprintf(fd,"d=\"M%g %gL%g %g\"/>\n", x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ static void svg_drawbezier(double *x, double *y, int points)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void svg_drawpolygon(int c, int what, double *x, double *y, int points,
|
static void svg_drawpolygon(int c, int what, double *x, double *y, int points,
|
||||||
int fill, int dash, int flags, int bus)
|
int fill, int dash, int flags, double bus)
|
||||||
{
|
{
|
||||||
double x1,y1,x2,y2;
|
double x1,y1,x2,y2;
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
|
|
@ -134,8 +134,8 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points,
|
||||||
}
|
}
|
||||||
fprintf(fd, "<path class=\"l%d\" ", c);
|
fprintf(fd, "<path class=\"l%d\" ", c);
|
||||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||||
if(bus || fill == 0 || fill == 2) {
|
if(bus == -1.0 || fill == 0 || fill == 2) {
|
||||||
if(bus) fprintf(fd, "style=\"stroke-width:%g; ", BUS_WIDTH * svg_linew);
|
if(bus == -1.0) fprintf(fd, "style=\"stroke-width:%g; ", BUS_WIDTH * svg_linew);
|
||||||
else fprintf(fd, "style=\"");
|
else fprintf(fd, "style=\"");
|
||||||
if(fill == 0) {
|
if(fill == 0) {
|
||||||
fprintf(fd,"fill:none;\" ");
|
fprintf(fd,"fill:none;\" ");
|
||||||
|
|
@ -282,7 +282,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void svg_drawline(int gc, int bus, double linex1,double liney1,double linex2,double liney2, int dash)
|
static void svg_drawline(int gc, double bus, double linex1,double liney1,double linex2,double liney2, int dash)
|
||||||
{
|
{
|
||||||
double x1,y1,x2,y2;
|
double x1,y1,x2,y2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ typedef struct
|
||||||
short sel;
|
short sel;
|
||||||
char *node;
|
char *node;
|
||||||
char *prop_ptr;
|
char *prop_ptr;
|
||||||
int bus; /* 20171201 cache here wire "bus" property, to avoid too many get_tok_value() calls */
|
double bus; /* 20171201 cache here wire "bus" property, to avoid too many get_tok_value() calls */
|
||||||
} xWire;
|
} xWire;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
@ -471,7 +471,7 @@ typedef struct
|
||||||
unsigned short sel;
|
unsigned short sel;
|
||||||
char *prop_ptr;
|
char *prop_ptr;
|
||||||
short dash;
|
short dash;
|
||||||
int bus;
|
double bus;
|
||||||
} xLine;
|
} xLine;
|
||||||
|
|
||||||
#if HAS_CAIRO==1
|
#if HAS_CAIRO==1
|
||||||
|
|
@ -519,7 +519,7 @@ typedef struct
|
||||||
char *prop_ptr;
|
char *prop_ptr;
|
||||||
short fill;
|
short fill;
|
||||||
short dash;
|
short dash;
|
||||||
int bus;
|
double bus;
|
||||||
} xPoly;
|
} xPoly;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
@ -1671,7 +1671,7 @@ extern char *my_strtok_r(char *str, const char *delim, const char *quote, int ke
|
||||||
extern char **parse_cmd_string(const char *cmd, int *argc);
|
extern char **parse_cmd_string(const char *cmd, int *argc);
|
||||||
extern int my_strncpy(char *d, const char *s, size_t n);
|
extern int my_strncpy(char *d, const char *s, size_t n);
|
||||||
extern int my_strcasecmp(const char *s1, const char *s2);
|
extern int my_strcasecmp(const char *s1, const char *s2);
|
||||||
extern int get_attr_val(const char *str);
|
extern double get_attr_val(const char *str);
|
||||||
extern int strboolcmp(const char *str, const char *boolean);
|
extern int strboolcmp(const char *str, const char *boolean);
|
||||||
extern char *my_strcasestr(const char *haystack, const char *needle);
|
extern char *my_strcasestr(const char *haystack, const char *needle);
|
||||||
extern double mylog10(double x);
|
extern double mylog10(double x);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue