Index: source/menu.c =================================================================== RCS file: /cvsroot/nedit/nedit/source/menu.c,v retrieving revision 1.112 diff -u -U5 -r1.112 menu.c --- source/menu.c 20 Aug 2004 19:33:20 -0000 1.112 +++ source/menu.c 1 Sep 2004 13:25:27 -0000 @@ -307,10 +307,14 @@ Cardinal *nArgs); static void prevDocumentAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); static void lastDocumentAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); +static void switchNextDocumentAP(Widget w, XEvent *event, String *args, + Cardinal *nArgs); +static void switchPrevDocumentAP(Widget w, XEvent *event, String *args, + Cardinal *nArgs); static void closePaneAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); static void capitalizeAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); static void lowercaseAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); static void fillAP(Widget w, XEvent *event, String *args, Cardinal *nArgs); @@ -519,10 +523,12 @@ {"detach_document_dialog", detachDocumentDialogAP}, {"move_document_dialog", moveDocumentDialogAP}, {"next_document", nextDocumentAP}, {"previous_document", prevDocumentAP}, {"last_document", lastDocumentAP}, + {"switch_next_document", switchNextDocumentAP}, + {"switch_previous_document", switchPrevDocumentAP}, {"uppercase", capitalizeAP}, {"lowercase", lowercaseAP}, {"fill-paragraph", fillAP}, {"fill_paragraph", fillAP}, {"control-code-dialog", controlDialogAP}, @@ -3491,10 +3497,22 @@ Cardinal *nArgs) { LastDocument(WidgetToWindow(w)); } +static void switchNextDocumentAP(Widget w, XEvent *event, String *args, + Cardinal *nArgs) +{ + SwitchWithNextDocument(WidgetToWindow(w)); +} + +static void switchPrevDocumentAP(Widget w, XEvent *event, String *args, + Cardinal *nArgs) +{ + SwitchWithPreviousDocument(WidgetToWindow(w)); +} + static void capitalizeAP(Widget w, XEvent *event, String *args, Cardinal *nArgs) { WindowInfo *window = WidgetToWindow(w); if (CheckReadOnly(window)) Index: source/text.c =================================================================== RCS file: /cvsroot/nedit/nedit/source/text.c,v retrieving revision 1.48 diff -u -U5 -r1.48 text.c --- source/text.c 28 Jul 2004 18:02:03 -0000 1.48 +++ source/text.c 1 Sep 2004 13:25:29 -0000 @@ -344,21 +344,21 @@ /* PageUp */ "Alt Shift CtrlosfPageUp: page_left(\"extend\", \"rect\")\n" "Meta Shift CtrlosfPageUp: page_left(\"extend\", \"rect\")\n" "Alt ShiftosfPageUp: previous_page(\"extend\", \"rect\")\n" "Meta ShiftosfPageUp: previous_page(\"extend\", \"rect\")\n" - "Shift CtrlosfPageUp: page_left(\"extend\")\n" + "Shift CtrlosfPageUp: switch_previous_document()\n" "CtrlosfPageUp: previous_document()\n" "ShiftosfPageUp: previous_page(\"extend\")\n" "~Alt ~Shift ~Ctrl ~MetaosfPageUp: previous_page()\n" /* PageDown */ "Alt Shift CtrlosfPageDown: page_right(\"extend\", \"rect\")\n" "Meta Shift CtrlosfPageDown: page_right(\"extend\", \"rect\")\n" "Alt ShiftosfPageDown: next_page(\"extend\", \"rect\")\n" "Meta ShiftosfPageDown: next_page(\"extend\", \"rect\")\n" - "Shift CtrlosfPageDown: page_right(\"extend\")\n" + "Shift CtrlosfPageDown: switch_next_document()\n" "CtrlosfPageDown: next_document()\n" "ShiftosfPageDown: next_page(\"extend\")\n" "~Alt ~Shift ~Ctrl ~MetaosfPageDown: next_page()\n" /* PageLeft and PageRight are placed later than the PageUp/PageDown Index: source/window.c =================================================================== RCS file: /cvsroot/nedit/nedit/source/window.c,v retrieving revision 1.171 diff -u -U5 -r1.171 window.c --- source/window.c 31 Aug 2004 21:37:57 -0000 1.171 +++ source/window.c 1 Sep 2004 13:25:33 -0000 @@ -3760,10 +3760,82 @@ RaiseDocumentWindow(win); } /* +** switch current tab with next tab +*/ +void SwitchWithNextDocument(WindowInfo *window) +{ + WindowInfo *win; + Widget w; + WidgetList tabList; + int i, nDoc; + + if (WindowList->next == NULL) + return; + + win = getNextTabWindow(window, 1, 0, 1); + if (win == NULL) + return; + + w = win->tab; + win->tab = window->tab; + window->tab = w; + + RefreshTabState(win); + RefreshTabState(window); + + RaiseDocument(window); + + nDoc = NDocuments(window); + XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList, NULL); + for (i = 0; i < nDoc; i++) { + if (window->tab == tabList[i]) { + XmLFolderSetActiveTab(window->tabBar, i, False); + break; + } + } +} + +/* +** switch current tab with previous tab +*/ +void SwitchWithPreviousDocument(WindowInfo *window) +{ + WindowInfo *win; + Widget w; + WidgetList tabList; + int i, nDoc; + + if (WindowList->next == NULL) + return; + + win = getNextTabWindow(window, -1, 0, 1); + if (win == NULL) + return; + + w = win->tab; + win->tab = window->tab; + window->tab = w; + + RefreshTabState(win); + RefreshTabState(window); + + RaiseDocument(window); + + nDoc = NDocuments(window); + XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList, NULL); + for (i = 0; i < nDoc; i++) { + if (window->tab == tabList[i]) { + XmLFolderSetActiveTab(window->tabBar, i, False); + break; + } + } +} + +/* ** make sure window is alive is kicking */ int IsValidWindow(WindowInfo *window) { WindowInfo *win; Index: source/window.h =================================================================== RCS file: /cvsroot/nedit/nedit/source/window.h,v retrieving revision 1.25 diff -u -U5 -r1.25 window.h --- source/window.h 20 Aug 2004 19:33:21 -0000 1.25 +++ source/window.h 1 Sep 2004 13:25:33 -0000 @@ -87,10 +87,12 @@ WindowInfo *MarkLastDocument(WindowInfo *window); WindowInfo *MarkActiveDocument(WindowInfo *window); void NextDocument(WindowInfo *window); void PreviousDocument(WindowInfo *window); void LastDocument(WindowInfo *window); +void SwitchWithNextDocument(WindowInfo *window); +void SwitchWithPreviousDocument(WindowInfo *window); int NDocuments(WindowInfo *window); WindowInfo *MoveDocument(WindowInfo *toWindow, WindowInfo *window); WindowInfo *DetachDocument(WindowInfo *window); void MoveDocumentDialog(WindowInfo *window); WindowInfo* GetTopDocument(Widget w);