From 392e7f9b57bb93d7df83a2545b159105b972e536 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Wed, 30 Sep 2020 00:55:34 +0200 Subject: [PATCH] "@#n:net_name" attribute (n = pin name or number) in symbols translates to net name attached to pin. "lab_show.sym" component that shows (does not assign) net name. "highlight=true" attribute can be given on instances in addition to symbols. Set filename in recent history also when given on command line. --- src/actions.c | 5 ++++- src/move.c | 11 ++++++++--- src/save.c | 4 ++-- src/xinit.c | 11 ++++++++--- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/actions.c b/src/actions.c index d4d817b5..6e20b0da 100644 --- a/src/actions.c +++ b/src/actions.c @@ -954,10 +954,13 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, if(first_call && (draw_sym & 3) ) bbox(BEGIN, 0.0 , 0.0 , 0.0 , 0.0); - lastinst++; + lastinst++; /* must be updated before calling symbol_bbox() */ prepared_hash_instances=0; /* 20171224 */ + /* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate + * to translate @#n:net_name texts */ prepared_netlist_structs=0; prepared_hilight_structs=0; + symbol_bbox(n, &inst_ptr[n].x1, &inst_ptr[n].y1, &inst_ptr[n].x2, &inst_ptr[n].y2); if(draw_sym & 3) bbox(ADD, inst_ptr[n].x1, inst_ptr[n].y1, inst_ptr[n].x2, inst_ptr[n].y2); diff --git a/src/move.c b/src/move.c index 00e06a67..7122f3c6 100644 --- a/src/move.c +++ b/src/move.c @@ -821,15 +821,18 @@ void copy_objects(int what) inst_ptr[lastinst].rot = (inst_ptr[lastinst].rot + ( (flip && (inst_ptr[lastinst].rot & 1) ) ? rot+2 : rot) ) & 0x3; inst_ptr[lastinst].flip = (flip? !inst_ptr[n].flip:inst_ptr[n].flip); + /* the newpropcnt argument is zero for the 1st call and used in */ + /* new_prop_string() for cleaning some internal caches. */ if(!newpropcnt) hash_all_names(lastinst); new_prop_string(lastinst, inst_ptr[n].prop_ptr,newpropcnt++, disable_unique_names); - /* the final newpropcnt argument is zero for the 1st call and used in */ - /* new_prop_string() for cleaning some internal caches. */ my_strdup2(235, &inst_ptr[lastinst].instname, get_tok_value(inst_ptr[lastinst].prop_ptr, "name", 0)); /* 20150409 */ n=selectedgroup[i].n=lastinst; + /* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate + * to translate @#n:net_name texts */ prepared_netlist_structs=0; prepared_hilight_structs=0; - lastinst++; + + lastinst++; /* must be updated before calling symbol_bbox which triggers prepare_netlist_structs(0) */ symbol_bbox(n, &inst_ptr[n].x1, &inst_ptr[n].y1, &inst_ptr[n].x2, &inst_ptr[n].y2); bbox(ADD, inst_ptr[n].x1, inst_ptr[n].y1, inst_ptr[n].x2, inst_ptr[n].y2 ); @@ -1277,6 +1280,8 @@ void move_objects(int what, int merge, double dx, double dy) ( (flip && (inst_ptr[n].rot & 1) ) ? rot+2 : rot) ) & 0x3; inst_ptr[n].flip = flip ^ inst_ptr[n].flip; + /* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate + * to translate @#n:net_name texts */ prepared_netlist_structs=0; prepared_hilight_structs=0; symbol_bbox(n, &inst_ptr[n].x1, &inst_ptr[n].y1, diff --git a/src/save.c b/src/save.c index 56172f7b..c56df49b 100644 --- a/src/save.c +++ b/src/save.c @@ -1979,8 +1979,8 @@ int load_sym_def(const char *name, FILE *embed_fd) break; case ']': if(level) { - my_free(0, &lcc[level].prop_ptr); - my_free(0, &lcc[level].symname); + my_free(1173, &lcc[level].prop_ptr); + my_free(1174, &lcc[level].symname); --level; } else { endfile=1; diff --git a/src/xinit.c b/src/xinit.c index fd3a01c8..aa2335b6 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1393,9 +1393,11 @@ int Tcl_AppInit(Tcl_Interp *inter) remove_symbols(); my_snprintf(s, S(s), "file normalize \"%s\"", filename); tcleval(s); - load_schematic(1, abs_sym_path(tclresult(), ""), 1); /* 20180925.1 */ - } - else { + my_strncpy(s, abs_sym_path(tclresult(), ""), S(s)); + load_schematic(1, s, 1); /* 20180925.1 */ + Tcl_VarEval(interp, "update_recent_file {", s, "}", NULL); + + } else { char * tmp; /* 20121110 */ char filename[PATH_MAX]; tmp = (char *) tclgetvar("XSCHEM_START_WINDOW"); /* 20121110 */ @@ -1403,6 +1405,9 @@ int Tcl_AppInit(Tcl_Interp *inter) my_strncpy(filename, abs_sym_path(tmp, ""), S(filename)); load_schematic(1, filename, 1); } + + + zoom_full(0, 0); /* Necessary to tell xschem the * initial area to display */