fix catch command in tclvareval(....menubar entryconfigure ...) commands

This commit is contained in:
stefan schippers 2025-08-19 09:00:09 +02:00
parent 220081adc9
commit 059ac92695
4 changed files with 13 additions and 13 deletions

View File

@ -164,26 +164,26 @@ int set_modify(int mod)
/* Do not configure buttons if displaying in preview window */
if(has_x && (xctx->top_path[0] == '\0' || strstr(xctx->top_path, ".x") == xctx->top_path)) {
char s[256];
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Netlist -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Netlist -background $simulate_bg}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_netlist $simulate_bg", NULL);
my_snprintf(s, S(s), "tctx::%s_simulate_id", xctx->current_win_path);
if(tclgetvar(s)) {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Simulate -background}", tclresult(), NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Simulate -background}", tclresult(), NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate ", tclresult(), NULL);
} else {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Simulate -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Simulate -background $simulate_bg}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);
}
}
if(sch_waves_loaded() >= 0) {
if(has_x && (xctx->top_path[0] == '\0' || strstr(xctx->top_path, ".x") == xctx->top_path)) {
tclvareval("set tctx::", xctx->current_win_path, "_waves Green", NULL);
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Waves -background Green}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Waves -background Green}", NULL);
}
} else {
if(has_x && (xctx->top_path[0] == '\0' || strstr(xctx->top_path, ".x") == xctx->top_path)) {
tclvareval("set tctx::", xctx->current_win_path, "_waves $simulate_bg", NULL);
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Waves -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Waves -background $simulate_bg}", NULL);
}
}
}

View File

@ -3163,12 +3163,12 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
}
if(err) {
if(has_x) {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Netlist -background red}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Netlist -background red}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_netlist red", NULL);
}
} else {
if(has_x) {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Netlist -background Green}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Netlist -background Green}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_netlist Green", NULL);
}
}

View File

@ -890,7 +890,7 @@ void free_rawfile(Raw **rawptr, int dr, int no_warning)
if(has_x) {
tclvareval("set tctx::", xctx->current_win_path, "_waves $simulate_bg", NULL);
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Waves -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Waves -background $simulate_bg}", NULL);
}
if(dr) draw();
@ -1060,10 +1060,10 @@ int raw_read(const char *f, Raw **rawptr, const char *type, int no_warning, doub
if(has_x) {
if(sch_waves_loaded() >= 0) {
tclvareval("set tctx::", xctx->current_win_path, "_waves Green", NULL);
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Waves -background Green}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Waves -background Green}", NULL);
} else {
tclvareval("set tctx::", xctx->current_win_path, "_waves $simulate_bg", NULL);
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Waves -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Waves -background $simulate_bg}", NULL);
}
}
return res;
@ -3453,7 +3453,7 @@ int save_schematic(const char *schname, int fast) /* 20171020 added return value
if(fast) set_modify(2); /* only clear modified flag, no title/tab/sim buttons update */
else set_modify(0);
}
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Simulate -background $simulate_bg}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Simulate -background $simulate_bg}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);
tclvareval("catch {unset tctx::", xctx->current_win_path, "_simulate_id}", NULL);
/* set local simulation directory if local_netlist_dir is set*/

View File

@ -3506,12 +3506,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
if(err) {
if(has_x) {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Netlist -background red}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Netlist -background red}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_netlist red", NULL);
}
} else {
if(has_x) {
tclvareval(xctx->top_path, "catch {.menubar entryconfigure Netlist -background Green}", NULL);
tclvareval("catch {", xctx->top_path, ".menubar entryconfigure Netlist -background Green}", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_netlist Green", NULL);
}
}