fix missing save_ctx in create_new_tab and create_new_window when creating new tab/window after the 2nd one, leading to wrong context switches. Added trace command on XSCHEM_LIBRARY_PATH when changing search path. `proc set_paths` is automatically called to cache in the new search path. No need to run it manually
This commit is contained in:
parent
d4641f2b1a
commit
229b07b945
|
|
@ -1452,7 +1452,6 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
|
|||
save_xctx[i] = NULL;
|
||||
my_strncpy(window_path[i], "", S(window_path[i]));
|
||||
}
|
||||
tclvareval("save_ctx ", xctx->current_win_path, NULL);
|
||||
save_xctx[0] = xctx; /* save current schematic */
|
||||
/* window_path[0] = Tk_NameToWindow(interp, ".drw", mainwindow); */
|
||||
my_strncpy(window_path[0], xctx->current_win_path, S(window_path[0]));
|
||||
|
|
@ -1461,6 +1460,7 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
|
|||
dbg(0, "new_schematic(\"create\"...): no more free slots\n");
|
||||
return; /* no more free slots */
|
||||
}
|
||||
tclvareval("save_ctx ", xctx->current_win_path, NULL);
|
||||
(*window_count)++;
|
||||
tclvareval("[xschem get top_path].menubar.simulate configure -bg $simulate_bg", NULL);
|
||||
tcleval(".menubar.view.menu entryconfigure {Tabbed interface} -state disabled");
|
||||
|
|
@ -1545,7 +1545,6 @@ static void create_new_tab(int *window_count, const char *noconfirm, const char
|
|||
save_xctx[i] = NULL;
|
||||
my_strncpy(window_path[i], "", S(window_path[i]));
|
||||
}
|
||||
tclvareval("save_ctx ", xctx->current_win_path, NULL);
|
||||
save_xctx[0] = xctx; /* save current schematic */
|
||||
my_strncpy(window_path[0], xctx->current_win_path, S(window_path[0]));
|
||||
}
|
||||
|
|
@ -1553,6 +1552,7 @@ static void create_new_tab(int *window_count, const char *noconfirm, const char
|
|||
dbg(0, "new_schematic(\"new_tab\"...): no more free slots\n");
|
||||
return; /* no more free slots */
|
||||
}
|
||||
tclvareval("save_ctx ", xctx->current_win_path, NULL);
|
||||
(*window_count)++;
|
||||
tclvareval("[xschem get top_path].menubar.simulate configure -bg $simulate_bg", NULL);
|
||||
tcleval(".menubar.view.menu entryconfigure {Tabbed interface} -state disabled");
|
||||
|
|
|
|||
|
|
@ -5511,6 +5511,12 @@ proc restore_ctx {context} {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
# context is saved in array variable in tctx:: namespace.
|
||||
# to get list of array names:
|
||||
# array names tctx::.drw
|
||||
# array names tctx::.x1.drw
|
||||
# .....
|
||||
proc save_ctx {context} {
|
||||
global has_x
|
||||
if {![info exists has_x]} {return}
|
||||
|
|
@ -6275,11 +6281,20 @@ proc set_initial_dirs {} {
|
|||
}
|
||||
}
|
||||
|
||||
# called whenever XSCHEM_LUBRARY_PATH changes (see trace command at end)
|
||||
proc trace_set_paths {varname idxname op} {
|
||||
if {$varname eq {XSCHEM_LIBRARY_PATH} } {
|
||||
# puts stderr "executing set_paths after XSCHEM_LIBRARY_PATH change"
|
||||
uplevel #0 set_paths
|
||||
}
|
||||
}
|
||||
|
||||
# when XSCHEM_LIBRARY_PATH is changed call this function to refresh and cache
|
||||
# new library search path.
|
||||
proc set_paths {} {
|
||||
global XSCHEM_LIBRARY_PATH env pathlist OS add_all_windows_drives
|
||||
set pathlist {}
|
||||
# puts stderr "caching search paths"
|
||||
if { [info exists XSCHEM_LIBRARY_PATH] } {
|
||||
if {$OS == "Windows"} {
|
||||
set pathlist_orig [split $XSCHEM_LIBRARY_PATH \;]
|
||||
|
|
@ -6733,3 +6748,6 @@ if { $show_infowindow } { wm deiconify .infotext }
|
|||
setup_tcp_xschem
|
||||
setup_tcp_bespice
|
||||
|
||||
# automatically build pathlist whenever XSCHEM_LIBRARY_PATH changes
|
||||
trace add variable XSCHEM_LIBRARY_PATH write trace_set_paths
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue