From 47ed76374e44fa7fc9f732c9e5e8281dbb6713ea Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Mon, 28 Dec 2020 04:47:26 +0100 Subject: [PATCH] fix value for "non hilight condition" on instance .color field as small negatives are used for simulation --- src/actions.c | 4 ++-- src/draw.c | 2 +- src/hilight.c | 14 +++++++------- src/move.c | 2 +- src/paste.c | 2 +- src/save.c | 2 +- src/svgdraw.c | 2 +- src/token.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/actions.c b/src/actions.c index b5c48059..638189ed 100644 --- a/src/actions.c +++ b/src/actions.c @@ -851,7 +851,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot xctx->inst[n].flip=symbol_name ? flip : 0; xctx->inst[n].flags=0; - xctx->inst[n].color=-1; + xctx->inst[n].color=-10000; /* small negative values used for simulation */ xctx->inst[n].sel=0; xctx->inst[n].node=NULL; xctx->inst[n].prop_ptr=NULL; @@ -1314,7 +1314,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected) entry=bus_hilight_lookup(xctx->inst[i].lab, 0, XLOOKUP ); if(entry) found = 1; } - else if( xctx->inst[i].color != -1 ) { + else if( xctx->inst[i].color != -10000 ) { found = 1; } if(!found) continue; diff --git a/src/draw.c b/src/draw.c index 904747b8..0cf43007 100644 --- a/src/draw.c +++ b/src/draw.c @@ -381,7 +381,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, ( /* ... and inst is hilighted ... */ IS_LABEL_SH_OR_PIN(type) && xctx->inst[n].node && xctx->inst[n].node[0] && bus_hilight_lookup(xctx->inst[n].node[0], 0, XLOOKUP ) - ) || ( !IS_LABEL_SH_OR_PIN(type) && (xctx->inst[n].color != -1)) )) { + ) || ( !IS_LABEL_SH_OR_PIN(type) && (xctx->inst[n].color != -10000)) )) { xctx->inst[n].flags|=1; /* ... then SKIP instance now and for following layers */ return; } diff --git a/src/hilight.c b/src/hilight.c index 1b1e6206..3c56bff1 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -77,7 +77,7 @@ static int there_are_hilights() if(hiptr[i]) return 1; } for(i = 0; i < xctx->instances; i++) { - if(inst[i].color != -1) return 1; + if(inst[i].color != -10000) return 1; } return 0; } @@ -302,7 +302,7 @@ void clear_all_hilights(void) xctx->hilight_nets=0; for(i=0;iinstances;i++) { - xctx->inst[i].color = -1 ; + xctx->inst[i].color = -10000 ; } dbg(1, "clear_all_hilights(): clearing\n"); xctx->hilight_color=0; @@ -840,13 +840,13 @@ void propagate_hilights(int set, int clear, int mode) } } if(nohilight_pins && clear) { - xctx->inst[i].color=-1; + xctx->inst[i].color=-10000; } } } else if( type && IS_LABEL_SH_OR_PIN(type) ) { entry=bus_hilight_lookup( xctx->inst[i].lab, 0, XLOOKUP); if(entry && set) xctx->inst[i].color = entry->value; - else if(!entry && clear) xctx->inst[i].color = -1; + else if(!entry && clear) xctx->inst[i].color = -10000; } } xctx->hilight_nets = there_are_hilights(); @@ -1160,7 +1160,7 @@ void unhilight_net(void) if( type && xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */ bus_hilight_lookup(xctx->inst[n].node[0], xctx->hilight_color, XDELETE); } - xctx->inst[n].color = -1; + xctx->inst[n].color = -10000; break; default: break; @@ -1214,7 +1214,7 @@ void select_hilight_net(void) type = (xctx->inst[i].ptr+ xctx->sym)->type; hilight_connected_inst = en_hilight_conn_inst && ( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) ); - if( xctx->inst[i].color != -1) { + if( xctx->inst[i].color != -10000) { dbg(1, "select_hilight_net(): instance %d flags &4 true\n", i); xctx->inst[i].sel = SELECTED; } @@ -1309,7 +1309,7 @@ void draw_hilight_net(int on_window) i++; if(i >= xctx->instances) break; } - if(xctx->inst[i].color != -1) + if(xctx->inst[i].color != -10000) { int col = get_color(xctx->inst[i].color); symptr = (xctx->inst[i].ptr+ xctx->sym); diff --git a/src/move.c b/src/move.c index 1003532d..a0ebd0d0 100644 --- a/src/move.c +++ b/src/move.c @@ -921,7 +921,7 @@ void copy_objects(int what) my_strdup(312, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); xctx->inst[n].sel=0; xctx->inst[xctx->instances].flags = xctx->inst[n].flags; - xctx->inst[xctx->instances].color = -1; + xctx->inst[xctx->instances].color = -10000; xctx->inst[xctx->instances].x0 = xctx->rx1+xctx->deltax; xctx->inst[xctx->instances].y0 = xctx->ry1+xctx->deltay; xctx->inst[xctx->instances].sel = SELECTED; diff --git a/src/paste.c b/src/paste.c index 04f3eec4..6f02ed56 100644 --- a/src/paste.c +++ b/src/paste.c @@ -213,7 +213,7 @@ void merge_inst(int k,FILE *fd) } ptr[i].sel=0; ptr[i].flags=0; - ptr[i].color=-1; + ptr[i].color=-10000; ptr[i].ptr=-1; ptr[i].prop_ptr=NULL; ptr[i].instname=NULL; diff --git a/src/save.c b/src/save.c index eec8f619..7cc20de0 100644 --- a/src/save.c +++ b/src/save.c @@ -551,7 +551,7 @@ static void load_inst(int k, FILE *fd) fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); read_line(fd, 0); } else { - xctx->inst[i].color=-1; + xctx->inst[i].color=-10000; xctx->inst[i].flags=0; xctx->inst[i].sel=0; xctx->inst[i].ptr=-1; /*04112003 was 0 */ diff --git a/src/svgdraw.c b/src/svgdraw.c index 019ef9df..dda6d5de 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -724,7 +724,7 @@ void svg_draw(void) } for(i=0;iinstances;i++) { color = c; - if(xctx->inst[i].color != -1) color = get_color(xctx->inst[i].color); + if(xctx->inst[i].color != -10000) color = get_color(xctx->inst[i].color); svg_draw_symbol(color,i,c,0,0,0.0,0.0); } } diff --git a/src/token.c b/src/token.c index c6bd75a6..5ef5cbda 100644 --- a/src/token.c +++ b/src/token.c @@ -229,7 +229,7 @@ void check_unique_names(int rename) comma_pos++; } } /* for(j...) */ - if( (xctx->inst[i].color != -1) && rename) { + if( (xctx->inst[i].color != -10000) && rename) { my_strdup(511, &tmp, xctx->inst[i].prop_ptr); new_prop_string(i, tmp, newpropcnt++, !rename); my_strdup2(512, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0));