1 Subject: action routines for switching tabs with neighboring tabs
3 NEdit*text.translations: #override \
4 Shift Ctrl<KeyPress>osfPageUp: switch_previous_document()\n\
5 Shift Ctrl<KeyPress>osfPageDown: switch_next_document()\n\
11 source/menu.c | 18 ++++++++++++++
12 source/window.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 4 files changed, 95 insertions(+), 1 deletion(-)
16 diff --quilt old/source/menu.c new/source/menu.c
19 @@ -330,6 +330,10 @@ static void prevDocumentAP(Widget w, XEv
21 static void lastDocumentAP(Widget w, XEvent *event, String *args,
23 +static void switchNextDocumentAP(Widget w, XEvent *event, String *args,
25 +static void switchPrevDocumentAP(Widget w, XEvent *event, String *args,
27 static void closePaneAP(Widget w, XEvent *event, String *args, Cardinal *nArgs);
28 static void capitalizeAP(Widget w, XEvent *event, String *args,
30 @@ -545,6 +549,8 @@ static XtActionsRec Actions[] = {
31 {"next_document", nextDocumentAP},
32 {"previous_document", prevDocumentAP},
33 {"last_document", lastDocumentAP},
34 + {"switch_next_document", switchNextDocumentAP},
35 + {"switch_previous_document", switchPrevDocumentAP},
36 {"uppercase", capitalizeAP},
37 {"lowercase", lowercaseAP},
38 {"fill-paragraph", fillAP},
39 @@ -3754,6 +3760,18 @@ static void lastDocumentAP(Widget w, XEv
40 LastDocument(WidgetToWindow(w));
43 +static void switchNextDocumentAP(Widget w, XEvent *event, String *args,
46 + SwitchWithNextDocument(WidgetToWindow(w));
49 +static void switchPrevDocumentAP(Widget w, XEvent *event, String *args,
52 + SwitchWithPreviousDocument(WidgetToWindow(w));
55 static void capitalizeAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
57 WindowInfo *window = WidgetToWindow(w);
58 diff --quilt old/source/window.c new/source/window.c
59 --- old/source/window.c
60 +++ new/source/window.c
61 @@ -4068,6 +4068,78 @@ void LastDocument(WindowInfo *window)
65 +** switch current tab with next tab
67 +void SwitchWithNextDocument(WindowInfo *window)
74 + if (WindowList->next == NULL)
77 + win = getNextTabWindow(window, 1, 0, 1);
82 + win->tab = window->tab;
85 + RefreshTabState(win);
86 + RefreshTabState(window);
88 + RaiseDocument(window);
90 + nDoc = NDocuments(window);
91 + XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList, NULL);
92 + for (i = 0; i < nDoc; i++) {
93 + if (window->tab == tabList[i]) {
94 + XmLFolderSetActiveTab(window->tabBar, i, False);
101 +** switch current tab with previous tab
103 +void SwitchWithPreviousDocument(WindowInfo *window)
107 + WidgetList tabList;
110 + if (WindowList->next == NULL)
113 + win = getNextTabWindow(window, -1, 0, 1);
118 + win->tab = window->tab;
121 + RefreshTabState(win);
122 + RefreshTabState(window);
124 + RaiseDocument(window);
126 + nDoc = NDocuments(window);
127 + XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList, NULL);
128 + for (i = 0; i < nDoc; i++) {
129 + if (window->tab == tabList[i]) {
130 + XmLFolderSetActiveTab(window->tabBar, i, False);
137 ** make sure window is alive is kicking
139 int IsValidWindow(WindowInfo *window)
140 diff --quilt old/source/window.h new/source/window.h
141 --- old/source/window.h
142 +++ new/source/window.h
143 @@ -86,6 +86,8 @@ WindowInfo *MarkActiveDocument(WindowInf
144 void NextDocument(WindowInfo *window);
145 void PreviousDocument(WindowInfo *window);
146 void LastDocument(WindowInfo *window);
147 +void SwitchWithNextDocument(WindowInfo *window);
148 +void SwitchWithPreviousDocument(WindowInfo *window);
149 int NDocuments(WindowInfo *window);
150 WindowInfo *MoveDocument(WindowInfo *toWindow, WindowInfo *window);
151 WindowInfo *DetachDocument(WindowInfo *window);
152 diff --quilt old/doc/help.etx new/doc/help.etx
155 @@ -805,7 +805,9 @@ Tabbed Editing
157 Notice that you can re-group tabs at any time by detaching and attaching them,
158 or moving them, to other windows. This can be done using the Windows menu, or
159 - using the context menu, which pops up when right clicking on a tab.
160 + using the context menu, which pops up when right clicking on a tab. You can
161 + also reorder the current tab by switching it with the left or right neighbor
162 + using the actions switch_next_document() or switch_previous_document().
164 You can switch to a tab by simply clicking on it, or you can use the keyboard.
165 The default keybindings to switch tabs (which are Ctrl+PageUp/-Down and Alt+Home,