From 54f3211d5103a0cf4aa0f39fdae72a0c63579afd Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Thu, 13 Jan 2022 00:58:00 +0100 Subject: [PATCH] show modify status (*) in tab names, master tab has red foreground --- src/actions.c | 5 +++-- src/xinit.c | 5 ++++- src/xschem.tcl | 7 +++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/actions.c b/src/actions.c index 369a6e98..a0cd9dc3 100644 --- a/src/actions.c +++ b/src/actions.c @@ -85,7 +85,7 @@ void set_modify(int mod) dbg(1, "set_modify(): %d\n", mod); if(mod == -1 || mod != xctx->prev_set_modify) { /* mod=-1 used to force set title */ if(mod != -1) xctx->prev_set_modify = mod; - else mod = 0; + else mod = xctx->modified; if(has_x && strcmp(get_cell(xctx->sch[xctx->currsch],1), "systemlib/font")) { if(mod == 1) { tclvareval("wm title ", top_path, " \"xschem - [file tail [xschem get schname]]*\"", NULL); @@ -96,7 +96,8 @@ void set_modify(int mod) } } } - tcleval("set_tab_names"); + if(xctx->modified) tcleval("set_tab_names *"); + else tcleval("set_tab_names"); } void print_version() diff --git a/src/xinit.c b/src/xinit.c index 1fd0ebc4..68175dc4 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1036,7 +1036,7 @@ static void switch_tab(int *window_count, const char *win_path) dbg(0, "new_schematic(\"switch_tab\"...): no tab to switch to found: %s\n", win_path); return; } - /* if window was closed then tkwin == 0 --> do nothing */ + /* if no matching tab found --> do nothing */ if(n >= 0 && n < MAX_NEW_WINDOWS) { tclvareval("save_ctx ", xctx->current_win_path, NULL); xctx = save_xctx[n]; @@ -1304,6 +1304,7 @@ static void destroy_tab(int *window_count, const char *win_path) if(*window_count == 0) tcleval(".menubar.view.menu entryconfigure 21 -state normal"); } xctx = save_xctx[0]; /* restore main (.drw) schematic */ + resetwin(1, 0, 0, 0, 0); /* create pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */ tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL); set_modify(-1); /* sets window title */ draw(); @@ -1644,7 +1645,9 @@ int Tcl_AppInit(Tcl_Interp *inter) { char name[PATH_MAX]; /* overflow safe 20161122 */ char tmp[2*PATH_MAX+100]; /* 20161122 overflow safe */ +#ifndef __unix__ char install_dir[PATH_MAX] = ""; +#endif int i; double l_width; struct stat buf; diff --git a/src/xschem.tcl b/src/xschem.tcl index 61b534ac..1ac1637d 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3734,7 +3734,7 @@ proc setup_tabbed_interface {} { if {$tabbed_interface} { .menubar.file.menu entryconfigure 6 -state disabled .menubar.file.menu entryconfigure 7 -state disabled - set_tab_names + set_tab_names } else { .menubar.file.menu entryconfigure 6 -state normal .menubar.file.menu entryconfigure 7 -state normal @@ -3823,15 +3823,14 @@ proc next_tab {} { .tabs.x$next_tab invoke } -proc set_tab_names {} { +proc set_tab_names {{mod {}}} { global tabbed_interface has_x if {[info exists has_x] && $tabbed_interface } { set currwin [xschem get current_win_path] regsub {\.drw} $currwin {} tabname if {$tabname eq {}} { set tabname .x0} - # puts "set_tab_names : currwin=$currwin" - .tabs$tabname configure -text [file tail [xschem get schname]] -bg Palegreen + .tabs$tabname configure -text [file tail [xschem get schname]]$mod -bg Palegreen if {$tabname eq {.x0}} { .tabs$tabname configure -fg red }