better apply store_geom when closing or loading a new schematic into a window/tab with an existing schematic

This commit is contained in:
stefan schippers 2026-01-31 11:17:32 +01:00
parent cee25ab335
commit 52b0f98dac
1 changed files with 6 additions and 7 deletions

View File

@ -1119,7 +1119,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
": UNSAVED data: want to exit?\"");
}
if(force || !xctx->modified || !strcmp(tclresult(), "ok")) {
if(has_x) tcleval("store_geom . [xschem get schname]");
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
swap_windows(0);
set_modify(0); /* set modified status to 0 to avoid another confirm in following line */
new_schematic("destroy", xctx->current_win_path, NULL, 0);
@ -1138,7 +1138,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
tcleval(s);
}
else {
if(has_x) tcleval("store_geom . [xschem get schname]");
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
clear_schematic(0, 0);
}
}
@ -1155,7 +1155,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
": UNSAVED data: want to exit?\"");
}
if(!has_x || force || !xctx->modified || !strcmp(tclresult(), "ok")) {
if(has_x) tcleval("store_geom . [xschem get schname]");
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
swap_tabs();
set_modify(0);
new_schematic("destroy", xctx->current_win_path, NULL, 1);
@ -1173,7 +1173,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
tcleval(s);
}
else {
if(has_x) tcleval("store_geom . [xschem get schname]");
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
clear_schematic(0, 0);
}
}
@ -1181,8 +1181,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
} else {
if(force) set_modify(0); /* avoid ask to save downstream */
if(has_x) tclvareval("store_geom ", xctx->top_path[0] ? xctx->top_path : ".",
" [xschem get schname]", NULL);
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
new_schematic("destroy", xctx->current_win_path, NULL, 1);
}
Tcl_SetResult(interp, my_itoa(get_window_count()), TCL_VOLATILE);
@ -3119,7 +3118,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(force || !has_x || !xctx->modified || save(1, 0) != -1 ) { /* save(1)==-1 --> user cancel */
char win_path[WINDOW_PATH_SIZE];
int skip = 0;
if(has_x) tcleval("store_geom . [xschem get schname]");
if(has_x) tcleval("store_geom [xschem get toplevel] [xschem get schname]");
dbg(1, "scheduler(): load: filename=%s\n", f);
my_strncpy(f, abs_sym_path(f, ""), S(f));
if(!force && f[0] && check_loaded(f, win_path) &&