Mercurial > hg > xemacs-beta
comparison src/gui.c @ 424:11054d720c21 r21-2-20
Import from CVS: tag r21-2-20
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:26:11 +0200 |
parents | 95016f13131a |
children |
comparison
equal
deleted
inserted
replaced
423:28d9c139be4c | 424:11054d720c21 |
---|---|
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, Q_callback; | 34 Lisp_Object Q_accelerator, Q_label, Q_callback; |
35 Lisp_Object Qtoggle, Qradio; | 35 Lisp_Object Qtoggle, Qradio; |
36 | |
37 static Lisp_Object parse_gui_item_tree_list (Lisp_Object list); | |
36 | 38 |
37 #ifdef HAVE_POPUPS | 39 #ifdef HAVE_POPUPS |
38 | 40 |
39 /* count of menus/dboxes currently up */ | 41 /* count of menus/dboxes currently up */ |
40 int popup_up_p; | 42 int popup_up_p; |
150 lp->keys = Qnil; | 152 lp->keys = Qnil; |
151 lp->accelerator = Qnil; | 153 lp->accelerator = Qnil; |
152 } | 154 } |
153 | 155 |
154 Lisp_Object | 156 Lisp_Object |
155 allocate_gui_item () | 157 allocate_gui_item (void) |
156 { | 158 { |
157 struct Lisp_Gui_Item *lp = | 159 struct Lisp_Gui_Item *lp = |
158 alloc_lcrecord_type (struct Lisp_Gui_Item, &lrecord_gui_item); | 160 alloc_lcrecord_type (struct Lisp_Gui_Item, &lrecord_gui_item); |
159 Lisp_Object val; | 161 Lisp_Object val; |
160 | 162 |
379 */ | 381 */ |
380 unsigned int | 382 unsigned int |
381 gui_item_display_flush_left (Lisp_Object gui_item, | 383 gui_item_display_flush_left (Lisp_Object gui_item, |
382 char* buf, Bytecount buf_len) | 384 char* buf, Bytecount buf_len) |
383 { | 385 { |
386 /* This function can call lisp */ | |
384 char *p = buf; | 387 char *p = buf; |
385 Bytecount len; | 388 Bytecount len; |
386 struct Lisp_Gui_Item* pgui_item = XGUI_ITEM (gui_item); | 389 struct Lisp_Gui_Item* pgui_item = XGUI_ITEM (gui_item); |
387 | 390 |
388 /* Copy item name first */ | 391 /* Copy item name first */ |
466 return 0; | 469 return 0; |
467 } | 470 } |
468 #endif /* HAVE_WINDOW_SYSTEM */ | 471 #endif /* HAVE_WINDOW_SYSTEM */ |
469 | 472 |
470 static Lisp_Object | 473 static Lisp_Object |
471 mark_gui_item (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 474 mark_gui_item (Lisp_Object obj) |
472 { | 475 { |
473 struct Lisp_Gui_Item *p = XGUI_ITEM (obj); | 476 struct Lisp_Gui_Item *p = XGUI_ITEM (obj); |
474 | 477 |
475 markobj (p->name); | 478 mark_object (p->name); |
476 markobj (p->callback); | 479 mark_object (p->callback); |
477 markobj (p->config); | 480 mark_object (p->config); |
478 markobj (p->suffix); | 481 mark_object (p->suffix); |
479 markobj (p->active); | 482 mark_object (p->active); |
480 markobj (p->included); | 483 mark_object (p->included); |
481 markobj (p->config); | 484 mark_object (p->config); |
482 markobj (p->filter); | 485 mark_object (p->filter); |
483 markobj (p->style); | 486 mark_object (p->style); |
484 markobj (p->selected); | 487 mark_object (p->selected); |
485 markobj (p->keys); | 488 mark_object (p->keys); |
486 markobj (p->accelerator); | 489 mark_object (p->accelerator); |
487 | 490 |
488 return Qnil; | 491 return Qnil; |
489 } | 492 } |
490 | 493 |
491 static unsigned long | 494 static unsigned long |
559 error ("printing unreadable object #<gui-item 0x%x>", g->header.uid); | 562 error ("printing unreadable object #<gui-item 0x%x>", g->header.uid); |
560 | 563 |
561 write_c_string ("#<gui-item ", printcharfun); | 564 write_c_string ("#<gui-item ", printcharfun); |
562 sprintf (buf, "0x%x>", g->header.uid); | 565 sprintf (buf, "0x%x>", g->header.uid); |
563 write_c_string (buf, printcharfun); | 566 write_c_string (buf, printcharfun); |
567 } | |
568 | |
569 /* parse a glyph descriptor into a tree of gui items. | |
570 | |
571 The gui_item slot of an image instance can be a single item or an | |
572 arbitrarily nested hierarchy of item lists. */ | |
573 | |
574 static Lisp_Object parse_gui_item_tree_item (Lisp_Object entry) | |
575 { | |
576 Lisp_Object ret = entry; | |
577 if (VECTORP (entry)) | |
578 { | |
579 ret = gui_parse_item_keywords_no_errors (entry); | |
580 } | |
581 else if (STRINGP (entry)) | |
582 { | |
583 CHECK_STRING (entry); | |
584 } | |
585 else | |
586 signal_simple_error ("item must be a vector or a string", entry); | |
587 | |
588 return ret; | |
589 } | |
590 | |
591 Lisp_Object parse_gui_item_tree_children (Lisp_Object list) | |
592 { | |
593 Lisp_Object rest, ret = Qnil; | |
594 CHECK_CONS (list); | |
595 /* recursively add items to the tree view */ | |
596 LIST_LOOP (rest, list) | |
597 { | |
598 Lisp_Object sub; | |
599 if (CONSP (XCAR (rest))) | |
600 sub = parse_gui_item_tree_list (XCAR (rest)); | |
601 else | |
602 sub = parse_gui_item_tree_item (XCAR (rest)); | |
603 | |
604 ret = Fcons (sub, ret); | |
605 } | |
606 /* make the order the same as the items we have parsed */ | |
607 return Fnreverse (ret); | |
608 } | |
609 | |
610 static Lisp_Object parse_gui_item_tree_list (Lisp_Object list) | |
611 { | |
612 Lisp_Object ret; | |
613 CHECK_CONS (list); | |
614 /* first one can never be a list */ | |
615 ret = parse_gui_item_tree_item (XCAR (list)); | |
616 return Fcons (ret, parse_gui_item_tree_children (XCDR (list))); | |
564 } | 617 } |
565 | 618 |
566 DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, | 619 DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, |
567 mark_gui_item, print_gui_item, | 620 mark_gui_item, print_gui_item, |
568 0, gui_item_equal, | 621 0, gui_item_equal, |