annotate src/toolbar-xlike.c @ 5896:2865c4f6fab2

Fix shell syntax error.
author Stephen J. Turnbull <stephen@xemacs.org>
date Tue, 05 May 2015 03:48:07 +0900
parents 56144c8593a8
children
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.
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
4 Copyright (C) 1995, 1996, 2002, 2010 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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5077
diff changeset
9 XEmacs is free software: you can redistribute it and/or modify it
713
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5077
diff changeset
11 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5077
diff changeset
12 option) any later version.
713
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5077
diff changeset
20 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
21
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
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 #include <config.h>
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
25 #include "lisp.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
26
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
27 #include "device-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
28 #include "faces.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
29 #include "frame-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
30 #include "glyphs.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
31 #include "toolbar.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
32 #include "window.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
33
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
34 /* 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
35 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
36
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
37 /* 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
38 **
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
39 ** Some of the routines used assert (FRAME_yyy_P(f)) checks, this is
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
40 ** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK(). When we
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
41 ** 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
42 ** new case here, or just remove the checks completely.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
43 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
44 ** 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
45 ** called before we are completely initialized. To avoid this, we use
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
46 ** the __INTERNAL_MAPPED_P (f) macro, that should return 0 if we should
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
47 ** 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
48 ** 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
49 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
50 ** 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
51 ** 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
52 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
53 #if defined(HAVE_GTK)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
54 #include "console-gtk-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
55 #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
56 #define __INTERNAL_FLUSH(d) gdk_flush()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
57 #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
58 #elif defined(HAVE_X_WINDOWS)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
59 #include "console-x-impl.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
60 #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
61 #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
62 #define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
63 #else
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2212
diff changeset
64 #define __INTERNAL_MAPPED_P(f) ABORT()
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2212
diff changeset
65 #define __INTERNAL_APPROPRIATENESS_CHECK(f) ABORT()
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2212
diff changeset
66 #define __INTERNAL_FLUSH(f) ABORT()
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
67 #endif
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
68
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
69 #include "toolbar-xlike.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
70
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
71 extern Lisp_Object Vtoolbar_shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
72
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
73 static void __prepare_button_area (struct frame *f,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
74 struct toolbar_button *tb)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
75 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
76 int sx = tb->x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
77 int sy = tb->y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
78 int swidth = tb->width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
79 int sheight = tb->height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
80 int border_width = tb->border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
81 int x_adj, width_adj, y_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
82 struct device *d = XDEVICE (f->device);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
83 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
84 struct window *w = XWINDOW (window);
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
85 int shadow_thickness;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
86 int def_shadow_thickness = XFIXNUM (Fspecifier_instance (Vtoolbar_shadow_thickness, window, Qnil, Qnil));
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
87 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
88
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
89 if (tb->vertical)
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 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
92 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
93 y_adj = height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
94 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
95 else
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 x_adj = width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
98 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
99 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
100 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
101
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
102 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
103
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
104 /* Blank toolbar buttons that should be 3d will have EQ (tb->up_glyph, Qt)
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
105 ** 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
106 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
107 ** Real toolbar buttons will check tb->enabled && tb->down
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 if (EQ (Qt, tb->up_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
110 {
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
111 shadow_thickness = def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
112 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
113 else if (NILP (tb->up_glyph))
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 shadow_thickness = 0;
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 else
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 if (tb->enabled)
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->down)
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
122 shadow_thickness = -def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
123 else
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 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
126 else
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 shadow_thickness = 0;
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 }
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 /* Blank the entire area. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
133 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
134 sx + x_adj, sy + y_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
135 swidth + width_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
136 sheight + height_adj);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
137
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
138 /* Draw the outline. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
139 if (shadow_thickness)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
140 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
141 MAYBE_DEVMETH (d, bevel_area,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
142 (w, toolbar_findex, sx + x_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
143 sy + y_adj, swidth + width_adj,
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
144 sheight + height_adj, abs (shadow_thickness),
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
145 EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
146 : EDGE_BEVEL_OUT));
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
147 }
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 /* Handle the borders... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
150 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
151 sx, sy,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
152 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
153 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
154 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
155 (tb->vertical ? sx + swidth : sx),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
156 (tb->vertical ? sy : sy + sheight),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
157 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
158 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
159 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
160
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
161 #define xlike_draw_blank_toolbar_button(f,tb) __prepare_button_area (f,tb)
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
162
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
163 void
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
164 xlike_output_toolbar_button (struct frame *f, Lisp_Object button)
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
165 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
166 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
167 int x_adj, y_adj, width_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
168 struct device *d = XDEVICE (f->device);
2212
51a17f29fab3 [xemacs-hg @ 2004-08-12 14:51:34 by james]
james
parents: 905
diff changeset
169 Lisp_Object instance, window, glyph;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
170 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
171 struct Lisp_Image_Instance *p;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
172 struct window *w;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
173 int vertical = tb->vertical;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
174 int border_width = tb->border_width;
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
175 face_index button_findex;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
176
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
177 if (vertical)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
178 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
179 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
180 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
181 y_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
182 height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
183 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
184 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
185 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
186 x_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
187 width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
188 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
189 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
190 }
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 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
193 w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
194
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
195 glyph = get_toolbar_button_glyph (w, tb);
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 if (tb->enabled)
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->down)
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 shadow_thickness = -2;
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 else
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 shadow_thickness = 2;
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 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
208 else
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 shadow_thickness = 0;
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
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
213 /* #### 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
214 changing the toolbar glyphs. Avoid crashing in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
215 if (GLYPHP (glyph))
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
216 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
217 /* WARNING: this interface may change */
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
218 Lisp_Object face_list[2] = { XGLYPH_FACE (glyph), Vtoolbar_face };
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
219
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
220 button_findex = merge_face_list_to_cache_index (w, face_list, 2);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
221 instance = glyph_image_instance (glyph, window, ERROR_ME_DEBUG_WARN, 1);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
222 }
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
223 else
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
224 {
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
225 button_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
226 instance = Qnil;
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
227 }
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
228
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
229 __prepare_button_area (f, tb);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
230
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
231 if (IMAGE_INSTANCEP (instance))
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 int width = tb->width + width_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
234 int height = tb->height + height_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
235 int x_offset = x_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
236 int y_offset = y_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
237
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
238 p = XIMAGE_INSTANCE (instance);
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 (IMAGE_INSTANCE_PIXMAP_TYPE_P (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 struct display_box db;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
243 struct display_glyph_area dga;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
244
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
245 if (width > (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
246 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
247 x_offset += ((int) (width - IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
248 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
249 width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
250 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
251 if (height > (int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
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 y_offset += ((int) (height - IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
254 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
255 height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
256 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
257
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
258 /* Draw exactly in the area specified... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
259 db.xpos = tb->x + x_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
260 db.ypos = tb->y + y_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
261 db.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
262 db.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
263
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
264 /* Display the whole glyph */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
265 dga.xoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
266 dga.yoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
267 dga.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
268 dga.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
269
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
270 redisplay_output_pixmap (w, instance,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
271 &db, &dga,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
272 button_findex, 0, 0, 0, 0);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
273 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
274 else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_TEXT)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
275 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
276 /* #### We need to make the face used configurable. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
277 struct face_cachel *cachel =
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
278 WINDOW_FACE_CACHEL (w, DEFAULT_INDEX);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
279 struct display_line dl;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
280 Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
281 unsigned char charsets[NUM_LEADING_BYTES];
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
282 Ichar_dynarr *buf;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
283 struct font_metric_info fm;
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 /* 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
286 handler. Mark the button as dirty and return
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
287 immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
288 if (f->window_face_cache_reset)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
289 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
290 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
291 MARK_TOOLBAR_CHANGED;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
292 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
293 }
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
294 buf = Dynarr_new (Ichar);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 800
diff changeset
295 convert_ibyte_string_into_ichar_dynarr
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
296 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
4967
0d4c9d0f6a8d rewrite dynarr code
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
297 find_charsets_in_ichar_string (charsets, Dynarr_begin (buf),
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
298 Dynarr_length (buf));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
299 ensure_face_cachel_complete (cachel, window, charsets);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
300 face_cachel_charset_font_metric_info (cachel, charsets, &fm);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
301
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
302 dl.ascent = fm.ascent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
303 dl.descent = fm.descent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
304 dl.ypos = tb->y + y_offset + fm.ascent;
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 if (fm.ascent + fm.descent <= height)
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.ypos += (height - fm.ascent - fm.descent) / 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
309 dl.clip = 0;
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 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
312 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
313 dl.clip = fm.ascent + fm.descent - height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
314 }
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 MAYBE_DEVMETH (d, output_string,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
317 (w, &dl, buf, tb->x + x_offset, 0, 0, width,
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 2500
diff changeset
318 button_findex, 0, 0, 0, 0));
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
319 Dynarr_free (buf);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
320 }
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 /* 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
323 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
324
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
325 tb->dirty = 0;
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
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
328 static int
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
329 xlike_get_button_size (struct frame *f, Lisp_Object window,
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
330 struct toolbar_button *tb, int vert, int pos)
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 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
333 int size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
334
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
335 if (tb->blank)
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 if (!NILP (tb->down_glyph))
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
338 size = XFIXNUM (tb->down_glyph);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
339 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
340 size = DEFAULT_TOOLBAR_BLANK_SIZE;
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 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
343 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
344 struct window *w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
345 Lisp_Object glyph = get_toolbar_button_glyph (w, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
346
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
347 /* 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
348 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
349 in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
350 if (NILP (glyph))
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
351 return XFIXNUM (f->toolbar_size[pos]);
713
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 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
354 size = glyph_height (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
355 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
356 size = glyph_width (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
357 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
358
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
359 if (!size)
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 /* 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
362 placeholder instead. */
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
363 return XFIXNUM (f->toolbar_size[pos]);
713
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 size += shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
367
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
368 return (size);
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
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
371 #define XLIKE_OUTPUT_BUTTONS_LOOP(left) \
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
372 do { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
373 while (!NILP (button)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
374 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
375 struct toolbar_button *tb = XTOOLBAR_BUTTON (button); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
376 int size, height, width; \
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 (left && tb->pushright) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
379 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
380 \
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
381 size = xlike_get_button_size (f, window, tb, vert, pos); \
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
382 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
383 if (vert) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
384 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
385 width = bar_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
386 if (y + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
387 height = max_pixpos - y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
388 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
389 height = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
390 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
391 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
392 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
393 if (x + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
394 width = max_pixpos - x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
395 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
396 width = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
397 height = bar_height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
398 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
399 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
400 if (tb->x != x \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
401 || tb->y != y \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
402 || tb->width != width \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
403 || tb->height != height \
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
404 || tb->dirty \
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
405 || f->clear) /* This is clearly necessary. */ \
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
406 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
407 if (width && height) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
408 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
409 tb->x = x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
410 tb->y = y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
411 tb->width = width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
412 tb->height = height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
413 tb->border_width = border_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
414 tb->vertical = vert; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
415 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
416 if (tb->blank || NILP (tb->up_glyph)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
417 { \
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
418 xlike_draw_blank_toolbar_button (f, tb); \
713
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 else \
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
421 xlike_output_toolbar_button (f, button); \
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
422 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
423 } \
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) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
426 y += height; \
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 x += width; \
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 if ((vert && y == max_pixpos) || (!vert && x == max_pixpos)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
431 button = Qnil; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
432 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
433 button = tb->next; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
434 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
435 } while (0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
436
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
437 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
438 xlike_output_toolbar (struct frame *f, enum edge_pos pos)
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
439 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
440 int x, y, bar_width, bar_height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
441 int max_pixpos, right_size, right_start, blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
442 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
443 Lisp_Object button, window;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
444 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
445
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
446 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
447 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
448 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
449
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
450 /* Do the border */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
451 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
452 x, y,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
453 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
454 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
455 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
456 (vert ? x : x + bar_width - border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
457 (vert ? y + bar_height - border_width : y),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
458 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
459 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
460
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
461 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
462 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
463 max_pixpos = y + bar_height - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
464 y += border_width;
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 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
467 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
468 max_pixpos = x + bar_width - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
469 x += border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
470 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
471
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
472 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
473 right_size = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
474
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
475 /* 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
476 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
477 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
478 output them they will come up immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
479 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
480 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
481 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
482 int size = xlike_get_button_size (f, window, tb, vert, pos);
713
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 if (tb->pushright)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
485 right_size += size;
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 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
488 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
489
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
490 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
491
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
492 /* Loop over the left buttons, updating and outputting them. */
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
493 XLIKE_OUTPUT_BUTTONS_LOOP (1);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
494
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
495 /* Now determine where the right buttons start. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
496 right_start = max_pixpos - right_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
497 if (right_start < (vert ? y : x))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
498 right_start = (vert ? y : x);
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 /* 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
501 the start of the right. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
502 blank_size = right_start - (vert ? y : x);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
503 if (blank_size)
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 int height, width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
506
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
507 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
508 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
509 width = bar_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
510 height = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
511 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
512 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
513 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
514 width = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
515 height = bar_height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
516 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
517
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
518 /*
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
519 * 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
520 * 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
521 * better.
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 (1)
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 struct toolbar_button tb;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
526
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
527 tb.x = x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
528 tb.y = y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
529 tb.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
530 tb.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
531 tb.border_width = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
532 tb.vertical = vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
533 tb.enabled = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
534 tb.up_glyph = border_width ? Qt : Qnil;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
535
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
536 __prepare_button_area (f, &tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
537 }
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 (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
540 y += height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
541 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
542 x += width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
543 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
544
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
545 /* Loop over the right buttons, updating and outputting them. */
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
546 XLIKE_OUTPUT_BUTTONS_LOOP (0);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
547
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
548 if (!vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
549 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
550 Lisp_Object frame = wrap_frame (f);
713
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 redisplay_clear_region (frame,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
553 DEFAULT_INDEX, FRAME_PIXWIDTH (f) - 1, y, 1,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
554 bar_height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
555 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
556
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
557 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
558 __INTERNAL_FLUSH (XDEVICE (f->device));
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 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
562 xlike_clear_toolbar (struct frame *f, enum edge_pos pos, int thickness_change)
713
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 Lisp_Object frame;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
565 int x, y, width, height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
566
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
567 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
568 frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
569
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
570 /* 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
571 to clear any excess toolbar if the size shrinks. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
572 if (thickness_change < 0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
573 {
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
574 if (pos == LEFT_EDGE || pos == RIGHT_EDGE)
713
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 x = x + width + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
577 width = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
578 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
579 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
580 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
581 y = y + height + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
582 height = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
583 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
584 }
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 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
587
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
588 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
589
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
590 __INTERNAL_FLUSH (XDEVICE (f->device));
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
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
593 void
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
594 xlike_output_frame_toolbars (struct frame *f)
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
595 {
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
596 enum edge_pos pos;
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
597 __INTERNAL_APPROPRIATENESS_CHECK (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
598
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
599 EDGE_POS_LOOP (pos)
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
600 {
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
601 if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
602 xlike_output_toolbar (f, pos);
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
603 }
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
604 }
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
605
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
606 void
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
607 xlike_clear_frame_toolbars (struct frame *f)
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
608 {
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
609 enum edge_pos pos;
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
610 __INTERNAL_APPROPRIATENESS_CHECK (f);
905
c15f25529e61 [xemacs-hg @ 2002-07-06 21:05:42 by andyp]
andyp
parents: 872
diff changeset
611
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
612 EDGE_POS_LOOP (pos)
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
613 {
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
614 if (f->toolbar_was_visible[pos]
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
615 && !FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
616 xlike_clear_toolbar (f, pos, 0);
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
617 }
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
618 }
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 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
621 xlike_redraw_exposed_toolbar (struct frame *f, enum edge_pos pos, int x, int y,
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
622 int width, int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
623 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
624 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
625 Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
626
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
627 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
628 &vert, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
629
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
630 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
631 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
632 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
633 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
634
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
635 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
636 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
637 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
638
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
639 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
640 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
641 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
642 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
643
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
644 /* 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
645 if (tb->y > (y + height))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
646 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
647 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
648 else
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 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
651 tb->dirty = 1;
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 /* 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
654 if (tb->x > (x + width))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
655 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
656 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
657
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
658 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
659 }
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 /* 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
662 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
663 that some portion of the toolbar is in the exposed region. */
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
664 xlike_output_toolbar (f, pos);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
665 }
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 void
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
668 xlike_redraw_exposed_toolbars (struct frame *f, int x, int y, int width,
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
669 int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
670 {
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
671 enum edge_pos pos;
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
672 __INTERNAL_APPROPRIATENESS_CHECK (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
673
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
674 EDGE_POS_LOOP (pos)
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
675 {
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
676 if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
677 xlike_redraw_exposed_toolbar (f, pos, x, y, width, height);
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
678 }
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
679 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
680
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
681 void
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
682 xlike_redraw_frame_toolbars (struct frame *f)
713
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 /* 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
685 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
686 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
687 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
688 actually ready before we try and draw all over it. */
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 4969
diff changeset
689 if (__INTERNAL_MAPPED_P (f))
4917
fce43cb76a1c xlike cleanup, documentation
Ben Wing <ben@xemacs.org>
parents: 3094
diff changeset
690 xlike_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f),
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
691 FRAME_PIXHEIGHT (f));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
692 }