3 doc/help.etx | 22 +++++++++++++---------
4 source/text.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
5 util/misc.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
6 3 files changed, 104 insertions(+), 11 deletions(-)
8 diff --quilt old/source/text.c new/source/text.c
11 @@ -426,10 +426,16 @@ static char defaultTranslations[] =
12 "Ctrl~Meta~Alt Button3<MotionNotify>: mouse_pan()\n"
13 "<Btn3Up>: end_drag()\n"
14 "<FocusIn>: focusIn()\n"
15 "<FocusOut>: focusOut()\n"
16 /* Support for mouse wheel in XFree86 */
17 + "Shift Alt<Btn4Down>,<Btn4Up>: scroll_left(1)\n"
18 + "Shift Alt<Btn5Down>,<Btn5Up>: scroll_right(1)\n"
19 + "Ctrl Alt<Btn4Down>,<Btn4Up>: scroll_left(1, tab)\n"
20 + "Ctrl Alt<Btn5Down>,<Btn5Up>: scroll_right(1, tab)\n"
21 + "Alt<Btn4Down>,<Btn4Up>: scroll_left(1, char)\n"
22 + "Alt<Btn5Down>,<Btn5Up>: scroll_right(1, char)\n"
23 "Shift<Btn4Down>,<Btn4Up>: scroll_up(1)\n"
24 "Shift<Btn5Down>,<Btn5Up>: scroll_down(1)\n"
25 "Ctrl<Btn4Down>,<Btn4Up>: scroll_up(1, pages)\n"
26 "Ctrl<Btn5Down>,<Btn5Up>: scroll_down(1, pages)\n"
27 "<Btn4Down>,<Btn4Up>: scroll_up(5)\n"
28 @@ -3399,12 +3405,31 @@ static void scrollLeftAP(Widget w, XEven
29 int horizOffset, nPixels;
30 int sliderMax, sliderSize;
32 if (*nArgs == 0 || sscanf(args[0], "%d", &nPixels) != 1)
36 + if (strncmp(args[1], "char", 4) == 0) {
37 + nPixels *= TextDMinFontWidth(textD, True);
39 + else if (strncmp(args[1], "tab", 3) == 0) {
40 + nPixels *= TextDMinFontWidth(textD, True) * textD->buffer->tabDist;
42 + else if (strncmp(args[1], "emtab", 5) == 0) {
43 + int tabDist = ((TextWidget)w)->text.emulateTabs;
45 + tabDist = textD->buffer->tabDist;
46 + nPixels *= TextDMinFontWidth(textD, True) * tabDist;
48 + else if (strncmp(args[1], "pixel", 5) != 0) {
53 XtVaGetValues(textD->hScrollBar, XmNmaximum, &sliderMax,
54 - XmNsliderSize, &sliderSize, NULL);
55 + XmNsliderSize, &sliderSize, NULL);
56 horizOffset = min(max(0, textD->horizOffset - nPixels), sliderMax - sliderSize);
57 if (textD->horizOffset != horizOffset) {
58 TextDSetScroll(textD, textD->topLineNum, horizOffset);
61 @@ -3416,10 +3441,29 @@ static void scrollRightAP(Widget w, XEve
62 int horizOffset, nPixels;
63 int sliderMax, sliderSize;
65 if (*nArgs == 0 || sscanf(args[0], "%d", &nPixels) != 1)
69 + if (strncmp(args[1], "char", 4) == 0) {
70 + nPixels *= TextDMinFontWidth(textD, True);
72 + else if (strncmp(args[1], "tab", 3) == 0) {
73 + nPixels *= TextDMinFontWidth(textD, True) * textD->buffer->tabDist;
75 + else if (strncmp(args[1], "emtab", 5) == 0) {
76 + int tabDist = ((TextWidget)w)->text.emulateTabs;
78 + tabDist = textD->buffer->tabDist;
79 + nPixels *= TextDMinFontWidth(textD, True) * tabDist;
81 + else if (strncmp(args[1], "pixel", 5) != 0) {
86 XtVaGetValues(textD->hScrollBar, XmNmaximum, &sliderMax,
87 XmNsliderSize, &sliderSize, NULL);
88 horizOffset = min(max(0, textD->horizOffset + nPixels), sliderMax - sliderSize);
89 if (textD->horizOffset != horizOffset) {
90 TextDSetScroll(textD, textD->topLineNum, horizOffset);
91 diff --quilt old/util/misc.c new/util/misc.c
94 @@ -154,10 +154,14 @@ static void scrollUpAP(Widget w, XEvent
96 static void pageDownAP(Widget w, XEvent *event, String *args,
98 static void pageUpAP(Widget w, XEvent *event, String *args,
100 +static void scrollLeftAP(Widget w, XEvent *event, String *args,
102 +static void scrollRightAP(Widget w, XEvent *event, String *args,
104 static long queryDesktop(Display *display, Window window, Atom deskTopAtom);
105 static void warning(const char* mesg);
106 static void microsleep(long usecs);
109 @@ -1927,11 +1931,13 @@ void InstallMouseWheelActions(XtAppConte
111 static XtActionsRec Actions[] = {
112 {"scrolled-window-scroll-up", scrollUpAP},
113 {"scrolled-window-page-up", pageUpAP},
114 {"scrolled-window-scroll-down", scrollDownAP},
115 - {"scrolled-window-page-down", pageDownAP}
116 + {"scrolled-window-page-down", pageDownAP},
117 + {"scrolled-window-scroll-left", scrollLeftAP},
118 + {"scrolled-window-scroll-right", scrollRightAP}
121 XtAppAddActions(context, Actions, XtNumber(Actions));
124 @@ -1942,10 +1948,16 @@ void InstallMouseWheelActions(XtAppConte
125 void AddMouseWheelSupport(Widget w)
127 if (XmIsScrolledWindow(XtParent(w)))
129 static const char scrollTranslations[] =
130 + "Shift Alt<Btn4Down>,<Btn4Up>: scrolled-window-scroll-left(1)\n"
131 + "Shift Alt<Btn5Down>,<Btn5Up>: scrolled-window-scroll-right(1)\n"
132 + "Ctrl Alt<Btn4Down>,<Btn4Up>: scrolled-window-scroll-left(8)\n"
133 + "Ctrl Alt<Btn5Down>,<Btn5Up>: scrolled-window-scroll-right(8)\n"
134 + "Alt<Btn4Down>,<Btn4Up>: scrolled-window-scroll-left(4)\n"
135 + "Alt<Btn5Down>,<Btn5Up>: scrolled-window-scroll-right(4)\n"
136 "Shift<Btn4Down>,<Btn4Up>: scrolled-window-scroll-up(1)\n"
137 "Shift<Btn5Down>,<Btn5Up>: scrolled-window-scroll-down(1)\n"
138 "Ctrl<Btn4Down>,<Btn4Up>: scrolled-window-page-up()\n"
139 "Ctrl<Btn5Down>,<Btn5Up>: scrolled-window-page-down()\n"
140 "<Btn4Down>,<Btn4Up>: scrolled-window-scroll-up(3)\n"
141 @@ -2018,10 +2030,43 @@ static void scrollDownAP(Widget w, XEven
142 for (i=0; i<nLines; i++)
143 XtCallActionProc(scrollBar, "IncrementDownOrRight", event, al, 1) ;
147 +static void scrollLeftAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
149 + Widget scrolledWindow, scrollBar;
153 + if (*nArgs == 0 || sscanf(args[0], "%d", &nLines) != 1)
156 + scrolledWindow = XtParent(w);
157 + scrollBar = XtNameToWidget (scrolledWindow, "HorScrollBar");
159 + for (i=0; i<nLines; i++)
160 + XtCallActionProc(scrollBar, "IncrementUpOrLeft", event, al, 1) ;
164 +static void scrollRightAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
166 + Widget scrolledWindow, scrollBar;
170 + if (*nArgs == 0 || sscanf(args[0], "%d", &nLines) != 1)
173 + scrolledWindow = XtParent(w);
174 + scrollBar = XtNameToWidget (scrolledWindow, "HorScrollBar");
176 + for (i=0; i<nLines; i++)
177 + XtCallActionProc(scrollBar, "IncrementDownOrRight", event, al, 1) ;
182 ** This is a disguisting hack to work around a bug in OpenMotif.
183 ** OpenMotif's toggle button Select() action routine remembers the last radio
184 ** button that was toggled (stored as global state) and refuses to take any
185 diff --quilt old/doc/help.etx new/doc/help.etx
188 @@ -2480,11 +2480,11 @@ Macro Subroutines
191 Width of the current pane in pixels.
194 - If tab emulation is turned on in the Tabs...
195 + If tab emulation is turned on in the Tab Stops...
196 dialog of the Preferences menu, the value is the
197 distance between emulated tab stops. If tab
198 emulation is turned off, the value is 0.
201 @@ -2599,23 +2599,23 @@ Macro Subroutines
202 Contains the value of the array sub-script separation string.
205 The distance between tab stops for a
206 hardware tab character, as set in the
207 - Tabs... dialog of the Preferences menu.
208 + Tab Stops... dialog of the Preferences menu.
211 The length of the text in the current document.
214 The line number of the top line of the currently active pane.
217 Whether the user is allowing the NEdit to insert tab characters to maintain
218 spacing in tab emulation and rectangular dragging operations. (The setting of
219 - the "Use tab characters in padding and emulated tabs" button in the Tabs...
220 - dialog of the Preferences menu.)
221 + the "Use tab characters in padding and emulated tabs" button in the
222 + Tab Stops... dialog of the Preferences menu.)
225 The right margin in the current window for text wrapping and filling.
228 @@ -3761,15 +3761,19 @@ Action Routines
230 **scroll_down( nUnits, ["lines" | "pages"] )**
231 Scroll the display down (towards the end of the file) by a given
232 number of units, units being lines or pages. Default units are lines.
234 -**scroll_left( nPixels )**
235 - Scroll the display left by nPixels.
237 -**scroll_right( nPixels )**
238 - Scroll the display right by nPixels.
239 +**scroll_left( nUnits, ["chars" | "tabs" | "emtabs" | "pixels"] )**
240 + Scroll the display left by a given number of units, units being characters,
241 + hardware tab stop spacing, emulated tab stop spacing, or pixels. If emulated
242 + tabs are disabled in the Tab Stops... dialog, "emtabs" is the same as "tabs".
244 +**scroll_right( nUnits, ["chars" | "tabs" | "emtabs" | "pixels"] )**
245 + Scroll the display right by a given number of units, units being characters,
246 + hardware tab stop spacing, emulated tab stop spacing, or pixels. If emulated
247 + tabs are disabled in the Tab Stops... dialog, "emtabs" is the same as "tabs".
249 **scroll_up( nUnits, ["lines" | "pages"] )**
250 Scroll the display up (towards the beginning of the file) by a given
251 number of units, units being lines or pages. Default units are lines.