when switching to a different tab/window the related schematic will be marked as dirty (asterisk) if underlying file is changed.
This commit is contained in:
parent
b5de718d63
commit
6ca06347b6
18
src/xinit.c
18
src/xinit.c
|
|
@ -1552,6 +1552,8 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
|
|||
}
|
||||
/* if window was closed then tkwin == 0 --> do nothing */
|
||||
if(tkwin && n >= 0 && n < MAX_NEW_WINDOWS) {
|
||||
struct stat buf;
|
||||
|
||||
if(tcl_ctx) tclvareval("save_ctx ", xctx->current_win_path, NULL);
|
||||
xctx = save_xctx[n];
|
||||
if(tcl_ctx) {
|
||||
|
|
@ -1559,7 +1561,12 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
|
|||
tclvareval("housekeeping_ctx", NULL);
|
||||
}
|
||||
if(tcl_ctx && has_x) tclvareval("reconfigure_layers_button {}", NULL);
|
||||
set_modify(-1); /* sets window title */
|
||||
if(!stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify &&
|
||||
xctx->time_last_modify != buf.st_mtime) {
|
||||
set_modify(1);
|
||||
} else {
|
||||
set_modify(-1); /* sets window title */
|
||||
}
|
||||
return 0;
|
||||
} else return 1;
|
||||
}
|
||||
|
|
@ -1596,6 +1603,7 @@ static int switch_tab(int *window_count, const char *win_path, int dr)
|
|||
dbg(1, "new_schematic() switch_tab: %s\n", new_path);
|
||||
/* if no matching tab found --> do nothing */
|
||||
if(n >= 0 && n < MAX_NEW_WINDOWS) {
|
||||
struct stat buf;
|
||||
if(xctx->current_win_path) {
|
||||
my_strncpy(previous_win_path, xctx->current_win_path, sizeof(previous_win_path));
|
||||
}
|
||||
|
|
@ -1607,7 +1615,13 @@ static int switch_tab(int *window_count, const char *win_path, int dr)
|
|||
if(has_x) tclvareval("reconfigure_layers_button {}", NULL);
|
||||
xctx->window = save_xctx[0]->window;
|
||||
if(dr) resetwin(1, 1, 1, 0, 0);
|
||||
set_modify(-1); /* sets window title */
|
||||
/* file exists and modification time on disk has changed since file loaded ... */
|
||||
if(!stat( xctx->sch[xctx->currsch], &buf) && xctx->time_last_modify &&
|
||||
xctx->time_last_modify != buf.st_mtime) {
|
||||
set_modify(1);
|
||||
} else {
|
||||
set_modify(-1); /* sets window title */
|
||||
}
|
||||
if(dr) draw();
|
||||
return 0;
|
||||
} else return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue