show modify status (*) in tab names, master tab has red foreground

This commit is contained in:
Stefan Frederik 2022-01-13 00:58:00 +01:00
parent 772a6c9f39
commit 54f3211d51
3 changed files with 10 additions and 7 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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
}