add -keep_symbols to `xschem load command`, options changed to have a leading dash, and moved at beginning of command arg list; `xschem netlist` command: add -keep_symbols option; `xschem setprop` command: move fast and fastundo to beginning of arg list with a leading dash; update proc cellview

This commit is contained in:
stefan schippers 2025-01-20 02:30:46 +01:00
parent 4f31c024c8
commit cb38deffa6
6 changed files with 168 additions and 157 deletions

View File

@ -1003,14 +1003,16 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
0: eat non escaped quotes (")
1: return unescaped quotes as part of the token value if they are present
2: eat backslashes </pre>
<li><kbd> load f [symbol|gui|noundoreset|nofullzoom]</kbd></li><pre>
<li><kbd> load [-nosymbols|-gui|-noundoreset|-nofullzoom|-keep_symbols] f</kbd></li><pre>
Load a new file 'f'.
'gui': ask to save modified file or warn if opening an already
open file or opening a new(not existing) file.
'noundoreset': do not reset the undo history
'symbol': do not load symbols (used if loading a symbol instead of a schematic)
'nofullzoom': do not do a full zoom on new schematic.
'nodraw': do not draw.</pre>
'-gui': ask to save modified file or warn if opening an already
open file or opening a new(not existing) file.
'-noundoreset': do not reset the undo history
'-nosymbols': do not load symbols (used if loading a symbol instead of
a schematic)
'-nofullzoom': do not do a full zoom on new schematic.
'-nodraw': do not draw.
'-keep_symbols': retain symbols that are already loaded.</pre>
<li><kbd> load_new_window [f]</kbd></li><pre>
Load schematic in a new tab/window. If 'f' not given prompt user
if 'f' is given as empty '{}' then open untitled.sch </pre>
@ -1071,7 +1073,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> net_pin_mismatch</kbd></li><pre>
Highlight nets attached to selected symbols with
a different name than symbol pin </pre>
<li><kbd> netlist [-messages | -erc | -nohier] [filename]</kbd></li><pre>
<li><kbd> netlist [-keep_symbols|-noalert|-messages|-erc | -nohier] [filename]</kbd></li><pre>
do a netlist of current schematic in currently defined netlist format
if 'filename'is given use specified name for the netlist
if 'filename' contains path components place the file in specified path location.
@ -1081,9 +1083,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
will create the netlist in different places.
netlisting directory is reset to previous setting after completing this command
If -messages is given return the ERC messages instead of just a fail (1)
or no fail (0) code.
If -erc is given it means netlister is called from gui, enable show infowindow
If -nohier is given netlist only current level
or no fail (0) code. </pre>
If -keep_symbols is given no not purge symbols encountered traversing the
design hierarchy </pre>
<li><kbd> new_process [f]</kbd></li><pre>
Start a new xschem process for a schematic.
If 'f' is given load specified schematic. </pre>
@ -1475,14 +1479,14 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
3 : set modified flag, do nothing else.
-1 : set title, rst floater caches.
-2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).</pre>
<li><kbd> setprop instance|symbol|text|rect ref tok [val] [fast]</kbd></li><pre>
<li><kbd> setprop [-fast|-fastundo] instance|symbol|text|rect ref tok [val]</kbd></li><pre>
setprop instance inst [tok] [val] [fast]
setprop [-fast] instance inst [tok] [val]
set attribute 'tok' of instance (name or number) 'inst' to value 'val'
If 'tok' set to 'allprops' replace whole instance prop_str with 'val'
If 'val' not given (no attribute value) delete attribute from instance
If 'tok' not given clear completely instance attribute string
If 'fast' argument if given does not redraw and is not undoable
If '-fast' argument if given does not redraw and is not undoable
setprop symbol name tok [val]
Set attribute 'tok' of symbol name 'name' to 'val'
@ -1490,23 +1494,23 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
This command is not very useful since changes are not saved into symbol
and netlisters reload symbols, so changes are lost anyway.
setprop rect lay n tok [val] [fast|fastundo]
setprop rect [-fast|-fastundo] lay n tok [val]
Set attribute 'tok' of rectangle number'n' on layer 'lay'
If 'val' not given (no attribute value) delete attribute from rect
If 'fast' argument is given does not redraw and is not undoable
If 'fastundo' s given same as above but action is undoable.
If '-fast' argument is given does not redraw and is not undoable
If '-fastundo' s given same as above but action is undoable.
setprop rect 2 n fullxzoom
setprop rect 2 n fullyzoom
These commands do full x/y zoom of graph 'n' (on layer 2, this is hardcoded).
setprop text n [tok] [val] [fast|fastundo]
setprop [-fast|-fastundo] text n [tok] [val]
Set attribute 'tok' of text number 'n'
If 'tok' not specified set text string (txt_ptr) to value
If "txt_ptr" is given as token replace the text txt_ptr ("the text")
If 'val' not given (no attribute value) delete attribute from text
If 'fast' argument is given does not redraw and is not undoable
If 'fastundo' s given same as above but action is undoable.</pre>
If '-fast' argument is given does not redraw and is not undoable
If '-fastundo' is given same as above but action is undoable.</pre>
<li><kbd> simulate [callback]</kbd></li><pre>
Run a simulation (start simulator configured as default in
Tools -&gt; Configure simulators and tools)

