fix value for "non hilight condition" on instance .color field as small negatives are used for simulation

This commit is contained in:
Stefan Frederik 2020-12-28 04:47:26 +01:00
parent 6363579e97
commit 47ed76374e
8 changed files with 15 additions and 15 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;i<xctx->instances;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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -724,7 +724,7 @@ void svg_draw(void)
}
for(i=0;i<xctx->instances;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);
}
}

View File

@ -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));