From 1184312527ab4728ea4ccdc86d56af632cc145c7 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sat, 19 Dec 2020 05:06:57 +0100 Subject: [PATCH] various fixes around the highlight speed improvements --- src/actions.c | 4 ++- src/editprop.c | 2 ++ src/hilight.c | 40 ++++++++++----------- src/save.c | 2 ++ src/scheduler.c | 2 +- xschem_library/examples/mos_power_ampli.sym | 2 +- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/actions.c b/src/actions.c index 32966324..ea05149b 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1119,8 +1119,10 @@ void go_back(int confirm) /* 20171006 add confirm */ int from_embedded_sym; int save_modified; char filename[PATH_MAX]; + int prev_sch_type; save_ok=0; + prev_sch_type = netlist_type; /* if CAD_SYMBOL_ATTRS do not hilight_parent_pins */ if(xctx->currsch>0) { /* if current sym/schematic is changed ask save before going up */ @@ -1155,7 +1157,7 @@ void go_back(int confirm) /* 20171006 add confirm */ if(from_embedded_sym) xctx->modified=save_modified; /* to force ask save embedded sym in parent schematic */ if(xctx->hilight_nets) { - hilight_parent_pins(); + if(prev_sch_type != CAD_SYMBOL_ATTRS) hilight_parent_pins(); propagate_hilights(1); } if(enable_drill) drill_hilight(); diff --git a/src/editprop.c b/src/editprop.c index 6fc954f2..079f12de 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -1045,6 +1045,8 @@ void update_symbol(const char *result, int x) xctx->inst[i].flags &= ~2; my_strdup(880, &xctx->inst[i].lab, get_tok_value(xctx->inst[i].prop_ptr, "lab",0)); } + if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) xctx->inst[i].flags |= 4; + else xctx->inst[i].flags &= ~4; } /* end for(k=0;klastsel;k++) */ /* new symbol bbox after prop changes (may change due to text length) */ if(xctx->modified) { diff --git a/src/hilight.c b/src/hilight.c index b6d0d1ca..b91e8a72 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -507,17 +507,17 @@ int search(const char *tok, const char *val, int sub, int sel, int what) str=expandlabel(str,&tmp); } if(str && has_token) { -#ifdef __unix__ + #ifdef __unix__ if( (!regexec(&re, str,0 , NULL, 0) && !sub) || /* 20071120 regex instead of strcmp */ (!strcmp(str, val) && sub && !bus) || (strstr(str,val) && sub && bus)) -#else + #else if ((!strcmp(str, val) && sub && !bus) || (strstr(str,val) && sub && bus)) -#endif + #endif { if(!sel) { type = (xctx->inst[i].ptr+ xctx->sym)->type; if( type && IS_LABEL_SH_OR_PIN(type) ) { - if(!bus_hilight_lookup(xctx->inst[i].node[0], col, XINSERT)) xctx->hilight_nets = 1; + bus_hilight_lookup(xctx->inst[i].node[0], col, XINSERT); /* sets xctx->hilight_nets = 1; */ if(what==NOW) for(c=0;cui_state|=SELECTION; } - if(sel==-1) { /* 20171211 unselect */ select_element(i, 0, 1, 0); } found = 1; } } - } for(i=0;iwires;i++) { str = get_tok_value(xctx->wire[i].prop_ptr, tok,0); if(get_tok_size ) { -#ifdef __unix__ + #ifdef __unix__ if( (!regexec(&re, str,0 , NULL, 0) && !sub ) || /* 20071120 regex instead of strcmp */ ( !strcmp(str, val) && sub ) ) -#else + #else if (!strcmp(str, val) && sub) -#endif + #endif { dbg(2, "search(): wire=%d, tok=%s, val=%s \n", i,tok, xctx->wire[i].node); if(!sel) { - bus_hilight_lookup(xctx->wire[i].node, col, XINSERT); + bus_hilight_lookup(xctx->wire[i].node, col, XINSERT); /* sets xctx->hilight_nets = 1 */ if(what == NOW) { if(xctx->wire[i].bus) drawline(hilight_layer, THICK, @@ -586,15 +584,16 @@ int search(const char *tok, const char *val, int sub, int sel, int what) } } } + if(!sel) propagate_hilights(1); if(sel) for(c = 0; c < cadlayers; c++) for(i=0;ilines[c];i++) { str = get_tok_value(xctx->line[c][i].prop_ptr, tok,0); if(get_tok_size) { -#ifdef __unix__ + #ifdef __unix__ if( (!regexec(&re, str,0 , NULL, 0) && !sub ) || ( !strcmp(str, val) && sub )) -#else + #else if ((!strcmp(str, val) && sub)) -#endif + #endif { if(sel==1) { select_line(c, i,SELECTED, 1); @@ -614,12 +613,12 @@ int search(const char *tok, const char *val, int sub, int sel, int what) if(sel) for(c = 0; c < cadlayers; c++) for(i=0;irects[c];i++) { str = get_tok_value(xctx->rect[c][i].prop_ptr, tok,0); if(get_tok_size) { -#ifdef __unix__ + #ifdef __unix__ if( (!regexec(&re, str,0 , NULL, 0) && !sub ) || ( !strcmp(str, val) && sub )) -#else + #else if ((!strcmp(str, val) && sub)) -#endif + #endif { if(sel==1) { select_box(c, i,SELECTED, 1); @@ -713,8 +712,7 @@ int hilight_netname(const char *name) rebuild_selected_array(); node_entry = bus_hash_lookup(name, "", XLOOKUP, 0, "", "", "", ""); ret = node_entry ? 1 : 0; - if(ret && !bus_hilight_lookup(name, xctx->hilight_color, XINSERT)) { - xctx->hilight_nets=1; + if(ret && !bus_hilight_lookup(name, xctx->hilight_color, XINSERT)) { /* sets xctx->hilight_nets=1 */ if(incr_hilight) xctx->hilight_color++; redraw_hilights(); } @@ -855,8 +853,7 @@ void hilight_net(int to_waveform) switch(xctx->sel_array[i].type) { case WIRE: - xctx->hilight_nets=1; - if(!bus_hilight_lookup(xctx->wire[n].node, xctx->hilight_color, XINSERT)) { + if(!bus_hilight_lookup(xctx->wire[n].node, xctx->hilight_color, XINSERT)) { /* sets xctx->hilight_nets=1 */ if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx->wire[n].node); if(incr_hilight) xctx->hilight_color++; } @@ -864,9 +861,8 @@ void hilight_net(int to_waveform) case ELEMENT: type = (xctx->inst[n].ptr+ xctx->sym)->type; if( type && xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */ - if(!bus_hilight_lookup(xctx->inst[n].node[0], xctx->hilight_color, XINSERT)) { + if(!bus_hilight_lookup(xctx->inst[n].node[0], xctx->hilight_color, XINSERT)) { /*sets xctx->hilight_nets=1 */ if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx->inst[n].node[0]); - xctx->hilight_nets=1; if(incr_hilight) xctx->hilight_color++; } } else { diff --git a/src/save.c b/src/save.c index a267abd7..d894b553 100644 --- a/src/save.c +++ b/src/save.c @@ -1640,6 +1640,7 @@ int load_sym_def(const char *name, FILE *embed_fd) my_strdup2(515, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= 4; + else symbol[symbols].flags &= ~4; } else { @@ -1655,6 +1656,7 @@ int load_sym_def(const char *name, FILE *embed_fd) my_strdup2(342, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= 4; + else symbol[symbols].flags &= ~4; } else { load_ascii_string(&aux_ptr, lcc[level].fd); diff --git a/src/scheduler.c b/src/scheduler.c index 9da478ff..ffea391e 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1821,7 +1821,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(cond) xctx->inst[inst].flags|=2; else { xctx->inst[inst].flags &=~2; - my_strdup(1215, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); + my_strdup(872, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); } my_free(922, &ptr); } diff --git a/xschem_library/examples/mos_power_ampli.sym b/xschem_library/examples/mos_power_ampli.sym index 15ba0f00..6291b67f 100644 --- a/xschem_library/examples/mos_power_ampli.sym +++ b/xschem_library/examples/mos_power_ampli.sym @@ -1,4 +1,4 @@ -v {xschem version=2.9.8 file_version=1.2} +v {xschem version=2.9.9 file_version=1.2 } G {} K {type=subcircuit format="@name @pinlist @symname"