Opening sub-schematic in new window/tab will inherit raw file loaded and annotation. ngspice::ngspice_data is preserved on context switches now

This commit is contained in:
stefan schippers 2023-12-05 13:13:59 +01:00
parent 926cc26b74
commit c090773afe
3 changed files with 26 additions and 6 deletions

View File

@ -533,6 +533,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
@ -1074,6 +1077,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
xschem raw_query loaded: return hierarchy level
where raw file was loaded or -1 if no raw loaded
xschem raw_query rawfile: return raw filename
xschem raw_query sim_type: return raw loaded simulation type (ac, op, tran, ...)
xschem raw_query index node: get index of simulation variable 'node'.
Example: raw_query index v(led) --> 46
xschem raw_query values node [dset] : print all simulation
@ -1445,6 +1449,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -3254,6 +3254,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* xschem raw_query loaded: return hierarchy level
* where raw file was loaded or -1 if no raw loaded
* xschem raw_query rawfile: return raw filename
* xschem raw_query sim_type: return raw loaded simulation type (ac, op, tran, ...)
* xschem raw_query index node: get index of simulation variable 'node'.
* Example: raw_query index v(led) --> 46
* xschem raw_query values node [dset] : print all simulation
@ -3326,6 +3327,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
} else if(argc > 2 && !strcmp(argv[2], "rawfile")) {
Tcl_SetResult(interp, raw->rawfile, TCL_VOLATILE);
} else if(argc > 2 && !strcmp(argv[2], "sim_type")) {
Tcl_SetResult(interp, raw->sim_type, TCL_VOLATILE);
} else if(argc > 2 && !strcmp(argv[2], "vars")) {
Tcl_SetResult(interp, my_itoa(raw->nvars), TCL_VOLATILE);
} else if(argc > 2 && !strcmp(argv[2], "list")) {

View File

@ -2956,11 +2956,19 @@ proc open_sub_schematic {{inst {}} {inst_number 0}} {
if {[lsearch -exact $instlist $inst] == -1} {return 0}
}
# open a new top level in another window / tab
set schname [xschem get_sch_from_sym $inst]
set rawfile [xschem raw_query rawfile]
set sim_type [xschem raw_query sim_type]
set res [xschem schematic_in_new_window force]
# if successfull descend into indicated sub-schematic
if {$res} {
xschem new_schematic switch [xschem get last_created_window]
if { $rawfile ne {}} {
if {$sim_type eq {op}} {
xschem annotate_op $rawfile
} else {
xschem raw_read $rawfile $sim_type
}
}
xschem select instance $inst fast
xschem descend
return 1
@ -6454,7 +6462,7 @@ set tctx::global_list {
## EXCEPTIONS, not to be saved/restored:
## execute
set tctx::global_array_list {
replace_key dircolor sim enable_layer
replace_key dircolor sim enable_layer ngspice::ngspice_data
}
proc delete_ctx {context} {
@ -6465,7 +6473,8 @@ proc delete_ctx {context} {
# puts "delete_ctx $tctx::tctx"
array unset $tctx::tctx
foreach tctx::i $tctx::global_array_list {
if { [array exists ${tctx::tctx}_$tctx::i] } {
regsub {::} $tctx::i {__} arr_name
if { [array exists ${tctx::tctx}_$arr_name] } {
array unset ${tctx::tctx}_$tctx::i
}
}
@ -6491,8 +6500,10 @@ proc restore_ctx {context} {
}
}
foreach tctx::i $tctx::global_array_list {
if { [array exists tctx::${tctx::tctx}_$tctx::i] } {
array set $tctx::i [array get [subst tctx::${tctx::tctx}_$tctx::i]]
unset -nocomplain $tctx::i
regsub {::} $tctx::i {__} arr_name
if { [array exists tctx::${tctx::tctx}_$arr_name] } {
array set $tctx::i [array get [subst tctx::${tctx::tctx}_$arr_name]]
}
}
}
@ -6519,7 +6530,8 @@ proc save_ctx {context} {
}
foreach tctx::i $tctx::global_array_list {
if { [array exists $tctx::i] } {
array set [subst tctx::${tctx::tctx}_$tctx::i] [array get $tctx::i]
regsub {::} $tctx::i {__} arr_name
array set [subst tctx::${tctx::tctx}_$arr_name] [array get $tctx::i]
}
}
}