428
|
1 /* Generic toolbar implementation.
|
|
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
2367
|
4 Copyright (C) 1995, 1996, 2003, 2004 Ben Wing.
|
428
|
5 Copyright (C) 1996 Chuck Thompson.
|
|
6
|
|
7 This file is part of XEmacs.
|
|
8
|
|
9 XEmacs is free software; you can redistribute it and/or modify it
|
|
10 under the terms of the GNU General Public License as published by the
|
|
11 Free Software Foundation; either version 2, or (at your option) any
|
|
12 later version.
|
|
13
|
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
17 for more details.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License
|
|
20 along with XEmacs; see the file COPYING. If not, write to
|
|
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 Boston, MA 02111-1307, USA. */
|
|
23
|
|
24 /* Synched up with: Not in FSF. */
|
|
25
|
|
26 /* Original implementation by Chuck Thompson for 19.12.
|
|
27 Default-toolbar-position and specifier-related stuff by Ben Wing. */
|
|
28
|
|
29 #include <config.h>
|
|
30 #include "lisp.h"
|
|
31
|
|
32 #include "buffer.h"
|
872
|
33 #include "frame-impl.h"
|
|
34 #include "device-impl.h"
|
428
|
35 #include "glyphs.h"
|
|
36 #include "redisplay.h"
|
|
37 #include "toolbar.h"
|
|
38 #include "window.h"
|
|
39
|
|
40 Lisp_Object Vtoolbar[4];
|
|
41 Lisp_Object Vtoolbar_size[4];
|
|
42 Lisp_Object Vtoolbar_visible_p[4];
|
|
43 Lisp_Object Vtoolbar_border_width[4];
|
|
44
|
|
45 Lisp_Object Vdefault_toolbar, Vdefault_toolbar_visible_p;
|
|
46 Lisp_Object Vdefault_toolbar_width, Vdefault_toolbar_height;
|
|
47 Lisp_Object Vdefault_toolbar_border_width;
|
744
|
48 Lisp_Object Vtoolbar_shadow_thickness;
|
428
|
49
|
|
50 Lisp_Object Vdefault_toolbar_position;
|
|
51 Lisp_Object Vtoolbar_buttons_captioned_p;
|
|
52
|
|
53 Lisp_Object Qtoolbar_buttonp;
|
|
54 Lisp_Object Q2D, Q3D, Q2d, Q3d;
|
|
55 Lisp_Object Q_size;
|
|
56
|
|
57 Lisp_Object Qinit_toolbar_from_resources;
|
|
58
|
1204
|
59 static const struct memory_description toolbar_button_description [] = {
|
934
|
60 { XD_LISP_OBJECT, offsetof (struct toolbar_button, next) },
|
|
61 { XD_LISP_OBJECT, offsetof (struct toolbar_button, frame) },
|
|
62 { XD_LISP_OBJECT, offsetof (struct toolbar_button, up_glyph) },
|
|
63 { XD_LISP_OBJECT, offsetof (struct toolbar_button, down_glyph) },
|
|
64 { XD_LISP_OBJECT, offsetof (struct toolbar_button, disabled_glyph) },
|
|
65 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_up_glyph) },
|
|
66 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_down_glyph) },
|
|
67 { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_disabled_glyph) },
|
|
68 { XD_LISP_OBJECT, offsetof (struct toolbar_button, callback) },
|
|
69 { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) },
|
|
70 { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) },
|
|
71 { XD_END }
|
|
72 };
|
428
|
73
|
|
74 static Lisp_Object
|
|
75 mark_toolbar_button (Lisp_Object obj)
|
|
76 {
|
|
77 struct toolbar_button *data = XTOOLBAR_BUTTON (obj);
|
|
78 mark_object (data->next);
|
|
79 mark_object (data->frame);
|
|
80 mark_object (data->up_glyph);
|
|
81 mark_object (data->down_glyph);
|
|
82 mark_object (data->disabled_glyph);
|
|
83 mark_object (data->cap_up_glyph);
|
|
84 mark_object (data->cap_down_glyph);
|
|
85 mark_object (data->cap_disabled_glyph);
|
|
86 mark_object (data->callback);
|
|
87 mark_object (data->enabled_p);
|
|
88 return data->help_string;
|
|
89 }
|
|
90
|
934
|
91 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
|
|
92 0, /*dumpable-flag*/
|
|
93 mark_toolbar_button, 0, 0, 0, 0,
|
|
94 toolbar_button_description,
|
|
95 struct toolbar_button);
|
428
|
96
|
|
97 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /*
|
|
98 Return non-nil if OBJECT is a toolbar button.
|
|
99 */
|
|
100 (object))
|
|
101 {
|
|
102 return TOOLBAR_BUTTONP (object) ? Qt : Qnil;
|
|
103 }
|
|
104
|
|
105 /* Only query functions are provided for toolbar buttons. They are
|
|
106 generated and updated from a toolbar description list. Any
|
|
107 directly made changes would be wiped out the first time the toolbar
|
|
108 was marked as dirty and was regenerated. The exception to this is
|
|
109 set-toolbar-button-down-flag. Having this allows us to control the
|
|
110 toolbar from elisp. Since we only trigger the button callbacks on
|
|
111 up-mouse events and we reset the flag first, there shouldn't be any
|
|
112 way for this to get us in trouble (like if someone decides to
|
|
113 change the toolbar from a toolbar callback). */
|
|
114
|
|
115 DEFUN ("toolbar-button-callback", Ftoolbar_button_callback, 1, 1, 0, /*
|
|
116 Return the callback function associated with the toolbar BUTTON.
|
|
117 */
|
|
118 (button))
|
|
119 {
|
|
120 CHECK_TOOLBAR_BUTTON (button);
|
|
121
|
|
122 return XTOOLBAR_BUTTON (button)->callback;
|
|
123 }
|
|
124
|
|
125 DEFUN ("toolbar-button-help-string", Ftoolbar_button_help_string, 1, 1, 0, /*
|
|
126 Return the help string function associated with the toolbar BUTTON.
|
|
127 */
|
|
128 (button))
|
|
129 {
|
|
130 CHECK_TOOLBAR_BUTTON (button);
|
|
131
|
|
132 return XTOOLBAR_BUTTON (button)->help_string;
|
|
133 }
|
|
134
|
|
135 DEFUN ("toolbar-button-enabled-p", Ftoolbar_button_enabled_p, 1, 1, 0, /*
|
|
136 Return t if BUTTON is active.
|
|
137 */
|
|
138 (button))
|
|
139 {
|
|
140 CHECK_TOOLBAR_BUTTON (button);
|
|
141
|
|
142 return XTOOLBAR_BUTTON (button)->enabled ? Qt : Qnil;
|
|
143 }
|
|
144
|
|
145 DEFUN ("set-toolbar-button-down-flag", Fset_toolbar_button_down_flag, 2, 2, 0, /*
|
|
146 Don't touch.
|
|
147 */
|
|
148 (button, flag))
|
|
149 {
|
|
150 struct toolbar_button *tb;
|
|
151 char old_flag;
|
|
152
|
|
153 CHECK_TOOLBAR_BUTTON (button);
|
|
154 tb = XTOOLBAR_BUTTON (button);
|
|
155 old_flag = tb->down;
|
|
156
|
|
157 /* If the button is ignored, don't do anything. */
|
|
158 if (!tb->enabled)
|
|
159 return Qnil;
|
|
160
|
|
161 /* If flag is nil, unset the down flag, otherwise set it to true.
|
|
162 This also triggers an immediate redraw of the button if the flag
|
|
163 does change. */
|
|
164
|
|
165 if (NILP (flag))
|
|
166 tb->down = 0;
|
|
167 else
|
|
168 tb->down = 1;
|
|
169
|
|
170 if (tb->down != old_flag)
|
|
171 {
|
|
172 struct frame *f = XFRAME (tb->frame);
|
|
173 struct device *d;
|
|
174
|
|
175 if (DEVICEP (f->device))
|
|
176 {
|
|
177 d = XDEVICE (f->device);
|
|
178
|
|
179 if (DEVICE_LIVE_P (XDEVICE (f->device)))
|
|
180 {
|
|
181 tb->dirty = 1;
|
|
182 MAYBE_DEVMETH (d, output_toolbar_button, (f, button));
|
|
183 }
|
|
184 }
|
|
185 }
|
|
186
|
|
187 return Qnil;
|
|
188 }
|
|
189
|
|
190 Lisp_Object
|
|
191 get_toolbar_button_glyph (struct window *w, struct toolbar_button *tb)
|
|
192 {
|
|
193 Lisp_Object glyph = Qnil;
|
|
194
|
|
195 /* The selected glyph logic:
|
|
196
|
|
197 UP: up
|
|
198 DOWN: down -> up
|
|
199 DISABLED: disabled -> up
|
|
200 CAP-UP: cap-up -> up
|
|
201 CAP-DOWN: cap-down -> cap-up -> down -> up
|
|
202 CAP-DISABLED: cap-disabled -> cap-up -> disabled -> up
|
|
203 */
|
|
204
|
|
205 if (!NILP (w->toolbar_buttons_captioned_p))
|
|
206 {
|
|
207 if (tb->enabled && tb->down)
|
|
208 glyph = tb->cap_down_glyph;
|
|
209 else if (!tb->enabled)
|
|
210 glyph = tb->cap_disabled_glyph;
|
|
211
|
|
212 if (NILP (glyph))
|
|
213 glyph = tb->cap_up_glyph;
|
|
214 }
|
|
215
|
|
216 if (NILP (glyph))
|
|
217 {
|
|
218 if (tb->enabled && tb->down)
|
|
219 glyph = tb->down_glyph;
|
|
220 else if (!tb->enabled)
|
|
221 glyph = tb->disabled_glyph;
|
|
222 }
|
|
223
|
|
224 /* The non-captioned up button is the ultimate fallback. It is
|
|
225 the only one we guarantee exists. */
|
|
226 if (NILP (glyph))
|
|
227 glyph = tb->up_glyph;
|
|
228
|
|
229 return glyph;
|
|
230 }
|
|
231
|
|
232
|
|
233 static enum toolbar_pos
|
|
234 decode_toolbar_position (Lisp_Object position)
|
|
235 {
|
|
236 if (EQ (position, Qtop)) return TOP_TOOLBAR;
|
|
237 if (EQ (position, Qbottom)) return BOTTOM_TOOLBAR;
|
|
238 if (EQ (position, Qleft)) return LEFT_TOOLBAR;
|
|
239 if (EQ (position, Qright)) return RIGHT_TOOLBAR;
|
563
|
240 invalid_constant ("Invalid toolbar position", position);
|
428
|
241
|
1204
|
242 RETURN_NOT_REACHED (TOP_TOOLBAR);
|
428
|
243 }
|
|
244
|
|
245 DEFUN ("set-default-toolbar-position", Fset_default_toolbar_position, 1, 1, 0, /*
|
|
246 Set the position that the `default-toolbar' will be displayed at.
|
|
247 Valid positions are 'top, 'bottom, 'left and 'right.
|
|
248 See `default-toolbar-position'.
|
|
249 */
|
|
250 (position))
|
|
251 {
|
|
252 enum toolbar_pos cur = decode_toolbar_position (Vdefault_toolbar_position);
|
|
253 enum toolbar_pos new = decode_toolbar_position (position);
|
|
254
|
|
255 if (cur != new)
|
|
256 {
|
|
257 /* The following calls will automatically cause the dirty
|
|
258 flags to be set; we delay frame size changes to avoid
|
|
259 lots of frame flickering. */
|
1318
|
260 int depth = begin_hold_frame_size_changes ();
|
428
|
261 set_specifier_fallback (Vtoolbar[cur], list1 (Fcons (Qnil, Qnil)));
|
|
262 set_specifier_fallback (Vtoolbar[new], Vdefault_toolbar);
|
|
263 set_specifier_fallback (Vtoolbar_size[cur], list1 (Fcons (Qnil, Qzero)));
|
|
264 set_specifier_fallback (Vtoolbar_size[new],
|
|
265 new == TOP_TOOLBAR || new == BOTTOM_TOOLBAR
|
|
266 ? Vdefault_toolbar_height
|
|
267 : Vdefault_toolbar_width);
|
|
268 set_specifier_fallback (Vtoolbar_border_width[cur],
|
|
269 list1 (Fcons (Qnil, Qzero)));
|
|
270 set_specifier_fallback (Vtoolbar_border_width[new],
|
|
271 Vdefault_toolbar_border_width);
|
|
272 set_specifier_fallback (Vtoolbar_visible_p[cur],
|
|
273 list1 (Fcons (Qnil, Qt)));
|
|
274 set_specifier_fallback (Vtoolbar_visible_p[new],
|
|
275 Vdefault_toolbar_visible_p);
|
|
276 Vdefault_toolbar_position = position;
|
1318
|
277 unbind_to (depth);
|
428
|
278 }
|
|
279
|
|
280 return position;
|
|
281 }
|
|
282
|
|
283 DEFUN ("default-toolbar-position", Fdefault_toolbar_position, 0, 0, 0, /*
|
|
284 Return the position that the `default-toolbar' will be displayed at.
|
|
285 The `default-toolbar' will only be displayed here if the corresponding
|
|
286 position-specific toolbar specifier does not provide a value.
|
|
287 */
|
|
288 ())
|
|
289 {
|
|
290 return Vdefault_toolbar_position;
|
|
291 }
|
|
292
|
|
293
|
|
294 static Lisp_Object
|
|
295 update_toolbar_button (struct frame *f, struct toolbar_button *tb,
|
|
296 Lisp_Object desc, int pushright)
|
|
297 {
|
|
298 Lisp_Object *elt, glyphs, retval, buffer;
|
|
299 struct gcpro gcpro1, gcpro2;
|
|
300
|
|
301 elt = XVECTOR_DATA (desc);
|
|
302 buffer = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer;
|
|
303
|
|
304 if (!tb)
|
|
305 {
|
|
306 tb = alloc_lcrecord_type (struct toolbar_button, &lrecord_toolbar_button);
|
|
307 tb->next = Qnil;
|
793
|
308 tb->frame = wrap_frame (f);
|
428
|
309 tb->up_glyph = Qnil;
|
|
310 tb->down_glyph = Qnil;
|
|
311 tb->disabled_glyph = Qnil;
|
|
312 tb->cap_up_glyph = Qnil;
|
|
313 tb->cap_down_glyph = Qnil;
|
|
314 tb->cap_disabled_glyph = Qnil;
|
|
315 tb->callback = Qnil;
|
|
316 tb->enabled_p = Qnil;
|
|
317 tb->help_string = Qnil;
|
|
318
|
|
319 tb->enabled = 0;
|
|
320 tb->down = 0;
|
|
321 tb->pushright = pushright;
|
|
322 tb->blank = 0;
|
|
323 tb->x = tb->y = tb->width = tb->height = -1;
|
|
324 tb->dirty = 1;
|
|
325 }
|
793
|
326 retval = wrap_toolbar_button (tb);
|
428
|
327
|
|
328 /* Let's make sure nothing gets mucked up by the potential call to
|
|
329 eval farther down. */
|
|
330 GCPRO2 (retval, desc);
|
|
331
|
|
332 glyphs = (CONSP (elt[0]) ? elt[0] : symbol_value_in_buffer (elt[0], buffer));
|
|
333
|
|
334 /* If this is true we have a blank, otherwise it is an actual
|
|
335 button. */
|
|
336 if (KEYWORDP (glyphs))
|
|
337 {
|
|
338 int pos;
|
|
339 int style_seen = 0;
|
|
340 int size_seen = 0;
|
|
341 int len = XVECTOR_LENGTH (desc);
|
|
342
|
|
343 if (!tb->blank)
|
|
344 {
|
|
345 tb->blank = 1;
|
|
346 tb->dirty = 1;
|
|
347 }
|
|
348
|
|
349 for (pos = 0; pos < len; pos += 2)
|
|
350 {
|
|
351 Lisp_Object key = elt[pos];
|
|
352 Lisp_Object val = elt[pos + 1];
|
|
353
|
|
354 if (EQ (key, Q_style))
|
|
355 {
|
|
356 style_seen = 1;
|
|
357
|
|
358 if (EQ (val, Q2D) || EQ (val, Q2d))
|
|
359 {
|
|
360 if (!EQ (Qnil, tb->up_glyph) || !EQ (Qt, tb->disabled_glyph))
|
|
361 {
|
|
362 tb->up_glyph = Qnil;
|
|
363 tb->disabled_glyph = Qt;
|
|
364 tb->dirty = 1;
|
|
365 }
|
|
366 }
|
|
367 else if (EQ (val, Q3D) || (EQ (val, Q3d)))
|
|
368 {
|
|
369 if (!EQ (Qt, tb->up_glyph) || !EQ (Qnil, tb->disabled_glyph))
|
|
370 {
|
|
371 tb->up_glyph = Qt;
|
|
372 tb->disabled_glyph = Qnil;
|
|
373 tb->dirty = 1;
|
|
374 }
|
|
375 }
|
|
376 }
|
|
377 else if (EQ (key, Q_size))
|
|
378 {
|
|
379 size_seen = 1;
|
|
380
|
|
381 if (!EQ (val, tb->down_glyph))
|
|
382 {
|
|
383 tb->down_glyph = val;
|
|
384 tb->dirty = 1;
|
|
385 }
|
|
386 }
|
|
387 }
|
|
388
|
|
389 if (!style_seen)
|
|
390 {
|
|
391 /* The default style is 3D. */
|
|
392 if (!EQ (Qt, tb->up_glyph) || !EQ (Qnil, tb->disabled_glyph))
|
|
393 {
|
|
394 tb->up_glyph = Qt;
|
|
395 tb->disabled_glyph = Qnil;
|
|
396 tb->dirty = 1;
|
|
397 }
|
|
398 }
|
|
399
|
|
400 if (!size_seen)
|
|
401 {
|
|
402 /* The default width is set to nil. The device specific
|
|
403 code will fill it in at its discretion. */
|
|
404 if (!NILP (tb->down_glyph))
|
|
405 {
|
|
406 tb->down_glyph = Qnil;
|
|
407 tb->dirty = 1;
|
|
408 }
|
|
409 }
|
|
410
|
|
411 /* The rest of these fields are not used by blanks. We make
|
|
412 sure they are nulled out in case this button object formerly
|
|
413 represented a real button. */
|
|
414 if (!NILP (tb->callback)
|
|
415 || !NILP (tb->enabled_p)
|
|
416 || !NILP (tb->help_string))
|
|
417 {
|
|
418 tb->cap_up_glyph = Qnil;
|
|
419 tb->cap_down_glyph = Qnil;
|
|
420 tb->cap_disabled_glyph = Qnil;
|
|
421 tb->callback = Qnil;
|
|
422 tb->enabled_p = Qnil;
|
|
423 tb->help_string = Qnil;
|
|
424 tb->dirty = 1;
|
|
425 }
|
|
426 }
|
|
427 else
|
|
428 {
|
|
429 if (tb->blank)
|
|
430 {
|
|
431 tb->blank = 0;
|
|
432 tb->dirty = 1;
|
|
433 }
|
|
434
|
|
435 /* We know that we at least have an up_glyph. Well, no, we
|
|
436 don't. The user may have changed the button glyph on us. */
|
|
437 if (CONSP (glyphs))
|
|
438 {
|
|
439 if (!EQ (XCAR (glyphs), tb->up_glyph))
|
|
440 {
|
|
441 tb->up_glyph = XCAR (glyphs);
|
|
442 tb->dirty = 1;
|
|
443 }
|
|
444 glyphs = XCDR (glyphs);
|
|
445 }
|
|
446 else
|
|
447 tb->up_glyph = Qnil;
|
|
448
|
|
449 /* We might have a down_glyph. */
|
|
450 if (CONSP (glyphs))
|
|
451 {
|
|
452 if (!EQ (XCAR (glyphs), tb->down_glyph))
|
|
453 {
|
|
454 tb->down_glyph = XCAR (glyphs);
|
|
455 tb->dirty = 1;
|
|
456 }
|
|
457 glyphs = XCDR (glyphs);
|
|
458 }
|
|
459 else
|
|
460 tb->down_glyph = Qnil;
|
|
461
|
|
462 /* We might have a disabled_glyph. */
|
|
463 if (CONSP (glyphs))
|
|
464 {
|
|
465 if (!EQ (XCAR (glyphs), tb->disabled_glyph))
|
|
466 {
|
|
467 tb->disabled_glyph = XCAR (glyphs);
|
|
468 tb->dirty = 1;
|
|
469 }
|
|
470 glyphs = XCDR (glyphs);
|
|
471 }
|
|
472 else
|
|
473 tb->disabled_glyph = Qnil;
|
|
474
|
|
475 /* We might have a cap_up_glyph. */
|
|
476 if (CONSP (glyphs))
|
|
477 {
|
|
478 if (!EQ (XCAR (glyphs), tb->cap_up_glyph))
|
|
479 {
|
|
480 tb->cap_up_glyph = XCAR (glyphs);
|
|
481 tb->dirty = 1;
|
|
482 }
|
|
483 glyphs = XCDR (glyphs);
|
|
484 }
|
|
485 else
|
|
486 tb->cap_up_glyph = Qnil;
|
|
487
|
|
488 /* We might have a cap_down_glyph. */
|
|
489 if (CONSP (glyphs))
|
|
490 {
|
|
491 if (!EQ (XCAR (glyphs), tb->cap_down_glyph))
|
|
492 {
|
|
493 tb->cap_down_glyph = XCAR (glyphs);
|
|
494 tb->dirty = 1;
|
|
495 }
|
|
496 glyphs = XCDR (glyphs);
|
|
497 }
|
|
498 else
|
|
499 tb->cap_down_glyph = Qnil;
|
|
500
|
|
501 /* We might have a cap_disabled_glyph. */
|
|
502 if (CONSP (glyphs))
|
|
503 {
|
|
504 if (!EQ (XCAR (glyphs), tb->cap_disabled_glyph))
|
|
505 {
|
|
506 tb->cap_disabled_glyph = XCAR (glyphs);
|
|
507 tb->dirty = 1;
|
|
508 }
|
|
509 }
|
|
510 else
|
|
511 tb->cap_disabled_glyph = Qnil;
|
|
512
|
|
513 /* Update the callback. */
|
|
514 if (!EQ (tb->callback, elt[1]))
|
|
515 {
|
|
516 tb->callback = elt[1];
|
|
517 /* This does not have an impact on the display properties of the
|
|
518 button so we do not mark it as dirty if it has changed. */
|
|
519 }
|
|
520
|
|
521 /* Update the enabled field. */
|
|
522 if (!EQ (tb->enabled_p, elt[2]))
|
|
523 {
|
|
524 tb->enabled_p = elt[2];
|
|
525 tb->dirty = 1;
|
|
526 }
|
|
527
|
|
528 /* We always do the following because if the enabled status is
|
|
529 determined by a function its decision may change without us being
|
|
530 able to detect it. */
|
|
531 {
|
|
532 int old_enabled = tb->enabled;
|
|
533
|
|
534 if (NILP (tb->enabled_p))
|
|
535 tb->enabled = 0;
|
|
536 else if (EQ (tb->enabled_p, Qt))
|
|
537 tb->enabled = 1;
|
|
538 else
|
|
539 {
|
|
540 if (NILP (tb->enabled_p) || EQ (tb->enabled_p, Qt))
|
|
541 /* short-circuit the common case for speed */
|
|
542 tb->enabled = !NILP (tb->enabled_p);
|
|
543 else
|
|
544 {
|
853
|
545 /* #### do we really need to protect this call? */
|
428
|
546 Lisp_Object result =
|
853
|
547 eval_in_buffer_trapping_problems
|
428
|
548 ("Error in toolbar enabled-p form",
|
|
549 XBUFFER
|
|
550 (WINDOW_BUFFER
|
|
551 (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)))),
|
853
|
552 tb->enabled_p, 0);
|
428
|
553 if (UNBOUNDP (result))
|
|
554 /* #### if there was an error in the enabled-p
|
|
555 form, should we pretend like it's enabled
|
|
556 or disabled? */
|
|
557 tb->enabled = 0;
|
|
558 else
|
|
559 tb->enabled = !NILP (result);
|
|
560 }
|
|
561 }
|
|
562
|
|
563 if (old_enabled != tb->enabled)
|
|
564 tb->dirty = 1;
|
|
565 }
|
|
566
|
|
567 /* Update the help echo string. */
|
|
568 if (!EQ (tb->help_string, elt[3]))
|
|
569 {
|
|
570 tb->help_string = elt[3];
|
|
571 /* This does not have an impact on the display properties of the
|
|
572 button so we do not mark it as dirty if it has changed. */
|
|
573 }
|
|
574 }
|
|
575
|
|
576 /* If this flag changes, the position is changing for sure unless
|
|
577 some very unlikely geometry occurs. */
|
|
578 if (tb->pushright != pushright)
|
|
579 {
|
|
580 tb->pushright = pushright;
|
|
581 tb->dirty = 1;
|
|
582 }
|
|
583
|
|
584 /* The position and size fields are only manipulated in the
|
|
585 device-dependent code. */
|
|
586 UNGCPRO;
|
|
587 return retval;
|
|
588 }
|
|
589
|
|
590 void
|
|
591 mark_frame_toolbar_buttons_dirty (struct frame *f, enum toolbar_pos pos)
|
|
592 {
|
|
593 Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos);
|
|
594
|
|
595 while (!NILP (button))
|
|
596 {
|
|
597 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
|
|
598 tb->dirty = 1;
|
|
599 button = tb->next;
|
|
600 }
|
|
601 return;
|
|
602 }
|
|
603
|
|
604 static Lisp_Object
|
|
605 compute_frame_toolbar_buttons (struct frame *f, enum toolbar_pos pos,
|
|
606 Lisp_Object toolbar)
|
|
607 {
|
|
608 Lisp_Object buttons, prev_button, first_button;
|
|
609 Lisp_Object orig_toolbar = toolbar;
|
|
610 int pushright_seen = 0;
|
|
611 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
|
|
612
|
|
613 first_button = FRAME_TOOLBAR_BUTTONS (f, pos);
|
|
614 buttons = prev_button = first_button;
|
|
615
|
|
616 /* Yes, we're being paranoid. */
|
|
617 GCPRO5 (toolbar, buttons, prev_button, first_button, orig_toolbar);
|
|
618
|
|
619 if (NILP (toolbar))
|
|
620 {
|
|
621 /* The output mechanisms will take care of clearing the former
|
|
622 toolbar. */
|
|
623 UNGCPRO;
|
|
624 return Qnil;
|
|
625 }
|
|
626
|
|
627 if (!CONSP (toolbar))
|
563
|
628 sferror ("toolbar description must be a list", toolbar);
|
428
|
629
|
|
630 /* First synchronize any existing buttons. */
|
|
631 while (!NILP (toolbar) && !NILP (buttons))
|
|
632 {
|
|
633 struct toolbar_button *tb;
|
|
634
|
|
635 if (NILP (XCAR (toolbar)))
|
|
636 {
|
|
637 if (pushright_seen)
|
563
|
638 sferror
|
428
|
639 ("more than one partition (nil) in toolbar description",
|
|
640 orig_toolbar);
|
|
641 else
|
|
642 pushright_seen = 1;
|
|
643 }
|
|
644 else
|
|
645 {
|
|
646 tb = XTOOLBAR_BUTTON (buttons);
|
|
647 update_toolbar_button (f, tb, XCAR (toolbar), pushright_seen);
|
|
648 prev_button = buttons;
|
|
649 buttons = tb->next;
|
|
650 }
|
|
651
|
|
652 toolbar = XCDR (toolbar);
|
|
653 }
|
|
654
|
|
655 /* If we hit the end of the toolbar, then clean up any excess
|
|
656 buttons and return. */
|
|
657 if (NILP (toolbar))
|
|
658 {
|
|
659 if (!NILP (buttons))
|
|
660 {
|
|
661 /* If this is the case the only thing we saw was a
|
|
662 pushright marker. */
|
|
663 if (EQ (buttons, first_button))
|
|
664 {
|
|
665 UNGCPRO;
|
|
666 return Qnil;
|
|
667 }
|
|
668 else
|
|
669 XTOOLBAR_BUTTON (prev_button)->next = Qnil;
|
|
670 }
|
|
671 UNGCPRO;
|
|
672 return first_button;
|
|
673 }
|
|
674
|
|
675 /* At this point there are more buttons on the toolbar than we
|
|
676 actually have in existence. */
|
|
677 while (!NILP (toolbar))
|
|
678 {
|
|
679 Lisp_Object new_button;
|
|
680
|
|
681 if (NILP (XCAR (toolbar)))
|
|
682 {
|
|
683 if (pushright_seen)
|
563
|
684 sferror
|
428
|
685 ("more than one partition (nil) in toolbar description",
|
|
686 orig_toolbar);
|
|
687 else
|
|
688 pushright_seen = 1;
|
|
689 }
|
|
690 else
|
|
691 {
|
|
692 new_button = update_toolbar_button (f, NULL, XCAR (toolbar),
|
|
693 pushright_seen);
|
|
694
|
|
695 if (NILP (first_button))
|
|
696 {
|
|
697 first_button = prev_button = new_button;
|
|
698 }
|
|
699 else
|
|
700 {
|
|
701 XTOOLBAR_BUTTON (prev_button)->next = new_button;
|
|
702 prev_button = new_button;
|
|
703 }
|
|
704 }
|
|
705
|
|
706 toolbar = XCDR (toolbar);
|
|
707 }
|
|
708
|
|
709 UNGCPRO;
|
|
710 return first_button;
|
|
711 }
|
|
712
|
|
713 static void
|
|
714 set_frame_toolbar (struct frame *f, enum toolbar_pos pos)
|
|
715 {
|
|
716 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
717 Lisp_Object toolbar = w->toolbar[pos];
|
|
718 f->toolbar_buttons[pos] = (FRAME_REAL_TOOLBAR_VISIBLE (f, pos)
|
|
719 ? compute_frame_toolbar_buttons (f, pos, toolbar)
|
|
720 : Qnil);
|
|
721 }
|
|
722
|
|
723 static void
|
|
724 compute_frame_toolbars_data (struct frame *f)
|
|
725 {
|
442
|
726 set_frame_toolbar (f, TOP_TOOLBAR);
|
|
727 set_frame_toolbar (f, BOTTOM_TOOLBAR);
|
|
728 set_frame_toolbar (f, LEFT_TOOLBAR);
|
|
729 set_frame_toolbar (f, RIGHT_TOOLBAR);
|
428
|
730 }
|
|
731
|
905
|
732 /* Update the toolbar geometry separately from actually displaying the
|
|
733 toolbar. This is necessary because both the gutter and the toolbar
|
|
734 are competing for redisplay cycles and, unfortunately, gutter
|
|
735 updates happen late in the game. Firstly they are done inside of
|
|
736 redisplay proper and secondly subcontrols may not get moved until
|
|
737 the next screen refresh. Only after subcontrols have been moved to
|
|
738 their final destinations can we be certain of updating the
|
|
739 toolbar. Under X this probably is exacerbated by the toolbar button
|
|
740 dirty flags which prevent updates happening when they possibly
|
|
741 should. */
|
428
|
742 void
|
905
|
743 update_frame_toolbars_geometry (struct frame *f)
|
428
|
744 {
|
|
745 struct device *d = XDEVICE (f->device);
|
|
746
|
|
747 if (DEVICE_SUPPORTS_TOOLBARS_P (d)
|
905
|
748 && (f->toolbar_changed
|
|
749 || f->frame_layout_changed
|
|
750 || f->frame_changed
|
|
751 || f->clear))
|
428
|
752 {
|
1559
|
753 int pos, frame_size_changed = 0;
|
442
|
754
|
428
|
755 /* We're not officially "in redisplay", so we still have a
|
|
756 chance to re-layout toolbars and windows. This is done here,
|
|
757 because toolbar is the only thing which currently might
|
|
758 necessitate this layout, as it is outside any windows. We
|
|
759 take care not to change size if toolbar geometry is really
|
|
760 unchanged, as it will hose windows whose pixsizes are not
|
|
761 multiple of character sizes. */
|
|
762
|
|
763 for (pos = 0; pos < 4; pos++)
|
|
764 if (FRAME_REAL_TOOLBAR_SIZE (f, pos)
|
|
765 != FRAME_CURRENT_TOOLBAR_SIZE (f, pos))
|
1559
|
766 frame_size_changed = 1;
|
428
|
767
|
905
|
768 for (pos = 0; pos < 4; pos++) {
|
428
|
769 f->current_toolbar_size[pos] = FRAME_REAL_TOOLBAR_SIZE (f, pos);
|
905
|
770 }
|
428
|
771
|
|
772 /* Removed the check for the minibuffer here. We handle this
|
|
773 more correctly now by consistently using
|
|
774 FRAME_LAST_NONMINIBUF_WINDOW instead of FRAME_SELECTED_WINDOW
|
|
775 throughout the toolbar code. */
|
|
776 compute_frame_toolbars_data (f);
|
1559
|
777
|
|
778 if (frame_size_changed)
|
|
779 {
|
|
780 int width, height;
|
2367
|
781 if (!window_system_pixelated_geometry (wrap_frame (f)))
|
|
782 pixel_to_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
|
|
783 &width, &height);
|
|
784 else
|
|
785 width = FRAME_PIXWIDTH (f), height = FRAME_PIXHEIGHT (f);
|
1559
|
786 if (!HAS_FRAMEMETH_P (f, set_frame_size))
|
|
787 change_frame_size (f, height, width, 0);
|
|
788 else
|
|
789 FRAMEMETH (f, set_frame_size, (f, width, height));
|
|
790 MARK_FRAME_LAYOUT_CHANGED (f);
|
|
791 }
|
905
|
792
|
|
793 /* Clear the previous toolbar locations. If we do it later
|
|
794 (after redisplay) we end up clearing what we have just
|
|
795 displayed. */
|
|
796 MAYBE_DEVMETH (d, clear_frame_toolbars, (f));
|
1559
|
797
|
905
|
798 }
|
|
799 }
|
428
|
800
|
905
|
801 /* Actually redisplay the toolbar buttons. */
|
|
802 void
|
|
803 update_frame_toolbars (struct frame *f)
|
|
804 {
|
|
805 struct device *d = XDEVICE (f->device);
|
|
806
|
|
807 if (DEVICE_SUPPORTS_TOOLBARS_P (d)
|
|
808 && (f->toolbar_changed
|
|
809 || f->frame_layout_changed
|
|
810 || f->frame_changed
|
|
811 || f->clear))
|
|
812 {
|
428
|
813 DEVMETH (d, output_frame_toolbars, (f));
|
|
814 }
|
|
815
|
|
816 f->toolbar_changed = 0;
|
|
817 }
|
|
818
|
|
819 void
|
|
820 init_frame_toolbars (struct frame *f)
|
|
821 {
|
|
822 struct device *d = XDEVICE (f->device);
|
|
823
|
|
824 if (DEVICE_SUPPORTS_TOOLBARS_P (d))
|
|
825 {
|
|
826 Lisp_Object frame;
|
|
827 int pos;
|
|
828
|
|
829 compute_frame_toolbars_data (f);
|
793
|
830 frame = wrap_frame (f);
|
428
|
831 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
|
|
832 Qinit_toolbar_from_resources,
|
|
833 frame);
|
|
834 MAYBE_DEVMETH (d, initialize_frame_toolbars, (f));
|
|
835
|
|
836 /* We are here as far in frame creation so cached specifiers are
|
|
837 already recomputed, and possibly modified by resource
|
|
838 initialization. Remember current toolbar geometry so next
|
|
839 redisplay will not needlessly relayout toolbars. */
|
|
840 for (pos = 0; pos < 4; pos++)
|
|
841 f->current_toolbar_size[pos] = FRAME_REAL_TOOLBAR_SIZE (f, pos);
|
|
842 }
|
|
843 }
|
|
844
|
|
845 void
|
|
846 init_device_toolbars (struct device *d)
|
|
847 {
|
793
|
848 Lisp_Object device = wrap_device (d);
|
428
|
849
|
|
850 if (DEVICE_SUPPORTS_TOOLBARS_P (d))
|
|
851 call_critical_lisp_code (d,
|
|
852 Qinit_toolbar_from_resources,
|
|
853 device);
|
|
854 }
|
|
855
|
|
856 void
|
|
857 init_global_toolbars (struct device *d)
|
|
858 {
|
|
859 if (DEVICE_SUPPORTS_TOOLBARS_P (d))
|
|
860 call_critical_lisp_code (d,
|
|
861 Qinit_toolbar_from_resources,
|
|
862 Qglobal);
|
|
863 }
|
|
864
|
|
865 void
|
|
866 free_frame_toolbars (struct frame *f)
|
|
867 {
|
|
868 /* If we had directly allocated any memory for the toolbars instead
|
|
869 of using all Lisp_Objects this is where we would now free it. */
|
|
870
|
|
871 MAYBE_FRAMEMETH (f, free_frame_toolbars, (f));
|
|
872 }
|
|
873
|
|
874 void
|
|
875 get_toolbar_coords (struct frame *f, enum toolbar_pos pos, int *x, int *y,
|
|
876 int *width, int *height, int *vert, int for_layout)
|
|
877 {
|
|
878 int visible_top_toolbar_height, visible_bottom_toolbar_height;
|
|
879 int adjust = (for_layout ? 1 : 0);
|
|
880
|
|
881 /* The top and bottom toolbars take precedence over the left and
|
|
882 right. */
|
|
883 visible_top_toolbar_height = (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)
|
|
884 ? FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) +
|
|
885 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f)
|
|
886 : 0);
|
|
887 visible_bottom_toolbar_height = (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)
|
|
888 ? FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) +
|
|
889 2 *
|
|
890 FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)
|
|
891 : 0);
|
|
892
|
|
893 /* We adjust the width and height by one to give us a narrow border
|
|
894 at the outside edges. However, when we are simply determining
|
|
895 toolbar location we don't want to do that. */
|
|
896
|
|
897 switch (pos)
|
|
898 {
|
|
899 case TOP_TOOLBAR:
|
|
900 *x = 1;
|
|
901 *y = 0; /* #### should be 1 if no menubar */
|
|
902 *width = FRAME_PIXWIDTH (f) - 2;
|
|
903 *height = FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) +
|
|
904 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) - adjust;
|
|
905 *vert = 0;
|
|
906 break;
|
|
907 case BOTTOM_TOOLBAR:
|
|
908 *x = 1;
|
|
909 *y = FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
|
|
910 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
|
|
911 *width = FRAME_PIXWIDTH (f) - 2;
|
|
912 *height = FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) +
|
|
913 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f) - adjust;
|
|
914 *vert = 0;
|
|
915 break;
|
|
916 case LEFT_TOOLBAR:
|
|
917 *x = 1;
|
|
918 *y = visible_top_toolbar_height;
|
|
919 *width = FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) +
|
|
920 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f) - adjust;
|
|
921 *height = (FRAME_PIXHEIGHT (f) - visible_top_toolbar_height -
|
|
922 visible_bottom_toolbar_height - 1);
|
|
923 *vert = 1;
|
|
924 break;
|
|
925 case RIGHT_TOOLBAR:
|
|
926 *x = FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
|
|
927 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
|
|
928 *y = visible_top_toolbar_height;
|
|
929 *width = FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) +
|
|
930 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f) - adjust;
|
|
931 *height = (FRAME_PIXHEIGHT (f) - visible_top_toolbar_height -
|
|
932 visible_bottom_toolbar_height);
|
|
933 *vert = 1;
|
|
934 break;
|
|
935 default:
|
2500
|
936 ABORT ();
|
428
|
937 }
|
|
938 }
|
|
939
|
|
940 #define CHECK_TOOLBAR(pos) do { \
|
|
941 if (FRAME_REAL_##pos##_VISIBLE (f)) \
|
|
942 { \
|
|
943 int x, y, width, height, vert; \
|
|
944 \
|
|
945 get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 0); \
|
|
946 if ((x_coord >= x) && (x_coord < (x + width))) \
|
|
947 { \
|
|
948 if ((y_coord >= y) && (y_coord < (y + height))) \
|
|
949 return FRAME_TOOLBAR_BUTTONS (f, pos); \
|
|
950 } \
|
|
951 } \
|
|
952 } while (0)
|
|
953
|
|
954 static Lisp_Object
|
|
955 toolbar_buttons_at_pixpos (struct frame *f, int x_coord, int y_coord)
|
|
956 {
|
|
957 CHECK_TOOLBAR (TOP_TOOLBAR);
|
|
958 CHECK_TOOLBAR (BOTTOM_TOOLBAR);
|
|
959 CHECK_TOOLBAR (LEFT_TOOLBAR);
|
|
960 CHECK_TOOLBAR (RIGHT_TOOLBAR);
|
|
961
|
|
962 return Qnil;
|
|
963 }
|
|
964 #undef CHECK_TOOLBAR
|
|
965
|
|
966 /* The device dependent code actually does the work of positioning the
|
|
967 buttons, but we are free to access that information at this
|
|
968 level. */
|
|
969 Lisp_Object
|
|
970 toolbar_button_at_pixpos (struct frame *f, int x_coord, int y_coord)
|
|
971 {
|
|
972 Lisp_Object buttons = toolbar_buttons_at_pixpos (f, x_coord, y_coord);
|
|
973
|
|
974 while (!NILP (buttons))
|
|
975 {
|
|
976 struct toolbar_button *tb = XTOOLBAR_BUTTON (buttons);
|
|
977
|
|
978 if ((x_coord >= tb->x) && (x_coord < (tb->x + tb->width)))
|
|
979 {
|
|
980 if ((y_coord >= tb->y) && (y_coord < (tb->y + tb->height)))
|
|
981 {
|
|
982 /* If we are over a blank, return nil. */
|
|
983 if (tb->blank)
|
|
984 return Qnil;
|
|
985 else
|
|
986 return buttons;
|
|
987 }
|
|
988 }
|
|
989
|
|
990 buttons = tb->next;
|
|
991 }
|
|
992
|
|
993 /* We are not over a toolbar or we are over a blank in the toolbar. */
|
|
994 return Qnil;
|
|
995 }
|
|
996
|
|
997
|
|
998 /************************************************************************/
|
|
999 /* Toolbar specifier type */
|
|
1000 /************************************************************************/
|
|
1001
|
|
1002 DEFINE_SPECIFIER_TYPE (toolbar);
|
|
1003
|
563
|
1004 #define CTB_ERROR(msg) do { \
|
|
1005 maybe_signal_error (Qinvalid_argument, msg, button, Qtoolbar, errb); \
|
|
1006 RETURN_SANS_WARNINGS Qnil; \
|
428
|
1007 } while (0)
|
|
1008
|
|
1009 /* Returns Q_style if key was :style, Qt if ok otherwise, Qnil if error. */
|
|
1010 static Lisp_Object
|
|
1011 check_toolbar_button_keywords (Lisp_Object button, Lisp_Object key,
|
578
|
1012 Lisp_Object val, Error_Behavior errb)
|
428
|
1013 {
|
|
1014 if (!KEYWORDP (key))
|
|
1015 {
|
563
|
1016 maybe_signal_error_2 (Qinvalid_argument, "Not a keyword", key, button,
|
|
1017 Qtoolbar, errb);
|
428
|
1018 return Qnil;
|
|
1019 }
|
|
1020
|
|
1021 if (EQ (key, Q_style))
|
|
1022 {
|
|
1023 if (!EQ (val, Q2D)
|
|
1024 && !EQ (val, Q3D)
|
|
1025 && !EQ (val, Q2d)
|
|
1026 && !EQ (val, Q3d))
|
|
1027 CTB_ERROR ("Unrecognized toolbar blank style");
|
|
1028
|
|
1029 return Q_style;
|
|
1030 }
|
|
1031 else if (EQ (key, Q_size))
|
|
1032 {
|
|
1033 if (!NATNUMP (val))
|
|
1034 CTB_ERROR ("invalid toolbar blank size");
|
|
1035 }
|
|
1036 else
|
|
1037 {
|
|
1038 CTB_ERROR ("invalid toolbar blank keyword");
|
|
1039 }
|
|
1040
|
|
1041 return Qt;
|
|
1042 }
|
|
1043
|
|
1044 /* toolbar button spec is [pixmap-pair function enabled-p help]
|
|
1045 or [:style 2d-or-3d :size width-or-height] */
|
|
1046
|
|
1047 DEFUN ("check-toolbar-button-syntax", Fcheck_toolbar_button_syntax, 1, 2, 0, /*
|
|
1048 Verify the syntax of entry BUTTON in a toolbar description list.
|
|
1049 If you want to verify the syntax of a toolbar description list as a
|
|
1050 whole, use `check-valid-instantiator' with a specifier type of 'toolbar.
|
|
1051 */
|
444
|
1052 (button, noerror))
|
428
|
1053 {
|
|
1054 Lisp_Object *elt, glyphs, value;
|
|
1055 int len;
|
578
|
1056 Error_Behavior errb = decode_error_behavior_flag (noerror);
|
428
|
1057
|
|
1058 if (!VECTORP (button))
|
|
1059 CTB_ERROR ("toolbar button descriptors must be vectors");
|
|
1060 elt = XVECTOR_DATA (button);
|
|
1061
|
|
1062 if (XVECTOR_LENGTH (button) == 2)
|
|
1063 {
|
|
1064 if (!EQ (Q_style, check_toolbar_button_keywords (button, elt[0],
|
|
1065 elt[1], errb)))
|
|
1066 CTB_ERROR ("must specify toolbar blank style");
|
|
1067
|
|
1068 return Qt;
|
|
1069 }
|
|
1070
|
|
1071 if (XVECTOR_LENGTH (button) != 4)
|
|
1072 CTB_ERROR ("toolbar button descriptors must be 2 or 4 long");
|
|
1073
|
|
1074 /* The first element must be a list of glyphs of length 1-6. The
|
|
1075 first entry is the pixmap for the up state, the second for the
|
|
1076 down state, the third for the disabled state, the fourth for the
|
|
1077 captioned up state, the fifth for the captioned down state and
|
|
1078 the sixth for the captioned disabled state. Only the up state is
|
|
1079 mandatory. */
|
|
1080 if (!CONSP (elt[0]))
|
|
1081 {
|
|
1082 /* We can't check the buffer-local here because we don't know
|
442
|
1083 which buffer to check in. #### I think this is a bad thing.
|
|
1084 See if we can't get enough information to this function so
|
|
1085 that it can check.
|
428
|
1086
|
|
1087 #### Wrong. We shouldn't be checking the value at all here.
|
|
1088 The user might set or change the value at any time. */
|
|
1089 value = Fsymbol_value (elt[0]);
|
|
1090
|
|
1091 if (!CONSP (value))
|
|
1092 {
|
|
1093 if (KEYWORDP (elt[0]))
|
|
1094 {
|
|
1095 int fsty = 0;
|
|
1096
|
|
1097 if (EQ (Q_style, check_toolbar_button_keywords (button, elt[0],
|
|
1098 elt[1],
|
|
1099 errb)))
|
|
1100 fsty++;
|
|
1101
|
|
1102 if (EQ (Q_style, check_toolbar_button_keywords (button, elt[2],
|
|
1103 elt[3],
|
|
1104 errb)))
|
|
1105 fsty++;
|
|
1106
|
|
1107 if (!fsty)
|
|
1108 CTB_ERROR ("must specify toolbar blank style");
|
|
1109 else if (EQ (elt[0], elt[2]))
|
|
1110 CTB_ERROR
|
|
1111 ("duplicate keywords in toolbar button blank description");
|
|
1112
|
|
1113 return Qt;
|
|
1114 }
|
|
1115 else
|
|
1116 CTB_ERROR ("first element of button must be a list (of glyphs)");
|
|
1117 }
|
|
1118 }
|
|
1119 else
|
|
1120 value = elt[0];
|
|
1121
|
|
1122 len = XINT (Flength (value));
|
|
1123 if (len < 1)
|
|
1124 CTB_ERROR ("toolbar button glyph list must have at least 1 entry");
|
|
1125
|
|
1126 if (len > 6)
|
|
1127 CTB_ERROR ("toolbar button glyph list can have at most 6 entries");
|
|
1128
|
|
1129 glyphs = value;
|
|
1130 while (!NILP (glyphs))
|
|
1131 {
|
|
1132 if (!GLYPHP (XCAR (glyphs)))
|
|
1133 {
|
|
1134 /* We allow nil for the down and disabled glyphs but not for
|
|
1135 the up glyph. */
|
|
1136 if (EQ (glyphs, value) || !NILP (XCAR (glyphs)))
|
|
1137 {
|
|
1138 CTB_ERROR
|
|
1139 ("all elements of toolbar button glyph list must be glyphs.");
|
|
1140 }
|
|
1141 }
|
|
1142 glyphs = XCDR (glyphs);
|
|
1143 }
|
|
1144
|
|
1145 /* The second element is the function to run when the button is
|
|
1146 activated. We do not do any checking on it because it is legal
|
|
1147 for the function to not be defined until after the toolbar is.
|
|
1148 It is the user's problem to get this right.
|
|
1149
|
|
1150 The third element is either a boolean indicating the enabled
|
|
1151 status or a function used to determine it. Again, it is the
|
|
1152 user's problem if this is wrong.
|
|
1153
|
|
1154 The fourth element, if not nil, must be a string which will be
|
|
1155 displayed as the help echo. */
|
|
1156
|
|
1157 /* #### This should be allowed to be a function returning a string
|
|
1158 as well as just a string. */
|
|
1159 if (!NILP (elt[3]) && !STRINGP (elt[3]))
|
|
1160 CTB_ERROR ("toolbar button help echo string must be a string");
|
|
1161
|
|
1162 return Qt;
|
|
1163 }
|
|
1164 #undef CTB_ERROR
|
|
1165
|
|
1166 static void
|
|
1167 toolbar_validate (Lisp_Object instantiator)
|
|
1168 {
|
|
1169 int pushright_seen = 0;
|
|
1170 Lisp_Object rest;
|
|
1171
|
|
1172 if (NILP (instantiator))
|
|
1173 return;
|
|
1174
|
|
1175 if (!CONSP (instantiator))
|
563
|
1176 sferror ("Toolbar spec must be list or nil", instantiator);
|
428
|
1177
|
|
1178 for (rest = instantiator; !NILP (rest); rest = XCDR (rest))
|
|
1179 {
|
|
1180 if (!CONSP (rest))
|
563
|
1181 sferror ("Bad list in toolbar spec", instantiator);
|
428
|
1182
|
|
1183 if (NILP (XCAR (rest)))
|
|
1184 {
|
|
1185 if (pushright_seen)
|
563
|
1186 sferror
|
|
1187 ("More than one partition (nil) in instantiator description",
|
|
1188 instantiator);
|
428
|
1189 else
|
|
1190 pushright_seen = 1;
|
|
1191 }
|
|
1192 else
|
|
1193 Fcheck_toolbar_button_syntax (XCAR (rest), Qnil);
|
|
1194 }
|
|
1195 }
|
|
1196
|
|
1197 static void
|
2286
|
1198 toolbar_after_change (Lisp_Object UNUSED (specifier),
|
|
1199 Lisp_Object UNUSED (locale))
|
428
|
1200 {
|
|
1201 /* #### This is overkill. I really need to rethink the after-change
|
|
1202 functions to make them easier to use. */
|
|
1203 MARK_TOOLBAR_CHANGED;
|
|
1204 }
|
|
1205
|
|
1206 DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1, 1, 0, /*
|
|
1207 Return non-nil if OBJECT is a toolbar specifier.
|
|
1208
|
442
|
1209 See `make-toolbar-specifier' for a description of possible toolbar
|
|
1210 instantiators.
|
428
|
1211 */
|
|
1212 (object))
|
|
1213 {
|
|
1214 return TOOLBAR_SPECIFIERP (object) ? Qt : Qnil;
|
|
1215 }
|
|
1216
|
|
1217
|
|
1218 /*
|
|
1219 Helper for invalidating the real specifier when default
|
|
1220 specifier caching changes
|
|
1221 */
|
|
1222 static void
|
|
1223 recompute_overlaying_specifier (Lisp_Object real_one[4])
|
|
1224 {
|
|
1225 enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
|
|
1226 Fset_specifier_dirty_flag (real_one[pos]);
|
|
1227 }
|
|
1228
|
|
1229 static void
|
2286
|
1230 toolbar_specs_changed (Lisp_Object UNUSED (specifier),
|
|
1231 struct window *UNUSED (w),
|
|
1232 Lisp_Object UNUSED (oldval))
|
428
|
1233 {
|
|
1234 /* This could be smarter but I doubt that it would make any
|
|
1235 noticeable difference given the infrequency with which this is
|
|
1236 probably going to be called.
|
|
1237 */
|
|
1238 MARK_TOOLBAR_CHANGED;
|
|
1239 }
|
|
1240
|
|
1241 static void
|
2286
|
1242 default_toolbar_specs_changed (Lisp_Object UNUSED (specifier),
|
|
1243 struct window *UNUSED (w),
|
|
1244 Lisp_Object UNUSED (oldval))
|
428
|
1245 {
|
|
1246 recompute_overlaying_specifier (Vtoolbar);
|
|
1247 }
|
|
1248
|
|
1249 static void
|
2286
|
1250 default_toolbar_size_changed_in_frame (Lisp_Object UNUSED (specifier),
|
|
1251 struct frame *UNUSED (f),
|
|
1252 Lisp_Object UNUSED (oldval))
|
428
|
1253 {
|
|
1254 recompute_overlaying_specifier (Vtoolbar_size);
|
|
1255 }
|
|
1256
|
|
1257 static void
|
2286
|
1258 default_toolbar_border_width_changed_in_frame (Lisp_Object UNUSED (specifier),
|
|
1259 struct frame *UNUSED (f),
|
|
1260 Lisp_Object UNUSED (oldval))
|
428
|
1261 {
|
|
1262 recompute_overlaying_specifier (Vtoolbar_border_width);
|
|
1263 }
|
|
1264
|
|
1265 static void
|
2286
|
1266 default_toolbar_visible_p_changed_in_frame (Lisp_Object UNUSED (specifier),
|
|
1267 struct frame *UNUSED (f),
|
|
1268 Lisp_Object UNUSED (oldval))
|
428
|
1269 {
|
|
1270 recompute_overlaying_specifier (Vtoolbar_visible_p);
|
|
1271 }
|
|
1272
|
|
1273 static void
|
2286
|
1274 toolbar_geometry_changed_in_window (Lisp_Object UNUSED (specifier),
|
|
1275 struct window *w,
|
|
1276 Lisp_Object UNUSED (oldval))
|
428
|
1277 {
|
|
1278 MARK_TOOLBAR_CHANGED;
|
|
1279 MARK_WINDOWS_CHANGED (w);
|
|
1280 }
|
|
1281
|
|
1282 static void
|
2286
|
1283 default_toolbar_size_changed_in_window (Lisp_Object UNUSED (specifier),
|
|
1284 struct window *UNUSED (w),
|
|
1285 Lisp_Object UNUSED (oldval))
|
428
|
1286 {
|
|
1287 recompute_overlaying_specifier (Vtoolbar_size);
|
|
1288 }
|
|
1289
|
|
1290 static void
|
2286
|
1291 default_toolbar_border_width_changed_in_window (Lisp_Object UNUSED (specifier),
|
|
1292 struct window *UNUSED (w),
|
|
1293 Lisp_Object UNUSED (oldval))
|
428
|
1294 {
|
|
1295 recompute_overlaying_specifier (Vtoolbar_border_width);
|
|
1296 }
|
|
1297
|
|
1298 static void
|
2286
|
1299 default_toolbar_visible_p_changed_in_window (Lisp_Object UNUSED (specifier),
|
|
1300 struct window *UNUSED (w),
|
|
1301 Lisp_Object UNUSED (oldval))
|
428
|
1302 {
|
|
1303 recompute_overlaying_specifier (Vtoolbar_visible_p);
|
|
1304 }
|
|
1305
|
|
1306 static void
|
2286
|
1307 toolbar_buttons_captioned_p_changed (Lisp_Object UNUSED (specifier),
|
|
1308 struct window *UNUSED (w),
|
|
1309 Lisp_Object UNUSED (oldval))
|
428
|
1310 {
|
|
1311 /* This could be smarter but I doubt that it would make any
|
|
1312 noticeable difference given the infrequency with which this is
|
|
1313 probably going to be called. */
|
|
1314 MARK_TOOLBAR_CHANGED;
|
|
1315 }
|
|
1316
|
744
|
1317 static void
|
2286
|
1318 toolbar_shadows_changed (Lisp_Object UNUSED (specifier),
|
|
1319 struct window *w,
|
|
1320 Lisp_Object UNUSED (oldval))
|
744
|
1321 {
|
|
1322 struct frame *f = XFRAME (w->frame);
|
|
1323
|
|
1324 if (!f->frame_data)
|
|
1325 {
|
|
1326 /* If there is not frame data yet, we need to get the hell out
|
|
1327 ** of here. This can happen when the initial frame is being
|
|
1328 ** created and we set our specifiers internally.
|
|
1329 */
|
|
1330 return;
|
|
1331 }
|
|
1332 MAYBE_DEVMETH (XDEVICE (f->device), redraw_frame_toolbars, (f));
|
|
1333 }
|
|
1334
|
428
|
1335
|
|
1336 void
|
|
1337 syms_of_toolbar (void)
|
|
1338 {
|
442
|
1339 INIT_LRECORD_IMPLEMENTATION (toolbar_button);
|
|
1340
|
563
|
1341 DEFSYMBOL_MULTIWORD_PREDICATE (Qtoolbar_buttonp);
|
|
1342 DEFSYMBOL (Q2D);
|
|
1343 DEFSYMBOL (Q3D);
|
|
1344 DEFSYMBOL (Q2d);
|
|
1345 DEFSYMBOL (Q3d);
|
|
1346 DEFKEYWORD (Q_size);
|
428
|
1347
|
563
|
1348 DEFSYMBOL (Qinit_toolbar_from_resources);
|
428
|
1349 DEFSUBR (Ftoolbar_button_p);
|
|
1350 DEFSUBR (Ftoolbar_button_callback);
|
|
1351 DEFSUBR (Ftoolbar_button_help_string);
|
|
1352 DEFSUBR (Ftoolbar_button_enabled_p);
|
|
1353 DEFSUBR (Fset_toolbar_button_down_flag);
|
|
1354 DEFSUBR (Fcheck_toolbar_button_syntax);
|
|
1355 DEFSUBR (Fset_default_toolbar_position);
|
|
1356 DEFSUBR (Fdefault_toolbar_position);
|
|
1357 DEFSUBR (Ftoolbar_specifier_p);
|
|
1358 }
|
|
1359
|
|
1360 void
|
|
1361 vars_of_toolbar (void)
|
|
1362 {
|
|
1363 staticpro (&Vdefault_toolbar_position);
|
|
1364 Vdefault_toolbar_position = Qtop;
|
|
1365
|
|
1366 #ifdef HAVE_WINDOW_SYSTEM
|
|
1367 Fprovide (Qtoolbar);
|
|
1368 #endif
|
|
1369 }
|
|
1370
|
|
1371 void
|
|
1372 specifier_type_create_toolbar (void)
|
|
1373 {
|
|
1374 INITIALIZE_SPECIFIER_TYPE (toolbar, "toolbar", "toolbar-specifier-p");
|
|
1375
|
|
1376 SPECIFIER_HAS_METHOD (toolbar, validate);
|
|
1377 SPECIFIER_HAS_METHOD (toolbar, after_change);
|
|
1378 }
|
|
1379
|
|
1380 void
|
|
1381 reinit_specifier_type_create_toolbar (void)
|
|
1382 {
|
|
1383 REINITIALIZE_SPECIFIER_TYPE (toolbar);
|
|
1384 }
|
|
1385
|
|
1386 void
|
|
1387 specifier_vars_of_toolbar (void)
|
|
1388 {
|
|
1389 Lisp_Object fb;
|
|
1390
|
|
1391 DEFVAR_SPECIFIER ("default-toolbar", &Vdefault_toolbar /*
|
|
1392 Specifier for a fallback toolbar.
|
|
1393 Use `set-specifier' to change this.
|
|
1394
|
|
1395 The position of this toolbar is specified in the function
|
|
1396 `default-toolbar-position'. If the corresponding position-specific
|
|
1397 toolbar (e.g. `top-toolbar' if `default-toolbar-position' is 'top)
|
|
1398 does not specify a toolbar in a particular domain (usually a window),
|
|
1399 then the value of `default-toolbar' in that domain, if any, will be
|
|
1400 used instead.
|
|
1401
|
|
1402 Note that the toolbar at any particular position will not be
|
|
1403 displayed unless its visibility flag is true and its thickness
|
|
1404 \(width or height, depending on orientation) is non-zero. The
|
|
1405 visibility is controlled by the specifiers `top-toolbar-visible-p',
|
|
1406 `bottom-toolbar-visible-p', `left-toolbar-visible-p', and
|
|
1407 `right-toolbar-visible-p', and the thickness is controlled by the
|
|
1408 specifiers `top-toolbar-height', `bottom-toolbar-height',
|
|
1409 `left-toolbar-width', and `right-toolbar-width'.
|
|
1410
|
|
1411 Note that one of the four visibility specifiers inherits from
|
|
1412 `default-toolbar-visibility' and one of the four thickness
|
|
1413 specifiers inherits from either `default-toolbar-width' or
|
|
1414 `default-toolbar-height' (depending on orientation), just
|
|
1415 like for the toolbar description specifiers (e.g. `top-toolbar')
|
|
1416 mentioned above.
|
|
1417
|
|
1418 Therefore, if you are setting `default-toolbar', you should control
|
|
1419 the visibility and thickness using `default-toolbar-visible-p',
|
|
1420 `default-toolbar-width', and `default-toolbar-height', rather than
|
|
1421 using position-specific specifiers. That way, you will get sane
|
|
1422 behavior if the user changes the default toolbar position.
|
|
1423
|
|
1424 The format of the instantiator for a toolbar is a list of
|
|
1425 toolbar-button-descriptors. Each toolbar-button-descriptor
|
|
1426 is a vector in one of the following formats:
|
|
1427
|
|
1428 [GLYPH-LIST FUNCTION ENABLED-P HELP] or
|
|
1429 [:style 2D-OR-3D] or
|
|
1430 [:style 2D-OR-3D :size WIDTH-OR-HEIGHT] or
|
|
1431 [:size WIDTH-OR-HEIGHT :style 2D-OR-3D]
|
|
1432
|
|
1433 Optionally, one of the toolbar-button-descriptors may be nil
|
|
1434 instead of a vector; this signifies the division between
|
|
1435 the toolbar buttons that are to be displayed flush-left,
|
|
1436 and the buttons to be displayed flush-right.
|
|
1437
|
|
1438 The first vector format above specifies a normal toolbar button;
|
|
1439 the others specify blank areas in the toolbar.
|
|
1440
|
|
1441 For the first vector format:
|
|
1442
|
|
1443 -- GLYPH-LIST should be a list of one to six glyphs (as created by
|
|
1444 `make-glyph') or a symbol whose value is such a list. The first
|
|
1445 glyph, which must be provided, is the glyph used to display the
|
|
1446 toolbar button when it is in the "up" (not pressed) state. The
|
|
1447 optional second glyph is for displaying the button when it is in
|
|
1448 the "down" (pressed) state. The optional third glyph is for when
|
|
1449 the button is disabled. The optional fourth, fifth and sixth glyphs
|
|
1450 are used to specify captioned versions for the up, down and disabled
|
|
1451 states respectively. The function `toolbar-make-button-list' is
|
|
1452 useful in creating these glyph lists. The specifier variable
|
|
1453 `toolbar-buttons-captioned-p' controls which glyphs are actually used.
|
|
1454
|
|
1455 -- Even if you do not provide separate down-state and disabled-state
|
|
1456 glyphs, the user will still get visual feedback to indicate which
|
|
1457 state the button is in. Buttons in the up-state are displayed
|
|
1458 with a shadowed border that gives a raised appearance to the
|
|
1459 button. Buttons in the down-state are displayed with shadows that
|
|
1460 give a recessed appearance. Buttons in the disabled state are
|
|
1461 displayed with no shadows, giving a 2-d effect.
|
|
1462
|
|
1463 -- If some of the toolbar glyphs are not provided, they inherit as follows:
|
|
1464
|
|
1465 UP: up
|
|
1466 DOWN: down -> up
|
|
1467 DISABLED: disabled -> up
|
|
1468 CAP-UP: cap-up -> up
|
|
1469 CAP-DOWN: cap-down -> cap-up -> down -> up
|
|
1470 CAP-DISABLED: cap-disabled -> cap-up -> disabled -> up
|
|
1471
|
|
1472 -- The second element FUNCTION is a function to be called when the
|
|
1473 toolbar button is activated (i.e. when the mouse is released over
|
|
1474 the toolbar button, if the press occurred in the toolbar). It
|
|
1475 can be any form accepted by `call-interactively', since this is
|
|
1476 how it is invoked.
|
|
1477
|
|
1478 -- The third element ENABLED-P specifies whether the toolbar button
|
|
1479 is enabled (disabled buttons do nothing when they are activated,
|
|
1480 and are displayed differently; see above). It should be either
|
|
1481 a boolean or a form that evaluates to a boolean.
|
|
1482
|
|
1483 -- The fourth element HELP, if non-nil, should be a string. This
|
|
1484 string is displayed in the echo area when the mouse passes over
|
|
1485 the toolbar button.
|
|
1486
|
|
1487 For the other vector formats (specifying blank areas of the toolbar):
|
|
1488
|
|
1489 -- 2D-OR-3D should be one of the symbols '2d or '3d, indicating
|
|
1490 whether the area is displayed with shadows (giving it a raised,
|
|
1491 3-d appearance) or without shadows (giving it a flat appearance).
|
|
1492
|
|
1493 -- WIDTH-OR-HEIGHT specifies the length, in pixels, of the blank
|
|
1494 area. If omitted, it defaults to a device-specific value
|
|
1495 (8 pixels for X devices).
|
|
1496 */ );
|
|
1497
|
|
1498 Vdefault_toolbar = Fmake_specifier (Qtoolbar);
|
|
1499 /* #### It would be even nicer if the specifier caching
|
|
1500 automatically knew about specifier fallbacks, so we didn't
|
|
1501 have to do it ourselves. */
|
|
1502 set_specifier_caching (Vdefault_toolbar,
|
438
|
1503 offsetof (struct window, default_toolbar),
|
428
|
1504 default_toolbar_specs_changed,
|
444
|
1505 0, 0, 0);
|
428
|
1506
|
|
1507 DEFVAR_SPECIFIER ("top-toolbar",
|
|
1508 &Vtoolbar[TOP_TOOLBAR] /*
|
|
1509 Specifier for the toolbar at the top of the frame.
|
|
1510 Use `set-specifier' to change this.
|
|
1511 See `default-toolbar' for a description of a valid toolbar instantiator.
|
|
1512 */ );
|
|
1513 Vtoolbar[TOP_TOOLBAR] = Fmake_specifier (Qtoolbar);
|
|
1514 set_specifier_caching (Vtoolbar[TOP_TOOLBAR],
|
438
|
1515 offsetof (struct window, toolbar[TOP_TOOLBAR]),
|
428
|
1516 toolbar_specs_changed,
|
444
|
1517 0, 0, 0);
|
428
|
1518
|
|
1519 DEFVAR_SPECIFIER ("bottom-toolbar",
|
|
1520 &Vtoolbar[BOTTOM_TOOLBAR] /*
|
|
1521 Specifier for the toolbar at the bottom of the frame.
|
|
1522 Use `set-specifier' to change this.
|
|
1523 See `default-toolbar' for a description of a valid toolbar instantiator.
|
|
1524
|
|
1525 Note that, unless the `default-toolbar-position' is `bottom', by
|
|
1526 default the height of the bottom toolbar (controlled by
|
|
1527 `bottom-toolbar-height') is 0; thus, a bottom toolbar will not be
|
|
1528 displayed even if you provide a value for `bottom-toolbar'.
|
|
1529 */ );
|
|
1530 Vtoolbar[BOTTOM_TOOLBAR] = Fmake_specifier (Qtoolbar);
|
|
1531 set_specifier_caching (Vtoolbar[BOTTOM_TOOLBAR],
|
438
|
1532 offsetof (struct window, toolbar[BOTTOM_TOOLBAR]),
|
428
|
1533 toolbar_specs_changed,
|
444
|
1534 0, 0, 0);
|
428
|
1535
|
|
1536 DEFVAR_SPECIFIER ("left-toolbar",
|
|
1537 &Vtoolbar[LEFT_TOOLBAR] /*
|
|
1538 Specifier for the toolbar at the left edge of the frame.
|
|
1539 Use `set-specifier' to change this.
|
|
1540 See `default-toolbar' for a description of a valid toolbar instantiator.
|
|
1541
|
|
1542 Note that, unless the `default-toolbar-position' is `left', by
|
|
1543 default the height of the left toolbar (controlled by
|
|
1544 `left-toolbar-width') is 0; thus, a left toolbar will not be
|
|
1545 displayed even if you provide a value for `left-toolbar'.
|
|
1546 */ );
|
|
1547 Vtoolbar[LEFT_TOOLBAR] = Fmake_specifier (Qtoolbar);
|
|
1548 set_specifier_caching (Vtoolbar[LEFT_TOOLBAR],
|
438
|
1549 offsetof (struct window, toolbar[LEFT_TOOLBAR]),
|
428
|
1550 toolbar_specs_changed,
|
444
|
1551 0, 0, 0);
|
428
|
1552
|
|
1553 DEFVAR_SPECIFIER ("right-toolbar",
|
|
1554 &Vtoolbar[RIGHT_TOOLBAR] /*
|
|
1555 Specifier for the toolbar at the right edge of the frame.
|
|
1556 Use `set-specifier' to change this.
|
|
1557 See `default-toolbar' for a description of a valid toolbar instantiator.
|
|
1558
|
|
1559 Note that, unless the `default-toolbar-position' is `right', by
|
|
1560 default the height of the right toolbar (controlled by
|
|
1561 `right-toolbar-width') is 0; thus, a right toolbar will not be
|
|
1562 displayed even if you provide a value for `right-toolbar'.
|
|
1563 */ );
|
|
1564 Vtoolbar[RIGHT_TOOLBAR] = Fmake_specifier (Qtoolbar);
|
|
1565 set_specifier_caching (Vtoolbar[RIGHT_TOOLBAR],
|
438
|
1566 offsetof (struct window, toolbar[RIGHT_TOOLBAR]),
|
428
|
1567 toolbar_specs_changed,
|
444
|
1568 0, 0, 0);
|
428
|
1569
|
|
1570 /* initially, top inherits from default; this can be
|
|
1571 changed with `set-default-toolbar-position'. */
|
|
1572 fb = list1 (Fcons (Qnil, Qnil));
|
|
1573 set_specifier_fallback (Vdefault_toolbar, fb);
|
|
1574 set_specifier_fallback (Vtoolbar[TOP_TOOLBAR], Vdefault_toolbar);
|
|
1575 set_specifier_fallback (Vtoolbar[BOTTOM_TOOLBAR], fb);
|
|
1576 set_specifier_fallback (Vtoolbar[LEFT_TOOLBAR], fb);
|
|
1577 set_specifier_fallback (Vtoolbar[RIGHT_TOOLBAR], fb);
|
|
1578
|
|
1579 DEFVAR_SPECIFIER ("default-toolbar-height", &Vdefault_toolbar_height /*
|
|
1580 *Height of the default toolbar, if it's oriented horizontally.
|
|
1581 This is a specifier; use `set-specifier' to change it.
|
|
1582
|
|
1583 The position of the default toolbar is specified by the function
|
|
1584 `set-default-toolbar-position'. If the corresponding position-specific
|
|
1585 toolbar thickness specifier (e.g. `top-toolbar-height' if
|
|
1586 `default-toolbar-position' is 'top) does not specify a thickness in a
|
|
1587 particular domain (a window or a frame), then the value of
|
|
1588 `default-toolbar-height' or `default-toolbar-width' (depending on the
|
|
1589 toolbar orientation) in that domain, if any, will be used instead.
|
|
1590
|
|
1591 Note that `default-toolbar-height' is only used when
|
|
1592 `default-toolbar-position' is 'top or 'bottom, and `default-toolbar-width'
|
|
1593 is only used when `default-toolbar-position' is 'left or 'right.
|
|
1594
|
|
1595 Note that all of the position-specific toolbar thickness specifiers
|
|
1596 have a fallback value of zero when they do not correspond to the
|
|
1597 default toolbar. Therefore, you will have to set a non-zero thickness
|
|
1598 value if you want a position-specific toolbar to be displayed.
|
|
1599
|
|
1600 Internally, toolbar thickness specifiers are instantiated in both
|
|
1601 window and frame domains, for different purposes. The value in the
|
|
1602 domain of a frame's selected window specifies the actual toolbar
|
|
1603 thickness that you will see in that frame. The value in the domain of
|
|
1604 a frame itself specifies the toolbar thickness that is used in frame
|
|
1605 geometry calculations.
|
|
1606
|
|
1607 Thus, for example, if you set the frame width to 80 characters and the
|
|
1608 left toolbar width for that frame to 68 pixels, then the frame will
|
|
1609 be sized to fit 80 characters plus a 68-pixel left toolbar. If you
|
|
1610 then set the left toolbar width to 0 for a particular buffer (or if
|
|
1611 that buffer does not specify a left toolbar or has a nil value
|
|
1612 specified for `left-toolbar-visible-p'), you will find that, when
|
|
1613 that buffer is displayed in the selected window, the window will have
|
|
1614 a width of 86 or 87 characters -- the frame is sized for a 68-pixel
|
|
1615 left toolbar but the selected window specifies that the left toolbar
|
|
1616 is not visible, so it is expanded to take up the slack.
|
|
1617 */ );
|
|
1618 Vdefault_toolbar_height = Fmake_specifier (Qnatnum);
|
|
1619 set_specifier_caching (Vdefault_toolbar_height,
|
438
|
1620 offsetof (struct window, default_toolbar_height),
|
428
|
1621 default_toolbar_size_changed_in_window,
|
438
|
1622 offsetof (struct frame, default_toolbar_height),
|
444
|
1623 default_toolbar_size_changed_in_frame, 0);
|
428
|
1624
|
|
1625 DEFVAR_SPECIFIER ("default-toolbar-width", &Vdefault_toolbar_width /*
|
|
1626 *Width of the default toolbar, if it's oriented vertically.
|
|
1627 This is a specifier; use `set-specifier' to change it.
|
|
1628
|
|
1629 See `default-toolbar-height' for more information.
|
|
1630 */ );
|
|
1631 Vdefault_toolbar_width = Fmake_specifier (Qnatnum);
|
|
1632 set_specifier_caching (Vdefault_toolbar_width,
|
438
|
1633 offsetof (struct window, default_toolbar_width),
|
428
|
1634 default_toolbar_size_changed_in_window,
|
438
|
1635 offsetof (struct frame, default_toolbar_width),
|
444
|
1636 default_toolbar_size_changed_in_frame, 0);
|
428
|
1637
|
|
1638 DEFVAR_SPECIFIER ("top-toolbar-height",
|
|
1639 &Vtoolbar_size[TOP_TOOLBAR] /*
|
|
1640 *Height of the top toolbar.
|
|
1641 This is a specifier; use `set-specifier' to change it.
|
|
1642
|
|
1643 See `default-toolbar-height' for more information.
|
|
1644 */ );
|
|
1645 Vtoolbar_size[TOP_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1646 set_specifier_caching (Vtoolbar_size[TOP_TOOLBAR],
|
438
|
1647 offsetof (struct window, toolbar_size[TOP_TOOLBAR]),
|
428
|
1648 toolbar_geometry_changed_in_window,
|
438
|
1649 offsetof (struct frame, toolbar_size[TOP_TOOLBAR]),
|
444
|
1650 frame_size_slipped, 0);
|
428
|
1651
|
|
1652 DEFVAR_SPECIFIER ("bottom-toolbar-height",
|
|
1653 &Vtoolbar_size[BOTTOM_TOOLBAR] /*
|
|
1654 *Height of the bottom toolbar.
|
|
1655 This is a specifier; use `set-specifier' to change it.
|
|
1656
|
|
1657 See `default-toolbar-height' for more information.
|
|
1658 */ );
|
|
1659 Vtoolbar_size[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1660 set_specifier_caching (Vtoolbar_size[BOTTOM_TOOLBAR],
|
438
|
1661 offsetof (struct window, toolbar_size[BOTTOM_TOOLBAR]),
|
428
|
1662 toolbar_geometry_changed_in_window,
|
438
|
1663 offsetof (struct frame, toolbar_size[BOTTOM_TOOLBAR]),
|
444
|
1664 frame_size_slipped, 0);
|
428
|
1665
|
|
1666 DEFVAR_SPECIFIER ("left-toolbar-width",
|
|
1667 &Vtoolbar_size[LEFT_TOOLBAR] /*
|
|
1668 *Width of left toolbar.
|
|
1669 This is a specifier; use `set-specifier' to change it.
|
|
1670
|
|
1671 See `default-toolbar-height' for more information.
|
|
1672 */ );
|
|
1673 Vtoolbar_size[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1674 set_specifier_caching (Vtoolbar_size[LEFT_TOOLBAR],
|
438
|
1675 offsetof (struct window, toolbar_size[LEFT_TOOLBAR]),
|
428
|
1676 toolbar_geometry_changed_in_window,
|
438
|
1677 offsetof (struct frame, toolbar_size[LEFT_TOOLBAR]),
|
444
|
1678 frame_size_slipped, 0);
|
428
|
1679
|
|
1680 DEFVAR_SPECIFIER ("right-toolbar-width",
|
|
1681 &Vtoolbar_size[RIGHT_TOOLBAR] /*
|
|
1682 *Width of right toolbar.
|
|
1683 This is a specifier; use `set-specifier' to change it.
|
|
1684
|
|
1685 See `default-toolbar-height' for more information.
|
|
1686 */ );
|
|
1687 Vtoolbar_size[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1688 set_specifier_caching (Vtoolbar_size[RIGHT_TOOLBAR],
|
438
|
1689 offsetof (struct window, toolbar_size[RIGHT_TOOLBAR]),
|
428
|
1690 toolbar_geometry_changed_in_window,
|
438
|
1691 offsetof (struct frame, toolbar_size[RIGHT_TOOLBAR]),
|
444
|
1692 frame_size_slipped, 0);
|
428
|
1693
|
744
|
1694 DEFVAR_SPECIFIER ("toolbar-shadow-thickness",
|
|
1695 &Vtoolbar_shadow_thickness /*
|
|
1696 *Width of shadows around toolbar buttons.
|
|
1697 This is a specifier; use `set-specifier' to change it.
|
|
1698 */ );
|
|
1699 Vtoolbar_shadow_thickness = Fmake_specifier (Qnatnum);
|
|
1700 set_specifier_caching(Vtoolbar_shadow_thickness,
|
|
1701 offsetof (struct window, toolbar_shadow_thickness),
|
|
1702 toolbar_shadows_changed,
|
|
1703 0,0, 0);
|
|
1704
|
|
1705 fb = Qnil;
|
|
1706
|
|
1707 #ifdef HAVE_TTY
|
|
1708 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1709 #endif
|
|
1710 #ifdef HAVE_GTK
|
|
1711 fb = Fcons (Fcons (list1 (Qgtk), make_int (2)), fb);
|
|
1712 #endif
|
|
1713 #ifdef HAVE_X_WINDOWS
|
|
1714 fb = Fcons (Fcons (list1 (Qx), make_int (2)), fb);
|
|
1715 #endif
|
|
1716 #ifdef HAVE_MS_WINDOWS
|
|
1717 fb = Fcons (Fcons (list1 (Qmswindows), make_int (2)), fb);
|
|
1718 #endif
|
|
1719
|
|
1720 if (!NILP (fb))
|
|
1721 set_specifier_fallback (Vtoolbar_shadow_thickness, fb);
|
|
1722
|
428
|
1723 fb = Qnil;
|
|
1724 #ifdef HAVE_TTY
|
|
1725 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1726 #endif
|
462
|
1727 #ifdef HAVE_GTK
|
|
1728 fb = Fcons (Fcons (list1 (Qgtk), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb);
|
|
1729 #endif
|
428
|
1730 #ifdef HAVE_X_WINDOWS
|
|
1731 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb);
|
|
1732 #endif
|
|
1733 #ifdef HAVE_MS_WINDOWS
|
442
|
1734 fb = Fcons (Fcons (list1 (Qmswindows),
|
428
|
1735 make_int (MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT)), fb);
|
|
1736 #endif
|
|
1737 if (!NILP (fb))
|
|
1738 set_specifier_fallback (Vdefault_toolbar_height, fb);
|
|
1739
|
|
1740 fb = Qnil;
|
|
1741 #ifdef HAVE_TTY
|
|
1742 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1743 #endif
|
462
|
1744 #ifdef HAVE_GTK
|
|
1745 fb = Fcons (Fcons (list1 (Qgtk), make_int (DEFAULT_TOOLBAR_WIDTH)), fb);
|
|
1746 #endif
|
428
|
1747 #ifdef HAVE_X_WINDOWS
|
|
1748 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb);
|
|
1749 #endif
|
|
1750 #ifdef HAVE_MS_WINDOWS
|
442
|
1751 fb = Fcons (Fcons (list1 (Qmswindows),
|
428
|
1752 make_int (MSWINDOWS_DEFAULT_TOOLBAR_WIDTH)), fb);
|
|
1753 #endif
|
|
1754 if (!NILP (fb))
|
|
1755 set_specifier_fallback (Vdefault_toolbar_width, fb);
|
|
1756
|
|
1757 set_specifier_fallback (Vtoolbar_size[TOP_TOOLBAR], Vdefault_toolbar_height);
|
|
1758 fb = list1 (Fcons (Qnil, Qzero));
|
|
1759 set_specifier_fallback (Vtoolbar_size[BOTTOM_TOOLBAR], fb);
|
|
1760 set_specifier_fallback (Vtoolbar_size[LEFT_TOOLBAR], fb);
|
|
1761 set_specifier_fallback (Vtoolbar_size[RIGHT_TOOLBAR], fb);
|
|
1762
|
|
1763 DEFVAR_SPECIFIER ("default-toolbar-border-width",
|
|
1764 &Vdefault_toolbar_border_width /*
|
|
1765 *Width of the border around the default toolbar.
|
|
1766 This is a specifier; use `set-specifier' to change it.
|
|
1767
|
|
1768 The position of the default toolbar is specified by the function
|
|
1769 `set-default-toolbar-position'. If the corresponding position-specific
|
|
1770 toolbar border width specifier (e.g. `top-toolbar-border-width' if
|
|
1771 `default-toolbar-position' is 'top) does not specify a border width in a
|
|
1772 particular domain (a window or a frame), then the value of
|
|
1773 `default-toolbar-border-width' in that domain, if any, will be used
|
|
1774 instead.
|
|
1775
|
|
1776 Internally, toolbar border width specifiers are instantiated in both
|
|
1777 window and frame domains, for different purposes. The value in the
|
|
1778 domain of a frame's selected window specifies the actual toolbar border
|
|
1779 width that you will see in that frame. The value in the domain of a
|
|
1780 frame itself specifies the toolbar border width that is used in frame
|
|
1781 geometry calculations. Changing the border width value in the frame
|
|
1782 domain will result in a size change in the frame itself, while changing
|
|
1783 the value in a window domain will not.
|
|
1784 */ );
|
|
1785 Vdefault_toolbar_border_width = Fmake_specifier (Qnatnum);
|
|
1786 set_specifier_caching (Vdefault_toolbar_border_width,
|
438
|
1787 offsetof (struct window, default_toolbar_border_width),
|
428
|
1788 default_toolbar_border_width_changed_in_window,
|
438
|
1789 offsetof (struct frame, default_toolbar_border_width),
|
444
|
1790 default_toolbar_border_width_changed_in_frame, 0);
|
428
|
1791
|
|
1792 DEFVAR_SPECIFIER ("top-toolbar-border-width",
|
|
1793 &Vtoolbar_border_width[TOP_TOOLBAR] /*
|
|
1794 *Border width of the top toolbar.
|
|
1795 This is a specifier; use `set-specifier' to change it.
|
|
1796
|
|
1797 See `default-toolbar-height' for more information.
|
|
1798 */ );
|
|
1799 Vtoolbar_border_width[TOP_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1800 set_specifier_caching (Vtoolbar_border_width[TOP_TOOLBAR],
|
438
|
1801 offsetof (struct window,
|
|
1802 toolbar_border_width[TOP_TOOLBAR]),
|
428
|
1803 toolbar_geometry_changed_in_window,
|
438
|
1804 offsetof (struct frame,
|
|
1805 toolbar_border_width[TOP_TOOLBAR]),
|
444
|
1806 frame_size_slipped, 0);
|
428
|
1807
|
|
1808 DEFVAR_SPECIFIER ("bottom-toolbar-border-width",
|
|
1809 &Vtoolbar_border_width[BOTTOM_TOOLBAR] /*
|
|
1810 *Border width of the bottom toolbar.
|
|
1811 This is a specifier; use `set-specifier' to change it.
|
|
1812
|
|
1813 See `default-toolbar-height' for more information.
|
|
1814 */ );
|
|
1815 Vtoolbar_border_width[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1816 set_specifier_caching (Vtoolbar_border_width[BOTTOM_TOOLBAR],
|
438
|
1817 offsetof (struct window,
|
|
1818 toolbar_border_width[BOTTOM_TOOLBAR]),
|
428
|
1819 toolbar_geometry_changed_in_window,
|
438
|
1820 offsetof (struct frame,
|
|
1821 toolbar_border_width[BOTTOM_TOOLBAR]),
|
444
|
1822 frame_size_slipped, 0);
|
428
|
1823
|
|
1824 DEFVAR_SPECIFIER ("left-toolbar-border-width",
|
|
1825 &Vtoolbar_border_width[LEFT_TOOLBAR] /*
|
|
1826 *Border width of left toolbar.
|
|
1827 This is a specifier; use `set-specifier' to change it.
|
|
1828
|
|
1829 See `default-toolbar-height' for more information.
|
|
1830 */ );
|
|
1831 Vtoolbar_border_width[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1832 set_specifier_caching (Vtoolbar_border_width[LEFT_TOOLBAR],
|
438
|
1833 offsetof (struct window,
|
|
1834 toolbar_border_width[LEFT_TOOLBAR]),
|
428
|
1835 toolbar_geometry_changed_in_window,
|
438
|
1836 offsetof (struct frame,
|
|
1837 toolbar_border_width[LEFT_TOOLBAR]),
|
444
|
1838 frame_size_slipped, 0);
|
428
|
1839
|
|
1840 DEFVAR_SPECIFIER ("right-toolbar-border-width",
|
|
1841 &Vtoolbar_border_width[RIGHT_TOOLBAR] /*
|
|
1842 *Border width of right toolbar.
|
|
1843 This is a specifier; use `set-specifier' to change it.
|
|
1844
|
|
1845 See `default-toolbar-height' for more information.
|
|
1846 */ );
|
|
1847 Vtoolbar_border_width[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum);
|
|
1848 set_specifier_caching (Vtoolbar_border_width[RIGHT_TOOLBAR],
|
438
|
1849 offsetof (struct window,
|
|
1850 toolbar_border_width[RIGHT_TOOLBAR]),
|
428
|
1851 toolbar_geometry_changed_in_window,
|
438
|
1852 offsetof (struct frame,
|
|
1853 toolbar_border_width[RIGHT_TOOLBAR]),
|
444
|
1854 frame_size_slipped, 0);
|
428
|
1855
|
|
1856 fb = Qnil;
|
|
1857 #ifdef HAVE_TTY
|
|
1858 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1859 #endif
|
|
1860 #ifdef HAVE_X_WINDOWS
|
|
1861 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
|
|
1862 #endif
|
462
|
1863 #ifdef HAVE_GTK
|
|
1864 fb = Fcons (Fcons (list1 (Qgtk), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
|
|
1865 #endif
|
428
|
1866 #ifdef HAVE_MS_WINDOWS
|
|
1867 fb = Fcons (Fcons (list1 (Qmswindows), make_int (MSWINDOWS_DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
|
|
1868 #endif
|
|
1869 if (!NILP (fb))
|
|
1870 set_specifier_fallback (Vdefault_toolbar_border_width, fb);
|
|
1871
|
|
1872 set_specifier_fallback (Vtoolbar_border_width[TOP_TOOLBAR], Vdefault_toolbar_border_width);
|
|
1873 fb = list1 (Fcons (Qnil, Qzero));
|
|
1874 set_specifier_fallback (Vtoolbar_border_width[BOTTOM_TOOLBAR], fb);
|
|
1875 set_specifier_fallback (Vtoolbar_border_width[LEFT_TOOLBAR], fb);
|
|
1876 set_specifier_fallback (Vtoolbar_border_width[RIGHT_TOOLBAR], fb);
|
|
1877
|
|
1878 DEFVAR_SPECIFIER ("default-toolbar-visible-p", &Vdefault_toolbar_visible_p /*
|
|
1879 *Whether the default toolbar is visible.
|
|
1880 This is a specifier; use `set-specifier' to change it.
|
|
1881
|
|
1882 The position of the default toolbar is specified by the function
|
|
1883 `set-default-toolbar-position'. If the corresponding position-specific
|
|
1884 toolbar visibility specifier (e.g. `top-toolbar-visible-p' if
|
|
1885 `default-toolbar-position' is 'top) does not specify a visible-p value
|
|
1886 in a particular domain (a window or a frame), then the value of
|
|
1887 `default-toolbar-visible-p' in that domain, if any, will be used
|
|
1888 instead.
|
|
1889
|
|
1890 Both window domains and frame domains are used internally, for
|
|
1891 different purposes. The distinction here is exactly the same as
|
|
1892 for thickness specifiers; see `default-toolbar-height' for more
|
|
1893 information.
|
|
1894
|
|
1895 `default-toolbar-visible-p' and all of the position-specific toolbar
|
|
1896 visibility specifiers have a fallback value of true.
|
|
1897 */ );
|
|
1898 Vdefault_toolbar_visible_p = Fmake_specifier (Qboolean);
|
|
1899 set_specifier_caching (Vdefault_toolbar_visible_p,
|
438
|
1900 offsetof (struct window, default_toolbar_visible_p),
|
428
|
1901 default_toolbar_visible_p_changed_in_window,
|
438
|
1902 offsetof (struct frame, default_toolbar_visible_p),
|
444
|
1903 default_toolbar_visible_p_changed_in_frame, 0);
|
428
|
1904
|
|
1905 DEFVAR_SPECIFIER ("top-toolbar-visible-p",
|
|
1906 &Vtoolbar_visible_p[TOP_TOOLBAR] /*
|
|
1907 *Whether the top toolbar is visible.
|
|
1908 This is a specifier; use `set-specifier' to change it.
|
|
1909
|
|
1910 See `default-toolbar-visible-p' for more information.
|
|
1911 */ );
|
|
1912 Vtoolbar_visible_p[TOP_TOOLBAR] = Fmake_specifier (Qboolean);
|
|
1913 set_specifier_caching (Vtoolbar_visible_p[TOP_TOOLBAR],
|
438
|
1914 offsetof (struct window,
|
|
1915 toolbar_visible_p[TOP_TOOLBAR]),
|
428
|
1916 toolbar_geometry_changed_in_window,
|
438
|
1917 offsetof (struct frame,
|
|
1918 toolbar_visible_p[TOP_TOOLBAR]),
|
444
|
1919 frame_size_slipped, 0);
|
428
|
1920
|
|
1921 DEFVAR_SPECIFIER ("bottom-toolbar-visible-p",
|
|
1922 &Vtoolbar_visible_p[BOTTOM_TOOLBAR] /*
|
|
1923 *Whether the bottom toolbar is visible.
|
|
1924 This is a specifier; use `set-specifier' to change it.
|
|
1925
|
|
1926 See `default-toolbar-visible-p' for more information.
|
|
1927 */ );
|
|
1928 Vtoolbar_visible_p[BOTTOM_TOOLBAR] = Fmake_specifier (Qboolean);
|
|
1929 set_specifier_caching (Vtoolbar_visible_p[BOTTOM_TOOLBAR],
|
438
|
1930 offsetof (struct window,
|
|
1931 toolbar_visible_p[BOTTOM_TOOLBAR]),
|
428
|
1932 toolbar_geometry_changed_in_window,
|
438
|
1933 offsetof (struct frame,
|
|
1934 toolbar_visible_p[BOTTOM_TOOLBAR]),
|
444
|
1935 frame_size_slipped, 0);
|
428
|
1936
|
|
1937 DEFVAR_SPECIFIER ("left-toolbar-visible-p",
|
|
1938 &Vtoolbar_visible_p[LEFT_TOOLBAR] /*
|
|
1939 *Whether the left toolbar is visible.
|
|
1940 This is a specifier; use `set-specifier' to change it.
|
|
1941
|
|
1942 See `default-toolbar-visible-p' for more information.
|
|
1943 */ );
|
|
1944 Vtoolbar_visible_p[LEFT_TOOLBAR] = Fmake_specifier (Qboolean);
|
|
1945 set_specifier_caching (Vtoolbar_visible_p[LEFT_TOOLBAR],
|
438
|
1946 offsetof (struct window,
|
|
1947 toolbar_visible_p[LEFT_TOOLBAR]),
|
428
|
1948 toolbar_geometry_changed_in_window,
|
438
|
1949 offsetof (struct frame,
|
|
1950 toolbar_visible_p[LEFT_TOOLBAR]),
|
444
|
1951 frame_size_slipped, 0);
|
428
|
1952
|
|
1953 DEFVAR_SPECIFIER ("right-toolbar-visible-p",
|
|
1954 &Vtoolbar_visible_p[RIGHT_TOOLBAR] /*
|
|
1955 *Whether the right toolbar is visible.
|
|
1956 This is a specifier; use `set-specifier' to change it.
|
|
1957
|
|
1958 See `default-toolbar-visible-p' for more information.
|
|
1959 */ );
|
|
1960 Vtoolbar_visible_p[RIGHT_TOOLBAR] = Fmake_specifier (Qboolean);
|
|
1961 set_specifier_caching (Vtoolbar_visible_p[RIGHT_TOOLBAR],
|
438
|
1962 offsetof (struct window,
|
|
1963 toolbar_visible_p[RIGHT_TOOLBAR]),
|
428
|
1964 toolbar_geometry_changed_in_window,
|
438
|
1965 offsetof (struct frame,
|
|
1966 toolbar_visible_p[RIGHT_TOOLBAR]),
|
444
|
1967 frame_size_slipped, 0);
|
428
|
1968
|
|
1969 /* initially, top inherits from default; this can be
|
|
1970 changed with `set-default-toolbar-position'. */
|
|
1971 fb = list1 (Fcons (Qnil, Qt));
|
|
1972 set_specifier_fallback (Vdefault_toolbar_visible_p, fb);
|
|
1973 set_specifier_fallback (Vtoolbar_visible_p[TOP_TOOLBAR],
|
|
1974 Vdefault_toolbar_visible_p);
|
|
1975 set_specifier_fallback (Vtoolbar_visible_p[BOTTOM_TOOLBAR], fb);
|
|
1976 set_specifier_fallback (Vtoolbar_visible_p[LEFT_TOOLBAR], fb);
|
|
1977 set_specifier_fallback (Vtoolbar_visible_p[RIGHT_TOOLBAR], fb);
|
|
1978
|
|
1979 DEFVAR_SPECIFIER ("toolbar-buttons-captioned-p",
|
|
1980 &Vtoolbar_buttons_captioned_p /*
|
|
1981 *Whether the toolbar buttons are captioned.
|
|
1982 This will only have a visible effect for those toolbar buttons which had
|
|
1983 captioned versions specified.
|
|
1984 This is a specifier; use `set-specifier' to change it.
|
|
1985 */ );
|
|
1986 Vtoolbar_buttons_captioned_p = Fmake_specifier (Qboolean);
|
|
1987 set_specifier_caching (Vtoolbar_buttons_captioned_p,
|
438
|
1988 offsetof (struct window, toolbar_buttons_captioned_p),
|
428
|
1989 toolbar_buttons_captioned_p_changed,
|
444
|
1990 0, 0, 0);
|
428
|
1991 set_specifier_fallback (Vtoolbar_buttons_captioned_p,
|
|
1992 list1 (Fcons (Qnil, Qt)));
|
|
1993 }
|