/[emacs]/emacs/src/w32menu.c
ViewVC logotype

Diff of /emacs/src/w32menu.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.62 by jasonr, Mon Jan 20 20:17:48 2003 UTC revision 1.63 by lektu, Tue Feb 4 14:03:15 2003 UTC
# Line 69  typedef struct _widget_value Line 69  typedef struct _widget_value
69    char*         name;    char*         name;
70    /* value (meaning depend on widget type) */    /* value (meaning depend on widget type) */
71    char*         value;    char*         value;
72    /* keyboard equivalent. no implications for XtTranslations */    /* keyboard equivalent. no implications for XtTranslations */
73    char*         key;    char*         key;
74    /* Help string or nil if none.    /* Help string or nil if none.
75       GC finds this string through the frame's menu_bar_vector       GC finds this string through the frame's menu_bar_vector
# Line 500  single_keymap_panes (keymap, pane_name, Line 500  single_keymap_panes (keymap, pane_name,
500    
501  /* This is a subroutine of single_keymap_panes that handles one  /* This is a subroutine of single_keymap_panes that handles one
502     keymap entry.     keymap entry.
503     KEY is a key in a keymap and ITEM is its binding.     KEY is a key in a keymap and ITEM is its binding.
504     PENDING_MAPS_PTR points to a list of keymaps waiting to be made into     PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
505     separate panes.     separate panes.
506     If NOTREAL is nonzero, only check for equivalent key bindings, don't     If NOTREAL is nonzero, only check for equivalent key bindings, don't
# Line 516  single_menu_item (key, item, pending_map Line 516  single_menu_item (key, item, pending_map
516    Lisp_Object map, item_string, enabled;    Lisp_Object map, item_string, enabled;
517    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
518    int res;    int res;
519      
520    /* Parse the menu item and leave the result in item_properties.  */    /* Parse the menu item and leave the result in item_properties.  */
521    GCPRO2 (key, item);    GCPRO2 (key, item);
522    res = parse_menu_item (item, notreal, 0);    res = parse_menu_item (item, notreal, 0);
# Line 525  single_menu_item (key, item, pending_map Line 525  single_menu_item (key, item, pending_map
525      return;                     /* Not a menu item.  */      return;                     /* Not a menu item.  */
526    
527    map = AREF (item_properties, ITEM_PROPERTY_MAP);    map = AREF (item_properties, ITEM_PROPERTY_MAP);
528      
529    if (notreal)    if (notreal)
530      {      {
531        /* We don't want to make a menu, just traverse the keymaps to        /* We don't want to make a menu, just traverse the keymaps to
# Line 536  single_menu_item (key, item, pending_map Line 536  single_menu_item (key, item, pending_map
536      }      }
537    
538    enabled = AREF (item_properties, ITEM_PROPERTY_ENABLE);    enabled = AREF (item_properties, ITEM_PROPERTY_ENABLE);
539    item_string = AREF (item_properties, ITEM_PROPERTY_NAME);    item_string = AREF (item_properties, ITEM_PROPERTY_NAME);
540    
541    if (!NILP (map) && SREF (item_string, 0) == '@')    if (!NILP (map) && SREF (item_string, 0) == '@')
542      {      {
# Line 811  cached information about equivalent key Line 811  cached information about equivalent key
811    
812        keymaps = 0;        keymaps = 0;
813      }      }
814      
815    if (NILP (position))    if (NILP (position))
816      {      {
817        discard_menu_items ();        discard_menu_items ();
# Line 828  cached information about equivalent key Line 828  cached information about equivalent key
828        discard_menu_items ();        discard_menu_items ();
829        UNGCPRO;        UNGCPRO;
830        return Qnil;        return Qnil;
831      }          }
832      
833    /* Display them in a menu.  */    /* Display them in a menu.  */
834    BLOCK_INPUT;    BLOCK_INPUT;
835    
# Line 974  on the left of the dialog box and all fo Line 974  on the left of the dialog box and all fo
974     But first we recompute the menu bar contents (the whole tree).     But first we recompute the menu bar contents (the whole tree).
975    
976     This way we can safely execute Lisp code.  */     This way we can safely execute Lisp code.  */
977      
978  void  void
979  x_activate_menubar (f)  x_activate_menubar (f)
980       FRAME_PTR f;       FRAME_PTR f;
# Line 1105  free_menubar_widget_value_tree (wv) Line 1105  free_menubar_widget_value_tree (wv)
1105       widget_value *wv;       widget_value *wv;
1106  {  {
1107    if (! wv) return;    if (! wv) return;
1108      
1109    wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;    wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
1110    
1111    if (wv->contents && (wv->contents != (widget_value*)1))    if (wv->contents && (wv->contents != (widget_value*)1))
# Line 1171  parse_single_submenu (item_key, item_nam Line 1171  parse_single_submenu (item_key, item_nam
1171                                 item_key, 0, 10);                                 item_key, 0, 10);
1172          }          }
1173      }      }
1174      
1175    return top_level_items;    return top_level_items;
1176  }  }
1177    
# Line 1200  digest_single_submenu (start, end, top_l Line 1200  digest_single_submenu (start, end, top_l
1200    first_wv = wv;    first_wv = wv;
1201    save_wv = 0;    save_wv = 0;
1202    prev_wv = 0;    prev_wv = 0;
1203    
1204    /* Loop over all panes and items made by the preceding call    /* Loop over all panes and items made by the preceding call
1205       to parse_single_submenu and construct a tree of widget_value objects.       to parse_single_submenu and construct a tree of widget_value objects.
1206       Ignore the panes and items used by previous calls to       Ignore the panes and items used by previous calls to
# Line 1304  digest_single_submenu (start, end, top_l Line 1304  digest_single_submenu (start, end, top_l
1304  #endif /* not HAVE_MULTILINGUAL_MENU */  #endif /* not HAVE_MULTILINGUAL_MENU */
1305    
1306            wv = xmalloc_widget_value ();            wv = xmalloc_widget_value ();
1307            if (prev_wv)            if (prev_wv)
1308              prev_wv->next = wv;              prev_wv->next = wv;
1309            else            else
1310              save_wv->contents = wv;              save_wv->contents = wv;
# Line 1477  set_frame_menubar (f, first_time, deep_p Line 1477  set_frame_menubar (f, first_time, deep_p
1477            menu_items_n_panes = submenu_n_panes[i];            menu_items_n_panes = submenu_n_panes[i];
1478            wv = digest_single_submenu (submenu_start[i], submenu_end[i],            wv = digest_single_submenu (submenu_start[i], submenu_end[i],
1479                                        submenu_top_level_items[i]);                                        submenu_top_level_items[i]);
1480            if (prev_wv)            if (prev_wv)
1481              prev_wv->next = wv;              prev_wv->next = wv;
1482            else            else
1483              first_wv->contents = wv;              first_wv->contents = wv;
# Line 1559  set_frame_menubar (f, first_time, deep_p Line 1559  set_frame_menubar (f, first_time, deep_p
1559               This value just has to be different from small integers.  */               This value just has to be different from small integers.  */
1560            wv->call_data = (void *) (EMACS_INT) (-1);            wv->call_data = (void *) (EMACS_INT) (-1);
1561    
1562            if (prev_wv)            if (prev_wv)
1563              prev_wv->next = wv;              prev_wv->next = wv;
1564            else            else
1565              first_wv->contents = wv;              first_wv->contents = wv;
# Line 1595  set_frame_menubar (f, first_time, deep_p Line 1595  set_frame_menubar (f, first_time, deep_p
1595    
1596      f->output_data.w32->menubar_widget = menubar_widget;      f->output_data.w32->menubar_widget = menubar_widget;
1597      SetMenu (FRAME_W32_WINDOW (f), f->output_data.w32->menubar_widget);      SetMenu (FRAME_W32_WINDOW (f), f->output_data.w32->menubar_widget);
1598      /* Causes flicker when menu bar is updated      /* Causes flicker when menu bar is updated
1599      DrawMenuBar (FRAME_W32_WINDOW (f)); */      DrawMenuBar (FRAME_W32_WINDOW (f)); */
1600    
1601      /* Force the window size to be recomputed so that the frame's text      /* Force the window size to be recomputed so that the frame's text
# Line 1697  w32_menu_show (f, x, y, for_click, keyma Line 1697  w32_menu_show (f, x, y, for_click, keyma
1697    wv->help = Qnil;    wv->help = Qnil;
1698    first_wv = wv;    first_wv = wv;
1699    first_pane = 1;    first_pane = 1;
1700    
1701    /* Loop over all panes and items, filling in the tree.  */    /* Loop over all panes and items, filling in the tree.  */
1702    i = 0;    i = 0;
1703    while (i < menu_items_used)    while (i < menu_items_used)
# Line 1800  w32_menu_show (f, x, y, for_click, keyma Line 1800  w32_menu_show (f, x, y, for_click, keyma
1800  #endif /* not HAVE_MULTILINGUAL_MENU */  #endif /* not HAVE_MULTILINGUAL_MENU */
1801    
1802            wv = xmalloc_widget_value ();            wv = xmalloc_widget_value ();
1803            if (prev_wv)            if (prev_wv)
1804              prev_wv->next = wv;              prev_wv->next = wv;
1805            else            else
1806              save_wv->contents = wv;              save_wv->contents = wv;
1807            wv->name = (char *) SDATA (item_name);            wv->name = (char *) SDATA (item_name);
1808            if (!NILP (descrip))            if (!NILP (descrip))
# Line 1872  w32_menu_show (f, x, y, for_click, keyma Line 1872  w32_menu_show (f, x, y, for_click, keyma
1872    menu_item_selection = 0;    menu_item_selection = 0;
1873    
1874    /* Display the menu.  */    /* Display the menu.  */
1875    menu_item_selection = SendMessage (FRAME_W32_WINDOW (f),    menu_item_selection = SendMessage (FRAME_W32_WINDOW (f),
1876                                       WM_EMACS_TRACKPOPUPMENU,                                       WM_EMACS_TRACKPOPUPMENU,
1877                                       (WPARAM)menu, (LPARAM)&pos);                                       (WPARAM)menu, (LPARAM)&pos);
1878    
# Line 1981  w32_dialog_show (f, keymaps, title, erro Line 1981  w32_dialog_show (f, keymaps, title, erro
1981      pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);      pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);
1982      prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX);      prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX);
1983      pane_string = (NILP (pane_name)      pane_string = (NILP (pane_name)
1984                     ? "" : (char *) SDATA (pane_name));                       ? "" : (char *) SDATA (pane_name));
1985      prev_wv = xmalloc_widget_value ();      prev_wv = xmalloc_widget_value ();
1986      prev_wv->value = pane_string;      prev_wv->value = pane_string;
1987      if (keymaps && !NILP (prefix))      if (keymaps && !NILP (prefix))
# Line 1990  w32_dialog_show (f, keymaps, title, erro Line 1990  w32_dialog_show (f, keymaps, title, erro
1990      prev_wv->name = "message";      prev_wv->name = "message";
1991      prev_wv->help = Qnil;      prev_wv->help = Qnil;
1992      first_wv = prev_wv;      first_wv = prev_wv;
1993    
1994      /* Loop over all panes and items, filling in the tree.  */      /* Loop over all panes and items, filling in the tree.  */
1995      i = MENU_ITEMS_PANE_LENGTH;      i = MENU_ITEMS_PANE_LENGTH;
1996      while (i < menu_items_used)      while (i < menu_items_used)
1997        {        {
1998            
1999          /* Create a new item within current pane.  */          /* Create a new item within current pane.  */
2000          Lisp_Object item_name, enable, descrip, help;          Lisp_Object item_name, enable, descrip, help;
2001    
# Line 2003  w32_dialog_show (f, keymaps, title, erro Line 2003  w32_dialog_show (f, keymaps, title, erro
2003          enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);          enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
2004          descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);          descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
2005          help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);          help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
2006            
2007          if (NILP (item_name))          if (NILP (item_name))
2008            {            {
2009              free_menubar_widget_value_tree (first_wv);              free_menubar_widget_value_tree (first_wv);
# Line 2087  w32_dialog_show (f, keymaps, title, erro Line 2087  w32_dialog_show (f, keymaps, title, erro
2087    /* Process events that apply to the menu.  */    /* Process events that apply to the menu.  */
2088    popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);    popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);
2089    
2090    lw_destroy_all_widgets (dialog_id);    lw_destroy_all_widgets (dialog_id);
2091    
2092    /* Find the selected item, and its pane, to return    /* Find the selected item, and its pane, to return
2093       the proper value.  */       the proper value.  */
# Line 2164  add_menu_item (HMENU menu, widget_value Line 2164  add_menu_item (HMENU menu, widget_value
2164        fuFlags = MF_SEPARATOR;        fuFlags = MF_SEPARATOR;
2165        out_string = NULL;        out_string = NULL;
2166      }      }
2167    else    else
2168      {      {
2169        if (wv->enabled)        if (wv->enabled)
2170          fuFlags = MF_STRING;          fuFlags = MF_STRING;

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26