From 881d8a4ed905fae763904788ee516714fa098baa Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 5 Nov 2023 14:13:20 +0100 Subject: [PATCH] various fixes for Simulator/Netlist button color codes --- src/actions.c | 2 ++ src/callback.c | 5 ++++ src/netlist.c | 2 +- src/scheduler.c | 2 ++ src/xschem.tcl | 75 +++++++++++++++++++++++++++++++++++++------------ 5 files changed, 67 insertions(+), 19 deletions(-) diff --git a/src/actions.c b/src/actions.c index 1eb84ae6..ac7c4e3d 100644 --- a/src/actions.c +++ b/src/actions.c @@ -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 */ diff --git a/src/callback.c b/src/callback.c index af2f8f1f..8535c810 100644 --- a/src/callback.c +++ b/src/callback.c @@ -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; diff --git a/src/netlist.c b/src/netlist.c index 64442dc2..5604f202 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -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]) { diff --git a/src/scheduler.c b/src/scheduler.c index 0440d6d7..199d8a10 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -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); diff --git a/src/xschem.tcl b/src/xschem.tcl index 21b47740..536b68ae 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -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