Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
387:f892a9d0bb8d | 388:aabb7f5b1c81 |
---|---|
29 #include "elhash.h" | 29 #include "elhash.h" |
30 #include "bytecode.h" | 30 #include "bytecode.h" |
31 | 31 |
32 Lisp_Object Q_active, Q_suffix, Q_keys, Q_style, Q_selected; | 32 Lisp_Object Q_active, Q_suffix, Q_keys, Q_style, Q_selected; |
33 Lisp_Object Q_filter, Q_config, Q_included, Q_key_sequence; | 33 Lisp_Object Q_filter, Q_config, Q_included, Q_key_sequence; |
34 Lisp_Object Q_accelerator, Q_label; | 34 Lisp_Object Q_accelerator, Q_label, Q_callback; |
35 Lisp_Object Qtoggle, Qradio; | 35 Lisp_Object Qtoggle, Qradio; |
36 | 36 |
37 #ifdef HAVE_POPUPS | 37 #ifdef HAVE_POPUPS |
38 | 38 |
39 /* count of menus/dboxes currently up */ | 39 /* count of menus/dboxes currently up */ |
121 * structure. If KEY is not a keyword, or is an unknown keyword, then | 121 * structure. If KEY is not a keyword, or is an unknown keyword, then |
122 * error is signaled. | 122 * error is signaled. |
123 */ | 123 */ |
124 void | 124 void |
125 gui_item_add_keyval_pair (struct gui_item *pgui_item, | 125 gui_item_add_keyval_pair (struct gui_item *pgui_item, |
126 Lisp_Object key, Lisp_Object val) | 126 Lisp_Object key, Lisp_Object val, |
127 Error_behavior errb) | |
127 { | 128 { |
128 if (!KEYWORDP (key)) | 129 if (!KEYWORDP (key)) |
129 signal_simple_error_2 ("Non-keyword in gui item", key, pgui_item->name); | 130 signal_simple_error_2 ("Non-keyword in gui item", key, pgui_item->name); |
130 | 131 |
131 if (EQ (key, Q_suffix)) pgui_item->suffix = val; | 132 if (EQ (key, Q_suffix)) pgui_item->suffix = val; |
134 else if (EQ (key, Q_config)) pgui_item->config = val; | 135 else if (EQ (key, Q_config)) pgui_item->config = val; |
135 else if (EQ (key, Q_filter)) pgui_item->filter = val; | 136 else if (EQ (key, Q_filter)) pgui_item->filter = val; |
136 else if (EQ (key, Q_style)) pgui_item->style = val; | 137 else if (EQ (key, Q_style)) pgui_item->style = val; |
137 else if (EQ (key, Q_selected)) pgui_item->selected = val; | 138 else if (EQ (key, Q_selected)) pgui_item->selected = val; |
138 else if (EQ (key, Q_keys)) pgui_item->keys = val; | 139 else if (EQ (key, Q_keys)) pgui_item->keys = val; |
140 else if (EQ (key, Q_callback)) pgui_item->callback = val; | |
139 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */ | 141 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */ |
140 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ | 142 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ |
141 else | 143 else if (ERRB_EQ (errb, ERROR_ME)) |
142 signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name); | 144 signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name); |
143 } | 145 } |
144 | 146 |
145 /* | 147 /* |
146 * ITEM is a lisp vector, describing a menu item or a button. The | 148 * ITEM is a lisp vector, describing a menu item or a button. The |
147 * function extracts the description of the item into the PGUI_ITEM | 149 * function extracts the description of the item into the PGUI_ITEM |
148 * structure. | 150 * structure. |
149 */ | 151 */ |
150 void | 152 static void |
151 gui_parse_item_keywords (Lisp_Object item, struct gui_item *pgui_item) | 153 gui_parse_item_keywords_internal (Lisp_Object item, struct gui_item *pgui_item, |
154 Error_behavior errb) | |
152 { | 155 { |
153 int length, plist_p, start; | 156 int length, plist_p, start; |
154 Lisp_Object *contents; | 157 Lisp_Object *contents; |
155 | 158 |
156 CHECK_VECTOR (item); | 159 CHECK_VECTOR (item); |
199 | 202 |
200 for (i = start; i < length;) | 203 for (i = start; i < length;) |
201 { | 204 { |
202 Lisp_Object key = contents [i++]; | 205 Lisp_Object key = contents [i++]; |
203 Lisp_Object val = contents [i++]; | 206 Lisp_Object val = contents [i++]; |
204 gui_item_add_keyval_pair (pgui_item, key, val); | 207 gui_item_add_keyval_pair (pgui_item, key, val, errb); |
205 } | 208 } |
206 } | 209 } |
210 } | |
211 | |
212 void | |
213 gui_parse_item_keywords (Lisp_Object item, struct gui_item *pgui_item) | |
214 { | |
215 gui_parse_item_keywords_internal (item, pgui_item, ERROR_ME); | |
216 } | |
217 | |
218 void | |
219 gui_parse_item_keywords_no_errors (Lisp_Object item, struct gui_item *pgui_item) | |
220 { | |
221 gui_parse_item_keywords_internal (item, pgui_item, ERROR_ME_NOT); | |
207 } | 222 } |
208 | 223 |
209 /* | 224 /* |
210 * Decide whether a GUI item is active by evaluating its :active form | 225 * Decide whether a GUI item is active by evaluating its :active form |
211 * if any | 226 * if any |
401 defkeyword (&Q_filter, ":filter"); | 416 defkeyword (&Q_filter, ":filter"); |
402 defkeyword (&Q_config, ":config"); | 417 defkeyword (&Q_config, ":config"); |
403 defkeyword (&Q_included, ":included"); | 418 defkeyword (&Q_included, ":included"); |
404 defkeyword (&Q_accelerator, ":accelerator"); | 419 defkeyword (&Q_accelerator, ":accelerator"); |
405 defkeyword (&Q_label, ":label"); | 420 defkeyword (&Q_label, ":label"); |
421 defkeyword (&Q_callback, ":callback"); | |
406 | 422 |
407 defsymbol (&Qtoggle, "toggle"); | 423 defsymbol (&Qtoggle, "toggle"); |
408 defsymbol (&Qradio, "radio"); | 424 defsymbol (&Qradio, "radio"); |
409 | 425 |
410 #ifdef HAVE_POPUPS | 426 #ifdef HAVE_POPUPS |