Mercurial > hg > xemacs-beta
comparison src/menubar-x.c @ 377:d883f39b8495 r21-2b4
Import from CVS: tag r21-2b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:05:42 +0200 |
parents | 6240c7796c7a |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
376:e2295b4d9f2e | 377:d883f39b8495 |
---|---|
144 | 144 |
145 if (STRINGP (XCAR (desc))) | 145 if (STRINGP (XCAR (desc))) |
146 { | 146 { |
147 Lisp_Object key, val; | 147 Lisp_Object key, val; |
148 Lisp_Object include_p = Qnil, hook_fn = Qnil, config_tag = Qnil; | 148 Lisp_Object include_p = Qnil, hook_fn = Qnil, config_tag = Qnil; |
149 Lisp_Object active_p = Qt; | |
149 Lisp_Object accel; | 150 Lisp_Object accel; |
150 int included_spec = 0; | 151 int included_spec = 0; |
152 int active_spec = 0; | |
151 wv->type = CASCADE_TYPE; | 153 wv->type = CASCADE_TYPE; |
152 wv->enabled = 1; | 154 wv->enabled = 1; |
153 wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); | 155 wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); |
154 | 156 |
155 accel = menu_name_to_accelerator (wv->name); | 157 accel = menu_name_to_accelerator (wv->name); |
170 include_p = val, included_spec = 1; | 172 include_p = val, included_spec = 1; |
171 else if (EQ (key, Q_config)) | 173 else if (EQ (key, Q_config)) |
172 config_tag = val; | 174 config_tag = val; |
173 else if (EQ (key, Q_filter)) | 175 else if (EQ (key, Q_filter)) |
174 hook_fn = val; | 176 hook_fn = val; |
177 else if (EQ (key, Q_active)) | |
178 active_p = val, active_spec = 1; | |
175 else if (EQ (key, Q_accelerator)) | 179 else if (EQ (key, Q_accelerator)) |
176 { | 180 { |
177 if ( SYMBOLP (val) | 181 if ( SYMBOLP (val) |
178 || CHARP (val)) | 182 || CHARP (val)) |
179 wv->accel = LISP_TO_VOID (val); | 183 wv->accel = LISP_TO_VOID (val); |
180 else | 184 else |
181 signal_simple_error ("bad keyboard accelerator", val); | 185 signal_simple_error ("bad keyboard accelerator", val); |
182 } | 186 } |
187 else if (EQ (key, Q_label)) | |
188 { | |
189 /* implement in 21.2 */ | |
190 } | |
183 else | 191 else |
184 signal_simple_error ("unknown menu cascade keyword", cascade); | 192 signal_simple_error ("unknown menu cascade keyword", cascade); |
185 } | 193 } |
186 | 194 |
187 if ((!NILP (config_tag) | 195 if ((!NILP (config_tag) |
189 || (included_spec && NILP (Feval (include_p)))) | 197 || (included_spec && NILP (Feval (include_p)))) |
190 { | 198 { |
191 wv = NULL; | 199 wv = NULL; |
192 goto menu_item_done; | 200 goto menu_item_done; |
193 } | 201 } |
194 if (!NILP (hook_fn)) | 202 |
203 if (active_spec) | |
204 active_p = Feval (active_p); | |
205 | |
206 if (!NILP (hook_fn) && !NILP (active_p)) | |
195 { | 207 { |
196 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF | 208 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF |
197 if (filter_p || depth == 0) | 209 if (filter_p || depth == 0) |
198 { | 210 { |
199 #endif | 211 #endif |
234 sep_wv->next = 0; | 246 sep_wv->next = 0; |
235 | 247 |
236 wv->contents = title_wv; | 248 wv->contents = title_wv; |
237 prev = sep_wv; | 249 prev = sep_wv; |
238 } | 250 } |
251 wv->enabled = ! NILP (active_p); | |
252 if (deep_p && !wv->enabled && !NILP (desc)) | |
253 { | |
254 widget_value *dummy; | |
255 /* Add a fake entry so the menus show up */ | |
256 wv->contents = dummy = xmalloc_widget_value (); | |
257 dummy->name = "(inactive)"; | |
258 dummy->accel = NULL; | |
259 dummy->enabled = 0; | |
260 dummy->selected = 0; | |
261 dummy->value = NULL; | |
262 dummy->type = BUTTON_TYPE; | |
263 dummy->call_data = NULL; | |
264 dummy->next = NULL; | |
265 | |
266 goto menu_item_done; | |
267 } | |
268 | |
239 } | 269 } |
240 else if (menubar_root_p) | 270 else if (menubar_root_p) |
241 { | 271 { |
242 wv->name = (char *) "menubar"; | 272 wv->name = (char *) "menubar"; |
243 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and | 273 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and |
246 else | 276 else |
247 { | 277 { |
248 signal_simple_error ("menu name (first element) must be a string", | 278 signal_simple_error ("menu name (first element) must be a string", |
249 desc); | 279 desc); |
250 } | 280 } |
251 | 281 |
252 wv->enabled = 1; | |
253 if (deep_p || menubar_root_p) | 282 if (deep_p || menubar_root_p) |
254 { | 283 { |
255 widget_value *next; | 284 widget_value *next; |
256 for (; !NILP (desc); desc = Fcdr (desc)) | 285 for (; !NILP (desc); desc = Fcdr (desc)) |
257 { | 286 { |