diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index e5e97533..2f743cee 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1593,6 +1593,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Switch context to indicated window path or schematic name
returns 0 if switch was successfull or 1 in case of errors
+ if "previous" given as window path switch to previously active tab
+ (only for tabbed interface)
(no tabs/windows present or no matching win_path / schematic name
found).
diff --git a/src/callback.c b/src/callback.c
index 56f6c389..4822ca84 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -3806,7 +3806,8 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
int save = xctx->semaphore;
if(xctx->semaphore >= 2) break;
xctx->semaphore = 0;
- tcleval("next_tab");
+ /* tcleval("next_tab"); */
+ new_schematic("switch", "previous", "", 1);
xctx->semaphore = save;
}
break;
diff --git a/src/scheduler.c b/src/scheduler.c
index df471237..f5386e48 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -5959,6 +5959,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* switch [window_path |schematic_name]
* Switch context to indicated window path or schematic name
* returns 0 if switch was successfull or 1 in case of errors
+ * if "previous" given as window path switch to previously active tab
+ * (only for tabbed interface)
* (no tabs/windows present or no matching win_path / schematic name
* found).
*/
diff --git a/src/xinit.c b/src/xinit.c
index 3a8ce74e..32afaec4 100644
--- a/src/xinit.c
+++ b/src/xinit.c
@@ -1527,6 +1527,9 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
dbg(0, "switch_window(): no filename or window path given\n");
return 1;
}
+ if(win_path && !strcmp(win_path, "previous")) {
+ return 1; /* not used in window interface, only for tabbed interface */
+ }
if(!strcmp(win_path, xctx->current_win_path)) return 0; /* already there */
n = get_tab_or_window_number(win_path);
if(n == 0) my_snprintf(my_win_path, S(my_win_path), ".drw");
@@ -1566,26 +1569,39 @@ static int switch_window(int *window_count, const char *win_path, int tcl_ctx)
static int switch_tab(int *window_count, const char *win_path, int dr)
{
int n;
-
+ static char previous_win_path[200] = "";
+ const char *new_path = win_path;
dbg(1, "switch_tab(): win_path=%s\n", win_path);
if(xctx->semaphore) return 1; /* some editing operation ongoing. do nothing */
if(!win_path) {
dbg(0, "switch_tab(): no filename or window path given\n");
return 1;
}
- if(!strcmp(win_path, xctx->current_win_path)) return 0; /* already there */
- n = get_tab_or_window_number(win_path);
+
+ if(win_path && !strcmp(win_path, "previous")) {
+ if(previous_win_path[0]) {
+ new_path = previous_win_path;
+ }
+ else return 1;
+ }
+
+ if(!strcmp(new_path, xctx->current_win_path)) return 0; /* already there */
+ n = get_tab_or_window_number(new_path);
if(n == -1) {
- dbg(0, "new_schematic(\"switch_tab\"...): no tab to switch to found: %s\n", win_path);
+ dbg(0, "new_schematic(\"switch_tab\"...): no tab to switch to found: %s\n", new_path);
return 1;
}
if(*window_count) {
- dbg(1, "new_schematic() switch_tab: %s\n", win_path);
+ dbg(1, "new_schematic() switch_tab: %s\n", new_path);
/* if no matching tab found --> do nothing */
if(n >= 0 && n < MAX_NEW_WINDOWS) {
+ if(xctx->current_win_path) {
+ my_strncpy(previous_win_path, xctx->current_win_path, sizeof(previous_win_path));
+ }
+ dbg(1, "switch_tab(): previous_win_path=%s\n", previous_win_path);
tclvareval("save_ctx ", xctx->current_win_path, NULL);
xctx = save_xctx[n];
- tclvareval("restore_ctx ", win_path, NULL);
+ tclvareval("restore_ctx ", new_path, NULL);
tclvareval("housekeeping_ctx", NULL);
if(has_x) tclvareval("reconfigure_layers_button {}", NULL);
xctx->window = save_xctx[0]->window;
diff --git a/src/xschem.tcl b/src/xschem.tcl
index 857077a1..c38472f7 100644
--- a/src/xschem.tcl
+++ b/src/xschem.tcl
@@ -8171,7 +8171,6 @@ proc swap_tabs {x y what} {
raise .tabs.mm
}
}
-
} else {
bind .tabs {}
place forget .tabs.mm