aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2008-06-09 22:06:21 +0000
committerJason Rumney2008-06-09 22:06:21 +0000
commit25be292e5f43dadef3e0cb00ddd126939e75ea35 (patch)
tree4b7aeb80277a16fbc685a856a5cf1d95ec7fe503
parent593c843ca9bc9ef3f1151ed9f67f9c0d098e60c6 (diff)
downloademacs-25be292e5f43dadef3e0cb00ddd126939e75ea35.tar.gz
emacs-25be292e5f43dadef3e0cb00ddd126939e75ea35.zip
(digest_single_submenu): Remove.
(syms_of_w32menu): Don't initialise variables that have moved to menu.c.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/w32menu.c182
2 files changed, 3 insertions, 182 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 63dc2fbd007..1aa79a1c674 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,9 @@
2 2
3 * w32menu.c (Fx_popup_menu): Unwind protect while building menu. 3 * w32menu.c (Fx_popup_menu): Unwind protect while building menu.
4 (parse_single_submenu): Remove. 4 (parse_single_submenu): Remove.
5 (digest_single_submenu): Remove.
6 (syms_of_w32menu): Don't initialise variables that have moved
7 to menu.c.
5 8
6 * menu.c (single_keymap_panes, push_menu_pane, push_menu_item): 9 * menu.c (single_keymap_panes, push_menu_pane, push_menu_item):
7 Make static again. 10 Make static again.
diff --git a/src/w32menu.c b/src/w32menu.c
index a2936bc8e41..e3fdf29ac95 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -623,186 +623,6 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
623} 623}
624 624
625 625
626/* Create a tree of widget_value objects
627 representing the panes and items
628 in menu_items starting at index START, up to index END. */
629
630static widget_value *
631digest_single_submenu (start, end, top_level_items)
632 int start, end, top_level_items;
633{
634 widget_value *wv, *prev_wv, *save_wv, *first_wv;
635 int i;
636 int submenu_depth = 0;
637 widget_value **submenu_stack;
638
639 submenu_stack
640 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
641 wv = xmalloc_widget_value ();
642 wv->name = "menu";
643 wv->value = 0;
644 wv->enabled = 1;
645 wv->button_type = BUTTON_TYPE_NONE;
646 wv->help = Qnil;
647 first_wv = wv;
648 save_wv = 0;
649 prev_wv = 0;
650
651 /* Loop over all panes and items made by the preceding call
652 to parse_single_submenu and construct a tree of widget_value objects.
653 Ignore the panes and items used by previous calls to
654 digest_single_submenu, even though those are also in menu_items. */
655 i = start;
656 while (i < end)
657 {
658 if (EQ (AREF (menu_items, i), Qnil))
659 {
660 submenu_stack[submenu_depth++] = save_wv;
661 save_wv = prev_wv;
662 prev_wv = 0;
663 i++;
664 }
665 else if (EQ (AREF (menu_items, i), Qlambda))
666 {
667 prev_wv = save_wv;
668 save_wv = submenu_stack[--submenu_depth];
669 i++;
670 }
671 else if (EQ (AREF (menu_items, i), Qt)
672 && submenu_depth != 0)
673 i += MENU_ITEMS_PANE_LENGTH;
674 /* Ignore a nil in the item list.
675 It's meaningful only for dialog boxes. */
676 else if (EQ (AREF (menu_items, i), Qquote))
677 i += 1;
678 else if (EQ (AREF (menu_items, i), Qt))
679 {
680 /* Create a new pane. */
681 Lisp_Object pane_name, prefix;
682 char *pane_string;
683
684 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
685 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
686
687 if (STRINGP (pane_name))
688 {
689 if (unicode_append_menu)
690 /* Encode as UTF-8 for now. */
691 pane_name = ENCODE_UTF_8 (pane_name);
692 else if (STRING_MULTIBYTE (pane_name))
693 pane_name = ENCODE_SYSTEM (pane_name);
694
695 ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
696 }
697
698 pane_string = (NILP (pane_name)
699 ? "" : (char *) SDATA (pane_name));
700 /* If there is just one top-level pane, put all its items directly
701 under the top-level menu. */
702 if (menu_items_n_panes == 1)
703 pane_string = "";
704
705 /* If the pane has a meaningful name,
706 make the pane a top-level menu item
707 with its items as a submenu beneath it. */
708 if (strcmp (pane_string, ""))
709 {
710 wv = xmalloc_widget_value ();
711 if (save_wv)
712 save_wv->next = wv;
713 else
714 first_wv->contents = wv;
715 wv->lname = pane_name;
716 /* Set value to 1 so update_submenu_strings can handle '@' */
717 wv->value = (char *) 1;
718 wv->enabled = 1;
719 wv->button_type = BUTTON_TYPE_NONE;
720 wv->help = Qnil;
721 }
722 save_wv = wv;
723 prev_wv = 0;
724 i += MENU_ITEMS_PANE_LENGTH;
725 }
726 else
727 {
728 /* Create a new item within current pane. */
729 Lisp_Object item_name, enable, descrip, def, type, selected;
730 Lisp_Object help;
731
732 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
733 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
734 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
735 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
736 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
737 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
738 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
739
740 if (STRINGP (item_name))
741 {
742 if (unicode_append_menu)
743 item_name = ENCODE_UTF_8 (item_name);
744 else if (STRING_MULTIBYTE (item_name))
745 item_name = ENCODE_SYSTEM (item_name);
746
747 ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
748 }
749
750 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
751 {
752 descrip = ENCODE_SYSTEM (descrip);
753 ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
754 }
755
756 wv = xmalloc_widget_value ();
757 if (prev_wv)
758 prev_wv->next = wv;
759 else
760 save_wv->contents = wv;
761
762 wv->lname = item_name;
763 if (!NILP (descrip))
764 wv->lkey = descrip;
765 wv->value = 0;
766 /* The EMACS_INT cast avoids a warning. There's no problem
767 as long as pointers have enough bits to hold small integers. */
768 wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
769 wv->enabled = !NILP (enable);
770
771 if (NILP (type))
772 wv->button_type = BUTTON_TYPE_NONE;
773 else if (EQ (type, QCradio))
774 wv->button_type = BUTTON_TYPE_RADIO;
775 else if (EQ (type, QCtoggle))
776 wv->button_type = BUTTON_TYPE_TOGGLE;
777 else
778 abort ();
779
780 wv->selected = !NILP (selected);
781 if (!STRINGP (help))
782 help = Qnil;
783
784 wv->help = help;
785
786 prev_wv = wv;
787
788 i += MENU_ITEMS_ITEM_LENGTH;
789 }
790 }
791
792 /* If we have just one "menu item"
793 that was originally a button, return it by itself. */
794 if (top_level_items && first_wv->contents && first_wv->contents->next == 0)
795 {
796 wv = first_wv->contents;
797 free_widget_value (first_wv);
798 return wv;
799 }
800
801 return first_wv;
802}
803
804
805
806/* Set the contents of the menubar widgets of frame F. 626/* Set the contents of the menubar widgets of frame F.
807 The argument FIRST_TIME is currently ignored; 627 The argument FIRST_TIME is currently ignored;
808 it is set the first time this is called, from initialize_frame_menubar. */ 628 it is set the first time this is called, from initialize_frame_menubar. */
@@ -2135,8 +1955,6 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
2135void syms_of_w32menu () 1955void syms_of_w32menu ()
2136{ 1956{
2137 globals_of_w32menu (); 1957 globals_of_w32menu ();
2138 staticpro (&menu_items);
2139 menu_items = Qnil;
2140 1958
2141 current_popup_menu = NULL; 1959 current_popup_menu = NULL;
2142 1960