Mercurial > hg > xemacs-beta
comparison src/gui.c @ 420:41dbb7a9d5f2 r21-2-18
Import from CVS: tag r21-2-18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:24:09 +0200 |
parents | e804706bfb8c |
children | 95016f13131a |
comparison
equal
deleted
inserted
replaced
419:66615b78f1a5 | 420:41dbb7a9d5f2 |
---|---|
120 else if (EQ (key, Q_selected)) pgui_item->selected = val; | 120 else if (EQ (key, Q_selected)) pgui_item->selected = val; |
121 else if (EQ (key, Q_keys)) pgui_item->keys = val; | 121 else if (EQ (key, Q_keys)) pgui_item->keys = val; |
122 else if (EQ (key, Q_callback)) pgui_item->callback = val; | 122 else if (EQ (key, Q_callback)) pgui_item->callback = val; |
123 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */ | 123 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */ |
124 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ | 124 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ |
125 else if (EQ (key, Q_accelerator)) | |
126 { | |
127 if (SYMBOLP (val) || CHARP (val)) | |
128 pgui_item->accelerator = val; | |
129 else if (ERRB_EQ (errb, ERROR_ME)) | |
130 signal_simple_error ("Bad keyboard accelerator", val); | |
131 } | |
125 else if (ERRB_EQ (errb, ERROR_ME)) | 132 else if (ERRB_EQ (errb, ERROR_ME)) |
126 signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name); | 133 signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name); |
127 } | 134 } |
128 | 135 |
129 void | 136 void |
139 lp->config = Qnil; | 146 lp->config = Qnil; |
140 lp->filter = Qnil; | 147 lp->filter = Qnil; |
141 lp->style = Qnil; | 148 lp->style = Qnil; |
142 lp->selected = Qnil; | 149 lp->selected = Qnil; |
143 lp->keys = Qnil; | 150 lp->keys = Qnil; |
151 lp->accelerator = Qnil; | |
144 } | 152 } |
145 | 153 |
146 Lisp_Object | 154 Lisp_Object |
147 allocate_gui_item () | 155 allocate_gui_item () |
148 { | 156 { |
260 Fplist_put (plist, Q_style, pgui_item->style); | 268 Fplist_put (plist, Q_style, pgui_item->style); |
261 if (!NILP (pgui_item->selected)) | 269 if (!NILP (pgui_item->selected)) |
262 Fplist_put (plist, Q_selected, pgui_item->selected); | 270 Fplist_put (plist, Q_selected, pgui_item->selected); |
263 if (!NILP (pgui_item->keys)) | 271 if (!NILP (pgui_item->keys)) |
264 Fplist_put (plist, Q_keys, pgui_item->keys); | 272 Fplist_put (plist, Q_keys, pgui_item->keys); |
273 if (!NILP (pgui_item->accelerator)) | |
274 Fplist_put (plist, Q_accelerator, pgui_item->accelerator); | |
265 } | 275 } |
266 | 276 |
267 /* | 277 /* |
268 * Decide whether a GUI item is active by evaluating its :active form | 278 * Decide whether a GUI item is active by evaluating its :active form |
269 * if any | 279 * if any |
274 /* This function can call lisp */ | 284 /* This function can call lisp */ |
275 | 285 |
276 /* Shortcut to avoid evaluating Qt each time */ | 286 /* Shortcut to avoid evaluating Qt each time */ |
277 return (EQ (XGUI_ITEM (gui_item)->active, Qt) | 287 return (EQ (XGUI_ITEM (gui_item)->active, Qt) |
278 || !NILP (Feval (XGUI_ITEM (gui_item)->active))); | 288 || !NILP (Feval (XGUI_ITEM (gui_item)->active))); |
289 } | |
290 | |
291 /* set menu accelerator key to first underlined character in menu name */ | |
292 Lisp_Object | |
293 gui_item_accelerator (Lisp_Object gui_item) | |
294 { | |
295 struct Lisp_Gui_Item* pgui = XGUI_ITEM (gui_item); | |
296 | |
297 if (!NILP (pgui->accelerator)) | |
298 return pgui->accelerator; | |
299 | |
300 else | |
301 return pgui->name; | |
302 } | |
303 | |
304 Lisp_Object | |
305 gui_name_accelerator (Lisp_Object nm) | |
306 { | |
307 /* !!#### This function has not been Mule-ized */ | |
308 char* name = (char*)XSTRING_DATA (nm); | |
309 | |
310 while (*name) { | |
311 if (*name=='%') { | |
312 ++name; | |
313 if (!(*name)) | |
314 return Qnil; | |
315 if (*name=='_' && *(name+1)) | |
316 { | |
317 int accelerator = (int) (unsigned char) (*(name+1)); | |
318 return make_char (tolower (accelerator)); | |
319 } | |
320 } | |
321 ++name; | |
322 } | |
323 return Qnil; | |
279 } | 324 } |
280 | 325 |
281 /* | 326 /* |
282 * Decide whether a GUI item is selected by evaluating its :selected form | 327 * Decide whether a GUI item is selected by evaluating its :selected form |
283 * if any | 328 * if any |
425 { | 470 { |
426 struct Lisp_Gui_Item *p = XGUI_ITEM (obj); | 471 struct Lisp_Gui_Item *p = XGUI_ITEM (obj); |
427 | 472 |
428 markobj (p->name); | 473 markobj (p->name); |
429 markobj (p->callback); | 474 markobj (p->callback); |
475 markobj (p->config); | |
430 markobj (p->suffix); | 476 markobj (p->suffix); |
431 markobj (p->active); | 477 markobj (p->active); |
432 markobj (p->included); | 478 markobj (p->included); |
433 markobj (p->config); | 479 markobj (p->config); |
434 markobj (p->filter); | 480 markobj (p->filter); |
435 markobj (p->style); | 481 markobj (p->style); |
436 markobj (p->selected); | 482 markobj (p->selected); |
437 markobj (p->keys); | 483 markobj (p->keys); |
484 markobj (p->accelerator); | |
438 | 485 |
439 return Qnil; | 486 return Qnil; |
440 } | 487 } |
441 | 488 |
442 static unsigned long | 489 static unsigned long |
491 && | 538 && |
492 EQ (p1->style, p2->style) | 539 EQ (p1->style, p2->style) |
493 && | 540 && |
494 EQ (p1->selected, p2->selected) | 541 EQ (p1->selected, p2->selected) |
495 && | 542 && |
543 EQ (p1->accelerator, p2->accelerator) | |
544 && | |
496 EQ (p1->keys, p2->keys))) | 545 EQ (p1->keys, p2->keys))) |
497 return 0; | 546 return 0; |
498 return 1; | 547 return 1; |
499 } | 548 } |
500 | 549 |
514 | 563 |
515 DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, | 564 DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, |
516 mark_gui_item, print_gui_item, | 565 mark_gui_item, print_gui_item, |
517 0, gui_item_equal, | 566 0, gui_item_equal, |
518 gui_item_hash, | 567 gui_item_hash, |
568 0, | |
519 struct Lisp_Gui_Item); | 569 struct Lisp_Gui_Item); |
520 | 570 |
521 void | 571 void |
522 syms_of_gui (void) | 572 syms_of_gui (void) |
523 { | 573 { |