annotate src/gui.c @ 388:aabb7f5b1c81 r21-2-9

Import from CVS: tag r21-2-9
author cvs
date Mon, 13 Aug 2007 11:09:42 +0200
parents bbff43aa5eb7
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Generic GUI code. (menubars, scrollbars, toolbars, dialogs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
5 Copyright (C) 1998 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <config.h>
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
27 #include "lisp.h"
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
28 #include "gui.h"
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
29 #include "elhash.h"
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 377
diff changeset
30 #include "bytecode.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 Lisp_Object Q_active, Q_suffix, Q_keys, Q_style, Q_selected;
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 371
diff changeset
33 Lisp_Object Q_filter, Q_config, Q_included, Q_key_sequence;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
34 Lisp_Object Q_accelerator, Q_label, Q_callback;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 Lisp_Object Qtoggle, Qradio;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
37 #ifdef HAVE_POPUPS
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
38
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
39 /* count of menus/dboxes currently up */
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
40 int popup_up_p;
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
41
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
42 DEFUN ("popup-up-p", Fpopup_up_p, 0, 0, 0, /*
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
43 Return t if a popup menu or dialog box is up, nil otherwise.
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
44 See `popup-menu' and `popup-dialog-box'.
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
45 */
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
46 ())
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
47 {
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
48 return popup_up_p ? Qt : Qnil;
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
49 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
50 #endif /* HAVE_POPUPS */
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
51
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
52 int
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
53 separator_string_p (CONST char *s)
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
54 {
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
55 CONST char *p;
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
56 char first;
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
57
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
58 if (!s || s[0] == '\0')
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
59 return 0;
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
60 first = s[0];
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
61 if (first != '-' && first != '=')
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
62 return 0;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
63 for (p = s; *p == first; p++)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
64 ;
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
65
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
66 return (*p == '!' || *p == ':' || *p == '\0');
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
67 }
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
68
286
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
69 /* Massage DATA to find the correct function and argument. Used by
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
70 popup_selection_callback() and the msw code. */
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
71 void
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
72 get_gui_callback (Lisp_Object data, Lisp_Object *fn, Lisp_Object *arg)
286
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
73 {
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
74 if (SYMBOLP (data)
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
75 || (COMPILED_FUNCTIONP (data)
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
76 && XCOMPILED_FUNCTION (data)->flags.interactivep)
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
77 || (EQ (XCAR (data), Qlambda)
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
78 && !NILP (Fassq (Qinteractive, Fcdr (Fcdr (data))))))
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
79 {
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
80 *fn = Qcall_interactively;
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
81 *arg = data;
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
82 }
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
83 else if (CONSP (data))
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
84 {
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
85 *fn = Qeval;
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
86 *arg = data;
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
87 }
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
88 else
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
89 {
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
90 *fn = Qeval;
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
91 *arg = list3 (Qsignal,
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
92 list2 (Qquote, Qerror),
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
93 list2 (Qquote, list2 (build_translated_string
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
94 ("illegal callback"),
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
95 data)));
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
96 }
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
97 }
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 272
diff changeset
98
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
99 /*
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
100 * Initialize the gui_item structure by setting all (GC-protected)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
101 * fields to their default values. The defaults are t for :active and
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
102 * :included values, and nil for others.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
103 */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
104 void
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
105 gui_item_init (struct gui_item *pgui_item)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
106 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
107 pgui_item->name = Qnil;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
108 pgui_item->callback = Qnil;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
109 pgui_item->suffix = Qnil;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
110 pgui_item->active = Qt;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
111 pgui_item->included = Qt;
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 286
diff changeset
112 pgui_item->config = Qnil;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
113 pgui_item->filter = Qnil;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
114 pgui_item->style = Qnil;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
115 pgui_item->selected = Qnil;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
116 pgui_item->keys = Qnil;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
117 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
118
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
119 /*
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
120 * Add a value VAL associated with keyword KEY into PGUI_ITEM
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
121 * structure. If KEY is not a keyword, or is an unknown keyword, then
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
122 * error is signaled.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
123 */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
124 void
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
125 gui_item_add_keyval_pair (struct gui_item *pgui_item,
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
126 Lisp_Object key, Lisp_Object val,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
127 Error_behavior errb)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
128 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
129 if (!KEYWORDP (key))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
130 signal_simple_error_2 ("Non-keyword in gui item", key, pgui_item->name);
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
131
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
132 if (EQ (key, Q_suffix)) pgui_item->suffix = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
133 else if (EQ (key, Q_active)) pgui_item->active = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
134 else if (EQ (key, Q_included)) pgui_item->included = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
135 else if (EQ (key, Q_config)) pgui_item->config = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
136 else if (EQ (key, Q_filter)) pgui_item->filter = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
137 else if (EQ (key, Q_style)) pgui_item->style = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
138 else if (EQ (key, Q_selected)) pgui_item->selected = val;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
139 else if (EQ (key, Q_keys)) pgui_item->keys = val;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
140 else if (EQ (key, Q_callback)) pgui_item->callback = val;
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 371
diff changeset
141 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 371
diff changeset
142 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
143 else if (ERRB_EQ (errb, ERROR_ME))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
144 signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name);
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
145 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
146
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
147 /*
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
148 * ITEM is a lisp vector, describing a menu item or a button. The
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
149 * function extracts the description of the item into the PGUI_ITEM
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
150 * structure.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
151 */
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
152 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
153 gui_parse_item_keywords_internal (Lisp_Object item, struct gui_item *pgui_item,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
154 Error_behavior errb)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
155 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
156 int length, plist_p, start;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
157 Lisp_Object *contents;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
158
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
159 CHECK_VECTOR (item);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
160 length = XVECTOR_LENGTH (item);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
161 contents = XVECTOR_DATA (item);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
162
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
163 if (length < 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
164 signal_simple_error ("GUI item descriptors must be at least 1 elts long", item);
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
165
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
166 /* length 1: [ "name" ]
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
167 length 2: [ "name" callback ]
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
168 length 3: [ "name" callback active-p ]
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
169 or [ "name" keyword value ]
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
170 length 4: [ "name" callback active-p suffix ]
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
171 or [ "name" callback keyword value ]
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
172 length 5+: [ "name" callback [ keyword value ]+ ]
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
173 or [ "name" [ keyword value ]+ ]
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
174 */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
175 plist_p = (length > 2 && (KEYWORDP (contents [1])
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
176 || KEYWORDP (contents [2])));
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
177
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
178 pgui_item->name = contents [0];
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
179 if (length > 1 && !KEYWORDP (contents [1]))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
180 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
181 pgui_item->callback = contents [1];
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
182 start = 2;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
183 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
184 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
185 start =1;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
186
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
187 if (!plist_p && length > 2)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
188 /* the old way */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
189 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
190 pgui_item->active = contents [2];
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
191 if (length == 4)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
192 pgui_item->suffix = contents [3];
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
193 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
194 else
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
195 /* the new way */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
196 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
197 int i;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
198 if ((length - start) & 1)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
199 signal_simple_error (
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
200 "GUI item descriptor has an odd number of keywords and values",
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
201 item);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
202
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
203 for (i = start; i < length;)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
204 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
205 Lisp_Object key = contents [i++];
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
206 Lisp_Object val = contents [i++];
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
207 gui_item_add_keyval_pair (pgui_item, key, val, errb);
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
208 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
209 }
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
210 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
211
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
212 void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
213 gui_parse_item_keywords (Lisp_Object item, struct gui_item *pgui_item)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
214 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
215 gui_parse_item_keywords_internal (item, pgui_item, ERROR_ME);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
216 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
217
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
218 void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
219 gui_parse_item_keywords_no_errors (Lisp_Object item, struct gui_item *pgui_item)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
220 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
221 gui_parse_item_keywords_internal (item, pgui_item, ERROR_ME_NOT);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
222 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
223
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
224 /*
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
225 * Decide whether a GUI item is active by evaluating its :active form
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
226 * if any
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
227 */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
228 int
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
229 gui_item_active_p (CONST struct gui_item *pgui_item)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
230 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
231 /* This function can call lisp */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
232
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
233 /* Shortcut to avoid evaluating Qt each time */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
234 return (EQ (pgui_item->active, Qt)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
235 || !NILP (Feval (pgui_item->active)));
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
236 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
237
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
238 /*
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
239 * Decide whether a GUI item is selected by evaluating its :selected form
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
240 * if any
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
241 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
242 int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
243 gui_item_selected_p (CONST struct gui_item *pgui_item)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
244 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
245 /* This function can call lisp */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
246
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
247 /* Shortcut to avoid evaluating Qt each time */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
248 return (EQ (pgui_item->selected, Qt)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
249 || !NILP (Feval (pgui_item->selected)));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
250 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
251
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
252 /*
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
253 * Decide whether a GUI item is included by evaluating its :included
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
254 * form if given, and testing its :config form against supplied CONFLIST
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
255 * configuration variable
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
256 */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
257 int
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
258 gui_item_included_p (CONST struct gui_item *pgui_item, Lisp_Object conflist)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
259 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
260 /* This function can call lisp */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
261
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
262 /* Evaluate :included first. Shortcut to avoid evaluating Qt each time */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
263 if (!EQ (pgui_item->included, Qt)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
264 && NILP (Feval (pgui_item->included)))
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
265 return 0;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
266
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
267 /* Do :config if conflist is given */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
268 if (!NILP (conflist) && !NILP (pgui_item->config)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
269 && NILP (Fmemq (pgui_item->config, conflist)))
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
270 return 0;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
271
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
272 return 1;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
273 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
274
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
275 static DOESNT_RETURN
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
276 signal_too_long_error (Lisp_Object name)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
277 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
278 signal_simple_error ("GUI item produces too long displayable string", name);
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
279 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
280
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
281 #ifdef HAVE_WINDOW_SYSTEM
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
282 /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
283 * Format "left flush" display portion of an item into BUF, guarded by
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
284 * maximum buffer size BUF_LEN. BUF_LEN does not count for terminating
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
285 * null character, so actual maximum size of buffer consumed is
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
286 * BUF_LEN + 1 bytes. If buffer is not big enough, then error is
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
287 * signaled.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
288 * Return value is the offset to the terminating null character into the
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
289 * buffer.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
290 */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
291 unsigned int
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
292 gui_item_display_flush_left (CONST struct gui_item *pgui_item,
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
293 char* buf, Bytecount buf_len)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
294 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
295 char *p = buf;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
296 Bytecount len;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
297
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
298 /* Copy item name first */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
299 CHECK_STRING (pgui_item->name);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
300 len = XSTRING_LENGTH (pgui_item->name);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
301 if (len > buf_len)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
302 signal_too_long_error (pgui_item->name);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
303 memcpy (p, XSTRING_DATA (pgui_item->name), len);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
304 p += len;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
305
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
306 /* Add space and suffix, if there is a suffix.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
307 * If suffix is not string evaluate it */
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
308 if (!NILP (pgui_item->suffix))
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
309 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
310 Lisp_Object suffix = pgui_item->suffix;
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
311 /* Shortcut to avoid evaluating suffix each time */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
312 if (!STRINGP (suffix))
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
313 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
314 suffix = Feval (suffix);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
315 CHECK_STRING (suffix);
259
11cf20601dec Import from CVS: tag r20-5b28
cvs
parents: 251
diff changeset
316 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
317
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
318 len = XSTRING_LENGTH (suffix);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
319 if (p + len + 1 > buf + buf_len)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
320 signal_too_long_error (pgui_item->name);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
321 *(p++) = ' ';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
322 memcpy (p, XSTRING_DATA (suffix), len);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
323 p += len;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
324 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
325 *p = '\0';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
326 return p - buf;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
327 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
328
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
329 /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
330 * Format "right flush" display portion of an item into BUF, guarded by
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
331 * maximum buffer size BUF_LEN. BUF_LEN does not count for terminating
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
332 * null character, so actual maximum size of buffer consumed is
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
333 * BUF_LEN + 1 bytes. If buffer is not big enough, then error is
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
334 * signaled.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
335 * Return value is the offset to the terminating null character into the
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
336 * buffer.
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
337 */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
338 unsigned int
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
339 gui_item_display_flush_right (CONST struct gui_item *pgui_item,
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
340 char* buf, Bytecount buf_len)
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
341 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
342 *buf = 0;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
343
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
344 /* Have keys? */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
345 if (!menubar_show_keybindings)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
346 return 0;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
347
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
348 /* Try :keys first */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
349 if (!NILP (pgui_item->keys))
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
350 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
351 CHECK_STRING (pgui_item->keys);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
352 if (XSTRING_LENGTH (pgui_item->keys) > buf_len)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
353 signal_too_long_error (pgui_item->name);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
354 strcpy (buf, (CONST char *) XSTRING_DATA (pgui_item->keys));
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
355 return XSTRING_LENGTH (pgui_item->keys);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
356 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
357
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
358 /* See if we can derive keys out of callback symbol */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
359 if (SYMBOLP (pgui_item->callback))
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
360 {
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
361 char buf2 [1024];
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 259
diff changeset
362 Bytecount len;
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
363
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
364 where_is_to_char (pgui_item->callback, buf2);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
365 len = strlen (buf2);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
366 if (len > buf_len)
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
367 signal_too_long_error (pgui_item->name);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
368 strcpy (buf, buf2);
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
369 return len;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
370 }
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
371
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
372 /* No keys - no right flush display */
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
373 return 0;
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
374 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
375 #endif /* HAVE_WINDOW_SYSTEM */
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 231
diff changeset
376
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
377 Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
378 mark_gui_item (struct gui_item* p, void (*markobj) (Lisp_Object))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
379 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
380 markobj (p->name);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
381 markobj (p->callback);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
382 markobj (p->suffix);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
383 markobj (p->active);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
384 markobj (p->included);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
385 markobj (p->config);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
386 markobj (p->filter);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
387 markobj (p->style);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
388 markobj (p->selected);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
389 markobj (p->keys);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
390
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
391 return Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
392 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
393
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
394 int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
395 gui_item_hash (Lisp_Object hashtable, struct gui_item* g, int slot)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
396 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
397 int hashid = HASH2 (internal_hash (g->callback, 0), internal_hash (g->name, 0));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
398 int id = GUI_ITEM_ID_BITS (hashid, slot);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
399 while (!NILP (Fgethash (make_int (id),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
400 hashtable, Qnil)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
401 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
402 id = GUI_ITEM_ID_BITS (id + 1, slot);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
403 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
404 return id;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
405 }
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
406
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 syms_of_gui (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 defkeyword (&Q_active, ":active");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 defkeyword (&Q_suffix, ":suffix");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 defkeyword (&Q_keys, ":keys");
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 371
diff changeset
413 defkeyword (&Q_key_sequence,":key-sequence");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 defkeyword (&Q_style, ":style");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 defkeyword (&Q_selected, ":selected");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 defkeyword (&Q_filter, ":filter");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 defkeyword (&Q_config, ":config");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 defkeyword (&Q_included, ":included");
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 0
diff changeset
419 defkeyword (&Q_accelerator, ":accelerator");
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 371
diff changeset
420 defkeyword (&Q_label, ":label");
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
421 defkeyword (&Q_callback, ":callback");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 defsymbol (&Qtoggle, "toggle");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 defsymbol (&Qradio, "radio");
231
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
425
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
426 #ifdef HAVE_POPUPS
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
427 DEFSUBR (Fpopup_up_p);
557eaa0339bf Import from CVS: tag r20-5b14
cvs
parents: 175
diff changeset
428 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 vars_of_gui (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 }