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