annotate src/glyphs-widget.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 2f8bb876ab1d
children 501cfd01ee6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1 /* Widget-specific glyph objects.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2 Copyright (C) 1998, 1999, 2000 Andy Piper.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
3
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
4 This file is part of XEmacs.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
5
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
9 later version.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
10
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
14 for more details.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
15
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
20
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
22
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
23 /* written by Andy Piper <andy@xemacs.org> */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
24
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
25 #include <config.h>
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
26 #include "lisp.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
27 #include "lstream.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
28 #include "console.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
29 #include "device.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
30 #include "faces.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
31 #include "glyphs.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
32 #include "objects.h"
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
33 #include "bytecode.h"
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
34 #include "window.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
35 #include "buffer.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
36 #include "frame.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
37 #include "insdel.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
38 #include "opaque.h"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
39
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
40 DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
41 DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo_box);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
42 Lisp_Object Qcombo_box;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
43 DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit_field);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
44 Lisp_Object Qedit_field;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
45 DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
46 Lisp_Object Qscrollbar;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
47 DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
48 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
49 Lisp_Object Qlabel;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
50 DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
51 Lisp_Object Qprogress_gauge;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
52 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree_view);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
53 Lisp_Object Qtree_view;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
54 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab_control);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
55 Lisp_Object Qtab_control;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
57 Lisp_Object Qlayout;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
58
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
59 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
60 Lisp_Object Q_image, Q_text, Q_orientation, Q_justify, Q_border;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
61 Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
62 Lisp_Object Vwidget_callback_current_channel;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
63 Lisp_Object Qwidget_callback_current_channel;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
64
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
65 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
66 int debug_widget_instances;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
67 #endif
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
68
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
69 /* TODO:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
70 - tooltips for controls, especially buttons.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
71 - keyboard traversal.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
72 - lisp configurable layout.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
73 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
74
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
75 /* In MS-Windows normal windows work in pixels, dialog boxes work in
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
76 dialog box units. Why? sigh. We could reuse the metrics for dialogs
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
77 if this were not the case. As it is we have to position things
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
78 pixel wise. I'm not even sure that X has this problem at least for
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
79 buttons in groups. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
80 static int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
81 widget_possible_dest_types (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
82 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
83 return IMAGE_WIDGET_MASK;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
84 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
85
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
86 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
87 check_valid_glyph_or_instantiator (Lisp_Object data)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
88 {
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
89 Lisp_Object glyph = data;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
90 if (SYMBOLP (data))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
91 glyph = XSYMBOL (data)->value;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
92
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
93 if (IMAGE_INSTANCEP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
94 CHECK_IMAGE_INSTANCE (glyph);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
95 else if (!CONSP (glyph) && !VECTORP (glyph))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
96 CHECK_BUFFER_GLYPH (glyph);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
97 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
98
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
99 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
100 check_valid_orientation (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
101 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
102 if (!EQ (data, Qhorizontal)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
103 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
104 !EQ (data, Qvertical))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
105 signal_simple_error ("unknown orientation for layout", data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
106 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
107
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
108 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
109 check_valid_tab_orientation (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
110 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
111 if (!EQ (data, Qtop)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
112 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
113 !EQ (data, Qbottom)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
114 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
115 !EQ (data, Qleft)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
116 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
117 !EQ (data, Qright))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
118 signal_simple_error ("unknown orientation for tab control", data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
119 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
120
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
121 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
122 check_valid_justification (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
123 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
124 if (!EQ (data, Qleft) && !EQ (data, Qright) && !EQ (data, Qcenter))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
125 signal_simple_error ("unknown justification for layout", data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
126 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
127
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
128 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
129 check_valid_border (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
130 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
131 if (!EQ (data, Qt) && !EQ (data, Qetched_in) && !EQ (data, Qetched_out)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
132 && !EQ (data, Qbevel_in) && !EQ (data, Qbevel_out)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
133 && !GLYPHP (data) && !VECTORP (data))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
134 signal_simple_error ("unknown border style for layout", data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
135 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
136
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
137 static void
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
138 check_valid_anything (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
139 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
140 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
141
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
142 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
143 check_valid_callback (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
144 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
145 if (!SYMBOLP (data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
146 && !COMPILED_FUNCTIONP (data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
147 && !CONSP (data))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
148 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
149 signal_simple_error (":callback must be a function or expression", data);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
150 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
151 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
152
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
153 static void
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
154 check_valid_int_or_function (Lisp_Object data)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
155 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
156 if (!INTP (data) && !CONSP (data))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
157 signal_simple_error ("must be an integer or expresssion", data);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
158 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
159
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
160 static void
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
161 check_valid_symbol (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
162 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
163 CHECK_SYMBOL (data);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
164 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
165
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
166 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
167 check_valid_string_or_vector (Lisp_Object data)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
168 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
169 if (!STRINGP (data) && !VECTORP (data))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
170 signal_simple_error (":descriptor must be a string or a vector", data);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
171 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
172
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
173 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
174 check_valid_item_list_1 (Lisp_Object items)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
175 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
176 Lisp_Object rest;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
177
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
178 CHECK_LIST (items);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
179 EXTERNAL_LIST_LOOP (rest, items)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
180 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
181 if (STRINGP (XCAR (rest)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
182 CHECK_STRING (XCAR (rest));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
183 else if (VECTORP (XCAR (rest)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
184 gui_parse_item_keywords (XCAR (rest));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
185 else if (LISTP (XCAR (rest)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
186 check_valid_item_list_1 (XCAR (rest));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
187 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
188 signal_simple_error ("Items must be vectors, lists or strings", items);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
189 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
190 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
191
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
192 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
193 check_valid_item_list (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
194 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
195 Lisp_Object items;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
196
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
197 Fcheck_valid_plist (data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
198 items = Fplist_get (data, Q_items, Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
199
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
200 check_valid_item_list_1 (items);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
201 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
202
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
203 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
204 check_valid_glyph_or_instantiator_list (Lisp_Object data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
205 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
206 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
207
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
208 CHECK_LIST (data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
209 EXTERNAL_LIST_LOOP (rest, data)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
210 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
211 check_valid_glyph_or_instantiator (XCAR (rest));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
212 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
213 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
214
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
215 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
216 glyph_instantiator_to_glyph (Lisp_Object sym)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
217 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
218 /* This function calls lisp. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
219 Lisp_Object glyph = sym;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
220 struct gcpro gcpro1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
221
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
222 GCPRO1 (glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
223 /* if we have a symbol get at the actual data */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
224 if (SYMBOLP (glyph))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
225 glyph = XSYMBOL (glyph)->value;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
226
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
227 if (CONSP (glyph))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
228 glyph = Feval (glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
229
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
230 /* Be really helpful to the user. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
231 if (VECTORP (glyph))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
232 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
233 glyph = call1 (intern ("make-glyph"), glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
234 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
235
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
236 /* substitute the new glyph */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
237 RETURN_UNGCPRO (glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
238 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
239
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
240 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
241 substitute_keyword_value (Lisp_Object inst, Lisp_Object key, Lisp_Object val)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
242 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
243 int i;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
244 /* substitute the new glyph */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
245 for (i = 0; i < XVECTOR_LENGTH (inst); i++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
246 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
247 if (EQ (key, XVECTOR_DATA (inst)[i]))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
248 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
249 XVECTOR_DATA (inst)[i+1] = val;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
250 break;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
251 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
252 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
253 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
254
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
255 /* Wire widget property invocations to specific widgets. The problem
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
256 we are solving here is that when instantiators get converted to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
257 instances they lose some type information (they just become
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
258 subwindows or widgets for example). For widgets we need to preserve
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
259 this type information so that we can do widget specific operations
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
260 on the instances. This is encoded in the widget type
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
261 field. widget_property gets invoked by decoding the primary type
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
262 (Qwidget), <widget>_property then invokes based on the secondary
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
263 type (Qedit_field for example). It is debatable whether we should
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
264 wire things in this generalised way rather than treating widgets
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
265 specially in image_instance_property. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
266 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
267 widget_property (Lisp_Object image_instance, Lisp_Object prop)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
268 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
269 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
270 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
271
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
272 /* first see if its a general property ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
273 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
274 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
275
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
276 /* .. then try device specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
277 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
278 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
279 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
280 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
281 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
282 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
283 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
284 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
285 if (meths && HAS_IIFORMAT_METH_P (meths, property))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
286 return IIFORMAT_METH (meths, property, (image_instance, prop));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
287 /* ... then fail */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
288 return Qunbound;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
289 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
290
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
291 static Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
292 widget_set_property (Lisp_Object image_instance, Lisp_Object prop, Lisp_Object val)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
293 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
294 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
295 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
296 Lisp_Object ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
297
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
298 /* PIck up any generic properties that we might need to keep hold
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
299 of. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
300 if (EQ (prop, Q_text))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
301 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
302 IMAGE_INSTANCE_WIDGET_TEXT (ii) = val;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
303 IMAGE_INSTANCE_TEXT_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
304 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
305
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
306 /* Now try device specific methods first ... */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
307 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
308 IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
309 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
310 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
311 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
312 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
313 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
314 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
315 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
316 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
317 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
318 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
319 ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
320 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
321 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
322 !UNBOUNDP (ret =
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
323 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
324 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
325 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
326 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
327 /* we didn't do any device specific properties, so shove the property in our plist */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
328 IMAGE_INSTANCE_WIDGET_PROPS (ii)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
329 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
330 return val;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
331 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
332
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
333 /* Like the rest of redisplay, we want widget updates to occur
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
334 asynchronously. Thus toolkit specific methods for setting properties
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
335 must be called by redisplay instead of by *_set_property. Thus
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
336 *_set_property records the change and this function actually
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
337 implements it. We want to be slightly clever about this however by
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
338 supplying format specific functions for the updates instead of lumping
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
339 them all into this function. Note that there is no need for format
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
340 generic functions. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
341 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
342 update_widget (Lisp_Object widget)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
343 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
344 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
345 struct image_instantiator_methods* meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
346
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
347 if (IMAGE_INSTANCE_TYPE (ii) != IMAGE_WIDGET)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
348 return;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
349
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
350 /* Device generic methods. We must update the widget's size as it
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
351 may have been changed by the the layout routines. We also do this
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
352 here so that explicit resizing from lisp does not result in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
353 synchronous updates. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
354 MAYBE_DEVMETH (XDEVICE (ii->device), update_widget, (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
355
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
356 /* Device-format specific methods */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
357 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
358 IMAGE_INSTANCE_WIDGET_TYPE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
359 ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
360 MAYBE_IIFORMAT_METH (meths, update, (widget));
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
361
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
362 /* Pick up the items we recorded earlier. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
363 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
364 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
365 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
366 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
367 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
368 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
369 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
370
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
371 /* Query for a widgets desired geometry. If no type specific method is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
372 provided then use the widget text to calculate sizes. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
373 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
374 widget_query_geometry (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
375 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
376 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
377 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
378 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
379 struct image_instantiator_methods* meths;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
380 Lisp_Object dynamic_width = Qnil;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
381 Lisp_Object dynamic_height = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
382
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
383 /* First just set up what we already have. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
384 if (width) *width = IMAGE_INSTANCE_WIDTH (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
385 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
386
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
387 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
388 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
389 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
390 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
391 /* .. then try device specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
392 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
393 IMAGE_INSTANCE_WIDGET_TYPE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
394 ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
395 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
396 IIFORMAT_METH (meths, query_geometry, (image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
397 width, height, disp,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
398 domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
399 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
400 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
401 /* ... then format specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
402 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
403 ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
404 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
405 IIFORMAT_METH (meths, query_geometry, (image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
406 width, height, disp,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
407 domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
408 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
409 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
410 unsigned int w, h;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
411
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
412 /* Then if we are allowed to resize the widget, make the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
413 size the same as the text dimensions. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
414 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
415 IMAGE_INSTANCE_WIDGET_FACE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
416 &w, &h, 0, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
417 /* Adjust the size for borders. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
418 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
419 *width = w + 2 * WIDGET_BORDER_WIDTH;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
420 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
421 *height = h + 2 * WIDGET_BORDER_HEIGHT;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
422 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
423 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
424 /* Finish off with dynamic sizing. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
425 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
426 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
427 dynamic_width = Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
428 if (INTP (dynamic_width))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
429 *width = XINT (dynamic_width);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
430 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
431 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
432 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
433 dynamic_height = Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
434 if (INTP (dynamic_height))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
435 *height = XINT (dynamic_height);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
436 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
437 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
438 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
439
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
440 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
441 widget_layout (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
442 unsigned int width, unsigned int height, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
443 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
444 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
445 struct image_instantiator_methods* meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
446
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
447 /* .. then try device specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
448 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
449 IMAGE_INSTANCE_WIDGET_TYPE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
450 ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
451 if (meths && HAS_IIFORMAT_METH_P (meths, layout))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
452 IIFORMAT_METH (meths, layout, (image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
453 width, height, domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
454 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
455 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
456 /* ... then format specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
457 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
458 ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
459 if (meths && HAS_IIFORMAT_METH_P (meths, layout))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
460 IIFORMAT_METH (meths, layout, (image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
461 width, height, domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
462 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
463 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
464
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
465 static void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
466 widget_validate (Lisp_Object instantiator)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
467 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
468 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
469
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
470 if (NILP (desc))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
471 signal_simple_error ("Must supply :descriptor", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
472
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
473 if (VECTORP (desc))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
474 gui_parse_item_keywords (desc);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
475
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
476 if (!NILP (find_keyword_in_vector (instantiator, Q_width))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
477 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_width)))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
478 signal_simple_error ("Must supply only one of :width and :pixel-width", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
479
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
480 if (!NILP (find_keyword_in_vector (instantiator, Q_height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
481 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_height)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
482 signal_simple_error ("Must supply only one of :height and :pixel-height", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
483 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
484
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
485 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
486 combo_box_validate (Lisp_Object instantiator)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
487 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
488 widget_validate (instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
489 if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
490 signal_simple_error ("Must supply item list", instantiator);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
491 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
492
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
493 /* we need to convert things like glyphs to images, eval expressions
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
494 etc.*/
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
495 static Lisp_Object
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
496 widget_normalize (Lisp_Object inst, Lisp_Object console_type)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
497 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
498 /* This function can call lisp */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
499 Lisp_Object glyph = find_keyword_in_vector (inst, Q_image);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
500
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
501 /* we need to eval glyph if its an expression, we do this for the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
502 same reasons we normalize file to data. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
503 if (!NILP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
504 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
505 substitute_keyword_value (inst, Q_image, glyph_instantiator_to_glyph (glyph));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
506 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
507
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
508 return inst;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
509 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
510
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
511 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
512 initialize_widget_image_instance (Lisp_Image_Instance *ii, Lisp_Object type)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
513 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
514 /* initialize_subwindow_image_instance (ii);*/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
515 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
516 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
517 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
518 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = allocate_gui_item ();
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
519 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
520 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = Qnil;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
521 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
522 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
523 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 1;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
524 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_HORIZONTAL;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
525 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
526 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
527
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
528 /* Instantiate a button widget. Unfortunately instantiated widgets are
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
529 particular to a frame since they need to have a parent. It's not
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
530 like images where you just select the image into the context you
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
531 want to display it in and BitBlt it. So image instances can have a
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
532 many-to-one relationship with things you see, whereas widgets can
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
533 only be one-to-one (i.e. per frame) */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
534 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
535 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
536 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
537 int dest_mask, Lisp_Object domain)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
538 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
539 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
540 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
541 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
542 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
543 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
544 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
545 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
546 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
547 Lisp_Object props = find_keyword_in_vector (instantiator, Q_properties);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
548 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
549 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
550 int pw=0, ph=0, tw=0, th=0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
551
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
552 /* this just does pixel type sizing */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
553 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
554 dest_mask, domain);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
555
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
556 if (!(dest_mask & (IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
557 incompatible_image_types (instantiator, dest_mask,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
558 IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
559
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
560 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
561
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
562 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
563 IMAGE_INSTANCE_WIDGET_PROPS (ii) = props;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
564
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
565 /* retrieve the fg and bg colors */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
566 if (!NILP (face))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
567 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Fget_face (face));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
568
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
569 /* Do layout specific initialisation. This feels a bit tacky, but
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
570 the alternative is a myriad of different little functions. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
571 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
572 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
573 Lisp_Object rest, children = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
574 Lisp_Object border = find_keyword_in_vector (instantiator, Q_border);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
575
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
576 if (NILP (orient))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
577 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
578 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
579 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
580 IMAGE_INSTANCE_TYPE (ii) = IMAGE_LAYOUT;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
581
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
582 if (EQ (border, Qt))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
583 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
584 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = Qetched_in;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
585 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
586 else if (GLYPHP (border))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
587 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
588 /* We are going to be sneaky here and add the border text as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
589 just another child, the layout and output routines don't know
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
590 this and will just display at the offsets we prescribe. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
591 Lisp_Object gii = glyph_image_instance (border, domain, ERROR_ME, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
592 /* make sure we are designated as the parent. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
593 XIMAGE_INSTANCE_PARENT (gii) = image_instance;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
594 children = Fcons (gii, children);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
595 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
596 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
597 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
598 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
599 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
600 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
601
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
602 /* Pick up the sub-widgets. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
603 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
604 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
605 /* make sure the image is instantiated */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
606 Lisp_Object gii = glyph_image_instance (XCAR (rest), domain, ERROR_ME, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
607 /* make sure we are designated as the parent. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
608 XIMAGE_INSTANCE_PARENT (gii) = image_instance;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
609 children = Fcons (gii, children);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
610 }
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
611 /* Make sure elements in the layout are in the order the
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
612 user expected. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
613 children = Fnreverse (children);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
614 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
615 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
616 /* retrieve the gui item information. This is easy if we have been
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
617 provided with a vector, more difficult if we have just been given
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
618 keywords */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
619 else if (STRINGP (desc) || NILP (desc))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
620 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
621 /* big cheat - we rely on the fact that a gui item looks like an instantiator */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
622 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
623 gui_parse_item_keywords_no_errors (instantiator);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
624 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
625 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
626 else
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
627 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
628 gui_parse_item_keywords_no_errors (desc);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
629
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
630 /* Pick up the orientation before we do our first layout. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
631 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
632 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
633
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
634 /* parse more gui items out of the properties */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
635 if (!NILP (props)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
636 && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
637 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
638 if (NILP (items))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
639 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
640 items = Fplist_get (props, Q_items, Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
641 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
642 if (!NILP (items))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
643 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
644 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
645 Fcons (IMAGE_INSTANCE_WIDGET_ITEMS (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
646 parse_gui_item_tree_children (items));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
647 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
648 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
649
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
650 /* Normalize size information. We now only assign sizes if the user
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
651 gives us some explicitly, or there are some constraints that we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
652 can't change later on. Otherwise we postpone sizing until query
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
653 geometry gets called. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
654 if (!NILP (pixwidth)) /* pixwidth takes precendent */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
655 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
656 if (!INTP (pixwidth))
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
657 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = pixwidth;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
658 else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
659 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
660 pw = XINT (pixwidth);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
661 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
662 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
663 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
664 else if (!NILP (width))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
665 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
666 tw = XINT (width);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
667 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
668 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
669
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
670 if (!NILP (pixheight))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
671 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
672 if (!INTP (pixheight))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
673 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
674 else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
675 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
676 ph = XINT (pixheight);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
677 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
678 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
679 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
680 else if (!NILP (height) && XINT (height) > 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
681 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
682 th = XINT (height);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
683 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
684 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
685
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
686 /* Taking the default face information when the user has specified
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
687 size in characters is probably as good as any since the widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
688 face is more likely to be proportional and thus give inadequate
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
689 results. Using character sizes can only ever be approximate
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
690 anyway. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
691 if (tw || th)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
692 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
693 int charwidth, charheight;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
694 default_face_font_info (domain, 0, 0, &charheight, &charwidth, 0);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
695 if (tw)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
696 pw = charwidth * tw;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
697 if (th)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
698 ph = charheight * th;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
699 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
700
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
701 /* for a widget with an image pick up the dimensions from that */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
702 if (!NILP (glyph))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
703 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
704 if (!pw)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
705 pw = glyph_width (glyph, domain) + 2 * WIDGET_BORDER_WIDTH;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
706 if (!ph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
707 ph = glyph_height (glyph, domain) + 2 * WIDGET_BORDER_HEIGHT;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
708 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
709 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
710 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
711
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
712 /* When we create the widgets the window system expects a valid
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
713 size, so If we still don' t have sizes, call layout to pick them
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
714 up. If query_geometry or layout relies on the widget being in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
715 existence then we are in catch 22. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
716 image_instance_layout (image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
717 pw ? pw : IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
718 ph ? ph : IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
719 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
720
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
721 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
722 debug_widget_instances++;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
723 stderr_out ("instantiated ");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
724 debug_print (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
725 stderr_out ("%d widgets instantiated\n", debug_widget_instances);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
726 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
727 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
728
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
729 /* Get the geometry of a button control. We need to adjust the size
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
730 depending on the type of button. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
731 static void
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
732 button_query_geometry (Lisp_Object image_instance,
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
733 unsigned int* width, unsigned int* height,
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
734 enum image_instance_geometry disp, Lisp_Object domain)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
735 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
736 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
737 unsigned int w, h;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
738 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
739 IMAGE_INSTANCE_WIDGET_FACE (ii),
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
740 &w, &h, 0, domain);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
741 /* Adjust the size for borders. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
742 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
743 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
744 *width = w + 2 * WIDGET_BORDER_WIDTH;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
745
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
746 if (EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qradio)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
747 ||
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
748 EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qtoggle))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
749 /* This is an approximation to the size of the actual button bit. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
750 *width += 12;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
751 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
752 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
753 *height = h + 2 * WIDGET_BORDER_HEIGHT;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
754 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
755
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
756 /* tree-view geometry - get the height right */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
757 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
758 tree_view_query_geometry (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
759 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
760 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
761 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
762 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
763 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
764
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
765
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
766 if (*width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
767 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
768 /* #### what should this be. reconsider when X has tree views. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
769 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
770 IMAGE_INSTANCE_WIDGET_FACE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
771 width, 0, 0, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
772 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
773 if (*height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
774 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
775 int len, h;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
776 default_face_font_info (domain, 0, 0, &h, 0, 0);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
777 GET_LIST_LENGTH (items, len);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
778 *height = len * h;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
779 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
780 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
781
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
782 /* Get the geometry of a tab control. This is based on the number of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
783 items and text therin in the tab control. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
784 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
785 tab_control_query_geometry (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
786 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
787 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
788 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
789 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
790 Lisp_Object items = XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
791 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
792 unsigned int tw = 0, th = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
793
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
794 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
795 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
796 unsigned int h, w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
797
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
798 query_string_geometry (XGUI_ITEM (XCAR (rest))->name,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
799 IMAGE_INSTANCE_WIDGET_FACE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
800 &w, &h, 0, domain);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
801 tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
802 tw += w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
803 th = max (th, h + 2 * WIDGET_BORDER_HEIGHT);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
804 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
805
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
806 /* Fixup returned values depending on orientation. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
807 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
808 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
809 if (height) *height = tw;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
810 if (width) *width = th;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
811 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
812 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
813 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
814 if (height) *height = th;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
815 if (width) *width = tw;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
816 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
817 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
818
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
819 /* Get the geometry of a tab control. This is based on the number of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
820 items and text therin in the tab control. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
821 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
822 tab_control_set_property (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
823 Lisp_Object prop,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
824 Lisp_Object val)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
825 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
826 /* Record new items for update. *_tab_control_update will do the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
827 rest. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
828 if (EQ (prop, Q_items))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
829 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
830 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
831
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
832 check_valid_item_list_1 (val);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
833
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
834 /* Don't set the actual items since we might decide not to use
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
835 the new ones (because nothing has really changed). If we did
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
836 set them and didn't use them then we would get into whole
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
837 heaps of trouble when the old items get GC'd. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
838 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) =
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
839 Fcons (XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
840 parse_gui_item_tree_children (val));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
841 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
842
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
843 return Qt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
844 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
845 return Qunbound;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
846 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
847
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
848 /* set the properties of a progres guage */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
849 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
850 progress_gauge_set_property (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
851 Lisp_Object prop,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
852 Lisp_Object val)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
853 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
854 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
855
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
856 if (EQ (prop, Q_value))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
857 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
858 CHECK_INT (val);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
859 #ifdef DEBUG_WIDGET_OUTPUT
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
860 printf ("progress gauge value set to %ld\n", XINT (val));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
861 #endif
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
862 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) =
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
863 copy_gui_item_tree (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
864 #ifdef ERROR_CHECK_GLYPHS
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
865 assert (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
866 #endif
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
867 if (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
868 XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))->value = val;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
869
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
870 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 1;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
871
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
872 return Qt;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
873 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
874 return Qunbound;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
875 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
876
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
877
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
878 /*****************************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
879 * widget layout *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
880 *****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
881 static int
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
882 layout_possible_dest_types (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
883 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
884 return IMAGE_LAYOUT_MASK;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
885 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
886
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
887 /* we need to convert things like glyphs to images, eval expressions
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
888 etc.*/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
889 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
890 layout_normalize (Lisp_Object inst, Lisp_Object console_type)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
891 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
892 /* This function can call lisp */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
893 Lisp_Object items = find_keyword_in_vector (inst, Q_items);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
894 Lisp_Object border = find_keyword_in_vector (inst, Q_border);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
895 /* we need to eval glyph if its an expression, we do this for the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
896 same reasons we normalize file to data. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
897 if (!NILP (items))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
898 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
899 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
900 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
901 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
902 /* substitute the new glyph */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
903 Fsetcar (rest, glyph_instantiator_to_glyph (XCAR (rest)));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
904 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
905 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
906 /* normalize the border spec. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
907 if (VECTORP (border) || CONSP (border))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
908 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
909 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
910 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
911 return inst;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
912 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
913
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
914 /* Layout widget. Sizing commentary: we have a number of problems that
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
915 we would like to address. Some consider some of these more
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
916 important than others. It used to be that size information was
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
917 determined at instantiation time and was then fixed forever
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
918 after. Generally this is not what we want. Users want size to be
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
919 "big enough" to accommodate whatever they are trying to show and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
920 this is dependent on text length, lines, font metrics etc. Of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
921 course these attributes can change dynamically and so the size
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
922 should changed dynamically also. Only in a few limited cases should
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
923 the size be fixed and remain fixed. Of course this actually means
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
924 that we don't really want to specifiy the size *at all* for most
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
925 widgets - we want it to be discovered dynamically. Thus we can
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
926 envisage the following scenarios:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
927
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
928 1. A button is sized to accommodate its text, the text changes and the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
929 button should change size also.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
930
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
931 2. A button is given an explicit size. Its size should never change.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
932
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
933 3. Layout is put inside an area. The size of the area changes, the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
934 layout should change with it.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
935
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
936 4. A button grows to accommodate additional text. The whitespace
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
937 around it should be modified to cope with the new layout
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
938 requirements.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
939
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
940 5. A button grows. The area surrounding it should grow also if
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
941 possible.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
942
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
943 What metrics are important?
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
944 1. Actual width and height.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
945
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
946 2. Whether the width and height are what the widget actually wants, or
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
947 whether it can grow or shrink.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
948
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
949 Text glyphs are particularly troublesome since their metrics depend
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
950 on the context in which they are being viewed. For instance they
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
951 can appear differently depending on the window face, frame face or
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
952 glyph face. In order to simplify this text glyphs can now only have
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
953 a glyph-face or image-instance face. All other glyphs are
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
954 essentially fixed in appearance. Perhaps the problem is that text
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
955 glyphs are cached on a device basis like most other glyphs. Instead
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
956 they should be cached per-window and then the instance would be
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
957 fixed and we wouldn't have to mess around with font metrics and the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
958 rest. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
959
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
960 /* Query the geometry of a layout widget. We assume that we can only
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
961 get here if the size is not already fixed. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
962 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
963 layout_query_geometry (Lisp_Object image_instance, unsigned int* width,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
964 unsigned int* height, enum image_instance_geometry disp,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
965 Lisp_Object domain)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
966 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
967 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
968 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
969 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
970 unsigned int gheight, gwidth;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
971
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
972 /* First just set up what we already have. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
973 if (width) *width = IMAGE_INSTANCE_WIDTH (ii);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
974 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
975
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
976 /* If we are not allowed to dynamically size then return. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
977 if (!IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
978 &&
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
979 !IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
980 return;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
981
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
982 /* Pick up the border text if we have one. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
983 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
984 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
985 image_instance_query_geometry (XCAR (items), &gwidth, &gheight, disp, domain);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
986 ph_adjust = gheight / 2;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
987 items = XCDR (items);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
988 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
989
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
990 /* Flip through the items to work out how much stuff we have to display */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
991 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
992 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
993 Lisp_Object glyph = XCAR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
994 image_instance_query_geometry (glyph, &gwidth, &gheight, disp, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
995
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
996 nitems ++;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
997 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
998 == LAYOUT_HORIZONTAL)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
999 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1000 maxph = max (maxph, gheight);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1001 maxpw += gwidth;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1002 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1003 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1004 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1005 maxpw = max (maxpw, gwidth);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1006 maxph += gheight;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1007 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1008 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1009
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1010 /* Work out minimum space we need to fit all the items. This could
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1011 have been fixed by the user. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1012 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1013 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1014 Lisp_Object dynamic_width =
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1015 Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1016 if (INTP (dynamic_width))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1017 *width = XINT (dynamic_width);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1018 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1019 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1020 == LAYOUT_HORIZONTAL)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1021 *width = maxpw + (nitems + 1) * WIDGET_BORDER_WIDTH * 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1022 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1023 *width = maxpw + 2 * WIDGET_BORDER_WIDTH * 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1024
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1025 /* Work out vertical spacings. */
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1026 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1027 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1028 Lisp_Object dynamic_height =
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1029 Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1030 if (INTP (dynamic_height))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1031 *height = XINT (dynamic_height);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1032 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1033 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1034 == LAYOUT_VERTICAL)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1035 *height = maxph + (nitems + 1) * WIDGET_BORDER_HEIGHT * 2 + ph_adjust;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1036 else
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1037 *height = maxph + 2 * WIDGET_BORDER_HEIGHT * 2 + ph_adjust;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1038 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1039
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1040 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1041 layout_layout (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1042 unsigned int width, unsigned int height, Lisp_Object domain)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1043 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1044 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1045 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1046 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1047 int x, y, maxph = 0, maxpw = 0, nitems = 0,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1048 horiz_spacing, vert_spacing, ph_adjust = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1049 unsigned int gheight, gwidth;
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1050
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1051 /* Pick up the border text if we have one. */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1052 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1053 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1054 Lisp_Object border = XCAR (items);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1055 items = XCDR (items);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1056 image_instance_query_geometry (border, &gwidth, &gheight,
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1057 IMAGE_DESIRED_GEOMETRY, domain);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1058 /* #### Really, what should this be? */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1059 XIMAGE_INSTANCE_XOFFSET (border) = 10;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1060 XIMAGE_INSTANCE_YOFFSET (border) = 0;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1061 ph_adjust = gheight / 2;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1062 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1063
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1064 image_instance_layout (border, gwidth, gheight, domain);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1065 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1066
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1067 /* Flip through the items to work out how much stuff we have to display. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1068 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1069 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1070 Lisp_Object glyph = XCAR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1071
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1072 image_instance_query_geometry (glyph, &gwidth, &gheight,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1073 IMAGE_DESIRED_GEOMETRY, domain);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1074 nitems ++;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1075 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1076 == LAYOUT_HORIZONTAL)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1077 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1078 maxph = max (maxph, gheight);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1079 maxpw += gwidth;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1080 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1081 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1082 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1083 maxpw = max (maxpw, gwidth);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1084 maxph += gheight;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1085 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1086 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1087
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1088 /* work out spacing between items and bounds of the layout */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1089 if (width < maxpw)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1090 /* The user wants a smaller space than the largest item, so we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1091 just provide default spacing and will let the output routines
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1092 clip.. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1093 horiz_spacing = WIDGET_BORDER_WIDTH * 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1094 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1095 == LAYOUT_HORIZONTAL)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1096 /* We have a larger area to display in so distribute the space
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1097 evenly. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1098 horiz_spacing = (width - maxpw) / (nitems + 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1099 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1100 horiz_spacing = (width - maxpw) / 2;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1101
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1102 if (height < maxph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1103 vert_spacing = WIDGET_BORDER_HEIGHT * 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1104 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1105 == LAYOUT_VERTICAL)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1106 vert_spacing = (height - (maxph + ph_adjust)) / (nitems + 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1107 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1108 vert_spacing = (height - (maxph + ph_adjust)) / 2;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1109
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1110 y = vert_spacing + ph_adjust;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1111 x = horiz_spacing;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1112
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1113 /* Now flip through putting items where we want them, paying
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1114 attention to justification. Make sure we don't mess with the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1115 border glyph. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1116 LIST_LOOP (rest, items)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1117 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1118 Lisp_Object glyph = XCAR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1119
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1120 image_instance_query_geometry (glyph, &gwidth, &gheight,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1121 IMAGE_DESIRED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1122
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1123 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1124 == LAYOUT_HORIZONTAL)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1125 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1126 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1127 == LAYOUT_JUSTIFY_RIGHT)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1128 y = height - (gheight + vert_spacing);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1129 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1130 == LAYOUT_JUSTIFY_CENTER)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1131 y = (height - gheight) / 2;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1132 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1133 else
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1134 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1135 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1136 == LAYOUT_JUSTIFY_RIGHT)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1137 x = width - (gwidth + horiz_spacing);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1138 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1139 == LAYOUT_JUSTIFY_CENTER)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1140 x = (width - gwidth) / 2;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1141 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1142
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1143 XIMAGE_INSTANCE_XOFFSET (glyph) = x;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1144 XIMAGE_INSTANCE_YOFFSET (glyph) = y;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1145
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1146 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1147 == LAYOUT_HORIZONTAL)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1148 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1149 x += (gwidth + horiz_spacing);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1150 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1151 else
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1152 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1153 y += (gheight + vert_spacing);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1154 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1155
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1156 /* Now layout subwidgets if they require it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1157 image_instance_layout (glyph, gwidth, gheight, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1158 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1159 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1160
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1161
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1162 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1163 /* initialization */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1164 /************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1165
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1166 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1167 syms_of_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1168 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1169 defkeyword (&Q_descriptor, ":descriptor");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1170 defkeyword (&Q_height, ":height");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1171 defkeyword (&Q_width, ":width");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1172 defkeyword (&Q_properties, ":properties");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1173 defkeyword (&Q_items, ":items");
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1174 defkeyword (&Q_image, ":image");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1175 defkeyword (&Q_text, ":text");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1176 defkeyword (&Q_orientation, ":orientation");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1177 defkeyword (&Q_justify, ":justify");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1178 defkeyword (&Q_border, ":border");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1179
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1180 defsymbol (&Qetched_in, "etched-in");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1181 defsymbol (&Qetched_out, "etched-out");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1182 defsymbol (&Qbevel_in, "bevel-in");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1183 defsymbol (&Qbevel_out, "bevel-out");
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1184 defsymbol (&Qwidget_callback_current_channel, "widget-callback-current-channel");
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1185 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1186
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1187 #define VALID_GUI_KEYWORDS(type) do { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1188 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1189 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1190 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1191 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1192 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_selected, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1193 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1194 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1195 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1196 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1197 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1198 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1199 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1200 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback_ex, check_valid_callback); \
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1201 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1202 } while (0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1203
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1204 #define VALID_WIDGET_KEYWORDS(type) do { \
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1205 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1206 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1207 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int_or_function);\
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1208 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int_or_function);\
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1209 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1210 } while (0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1211
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1212
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1213 static void image_instantiator_widget (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1214 { /* we only do this for properties */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1215 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1216 IIFORMAT_HAS_METHOD (widget, property);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1217 IIFORMAT_HAS_METHOD (widget, set_property);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1218 IIFORMAT_HAS_METHOD (widget, query_geometry);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1219 IIFORMAT_HAS_METHOD (widget, layout);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1220 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1221
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1222 static void image_instantiator_buttons (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1223 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1224 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1225 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1226 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1227 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1228 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1229 IIFORMAT_HAS_METHOD (button, query_geometry);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1230 IIFORMAT_VALID_KEYWORD (button,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1231 Q_image, check_valid_glyph_or_instantiator);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1232 VALID_WIDGET_KEYWORDS (button);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1233 VALID_GUI_KEYWORDS (button);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1234 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1235
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1236 static void image_instantiator_edit_fields (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1237 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1238 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1239 IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1240 IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1241 IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1242 VALID_WIDGET_KEYWORDS (edit_field);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1243 VALID_GUI_KEYWORDS (edit_field);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1244 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1245
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1246 static void image_instantiator_combo_box (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1247 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1248 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1249 IIFORMAT_HAS_METHOD (combo_box, validate);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1250 IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1251 VALID_GUI_KEYWORDS (combo_box);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1252
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1253 IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1254 IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1255 IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int_or_function);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1256 IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1257 IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1258 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1259
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1260 static void image_instantiator_scrollbar (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1261 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1262 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1263 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1264 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1265 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1266 VALID_GUI_KEYWORDS (scrollbar);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1267
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1268 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int_or_function);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1269 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int_or_function);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1270 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1271 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1272
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1273 static void image_instantiator_progress_guage (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1274 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1275 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1276 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1277 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1278 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1279 IIFORMAT_HAS_METHOD (progress_gauge, set_property);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1280 VALID_WIDGET_KEYWORDS (progress_gauge);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1281 VALID_GUI_KEYWORDS (progress_gauge);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1282 }
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1283
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1284 static void image_instantiator_tree_view (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1285 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1286 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1287 IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1288 IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1289 IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1290 IIFORMAT_HAS_METHOD (tree_view, query_geometry);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1291 VALID_WIDGET_KEYWORDS (tree_view);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1292 VALID_GUI_KEYWORDS (tree_view);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1293 IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1294 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1295
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1296 static void image_instantiator_tab_control (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1297 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1298 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1299 IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1300 IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1301 IIFORMAT_HAS_SHARED_METHOD (tab_control, instantiate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1302 IIFORMAT_HAS_METHOD (tab_control, query_geometry);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1303 IIFORMAT_HAS_METHOD (tab_control, set_property);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1304 VALID_WIDGET_KEYWORDS (tab_control);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1305 VALID_GUI_KEYWORDS (tab_control);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1306 IIFORMAT_VALID_KEYWORD (tab_control, Q_orientation, check_valid_tab_orientation);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1307 IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1308 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1309
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1310 static void image_instantiator_labels (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1311 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1312 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1313 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1314 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, widget);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1315 VALID_WIDGET_KEYWORDS (label);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
1316 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1317 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1318
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1319 static void image_instantiator_layout (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1320 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1321 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1322 IIFORMAT_HAS_METHOD (layout, possible_dest_types);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1323 IIFORMAT_HAS_SHARED_METHOD (layout, instantiate, widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1324 IIFORMAT_HAS_METHOD (layout, normalize);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1325 IIFORMAT_HAS_METHOD (layout, query_geometry);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1326 IIFORMAT_HAS_METHOD (layout, layout);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1327 VALID_WIDGET_KEYWORDS (layout);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1328 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1329 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1330 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1331 IIFORMAT_VALID_KEYWORD (layout, Q_items,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1332 check_valid_glyph_or_instantiator_list);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1333 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1334
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1335 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1336 image_instantiator_format_create_glyphs_widget (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1337 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1338 image_instantiator_widget();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1339 image_instantiator_buttons();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1340 image_instantiator_edit_fields();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1341 image_instantiator_combo_box();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1342 image_instantiator_scrollbar();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1343 image_instantiator_progress_guage();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1344 image_instantiator_tree_view();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1345 image_instantiator_tab_control();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1346 image_instantiator_labels();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1347 image_instantiator_layout();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1348 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1349
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1350 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1351 reinit_vars_of_glyphs_widget (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1352 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1353 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1354 debug_widget_instances = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1355 #endif
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1356 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1357
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1358 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1359 vars_of_glyphs_widget (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1360 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1361 reinit_vars_of_glyphs_widget ();
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1362
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1363 DEFVAR_LISP ("widget-callback-current-channel", &Vwidget_callback_current_channel /*
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1364 The domain that is current when a widget callback is invoked.
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1365 This is invariably the frame that the widget is instantiated in.
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1366 */);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1367 Vwidget_callback_current_channel = Qnil;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1368 }