annotate oldXMenu/Internal.c @ 72397:11e68a34a4bd

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 15 Aug 2006 02:50:30 +0000
parents e8a3fb527b77
children ce127a46b1ca d04d8ccb3c41 c5406394f567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
1 #include "copyright.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
2
Dave Love <fx@gnu.org>
parents:
diff changeset
3 /* Copyright Massachusetts Institute of Technology 1985 */
68640
e8a3fb527b77 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65000
diff changeset
4 /* Copyright (C) 2002, 2003, 2004, 2005,
e8a3fb527b77 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65000
diff changeset
5 2006 Free Software Foundation, Inc. */
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
6
Dave Love <fx@gnu.org>
parents:
diff changeset
7 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
8 * XMenu: MIT Project Athena, X Window system menu package
Dave Love <fx@gnu.org>
parents:
diff changeset
9 *
Dave Love <fx@gnu.org>
parents:
diff changeset
10 * XMenuInternal.c - XMenu internal (not user visible) routines.
Dave Love <fx@gnu.org>
parents:
diff changeset
11 *
Dave Love <fx@gnu.org>
parents:
diff changeset
12 * Author: Tony Della Fera, DEC
Dave Love <fx@gnu.org>
parents:
diff changeset
13 * November, 1985
Dave Love <fx@gnu.org>
parents:
diff changeset
14 *
Dave Love <fx@gnu.org>
parents:
diff changeset
15 */
Dave Love <fx@gnu.org>
parents:
diff changeset
16
Dave Love <fx@gnu.org>
parents:
diff changeset
17 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
18 #include "XMenuInt.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
19
Dave Love <fx@gnu.org>
parents:
diff changeset
20 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
21 * Toggle color macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
22 */
Dave Love <fx@gnu.org>
parents:
diff changeset
23 #define toggle_color(x) \
Dave Love <fx@gnu.org>
parents:
diff changeset
24 ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
Dave Love <fx@gnu.org>
parents:
diff changeset
25
Dave Love <fx@gnu.org>
parents:
diff changeset
26 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
27 * Internal Window creation queue sizes.
Dave Love <fx@gnu.org>
parents:
diff changeset
28 */
Dave Love <fx@gnu.org>
parents:
diff changeset
29 #define S_QUE_SIZE 300
Dave Love <fx@gnu.org>
parents:
diff changeset
30 #define P_QUE_SIZE 20
Dave Love <fx@gnu.org>
parents:
diff changeset
31 #define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
Dave Love <fx@gnu.org>
parents:
diff changeset
32
Dave Love <fx@gnu.org>
parents:
diff changeset
33
Dave Love <fx@gnu.org>
parents:
diff changeset
34 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
35 * XMWinQue - Internal window creation queue datatype.
Dave Love <fx@gnu.org>
parents:
diff changeset
36 */
Dave Love <fx@gnu.org>
parents:
diff changeset
37 typedef struct _xmwinquedef {
Dave Love <fx@gnu.org>
parents:
diff changeset
38 int sq_size;
Dave Love <fx@gnu.org>
parents:
diff changeset
39 XMSelect *sq[S_QUE_SIZE];
Dave Love <fx@gnu.org>
parents:
diff changeset
40 XMSelect **sq_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
41 int pq_size;
Dave Love <fx@gnu.org>
parents:
diff changeset
42 XMPane *pq[P_QUE_SIZE];
Dave Love <fx@gnu.org>
parents:
diff changeset
43 XMPane **pq_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
44 } XMWinQue;
Dave Love <fx@gnu.org>
parents:
diff changeset
45
Dave Love <fx@gnu.org>
parents:
diff changeset
46 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
47 * _XMWinQue - Internal static window creation queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
48 */
Dave Love <fx@gnu.org>
parents:
diff changeset
49 static Bool _XMWinQueIsInit = False;
Dave Love <fx@gnu.org>
parents:
diff changeset
50 static XMWinQue _XMWinQue;
Dave Love <fx@gnu.org>
parents:
diff changeset
51
Dave Love <fx@gnu.org>
parents:
diff changeset
52 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
53 * _XMErrorCode - Global XMenu error code.
Dave Love <fx@gnu.org>
parents:
diff changeset
54 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
55 int _XMErrorCode = XME_NO_ERROR;
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
56 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
57 * _XMErrorList - Global XMenu error code description strings.
Dave Love <fx@gnu.org>
parents:
diff changeset
58 */
Dave Love <fx@gnu.org>
parents:
diff changeset
59 char *
Dave Love <fx@gnu.org>
parents:
diff changeset
60 _XMErrorList[XME_CODE_COUNT] = {
Dave Love <fx@gnu.org>
parents:
diff changeset
61 "No error", /* XME_NO_ERROR */
Dave Love <fx@gnu.org>
parents:
diff changeset
62 "Menu not initialized", /* XME_NOT_INIT */
Dave Love <fx@gnu.org>
parents:
diff changeset
63 "Argument out of bounds", /* XME_ARG_BOUNDS */
Dave Love <fx@gnu.org>
parents:
diff changeset
64 "Pane not found", /* XME_P_NOT_FOUND */
Dave Love <fx@gnu.org>
parents:
diff changeset
65 "Selection not found", /* XME_S_NOT_FOUND */
Dave Love <fx@gnu.org>
parents:
diff changeset
66 "Invalid menu style parameter", /* XME_STYLE_PARAM */
Dave Love <fx@gnu.org>
parents:
diff changeset
67 "Unable to grab mouse", /* XME_GRAB_MOUSE */
Dave Love <fx@gnu.org>
parents:
diff changeset
68 "Unable to interpret locator", /* XME_INTERP_LOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
69 "Unable to calloc memory", /* XME_CALLOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
70 "Unable to create XAssocTable", /* XME_CREATE_ASSOC */
Dave Love <fx@gnu.org>
parents:
diff changeset
71 "Unable to store bitmap", /* XME_STORE_BITMAP */
Dave Love <fx@gnu.org>
parents:
diff changeset
72 "Unable to make tile pixmaps", /* XME_MAKE_TILES */
Dave Love <fx@gnu.org>
parents:
diff changeset
73 "Unable to make pixmap", /* XME_MAKE_PIXMAP */
Dave Love <fx@gnu.org>
parents:
diff changeset
74 "Unable to create cursor", /* XME_CREATE_CURSOR */
Dave Love <fx@gnu.org>
parents:
diff changeset
75 "Unable to open font", /* XME_OPEN_FONT */
Dave Love <fx@gnu.org>
parents:
diff changeset
76 "Unable to create windows", /* XME_CREATE_WINDOW */
Dave Love <fx@gnu.org>
parents:
diff changeset
77 "Unable to create transparencies", /* XME_CREATE_TRANSP */
Dave Love <fx@gnu.org>
parents:
diff changeset
78 };
Dave Love <fx@gnu.org>
parents:
diff changeset
79
Dave Love <fx@gnu.org>
parents:
diff changeset
80 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
81 * _XMEventHandler - Internal event handler variable.
Dave Love <fx@gnu.org>
parents:
diff changeset
82 */
Dave Love <fx@gnu.org>
parents:
diff changeset
83 int (*_XMEventHandler)() = NULL;
Dave Love <fx@gnu.org>
parents:
diff changeset
84
Dave Love <fx@gnu.org>
parents:
diff changeset
85
Dave Love <fx@gnu.org>
parents:
diff changeset
86
Dave Love <fx@gnu.org>
parents:
diff changeset
87 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
88 * _XMWinQueInit - Internal routine to initialize the window
Dave Love <fx@gnu.org>
parents:
diff changeset
89 * queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
90 */
Dave Love <fx@gnu.org>
parents:
diff changeset
91 _XMWinQueInit()
Dave Love <fx@gnu.org>
parents:
diff changeset
92 {
Dave Love <fx@gnu.org>
parents:
diff changeset
93 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
94 * If the queue is not initialized initialize it.
Dave Love <fx@gnu.org>
parents:
diff changeset
95 */
Dave Love <fx@gnu.org>
parents:
diff changeset
96 if (!_XMWinQueIsInit) {
Dave Love <fx@gnu.org>
parents:
diff changeset
97 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
98 * Blank the queue structure.
Dave Love <fx@gnu.org>
parents:
diff changeset
99 */
Dave Love <fx@gnu.org>
parents:
diff changeset
100 register int i;
Dave Love <fx@gnu.org>
parents:
diff changeset
101
Dave Love <fx@gnu.org>
parents:
diff changeset
102 for (i = 0; i < S_QUE_SIZE; i++)
Dave Love <fx@gnu.org>
parents:
diff changeset
103 _XMWinQue.sq[i] = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
104
Dave Love <fx@gnu.org>
parents:
diff changeset
105 for (i = 0; i < P_QUE_SIZE; i++)
Dave Love <fx@gnu.org>
parents:
diff changeset
106 _XMWinQue.pq[i] = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
107
Dave Love <fx@gnu.org>
parents:
diff changeset
108 _XMWinQue.sq_size = _XMWinQue.pq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
109
Dave Love <fx@gnu.org>
parents:
diff changeset
110 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
111 * Initialize the next free location pointers.
Dave Love <fx@gnu.org>
parents:
diff changeset
112 */
Dave Love <fx@gnu.org>
parents:
diff changeset
113 _XMWinQue.sq_ptr = _XMWinQue.sq;
Dave Love <fx@gnu.org>
parents:
diff changeset
114 _XMWinQue.pq_ptr = _XMWinQue.pq;
Dave Love <fx@gnu.org>
parents:
diff changeset
115 }
Dave Love <fx@gnu.org>
parents:
diff changeset
116 }
Dave Love <fx@gnu.org>
parents:
diff changeset
117
Dave Love <fx@gnu.org>
parents:
diff changeset
118
Dave Love <fx@gnu.org>
parents:
diff changeset
119
Dave Love <fx@gnu.org>
parents:
diff changeset
120 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
121 * _XMWinQueAddPane - Internal routine to add a pane to the pane
Dave Love <fx@gnu.org>
parents:
diff changeset
122 * window queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
123 */
Dave Love <fx@gnu.org>
parents:
diff changeset
124 int
Dave Love <fx@gnu.org>
parents:
diff changeset
125 _XMWinQueAddPane(display, menu, p_ptr)
Dave Love <fx@gnu.org>
parents:
diff changeset
126 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
127 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
128 register XMPane *p_ptr; /* XMPane being queued. */
Dave Love <fx@gnu.org>
parents:
diff changeset
129 {
Dave Love <fx@gnu.org>
parents:
diff changeset
130 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
131 * If the queue is currently full then flush it.
Dave Love <fx@gnu.org>
parents:
diff changeset
132 */
Dave Love <fx@gnu.org>
parents:
diff changeset
133 if (_XMWinQue.pq_size == P_QUE_SIZE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
134 if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
135 }
Dave Love <fx@gnu.org>
parents:
diff changeset
136
Dave Love <fx@gnu.org>
parents:
diff changeset
137 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
138 * Insert the new XMPane pointer and increment the queue pointer
Dave Love <fx@gnu.org>
parents:
diff changeset
139 * and the queue size.
Dave Love <fx@gnu.org>
parents:
diff changeset
140 */
Dave Love <fx@gnu.org>
parents:
diff changeset
141 *_XMWinQue.pq_ptr = p_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
142 _XMWinQue.pq_ptr++;
Dave Love <fx@gnu.org>
parents:
diff changeset
143 _XMWinQue.pq_size++;
Dave Love <fx@gnu.org>
parents:
diff changeset
144
Dave Love <fx@gnu.org>
parents:
diff changeset
145 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
146 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
147 */
Dave Love <fx@gnu.org>
parents:
diff changeset
148 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
149 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
150 }
Dave Love <fx@gnu.org>
parents:
diff changeset
151
Dave Love <fx@gnu.org>
parents:
diff changeset
152
Dave Love <fx@gnu.org>
parents:
diff changeset
153
Dave Love <fx@gnu.org>
parents:
diff changeset
154 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
155 * _XMWinQueAddSelection - Internal routine to add a selection to
Dave Love <fx@gnu.org>
parents:
diff changeset
156 * the selection window queue.
Dave Love <fx@gnu.org>
parents:
diff changeset
157 */
Dave Love <fx@gnu.org>
parents:
diff changeset
158 int
Dave Love <fx@gnu.org>
parents:
diff changeset
159 _XMWinQueAddSelection(display, menu, s_ptr)
Dave Love <fx@gnu.org>
parents:
diff changeset
160 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
161 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
162 register XMSelect *s_ptr; /* XMSelection being queued. */
Dave Love <fx@gnu.org>
parents:
diff changeset
163 {
Dave Love <fx@gnu.org>
parents:
diff changeset
164 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
165 * If this entry will overflow the queue then flush it.
Dave Love <fx@gnu.org>
parents:
diff changeset
166 */
Dave Love <fx@gnu.org>
parents:
diff changeset
167 if (_XMWinQue.sq_size == S_QUE_SIZE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
168 if (_XMWinQueFlush(display, menu, 0, 0) == _FAILURE) return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
169 }
Dave Love <fx@gnu.org>
parents:
diff changeset
170
Dave Love <fx@gnu.org>
parents:
diff changeset
171 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
172 * Insert the new XMSelect pointer and increment the queue pointer
Dave Love <fx@gnu.org>
parents:
diff changeset
173 * and the queue size.
Dave Love <fx@gnu.org>
parents:
diff changeset
174 */
Dave Love <fx@gnu.org>
parents:
diff changeset
175 *_XMWinQue.sq_ptr = s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
176 _XMWinQue.sq_ptr++;
Dave Love <fx@gnu.org>
parents:
diff changeset
177 _XMWinQue.sq_size++;
Dave Love <fx@gnu.org>
parents:
diff changeset
178
Dave Love <fx@gnu.org>
parents:
diff changeset
179 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
180 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
181 */
Dave Love <fx@gnu.org>
parents:
diff changeset
182 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
183 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
184 }
Dave Love <fx@gnu.org>
parents:
diff changeset
185
Dave Love <fx@gnu.org>
parents:
diff changeset
186
Dave Love <fx@gnu.org>
parents:
diff changeset
187
Dave Love <fx@gnu.org>
parents:
diff changeset
188 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
189 * _XMWinQueFlush - Internal routine to flush the pane and
Dave Love <fx@gnu.org>
parents:
diff changeset
190 * selection window queues.
Dave Love <fx@gnu.org>
parents:
diff changeset
191 */
Dave Love <fx@gnu.org>
parents:
diff changeset
192 int
Dave Love <fx@gnu.org>
parents:
diff changeset
193 _XMWinQueFlush(display, menu, pane, select)
Dave Love <fx@gnu.org>
parents:
diff changeset
194 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
195 register XMenu *menu; /* Menu being manipulated. */
Dave Love <fx@gnu.org>
parents:
diff changeset
196 register XMPane *pane; /* Current pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
197 {
Dave Love <fx@gnu.org>
parents:
diff changeset
198 register int pq_index; /* Pane queue index. */
Dave Love <fx@gnu.org>
parents:
diff changeset
199 register int sq_index; /* Selection queue index. */
Dave Love <fx@gnu.org>
parents:
diff changeset
200 register XMPane *p_ptr; /* XMPane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
201 register XMSelect *s_ptr; /* XMSelect pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
202 unsigned long valuemask; /* Which attributes to set. */
Dave Love <fx@gnu.org>
parents:
diff changeset
203 XSetWindowAttributes *attributes; /* Attributes to be set. */
Dave Love <fx@gnu.org>
parents:
diff changeset
204
Dave Love <fx@gnu.org>
parents:
diff changeset
205 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
206 * If the pane window queue is not empty...
Dave Love <fx@gnu.org>
parents:
diff changeset
207 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
208
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
209 if (_XMWinQue.pq_size > 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
210 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
211 * set up attributes for pane window to be created.
Dave Love <fx@gnu.org>
parents:
diff changeset
212 */
Dave Love <fx@gnu.org>
parents:
diff changeset
213 valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
Dave Love <fx@gnu.org>
parents:
diff changeset
214 attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes));
Dave Love <fx@gnu.org>
parents:
diff changeset
215 attributes->border_pixel = menu->p_bdr_color;
Dave Love <fx@gnu.org>
parents:
diff changeset
216 attributes->background_pixmap = menu->inact_pixmap;
Dave Love <fx@gnu.org>
parents:
diff changeset
217 attributes->override_redirect = True;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
218
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
219 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
220 * Create all the pending panes in order, so that the
Dave Love <fx@gnu.org>
parents:
diff changeset
221 * current pane will be on top, with the others
Dave Love <fx@gnu.org>
parents:
diff changeset
222 * stacked appropriately under it.
Dave Love <fx@gnu.org>
parents:
diff changeset
223 */
Dave Love <fx@gnu.org>
parents:
diff changeset
224 for (pq_index = _XMWinQue.pq_size - 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
225 pq_index >= 0;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
226 pq_index--)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
227 {
Dave Love <fx@gnu.org>
parents:
diff changeset
228 p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
229 if (p_ptr == pane) break;
Dave Love <fx@gnu.org>
parents:
diff changeset
230 p_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
231 menu->parent,
Dave Love <fx@gnu.org>
parents:
diff changeset
232 p_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
233 p_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
234 p_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
235 p_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
236 menu->p_bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
237 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
238 InputOutput,
Dave Love <fx@gnu.org>
parents:
diff changeset
239 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
240 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
241 attributes);
Dave Love <fx@gnu.org>
parents:
diff changeset
242 XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
243 XSelectInput(display, p_ptr->window, menu->p_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
244 }
Dave Love <fx@gnu.org>
parents:
diff changeset
245 for (pq_index = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
246 pq_index < _XMWinQue.pq_size;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
247 pq_index++)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
248 {
Dave Love <fx@gnu.org>
parents:
diff changeset
249 p_ptr = _XMWinQue.pq[pq_index]; /* Retrieve next pane. */
Dave Love <fx@gnu.org>
parents:
diff changeset
250 p_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
251 menu->parent,
Dave Love <fx@gnu.org>
parents:
diff changeset
252 p_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
253 p_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
254 p_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
255 p_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
256 menu->p_bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
257 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
258 InputOutput,
Dave Love <fx@gnu.org>
parents:
diff changeset
259 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
260 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
261 attributes);
Dave Love <fx@gnu.org>
parents:
diff changeset
262 XMakeAssoc(display, menu->assoc_tab, p_ptr->window, p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
263 XSelectInput(display, p_ptr->window, menu->p_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
264 if (p_ptr == pane) break;
Dave Love <fx@gnu.org>
parents:
diff changeset
265 }
Dave Love <fx@gnu.org>
parents:
diff changeset
266
Dave Love <fx@gnu.org>
parents:
diff changeset
267 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
268 * Reset the pane queue pointer and size.
Dave Love <fx@gnu.org>
parents:
diff changeset
269 */
Dave Love <fx@gnu.org>
parents:
diff changeset
270 _XMWinQue.pq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
271 _XMWinQue.pq_ptr = _XMWinQue.pq;
Dave Love <fx@gnu.org>
parents:
diff changeset
272 }
Dave Love <fx@gnu.org>
parents:
diff changeset
273
Dave Love <fx@gnu.org>
parents:
diff changeset
274 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
275 * If the selection window queue is not empty...
Dave Love <fx@gnu.org>
parents:
diff changeset
276 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
277
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
278 if (_XMWinQue.sq_size > 0) {
Dave Love <fx@gnu.org>
parents:
diff changeset
279
Dave Love <fx@gnu.org>
parents:
diff changeset
280 for (sq_index = 0; sq_index < _XMWinQue.sq_size; sq_index++) {
Dave Love <fx@gnu.org>
parents:
diff changeset
281 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
282 * Retrieve the XMSelect pointer.
Dave Love <fx@gnu.org>
parents:
diff changeset
283 */
Dave Love <fx@gnu.org>
parents:
diff changeset
284 s_ptr = _XMWinQue.sq[sq_index];
Dave Love <fx@gnu.org>
parents:
diff changeset
285 s_ptr->window = XCreateWindow(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
286 s_ptr->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
287 s_ptr->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
288 s_ptr->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
289 s_ptr->window_w,
Dave Love <fx@gnu.org>
parents:
diff changeset
290 s_ptr->window_h,
Dave Love <fx@gnu.org>
parents:
diff changeset
291 0, /* border width*/
Dave Love <fx@gnu.org>
parents:
diff changeset
292 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
293 InputOnly,
Dave Love <fx@gnu.org>
parents:
diff changeset
294 CopyFromParent,
Dave Love <fx@gnu.org>
parents:
diff changeset
295 0,
Dave Love <fx@gnu.org>
parents:
diff changeset
296 attributes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
297
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
298 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
299 * Insert the new window id and its
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
300 * associated XMSelect structure into the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
301 * association table.
Dave Love <fx@gnu.org>
parents:
diff changeset
302 */
Dave Love <fx@gnu.org>
parents:
diff changeset
303 XMakeAssoc(display, menu->assoc_tab, s_ptr->window, s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
304 XSelectInput(display, s_ptr->window, menu->s_events);
Dave Love <fx@gnu.org>
parents:
diff changeset
305 }
Dave Love <fx@gnu.org>
parents:
diff changeset
306
Dave Love <fx@gnu.org>
parents:
diff changeset
307 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
308 * Reset the selection queue pointer and size.
Dave Love <fx@gnu.org>
parents:
diff changeset
309 */
Dave Love <fx@gnu.org>
parents:
diff changeset
310 _XMWinQue.sq_size = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
311 _XMWinQue.sq_ptr = _XMWinQue.sq;
Dave Love <fx@gnu.org>
parents:
diff changeset
312 }
Dave Love <fx@gnu.org>
parents:
diff changeset
313
Dave Love <fx@gnu.org>
parents:
diff changeset
314 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
315 * Flush X's internal queues.
Dave Love <fx@gnu.org>
parents:
diff changeset
316 */
Dave Love <fx@gnu.org>
parents:
diff changeset
317 XFlush(display);
Dave Love <fx@gnu.org>
parents:
diff changeset
318
Dave Love <fx@gnu.org>
parents:
diff changeset
319 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
320 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
321 */
Dave Love <fx@gnu.org>
parents:
diff changeset
322 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
323 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
324 }
Dave Love <fx@gnu.org>
parents:
diff changeset
325
Dave Love <fx@gnu.org>
parents:
diff changeset
326
Dave Love <fx@gnu.org>
parents:
diff changeset
327
Dave Love <fx@gnu.org>
parents:
diff changeset
328 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
329 * _XMGetPanePtr - Given a menu pointer and a pane index number, return
Dave Love <fx@gnu.org>
parents:
diff changeset
330 * a pane pointer that points to the indexed pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
331 */
Dave Love <fx@gnu.org>
parents:
diff changeset
332 XMPane *
Dave Love <fx@gnu.org>
parents:
diff changeset
333 _XMGetPanePtr(menu, p_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
334 register XMenu *menu; /* Menu to find the pane in. */
Dave Love <fx@gnu.org>
parents:
diff changeset
335 register int p_num; /* Index number of pane to find. */
Dave Love <fx@gnu.org>
parents:
diff changeset
336 {
Dave Love <fx@gnu.org>
parents:
diff changeset
337 register XMPane *p_ptr; /* Pane pointer to be returned. */
Dave Love <fx@gnu.org>
parents:
diff changeset
338 register int i; /* Loop counter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
339
Dave Love <fx@gnu.org>
parents:
diff changeset
340 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
341 * Is the pane number out of range?
Dave Love <fx@gnu.org>
parents:
diff changeset
342 */
Dave Love <fx@gnu.org>
parents:
diff changeset
343 if ((p_num < 0) || (p_num > (menu->p_count - 1))) {
Dave Love <fx@gnu.org>
parents:
diff changeset
344 _XMErrorCode = XME_P_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
345 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
346 }
Dave Love <fx@gnu.org>
parents:
diff changeset
347
Dave Love <fx@gnu.org>
parents:
diff changeset
348 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
349 * Find the right pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
350 */
Dave Love <fx@gnu.org>
parents:
diff changeset
351 p_ptr = menu->p_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
352 for (i = 0; i < p_num; i++) p_ptr = p_ptr->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
353
Dave Love <fx@gnu.org>
parents:
diff changeset
354 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
355 * Return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
356 */
Dave Love <fx@gnu.org>
parents:
diff changeset
357 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
358 return(p_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
359 }
Dave Love <fx@gnu.org>
parents:
diff changeset
360
Dave Love <fx@gnu.org>
parents:
diff changeset
361
Dave Love <fx@gnu.org>
parents:
diff changeset
362
Dave Love <fx@gnu.org>
parents:
diff changeset
363 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
364 * _XMGetSelectionPtr - Given pane pointer and a selection index number,
Dave Love <fx@gnu.org>
parents:
diff changeset
365 * return a selection pointer that points to the
Dave Love <fx@gnu.org>
parents:
diff changeset
366 * indexed selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
367 */
Dave Love <fx@gnu.org>
parents:
diff changeset
368 XMSelect *
Dave Love <fx@gnu.org>
parents:
diff changeset
369 _XMGetSelectionPtr(p_ptr, s_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
370 register XMPane *p_ptr; /* Pane to find the selection in. */
Dave Love <fx@gnu.org>
parents:
diff changeset
371 register int s_num; /* Index number of the selection to find. */
Dave Love <fx@gnu.org>
parents:
diff changeset
372 {
Dave Love <fx@gnu.org>
parents:
diff changeset
373 register XMSelect *s_ptr; /* Selection pointer to be returned. */
Dave Love <fx@gnu.org>
parents:
diff changeset
374 register int i; /* Loop counter. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
375
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
376 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
377 * Is the selection number out of range?
Dave Love <fx@gnu.org>
parents:
diff changeset
378 */
Dave Love <fx@gnu.org>
parents:
diff changeset
379 if ((s_num < 0) || (s_num > (p_ptr->s_count - 1))) {
Dave Love <fx@gnu.org>
parents:
diff changeset
380 _XMErrorCode = XME_S_NOT_FOUND;
Dave Love <fx@gnu.org>
parents:
diff changeset
381 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
382 }
Dave Love <fx@gnu.org>
parents:
diff changeset
383
Dave Love <fx@gnu.org>
parents:
diff changeset
384 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
385 * Find the right selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
386 */
Dave Love <fx@gnu.org>
parents:
diff changeset
387 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
388 for (i = 0; i < s_num; i++) s_ptr = s_ptr->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
389
Dave Love <fx@gnu.org>
parents:
diff changeset
390 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
391 * Return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
392 */
Dave Love <fx@gnu.org>
parents:
diff changeset
393 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
394 return(s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
395 }
Dave Love <fx@gnu.org>
parents:
diff changeset
396
Dave Love <fx@gnu.org>
parents:
diff changeset
397
Dave Love <fx@gnu.org>
parents:
diff changeset
398
Dave Love <fx@gnu.org>
parents:
diff changeset
399 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
400 * _XMRecomputeGlobals - Internal subroutine to recompute menu wide
Dave Love <fx@gnu.org>
parents:
diff changeset
401 * global values.
Dave Love <fx@gnu.org>
parents:
diff changeset
402 */
Dave Love <fx@gnu.org>
parents:
diff changeset
403 _XMRecomputeGlobals(display, menu)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
404 register Display *display; /*X11 display variable. */
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
405 register XMenu *menu; /* Menu object to compute from. */
Dave Love <fx@gnu.org>
parents:
diff changeset
406 {
Dave Love <fx@gnu.org>
parents:
diff changeset
407 register XMPane *p_ptr; /* Pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
408 register XMSelect *s_ptr; /* Selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
409
Dave Love <fx@gnu.org>
parents:
diff changeset
410 register int max_p_label = 0; /* Maximum pane label width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
411 register int max_s_label = 0; /* Maximum selection label width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
412 register int s_count = 0; /* Maximum selection count. */
Dave Love <fx@gnu.org>
parents:
diff changeset
413
Dave Love <fx@gnu.org>
parents:
diff changeset
414 int p_s_pad; /* Pane <-> selection padding. */
Dave Love <fx@gnu.org>
parents:
diff changeset
415 int p_s_diff; /* Pane <-> selection separation. */
Dave Love <fx@gnu.org>
parents:
diff changeset
416
Dave Love <fx@gnu.org>
parents:
diff changeset
417 int p_height; /* Pane window height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
418 int p_width; /* Pane window width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
419 int s_width; /* Selection window width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
420
Dave Love <fx@gnu.org>
parents:
diff changeset
421 int screen; /* DefaultScreen holder. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
422
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
423 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
424 * For each pane...
Dave Love <fx@gnu.org>
parents:
diff changeset
425 */
Dave Love <fx@gnu.org>
parents:
diff changeset
426 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
427 p_ptr = menu->p_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
428 p_ptr != menu->p_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
429 p_ptr = p_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
430 ){
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
431
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
432 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
433 * Recompute maximum pane label width.
Dave Love <fx@gnu.org>
parents:
diff changeset
434 */
Dave Love <fx@gnu.org>
parents:
diff changeset
435 max_p_label = max(max_p_label, p_ptr->label_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
436
Dave Love <fx@gnu.org>
parents:
diff changeset
437 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
438 * Recompute maximum selection count.
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
439 */
Dave Love <fx@gnu.org>
parents:
diff changeset
440 s_count = max(s_count, p_ptr->s_count);
Dave Love <fx@gnu.org>
parents:
diff changeset
441
Dave Love <fx@gnu.org>
parents:
diff changeset
442 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
443 * For each selection in the current pane...
Dave Love <fx@gnu.org>
parents:
diff changeset
444 */
Dave Love <fx@gnu.org>
parents:
diff changeset
445 for (
Dave Love <fx@gnu.org>
parents:
diff changeset
446 s_ptr = p_ptr->s_list->next;
Dave Love <fx@gnu.org>
parents:
diff changeset
447 s_ptr != p_ptr->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
448 s_ptr = s_ptr->next
Dave Love <fx@gnu.org>
parents:
diff changeset
449 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
450
Dave Love <fx@gnu.org>
parents:
diff changeset
451 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
452 * Recompute maximum selection label width.
Dave Love <fx@gnu.org>
parents:
diff changeset
453 */
Dave Love <fx@gnu.org>
parents:
diff changeset
454 max_s_label = max(max_s_label, s_ptr->label_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
455 }
Dave Love <fx@gnu.org>
parents:
diff changeset
456 }
Dave Love <fx@gnu.org>
parents:
diff changeset
457
Dave Love <fx@gnu.org>
parents:
diff changeset
458 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
459 * Recompute pane height.
Dave Love <fx@gnu.org>
parents:
diff changeset
460 */
Dave Love <fx@gnu.org>
parents:
diff changeset
461 p_height = (menu->flag_height << 1) + (menu->s_y_off * s_count);
Dave Love <fx@gnu.org>
parents:
diff changeset
462
Dave Love <fx@gnu.org>
parents:
diff changeset
463 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
464 * Recompute horizontal padding between the pane window and the
Dave Love <fx@gnu.org>
parents:
diff changeset
465 * selection windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
466 */
Dave Love <fx@gnu.org>
parents:
diff changeset
467 p_s_pad = menu->p_x_off << 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
468
Dave Love <fx@gnu.org>
parents:
diff changeset
469 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
470 * Recompute pane and selection window widths.
Dave Love <fx@gnu.org>
parents:
diff changeset
471 * This is done by first computing the window sizes from the maximum
Dave Love <fx@gnu.org>
parents:
diff changeset
472 * label widths. If the spacing between the selection window and the
Dave Love <fx@gnu.org>
parents:
diff changeset
473 * containing pane window is less than the pane selection padding value
Dave Love <fx@gnu.org>
parents:
diff changeset
474 * (twice the pane X offset) then change the size of the pane to be
Dave Love <fx@gnu.org>
parents:
diff changeset
475 * the size of the selection window plus the padding. If, however the
Dave Love <fx@gnu.org>
parents:
diff changeset
476 * spacing between the selection window and the containing pane window
Dave Love <fx@gnu.org>
parents:
diff changeset
477 * is more than the pane selection padding value increase the size of
Dave Love <fx@gnu.org>
parents:
diff changeset
478 * the selection to its maximum possible value (the pane width minus
Dave Love <fx@gnu.org>
parents:
diff changeset
479 * the pane selection padding value).
Dave Love <fx@gnu.org>
parents:
diff changeset
480 */
Dave Love <fx@gnu.org>
parents:
diff changeset
481 p_width = max_p_label + p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
482 s_width = max_s_label + (menu->s_fnt_pad << 1) + (menu->s_bdr_width << 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
483 p_s_diff = p_width - s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
484 if (p_s_diff < p_s_pad) {
Dave Love <fx@gnu.org>
parents:
diff changeset
485 p_width = s_width + p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
486 }
Dave Love <fx@gnu.org>
parents:
diff changeset
487 else if (p_s_diff > p_s_pad) {
Dave Love <fx@gnu.org>
parents:
diff changeset
488 s_width = p_width - p_s_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
489 }
Dave Love <fx@gnu.org>
parents:
diff changeset
490
Dave Love <fx@gnu.org>
parents:
diff changeset
491 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
492 * Reset menu wide global values.
Dave Love <fx@gnu.org>
parents:
diff changeset
493 */
Dave Love <fx@gnu.org>
parents:
diff changeset
494 menu->s_count = s_count;
Dave Love <fx@gnu.org>
parents:
diff changeset
495 menu->p_height = p_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
496 menu->p_width = p_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
497 menu->s_width = s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
498
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
499 /*
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
500 * Ensure that the origin of the menu is placed so that
Dave Love <fx@gnu.org>
parents:
diff changeset
501 * None of the panes ore selections are off the screen.
Dave Love <fx@gnu.org>
parents:
diff changeset
502 */
Dave Love <fx@gnu.org>
parents:
diff changeset
503 screen = DefaultScreen(display);
Dave Love <fx@gnu.org>
parents:
diff changeset
504 if (menu->x_pos + menu->width > DisplayWidth(display, screen))
Dave Love <fx@gnu.org>
parents:
diff changeset
505 menu->x_pos = DisplayWidth(display, screen) - menu->width;
Dave Love <fx@gnu.org>
parents:
diff changeset
506 else if (menu->x_pos < 0) menu->x_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
507 if(menu->y_pos + menu->height > DisplayHeight(display, screen))
Dave Love <fx@gnu.org>
parents:
diff changeset
508 menu->y_pos = DisplayHeight(display, screen) - menu->height;
Dave Love <fx@gnu.org>
parents:
diff changeset
509 else if (menu->y_pos < 0) menu->y_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
510 }
Dave Love <fx@gnu.org>
parents:
diff changeset
511
Dave Love <fx@gnu.org>
parents:
diff changeset
512
Dave Love <fx@gnu.org>
parents:
diff changeset
513 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
514 * _XMRecomputePane - Internal subroutine to recompute pane
Dave Love <fx@gnu.org>
parents:
diff changeset
515 * window dependencies.
Dave Love <fx@gnu.org>
parents:
diff changeset
516 */
Dave Love <fx@gnu.org>
parents:
diff changeset
517 int
Dave Love <fx@gnu.org>
parents:
diff changeset
518 _XMRecomputePane(display, menu, p_ptr, p_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
519 register Display *display; /* Standard X display variable. */
Dave Love <fx@gnu.org>
parents:
diff changeset
520 register XMenu *menu; /* Menu object being recomputed. */
Dave Love <fx@gnu.org>
parents:
diff changeset
521 register XMPane *p_ptr; /* Pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
522 register int p_num; /* Pane sequence number. */
Dave Love <fx@gnu.org>
parents:
diff changeset
523 {
Dave Love <fx@gnu.org>
parents:
diff changeset
524 register int window_x; /* Recomputed window X coordinate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
525 register int window_y; /* Recomputed window Y coordinate. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
526
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
527 unsigned long change_mask; /* Value mask to reconfigure window. */
Dave Love <fx@gnu.org>
parents:
diff changeset
528 XWindowChanges *changes; /* Values to use in configure window. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
529
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
530 register Bool config_p = False; /* Reconfigure pane window? */
Dave Love <fx@gnu.org>
parents:
diff changeset
531
Dave Love <fx@gnu.org>
parents:
diff changeset
532 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
533 * Update the pane serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
534 */
Dave Love <fx@gnu.org>
parents:
diff changeset
535 p_ptr->serial = p_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
536
Dave Love <fx@gnu.org>
parents:
diff changeset
537 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
538 * Recompute window X and Y coordinates.
Dave Love <fx@gnu.org>
parents:
diff changeset
539 */
Dave Love <fx@gnu.org>
parents:
diff changeset
540 switch (menu->menu_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
541 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
542 window_x = menu->p_x_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
543 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
544 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
545 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
546 window_x = menu->p_x_off * p_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
547 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
548 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
549 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
550 window_x = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
551 window_y = menu->p_y_off * ((menu->p_count - 1) - p_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
552 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
553 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
554 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
555 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
556 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
557 }
Dave Love <fx@gnu.org>
parents:
diff changeset
558 window_x += menu->x_pos;
Dave Love <fx@gnu.org>
parents:
diff changeset
559 window_y += menu->y_pos;
Dave Love <fx@gnu.org>
parents:
diff changeset
560
Dave Love <fx@gnu.org>
parents:
diff changeset
561 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
562 * If the newly compute pane coordinates differ from the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
563 * current coordinates, reset the current coordinates and
Dave Love <fx@gnu.org>
parents:
diff changeset
564 * reconfigure the pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
565 */
Dave Love <fx@gnu.org>
parents:
diff changeset
566 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
567 (window_x != p_ptr->window_x) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
568 (window_y != p_ptr->window_y)
Dave Love <fx@gnu.org>
parents:
diff changeset
569 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
570 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
571 * Reset the coordinates and schedule
Dave Love <fx@gnu.org>
parents:
diff changeset
572 * the pane for reconfiguration.
Dave Love <fx@gnu.org>
parents:
diff changeset
573 */
Dave Love <fx@gnu.org>
parents:
diff changeset
574 p_ptr->window_x = window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
575 p_ptr->window_y = window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
576 config_p = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
577 }
Dave Love <fx@gnu.org>
parents:
diff changeset
578
Dave Love <fx@gnu.org>
parents:
diff changeset
579 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
580 * If the local pane width and height differs from the
Dave Love <fx@gnu.org>
parents:
diff changeset
581 * menu pane width and height, reset the local values.
Dave Love <fx@gnu.org>
parents:
diff changeset
582 */
Dave Love <fx@gnu.org>
parents:
diff changeset
583 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
584 (p_ptr->window_w != menu->p_width) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
585 (p_ptr->window_h != menu->p_height)
Dave Love <fx@gnu.org>
parents:
diff changeset
586 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
587 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
588 * Reset window width and height and schedule
Dave Love <fx@gnu.org>
parents:
diff changeset
589 * the pane for reconfiguration.
Dave Love <fx@gnu.org>
parents:
diff changeset
590 */
Dave Love <fx@gnu.org>
parents:
diff changeset
591 p_ptr->window_w = menu->p_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
592 p_ptr->window_h = menu->p_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
593 config_p = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
594 }
Dave Love <fx@gnu.org>
parents:
diff changeset
595
Dave Love <fx@gnu.org>
parents:
diff changeset
596 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
597 * If we need to reconfigure the pane window do it now.
Dave Love <fx@gnu.org>
parents:
diff changeset
598 */
Dave Love <fx@gnu.org>
parents:
diff changeset
599 if (config_p == True) {
Dave Love <fx@gnu.org>
parents:
diff changeset
600 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
601 * If the pane window has already been created then
Dave Love <fx@gnu.org>
parents:
diff changeset
602 * reconfigure the existing window, otherwise queue
Dave Love <fx@gnu.org>
parents:
diff changeset
603 * it for creation with the new configuration.
Dave Love <fx@gnu.org>
parents:
diff changeset
604 */
Dave Love <fx@gnu.org>
parents:
diff changeset
605 if (p_ptr->window) {
Dave Love <fx@gnu.org>
parents:
diff changeset
606 change_mask = (CWX | CWY | CWWidth | CWHeight);
Dave Love <fx@gnu.org>
parents:
diff changeset
607 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
608 changes->x = p_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
609 changes->y = p_ptr->window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
610 changes->width = p_ptr->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
611 changes->height = p_ptr->window_h;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
612
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
613 XConfigureWindow(
Dave Love <fx@gnu.org>
parents:
diff changeset
614 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
615 p_ptr->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
616 change_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
617 changes
Dave Love <fx@gnu.org>
parents:
diff changeset
618 );
Dave Love <fx@gnu.org>
parents:
diff changeset
619 free(changes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
620
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
621 }
Dave Love <fx@gnu.org>
parents:
diff changeset
622 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
623 if (_XMWinQueAddPane(display, menu, p_ptr) == _FAILURE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
624 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
625 }
Dave Love <fx@gnu.org>
parents:
diff changeset
626 }
Dave Love <fx@gnu.org>
parents:
diff changeset
627 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
628
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
629 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
630 * Recompute label X position.
Dave Love <fx@gnu.org>
parents:
diff changeset
631 */
Dave Love <fx@gnu.org>
parents:
diff changeset
632 switch (menu->p_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
633 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
634 p_ptr->label_x = menu->p_x_off + menu->p_fnt_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
635 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
636 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
637 p_ptr->label_x = menu->p_width -
Dave Love <fx@gnu.org>
parents:
diff changeset
638 (p_ptr->label_width + menu->p_x_off + menu->p_fnt_pad);
Dave Love <fx@gnu.org>
parents:
diff changeset
639 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
640 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
641 p_ptr->label_x = (menu->p_width - p_ptr->label_width) >> 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
642 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
643 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
644 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
645 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
646 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
647 }
Dave Love <fx@gnu.org>
parents:
diff changeset
648 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
649 * Recompute label Y positions.
Dave Love <fx@gnu.org>
parents:
diff changeset
650 */
Dave Love <fx@gnu.org>
parents:
diff changeset
651 p_ptr->label_uy = menu->p_fnt_pad + menu->p_fnt_info->max_bounds.ascent;
Dave Love <fx@gnu.org>
parents:
diff changeset
652 p_ptr->label_ly = (menu->p_height - menu->p_fnt_pad - menu->p_fnt_info->max_bounds.descent);
Dave Love <fx@gnu.org>
parents:
diff changeset
653
Dave Love <fx@gnu.org>
parents:
diff changeset
654 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
655 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
656 */
Dave Love <fx@gnu.org>
parents:
diff changeset
657 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
658 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
659 }
Dave Love <fx@gnu.org>
parents:
diff changeset
660
Dave Love <fx@gnu.org>
parents:
diff changeset
661
Dave Love <fx@gnu.org>
parents:
diff changeset
662
Dave Love <fx@gnu.org>
parents:
diff changeset
663 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
664 * _XMRecomputeSelection - Internal subroutine to recompute
Dave Love <fx@gnu.org>
parents:
diff changeset
665 * selection window dependencies.
Dave Love <fx@gnu.org>
parents:
diff changeset
666 */
Dave Love <fx@gnu.org>
parents:
diff changeset
667 int
Dave Love <fx@gnu.org>
parents:
diff changeset
668 _XMRecomputeSelection(display, menu, s_ptr, s_num)
Dave Love <fx@gnu.org>
parents:
diff changeset
669 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
670 register XMenu *menu; /* Menu object being recomputed. */
Dave Love <fx@gnu.org>
parents:
diff changeset
671 register XMSelect *s_ptr; /* Selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
672 register int s_num; /* Selection sequence number. */
Dave Love <fx@gnu.org>
parents:
diff changeset
673 {
Dave Love <fx@gnu.org>
parents:
diff changeset
674 register Bool config_s = False; /* Reconfigure selection window? */
Dave Love <fx@gnu.org>
parents:
diff changeset
675 XWindowChanges *changes; /* Values to change in configure. */
Dave Love <fx@gnu.org>
parents:
diff changeset
676 unsigned long change_mask; /* Value mask for XConfigureWindow. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
677
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
678 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
679 * If the selection serial numbers are out of order, begin
Dave Love <fx@gnu.org>
parents:
diff changeset
680 * resequencing selections. Recompute selection window coordinates
Dave Love <fx@gnu.org>
parents:
diff changeset
681 * and serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
682 *
Dave Love <fx@gnu.org>
parents:
diff changeset
683 * When selections are created they are given a serial number of
Dave Love <fx@gnu.org>
parents:
diff changeset
684 * -1, this causes this routine to give a new selection
Dave Love <fx@gnu.org>
parents:
diff changeset
685 * its initial coordinates and serial number.
Dave Love <fx@gnu.org>
parents:
diff changeset
686 */
Dave Love <fx@gnu.org>
parents:
diff changeset
687 if (s_ptr->serial != s_num) {
Dave Love <fx@gnu.org>
parents:
diff changeset
688 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
689 * Fix the sequence number.
Dave Love <fx@gnu.org>
parents:
diff changeset
690 */
Dave Love <fx@gnu.org>
parents:
diff changeset
691 s_ptr->serial = s_num;
Dave Love <fx@gnu.org>
parents:
diff changeset
692 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
693 * Recompute window X and Y coordinates.
Dave Love <fx@gnu.org>
parents:
diff changeset
694 */
Dave Love <fx@gnu.org>
parents:
diff changeset
695 s_ptr->window_x = menu->s_x_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
696 s_ptr->window_y = menu->flag_height + (menu->s_y_off * s_num);
Dave Love <fx@gnu.org>
parents:
diff changeset
697 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
698 * We must reconfigure the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
699 */
Dave Love <fx@gnu.org>
parents:
diff changeset
700 config_s = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
701 }
Dave Love <fx@gnu.org>
parents:
diff changeset
702
Dave Love <fx@gnu.org>
parents:
diff changeset
703 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
704 * If the local selection width and height differs from the
Dave Love <fx@gnu.org>
parents:
diff changeset
705 * menu selection width and height, reset the local values.
Dave Love <fx@gnu.org>
parents:
diff changeset
706 */
Dave Love <fx@gnu.org>
parents:
diff changeset
707 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
708 (s_ptr->window_w != menu->s_width) ||
Dave Love <fx@gnu.org>
parents:
diff changeset
709 (s_ptr->window_h != menu->s_height)
Dave Love <fx@gnu.org>
parents:
diff changeset
710 ){
Dave Love <fx@gnu.org>
parents:
diff changeset
711 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
712 * We must reconfigure the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
713 */
Dave Love <fx@gnu.org>
parents:
diff changeset
714 config_s = True;
Dave Love <fx@gnu.org>
parents:
diff changeset
715 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
716 * Reset window width and height.
Dave Love <fx@gnu.org>
parents:
diff changeset
717 */
Dave Love <fx@gnu.org>
parents:
diff changeset
718 s_ptr->window_w = menu->s_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
719 s_ptr->window_h = menu->s_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
720 }
Dave Love <fx@gnu.org>
parents:
diff changeset
721
Dave Love <fx@gnu.org>
parents:
diff changeset
722 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
723 * If we need to reconfigure the selection window do it now.
Dave Love <fx@gnu.org>
parents:
diff changeset
724 */
Dave Love <fx@gnu.org>
parents:
diff changeset
725 if (config_s == True) {
Dave Love <fx@gnu.org>
parents:
diff changeset
726 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
727 * If the selection window has already been created then
Dave Love <fx@gnu.org>
parents:
diff changeset
728 * reconfigure the existing window, otherwise queue it
Dave Love <fx@gnu.org>
parents:
diff changeset
729 * for creation with the new configuration.
Dave Love <fx@gnu.org>
parents:
diff changeset
730 */
Dave Love <fx@gnu.org>
parents:
diff changeset
731 if (s_ptr->window) {
Dave Love <fx@gnu.org>
parents:
diff changeset
732 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
733 change_mask = (CWX | CWY | CWWidth | CWHeight);
Dave Love <fx@gnu.org>
parents:
diff changeset
734 changes = (XWindowChanges *)malloc(sizeof(XWindowChanges));
Dave Love <fx@gnu.org>
parents:
diff changeset
735 changes->x = s_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
736 changes->y = s_ptr->window_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
737 changes->width = s_ptr->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
738 changes->height = s_ptr->window_h;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
739
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
740 XConfigureWindow(
Dave Love <fx@gnu.org>
parents:
diff changeset
741 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
742 s_ptr->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
743 change_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
744 changes
Dave Love <fx@gnu.org>
parents:
diff changeset
745 );
Dave Love <fx@gnu.org>
parents:
diff changeset
746 free(changes);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
747
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
748 }
Dave Love <fx@gnu.org>
parents:
diff changeset
749 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
750 if (_XMWinQueAddSelection(display, menu, s_ptr) == _FAILURE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
751 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
752 }
Dave Love <fx@gnu.org>
parents:
diff changeset
753 }
Dave Love <fx@gnu.org>
parents:
diff changeset
754 }
Dave Love <fx@gnu.org>
parents:
diff changeset
755
Dave Love <fx@gnu.org>
parents:
diff changeset
756 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
757 * Recompute label X position.
Dave Love <fx@gnu.org>
parents:
diff changeset
758 */
Dave Love <fx@gnu.org>
parents:
diff changeset
759 switch (menu->s_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
760 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
761 s_ptr->label_x = menu->s_bdr_width + menu->s_fnt_pad + s_ptr->window_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
762 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
763 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
764 s_ptr->label_x = s_ptr->window_x + menu->s_width -
Dave Love <fx@gnu.org>
parents:
diff changeset
765 (s_ptr->label_width + menu->s_bdr_width + menu->s_fnt_pad);
Dave Love <fx@gnu.org>
parents:
diff changeset
766 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
767 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
768 s_ptr->label_x = s_ptr->window_x + ((menu->s_width - s_ptr->label_width) >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
769 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
770 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
771 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
772 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
773 return(_FAILURE);
Dave Love <fx@gnu.org>
parents:
diff changeset
774 }
Dave Love <fx@gnu.org>
parents:
diff changeset
775 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
776 * Recompute label Y position.
Dave Love <fx@gnu.org>
parents:
diff changeset
777 */
Dave Love <fx@gnu.org>
parents:
diff changeset
778 s_ptr->label_y = s_ptr->window_y + menu->s_fnt_info->max_bounds.ascent + menu->s_fnt_pad + menu->s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
779
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
780 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
781 * All went well, return successfully.
Dave Love <fx@gnu.org>
parents:
diff changeset
782 */
Dave Love <fx@gnu.org>
parents:
diff changeset
783 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
784 return(_SUCCESS);
Dave Love <fx@gnu.org>
parents:
diff changeset
785 }
Dave Love <fx@gnu.org>
parents:
diff changeset
786
Dave Love <fx@gnu.org>
parents:
diff changeset
787
Dave Love <fx@gnu.org>
parents:
diff changeset
788
Dave Love <fx@gnu.org>
parents:
diff changeset
789 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
790 * _XMTransToOrigin - Internal subroutine to translate the point at
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
791 * the center of the current pane and selection to the
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
792 * the menu origin.
Dave Love <fx@gnu.org>
parents:
diff changeset
793 *
Dave Love <fx@gnu.org>
parents:
diff changeset
794 * WARNING! ****** Be certain that all menu dependencies have been
Dave Love <fx@gnu.org>
parents:
diff changeset
795 * recomputed before calling this routine or
Dave Love <fx@gnu.org>
parents:
diff changeset
796 * unpredictable results will follow.
Dave Love <fx@gnu.org>
parents:
diff changeset
797 */
Dave Love <fx@gnu.org>
parents:
diff changeset
798 _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, orig_x, orig_y)
Dave Love <fx@gnu.org>
parents:
diff changeset
799 Display *display; /* Not used. Included for consistency. */
Dave Love <fx@gnu.org>
parents:
diff changeset
800 register XMenu *menu; /* Menu being computed against. */
Dave Love <fx@gnu.org>
parents:
diff changeset
801 register XMPane *p_ptr; /* Current pane pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
802 register XMSelect *s_ptr; /* Current selection pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
803 int x_pos; /* X coordinate of point to translate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
804 int y_pos; /* Y coordinate of point to translate. */
Dave Love <fx@gnu.org>
parents:
diff changeset
805 int *orig_x; /* Return value X coord. of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
806 int *orig_y; /* Return value Y coord. of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
807 {
Dave Love <fx@gnu.org>
parents:
diff changeset
808 register int l_orig_x; /* Local X coordinate of the menu origin. */
Dave Love <fx@gnu.org>
parents:
diff changeset
809 register int l_orig_y; /* Local Y coordinate of the menu origin. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
810
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
811 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
812 * Translate the menu origin such that the cursor hot point will be in the
Dave Love <fx@gnu.org>
parents:
diff changeset
813 * center of the desired current selection and pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
814 * If the current selection pointer is NULL then assume that the hot point
Dave Love <fx@gnu.org>
parents:
diff changeset
815 * will be in the center of the current pane flag.
Dave Love <fx@gnu.org>
parents:
diff changeset
816 */
Dave Love <fx@gnu.org>
parents:
diff changeset
817
Dave Love <fx@gnu.org>
parents:
diff changeset
818 if (s_ptr == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
819 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
820 * Translate from the center of the pane flag to the upper left
Dave Love <fx@gnu.org>
parents:
diff changeset
821 * of the current pane window.
Dave Love <fx@gnu.org>
parents:
diff changeset
822 */
Dave Love <fx@gnu.org>
parents:
diff changeset
823 l_orig_x = x_pos - (menu->p_width >> 1) - menu->p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
824 l_orig_y = y_pos - (menu->flag_height >> 1) - menu->p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
825 }
Dave Love <fx@gnu.org>
parents:
diff changeset
826 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
827 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
828 * First translate from the center of the current selection
Dave Love <fx@gnu.org>
parents:
diff changeset
829 * to the upper left of the current selection window.
Dave Love <fx@gnu.org>
parents:
diff changeset
830 */
Dave Love <fx@gnu.org>
parents:
diff changeset
831 l_orig_x = x_pos - (menu->s_width >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
832 l_orig_y = y_pos - (menu->s_height >> 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
833
Dave Love <fx@gnu.org>
parents:
diff changeset
834 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
835 * Then translate to the upper left of the current pane window.
Dave Love <fx@gnu.org>
parents:
diff changeset
836 */
Dave Love <fx@gnu.org>
parents:
diff changeset
837 l_orig_x -= (s_ptr->window_x + menu->p_bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
838 l_orig_y -= (s_ptr->window_y + menu->p_bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
839 }
Dave Love <fx@gnu.org>
parents:
diff changeset
840
Dave Love <fx@gnu.org>
parents:
diff changeset
841 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
842 * Finally translate to the upper left of the menu.
Dave Love <fx@gnu.org>
parents:
diff changeset
843 */
Dave Love <fx@gnu.org>
parents:
diff changeset
844 l_orig_x -= (p_ptr->window_x - menu->x_pos);
Dave Love <fx@gnu.org>
parents:
diff changeset
845 l_orig_y -= (p_ptr->window_y - menu->y_pos);
Dave Love <fx@gnu.org>
parents:
diff changeset
846
Dave Love <fx@gnu.org>
parents:
diff changeset
847 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
848 * Set the return values.
Dave Love <fx@gnu.org>
parents:
diff changeset
849 */
Dave Love <fx@gnu.org>
parents:
diff changeset
850 *orig_x = l_orig_x;
Dave Love <fx@gnu.org>
parents:
diff changeset
851 *orig_y = l_orig_y;
Dave Love <fx@gnu.org>
parents:
diff changeset
852 }
Dave Love <fx@gnu.org>
parents:
diff changeset
853
Dave Love <fx@gnu.org>
parents:
diff changeset
854 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
855 * _XMRefreshPane - Internal subroutine to completely refresh
Dave Love <fx@gnu.org>
parents:
diff changeset
856 * the contents of a pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
857 */
Dave Love <fx@gnu.org>
parents:
diff changeset
858 _XMRefreshPane(display, menu, pane)
Dave Love <fx@gnu.org>
parents:
diff changeset
859 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
860 register XMenu *menu;
Dave Love <fx@gnu.org>
parents:
diff changeset
861 register XMPane *pane;
Dave Love <fx@gnu.org>
parents:
diff changeset
862 {
Dave Love <fx@gnu.org>
parents:
diff changeset
863 register XMSelect *s_list = pane->s_list;
Dave Love <fx@gnu.org>
parents:
diff changeset
864 register XMSelect *s_ptr;
Dave Love <fx@gnu.org>
parents:
diff changeset
865
Dave Love <fx@gnu.org>
parents:
diff changeset
866 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
867 * First clear the pane.
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
868 */
Dave Love <fx@gnu.org>
parents:
diff changeset
869 XClearWindow(display, pane->window);
Dave Love <fx@gnu.org>
parents:
diff changeset
870 if (!pane->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
871 XFillRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
872 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
873 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
874 pane->label_x - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
875 pane->label_uy - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
876 pane->label_width + (menu->p_fnt_pad << 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
877 menu->flag_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
878
Dave Love <fx@gnu.org>
parents:
diff changeset
879 XFillRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
880 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
881 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
882 pane->label_x - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
883 pane->label_ly - menu->p_fnt_info->max_bounds.ascent - menu->p_fnt_pad,
Dave Love <fx@gnu.org>
parents:
diff changeset
884 pane->label_width + (menu->p_fnt_pad << 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
885 menu->flag_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
886 }
Dave Love <fx@gnu.org>
parents:
diff changeset
887 if (!pane->active) {
Dave Love <fx@gnu.org>
parents:
diff changeset
888 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
889 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
890 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
891 pane->label_x, pane->label_uy,
Dave Love <fx@gnu.org>
parents:
diff changeset
892 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
893 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
894 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
895 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
896 pane->label_x, pane->label_ly,
Dave Love <fx@gnu.org>
parents:
diff changeset
897 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
898 }
Dave Love <fx@gnu.org>
parents:
diff changeset
899 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
900 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
901 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
902 menu->pane_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
903 pane->label_x, pane->label_uy,
Dave Love <fx@gnu.org>
parents:
diff changeset
904 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
905 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
906 pane->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
907 menu->pane_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
908 pane->label_x, pane->label_ly,
Dave Love <fx@gnu.org>
parents:
diff changeset
909 pane->label, pane->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
910
Dave Love <fx@gnu.org>
parents:
diff changeset
911 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
912 * Finally refresh each selection if the pane is activated.
Dave Love <fx@gnu.org>
parents:
diff changeset
913 */
Dave Love <fx@gnu.org>
parents:
diff changeset
914 if (pane->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
915 for (s_ptr = s_list->next; s_ptr != s_list; s_ptr = s_ptr->next)
Dave Love <fx@gnu.org>
parents:
diff changeset
916 _XMRefreshSelection(display, menu, s_ptr);
Dave Love <fx@gnu.org>
parents:
diff changeset
917 }
Dave Love <fx@gnu.org>
parents:
diff changeset
918 }
Dave Love <fx@gnu.org>
parents:
diff changeset
919 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
920
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
921
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
922
Dave Love <fx@gnu.org>
parents:
diff changeset
923
Dave Love <fx@gnu.org>
parents:
diff changeset
924 /*
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
925 * _XMRefreshSelection - Internal subroutine that refreshes
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
926 * a single selection window.
Dave Love <fx@gnu.org>
parents:
diff changeset
927 */
Dave Love <fx@gnu.org>
parents:
diff changeset
928 _XMRefreshSelection(display, menu, select)
Dave Love <fx@gnu.org>
parents:
diff changeset
929 register Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
930 register XMenu *menu;
Dave Love <fx@gnu.org>
parents:
diff changeset
931 register XMSelect *select;
Dave Love <fx@gnu.org>
parents:
diff changeset
932 {
Dave Love <fx@gnu.org>
parents:
diff changeset
933 register int width = select->window_w;
Dave Love <fx@gnu.org>
parents:
diff changeset
934 register int height = select->window_h;
Dave Love <fx@gnu.org>
parents:
diff changeset
935 register int bdr_width = menu->s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
936
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
937 if (select->type == SEPARATOR) {
Dave Love <fx@gnu.org>
parents:
diff changeset
938 XDrawLine(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
939 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
940 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
941 select->window_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
942 select->window_y + height / 2,
Dave Love <fx@gnu.org>
parents:
diff changeset
943 select->window_x + width,
Dave Love <fx@gnu.org>
parents:
diff changeset
944 select->window_y + height / 2);
Dave Love <fx@gnu.org>
parents:
diff changeset
945 }
Dave Love <fx@gnu.org>
parents:
diff changeset
946 else if (select->activated) {
Dave Love <fx@gnu.org>
parents:
diff changeset
947 if (menu->menu_mode == INVERT) {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
948 XFillRectangle(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
949 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
950 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
951 select->window_x, select->window_y,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
952 width, height);
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
953 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
954 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
955 menu->inverse_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
956 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
957 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
958 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
959 }
Dave Love <fx@gnu.org>
parents:
diff changeset
960 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
961 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
962 * Using BOX mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
963 * Since most drawing routines with arbitrary width lines
Dave Love <fx@gnu.org>
parents:
diff changeset
964 * are slow compared to raster-ops lets use a raster-op to
Dave Love <fx@gnu.org>
parents:
diff changeset
965 * draw the boxes.
Dave Love <fx@gnu.org>
parents:
diff changeset
966 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
967
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
968 XDrawRectangle(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
969 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
970 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
971 select->window_x + (bdr_width >> 1),
Dave Love <fx@gnu.org>
parents:
diff changeset
972 select->window_y + (bdr_width >> 1 ),
Dave Love <fx@gnu.org>
parents:
diff changeset
973 width - bdr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
974 height - bdr_width);
Dave Love <fx@gnu.org>
parents:
diff changeset
975 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
976 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
977 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
978 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
979 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
980 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
981 }
Dave Love <fx@gnu.org>
parents:
diff changeset
982 }
Dave Love <fx@gnu.org>
parents:
diff changeset
983 else {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
984 XClearArea(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
985 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
986 select->window_x, select->window_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
987 width, height,
Dave Love <fx@gnu.org>
parents:
diff changeset
988 False);
Dave Love <fx@gnu.org>
parents:
diff changeset
989 if (select->active) {
Dave Love <fx@gnu.org>
parents:
diff changeset
990 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
991 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
992 menu->normal_select_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
993 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
994 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
995 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
996 }
Dave Love <fx@gnu.org>
parents:
diff changeset
997 else {
Dave Love <fx@gnu.org>
parents:
diff changeset
998 XDrawString(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
999 select->parent_p->window,
Dave Love <fx@gnu.org>
parents:
diff changeset
1000 menu->inact_GC,
Dave Love <fx@gnu.org>
parents:
diff changeset
1001 select->label_x,
Dave Love <fx@gnu.org>
parents:
diff changeset
1002 select->label_y,
Dave Love <fx@gnu.org>
parents:
diff changeset
1003 select->label, select->label_length);
Dave Love <fx@gnu.org>
parents:
diff changeset
1004 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1005 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1006 }
Dave Love <fx@gnu.org>
parents:
diff changeset
1007
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1008 /* arch-tag: 3ac61957-0852-4e72-8b88-7dfab1a5dee9
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1009 (do not change this comment) */