annotate src/glyphs-widget.c @ 398:74fd4e045ea6 r21-2-29

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