Mercurial > emacs
annotate lwlib/lwlib.c @ 89402:e6b8ccf4cfa2
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 14 Mar 2003 07:58:54 +0000 |
parents | 6ab7bfc7590d |
children |
rev | line source |
---|---|
5626 | 1 /* A general interface to the widgets of different toolkits. |
2 Copyright (C) 1992, 1993 Lucid, Inc. | |
3 | |
4 This file is part of the Lucid Widget Library. | |
5 | |
6 The Lucid Widget Library is free software; you can redistribute it and/or | |
7 modify it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 The Lucid Widget Library is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14163
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14163
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
5626 | 20 |
21 #ifdef NeXT | |
22 #undef __STRICT_BSD__ /* ick */ | |
23 #endif | |
24 | |
26087
e0d966fb548f
Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents:
25718
diff
changeset
|
25 #ifdef HAVE_CONFIG_H |
e0d966fb548f
Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents:
25718
diff
changeset
|
26 #include <config.h> |
e0d966fb548f
Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents:
25718
diff
changeset
|
27 #endif |
e0d966fb548f
Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents:
25718
diff
changeset
|
28 |
41765
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
29 #include "../src/lisp.h" |
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
30 |
5626 | 31 #include <sys/types.h> |
32 #include <stdio.h> | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
33 #include <ctype.h> |
5627
7ff2d6076466
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
34 #include "lwlib-int.h" |
5626 | 35 #include "lwlib-utils.h" |
5706
75570af32e92
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5627
diff
changeset
|
36 #include <X11/StringDefs.h> |
5626 | 37 |
38 #if defined (USE_LUCID) | |
39 #include "lwlib-Xlw.h" | |
40 #endif | |
41 #if defined (USE_MOTIF) | |
42 #include "lwlib-Xm.h" | |
6306
19fc40b33f52
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6305
diff
changeset
|
43 #else /* not USE_MOTIF */ |
19fc40b33f52
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6305
diff
changeset
|
44 #if defined (USE_LUCID) |
19fc40b33f52
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6305
diff
changeset
|
45 #define USE_XAW |
19fc40b33f52
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6305
diff
changeset
|
46 #endif /* not USE_MOTIF && USE_LUCID */ |
5626 | 47 #endif |
48 #if defined (USE_OLIT) | |
49 #include "lwlib-Xol.h" | |
50 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
51 #if defined (USE_XAW) |
21391 | 52 #include <X11/Xaw/Paned.h> |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
53 #include "lwlib-Xaw.h" |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
54 #endif |
5626 | 55 |
56 #if !defined (USE_LUCID) && !defined (USE_MOTIF) && !defined (USE_OLIT) | |
57 ERROR! At least one of USE_LUCID, USE_MOTIF or USE_OLIT must be defined. | |
58 #endif | |
59 | |
60 #if defined (USE_MOTIF) && defined (USE_OLIT) | |
61 ERROR! no more than one of USE_MOTIF and USE_OLIT may be defined. | |
62 #endif | |
63 | |
8785 | 64 #ifndef max |
65 #define max(x, y) ((x) > (y) ? (x) : (y)) | |
66 #endif | |
67 | |
5626 | 68 /* List of all widgets managed by the library. */ |
69 static widget_info* | |
70 all_widget_info = NULL; | |
71 | |
12187
18d061c3d0dd
(lwlib_toolkit_type): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
11861
diff
changeset
|
72 #ifdef USE_MOTIF |
18d061c3d0dd
(lwlib_toolkit_type): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
11861
diff
changeset
|
73 char *lwlib_toolkit_type = "motif"; |
18d061c3d0dd
(lwlib_toolkit_type): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
11861
diff
changeset
|
74 #else |
18d061c3d0dd
(lwlib_toolkit_type): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
11861
diff
changeset
|
75 char *lwlib_toolkit_type = "lucid"; |
18d061c3d0dd
(lwlib_toolkit_type): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
11861
diff
changeset
|
76 #endif |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
77 |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
78 static widget_value *merge_widget_value P_ ((widget_value *, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
79 widget_value *, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
80 int, int *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
81 static void instantiate_widget_instance P_ ((widget_instance *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
82 static int my_strcasecmp P_ ((char *, char *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
83 static void safe_free_str P_ ((char *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
84 static void free_widget_value_tree P_ ((widget_value *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
85 static widget_value *copy_widget_value_tree P_ ((widget_value *, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
86 change_type)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
87 static widget_info *allocate_widget_info P_ ((char *, char *, LWLIB_ID, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
88 widget_value *, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
89 lw_callback, lw_callback, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
90 lw_callback, lw_callback)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
91 static void free_widget_info P_ ((widget_info *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
92 static void mark_widget_destroyed P_ ((Widget, XtPointer, XtPointer)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
93 static widget_instance *allocate_widget_instance P_ ((widget_info *, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
94 Widget, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
95 static void free_widget_instance P_ ((widget_instance *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
96 static widget_info *get_widget_info P_ ((LWLIB_ID, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
97 static widget_instance *get_widget_instance P_ ((Widget, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
98 static widget_instance *find_instance P_ ((LWLIB_ID, Widget, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
99 static Boolean safe_strcmp P_ ((char *, char *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
100 static Widget name_to_widget P_ ((widget_instance *, char *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
101 static void set_one_value P_ ((widget_instance *, widget_value *, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
102 static void update_one_widget_instance P_ ((widget_instance *, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
103 static void update_all_widget_values P_ ((widget_info *, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
104 static void initialize_widget_instance P_ ((widget_instance *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
105 static widget_creation_function find_in_table P_ ((char *, widget_creation_entry *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
106 static Boolean dialog_spec_p P_ ((char *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
107 static void instantiate_widget_instance P_ ((widget_instance *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
108 static void destroy_one_instance P_ ((widget_instance *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
109 static void lw_pop_all_widgets P_ ((LWLIB_ID, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
110 static Boolean get_one_value P_ ((widget_instance *, widget_value *)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
111 static void show_one_widget_busy P_ ((Widget, Boolean)); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
112 |
21391 | 113 void |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
114 lwlib_memset (address, value, length) |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
115 char *address; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
116 int value; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
117 int length; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
118 { |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
119 int i; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
120 |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
121 for (i = 0; i < length; i++) |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
122 address[i] = value; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
123 } |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
124 |
21391 | 125 void |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
126 lwlib_bcopy (from, to, length) |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
127 char *from; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
128 char *to; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
129 int length; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
130 { |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
131 int i; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
132 |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
133 for (i = 0; i < length; i++) |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
134 to[i] = from[i]; |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
135 } |
5626 | 136 /* utility functions for widget_instance and widget_info */ |
7423
4a5d0d109242
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6333
diff
changeset
|
137 char * |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
138 safe_strdup (s) |
29468 | 139 const char *s; |
5626 | 140 { |
141 char *result; | |
142 if (! s) return 0; | |
143 result = (char *) malloc (strlen (s) + 1); | |
144 if (! result) | |
145 return 0; | |
146 strcpy (result, s); | |
147 return result; | |
148 } | |
149 | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
150 /* Like strcmp but ignore differences in case. */ |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
151 |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
152 static int |
5853 | 153 my_strcasecmp (s1, s2) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
154 char *s1, *s2; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
155 { |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
156 while (1) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
157 { |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
158 int c1 = *s1++; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
159 int c2 = *s2++; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
160 if (isupper (c1)) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
161 c1 = tolower (c1); |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
162 if (isupper (c2)) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
163 c2 = tolower (c2); |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
164 if (c1 != c2) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
165 return (c1 > c2 ? 1 : -1); |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
166 if (c1 == 0) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
167 return 0; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
168 } |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
169 } |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
170 |
5626 | 171 static void |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
172 safe_free_str (s) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
173 char *s; |
5626 | 174 { |
175 if (s) free (s); | |
176 } | |
177 | |
178 static widget_value *widget_value_free_list = 0; | |
5993
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
179 static int malloc_cpt = 0; |
5626 | 180 |
181 widget_value * | |
182 malloc_widget_value () | |
183 { | |
184 widget_value *wv; | |
185 if (widget_value_free_list) | |
186 { | |
187 wv = widget_value_free_list; | |
188 widget_value_free_list = wv->free_list; | |
189 wv->free_list = 0; | |
190 } | |
191 else | |
192 { | |
193 wv = (widget_value *) malloc (sizeof (widget_value)); | |
5993
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
194 malloc_cpt++; |
5626 | 195 } |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
196 lwlib_memset (wv, 0, sizeof (widget_value)); |
5626 | 197 return wv; |
198 } | |
199 | |
14163
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
200 /* this is analogous to free(). It frees only what was allocated |
5626 | 201 by malloc_widget_value(), and no substructures. |
202 */ | |
203 void | |
204 free_widget_value (wv) | |
205 widget_value *wv; | |
206 { | |
207 if (wv->free_list) | |
208 abort (); | |
5993
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
209 |
5999
b135bb2b4bfe
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5993
diff
changeset
|
210 if (malloc_cpt > 25) |
5993
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
211 { |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
212 /* When the number of already allocated cells is too big, |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
213 We free it. */ |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
214 free (wv); |
5999
b135bb2b4bfe
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5993
diff
changeset
|
215 malloc_cpt--; |
5993
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
216 } |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
217 else |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
218 { |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
219 wv->free_list = widget_value_free_list; |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
220 widget_value_free_list = wv; |
5feb28cb62c8
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5853
diff
changeset
|
221 } |
5626 | 222 } |
223 | |
224 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
225 free_widget_value_tree (wv) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
226 widget_value *wv; |
5626 | 227 { |
228 if (!wv) | |
229 return; | |
230 | |
231 if (wv->name) free (wv->name); | |
232 if (wv->value) free (wv->value); | |
233 if (wv->key) free (wv->key); | |
234 | |
41765
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
235 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; |
5626 | 236 |
237 if (wv->toolkit_data && wv->free_toolkit_data) | |
238 { | |
14611
69fca906f068
(free_widget_value_tree, merge_widget_value):
Karl Heuer <kwzh@gnu.org>
parents:
14594
diff
changeset
|
239 XtFree (wv->toolkit_data); |
5626 | 240 wv->toolkit_data = (void *) 0xDEADBEEF; |
241 } | |
242 | |
243 if (wv->contents && (wv->contents != (widget_value*)1)) | |
244 { | |
245 free_widget_value_tree (wv->contents); | |
246 wv->contents = (widget_value *) 0xDEADBEEF; | |
247 } | |
248 if (wv->next) | |
249 { | |
250 free_widget_value_tree (wv->next); | |
251 wv->next = (widget_value *) 0xDEADBEEF; | |
252 } | |
253 free_widget_value (wv); | |
254 } | |
255 | |
256 static widget_value * | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
257 copy_widget_value_tree (val, change) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
258 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
259 change_type change; |
5626 | 260 { |
261 widget_value* copy; | |
262 | |
263 if (!val) | |
264 return NULL; | |
265 if (val == (widget_value *) 1) | |
266 return val; | |
267 | |
268 copy = malloc_widget_value (); | |
269 copy->name = safe_strdup (val->name); | |
270 copy->value = safe_strdup (val->value); | |
271 copy->key = safe_strdup (val->key); | |
41765
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
272 copy->help = val->help; |
5626 | 273 copy->enabled = val->enabled; |
25036 | 274 copy->button_type = val->button_type; |
5626 | 275 copy->selected = val->selected; |
276 copy->edited = False; | |
277 copy->change = change; | |
14879
70f79ccb9875
(merge_widget_value): Set the this_one_change field.
Richard M. Stallman <rms@gnu.org>
parents:
14663
diff
changeset
|
278 copy->this_one_change = change; |
5626 | 279 copy->contents = copy_widget_value_tree (val->contents, change); |
280 copy->call_data = val->call_data; | |
281 copy->next = copy_widget_value_tree (val->next, change); | |
282 copy->toolkit_data = NULL; | |
283 copy->free_toolkit_data = False; | |
284 return copy; | |
285 } | |
286 | |
287 static widget_info * | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
288 allocate_widget_info (type, name, id, val, pre_activate_cb, |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
289 selection_cb, post_activate_cb, highlight_cb) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
290 char* type; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
291 char* name; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
292 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
293 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
294 lw_callback pre_activate_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
295 lw_callback selection_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
296 lw_callback post_activate_cb; |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
297 lw_callback highlight_cb; |
5626 | 298 { |
299 widget_info* info = (widget_info*)malloc (sizeof (widget_info)); | |
300 info->type = safe_strdup (type); | |
301 info->name = safe_strdup (name); | |
302 info->id = id; | |
303 info->val = copy_widget_value_tree (val, STRUCTURAL_CHANGE); | |
304 info->busy = False; | |
305 info->pre_activate_cb = pre_activate_cb; | |
306 info->selection_cb = selection_cb; | |
307 info->post_activate_cb = post_activate_cb; | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
308 info->highlight_cb = highlight_cb; |
5626 | 309 info->instances = NULL; |
310 | |
311 info->next = all_widget_info; | |
312 all_widget_info = info; | |
313 | |
314 return info; | |
315 } | |
316 | |
317 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
318 free_widget_info (info) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
319 widget_info* info; |
5626 | 320 { |
321 safe_free_str (info->type); | |
322 safe_free_str (info->name); | |
323 free_widget_value_tree (info->val); | |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
324 lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info)); |
5626 | 325 free (info); |
326 } | |
327 | |
328 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
329 mark_widget_destroyed (widget, closure, call_data) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
330 Widget widget; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
331 XtPointer closure; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
332 XtPointer call_data; |
5626 | 333 { |
334 widget_instance* instance = (widget_instance*)closure; | |
335 | |
336 /* be very conservative */ | |
337 if (instance->widget == widget) | |
338 instance->widget = NULL; | |
339 } | |
340 | |
341 static widget_instance * | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
342 allocate_widget_instance (info, parent, pop_up_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
343 widget_info* info; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
344 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
345 Boolean pop_up_p; |
5626 | 346 { |
347 widget_instance* instance = | |
348 (widget_instance*)malloc (sizeof (widget_instance)); | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
349 bzero (instance, sizeof *instance); |
5626 | 350 instance->parent = parent; |
351 instance->pop_up_p = pop_up_p; | |
352 instance->info = info; | |
353 instance->next = info->instances; | |
354 info->instances = instance; | |
355 | |
14163
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
356 instantiate_widget_instance (instance); |
5626 | 357 |
358 XtAddCallback (instance->widget, XtNdestroyCallback, | |
359 mark_widget_destroyed, (XtPointer)instance); | |
360 return instance; | |
361 } | |
362 | |
363 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
364 free_widget_instance (instance) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
365 widget_instance* instance; |
5626 | 366 { |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
367 lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance)); |
5626 | 368 free (instance); |
369 } | |
370 | |
371 static widget_info * | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
372 get_widget_info (id, remove_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
373 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
374 Boolean remove_p; |
5626 | 375 { |
376 widget_info* info; | |
377 widget_info* prev; | |
378 for (prev = NULL, info = all_widget_info; | |
379 info; | |
380 prev = info, info = info->next) | |
381 if (info->id == id) | |
382 { | |
383 if (remove_p) | |
384 { | |
385 if (prev) | |
386 prev->next = info->next; | |
387 else | |
388 all_widget_info = info->next; | |
389 } | |
390 return info; | |
391 } | |
392 return NULL; | |
393 } | |
394 | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
395 /* Internal function used by the library dependent implementation to get the |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
396 widget_value for a given widget in an instance */ |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
397 widget_info * |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6306
diff
changeset
|
398 lw_get_widget_info (id) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6306
diff
changeset
|
399 LWLIB_ID id; |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
400 { |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
401 return get_widget_info (id, 0); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
402 } |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
403 |
5626 | 404 static widget_instance * |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
405 get_widget_instance (widget, remove_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
406 Widget widget; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
407 Boolean remove_p; |
5626 | 408 { |
409 widget_info* info; | |
410 widget_instance* instance; | |
411 widget_instance* prev; | |
412 for (info = all_widget_info; info; info = info->next) | |
413 for (prev = NULL, instance = info->instances; | |
414 instance; | |
415 prev = instance, instance = instance->next) | |
416 if (instance->widget == widget) | |
417 { | |
418 if (remove_p) | |
419 { | |
420 if (prev) | |
421 prev->next = instance->next; | |
422 else | |
423 info->instances = instance->next; | |
424 } | |
425 return instance; | |
426 } | |
427 return (widget_instance *) 0; | |
428 } | |
429 | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
430 /* Value is a pointer to the widget_instance corresponding to |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
431 WIDGET, or null if WIDGET is not a lwlib widget. */ |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
432 |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
433 widget_instance * |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
434 lw_get_widget_instance (widget) |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
435 Widget widget; |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
436 { |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
437 return get_widget_instance (widget, False); |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
438 } |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
439 |
5626 | 440 static widget_instance* |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
441 find_instance (id, parent, pop_up_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
442 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
443 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
444 Boolean pop_up_p; |
5626 | 445 { |
446 widget_info* info = get_widget_info (id, False); | |
447 widget_instance* instance; | |
448 | |
449 if (info) | |
450 for (instance = info->instances; instance; instance = instance->next) | |
451 if (instance->parent == parent && instance->pop_up_p == pop_up_p) | |
452 return instance; | |
453 | |
454 return NULL; | |
455 } | |
456 | |
457 | |
458 /* utility function for widget_value */ | |
459 static Boolean | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
460 safe_strcmp (s1, s2) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
461 char* s1; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
462 char* s2; |
5626 | 463 { |
464 if (!!s1 ^ !!s2) return True; | |
465 return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2; | |
466 } | |
467 | |
468 | |
469 #if 0 | |
470 # define EXPLAIN(name, oc, nc, desc, a1, a2) \ | |
471 printf ("Change: \"%s\"\tmax(%s=%d,%s=%d)\t%s %d %d\n", \ | |
472 name, \ | |
473 (oc == NO_CHANGE ? "none" : \ | |
474 (oc == INVISIBLE_CHANGE ? "invisible" : \ | |
475 (oc == VISIBLE_CHANGE ? "visible" : \ | |
476 (oc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ | |
477 oc, \ | |
478 (nc == NO_CHANGE ? "none" : \ | |
479 (nc == INVISIBLE_CHANGE ? "invisible" : \ | |
480 (nc == VISIBLE_CHANGE ? "visible" : \ | |
481 (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ | |
482 nc, desc, a1, a2) | |
483 #else | |
484 # define EXPLAIN(name, oc, nc, desc, a1, a2) | |
485 #endif | |
486 | |
487 | |
488 static widget_value * | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
489 merge_widget_value (val1, val2, level, change_p) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
490 widget_value* val1; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
491 widget_value* val2; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
492 int level; |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
493 int *change_p; |
5626 | 494 { |
14879
70f79ccb9875
(merge_widget_value): Set the this_one_change field.
Richard M. Stallman <rms@gnu.org>
parents:
14663
diff
changeset
|
495 change_type change, this_one_change; |
5626 | 496 widget_value* merged_next; |
497 widget_value* merged_contents; | |
498 | |
499 if (!val1) | |
500 { | |
501 if (val2) | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
502 { |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
503 *change_p = 1; |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
504 return copy_widget_value_tree (val2, STRUCTURAL_CHANGE); |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
505 } |
5626 | 506 else |
507 return NULL; | |
508 } | |
509 if (!val2) | |
510 { | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
511 *change_p = 1; |
5626 | 512 free_widget_value_tree (val1); |
513 return NULL; | |
514 } | |
515 | |
516 change = NO_CHANGE; | |
517 | |
518 if (safe_strcmp (val1->name, val2->name)) | |
519 { | |
520 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "name change", | |
521 val1->name, val2->name); | |
522 change = max (change, STRUCTURAL_CHANGE); | |
523 safe_free_str (val1->name); | |
524 val1->name = safe_strdup (val2->name); | |
525 } | |
526 if (safe_strcmp (val1->value, val2->value)) | |
527 { | |
528 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "value change", | |
529 val1->value, val2->value); | |
530 change = max (change, VISIBLE_CHANGE); | |
531 safe_free_str (val1->value); | |
532 val1->value = safe_strdup (val2->value); | |
533 } | |
534 if (safe_strcmp (val1->key, val2->key)) | |
535 { | |
536 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "key change", | |
537 val1->key, val2->key); | |
538 change = max (change, VISIBLE_CHANGE); | |
539 safe_free_str (val1->key); | |
540 val1->key = safe_strdup (val2->key); | |
541 } | |
41765
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
542 if (! EQ (val1->help, val2->help)) |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
543 { |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
544 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "help change", |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
545 val1->help, val2->help); |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
546 change = max (change, VISIBLE_CHANGE); |
41765
27b70bc263d6
Include ../src/lisp.h. Don't declare xmalloc.
Richard M. Stallman <rms@gnu.org>
parents:
32040
diff
changeset
|
547 val1->help = val2->help; |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
548 } |
5626 | 549 if (val1->enabled != val2->enabled) |
550 { | |
551 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "enablement change", | |
552 val1->enabled, val2->enabled); | |
553 change = max (change, VISIBLE_CHANGE); | |
554 val1->enabled = val2->enabled; | |
555 } | |
25036 | 556 if (val1->button_type != val2->button_type) |
557 { | |
558 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "button type change", | |
559 val1->button_type, val2->button_type); | |
560 change = max (change, VISIBLE_CHANGE); | |
561 val1->button_type = val2->button_type; | |
562 } | |
5626 | 563 if (val1->selected != val2->selected) |
564 { | |
565 EXPLAIN (val1->name, change, VISIBLE_CHANGE, "selection change", | |
566 val1->selected, val2->selected); | |
567 change = max (change, VISIBLE_CHANGE); | |
568 val1->selected = val2->selected; | |
569 } | |
570 if (val1->call_data != val2->call_data) | |
571 { | |
572 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "call-data change", | |
573 val1->call_data, val2->call_data); | |
574 change = max (change, INVISIBLE_CHANGE); | |
575 val1->call_data = val2->call_data; | |
576 } | |
577 | |
578 if (level > 0) | |
579 { | |
580 merged_contents = | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
581 merge_widget_value (val1->contents, val2->contents, level - 1, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
582 change_p); |
5626 | 583 |
584 if (val1->contents && !merged_contents) | |
585 { | |
14163
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
586 /* This used to say INVISIBLE_CHANGE, |
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
587 but it is visible and vitally important when |
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
588 the contents of the menu bar itself are entirely deleted. |
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
589 |
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
590 But maybe it doesn't matter. This fails to fix the bug. */ |
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
591 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(contents gone)", |
5626 | 592 0, 0); |
14163
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
593 change = max (change, STRUCTURAL_CHANGE); |
5626 | 594 } |
595 else if (merged_contents && merged_contents->change != NO_CHANGE) | |
596 { | |
597 EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents change)", | |
598 0, 0); | |
599 change = max (change, INVISIBLE_CHANGE); | |
15854
184808f2a73c
(merge_widget_value): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
15790
diff
changeset
|
600 #if 0 /* This was replaced by the August 9 1996 change in lwlib-Xm.c. */ |
15790
fb5e87397205
(merge_widget_value) [USE_MOTIF]: Pass along the change flag from
Richard M. Stallman <rms@gnu.org>
parents:
15630
diff
changeset
|
601 #ifdef USE_MOTIF |
fb5e87397205
(merge_widget_value) [USE_MOTIF]: Pass along the change flag from
Richard M. Stallman <rms@gnu.org>
parents:
15630
diff
changeset
|
602 change = max (merged_contents->change, change); |
fb5e87397205
(merge_widget_value) [USE_MOTIF]: Pass along the change flag from
Richard M. Stallman <rms@gnu.org>
parents:
15630
diff
changeset
|
603 #endif |
15854
184808f2a73c
(merge_widget_value): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
15790
diff
changeset
|
604 #endif |
5626 | 605 } |
606 | |
607 val1->contents = merged_contents; | |
608 } | |
609 | |
14879
70f79ccb9875
(merge_widget_value): Set the this_one_change field.
Richard M. Stallman <rms@gnu.org>
parents:
14663
diff
changeset
|
610 this_one_change = change; |
70f79ccb9875
(merge_widget_value): Set the this_one_change field.
Richard M. Stallman <rms@gnu.org>
parents:
14663
diff
changeset
|
611 |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
612 merged_next = merge_widget_value (val1->next, val2->next, level, change_p); |
5626 | 613 |
614 if (val1->next && !merged_next) | |
615 { | |
616 EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(following gone)", | |
617 0, 0); | |
618 change = max (change, STRUCTURAL_CHANGE); | |
619 } | |
620 else if (merged_next) | |
621 { | |
622 if (merged_next->change) | |
623 EXPLAIN (val1->name, change, merged_next->change, "(following change)", | |
624 0, 0); | |
625 change = max (change, merged_next->change); | |
626 } | |
627 | |
628 val1->next = merged_next; | |
629 | |
14879
70f79ccb9875
(merge_widget_value): Set the this_one_change field.
Richard M. Stallman <rms@gnu.org>
parents:
14663
diff
changeset
|
630 val1->this_one_change = this_one_change; |
5626 | 631 val1->change = change; |
632 | |
633 if (change > NO_CHANGE && val1->toolkit_data) | |
634 { | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
635 *change_p = 1; |
5626 | 636 if (val1->free_toolkit_data) |
14611
69fca906f068
(free_widget_value_tree, merge_widget_value):
Karl Heuer <kwzh@gnu.org>
parents:
14594
diff
changeset
|
637 XtFree (val1->toolkit_data); |
5626 | 638 val1->toolkit_data = NULL; |
639 } | |
640 | |
641 return val1; | |
642 } | |
643 | |
644 | |
645 /* modifying the widgets */ | |
646 static Widget | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
647 name_to_widget (instance, name) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
648 widget_instance* instance; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
649 char* name; |
5626 | 650 { |
651 Widget widget = NULL; | |
652 | |
653 if (!instance->widget) | |
654 return NULL; | |
655 | |
656 if (!strcmp (XtName (instance->widget), name)) | |
657 widget = instance->widget; | |
658 else | |
659 { | |
660 int length = strlen (name) + 2; | |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
661 char* real_name = (char *) xmalloc (length); |
5626 | 662 real_name [0] = '*'; |
663 strcpy (real_name + 1, name); | |
664 | |
665 widget = XtNameToWidget (instance->widget, real_name); | |
7515
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
666 |
d31babe815e7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7423
diff
changeset
|
667 free (real_name); |
5626 | 668 } |
669 return widget; | |
670 } | |
671 | |
672 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
673 set_one_value (instance, val, deep_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
674 widget_instance* instance; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
675 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
676 Boolean deep_p; |
5626 | 677 { |
678 Widget widget = name_to_widget (instance, val->name); | |
679 | |
680 if (widget) | |
681 { | |
682 #if defined (USE_LUCID) | |
683 if (lw_lucid_widget_p (instance->widget)) | |
684 xlw_update_one_widget (instance, widget, val, deep_p); | |
685 #endif | |
686 #if defined (USE_MOTIF) | |
687 if (lw_motif_widget_p (instance->widget)) | |
688 xm_update_one_widget (instance, widget, val, deep_p); | |
689 #endif | |
690 #if defined (USE_OLIT) | |
691 if (lw_olit_widget_p (instance->widget)) | |
692 xol_update_one_widget (instance, widget, val, deep_p); | |
693 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
694 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
695 if (lw_xaw_widget_p (instance->widget)) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
696 xaw_update_one_widget (instance, widget, val, deep_p); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
697 #endif |
5626 | 698 } |
699 } | |
700 | |
701 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
702 update_one_widget_instance (instance, deep_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
703 widget_instance* instance; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
704 Boolean deep_p; |
5626 | 705 { |
706 widget_value *val; | |
707 | |
708 if (!instance->widget) | |
709 /* the widget was destroyed */ | |
710 return; | |
711 | |
712 for (val = instance->info->val; val; val = val->next) | |
713 if (val->change != NO_CHANGE) | |
714 set_one_value (instance, val, deep_p); | |
715 } | |
716 | |
717 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
718 update_all_widget_values (info, deep_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
719 widget_info* info; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
720 Boolean deep_p; |
5626 | 721 { |
722 widget_instance* instance; | |
723 widget_value* val; | |
724 | |
725 for (instance = info->instances; instance; instance = instance->next) | |
726 update_one_widget_instance (instance, deep_p); | |
727 | |
728 for (val = info->val; val; val = val->next) | |
729 val->change = NO_CHANGE; | |
730 } | |
731 | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
732 int |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
733 lw_modify_all_widgets (id, val, deep_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
734 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
735 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
736 Boolean deep_p; |
5626 | 737 { |
738 widget_info* info = get_widget_info (id, False); | |
739 widget_value* new_val; | |
740 widget_value* next_new_val; | |
741 widget_value* cur; | |
742 widget_value* prev; | |
743 widget_value* next; | |
744 int found; | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
745 int change_p = 0; |
5626 | 746 |
747 if (!info) | |
29468 | 748 return 0; |
5626 | 749 |
750 for (new_val = val; new_val; new_val = new_val->next) | |
751 { | |
752 next_new_val = new_val->next; | |
753 new_val->next = NULL; | |
754 found = False; | |
755 for (prev = NULL, cur = info->val; cur; prev = cur, cur = cur->next) | |
756 if (!strcmp (cur->name, new_val->name)) | |
757 { | |
758 found = True; | |
759 next = cur->next; | |
760 cur->next = NULL; | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
761 cur = merge_widget_value (cur, new_val, deep_p ? 1000 : 1, |
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
762 &change_p); |
5626 | 763 if (prev) |
764 prev->next = cur ? cur : next; | |
765 else | |
766 info->val = cur ? cur : next; | |
767 if (cur) | |
768 cur->next = next; | |
769 break; | |
770 } | |
771 if (!found) | |
772 { | |
773 /* Could not find it, add it */ | |
774 if (prev) | |
775 prev->next = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE); | |
776 else | |
777 info->val = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE); | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
778 change_p = 1; |
5626 | 779 } |
780 new_val->next = next_new_val; | |
781 } | |
782 | |
783 update_all_widget_values (info, deep_p); | |
27997
7ff6dc4c3775
(lw_modify_all_widgets): Return non-zero if widget
Gerd Moellmann <gerd@gnu.org>
parents:
27756
diff
changeset
|
784 return change_p; |
5626 | 785 } |
786 | |
787 | |
788 /* creating the widgets */ | |
789 | |
790 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
791 initialize_widget_instance (instance) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
792 widget_instance* instance; |
5626 | 793 { |
794 widget_value* val; | |
795 | |
796 for (val = instance->info->val; val; val = val->next) | |
797 val->change = STRUCTURAL_CHANGE; | |
798 | |
799 update_one_widget_instance (instance, True); | |
800 | |
801 for (val = instance->info->val; val; val = val->next) | |
802 val->change = NO_CHANGE; | |
803 } | |
804 | |
805 | |
806 static widget_creation_function | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
807 find_in_table (type, table) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
808 char* type; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
809 widget_creation_entry* table; |
5626 | 810 { |
811 widget_creation_entry* cur; | |
812 for (cur = table; cur->type; cur++) | |
5853 | 813 if (!my_strcasecmp (type, cur->type)) |
5626 | 814 return cur->function; |
815 return NULL; | |
816 } | |
817 | |
818 static Boolean | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
819 dialog_spec_p (name) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
820 char* name; |
5626 | 821 { |
822 /* return True if name matches [EILPQeilpq][1-9][Bb] or | |
823 [EILPQeilpq][1-9][Bb][Rr][1-9] */ | |
824 if (!name) | |
825 return False; | |
826 | |
827 switch (name [0]) | |
828 { | |
829 case 'E': case 'I': case 'L': case 'P': case 'Q': | |
830 case 'e': case 'i': case 'l': case 'p': case 'q': | |
831 if (name [1] >= '0' && name [1] <= '9') | |
832 { | |
833 if (name [2] != 'B' && name [2] != 'b') | |
834 return False; | |
835 if (!name [3]) | |
836 return True; | |
837 if ((name [3] == 'T' || name [3] == 't') && !name [4]) | |
838 return True; | |
839 if ((name [3] == 'R' || name [3] == 'r') | |
840 && name [4] >= '0' && name [4] <= '9' && !name [5]) | |
841 return True; | |
842 return False; | |
843 } | |
844 else | |
845 return False; | |
846 | |
847 default: | |
848 return False; | |
849 } | |
850 } | |
851 | |
852 static void | |
14163
2422ceecd9d2
(instantiate_widget_instance): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
12744
diff
changeset
|
853 instantiate_widget_instance (instance) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
854 widget_instance* instance; |
5626 | 855 { |
856 widget_creation_function function = NULL; | |
857 | |
858 #if defined (USE_LUCID) | |
859 if (!function) | |
860 function = find_in_table (instance->info->type, xlw_creation_table); | |
861 #endif | |
862 #if defined(USE_MOTIF) | |
863 if (!function) | |
864 function = find_in_table (instance->info->type, xm_creation_table); | |
865 #endif | |
866 #if defined (USE_OLIT) | |
867 if (!function) | |
868 function = find_in_table (instance->info->type, xol_creation_table); | |
869 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
870 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
871 if (!function) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
872 function = find_in_table (instance->info->type, xaw_creation_table); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
873 #endif |
5626 | 874 |
875 if (!function) | |
876 { | |
877 if (dialog_spec_p (instance->info->type)) | |
878 { | |
879 #if defined (USE_LUCID) | |
880 /* not yet */ | |
881 #endif | |
882 #if defined(USE_MOTIF) | |
883 if (!function) | |
884 function = xm_create_dialog; | |
885 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
886 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
887 if (!function) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
888 function = xaw_create_dialog; |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
889 #endif |
5626 | 890 #if defined (USE_OLIT) |
891 /* not yet */ | |
892 #endif | |
893 } | |
894 } | |
895 | |
896 if (!function) | |
897 { | |
898 printf ("No creation function for widget type %s\n", | |
899 instance->info->type); | |
900 abort (); | |
901 } | |
902 | |
903 instance->widget = (*function) (instance); | |
904 | |
905 if (!instance->widget) | |
906 abort (); | |
907 | |
908 /* XtRealizeWidget (instance->widget);*/ | |
909 } | |
910 | |
911 void | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
912 lw_register_widget (type, name, id, val, pre_activate_cb, |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
913 selection_cb, post_activate_cb, highlight_cb) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
914 char* type; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
915 char* name; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
916 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
917 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
918 lw_callback pre_activate_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
919 lw_callback selection_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
920 lw_callback post_activate_cb; |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
921 lw_callback highlight_cb; |
5626 | 922 { |
923 if (!get_widget_info (id, False)) | |
924 allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb, | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
925 post_activate_cb, highlight_cb); |
5626 | 926 } |
927 | |
928 Widget | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
929 lw_get_widget (id, parent, pop_up_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
930 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
931 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
932 Boolean pop_up_p; |
5626 | 933 { |
934 widget_instance* instance; | |
935 | |
936 instance = find_instance (id, parent, pop_up_p); | |
937 return instance ? instance->widget : NULL; | |
938 } | |
939 | |
940 Widget | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
941 lw_make_widget (id, parent, pop_up_p) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
942 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
943 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
944 Boolean pop_up_p; |
5626 | 945 { |
946 widget_instance* instance; | |
947 widget_info* info; | |
948 | |
949 instance = find_instance (id, parent, pop_up_p); | |
950 if (!instance) | |
951 { | |
952 info = get_widget_info (id, False); | |
953 if (!info) | |
954 return NULL; | |
955 instance = allocate_widget_instance (info, parent, pop_up_p); | |
956 initialize_widget_instance (instance); | |
957 } | |
958 if (!instance->widget) | |
959 abort (); | |
960 return instance->widget; | |
961 } | |
962 | |
963 Widget | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
964 lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb, |
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
965 selection_cb, post_activate_cb, highlight_cb) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
966 char* type; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
967 char* name; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
968 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
969 widget_value* val; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
970 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
971 Boolean pop_up_p; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
972 lw_callback pre_activate_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
973 lw_callback selection_cb; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
974 lw_callback post_activate_cb; |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
975 lw_callback highlight_cb; |
5626 | 976 { |
977 lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb, | |
27335
314e947f85ea
(copy_widget_value_tree): Copy help string.
Gerd Moellmann <gerd@gnu.org>
parents:
26087
diff
changeset
|
978 post_activate_cb, highlight_cb); |
5626 | 979 return lw_make_widget (id, parent, pop_up_p); |
980 } | |
981 | |
982 | |
983 /* destroying the widgets */ | |
984 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
985 destroy_one_instance (instance) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
986 widget_instance* instance; |
5626 | 987 { |
988 /* Remove the destroy callback on the widget; that callback will try to | |
989 dereference the instance object (to set its widget slot to 0, since the | |
990 widget is dead.) Since the instance is now dead, we don't have to worry | |
991 about the fact that its widget is dead too. | |
992 | |
993 This happens in the Phase2Destroy of the widget, so this callback would | |
994 not have been run until arbitrarily long after the instance was freed. | |
995 */ | |
996 if (instance->widget) | |
997 XtRemoveCallback (instance->widget, XtNdestroyCallback, | |
998 mark_widget_destroyed, (XtPointer)instance); | |
999 | |
1000 if (instance->widget) | |
1001 { | |
1002 /* The else are pretty tricky here, including the empty statement | |
1003 at the end because it would be very bad to destroy a widget | |
1004 twice. */ | |
1005 #if defined (USE_LUCID) | |
1006 if (lw_lucid_widget_p (instance->widget)) | |
1007 xlw_destroy_instance (instance); | |
1008 else | |
1009 #endif | |
1010 #if defined (USE_MOTIF) | |
1011 if (lw_motif_widget_p (instance->widget)) | |
1012 xm_destroy_instance (instance); | |
1013 else | |
1014 #endif | |
1015 #if defined (USE_OLIT) | |
1016 if (lw_olit_widget_p (instance->widget)) | |
1017 xol_destroy_instance (instance); | |
1018 else | |
1019 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1020 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1021 if (lw_xaw_widget_p (instance->widget)) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1022 xaw_destroy_instance (instance); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1023 else |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1024 #endif |
5626 | 1025 /* do not remove the empty statement */ |
1026 ; | |
1027 } | |
1028 | |
1029 free_widget_instance (instance); | |
1030 } | |
1031 | |
1032 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1033 lw_destroy_widget (w) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1034 Widget w; |
5626 | 1035 { |
1036 widget_instance* instance = get_widget_instance (w, True); | |
1037 | |
1038 if (instance) | |
1039 { | |
1040 widget_info *info = instance->info; | |
1041 /* instance has already been removed from the list; free it */ | |
1042 destroy_one_instance (instance); | |
1043 /* if there are no instances left, free the info too */ | |
1044 if (!info->instances) | |
1045 lw_destroy_all_widgets (info->id); | |
1046 } | |
1047 } | |
1048 | |
1049 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1050 lw_destroy_all_widgets (id) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1051 LWLIB_ID id; |
5626 | 1052 { |
1053 widget_info* info = get_widget_info (id, True); | |
1054 widget_instance* instance; | |
1055 widget_instance* next; | |
1056 | |
1057 if (info) | |
1058 { | |
1059 for (instance = info->instances; instance; ) | |
1060 { | |
1061 next = instance->next; | |
1062 destroy_one_instance (instance); | |
1063 instance = next; | |
1064 } | |
1065 free_widget_info (info); | |
1066 } | |
1067 } | |
1068 | |
1069 void | |
1070 lw_destroy_everything () | |
1071 { | |
1072 while (all_widget_info) | |
1073 lw_destroy_all_widgets (all_widget_info->id); | |
1074 } | |
1075 | |
1076 void | |
1077 lw_destroy_all_pop_ups () | |
1078 { | |
1079 widget_info* info; | |
1080 widget_info* next; | |
1081 widget_instance* instance; | |
1082 | |
1083 for (info = all_widget_info; info; info = next) | |
1084 { | |
1085 next = info->next; | |
1086 instance = info->instances; | |
1087 if (instance && instance->pop_up_p) | |
1088 lw_destroy_all_widgets (info->id); | |
1089 } | |
1090 } | |
1091 | |
1092 #ifdef USE_MOTIF | |
11861 | 1093 extern Widget first_child (/* Widget */); /* garbage */ |
5626 | 1094 #endif |
1095 | |
1096 Widget | |
1097 lw_raise_all_pop_up_widgets () | |
1098 { | |
1099 widget_info* info; | |
1100 widget_instance* instance; | |
1101 Widget result = NULL; | |
1102 | |
1103 for (info = all_widget_info; info; info = info->next) | |
1104 for (instance = info->instances; instance; instance = instance->next) | |
1105 if (instance->pop_up_p) | |
1106 { | |
1107 Widget widget = instance->widget; | |
1108 if (widget) | |
1109 { | |
1110 if (XtIsManaged (widget) | |
1111 #ifdef USE_MOTIF | |
1112 /* What a complete load of crap!!!! | |
1113 When a dialogShell is on the screen, it is not managed! | |
1114 */ | |
1115 || (lw_motif_widget_p (instance->widget) && | |
1116 XtIsManaged (first_child (widget))) | |
1117 #endif | |
1118 ) | |
1119 { | |
1120 if (!result) | |
1121 result = widget; | |
1122 XMapRaised (XtDisplay (widget), XtWindow (widget)); | |
1123 } | |
1124 } | |
1125 } | |
1126 return result; | |
1127 } | |
1128 | |
1129 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1130 lw_pop_all_widgets (id, up) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1131 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1132 Boolean up; |
5626 | 1133 { |
1134 widget_info* info = get_widget_info (id, False); | |
1135 widget_instance* instance; | |
1136 | |
1137 if (info) | |
1138 for (instance = info->instances; instance; instance = instance->next) | |
1139 if (instance->pop_up_p && instance->widget) | |
1140 { | |
1141 #if defined (USE_LUCID) | |
1142 if (lw_lucid_widget_p (instance->widget)) | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1143 { |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1144 XtRealizeWidget (instance->widget); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1145 xlw_pop_instance (instance, up); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1146 } |
5626 | 1147 #endif |
1148 #if defined (USE_MOTIF) | |
1149 if (lw_motif_widget_p (instance->widget)) | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1150 { |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1151 XtRealizeWidget (instance->widget); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1152 xm_pop_instance (instance, up); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1153 } |
5626 | 1154 #endif |
1155 #if defined (USE_OLIT) | |
1156 if (lw_olit_widget_p (instance->widget)) | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1157 { |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1158 XtRealizeWidget (instance->widget); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1159 xol_pop_instance (instance, up); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1160 } |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1161 #endif |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1162 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1163 if (lw_xaw_widget_p (instance->widget)) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1164 { |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1165 XtRealizeWidget (XtParent (instance->widget)); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1166 XtRealizeWidget (instance->widget); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1167 xaw_pop_instance (instance, up); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1168 } |
5626 | 1169 #endif |
1170 } | |
1171 } | |
1172 | |
1173 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1174 lw_pop_up_all_widgets (id) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1175 LWLIB_ID id; |
5626 | 1176 { |
1177 lw_pop_all_widgets (id, True); | |
1178 } | |
1179 | |
1180 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1181 lw_pop_down_all_widgets (id) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1182 LWLIB_ID id; |
5626 | 1183 { |
1184 lw_pop_all_widgets (id, False); | |
1185 } | |
1186 | |
1187 void | |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1188 lw_popup_menu (widget, event) |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1189 Widget widget; |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1190 XEvent *event; |
5626 | 1191 { |
1192 #if defined (USE_LUCID) | |
1193 if (lw_lucid_widget_p (widget)) | |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1194 xlw_popup_menu (widget, event); |
5626 | 1195 #endif |
1196 #if defined (USE_MOTIF) | |
1197 if (lw_motif_widget_p (widget)) | |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1198 xm_popup_menu (widget, event); |
5626 | 1199 #endif |
1200 #if defined (USE_OLIT) | |
1201 if (lw_olit_widget_p (widget)) | |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1202 xol_popup_menu (widget, event); |
5626 | 1203 #endif |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1204 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1205 if (lw_xaw_widget_p (widget)) |
12744
0c5625e91a11
(lw_popup_menu): New arg event, passed along.
Richard M. Stallman <rms@gnu.org>
parents:
12187
diff
changeset
|
1206 xaw_popup_menu (widget, event); |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1207 #endif |
5626 | 1208 } |
1209 | |
1210 /* get the values back */ | |
1211 static Boolean | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1212 get_one_value (instance, val) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1213 widget_instance* instance; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1214 widget_value* val; |
5626 | 1215 { |
1216 Widget widget = name_to_widget (instance, val->name); | |
1217 | |
1218 if (widget) | |
1219 { | |
1220 #if defined (USE_LUCID) | |
1221 if (lw_lucid_widget_p (instance->widget)) | |
1222 xlw_update_one_value (instance, widget, val); | |
1223 #endif | |
1224 #if defined (USE_MOTIF) | |
1225 if (lw_motif_widget_p (instance->widget)) | |
1226 xm_update_one_value (instance, widget, val); | |
1227 #endif | |
1228 #if defined (USE_OLIT) | |
1229 if (lw_olit_widget_p (instance->widget)) | |
1230 xol_update_one_value (instance, widget, val); | |
1231 #endif | |
6305
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1232 #if defined (USE_XAW) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1233 if (lw_xaw_widget_p (instance->widget)) |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1234 xaw_update_one_value (instance, widget, val); |
65beaa9aa1e4
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5999
diff
changeset
|
1235 #endif |
5626 | 1236 return True; |
1237 } | |
1238 else | |
1239 return False; | |
1240 } | |
1241 | |
1242 Boolean | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1243 lw_get_some_values (id, val_out) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1244 LWLIB_ID id; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1245 widget_value* val_out; |
5626 | 1246 { |
1247 widget_info* info = get_widget_info (id, False); | |
1248 widget_instance* instance; | |
1249 widget_value* val; | |
1250 Boolean result = False; | |
1251 | |
1252 if (!info) | |
1253 return False; | |
1254 | |
1255 instance = info->instances; | |
1256 if (!instance) | |
1257 return False; | |
1258 | |
1259 for (val = val_out; val; val = val->next) | |
1260 if (get_one_value (instance, val)) | |
1261 result = True; | |
1262 | |
1263 return result; | |
1264 } | |
1265 | |
1266 widget_value* | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1267 lw_get_all_values (id) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1268 LWLIB_ID id; |
5626 | 1269 { |
1270 widget_info* info = get_widget_info (id, False); | |
1271 widget_value* val = info->val; | |
1272 if (lw_get_some_values (id, val)) | |
1273 return val; | |
1274 else | |
1275 return NULL; | |
1276 } | |
1277 | |
1278 /* internal function used by the library dependent implementation to get the | |
1279 widget_value for a given widget in an instance */ | |
1280 widget_value* | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1281 lw_get_widget_value_for_widget (instance, w) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1282 widget_instance* instance; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1283 Widget w; |
5626 | 1284 { |
1285 char* name = XtName (w); | |
1286 widget_value* cur; | |
1287 for (cur = instance->info->val; cur; cur = cur->next) | |
1288 if (!strcmp (cur->name, name)) | |
1289 return cur; | |
1290 return NULL; | |
1291 } | |
1292 | |
1293 /* update other instances value when one thing changed */ | |
14594
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1294 |
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1295 /* To forbid recursive calls */ |
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1296 static Boolean lwlib_updating; |
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1297 |
5626 | 1298 /* This function can be used as a an XtCallback for the widgets that get |
1299 modified to update other instances of the widgets. Closure should be the | |
1300 widget_instance. */ | |
1301 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1302 lw_internal_update_other_instances (widget, closure, call_data) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1303 Widget widget; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1304 XtPointer closure; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1305 XtPointer call_data; |
5626 | 1306 { |
1307 widget_instance* instance = (widget_instance*)closure; | |
1308 char* name = XtName (widget); | |
1309 widget_info* info; | |
1310 widget_instance* cur; | |
1311 widget_value* val; | |
1312 | |
14594
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1313 /* Avoid possibly infinite recursion. */ |
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1314 if (lwlib_updating) |
5626 | 1315 return; |
1316 | |
1317 /* protect against the widget being destroyed */ | |
1318 if (XtWidgetBeingDestroyedP (widget)) | |
1319 return; | |
1320 | |
1321 /* Return immediately if there are no other instances */ | |
1322 info = instance->info; | |
1323 if (!info->instances->next) | |
1324 return; | |
1325 | |
14594
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1326 lwlib_updating = True; |
5626 | 1327 |
1328 for (val = info->val; val && strcmp (val->name, name); val = val->next); | |
1329 | |
1330 if (val && get_one_value (instance, val)) | |
1331 for (cur = info->instances; cur; cur = cur->next) | |
1332 if (cur != instance) | |
1333 set_one_value (cur, val, True); | |
1334 | |
14594
37d38d8040a1
(lw_internal_update_other_instances): Move static var
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1335 lwlib_updating = False; |
5626 | 1336 } |
1337 | |
1338 | |
1339 /* get the id */ | |
1340 | |
1341 LWLIB_ID | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1342 lw_get_widget_id (w) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1343 Widget w; |
5626 | 1344 { |
1345 widget_instance* instance = get_widget_instance (w, False); | |
1346 | |
1347 return instance ? instance->info->id : 0; | |
1348 } | |
1349 | |
1350 /* set the keyboard focus */ | |
1351 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1352 lw_set_keyboard_focus (parent, w) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1353 Widget parent; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1354 Widget w; |
5626 | 1355 { |
1356 #if defined (USE_MOTIF) | |
1357 xm_set_keyboard_focus (parent, w); | |
1358 #else | |
1359 XtSetKeyboardFocus (parent, w); | |
1360 #endif | |
1361 } | |
1362 | |
1363 /* Show busy */ | |
1364 static void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1365 show_one_widget_busy (w, flag) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1366 Widget w; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1367 Boolean flag; |
5626 | 1368 { |
1369 Pixel foreground = 0; | |
1370 Pixel background = 1; | |
1371 Widget widget_to_invert = XtNameToWidget (w, "*sheet"); | |
1372 if (!widget_to_invert) | |
1373 widget_to_invert = w; | |
1374 | |
1375 XtVaGetValues (widget_to_invert, | |
1376 XtNforeground, &foreground, | |
1377 XtNbackground, &background, | |
30571 | 1378 NULL); |
5626 | 1379 XtVaSetValues (widget_to_invert, |
1380 XtNforeground, background, | |
1381 XtNbackground, foreground, | |
30571 | 1382 NULL); |
5626 | 1383 } |
1384 | |
1385 void | |
5724
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1386 lw_show_busy (w, busy) |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1387 Widget w; |
02a4aeb69cae
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
1388 Boolean busy; |
5626 | 1389 { |
1390 widget_instance* instance = get_widget_instance (w, False); | |
1391 widget_info* info; | |
1392 widget_instance* next; | |
1393 | |
1394 if (instance) | |
1395 { | |
1396 info = instance->info; | |
1397 if (info->busy != busy) | |
1398 { | |
1399 for (next = info->instances; next; next = next->next) | |
1400 if (next->widget) | |
1401 show_one_widget_busy (next->widget, busy); | |
1402 info->busy = busy; | |
1403 } | |
1404 } | |
1405 } | |
8785 | 1406 |
1407 /* This hack exists because Lucid/Athena need to execute the strange | |
1408 function below to support geometry management. */ | |
1409 void | |
1410 lw_refigure_widget (w, doit) | |
1411 Widget w; | |
1412 Boolean doit; | |
1413 { | |
9929
72dc1c5b3939
(lw_refigure_widget): Use the macro USE_XAW rather than XAW.
Paul Reilly <pmr@pajato.com>
parents:
9226
diff
changeset
|
1414 #if defined (USE_XAW) |
8785 | 1415 XawPanedSetRefigureMode (w, doit); |
1416 #endif | |
1417 #if defined (USE_MOTIF) | |
1418 if (doit) | |
11714
b62d02709ec7
(lw_refigure_widget) [USE_MOTIF]: Fix backward if.
Richard M. Stallman <rms@gnu.org>
parents:
11676
diff
changeset
|
1419 XtManageChild (w); |
8785 | 1420 else |
11714
b62d02709ec7
(lw_refigure_widget) [USE_MOTIF]: Fix backward if.
Richard M. Stallman <rms@gnu.org>
parents:
11676
diff
changeset
|
1421 XtUnmanageChild (w); |
8785 | 1422 #endif |
1423 } | |
1424 | |
1425 /* Toolkit independent way of determining if an event window is in the | |
1426 menubar. */ | |
1427 Boolean | |
1428 lw_window_is_in_menubar (win, menubar_widget) | |
1429 Window win; | |
1430 Widget menubar_widget; | |
1431 { | |
1432 return menubar_widget | |
1433 #if defined (USE_LUCID) | |
1434 && XtWindow (menubar_widget) == win; | |
1435 #endif | |
1436 #if defined (USE_MOTIF) | |
14663
d9cafe0ebb7d
(lw_window_is_in_menubar) [USE_MOTIF]:
Richard M. Stallman <rms@gnu.org>
parents:
14611
diff
changeset
|
1437 && ((XtWindow (menubar_widget) == win) |
d9cafe0ebb7d
(lw_window_is_in_menubar) [USE_MOTIF]:
Richard M. Stallman <rms@gnu.org>
parents:
14611
diff
changeset
|
1438 || (XtWindowToWidget (XtDisplay (menubar_widget), win) |
d9cafe0ebb7d
(lw_window_is_in_menubar) [USE_MOTIF]:
Richard M. Stallman <rms@gnu.org>
parents:
14611
diff
changeset
|
1439 && (XtParent (XtWindowToWidget (XtDisplay (menubar_widget), win)) |
d9cafe0ebb7d
(lw_window_is_in_menubar) [USE_MOTIF]:
Richard M. Stallman <rms@gnu.org>
parents:
14611
diff
changeset
|
1440 == menubar_widget))); |
8785 | 1441 #endif |
1442 } | |
1443 | |
1444 /* Motif hack to set the main window areas. */ | |
1445 void | |
1446 lw_set_main_areas (parent, menubar, work_area) | |
1447 Widget parent; | |
1448 Widget menubar; | |
1449 Widget work_area; | |
1450 { | |
1451 #if defined (USE_MOTIF) | |
9093
f8546f467db6
(lw_set_main_areas): Move call to XmMainSetAreas() to `lwlib-Xm.c'.
Paul Reilly <pmr@pajato.com>
parents:
8785
diff
changeset
|
1452 xm_set_main_areas (parent, menubar, work_area); |
8785 | 1453 #endif |
1454 } | |
1455 | |
1456 /* Manage resizing for Motif. This disables resizing when the menubar | |
1457 is about to be modified. */ | |
1458 void | |
1459 lw_allow_resizing (w, flag) | |
1460 Widget w; | |
1461 Boolean flag; | |
1462 { | |
1463 #if defined (USE_MOTIF) | |
9226
fc3f748ccf9e
(lw_set_main_areas): Use xm_set_main_areas().
Paul Reilly <pmr@pajato.com>
parents:
9093
diff
changeset
|
1464 xm_manage_resizing (w, flag); |
8785 | 1465 #endif |
1466 } | |
25036 | 1467 |
1468 | |
1469 /* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is | |
1470 set to an appropriate enumerator of type enum menu_separator. | |
1471 MOTIF_P non-zero means map separator types not supported by Motif | |
1472 to similar ones that are supported. */ | |
1473 | |
1474 int | |
1475 lw_separator_p (label, type, motif_p) | |
1476 char *label; | |
1477 enum menu_separator *type; | |
1478 int motif_p; | |
1479 { | |
32040
02773dbde247
(lw_separator_p): Init separator_p (bug with "-- some text").
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30571
diff
changeset
|
1480 int separator_p = 0; |
25036 | 1481 |
1482 if (strlen (label) >= 3 | |
1483 && bcmp (label, "--:", 3) == 0) | |
1484 { | |
1485 static struct separator_table | |
1486 { | |
1487 char *name; | |
1488 enum menu_separator type; | |
1489 } | |
1490 separator_names[] = | |
1491 { | |
42120
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1492 {"space", SEPARATOR_NO_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1493 {"noLine", SEPARATOR_NO_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1494 {"singleLine", SEPARATOR_SINGLE_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1495 {"doubleLine", SEPARATOR_DOUBLE_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1496 {"singleDashedLine", SEPARATOR_SINGLE_DASHED_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1497 {"doubleDashedLine", SEPARATOR_DOUBLE_DASHED_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1498 {"shadowEtchedIn", SEPARATOR_SHADOW_ETCHED_IN}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1499 {"shadowEtchedOut", SEPARATOR_SHADOW_ETCHED_OUT}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1500 {"shadowEtchedInDash", SEPARATOR_SHADOW_ETCHED_IN_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1501 {"shadowEtchedOutDash", SEPARATOR_SHADOW_ETCHED_OUT_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1502 {"shadowDoubleEtchedIn", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1503 {"shadowDoubleEtchedOut", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1504 {"shadowDoubleEtchedInDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1505 {"shadowDoubleEtchedOutDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1506 {0,0} |
25036 | 1507 }; |
1508 | |
1509 int i; | |
1510 | |
1511 label += 3; | |
1512 for (i = 0; separator_names[i].name; ++i) | |
1513 if (strcmp (label, separator_names[i].name) == 0) | |
1514 { | |
1515 separator_p = 1; | |
1516 *type = separator_names[i].type; | |
1517 | |
1518 /* If separator type is not supported under Motif, | |
1519 use a similar one. */ | |
1520 if (motif_p && *type >= SEPARATOR_SHADOW_DOUBLE_ETCHED_IN) | |
1521 *type -= 4; | |
1522 break; | |
1523 } | |
1524 } | |
25562
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1525 else if (strlen (label) > 3 |
25718
096f3085e905
(lw_separator_p): Check for new-style separators
Gerd Moellmann <gerd@gnu.org>
parents:
25627
diff
changeset
|
1526 && bcmp (label, "--", 2) == 0 |
096f3085e905
(lw_separator_p): Check for new-style separators
Gerd Moellmann <gerd@gnu.org>
parents:
25627
diff
changeset
|
1527 && label[2] != '-') |
25562
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1528 { |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1529 /* Alternative, more Emacs-style names. */ |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1530 static struct separator_table |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1531 { |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1532 char *name; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1533 enum menu_separator type; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1534 } |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1535 separator_names[] = |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1536 { |
42120
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1537 {"space", SEPARATOR_NO_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1538 {"no-line", SEPARATOR_NO_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1539 {"single-line", SEPARATOR_SINGLE_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1540 {"double-line", SEPARATOR_DOUBLE_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1541 {"single-dashed-line", SEPARATOR_SINGLE_DASHED_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1542 {"double-dashed-line", SEPARATOR_DOUBLE_DASHED_LINE}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1543 {"shadow-etched-in", SEPARATOR_SHADOW_ETCHED_IN}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1544 {"shadow-etched-out", SEPARATOR_SHADOW_ETCHED_OUT}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1545 {"shadow-etched-in-dash", SEPARATOR_SHADOW_ETCHED_IN_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1546 {"shadow-etched-out-dash", SEPARATOR_SHADOW_ETCHED_OUT_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1547 {"shadow-double-etched-in", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1548 {"shadow-double-etched-out", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1549 {"shadow-double-etched-in-dash", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1550 {"shadow-double-etched-out-dash",SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH}, |
87f989b9dad5
(separator_names): Add missing braces around initializers.
Pavel Janík <Pavel@Janik.cz>
parents:
41765
diff
changeset
|
1551 {0,0} |
25562
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1552 }; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1553 |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1554 int i; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1555 |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1556 label += 2; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1557 for (i = 0; separator_names[i].name; ++i) |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1558 if (strcmp (label, separator_names[i].name) == 0) |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1559 { |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1560 separator_p = 1; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1561 *type = separator_names[i].type; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1562 |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1563 /* If separator type is not supported under Motif, |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1564 use a similar one. */ |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1565 if (motif_p && *type >= SEPARATOR_SHADOW_DOUBLE_ETCHED_IN) |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1566 *type -= 4; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1567 break; |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1568 } |
374f4e51615c
(lw_separator_p): Add alternative separator type names.
Gerd Moellmann <gerd@gnu.org>
parents:
25036
diff
changeset
|
1569 } |
25036 | 1570 else |
1571 { | |
1572 /* Old-style separator, maybe. It's a separator if it contains | |
1573 only dashes. */ | |
1574 while (*label == '-') | |
1575 ++label; | |
1576 separator_p = *label == 0; | |
1577 *type = SEPARATOR_SHADOW_ETCHED_IN; | |
1578 } | |
1579 | |
1580 return separator_p; | |
1581 } | |
1582 |