From 8d2088edd50cb757410a52a02eec2d2c7e197f95 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 29 Sep 2025 10:23:43 +0200 Subject: [PATCH] avoid double "is already open" warning when doing Shift-Backspace or Ctrl-Backstapce when schematic already loaded --- src/actions.c | 2 +- src/xschem.tcl | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/actions.c b/src/actions.c index 0b1d5fd8..26552f49 100644 --- a/src/actions.c +++ b/src/actions.c @@ -624,7 +624,7 @@ void ask_new_file(int in_new_window, char *filename) int skip = 0; dbg(1, "ask_new_file(): load: f=%s\n", f); - if(check_loaded(f, win_path)) { + if(check_loaded(f, win_path) && !filename) { char msg[PATH_MAX + 100]; my_snprintf(msg, S(msg), "tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] " diff --git a/src/xschem.tcl b/src/xschem.tcl index 11790c9b..3f43be51 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -8562,7 +8562,7 @@ proc set_geom {win {filename {}}} { set geom_file $USER_CONF_DIR/geometry if { [file exists $geom_file]} { - set fd [ open $geom_file] + set fd [open $geom_file] while {[gets $fd line] >= 0} { if { [llength $line] == 2} { lassign $line f g @@ -8601,12 +8601,20 @@ proc set_geom {win {filename {}}} { proc get_lastclosed {} { global USER_CONF_DIR + set geom_file $USER_CONF_DIR/geometry set ret {} - if {[file exists $USER_CONF_DIR/geometry]} { - set ret [lindex [read_data $USER_CONF_DIR/geometry] 0] - if {$ret eq [abs_sym_path untitled.sch]} { - set ret {} + if {[file exists $geom_file]} { + set fd [open $geom_file] + while {[gets $fd line] >= 0} { + set ret [lindex $line 0] + if {$ret eq [abs_sym_path untitled.sch]} { + continue + } + if { $ret ne {}} { + break + } } + close $fd } return $ret }