fix a bug when closing with ctrl-q (ie from callback(), calling proc quit_xschem) and there are multiple windows, some with changed data (switch_tab() was skipped due to xctx->semaphore). Process status dialog window will not be updated if vertical slider is not positioned to bottom

This commit is contained in:
stefan schippers 2023-10-22 02:53:03 +02:00
parent d5d090afc0
commit 8f3fedab1f
5 changed files with 60 additions and 17 deletions

View File

@ -1922,6 +1922,9 @@ int rstate; /* (reduced state, without ShiftMask) */
if(key=='q' && rstate==ControlMask) /* quit xschem */
{
if(xctx->semaphore >= 2) break;
/* must be set to zero, otherwise switch_tab/switch_win does not proceed
* and these are necessary when closing tabs/windows */
xctx->semaphore = 0;
tcleval("quit_xschem");
break;
}
@ -3007,7 +3010,7 @@ int rstate; /* (reduced state, without ShiftMask) */
break;
} /* switch(event) */
xctx->semaphore--;
if(xctx->semaphore > 0) xctx->semaphore--;
if(redraw_only) {
xctx->semaphore--; /* decrement articially incremented semaphore (see above) */
dbg(1, "callback(): semaphore >=2 restoring window context: %s <-- %s\n", old_winpath, winpath);

View File

@ -1399,6 +1399,7 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
int n;
char my_win_path[80];
Tk_Window tkwin=NULL;
if(xctx->semaphore) return 1; /* some editing operation ongoing. do nothing */
if(!win_path) {
dbg(0, "switch_window(): no filename or window path given\n");
return 1;

View File

@ -383,18 +383,21 @@ proc update_process_status {lb} {
set exists 0
set selected [$lb curselection]
if { [winfo exists .pstat] } {
if { $selected ne {} && [llength $selected] == 1} {
.pstat.text delete 1.0 end
set idx $selected
set cmd1 [$lb get $idx]
foreach {id pid cmd2} [get_running_cmds] {
if { $cmd1 eq $cmd2 } {
if {[catch { set t $execute(data,$id) } err]} {
set t $err
set pos [lindex [.pstat.text yview] 1]
if {$pos == 1} {
if { $selected ne {} && [llength $selected] == 1} {
.pstat.text delete 1.0 end
set idx $selected
set cmd1 [$lb get $idx]
foreach {id pid cmd2} [get_running_cmds] {
if { $cmd1 eq $cmd2 } {
if {[catch { set t $execute(data,$id) } err]} {
set t $err
}
.pstat.text insert 1.0 $t
.pstat.text yview moveto 1
break
}
.pstat.text insert 1.0 $t
.pstat.text yview moveto 1
break
}
}
}

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.4 file_version=1.2
v {xschem version=3.4.5 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -331,9 +331,10 @@ xschem raw_read $netlist_dir/poweramp.raw tran
C {launcher.sym} 1450 -30 0 0 {name=h6
descr="Graph Manual page"
url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"}
C {simulator_commands.sym} 1020 -450 0 0 {name=COMMANDS
C {simulator_commands.sym} 1020 -670 0 0 {name=NGSPICE
simulator=ngspice
only_toplevel=false
spice_ignore=0
value="
.option ITL4=20000 ITL5=0
vvss vss 0 dc 0
@ -359,7 +360,7 @@ save p(r*) p(v*)
write poweramp.raw
.endc
"}
C {simulator_commands.sym} 1020 -650 0 0 {name=COMMANDS1
C {simulator_commands.sym} 1020 -870 0 0 {name=COMMANDS1
simulator=xyce
only_toplevel=false
value="
@ -387,3 +388,38 @@ tclcommand="
xschem raw_read $netlist_dir/poweramp_xyce.raw tran
"
}
C {simulator_commands.sym} 1020 -480 0 0 {name=NGSPICE_BATCH
simulator=ngspice
spice_ignore=1
only_toplevel=false
value="
.option ITL4=20000 ITL5=0
vvss vss 0 dc 0
.temp 30
.param frequ=5k
.param gain=45
.option savecurrents
** models are generally not free: you must download
** SPICE models for active devices and put them into the below
** referenced file in simulation directory.
.include \\"models_poweramp.txt\\"
.save all
.op
.tran 8e-7 0.07 uic
"}
C {launcher.sym} 960 -330 0 0 {name=h4
descr="Swap interactive
/batch mode"
tclcommand="proc simswap \{\} \{
set x [xschem getprop instance NGSPICE spice_ignore]
xschem setprop instance NGSPICE_BATCH spice_ignore $x
set x [expr \{ !$x\}]
xschem setprop instance NGSPICE spice_ignore $x
\}
simswap
"
}

View File

@ -366,7 +366,7 @@ descr="Graph Manual page"
url="https://xschem.sourceforge.io/stefan/xschem_man/graphs.html"}
C {simulator_commands.sym} 470 -150 0 0 {name=INTERACTIVE
simulator=ngspice
spice_ignore=1
spice_ignore=0
only_toplevel=false
value="
.options SCALE=0.10
@ -484,7 +484,7 @@ tclcommand="
}
C {simulator_commands.sym} 340 -150 0 0 {name=BATCH_MODE
simulator=ngspice
spice_ignore=0
spice_ignore=1
only_toplevel=false
value="
.options SCALE=0.10