better usage of no_ask_save tcl var (keep asking to save modified schematics when navigating hierarchy to avoid nuking edits)

This commit is contained in:
stefan schippers 2026-02-13 13:55:05 +01:00
parent d3ec547394
commit 9532340a0e
2 changed files with 5 additions and 4 deletions

View File

@ -563,7 +563,7 @@ int save(int confirm, int fast)
{
dbg(1, "save(): force=%d modified=%d\n", force, xctx->modified);
if(confirm) {
tcleval("ask_save_optional");
tcleval("ask_save");
if(!strcmp(tclresult(), "") ) return -1; /* user clicks "Cancel" */
else if(!strcmp(tclresult(), "yes") ) return save_schematic(xctx->sch[xctx->currsch], fast);
else return 0; /* user clicks "no" */
@ -2619,7 +2619,7 @@ void go_back(int what)
if(xctx->modified)
{
if(confirm) {
tcleval("ask_save_optional");
tcleval("ask_save");
if(!strcmp(tclresult(), "yes") ) save_ok = save_schematic(xctx->sch[xctx->currsch], 0);
else if(!strcmp(tclresult(), "") ) return;
}

View File

@ -3404,7 +3404,8 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
if(!strcmp(xctx->sch[xctx->currsch],"") || strstr(xctx->sch[xctx->currsch], "untitled")) {
saveas(NULL, SCHEMATIC);
} else {
save(1, 0);
int confirm = !tclgetboolvar("no_ask_save");
save(confirm, 0);
}
}
@ -3858,7 +3859,7 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
}
break;
case XK_ISO_Left_Tab:
case XK_ISO_Left_Tab: /* Shift is pressed */
if(state == (ControlMask | ShiftMask)) {
int save = xctx->semaphore;
if(xctx->semaphore >= 2) break;