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

Diff of /emacs/src/xmenu.c

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

revision 1.232 by lektu, Thu Jul 11 14:17:28 2002 UTC revision 1.233 by raeburn, Mon Jul 15 00:00:41 2002 UTC
# Line 505  single_menu_item (key, item, pending_map Line 505  single_menu_item (key, item, pending_map
505    enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];    enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
506    item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];    item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
507    
508    if (!NILP (map) && XSTRING (item_string)->data[0] == '@')    if (!NILP (map) && SREF (item_string, 0) == '@')
509      {      {
510        if (!NILP (enabled))        if (!NILP (enabled))
511          /* An enabled separate pane. Remember this to handle it later.  */          /* An enabled separate pane. Remember this to handle it later.  */
# Line 551  single_menu_item (key, item, pending_map Line 551  single_menu_item (key, item, pending_map
551                    index++;              /* Skip a left, right divider. */                    index++;              /* Skip a left, right divider. */
552                  else                  else
553                    {                    {
554                      if (!submenu && XSTRING (tem)->data[0] != '\0'                      if (!submenu && SREF (tem, 0) != '\0'
555                          && XSTRING (tem)->data[0] != '-')                          && SREF (tem, 0) != '-')
556                        XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME]                        XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME]
557                          = concat2 (build_string ("    "), tem);                          = concat2 (build_string ("    "), tem);
558                      index += MENU_ITEMS_ITEM_LENGTH;                      index += MENU_ITEMS_ITEM_LENGTH;
# Line 568  single_menu_item (key, item, pending_map Line 568  single_menu_item (key, item, pending_map
568            prefix = build_string (NILP (selected) ? "( ) " : "(*) ");            prefix = build_string (NILP (selected) ? "( ) " : "(*) ");
569        }        }
570      /* Not a button. If we have earlier buttons, then we need a prefix.  */      /* Not a button. If we have earlier buttons, then we need a prefix.  */
571      else if (!*notbuttons_ptr && XSTRING (item_string)->data[0] != '\0'      else if (!*notbuttons_ptr && SREF (item_string, 0) != '\0'
572               && XSTRING (item_string)->data[0] != '-')               && SREF (item_string, 0) != '-')
573        prefix = build_string ("    ");        prefix = build_string ("    ");
574    
575      if (!NILP (prefix))      if (!NILP (prefix))
# Line 1453  single_submenu (item_key, item_name, map Line 1453  single_submenu (item_key, item_name, map
1453              }              }
1454  #endif  #endif
1455            pane_string = (NILP (pane_name)            pane_string = (NILP (pane_name)
1456                           ? "" : (char *) XSTRING (pane_name)->data);                           ? "" : (char *) SDATA (pane_name));
1457            /* If there is just one top-level pane, put all its items directly            /* If there is just one top-level pane, put all its items directly
1458               under the top-level menu.  */               under the top-level menu.  */
1459            if (menu_items_n_panes == 1)            if (menu_items_n_panes == 1)
# Line 1517  single_submenu (item_key, item_name, map Line 1517  single_submenu (item_key, item_name, map
1517            else            else
1518              save_wv->contents = wv;              save_wv->contents = wv;
1519    
1520            wv->name = (char *) XSTRING (item_name)->data;            wv->name = (char *) SDATA (item_name);
1521            if (!NILP (descrip))            if (!NILP (descrip))
1522              wv->key = (char *) XSTRING (descrip)->data;              wv->key = (char *) SDATA (descrip);
1523            wv->value = 0;            wv->value = 0;
1524            /* The EMACS_INT cast avoids a warning.  There's no problem            /* The EMACS_INT cast avoids a warning.  There's no problem
1525               as long as pointers have enough bits to hold small integers.  */               as long as pointers have enough bits to hold small integers.  */
# Line 1753  set_frame_menubar (f, first_time, deep_p Line 1753  set_frame_menubar (f, first_time, deep_p
1753            string = XVECTOR (items)->contents[i + 1];            string = XVECTOR (items)->contents[i + 1];
1754            if (NILP (string))            if (NILP (string))
1755              break;              break;
1756            wv->name = (char *) XSTRING (string)->data;            wv->name = (char *) SDATA (string);
1757            wv = wv->next;            wv = wv->next;
1758          }          }
1759    
# Line 1776  set_frame_menubar (f, first_time, deep_p Line 1776  set_frame_menubar (f, first_time, deep_p
1776              break;              break;
1777    
1778            wv = xmalloc_widget_value ();            wv = xmalloc_widget_value ();
1779            wv->name = (char *) XSTRING (string)->data;            wv->name = (char *) SDATA (string);
1780            wv->value = 0;            wv->value = 0;
1781            wv->enabled = 1;            wv->enabled = 1;
1782            wv->button_type = BUTTON_TYPE_NONE;            wv->button_type = BUTTON_TYPE_NONE;
# Line 2051  xmenu_show (f, x, y, for_click, keymaps, Line 2051  xmenu_show (f, x, y, for_click, keymaps,
2051              }              }
2052  #endif  #endif
2053            pane_string = (NILP (pane_name)            pane_string = (NILP (pane_name)
2054                           ? "" : (char *) XSTRING (pane_name)->data);                           ? "" : (char *) SDATA (pane_name));
2055            /* If there is just one top-level pane, put all its items directly            /* If there is just one top-level pane, put all its items directly
2056               under the top-level menu.  */               under the top-level menu.  */
2057            if (menu_items_n_panes == 1)            if (menu_items_n_panes == 1)
# Line 2116  xmenu_show (f, x, y, for_click, keymaps, Line 2116  xmenu_show (f, x, y, for_click, keymaps,
2116              prev_wv->next = wv;              prev_wv->next = wv;
2117            else            else
2118              save_wv->contents = wv;              save_wv->contents = wv;
2119            wv->name = (char *) XSTRING (item_name)->data;            wv->name = (char *) SDATA (item_name);
2120            if (!NILP (descrip))            if (!NILP (descrip))
2121              wv->key = (char *) XSTRING (descrip)->data;              wv->key = (char *) SDATA (descrip);
2122            wv->value = 0;            wv->value = 0;
2123            /* If this item has a null value,            /* If this item has a null value,
2124               make the call_data null so that it won't display a box               make the call_data null so that it won't display a box
# Line 2169  xmenu_show (f, x, y, for_click, keymaps, Line 2169  xmenu_show (f, x, y, for_click, keymaps,
2169          title = ENCODE_SYSTEM (title);          title = ENCODE_SYSTEM (title);
2170  #endif  #endif
2171                
2172        wv_title->name = (char *) XSTRING (title)->data;        wv_title->name = (char *) SDATA (title);
2173        wv_title->enabled = TRUE;        wv_title->enabled = TRUE;
2174        wv_title->button_type = BUTTON_TYPE_NONE;        wv_title->button_type = BUTTON_TYPE_NONE;
2175        wv_title->next = wv_sep1;        wv_title->next = wv_sep1;
# Line 2370  xdialog_show (f, keymaps, title, error) Line 2370  xdialog_show (f, keymaps, title, error)
2370      pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];      pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
2371      prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];      prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
2372      pane_string = (NILP (pane_name)      pane_string = (NILP (pane_name)
2373                     ? "" : (char *) XSTRING (pane_name)->data);                       ? "" : (char *) SDATA (pane_name));  
2374      prev_wv = xmalloc_widget_value ();      prev_wv = xmalloc_widget_value ();
2375      prev_wv->value = pane_string;      prev_wv->value = pane_string;
2376      if (keymaps && !NILP (prefix))      if (keymaps && !NILP (prefix))
# Line 2417  xdialog_show (f, keymaps, title, error) Line 2417  xdialog_show (f, keymaps, title, error)
2417          prev_wv->next = wv;          prev_wv->next = wv;
2418          wv->name = (char *) button_names[nb_buttons];          wv->name = (char *) button_names[nb_buttons];
2419          if (!NILP (descrip))          if (!NILP (descrip))
2420            wv->key = (char *) XSTRING (descrip)->data;            wv->key = (char *) SDATA (descrip);
2421          wv->value = (char *) XSTRING (item_name)->data;          wv->value = (char *) SDATA (item_name);
2422          wv->call_data = (void *) &XVECTOR (menu_items)->contents[i];          wv->call_data = (void *) &XVECTOR (menu_items)->contents[i];
2423          wv->enabled = !NILP (enable);          wv->enabled = !NILP (enable);
2424          wv->help = Qnil;          wv->help = Qnil;
# Line 2656  xmenu_show (f, x, y, for_click, keymaps, Line 2656  xmenu_show (f, x, y, for_click, keymaps,
2656            pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];            pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
2657            prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];            prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
2658            pane_string = (NILP (pane_name)            pane_string = (NILP (pane_name)
2659                           ? "" : (char *) XSTRING (pane_name)->data);                           ? "" : (char *) SDATA (pane_name));
2660            if (keymaps && !NILP (prefix))            if (keymaps && !NILP (prefix))
2661              pane_string++;              pane_string++;
2662    
# Line 2683  xmenu_show (f, x, y, for_click, keymaps, Line 2683  xmenu_show (f, x, y, for_click, keymaps,
2683                    j++;                    j++;
2684                    continue;                    continue;
2685                  }                  }
2686                width = STRING_BYTES (XSTRING (item));                width = SBYTES (item);
2687                if (width > maxwidth)                if (width > maxwidth)
2688                  maxwidth = width;                  maxwidth = width;
2689    
# Line 2706  xmenu_show (f, x, y, for_click, keymaps, Line 2706  xmenu_show (f, x, y, for_click, keymaps,
2706            descrip            descrip
2707              = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];              = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
2708            help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];            help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
2709            help_string = STRINGP (help) ? XSTRING (help)->data : NULL;            help_string = STRINGP (help) ? SDATA (help) : NULL;
2710                        
2711            if (!NILP (descrip))            if (!NILP (descrip))
2712              {              {
2713                int gap = maxwidth - STRING_BYTES (XSTRING (item_name));                int gap = maxwidth - SBYTES (item_name);
2714  #ifdef C_ALLOCA  #ifdef C_ALLOCA
2715                Lisp_Object spacer;                Lisp_Object spacer;
2716                spacer = Fmake_string (make_number (gap), make_number (' '));                spacer = Fmake_string (make_number (gap), make_number (' '));
2717                item_name = concat2 (item_name, spacer);                item_name = concat2 (item_name, spacer);
2718                item_name = concat2 (item_name, descrip);                item_name = concat2 (item_name, descrip);
2719                item_data = XSTRING (item_name)->data;                item_data = SDATA (item_name);
2720  #else  #else
2721                /* if alloca is fast, use that to make the space,                /* if alloca is fast, use that to make the space,
2722                   to reduce gc needs.  */                   to reduce gc needs.  */
2723                item_data                item_data
2724                  = (unsigned char *) alloca (maxwidth                  = (unsigned char *) alloca (maxwidth
2725                                              + STRING_BYTES (XSTRING (descrip)) + 1);                                              + SBYTES (descrip) + 1);
2726                bcopy (XSTRING (item_name)->data, item_data,                bcopy (SDATA (item_name), item_data,
2727                       STRING_BYTES (XSTRING (item_name)));                       SBYTES (item_name));
2728                for (j = XSTRING (item_name)->size; j < maxwidth; j++)                for (j = SCHARS (item_name); j < maxwidth; j++)
2729                  item_data[j] = ' ';                  item_data[j] = ' ';
2730                bcopy (XSTRING (descrip)->data, item_data + j,                bcopy (SDATA (descrip), item_data + j,
2731                       STRING_BYTES (XSTRING (descrip)));                       SBYTES (descrip));
2732                item_data[j + STRING_BYTES (XSTRING (descrip))] = 0;                item_data[j + SBYTES (descrip)] = 0;
2733  #endif  #endif
2734              }              }
2735            else            else
2736              item_data = XSTRING (item_name)->data;              item_data = SDATA (item_name);
2737    
2738            if (XMenuAddSelection (FRAME_X_DISPLAY (f),            if (XMenuAddSelection (FRAME_X_DISPLAY (f),
2739                                   menu, lpane, 0, item_data,                                   menu, lpane, 0, item_data,

Legend:
Removed from v.1.232  
changed lines
  Added in v.1.233

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