various fixes for Simulator/Netlist button color codes

This commit is contained in:
stefan schippers 2023-11-05 14:13:20 +01:00
parent 27114408ec
commit 881d8a4ed9
5 changed files with 67 additions and 19 deletions

View File

@ -151,6 +151,8 @@ int set_modify(int mod)
if(mod == 1 || (mod == 0 && xctx->prev_set_modify) || mod == -2) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg $simulate_bg", NULL);
tclvareval(xctx->top_path, ".menubar.simulate configure -bg $simulate_bg", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist $simulate_bg", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);
}
/* clear floater caches */

View File

@ -2388,8 +2388,11 @@ int rstate; /* (reduced state, without ShiftMask) */
}
if(err) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist red", NULL);
} else {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg LightGreen", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist LightGreen", NULL);
}
break;
}
@ -2416,8 +2419,10 @@ int rstate; /* (reduced state, without ShiftMask) */
}
if(err) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist red", NULL);
} else {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg LightGreen", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist LightGreen", NULL);
}
break;

View File

@ -406,7 +406,7 @@ void netlist_options(int i)
if(str[0]) {
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
if(!strboolcmp(str, "true")) tclsetintvar("lvs_ignore", 1);
else tclsetintvar("lvs_.netlist", 0);
else tclsetintvar("lvs_ignore", 0);
}
str = get_tok_value(xctx->inst[i].prop_ptr, "lvs_netlist", 0);
if(str[0]) {

View File

@ -2710,8 +2710,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
if(err) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist red", NULL);
} else {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg LightGreen", NULL);
tclvareval(xctx->top_path, "set tctx::", xctx->current_win_path, "_netlist LightGreen", NULL);
}
tclsetvar("show_infowindow_after_netlist", saveshow);
my_free(_ALLOC_ID_, &saveshow);

View File

@ -268,7 +268,7 @@ proc execute_fileevent {id} {
}
set execute(exitcode,last) $exit_status
if {[info exists execute(callback,$id)] && $execute(callback,$id) ne {}} {
uplevel #0 eval $execute(callback,$id)
eval uplevel #0 [list $execute(callback,$id)]
}
catch {unset execute(callback,$id)}
set execute(cmd,last) $execute(cmd,$id)
@ -1725,10 +1725,10 @@ proc simulate {{callback {}}} {
set save [pwd]
cd $netlist_dir
$button_path configure -bg yellow
set tctx::[xschem get current_win_path]_simulate 1
set tctx::[xschem get current_win_path]_simulate yellow
if {$OS == "Windows"} {
# $cmd cannot be surrounded by {} as exec will change forward slash to backward slash
clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate
set_simulate_button list [xschem get top_path] [xschem get current_win_path]
if { $callback ne {} } {
uplevel #0 {
eval $callback
@ -1738,8 +1738,14 @@ proc simulate {{callback {}}} {
eval exec $cmd &
set id 0
} else {
# window interface tabbed interface
# -----------------------------------------
# top_path win_path top_path win_path
# {} .drw {} .drw
# .x1 .x1.drw {} .x1.drw
# .x2 .x2.drw {} .x2.drw
set execute(callback) "
clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate
set_simulate_button [list [xschem get top_path] [xschem get current_win_path]]
$callback
"
# puts $cmd
@ -6312,26 +6318,59 @@ proc housekeeping_ctx {} {
xschem set hide_symbols $hide_symbols
xschem set draw_window $draw_window
xschem case_insensitive $case_insensitive
if {![info exists tctx::[xschem get current_win_path]_simulate]} {
[xschem get top_path].menubar.simulate configure -bg $simulate_bg
} else {
[xschem get top_path].menubar.simulate configure -bg yellow
}
set_sim_netlist_buttons
.statusbar.7 configure -text $netlist_type
}
proc clear_simulate_button {button_path simvar} {
# callback that resets simulate button color at end of simulation
proc set_simulate_button {top_path winpath} {
global simulate_bg execute
if { "tctx::[xschem get current_win_path]_simulate" eq $simvar } {
if {![info exists execute(exitcode,last)]} {
$button_path configure -bg $simulate_bg
} elseif { $execute(exitcode,last) == 0} {
$button_path configure -bg LightGreen
} else {
$button_path configure -bg red
set current_win [xschem get current_win_path]
set simvar tctx::${winpath}_simulate
set sim_button $top_path.menubar.simulate
if {![info exists execute(exitcode,last)]} {
if { $current_win eq $winpath} {
$sim_button configure -bg $simulate_bg
}
set $simvar $simulate_bg
} elseif { $execute(exitcode,last) == 0} {
if { $current_win eq $winpath} {
$sim_button configure -bg LightGreen
}
set $simvar LightGreen
} else {
if { $current_win eq $winpath} {
$sim_button configure -bg red
}
set $simvar red
}
}
# set simulate and netlist buttons on context change
proc set_sim_netlist_buttons {} {
global simulate_bg execute
set win_path [xschem get current_win_path]
set top_path [xschem get top_path]
set netlist_var tctx::${win_path}_netlist
set sim_var tctx::${win_path}_simulate
set netlist_button $top_path.menubar.netlist
set sim_button $top_path.menubar.simulate
if {![info exists $netlist_var] || [set $netlist_var] eq $simulate_bg} {
$netlist_button configure -bg $simulate_bg
} else {
$netlist_button configure -bg [set $netlist_var]
}
if {![info exists $sim_var] || [set $sim_var] eq $simulate_bg} {
$sim_button configure -bg $simulate_bg
} else {
$sim_button configure -bg [set $sim_var]
}
unset $simvar
}
# these two routines are workarounds for broken remote desktop connection tools