various fixes and cleanups - followup of previous commit

This commit is contained in:
stefan schippers 2023-08-28 03:00:48 +02:00
parent 1c3c9ff889
commit 9e4d3c111a
2 changed files with 28 additions and 16 deletions

View File

@ -24,15 +24,24 @@
void statusmsg(char str[],int n)
{
tclsetvar("infowindow_text", str);
if(!str) return;
if(str[0]== '\0') {
tclsetvar("infowindow_text", "");
} else {
if(n == 2) {
tcleval("if {$infowindow_text ne {}} {append infowindow_text \\n}");
tclvareval("append infowindow_text {", str, "}", NULL);
}
}
if(!has_x) return;
if(n==2) {
dbg(3, "statusmsg(): n = 2, str = %s\n", str);
tcleval("infowindow");
}
else {
tclvareval(xctx->top_path, ".statusbar.1 configure -text $infowindow_text", NULL);
dbg(3, "statusmsg(str, %d): -> $infowindow_text = %s\n", n, tclgetvar("infowindow_text"));
tclvareval(xctx->top_path, ".statusbar.1 configure -text {", str, "}", NULL);
dbg(3, "statusmsg(str, %d): -> str = %s\n", n, str);
}
}
@ -2288,8 +2297,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
const char *path;
yyparse_error = 0;
my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist"));
tclsetvar("show_infowindow_after_netlist", "never");
my_strncpy(save, tclgetvar("netlist_dir"), S(save));
if(argc > 2 && strcmp(argv[2], "-erc")) { /* xschem netlist NOT invoked from GUI */
tclsetvar("show_infowindow_after_netlist", "never");
}
if(argc > 2) {
if(!strcmp(argv[2], "-messages")) {
messages = 1;
@ -2323,7 +2334,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
set_netlist_dir(1, save);
}
if(messages) {
Tcl_SetResult(interp, (char *)tcleval(".infotext.f1.text get 1.0 end"), TCL_VOLATILE);
Tcl_SetResult(interp, (char *)tclgetvar("infowindow_text"), TCL_VOLATILE);
} else {
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
}

View File

@ -4411,12 +4411,12 @@ proc show_infotext {{err 0}} {
set s $show_infowindow_after_netlist
if {$s == 1} { set s always}
if {$s == 0} { set s onerror}
if {[info exists has_x]} {
if {($s eq {always}) || ($err != 0 && $s eq {onerror})} {
wm deiconify .infotext
}
} else {
puts stderr $infowindow_text
if {($s eq {always}) || ($err != 0 && $s eq {onerror})} {
if {[info exists has_x]} {
wm deiconify .infotext
} else {
puts stderr $infowindow_text
}
}
}
@ -4424,7 +4424,6 @@ proc infowindow {} {
global infowindow_text
set infotxt $infowindow_text
if { $infowindow_text ne {}} {append infotxt \n}
set z {.infotext}
if ![string compare $infotxt ""] {
if [winfo exists $z] {
@ -4456,8 +4455,10 @@ proc infowindow {} {
pack $z.f2 -fill x
bind $z <Escape> "wm withdraw $z; set show_infowindow 0"
}
$z.f1.text insert end $infotxt
$z.f1.text see end
$z.f1.text delete 1.0 end
$z.f1.text insert 1.0 $infotxt
set lines [$z.f1.text count -displaylines 1.0 end]
$z.f1.text see ${lines}.0
return {}
}
@ -5995,7 +5996,7 @@ proc build_widgets { {topwin {} } } {
-padx 2 -pady 0 -command \{simulate_button $topwin.menubar.simulate\} $bbg
set simulate_bg [$topwin.menubar.simulate cget -bg]
eval button $topwin.menubar.netlist -text "Netlist" -activebackground red -takefocus 0 \
-padx 2 -pady 0 -command \{xschem netlist\} $bbg
-padx 2 -pady 0 -command \{xschem netlist -erc\} $bbg
# create $topwin.menubar.layers.menu
create_layers_menu $topwin
$topwin.menubar.view.menu add checkbutton -label "Show ERC Info window" -variable show_infowindow \
@ -6275,7 +6276,7 @@ tclcommand=\"xschem raw_read \$netlist_dir/[file tail [file rootname [xschem get
$topwin.menubar.simulation.menu add checkbutton -label "Use 'spiceprefix' attribute" -variable spiceprefix \
-command {xschem redraw}
# {xschem save; xschem reload}
toolbar_add Netlist { xschem netlist } "Create netlist" $topwin
toolbar_add Netlist { xschem netlist -erc } "Create netlist" $topwin
toolbar_add Simulate "simulate_button $topwin.menubar.simulate" "Run simulation" $topwin
toolbar_add Waves { waves } "View results" $topwin