various fixes around the highlight speed improvements

This commit is contained in:
Stefan Frederik 2020-12-19 05:06:57 +01:00
parent a837682731
commit 1184312527
6 changed files with 27 additions and 25 deletions

View File

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

View File

@ -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;k<xctx->lastsel;k++) */
/* new symbol bbox after prop changes (may change due to text length) */
if(xctx->modified) {

View File

@ -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;c<cadlayers;c++)
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0);
}
@ -533,28 +533,26 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
select_element(i, SELECTED, 1, 0);
xctx->ui_state|=SELECTION;
}
if(sel==-1) { /* 20171211 unselect */
select_element(i, 0, 1, 0);
}
found = 1;
}
}
}
for(i=0;i<xctx->wires;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;i<xctx->lines[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;i<xctx->rects[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 {

View File

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

View File

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

View File

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