fix hilights when descending / going back

This commit is contained in:
Stefan Frederik 2020-12-18 19:43:45 +01:00
parent 821ebf06f2
commit 41c46bd84b
3 changed files with 63 additions and 1 deletions

View File

@ -996,7 +996,11 @@ void descend_schematic(int instnumber)
const char *str;
char filename[PATH_MAX];
int inst_mult, inst_number;
int save_ok = 0;
int i, save_ok = 0;
int hilight_connected_inst;
char *type;
struct hilight_hashentry *entry;
rebuild_selected_array();
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT)
@ -1102,6 +1106,36 @@ void descend_schematic(int instnumber)
if(xctx->hilight_nets)
{
prepare_netlist_structs(0);
for(i = 0; i < xctx->instances; i++) {
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst =
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true");
if(hilight_connected_inst && type && !IS_LABEL_SH_OR_PIN(type)) {
int rects, j;
if( (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, xctx->inst[i].node[0]);
for(j=0;j<rects;j++) {
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
entry=bus_hilight_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
if(entry) {
xctx->inst[i].flags |= 4;
xctx->inst[i].color=get_color(entry->value);
break;
}
}
}
}
} else if( type && IS_LABEL_SH_OR_PIN(type) ) {
entry=bus_hilight_lookup( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) , 0, XLOOKUP);
if(entry) xctx->inst[i].color=get_color(entry->value);
}
}
if(enable_drill) drill_hilight();
}
dbg(1, "descend_schematic(): before zoom(): prep_hash_inst=%d\n", xctx->prep_hash_inst);

View File

@ -343,9 +343,11 @@ void hilight_net_pin_mismatches(void)
void hilight_parent_pins(void)
{
int hilight_connected_inst;
int rects, i, j, k;
struct hilight_hashentry *entry;
const char *pin_name;
char *type;
char *pin_node = NULL;
char *net_node=NULL;
int mult, net_mult, inst_number;
@ -385,6 +387,31 @@ void hilight_parent_pins(void)
}
}
}
for(i = 0; i < xctx->instances; i++) {
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst =
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true");
if(hilight_connected_inst && type && !IS_LABEL_SH_OR_PIN(type)) {
int rects, j;
if( (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, xctx->inst[i].node[0]);
for(j=0;j<rects;j++) {
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
entry=bus_hilight_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
if(entry) {
xctx->inst[i].flags |= 4;
xctx->inst[i].color=get_color(entry->value);
break;
}
}
}
}
} else if( type && IS_LABEL_SH_OR_PIN(type) ) {
entry=bus_hilight_lookup( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) , 0, XLOOKUP);
if(entry) xctx->inst[i].color=get_color(entry->value);
}
}
my_free(767, &pin_node);
my_free(768, &net_node);
}

View File

@ -842,6 +842,7 @@ extern int text_bbox(const char * str,double xscale, double yscale,
double *rx2, double *ry2);
extern int get_color(int value);
extern void hash_inst(int what, int n);
extern void hash_inst_pin(int what, int i, int j);
extern void del_inst_table(void);