annotate src/toolbar-common.c @ 930:eaedf30d9d76

[xemacs-hg @ 2002-07-23 08:34:59 by youngs] 2002-07-15 Jerry James <james@xemacs.org> * make-docfile.c: Change whitespace and organization to reduce the size of the diff against FSF Emacs sources and synch to Emacs 21.2. Remove unused DO_REALLOC. Mark XEmacs changes and additions more clearly. Reintroduce previously deleted Emacs code inside #if 0 ... #endif. * make-docfile.c (next_extra_elc): Replace goto with do-while. * make-docfile.c (main): Put XEmacs-only args in one place. * make-docfile.c (write_c_args): Change buff to buf to match Emacs. Replace pointer arithmetic with simpler array syntax. * make-docfile.c (scan_c_file): Note that DEFSIMPLE and DEFPRED no longer exist. Correct the "name too long" test (off by one). Die with message if a DEFUN has no docstring instead of hanging. * make-docfile.c (scan_lisp_file): Introduce while loops used in Emacs sources to skip consecutive blank lines. 2002-07-21 John Paul Wallington <jpw@xemacs.org> * process.el (substitute-env-vars): New function; sync with GNU Emacs 21.1.50. (setenv): Add optional arg SUBSTITUTE-ENV-VARS; sync with GNU Emacs 21.1.50. 2002-07-20 Mike Sperber <mike@xemacs.org> * eval.c (run_post_gc_hook): Use more correct flags when running post-gc-hook. 2002-07-20 Mike Sperber <mike@xemacs.org> * process-unix.c (child_setup): Don't try to close file descriptors for chid process once again---it's already being done in close_process_descs. (unix_create_process): Call begin_dont_check_for_quit to inhibit unwanted interaction (and thus breaking of X event synchronicity) in the child. 2002-07-15 Jerry James <james@xemacs.org> * lisp.h: Make Qdll_error visible globally. * symbols.c (check_sane_subr): Revert 2002-06-26 change. Check only if !initialized. * symbols.c (check_module_subr): Add parameter. Duplicate check_sane_subr checks, but signal an error instead of asserting. * symbols.c (defsubr): Use check_module_subr parameter. * symbols.c (defsubr_macro): Ditto.
author youngs
date Tue, 23 Jul 2002 08:35:11 +0000
parents c15f25529e61
children 51a17f29fab3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
1 /* toolbar implementation -- "Generic" (X or GTK) redisplay interface.
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
4 Copyright (C) 1995, 1996, 2002 Ben Wing.
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
5 Copyright (C) 1996 Chuck Thompson.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
6
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
7 This file is part of XEmacs.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
8
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
12 later version.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
13
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
17 for more details.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
18
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
23
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
25
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
26 #include <config.h>
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
27 #include "lisp.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
28
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
29 #include "device-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
30 #include "faces.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
31 #include "frame-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
32 #include "glyphs.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
33 #include "toolbar.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
34 #include "window.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
35
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
36 /* This is used when we need to draw the toolbars ourselves -- on X or GTK.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
37 On MS Windows, we use the built-in toolbar controls. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
38
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
39 /* Only a very few things need to differ based on the toolkit used.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
40 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
41 ** Some of the routines used assert(FRAME_yyy_P(f)) checks, this is
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
42 ** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK(). When we
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
43 ** add new window systems that use this code, we should either add a
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
44 ** new case here, or just remove the checks completely.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
45 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
46 ** At least for X & GTK redraw_frame_toolbars() might end up getting
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
47 ** called before we are completely initialized. To avoid this, we use
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
48 ** the __INTERNAL_MAPPED_P(f) macro, that should return 0 if we should
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
49 ** not draw the toolbars yet. When we add new window systems that use
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
50 ** this code, we should add a new case here, if they need it.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
51 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
52 ** When clearing the toolbar, it is nice to flush the drawing queue.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
53 ** Use __INTERNAL_FLUSH to do this. It is passed a device.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
54 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
55 #if defined(HAVE_GTK)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
56 #include "console-gtk-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
57 #define __INTERNAL_MAPPED_P(f) GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
58 #define __INTERNAL_FLUSH(d) gdk_flush()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
59 #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_GTK_P (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
60 #elif defined(HAVE_X_WINDOWS)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
61 #include "console-x-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
62 #define __INTERNAL_MAPPED_P(f) XtIsRealized (FRAME_X_SHELL_WIDGET (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
63 #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_X_P (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
64 #define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
65 #else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
66 #define __INTERNAL_MAPPED_P(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
67 #define __INTERNAL_APPROPRIATENESS_CHECK(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
68 #define __INTERNAL_FLUSH(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
69 #endif
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
70
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
71 #include "toolbar-common.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
72
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
73 extern Lisp_Object Vtoolbar_shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
74
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
75 static void __prepare_button_area (struct frame *f,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
76 struct toolbar_button *tb)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
77 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
78 int sx = tb->x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
79 int sy = tb->y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
80 int swidth = tb->width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
81 int sheight = tb->height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
82 int border_width = tb->border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
83 int x_adj, width_adj, y_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
84 struct device *d = XDEVICE (f->device);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
85 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
86 struct window *w = XWINDOW (window);
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
87 int shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
88 int def_shadow_thickness = XINT (Fspecifier_instance(Vtoolbar_shadow_thickness, window, Qnil, Qnil));
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
89 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
90
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
91 if (tb->vertical)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
92 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
93 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
94 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
95 y_adj = height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
96 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
97 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
98 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
99 x_adj = width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
100 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
101 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
102 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
103
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
104 toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
105
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
106 /* Blank toolbar buttons that should be 3d will have EQ(tb->up_glyph, Qt)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
107 ** Blank toolbar buttons that should be flat will have NILP (tb->up_glyph)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
108 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
109 ** Real toolbar buttons will check tb->enabled && tb->down
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
110 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
111 if (EQ (Qt, tb->up_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
112 {
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
113 shadow_thickness = def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
114 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
115 else if (NILP (tb->up_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
116 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
117 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
118 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
119 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
120 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
121 if (tb->enabled)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
122 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
123 if (tb->down)
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
124 shadow_thickness = -def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
125 else
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
126 shadow_thickness = def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
127 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
128 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
129 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
130 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
131 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
132 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
133
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
134 /* Blank the entire area. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
135 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
136 sx + x_adj, sy + y_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
137 swidth + width_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
138 sheight + height_adj);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
139
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
140 /* Draw the outline. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
141 if (shadow_thickness)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
142 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
143 MAYBE_DEVMETH (d, bevel_area,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
144 (w, toolbar_findex, sx + x_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
145 sy + y_adj, swidth + width_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
146 sheight + height_adj, abs(shadow_thickness),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
147 EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN : EDGE_BEVEL_OUT));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
148 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
149
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
150 /* Handle the borders... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
151 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
152 sx, sy,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
153 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
154 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
155 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
156 (tb->vertical ? sx + swidth : sx),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
157 (tb->vertical ? sy : sy + sheight),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
158 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
159 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
160 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
161
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
162 #define common_draw_blank_toolbar_button(f,tb) __prepare_button_area (f,tb)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
163
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
164 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
165 common_output_toolbar_button (struct frame *f, Lisp_Object button)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
166 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
167 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
168 int x_adj, y_adj, width_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
169 struct device *d = XDEVICE (f->device);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
170 Lisp_Object instance, frame, window, glyph;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
171 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
172 struct Lisp_Image_Instance *p;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
173 struct window *w;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
174 int vertical = tb->vertical;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
175 int border_width = tb->border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
176 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
177
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
178 if (vertical)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
179 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
180 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
181 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
182 y_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
183 height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
184 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
185 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
186 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
187 x_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
188 width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
189 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
190 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
191 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
192
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
193 frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
194 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
195 w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
196
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
197 glyph = get_toolbar_button_glyph (w, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
198
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
199 if (tb->enabled)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
200 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
201 if (tb->down)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
202 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
203 shadow_thickness = -2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
204 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
205 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
206 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
207 shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
208 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
209 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
210 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
211 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
212 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
213 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
214
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
215 toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
216
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
217 __prepare_button_area (f, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
218
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
219 /* #### It is currently possible for users to trash us by directly
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
220 changing the toolbar glyphs. Avoid crashing in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
221 if (GLYPHP (glyph))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
222 instance = glyph_image_instance (glyph, window, ERROR_ME_DEBUG_WARN, 1);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
223 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
224 instance = Qnil;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
225
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
226 if (IMAGE_INSTANCEP (instance))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
227 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
228 int width = tb->width + width_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
229 int height = tb->height + height_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
230 int x_offset = x_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
231 int y_offset = y_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
232
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
233 p = XIMAGE_INSTANCE (instance);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
234
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
235 if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
236 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
237 struct display_box db;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
238 struct display_glyph_area dga;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
239
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
240 if (width > (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
241 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
242 x_offset += ((int) (width - IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
243 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
244 width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
245 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
246 if (height > (int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
247 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
248 y_offset += ((int) (height - IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
249 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
250 height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
251 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
252
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
253 /* Draw exactly in the area specified... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
254 db.xpos = tb->x + x_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
255 db.ypos = tb->y + y_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
256 db.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
257 db.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
258
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
259 /* Display the whole glyph */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
260 dga.xoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
261 dga.yoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
262 dga.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
263 dga.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
264
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
265 redisplay_output_pixmap (w, instance,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
266 &db, &dga,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
267 toolbar_findex, 0, 0, 0, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
268 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
269 else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_TEXT)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
270 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
271 /* #### We need to make the face used configurable. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
272 struct face_cachel *cachel =
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
273 WINDOW_FACE_CACHEL (w, DEFAULT_INDEX);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
274 struct display_line dl;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
275 Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
276 unsigned char charsets[NUM_LEADING_BYTES];
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
277 Ichar_dynarr *buf;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
278 struct font_metric_info fm;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
279
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
280 /* This could be true if we were called via the Expose event
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
281 handler. Mark the button as dirty and return
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
282 immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
283 if (f->window_face_cache_reset)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
284 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
285 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
286 MARK_TOOLBAR_CHANGED;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
287 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
288 }
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
289 buf = Dynarr_new (Ichar);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
290 convert_ibyte_string_into_ichar_dynarr
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
291 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
292 find_charsets_in_ichar_string (charsets, Dynarr_atp (buf, 0),
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
293 Dynarr_length (buf));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
294 ensure_face_cachel_complete (cachel, window, charsets);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
295 face_cachel_charset_font_metric_info (cachel, charsets, &fm);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
296
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
297 dl.ascent = fm.ascent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
298 dl.descent = fm.descent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
299 dl.ypos = tb->y + y_offset + fm.ascent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
300
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
301 if (fm.ascent + fm.descent <= height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
302 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
303 dl.ypos += (height - fm.ascent - fm.descent) / 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
304 dl.clip = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
305 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
306 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
307 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
308 dl.clip = fm.ascent + fm.descent - height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
309 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
310
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
311 MAYBE_DEVMETH (d, output_string,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
312 (w, &dl, buf, tb->x + x_offset, 0, 0, width,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
313 toolbar_findex, 0, 0, 0, 0));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
314 Dynarr_free (buf);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
315 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
316
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
317 /* We silently ignore the image if it isn't a pixmap or text. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
318 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
319
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
320 tb->dirty = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
321 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
322
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
323 static int
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
324 common_get_button_size (struct frame *f, Lisp_Object window,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
325 struct toolbar_button *tb, int vert, int pos)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
326 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
327 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
328 int size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
329
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
330 if (tb->blank)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
331 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
332 if (!NILP (tb->down_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
333 size = XINT (tb->down_glyph);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
334 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
335 size = DEFAULT_TOOLBAR_BLANK_SIZE;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
336 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
337 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
338 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
339 struct window *w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
340 Lisp_Object glyph = get_toolbar_button_glyph (w, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
341
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
342 /* Unless, of course, the user has done something stupid like
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
343 change the glyph out from under us. Use a blank placeholder
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
344 in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
345 if (NILP (glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
346 return XINT (f->toolbar_size[pos]);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
347
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
348 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
349 size = glyph_height (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
350 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
351 size = glyph_width (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
352 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
353
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
354 if (!size)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
355 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
356 /* If the glyph doesn't have a size we'll insert a blank
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
357 placeholder instead. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
358 return XINT (f->toolbar_size[pos]);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
359 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
360
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
361 size += shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
362
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
363 return (size);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
364 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
365
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
366 #define COMMON_OUTPUT_BUTTONS_LOOP(left) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
367 do { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
368 while (!NILP (button)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
369 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
370 struct toolbar_button *tb = XTOOLBAR_BUTTON (button); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
371 int size, height, width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
372 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
373 if (left && tb->pushright) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
374 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
375 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
376 size = common_get_button_size (f, window, tb, vert, pos); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
377 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
378 if (vert) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
379 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
380 width = bar_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
381 if (y + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
382 height = max_pixpos - y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
383 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
384 height = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
385 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
386 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
387 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
388 if (x + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
389 width = max_pixpos - x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
390 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
391 width = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
392 height = bar_height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
393 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
394 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
395 if (tb->x != x \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
396 || tb->y != y \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
397 || tb->width != width \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
398 || tb->height != height \
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
399 || tb->dirty \
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
400 || f->clear) /* This is clearly necessary. */ \
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
401 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
402 if (width && height) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
403 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
404 tb->x = x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
405 tb->y = y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
406 tb->width = width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
407 tb->height = height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
408 tb->border_width = border_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
409 tb->vertical = vert; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
410 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
411 if (tb->blank || NILP (tb->up_glyph)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
412 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
413 common_draw_blank_toolbar_button (f, tb); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
414 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
415 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
416 common_output_toolbar_button (f, button); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
417 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
418 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
419 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
420 if (vert) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
421 y += height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
422 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
423 x += width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
424 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
425 if ((vert && y == max_pixpos) || (!vert && x == max_pixpos)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
426 button = Qnil; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
427 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
428 button = tb->next; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
429 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
430 } while (0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
431
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
432 #define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
433 do { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
434 switch (pos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
435 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
436 case TOP_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
437 (frame)->top_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
438 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
439 case BOTTOM_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
440 (frame)->bottom_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
441 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
442 case LEFT_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
443 (frame)->left_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
444 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
445 case RIGHT_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
446 (frame)->right_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
447 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
448 default: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
449 abort (); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
450 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
451 } while (0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
452
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
453 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
454 common_output_toolbar (struct frame *f, enum toolbar_pos pos)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
455 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
456 int x, y, bar_width, bar_height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
457 int max_pixpos, right_size, right_start, blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
458 int border_width = FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
459 Lisp_Object button, window;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
460 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
461
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
462 get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
463 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
464 toolbar_findex = get_builtin_face_cache_index (XWINDOW (window), Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
465
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
466 /* Do the border */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
467 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
468 x, y,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
469 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
470 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
471 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
472 (vert ? x : x + bar_width - border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
473 (vert ? y + bar_height - border_width : y),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
474 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
475 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
476
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
477 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
478 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
479 max_pixpos = y + bar_height - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
480 y += border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
481 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
482 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
483 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
484 max_pixpos = x + bar_width - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
485 x += border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
486 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
487
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
488 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
489 right_size = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
490
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
491 /* First loop over all of the buttons to determine how much room we
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
492 need for left hand and right hand buttons. This loop will also
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
493 make sure that all instances are instantiated so when we actually
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
494 output them they will come up immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
495 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
496 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
497 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
498 int size = common_get_button_size (f, window, tb, vert, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
499
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
500 if (tb->pushright)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
501 right_size += size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
502
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
503 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
504 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
505
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
506 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
507
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
508 /* Loop over the left buttons, updating and outputting them. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
509 COMMON_OUTPUT_BUTTONS_LOOP (1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
510
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
511 /* Now determine where the right buttons start. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
512 right_start = max_pixpos - right_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
513 if (right_start < (vert ? y : x))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
514 right_start = (vert ? y : x);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
515
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
516 /* Output the blank which goes from the end of the left buttons to
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
517 the start of the right. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
518 blank_size = right_start - (vert ? y : x);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
519 if (blank_size)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
520 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
521 int height, width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
522
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
523 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
524 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
525 width = bar_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
526 height = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
527 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
528 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
529 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
530 width = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
531 height = bar_height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
532 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
533
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
534 /*
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
535 * Use a 3D pushright separator only if there isn't a toolbar
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
536 * border. A flat separator meshes with the border and looks
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
537 * better.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
538 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
539 if (1)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
540 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
541 struct toolbar_button tb;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
542
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
543 tb.x = x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
544 tb.y = y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
545 tb.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
546 tb.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
547 tb.border_width = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
548 tb.vertical = vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
549 tb.enabled = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
550 tb.up_glyph = border_width ? Qt : Qnil;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
551
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
552 __prepare_button_area (f, &tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
553 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
554
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
555 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
556 y += height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
557 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
558 x += width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
559 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
560
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
561 /* Loop over the right buttons, updating and outputting them. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
562 COMMON_OUTPUT_BUTTONS_LOOP (0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
563
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
564 if (!vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
565 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
566 Lisp_Object frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
567
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
568 redisplay_clear_region (frame,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
569 DEFAULT_INDEX, FRAME_PIXWIDTH (f) - 1, y, 1,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
570 bar_height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
571 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
572
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
573 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
574 __INTERNAL_FLUSH (XDEVICE (f->device));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
575 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
576
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
577 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
578 common_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
579 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
580 Lisp_Object frame;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
581 int x, y, width, height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
582
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
583 get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
584 frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
585
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
586 /* The thickness_change parameter is used by the toolbar resize routines
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
587 to clear any excess toolbar if the size shrinks. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
588 if (thickness_change < 0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
589 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
590 if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
591 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
592 x = x + width + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
593 width = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
594 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
595 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
596 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
597 y = y + height + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
598 height = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
599 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
600 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
601
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
602 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
603
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
604 redisplay_clear_region (frame, DEFAULT_INDEX, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
605
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
606 __INTERNAL_FLUSH (XDEVICE (f->device));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
607 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
608
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
609 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
610 common_output_frame_toolbars (struct frame *f)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
611 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
612 __INTERNAL_APPROPRIATENESS_CHECK(f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
613
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
614 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
615 common_output_toolbar (f, TOP_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
616
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
617 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
618 common_output_toolbar (f, BOTTOM_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
619
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
620 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
621 common_output_toolbar (f, LEFT_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
622
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
623 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
624 common_output_toolbar (f, RIGHT_TOOLBAR);
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
625 }
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
626
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
627 void
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
628 common_clear_frame_toolbars (struct frame *f)
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
629 {
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
630 __INTERNAL_APPROPRIATENESS_CHECK(f);
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
631
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
632 if (f->top_toolbar_was_visible
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
633 && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
634 common_clear_toolbar (f, TOP_TOOLBAR, 0);
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
635 if (f->bottom_toolbar_was_visible
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
636 && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
637 common_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
638 if (f->left_toolbar_was_visible
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
639 && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
640 common_clear_toolbar (f, LEFT_TOOLBAR, 0);
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
641 if (f->right_toolbar_was_visible
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
642 && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
643 common_clear_toolbar (f, RIGHT_TOOLBAR, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
644 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
645
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
646 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
647 common_redraw_exposed_toolbar (struct frame *f, enum toolbar_pos pos, int x, int y,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
648 int width, int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
649 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
650 int bar_x, bar_y, bar_width, bar_height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
651 Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
652
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
653 get_toolbar_coords (f, pos, &bar_x, &bar_y, &bar_width, &bar_height,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
654 &vert, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
655
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
656 if (((y + height) < bar_y) || (y > (bar_y + bar_height)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
657 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
658 if (((x + width) < bar_x) || (x > (bar_x + bar_width)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
659 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
660
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
661 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
662 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
663 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
664
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
665 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
666 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
667 if (((tb->y + tb->height) > y) && (tb->y < (y + height)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
668 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
669
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
670 /* If this is true we have gone past the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
671 if (tb->y > (y + height))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
672 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
673 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
674 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
675 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
676 if (((tb->x + tb->width) > x) && (tb->x < (x + width)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
677 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
678
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
679 /* If this is true we have gone past the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
680 if (tb->x > (x + width))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
681 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
682 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
683
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
684 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
685 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
686
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
687 /* Even if none of the buttons is in the area, the blank region at
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
688 the very least must be because the first thing we did is verify
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
689 that some portion of the toolbar is in the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
690 common_output_toolbar (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
691 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
692
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
693 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
694 common_redraw_exposed_toolbars (struct frame *f, int x, int y, int width,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
695 int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
696 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
697 __INTERNAL_APPROPRIATENESS_CHECK(f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
698
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
699 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
700 common_redraw_exposed_toolbar (f, TOP_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
701
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
702 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
703 common_redraw_exposed_toolbar (f, BOTTOM_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
704
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
705 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
706 common_redraw_exposed_toolbar (f, LEFT_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
707
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
708 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
709 common_redraw_exposed_toolbar (f, RIGHT_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
710 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
711
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
712 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
713 common_redraw_frame_toolbars (struct frame *f)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
714 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
715 /* There are certain startup paths that lead to update_EmacsFrame in
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
716 faces.c being called before a new frame is fully initialized. In
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
717 particular before we have actually mapped it. That routine can
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
718 call this one. So, we need to make sure that the frame is
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
719 actually ready before we try and draw all over it. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
720 if (__INTERNAL_MAPPED_P(f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
721 common_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
722 FRAME_PIXHEIGHT (f));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
723 }