emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32menu.c


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32menu.c
Date: Sun, 09 Dec 2001 11:48:03 -0500

Index: emacs/src/w32menu.c
diff -c emacs/src/w32menu.c:1.48 emacs/src/w32menu.c:1.49
*** emacs/src/w32menu.c:1.48    Sat Dec  1 06:14:23 2001
--- emacs/src/w32menu.c Sun Dec  9 11:48:03 2001
***************
*** 61,66 ****
--- 61,68 ----
    BUTTON_TYPE_RADIO
  };
  
+ /* This structure is based on the one in ../lwlib/lwlib.h, modified
+    for Windows.  */
  typedef struct _widget_value
  {
    /* name of widget */
***************
*** 69,76 ****
    char*               value;
    /* keyboard equivalent. no implications for XtTranslations */ 
    char*               key;
!   /* Help string or null if none.  */
!   char                *help;
    /* true if enabled */
    Boolean     enabled;
    /* true if selected */
--- 71,80 ----
    char*               value;
    /* keyboard equivalent. no implications for XtTranslations */ 
    char*               key;
!   /* Help string or nil if none.
!      GC finds this string through the frame's menu_bar_vector
!      or through menu_items.  */
!   Lisp_Object help;
    /* true if enabled */
    Boolean     enabled;
    /* true if selected */
***************
*** 1269,1279 ****
            abort ();
  
          wv->selected = !NILP (selected);
!         if (STRINGP (help))
!           wv->help = (char *) XSTRING (help)->data;
!           else
!             wv->help = NULL;
  
          prev_wv = wv;
  
          i += MENU_ITEMS_ITEM_LENGTH;
--- 1273,1283 ----
            abort ();
  
          wv->selected = !NILP (selected);
!         if (!STRINGP (help))
!           help = Qnil;
  
+         wv->help = help;
+ 
          prev_wv = wv;
  
          i += MENU_ITEMS_ITEM_LENGTH;
***************
*** 1727,1734 ****
            abort ();
  
          wv->selected = !NILP (selected);
!           if (STRINGP (help))
!             wv->help = XSTRING (help)->data;
  
          prev_wv = wv;
  
--- 1731,1740 ----
            abort ();
  
          wv->selected = !NILP (selected);
!           if (!STRINGP (help))
!           help = Qnil;
! 
!         wv->help = help;
  
          prev_wv = wv;
  
***************
*** 2083,2095 ****
        else
        out_string = wv->name;
  
!       if (wv->title || wv->call_data == 0)
        {
          /* Only use MF_OWNERDRAW if GetMenuItemInfo is usable, since
             we can't deallocate the memory otherwise.  */
          if (get_menu_item_info)
            {
!             out_string = LocalAlloc (LPTR, strlen (wv->name) + 1);
              strcpy (out_string, wv->name);
              fuFlags = MF_OWNERDRAW | MF_DISABLED;
            }
--- 2089,2106 ----
        else
        out_string = wv->name;
  
!       if (item != NULL)
!       fuFlags = MF_POPUP;
!       else if (wv->title || wv->call_data == 0)
        {
          /* Only use MF_OWNERDRAW if GetMenuItemInfo is usable, since
             we can't deallocate the memory otherwise.  */
          if (get_menu_item_info)
            {
!             out_string = (char *) LocalAlloc (LPTR, strlen (wv->name) + 1);
! #ifdef MENU_DEBUG
!             DebPrint ("Menu: allocing %ld for owner-draw", info.dwItemData);
! #endif
              strcpy (out_string, wv->name);
              fuFlags = MF_OWNERDRAW | MF_DISABLED;
            }
***************
*** 2105,2113 ****
        fuFlags |= MF_UNCHECKED;
      }
  
-   if (item != NULL)
-     fuFlags = MF_POPUP;
- 
    return_value =
      AppendMenu (menu,
                  fuFlags,
--- 2116,2121 ----
***************
*** 2124,2138 ****
          info.cbSize = sizeof (info);
          info.fMask = MIIM_DATA;
  
!         /* Set help string for menu item.  Allocate new memory
!            from the heap for it, since garbage collection can
!            occur while menus are active.  */
          if (wv->help)
!           {
!             info.dwItemData
!               = (DWORD) LocalAlloc (LPTR, strlen(wv->help) + 1);
!             strcpy (info.dwItemData, wv->help);
!           }
  
          if (wv->button_type == BUTTON_TYPE_RADIO)
            {
--- 2132,2142 ----
          info.cbSize = sizeof (info);
          info.fMask = MIIM_DATA;
  
!         /* Set help string for menu item.  Leave it as a Lisp_Object
!            until it is ready to be displayed, since GC can happen while
!            menus are active.  */
          if (wv->help)
!           info.dwItemData = (DWORD) wv->help;
  
          if (wv->button_type == BUTTON_TYPE_RADIO)
            {
***************
*** 2213,2219 ****
          info.fMask = MIIM_DATA;
          get_menu_item_info (menu, item, FALSE, &info);
  
!         help = info.dwItemData ? build_string ((char *)info.dwItemData) : 
Qnil;
        }
  
        /* Store the help echo in the keyboard buffer as the X toolkit
--- 2217,2223 ----
          info.fMask = MIIM_DATA;
          get_menu_item_info (menu, item, FALSE, &info);
  
!         help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
        }
  
        /* Store the help echo in the keyboard buffer as the X toolkit
***************
*** 2232,2238 ****
      }
  }
  
! /* Free memory used by owner-drawn and help_echo strings.  */
  static void
  w32_free_submenu_strings (menu)
       HMENU menu;
--- 2236,2242 ----
      }
  }
  
! /* Free memory used by owner-drawn strings.  */
  static void
  w32_free_submenu_strings (menu)
       HMENU menu;
***************
*** 2243,2255 ****
        MENUITEMINFO info;
  
        info.cbSize = sizeof (info);
!       info.fMask = MIIM_DATA | MIIM_SUBMENU;
  
        get_menu_item_info (menu, i, TRUE, &info);
  
!       /* Both owner-drawn names and help strings are held in dwItemData.  */
!       if (info.dwItemData)
!       LocalFree (info.dwItemData);
  
        /* Recurse down submenus.  */
        if (info.hSubMenu)
--- 2247,2264 ----
        MENUITEMINFO info;
  
        info.cbSize = sizeof (info);
!       info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
  
        get_menu_item_info (menu, i, TRUE, &info);
  
!       /* Owner-drawn names are held in dwItemData.  */
!       if ((info.fType & MF_OWNERDRAW) && info.dwItemData)
!       {
! #ifdef MENU_DEBUG
!         DebPrint ("Menu: freeing %ld for owner-draw", info.dwItemData);
! #endif
!         LocalFree (info.dwItemData);
!       }
  
        /* Recurse down submenus.  */
        if (info.hSubMenu)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]