annotate src/glyphs-widget.c @ 444:576fb035e263 r21-2-37

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