View File

@ -1869,7 +1869,7 @@ static void context_menu_action(double mx, double my)
merge_file(2,".sch");
break;
case 9: /* load most recent file */
tclvareval("xschem load [lindex $recentfile 0] gui", NULL);
tclvareval("xschem load -gui [lindex $recentfile 0]", NULL);
break;
case 10: /* edit attributes */
edit_property(0);
@ -3145,7 +3145,7 @@ int rstate; /* (reduced state, without ShiftMask) */
}
if(key=='O' && rstate == ControlMask ) /* load most recent tile */
{
tclvareval("xschem load [lindex $recentfile 0] gui", NULL);
tclvareval("xschem load -gui [lindex $recentfile 0]", NULL);
break;
}
if(key=='O' && rstate == 0) /* toggle light/dark colorscheme 20171113 */

View File

@ -108,19 +108,19 @@ proc annotate {} {
set type [xschem getprop instance $i cell::type]
if { $type == "probe"} {
set net [xschem instance_net $i p]
if {[catch {xschem setprop instance $i voltage [get_voltage $net] fast} err]} {
if {[catch {xschem setprop -fast instance $i voltage [get_voltage $net]} err]} {
puts "1 error : $err net: $net"
}
}
if { $type == "current_probe"} {
if {[catch {xschem setprop instance $i current [get_current $name] fast} err]} {
if {[catch {xschem setprop -fast instance $i current [get_current $name]} err]} {
puts "2 error : $err"
}
}
if { $type == "differential_probe"} {
set netp [xschem instance_net $i p]
set netm [xschem instance_net $i m]
if {[catch {xschem setprop instance $i voltage [get_diff_voltage $netp $netm] fast} err]} {
if {[catch {xschem setprop -fast instance $i voltage [get_diff_voltage $netp $netm]} err]} {
puts "3 error : $err"
}
}

View File

@ -2808,38 +2808,54 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* load f [symbol|gui|noundoreset|nofullzoom]
/* load [-nosymbols|-gui|-noundoreset|-nofullzoom|-keep_symbols] f
* Load a new file 'f'.
* 'gui': ask to save modified file or warn if opening an already
* open file or opening a new(not existing) file.
* 'noundoreset': do not reset the undo history
* 'symbol': do not load symbols (used if loading a symbol instead of a schematic)
* 'nofullzoom': do not do a full zoom on new schematic.
* 'nodraw': do not draw.
* '-gui': ask to save modified file or warn if opening an already
* open file or opening a new(not existing) file.
* '-noundoreset': do not reset the undo history
* '-nosymbols': do not load symbols (used if loading a symbol instead of
* a schematic)
* '-nofullzoom': do not do a full zoom on new schematic.
* '-nodraw': do not draw.
* '-keep_symbols': retain symbols that are already loaded.
*/
else if(!strcmp(argv[1], "load") )
{
int load_symbols = 1, force = 1, undo_reset = 1, nofullzoom = 0, nodraw = 0;
int keep_symbols = 0;
size_t i;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) {
for(i = 3; i < argc; ++i) {
if(!strcmp(argv[i], "symbol")) load_symbols = 0;
if(!strcmp(argv[i], "gui")) force = 0;
if(!strcmp(argv[i], "noundoreset")) undo_reset = 0;
if(!strcmp(argv[i], "nofullzoom")) nofullzoom = 1;
if(!strcmp(argv[i], "nodraw")) {nofullzoom = 1; nodraw = 1;}
for(i = 2; i < argc; i++) {
if(argv[i][0] == '-') {
if(!strcmp(argv[i], "-nosymbols")) {
load_symbols = 0 ;
} else if(!strcmp(argv[i], "-gui")) {
force = 0;
} else if(!strcmp(argv[i], "-noundoreset")) {
undo_reset = 0;
} else if(!strcmp(argv[i], "-nofullzoom")) {
nofullzoom = 1;
} else if(!strcmp(argv[i], "-nodraw")) {
nofullzoom = 1; nodraw = 1;
} else if(!strcmp(argv[i], "-keep_symbols")) {
keep_symbols = 1;
}
} else {
break;
}
}
if(argc>2) {
if(argc>i) {
char f[PATH_MAX + 100];
my_snprintf(f, S(f),"regsub {^~/} {%s} {%s/}", argv[2], home_dir);
my_snprintf(f, S(f),"regsub {^~/} {%s} {%s/}", argv[i], home_dir);
tcleval(f);
my_strncpy(f, tclresult(), S(f));
if(force || !has_x || !xctx->modified || save(1, 0) != -1 ) { /* save(1)==-1 --> user cancel */
char win_path[WINDOW_PATH_SIZE];
int skip = 0;
dbg(1, "scheduler(): load: filename=%s\n", argv[2]);
dbg(1, "scheduler(): load: filename=%s\n", argv[i]);
my_strncpy(f, abs_sym_path(f, ""), S(f));
if(!force && f[0] && check_loaded(f, win_path) ) {
char msg[PATH_MAX + 100];
@ -2859,7 +2875,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* no implicit undo: if needed do it before loading */
/* if(!undo_reset) xctx->push_undo(); */
if(undo_reset) xctx->currsch = 0;
remove_symbols();
if(!keep_symbols) remove_symbols();
if(!nofullzoom) {
xctx->zoom=CADINITIALZOOM;
xctx->mooz=1/CADINITIALZOOM;
@ -3200,7 +3216,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
hilight_net_pin_mismatches();
}
/* netlist [-noalert -messages | -erc | -nohier] [filename]
/* netlist [-keep_symbols|-noalert|-messages|-erc | -nohier] [filename]
* do a netlist of current schematic in currently defined netlist format
* if 'filename'is given use specified name for the netlist
* if 'filename' contains path components place the file in specified path location.
@ -3210,9 +3226,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* will create the netlist in different places.
* netlisting directory is reset to previous setting after completing this command
* If -messages is given return the ERC messages instead of just a fail (1)
* or no fail (0) code.
* If -erc is given it means netlister is called from gui, enable show infowindow
* If -nohier is given netlist only current level
* or no fail (0) code. */
* If -keep_symbols is given no not purge symbols encountered traversing the
* design hierarchy */
else if(!strcmp(argv[1], "netlist") )
{
char *saveshow = NULL;
@ -3220,6 +3238,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int hier_netlist = 1;
int i, messages = 0;
int alert = 1;
int keep_symbols=0, save_keep;
int erc = 0;
const char *fname = NULL;
const char *path;
@ -3236,6 +3255,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
messages = 1;
} else if(!strcmp(argv[i], "-erc")) {
erc = 1;
} else if(!strcmp(argv[i], "-keep_symbols")) {
keep_symbols = 1;
} else if(!strcmp(argv[i], "-noalert")) {
alert = 0;
} else if(!strcmp(argv[i], "-nohier")) {
@ -3257,8 +3278,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
if(set_netlist_dir(0, NULL) ) {
done_netlist = 1;
save_keep = tclgetboolvar("keep_symbols");
tclsetboolvar("keep_symbols", keep_symbols);
if(xctx->netlist_type == CAD_SPICE_NETLIST)
err = global_spice_netlist(hier_netlist, alert); /* 1 means global netlist */
err = global_spice_netlist(hier_netlist, alert);
else if(xctx->netlist_type == CAD_VHDL_NETLIST)
err = global_vhdl_netlist(hier_netlist, alert);
else if(xctx->netlist_type == CAD_VERILOG_NETLIST)
@ -3268,6 +3292,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else
if(has_x) tcleval("tk_messageBox -type ok -parent [xschem get topwindow] "
"-message {Please Set netlisting mode (Options menu)}");
tclsetboolvar("keep_symbols", save_keep);
if( (erc == 0) ) {
my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name));
}
@ -5261,14 +5287,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
Tcl_ResetResult(interp);
}
/* setprop instance|symbol|text|rect ref tok [val] [fast]
/* setprop [-fast|-fastundo] instance|symbol|text|rect ref tok [val]
*
* setprop instance inst [tok] [val] [fast]
* setprop [-fast] instance inst [tok] [val]
* set attribute 'tok' of instance (name or number) 'inst' to value 'val'
* If 'tok' set to 'allprops' replace whole instance prop_str with 'val'
* If 'val' not given (no attribute value) delete attribute from instance
* If 'tok' not given clear completely instance attribute string
* If 'fast' argument if given does not redraw and is not undoable
* If '-fast' argument if given does not redraw and is not undoable
*
* setprop symbol name tok [val]
* Set attribute 'tok' of symbol name 'name' to 'val'
@ -5276,43 +5302,52 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* This command is not very useful since changes are not saved into symbol
* and netlisters reload symbols, so changes are lost anyway.
*
* setprop rect lay n tok [val] [fast|fastundo]
* setprop rect [-fast|-fastundo] lay n tok [val]
* Set attribute 'tok' of rectangle number'n' on layer 'lay'
* If 'val' not given (no attribute value) delete attribute from rect
* If 'fast' argument is given does not redraw and is not undoable
* If 'fastundo' s given same as above but action is undoable.
* If '-fast' argument is given does not redraw and is not undoable
* If '-fastundo' s given same as above but action is undoable.
*
* setprop rect 2 n fullxzoom
* setprop rect 2 n fullyzoom
* These commands do full x/y zoom of graph 'n' (on layer 2, this is hardcoded).
*
* setprop text n [tok] [val] [fast|fastundo]
* setprop [-fast|-fastundo] text n [tok] [val]
* Set attribute 'tok' of text number 'n'
* If 'tok' not specified set text string (txt_ptr) to value
* If "txt_ptr" is given as token replace the text txt_ptr ("the text")
* If 'val' not given (no attribute value) delete attribute from text
* If 'fast' argument is given does not redraw and is not undoable
* If 'fastundo' s given same as above but action is undoable.
* If '-fast' argument is given does not redraw and is not undoable
* If '-fastundo' is given same as above but action is undoable.
*/
else if(!strcmp(argv[1], "setprop"))
{
int i, fast = 0, shift = 0;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
/* 0 1 2 3 4 5 6
* xschem setprop instance R4 value [30k] [fast] */
for(i = 2; i < argc; i++) {
if(argv[i][0] == '-') {
if(!strcmp(argv[i], "-fast")) {
fast = 1; shift++;
} else if(!strcmp(argv[i], "-fastundo")) {
fast = 3; shift++;
}
} else {
break;
}
}
/* remove option (-xxx) arguments and shift remaining */
if(shift) for(; i < argc; i++) {
argv[i - shift] = argv[i];
}
argc -= shift;
/* 0 1 2 3 4 5
* xschem setprop instance R4 value [30k] */
if(argc > 2 && !strcmp(argv[2], "instance")) {
int inst, fast=0;
if(argc > 6) {
if(!strcmp(argv[6], "fast")) {
fast = 1;
argc = 6;
}
}
else if(argc > 5) {
if(!strcmp(argv[5], "fast")) {
fast = 1;
argc = 5;
}
}
int inst;
if(argc < 4) {
Tcl_SetResult(interp, "xschem setprop instance needs 1 or more additional arguments", TCL_STATIC);
return TCL_ERROR;
@ -5390,10 +5425,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strdup2(_ALLOC_ID_, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], NULL)); /* delete attr */
} else if(argc > 5 && !strcmp(argv[2], "rect")) {
/* 0 1 2 3 4 5 6 7
* xschem setprop rect c n token [value] [fast|fastundo] */
/* 0 1 2 3 4 5 6
* xschem setprop rect c n token [value] */
int change_done = 0;
int fast = 0;
xRect *r;
int c = atoi(argv[3]);
int n = atoi(argv[4]);
@ -5402,26 +5436,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
return TCL_ERROR;
}
r = &xctx->rect[c][n];
if(argc > 7) {
if(!strcmp(argv[7], "fast")) {
fast = 1;
argc = 7;
}
if(!strcmp(argv[7], "fastundo")) {
fast = 3;
argc = 7;
}
}
else if(argc > 6) {
if(!strcmp(argv[6], "fast")) {
fast = 1;
argc = 6;
}
if(!strcmp(argv[6], "fastundo")) {
fast = 3;
argc = 6;
}
}
if(!fast) {
bbox(START,0.0,0.0,0.0,0.0);
}
@ -5480,7 +5494,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* xschem setprop text n [token] value [fast|fastundo]
* if "txt_ptr" is given as token replace the text txt_ptr ("the text") */
int change_done = 0;
int argc_copy, i, tmp, fast = 0;
int tmp;
double xx1, xx2, yy1, yy2, dtmp;
xText *t;
int n = atoi(argv[3]);
@ -5490,17 +5504,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
t = &xctx->text[n];
argc_copy = argc;
for(i = 5; i < argc_copy; i++) {
if(!strcmp(argv[i], "fast")) {
fast = 1;
argc--;
}
if(!strcmp(argv[i], "fastundo")) {
fast = 3;
argc--;
}
}
if(!fast) {
bbox(START,0.0,0.0,0.0,0.0);
}

View File

@ -1189,8 +1189,7 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
/* given a string <s> with multiple "token=value ..." assignments */
/* substitute <tok>'s value with <new_val> */
/* if tok not found in s and new_val!=NULL add tok=new_val at end.*/
/* if new_val is empty ('\0') set token value to "" (token="") */
/* if new_val is NULL *remove* 'token (and =val if any)' from s */
/* if new_val is NULL *OR* empty *remove* 'token (and =val if any)' from s */
/* return the updated string */
{
static char *result=NULL;
@ -1225,8 +1224,11 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
new_val_copy = my_malloc(_ALLOC_ID_, new_val_len+3);
my_snprintf(new_val_copy, new_val_len+3, "\"%s\"", new_val);
}
else my_strdup(_ALLOC_ID_, &new_val_copy, new_val);
else my_strdup(_ALLOC_ID_, &new_val_copy, new_val); /* new_val_copy is NULL if new_val empty */
} else new_val_copy = NULL;
/* if new_val is NULL or empty new_val_copy will be NULL */
dbg(1, "subst_token(): %s, %s, %s\n", s ? s : "<NULL>", tok ? tok : "<NULL>", new_val ? new_val : "<NULL>");
sizetok = size = CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &result, size);

View File

@ -1189,7 +1189,7 @@ proc setup_recent_menu { { topwin {} } } {
if { [info exists recentfile] } {
foreach i $recentfile {
$topwin.menubar.file.recent add command \
-command "xschem load {$i} gui" \
-command "xschem load -gui {$i}" \
-label [file tail $i]
}
}
@ -1804,14 +1804,19 @@ proc cellview_setlabels {w symbol derived_symbol} {
puts ===============
if {$sym_sch ne $new_sch && $sym_spice_sym_def eq {}} {
puts "Changing schematic attribute in symbol"
xschem load $symbol noundoreset nodraw
xschem load -keep_symbols -nodraw -noundoreset $symbol
set oldprop [xschem get schsymbolprop]
set newprop [xschem subst_tok $oldprop schematic $new_sch]
if { $new_sch eq $default_sch } {
set newprop [xschem subst_tok $oldprop schematic {}] ;# delete schematic attr in symbol
} else {
set newprop [xschem subst_tok $oldprop schematic $new_sch]
}
xschem set schsymbolprop $newprop
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
xschem save fast
xschem load $current noundoreset nodraw
xschem reload_symbols ;# update in-memory symbol data
xschem remove_symbols ;# purge all symbols to force a reload from disk
xschem load -keep_symbols -nodraw -noundoreset $current
xschem netlist -keep_symbols -noalert;# traverse the hierarchy and retain all encountered symbols
}
puts sym_sch=$sym_sch
puts default_sch=$default_sch
@ -1833,14 +1838,14 @@ proc cellview_edit_item {symbol w} {
set old_sym_def [xschem getprop symbol $symbol spice_sym_def 2]
set new_sym_def [editdata $sym_spice_sym_def {Symbol spice_sym_def attribute}]
if {$new_sym_def ne $old_sym_def} {
xschem load $symbol noundoreset nodraw
xschem load -keep_symbols -nodraw -noundoreset $symbol
set oldprop [xschem get schsymbolprop]
set newprop [xschem subst_tok $oldprop spice_sym_def $new_sym_def]
xschem set schsymbolprop $newprop
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
xschem save fast
puts "$symbol: updated spice_sym_def attribute"
xschem load $current noundoreset nodraw
xschem load -keep_symbols -nodraw -noundoreset $current
xschem reload_symbols ;# update in-memory symbol data
}
}
@ -1879,10 +1884,7 @@ proc cellview {{derived_symbols {}}} {
}
toplevel .cv
xschem reload_symbols ;# purge unused symbols
set save_keep $keep_symbols
set keep_symbols 1 ;# keep all symbols when doing a hierarchic netlist
xschem netlist -noalert;# traverse the hierarchy and retain all encountered symbols
set keep_symbols $save_keep
xschem netlist -keep_symbols -noalert;# traverse the hierarchy and retain all encountered symbols
wm geometry .cv 800x200
update
raise .cv
@ -1993,17 +1995,17 @@ proc traversal_setlabels {w parent_sch instname inst_sch sym_sch default_sch ins
# puts "traversal_update_schematic: $w parent: $parent_sch $instname def: $sym_sch $inst_sch --> [$w get]"
if { $inst_sch ne [$w get] } {
puts "update attr"
xschem load $parent_sch noundoreset nodraw
xschem load -undoreset -nodraw $parent_sch
if { [$w get] eq $sym_sch} {
xschem setprop instance $instname schematic fast ;# remove schematic attr on instance
xschem setprop -fast instance $instname schematic ;# remove schematic attr on instance
} else {
xschem setprop instance $instname schematic [$w get] fast ;# set schematic attr on instance
xschem setprop -fast instance $instname schematic [$w get] ;# set schematic attr on instance
}
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
xschem save fast
set inst_sch [$w get]
# puts "inst_sch set to: $inst_sch"
xschem load $current noundoreset nodraw
xschem load -undoreset -nodraw $current
bind $w <KeyRelease> "
traversal_setlabels $w [list $parent_sch] [list $instname] [list $inst_sch] [list $sym_sch] \
@ -2724,7 +2726,7 @@ proc graph_edit_wave {n n_wave} {
# remove excess colors
set col [lrange $col 0 [expr {$i - 1}]]
set graph_sel_color [lindex $col $graph_sel_wave]
xschem setprop rect 2 $graph_selected color $col fast
xschem setprop -fast rect 2 $graph_selected color $col
xschem draw_graph $graph_selected
toplevel .graphdialog -class Dialog
wm transient .graphdialog [xschem get topwindow]
@ -2806,10 +2808,10 @@ proc graph_add_nodes_from_list {nodelist} {
.graphdialog.center.right.text1 insert end $sel
if { [xschem get schname] eq $graph_schname } {
set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected color $col fastundo
xschem setprop -fastundo rect 2 $graph_selected color $col
graph_update_nodelist
regsub -all {[\\"]} $node {\\&} node_quoted
xschem setprop rect 2 $graph_selected node $node_quoted fast
xschem setprop -fast rect 2 $graph_selected node $node_quoted
xschem draw_graph $graph_selected
}
}
@ -2836,13 +2838,13 @@ proc graph_add_nodes_from_list {nodelist} {
}
if {$change_done} {
xschem setprop rect 2 [xschem get graph_lastsel] color $col fastundo
xschem setprop -fastundo rect 2 [xschem get graph_lastsel] color $col
if {[string length $nnn] > 0 && ![regexp "\n$" $nnn]} {
append nnn "\n"
}
append nnn $sel
regsub -all {[\\"]} $nnn {\\&} node_quoted
xschem setprop rect 2 [xschem get graph_lastsel] node $node_quoted fast
xschem setprop -fast rect 2 [xschem get graph_lastsel] node $node_quoted
xschem draw_graph [xschem get graph_lastsel]
}
}
@ -2945,7 +2947,7 @@ proc graph_change_wave_color {{wave {}}} {
set index [string range $tag 1 end]
set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $index $index $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col fast
xschem setprop -fast rect 2 $graph_selected color $col
}
}
graph_update_nodelist
@ -2957,7 +2959,7 @@ proc graph_change_wave_color {{wave {}}} {
set index [string range $tag 1 end]
set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $index $index $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col fast
xschem setprop -fast rect 2 $graph_selected color $col
graph_update_nodelist
xschem draw_graph $graph_selected
}
@ -2966,7 +2968,7 @@ proc graph_change_wave_color {{wave {}}} {
} else {
set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $wave $wave $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col fast
xschem setprop -fast rect 2 $graph_selected color $col
xschem draw_graph $graph_selected
}
}
@ -3023,7 +3025,7 @@ proc graph_tag_nodes {txt} {
} else {
set col {}
}
xschem setprop rect 2 $graph_selected color $col fast
xschem setprop -fast rect 2 $graph_selected color $col
}
return [list $tt $cc]
}
@ -3078,7 +3080,7 @@ proc graph_update_node {node} {
# note the double escaping for regsub replace string
regsub -all {[\\"]} $node {\\&} node_quoted
graph_push_undo
xschem setprop rect 2 $graph_selected node $node_quoted fast
xschem setprop -fast rect 2 $graph_selected node $node_quoted
xschem draw_graph $graph_selected
}
@ -3139,13 +3141,13 @@ proc set_rect_flags {graph_selected} {
} else {
set unlocked {}
}
xschem setprop rect 2 $graph_selected flags "graph$unlocked$private_cursor" fast
xschem setprop -fast rect 2 $graph_selected flags "graph$unlocked$private_cursor"
}
proc graphdialog_set_raw_props {} {
global graph_selected
xschem setprop rect 2 $graph_selected rawfile [.graphdialog.center.right.rawentry get] fast
xschem setprop rect 2 $graph_selected sim_type [.graphdialog.center.right.list get] fast
xschem setprop -fast rect 2 $graph_selected rawfile [.graphdialog.center.right.rawentry get]
xschem setprop -fast rect 2 $graph_selected sim_type [.graphdialog.center.right.list get]
graph_fill_listbox
}
@ -3239,9 +3241,9 @@ proc graph_edit_properties {n} {
checkbutton .graphdialog.center.right.autoload -text {Auto load} -variable graph_autoload \
-command {
if {$graph_autoload} {
xschem setprop rect 2 $graph_selected autoload 1 fast
xschem setprop -fast rect 2 $graph_selected autoload 1
} else {
xschem setprop rect 2 $graph_selected autoload 0 fast
xschem setprop -fast rect 2 $graph_selected autoload 0
}
}
label .graphdialog.center.right.lab2 -text { Sim type:}
@ -3254,7 +3256,7 @@ proc graph_edit_properties {n} {
}
if { [info tclversion] > 8.4} {
bind .graphdialog.center.right.list <<ComboboxSelected>> {
xschem setprop rect 2 $graph_selected sim_type [.graphdialog.center.right.list get] fast
xschem setprop -fast rect 2 $graph_selected sim_type [.graphdialog.center.right.list get]
graph_fill_listbox
}
if { [xschem getprop rect 2 $graph_selected sim_type 2] ne {}} {
@ -3272,7 +3274,7 @@ proc graph_edit_properties {n} {
}
bind .graphdialog.center.right.list <KeyRelease> {
xschem setprop rect 2 $graph_selected sim_type [.graphdialog.center.right.list get] fast
xschem setprop -fast rect 2 $graph_selected sim_type [.graphdialog.center.right.list get]
graph_fill_listbox
}
@ -3325,10 +3327,10 @@ proc graph_edit_properties {n} {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
graph_update_node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected x1 [.graphdialog.top3.xmin get] fast
xschem setprop rect 2 $graph_selected x2 [.graphdialog.top3.xmax get] fast
xschem setprop rect 2 $graph_selected y1 [.graphdialog.top3.ymin get] fast
xschem setprop rect 2 $graph_selected y2 [.graphdialog.top3.ymax get] fast
xschem setprop -fast rect 2 $graph_selected x1 [.graphdialog.top3.xmin get]
xschem setprop -fast rect 2 $graph_selected x2 [.graphdialog.top3.xmax get]
xschem setprop -fast rect 2 $graph_selected y1 [.graphdialog.top3.ymin get]
xschem setprop -fast rect 2 $graph_selected y2 [.graphdialog.top3.ymax get]
set_rect_flags $graph_selected
}
set graph_dialog_default_geometry [winfo geometry .graphdialog]
@ -3340,10 +3342,10 @@ proc graph_edit_properties {n} {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
graph_update_node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected x1 [.graphdialog.top3.xmin get] fast
xschem setprop rect 2 $graph_selected x2 [.graphdialog.top3.xmax get] fast
xschem setprop rect 2 $graph_selected y1 [.graphdialog.top3.ymin get] fast
xschem setprop rect 2 $graph_selected y2 [.graphdialog.top3.ymax get] fast
xschem setprop -fast rect 2 $graph_selected x1 [.graphdialog.top3.xmin get]
xschem setprop -fast rect 2 $graph_selected x2 [.graphdialog.top3.xmax get]
xschem setprop -fast rect 2 $graph_selected y1 [.graphdialog.top3.ymin get]
xschem setprop -fast rect 2 $graph_selected y2 [.graphdialog.top3.ymax get]
set_rect_flags $graph_selected
}
}
@ -3364,7 +3366,7 @@ proc graph_edit_properties {n} {
-command {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
xschem setprop rect 2 $graph_selected legend $graph_legend fast
xschem setprop -fast rect 2 $graph_selected legend $graph_legend
xschem draw_graph $graph_selected
}
}
@ -3497,7 +3499,7 @@ proc graph_edit_properties {n} {
-command {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
xschem setprop rect 2 $graph_selected rainbow $graph_rainbow fast
xschem setprop -fast rect 2 $graph_selected rainbow $graph_rainbow
xschem draw_graph $graph_selected
}
}
@ -3535,7 +3537,7 @@ proc graph_edit_properties {n} {
-command {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
xschem setprop rect 2 $graph_selected digital $graph_digital fast
xschem setprop -fast rect 2 $graph_selected digital $graph_digital
xschem draw_graph $graph_selected
}
}
@ -3623,17 +3625,17 @@ proc graph_edit_properties {n} {
-command {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
xschem setprop rect 2 $graph_selected logx $graph_logx fast
xschem setprop -fast rect 2 $graph_selected logx $graph_logx
if { $graph_logx eq 1} {
graph_push_undo
xschem setprop rect 2 $graph_selected subdivx 8 fast
xschem setprop -fast rect 2 $graph_selected subdivx 8
.graphdialog.top2.subdivx delete 0 end
.graphdialog.top2.subdivx insert 0 8
xschem setprop rect 2 $graph_selected fullxzoom
xschem setprop rect 2 $graph_selected fullyzoom
} else {
graph_push_undo
xschem setprop rect 2 $graph_selected subdivx 4 fast
xschem setprop -fast rect 2 $graph_selected subdivx 4
.graphdialog.top2.subdivx delete 0 end
.graphdialog.top2.subdivx insert 0 4
xschem setprop rect 2 $graph_selected fullxzoom
@ -3647,16 +3649,16 @@ proc graph_edit_properties {n} {
-command {
if { [xschem get schname] eq $graph_schname } {
graph_push_undo
xschem setprop rect 2 $graph_selected logy $graph_logy fast
xschem setprop -fast rect 2 $graph_selected logy $graph_logy
if { $graph_logy eq 1} {
graph_push_undo
xschem setprop rect 2 $graph_selected subdivy 8 fast
xschem setprop -fast rect 2 $graph_selected subdivy 8
.graphdialog.top2.subdivy delete 0 end
.graphdialog.top2.subdivy insert 0 8
xschem setprop rect 2 $graph_selected fullyzoom
} else {
graph_push_undo
xschem setprop rect 2 $graph_selected subdivy 4 fast
xschem setprop -fast rect 2 $graph_selected subdivy 4
.graphdialog.top2.subdivy delete 0 end
.graphdialog.top2.subdivy insert 0 4
xschem setprop rect 2 $graph_selected fullyzoom
@ -6650,7 +6652,7 @@ proc swap_compare_schematics {} {
}
puts "swap_compare_schematics:\n sch1=$sch1\n sch2=$sch2"
if {$sch2 ne {}} {
xschem load $sch2 nofullzoom gui
xschem load -nofullzoom -gui $sch2
set current [xschem get schname]
# Use "file tail" to handle equality of
# https://raw.githubusercon...tb_reram.sch and /tmp/xschem_web/tb_reram.sch
@ -8103,7 +8105,7 @@ proc build_widgets { {topwin {} } } {
}
$topwin.menubar.file add command -label "Open" -command "xschem load" -accelerator {Ctrl+O}
$topwin.menubar.file add command -label "Open Most Recent" \
-command {xschem load [lindex "$recentfile" 0] gui} -accelerator {Ctrl+Shift+O}
-command {xschem load -gui [lindex "$recentfile" 0]} -accelerator {Ctrl+Shift+O}
$topwin.menubar.file add cascade -label "Open recent" -menu $topwin.menubar.file.recent
menu $topwin.menubar.file.recent -tearoff 0
setup_recent_menu $topwin