annotate lwlib/lwlib.c @ 78:c7528f8e288d r20-0b34

Import from CVS: tag r20-0b34
author cvs
date Mon, 13 Aug 2007 09:05:42 +0200
parents 131b0175ea99
children 1ce6082ce73f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* A general interface to the widgets of different toolkits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Lucid, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of the Lucid Widget Library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 The Lucid Widget Library is free software; you can redistribute it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 modify it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 The Lucid Widget Library is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #ifdef NeXT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #undef __STRICT_BSD__ /* ick */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <unistd.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #include <sys/types.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "lwlib-internal.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "lwlib-utils.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #if defined(__GNUC__) && !defined(alloca)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #define alloca __builtin_alloca
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
38 #if ((!__GNUC__) && !defined(__hpux)) && !defined(_AIX) && !defined (_SCO_DS) && !defined (__USLC__) && !defined(sinix)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include <alloca.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #ifdef __SUNPRO_C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 void *__builtin_alloca (unsigned int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #if defined(_AIX)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #pragma alloca
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #ifdef BROKEN_SUNOS_HEADERS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 extern void * memset (void *, int, int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 extern int strcasecmp (char *, char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 extern int fprintf (FILE *, CONST char *, ...);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #include "lwlib-Xlw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 #include "lwlib-Xm.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #include "lwlib-Xaw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 /* #### Does a check need to be put back in here to make sure we have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 sufficient defines to function properly or are the checks in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 makefile sufficient? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 /* List of all widgets managed by the library. Note that each "widget"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 listed here may actually be a tree of widgets; for example, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 single entry here might represent a single menubar or popup menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 each of which might be implemented with a tree of widgets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 static widget_info *all_widget_info = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 /* Forward declarations */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 instantiate_widget_instance (widget_instance *instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 /* utility functions for widget_instance and widget_info */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 safe_strdup (CONST char *s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 char *result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 if (! s) return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 result = (char *) malloc (strlen (s) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 if (! result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 strcpy (result, s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 safe_free_str (char *s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 if (s) free (s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 static widget_value *widget_value_free_list = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 malloc_widget_value (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 widget_value *wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 if (widget_value_free_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 wv = widget_value_free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 widget_value_free_list = wv->free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 wv->free_list = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 wv = (widget_value *) malloc (sizeof (widget_value));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 if (wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 memset (wv, 0, sizeof (widget_value));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 return wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 /* this is analogous to free(). It frees only what was allocated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 by malloc_widget_value(), and no substructures.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 free_widget_value (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 if (wv->free_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 wv->free_list = widget_value_free_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 widget_value_free_list = wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 static void free_widget_value_tree (widget_value *wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 free_widget_value_contents (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 if (wv->name) free (wv->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 if (wv->value) free (wv->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 if (wv->key) free (wv->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 /* #### - all of this 0xDEADBEEF stuff should be unnecessary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 in production code... it should be conditionalized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 if (wv->toolkit_data && wv->free_toolkit_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 free (wv->toolkit_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 wv->toolkit_data = (void *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 if (wv->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 free (wv->scrollbar_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 wv->scrollbar_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 if (wv->contents && (wv->contents != (widget_value*)1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 free_widget_value_tree (wv->contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 wv->contents = (widget_value *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 if (wv->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 free_widget_value_tree (wv->next);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 wv->next = (widget_value *) 0xDEADBEEF;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 free_widget_value_tree (widget_value *wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 if (!wv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 free_widget_value_contents (wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 free_widget_value (wv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 copy_scrollbar_values (widget_value *val, widget_value *copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 if (!copy->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 copy->scrollbar_data =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (scrollbar_values *) malloc (sizeof (scrollbar_values));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 if (val->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 *copy->scrollbar_data = *val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 memset (copy->scrollbar_data, 0, sizeof (scrollbar_values));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 * Return true if old->scrollbar_data were not equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 * to new->scrollbar_data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 merge_scrollbar_values (widget_value *old, widget_value *new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 Boolean changed = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 if (new->scrollbar_data && !old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 copy_scrollbar_values (new, old);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 changed = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 else if (!new->scrollbar_data && old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 free (old->scrollbar_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 old->scrollbar_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 else if (new->scrollbar_data && old->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 scrollbar_values *old_sb = old->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 scrollbar_values *new_sb = new->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 #define FROB(field) if (old_sb->field != new_sb->field) changed = True
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 FROB (line_increment);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 FROB (page_increment);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 FROB (minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 FROB (maximum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 FROB (slider_size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 FROB (slider_position);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 FROB (scrollbar_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 FROB (scrollbar_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 FROB (scrollbar_x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 FROB (scrollbar_y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 #undef FROB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 *old_sb = *new_sb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 return changed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 #endif /* NEED_SCROLLBARS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 /* Make a complete copy of a widget_value tree. Store CHANGE into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 the widget_value tree's `change' field. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 static widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 copy_widget_value_tree (widget_value *val, change_type change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 widget_value *copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 if (!val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 if (val == (widget_value *) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 copy = malloc_widget_value ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 if (copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 /* #### - don't seg fault *here* if out of memory. Menus will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 truncated inexplicably. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 copy->type = val->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 copy->name = safe_strdup (val->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 copy->value = safe_strdup (val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 copy->key = safe_strdup (val->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 copy->enabled = val->enabled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 copy->selected = val->selected;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 copy->edited = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 copy->change = change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 copy->contents = copy_widget_value_tree (val->contents, change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 copy->call_data = val->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 copy->next = copy_widget_value_tree (val->next, change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 copy->toolkit_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 copy->free_toolkit_data = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 copy_scrollbar_values (val, copy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 return copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 /* This function is used to implement incremental menu construction. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 replace_widget_value_tree (widget_value *node, widget_value *newtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 widget_value *copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 if (!node || !newtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 copy = copy_widget_value_tree (newtree, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 free_widget_value_contents (node);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 *node = *copy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 free_widget_value (copy); /* free the node, but not its contents. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 return node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 static widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 allocate_widget_info (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 lw_callback pre_activate_cb, lw_callback selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 widget_info *info = (widget_info *) malloc (sizeof (widget_info));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 info->type = safe_strdup (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 info->name = safe_strdup (name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 info->id = id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 info->val = copy_widget_value_tree (val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 info->busy = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 info->pre_activate_cb = pre_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 info->selection_cb = selection_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 info->post_activate_cb = post_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 info->instances = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 info->next = all_widget_info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 all_widget_info = info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 return info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 free_widget_info (widget_info *info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 safe_free_str (info->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 safe_free_str (info->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 free_widget_value_tree (info->val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 free (info);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 widget_instance *instance = (widget_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 /* be very conservative */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 if (instance->widget == widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 instance->widget = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 static widget_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 allocate_widget_instance (widget_info *info, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 widget_instance *instance =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (widget_instance *) malloc (sizeof (widget_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 instance->parent = parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 instance->pop_up_p = pop_up_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 instance->info = info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 instance->next = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 info->instances = instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 instantiate_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 XtAddCallback (instance->widget, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 mark_widget_destroyed, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 free_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 memset ((void *) instance, 0xDEADBEEF, sizeof (widget_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 free (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 static widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 get_widget_info (LWLIB_ID id, Boolean remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 widget_info *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 for (prev = NULL, info = all_widget_info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 prev = info, info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 if (info->id == id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 if (remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 prev->next = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 all_widget_info = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 return info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 /* Internal function used by the library dependent implementation to get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 widget_value for a given widget in an instance */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 widget_info *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 lw_get_widget_info (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 return get_widget_info (id, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 map_widget_values (widget_value *value, int (*mapfunc) (widget_value *value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 void *closure),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 void *closure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 int retval = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 if (value->contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 retval = map_widget_values (value->contents, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 if (retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 if (value->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 retval = map_widget_values (value->next, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 if (retval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 return (mapfunc) (value, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 lw_map_widget_values (LWLIB_ID id, int (*mapfunc) (widget_value *value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 void *closure),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 void *closure)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 widget_info *info = get_widget_info (id, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 if (info->val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 return map_widget_values (info->val, mapfunc, closure);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 static widget_instance *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 get_widget_instance (Widget widget, Boolean remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 widget_instance *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 for (info = all_widget_info; info; info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 for (prev = NULL, instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 prev = instance, instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 if (instance->widget == widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 if (remove_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 prev->next = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 info->instances = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 return (widget_instance *) 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 static widget_instance*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 if (instance->parent == parent && instance->pop_up_p == pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 /* utility function for widget_value */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 safe_strcmp (CONST char *s1, CONST char *s2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 if (!!s1 ^ !!s2) return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
478 static change_type
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
479 max (change_type i1, change_type i2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 {
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
481 return (int)i1 > (int)i2 ? i1 : i2;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 # define EXPLAIN(name, oc, nc, desc, a1, a2) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 printf ("Change: \"%s\"\tmax(%s=%d,%s=%d)\t%s %d %d\n", \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 name, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (oc == NO_CHANGE ? "none" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (oc == INVISIBLE_CHANGE ? "invisible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (oc == VISIBLE_CHANGE ? "visible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (oc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 oc, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (nc == NO_CHANGE ? "none" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (nc == INVISIBLE_CHANGE ? "invisible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (nc == VISIBLE_CHANGE ? "visible" : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 nc, desc, a1, a2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 # define EXPLAIN(name, oc, nc, desc, a1, a2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 static widget_value *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 merge_widget_value (widget_value *val1, widget_value *val2, int level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 change_type change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 widget_value *merged_next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 widget_value *merged_contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 if (!val1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 if (val2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 return copy_widget_value_tree (val2, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 if (!val2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 free_widget_value_tree (val1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 if (val1->type != val2->type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "type change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 val1->type, val2->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 val1->type = val2->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 if (safe_strcmp (val1->name, val2->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "name change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 val1->name, val2->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 safe_free_str (val1->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 val1->name = safe_strdup (val2->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 if (safe_strcmp (val1->value, val2->value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "value change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 val1->value, val2->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 safe_free_str (val1->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 val1->value = safe_strdup (val2->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 if (safe_strcmp (val1->key, val2->key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "key change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 val1->key, val2->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 safe_free_str (val1->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 val1->key = safe_strdup (val2->key);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 if (val1->enabled != val2->enabled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "enablement change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 val1->enabled, val2->enabled);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 val1->enabled = val2->enabled;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 if (val1->selected != val2->selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "selection change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 val1->selected, val2->selected);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 val1->selected = val2->selected;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 if (val1->call_data != val2->call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "call-data change",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 val1->call_data, val2->call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 val1->call_data = val2->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 #ifdef NEED_SCROLLBARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 if (merge_scrollbar_values (val1, val2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "scrollbar change", 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 change = max (change, VISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 if (level > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 merged_contents =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 merge_widget_value (val1->contents, val2->contents, level - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 if (val1->contents && !merged_contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents gone)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 else if (merged_contents && merged_contents->change != NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents change)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 change = max (change, INVISIBLE_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 val1->contents = merged_contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 merged_next = merge_widget_value (val1->next, val2->next, level);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 if (val1->next && !merged_next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(following gone)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 change = max (change, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 else if (merged_next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 if (merged_next->change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 EXPLAIN (val1->name, change, merged_next->change, "(following change)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 change = max (change, merged_next->change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 val1->next = merged_next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 val1->change = change;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 if (change > NO_CHANGE && val1->toolkit_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 if (val1->free_toolkit_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 free (val1->toolkit_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 val1->toolkit_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 return val1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 /* modifying the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 name_to_widget (widget_instance *instance, CONST char *name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 Widget widget = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 if (!strcmp (XtName (instance->widget), name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 int length = strlen (name) + 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 char *real_name = (char *) alloca (length);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 real_name [0] = '*';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 strcpy (real_name + 1, name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 widget = XtNameToWidget (instance->widget, real_name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 set_one_value (widget_instance *instance, widget_value *val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 Widget widget = name_to_widget (instance, val->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 xlw_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 xm_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 xaw_update_one_widget (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 update_one_widget_instance (widget_instance *instance, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 /* the widget was destroyed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 if (val->change != NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 set_one_value (instance, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 update_all_widget_values (widget_info *info, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 update_one_widget_instance (instance, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 for (val = info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 val->change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 lw_modify_all_widgets (LWLIB_ID id, widget_value *val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 widget_value *new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 widget_value *next_new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 widget_value *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 widget_value *prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 widget_value *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 int found;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 for (new_val = val; new_val; new_val = new_val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 next_new_val = new_val->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 new_val->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 found = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 for (prev = NULL, cur = info->val; cur; prev = cur, cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 if (!strcmp (cur->name, new_val->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 found = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 next = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 cur->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 cur = merge_widget_value (cur, new_val, deep_p ? 1000 : 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 prev->next = cur ? cur : next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 info->val = cur ? cur : next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 if (cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 cur->next = next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 if (!found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 /* Could not find it, add it */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 prev->next = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 info->val = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 new_val->next = next_new_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 update_all_widget_values (info, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 /* creating the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 initialize_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 val->change = STRUCTURAL_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 update_one_widget_instance (instance, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 for (val = instance->info->val; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 val->change = NO_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 static widget_creation_function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 find_in_table (CONST char *type, widget_creation_entry *table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 widget_creation_entry *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 for (cur = table; cur->type; cur++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 if (!strcasecmp (type, cur->type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 return cur->function;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 dialog_spec_p (CONST char *name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 /* return True if name matches [EILPQeilpq][1-9][Bb] or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 [EILPQeilpq][1-9][Bb][Rr][1-9] */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 if (!name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 switch (name [0])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 case 'E': case 'I': case 'L': case 'P': case 'Q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 case 'e': case 'i': case 'l': case 'p': case 'q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 if (name [1] >= '0' && name [1] <= '9')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 if (name [2] != 'B' && name [2] != 'b')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 if (!name [3])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 if ((name [3] == 'T' || name [3] == 't') && !name [4])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 if ((name [3] == 'R' || name [3] == 'r')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 && name [4] >= '0' && name [4] <= '9' && !name [5])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 instantiate_widget_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 widget_creation_function function = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 function = find_in_table (instance->info->type, xlw_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 function = find_in_table (instance->info->type, xm_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 function = find_in_table (instance->info->type, xaw_creation_table);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 if (dialog_spec_p (instance->info->type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 function = xm_create_dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 #ifdef DIALOGS_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 function = xaw_create_dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 #ifdef DIALOGS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 /* not yet (not ever?) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 if (!function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 fprintf (stderr, "No creation function for widget type %s\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 instance->info->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 instance->widget = (*function) (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 /* XtRealizeWidget (instance->widget);*/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 lw_register_widget (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 lw_callback pre_activate_cb, lw_callback selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 if (!get_widget_info (id, False))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 post_activate_cb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 instance = find_instance (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 return instance ? instance->widget : NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 instance = find_instance (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 instance = allocate_widget_instance (info, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 initialize_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 if (!instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 return instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 lw_create_widget (CONST char *type, CONST char *name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 LWLIB_ID id, widget_value *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 Widget parent, Boolean pop_up_p, lw_callback pre_activate_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 lw_callback selection_cb, lw_callback post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 post_activate_cb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 return lw_make_widget (id, parent, pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 /* destroying the widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 destroy_one_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 /* Remove the destroy callback on the widget; that callback will try to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 dereference the instance object (to set its widget slot to 0, since the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 widget is dead.) Since the instance is now dead, we don't have to worry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 about the fact that its widget is dead too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 This happens in the Phase2Destroy of the widget, so this callback would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 not have been run until arbitrarily long after the instance was freed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 if (instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 XtRemoveCallback (instance->widget, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 mark_widget_destroyed, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 if (instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 /* The else are pretty tricky here, including the empty statement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 at the end because it would be very bad to destroy a widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 twice. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 xlw_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 xm_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 xaw_destroy_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 /* do not remove the empty statement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 free_widget_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 lw_destroy_widget (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 widget_instance *instance = get_widget_instance (w, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 if (instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 widget_info *info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 /* instance has already been removed from the list; free it */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 destroy_one_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 /* if there are no instances left, free the info too */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 if (!info->instances)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 lw_destroy_all_widgets (info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 lw_destroy_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 widget_info *info = get_widget_info (id, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 widget_instance *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 for (instance = info->instances; instance; )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 next = instance->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 destroy_one_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 instance = next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 free_widget_info (info);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 lw_destroy_everything ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 while (all_widget_info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 lw_destroy_all_widgets (all_widget_info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 lw_destroy_all_pop_ups ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 widget_info *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 for (info = all_widget_info; info; info = next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 next = info->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 if (instance && instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 lw_destroy_all_widgets (info->id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 lw_raise_all_pop_up_widgets (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 Widget result = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 for (info = all_widget_info; info; info = info->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 if (instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 if (XtIsManaged (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 /* What a complete load of crap!!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 When a dialogShell is on the screen, it is not managed!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 || (lw_motif_widget_p (instance->widget) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 XtIsManaged (first_child (widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 if (!result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 result = widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 XMapRaised (XtDisplay (widget), XtWindow (widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 lw_pop_all_widgets (LWLIB_ID id, Boolean up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 if (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 for (instance = info->instances; instance; instance = instance->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 if (instance->pop_up_p && instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 xlw_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 xm_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 XtRealizeWidget (XtParent (instance->widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 XtRealizeWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 xaw_pop_instance (instance, up);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 lw_pop_up_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 lw_pop_all_widgets (id, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 lw_pop_down_all_widgets (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 lw_pop_all_widgets (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 lw_popup_menu (Widget widget, XEvent *event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 if (lw_lucid_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 xlw_popup_menu (widget, event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 if (lw_motif_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 xm_popup_menu (widget, event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 #ifdef MENUBARS_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 if (lw_xaw_widget_p (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 xaw_popup_menu (widget, event); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 /* get the values back */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 get_one_value (widget_instance *instance, widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 Widget widget = name_to_widget (instance, val->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 #ifdef NEED_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 if (lw_lucid_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 xlw_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 #ifdef NEED_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 if (lw_motif_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 xm_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 #ifdef NEED_ATHENA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 if (lw_xaw_widget_p (instance->widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 xaw_update_one_value (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 lw_get_some_values (LWLIB_ID id, widget_value *val_out)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 widget_instance *instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 Boolean result = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 if (!info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 instance = info->instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 for (val = val_out; val; val = val->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 if (get_one_value (instance, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 result = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 widget_value*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 lw_get_all_values (LWLIB_ID id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 widget_info *info = get_widget_info (id, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 widget_value *val = info->val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 if (lw_get_some_values (id, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 /* internal function used by the library dependent implementation to get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 widget_value for a given widget in an instance */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 widget_value*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 lw_get_widget_value_for_widget (widget_instance *instance, Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 char *name = XtName (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 widget_value *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 for (cur = instance->info->val; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 if (!strcmp (cur->name, name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 return cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 /* update other instances value when one thing changed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 /* This function can be used as a an XtCallback for the widgets that get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 modified to update other instances of the widgets. Closure should be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 widget_instance. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 lw_internal_update_other_instances (Widget widget, XtPointer closure,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 /* To forbid recursive calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 static Boolean updating;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 widget_instance *instance = (widget_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 char *name = XtName (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 widget_instance *cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 widget_value *val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 /* never recurse as this could cause infinite recursions. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 if (updating)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 /* protect against the widget being destroyed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 if (XtWidgetBeingDestroyedP (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 /* Return immediately if there are no other instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 if (!info->instances->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 updating = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 for (val = info->val; val && strcmp (val->name, name); val = val->next);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 if (val && get_one_value (instance, val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 for (cur = info->instances; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 if (cur != instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 set_one_value (cur, val, True);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 updating = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 /* get the id */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 LWLIB_ID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 lw_get_widget_id (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 widget_instance *instance = get_widget_instance (w, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 return instance ? instance->info->id : 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 /* set the keyboard focus */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 lw_set_keyboard_focus (Widget parent, Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1256 #if defined(NEED_MOTIF) && !defined(LESSTIF_VERSION)
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1257 /* This loses with Lesstif v0.75a */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 xm_set_keyboard_focus (parent, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 XtSetKeyboardFocus (parent, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 /* Show busy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 show_one_widget_busy (Widget w, Boolean flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 Pixel foreground = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 Pixel background = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 Widget widget_to_invert = XtNameToWidget (w, "*sheet");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 if (!widget_to_invert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 widget_to_invert = w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 XtVaGetValues (widget_to_invert,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 XtNforeground, &foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 XtNbackground, &background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 XtVaSetValues (widget_to_invert,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 XtNforeground, background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 XtNbackground, foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 lw_show_busy (Widget w, Boolean busy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 widget_instance *instance = get_widget_instance (w, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 widget_info *info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 widget_instance *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 if (instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 info = instance->info;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 if (info->busy != busy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 for (next = info->instances; next; next = next->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 if (next->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 show_one_widget_busy (next->widget, busy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 info->busy = busy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 }