Hiya

Revision 41657 introduces a regression with VirtualBox Guest Additions video driver. Please see http://www.reactos.org/bugzilla/show_bug.cgi?id=4650
for more details.

Regards 

2009/7/2 <ros-dev-request@reactos.org>
Send Ros-dev mailing list submissions to
       ros-dev@reactos.org

To subscribe or unsubscribe via the World Wide Web, visit
       http://www.reactos.org/mailman/listinfo/ros-dev
or, via email, send a message with subject or body 'help' to
       ros-dev-request@reactos.org

You can reach the person managing the list at
       ros-dev-owner@reactos.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ros-dev digest..."


Today's Topics:

  1. Re: [ros-diffs] [mkupfer] 41733: Mikhail Denisenko
     <denisenkom AT gmail DOT com> - Add symbols to system menu by
     using marlett font. - See issue #4450 for details. (Ged)
  2. Re: [ros-diffs] [mkupfer] 41733: Mikhail Denisenko
     <denisenkom AT gmail DOT com> - Add symbols to system menu by
     using marlett font. - See issue #4450 for details. (James Tabor)


----------------------------------------------------------------------

Message: 1
Date: Wed, 1 Jul 2009 23:10:03 +0100
From: "Ged" <gedmurphy@gmail.com>
Subject: Re: [ros-dev] [ros-diffs] [mkupfer] 41733: Mikhail Denisenko
       <denisenkom AT gmail DOT com> - Add symbols to system menu by   using
       marlett font. - See issue #4450 for details.
To: <ros-dev@reactos.org>
Message-ID: <001801c9fa98$af921810$0eb64830$@com>
Content-Type: text/plain;       charset="utf-8"

Did you read this patch before committing it?
Your last patch fixed tchar usage and then this next patch introduces new ones.


-----Original Message-----
From: ros-diffs-bounces@reactos.org [mailto:ros-diffs-bounces@reactos.org] On Behalf Of mkupfer@svn.reactos.org
Sent: 01 July 2009 22:57
To: ros-diffs@reactos.org
Subject: [ros-diffs] [mkupfer] 41733: Mikhail Denisenko <denisenkom AT gmail DOT com> - Add symbols to system menu by using marlett font. - See issue #4450 for details.

Author: mkupfer
Date: Thu Jul  2 01:56:44 2009
New Revision: 41733

URL: http://svn.reactos.org/svn/reactos?rev=41733&view=rev
Log:
Mikhail Denisenko <denisenkom AT gmail DOT com>
- Add symbols to system menu by using marlett font.
- See issue #4450 for details.

Modified:
   trunk/reactos/dll/win32/user32/windows/menu.c

Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/menu.c?rev=41733&r1=41732&r2=41733&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Thu Jul  2 01:56:44 2009
@@ -42,7 +42,6 @@
 #define IS_SYSTEM_POPUP(MenuInfo) \
       (0 != ((MenuInfo)->Flags & MF_POPUP) && 0 != ((MenuInfo)->Flags & MF_SYSMENU))

-#define IS_MAGIC_ITEM(Bmp)   ((int) Bmp <12)
 #define IS_MAGIC_BITMAP(id) ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1))

 #define MENU_ITEM_HBMP_SPACE (5)
@@ -307,7 +306,7 @@
  Size->cx = Size->cy = 0;

  /* check if there is a magic menu item associated with this item */
-  if (0 != Bmp && IS_MAGIC_ITEM((INT)(Bmp)))
+  if (IS_MAGIC_BITMAP(Bmp))
    {
      switch((INT_PTR) Bmp)
        {
@@ -339,18 +338,15 @@
          case (INT_PTR) HBMMENU_MBAR_CLOSE:
          case (INT_PTR) HBMMENU_MBAR_MINIMIZE_D:
          case (INT_PTR) HBMMENU_MBAR_CLOSE_D:
+          case (INT_PTR) HBMMENU_POPUP_CLOSE:
+          case (INT_PTR) HBMMENU_POPUP_RESTORE:
+          case (INT_PTR) HBMMENU_POPUP_MAXIMIZE:
+          case (INT_PTR) HBMMENU_POPUP_MINIMIZE:
            /* FIXME: Why we need to subtract these magic values? */
            /* to make them smaller than the menu bar? */
            Size->cx = GetSystemMetrics(SM_CXSIZE) - 2;
            Size->cy = GetSystemMetrics(SM_CYSIZE) - 4;
            return;
-          case (INT_PTR) HBMMENU_POPUP_CLOSE:
-          case (INT_PTR) HBMMENU_POPUP_RESTORE:
-          case (INT_PTR) HBMMENU_POPUP_MAXIMIZE:
-          case (INT_PTR) HBMMENU_POPUP_MINIMIZE:
-          default:
-            FIXME("Magic menu bitmap not implemented\n");
-            return;
        }
    }

@@ -359,6 +355,70 @@
      Size->cx = Bm.bmWidth;
      Size->cy = Bm.bmHeight;
    }
+}
+
+/***********************************************************************
+ *           MenuDrawPopupGlyph
+ *
+ * Draws popup magic glyphs (can be found in system menu).
+ */
+static void FASTCALL
+MenuDrawPopupGlyph(HDC dc, LPRECT r, INT_PTR popupMagic, BOOL inactive, BOOL hilite)
+{
+  LOGFONTW lf;
+  HFONT hFont, hOldFont;
+  COLORREF clrsave;
+  INT bkmode;
+  TCHAR symbol;
+  switch (popupMagic)
+  {
+  case (INT_PTR) HBMMENU_POPUP_RESTORE:
+    symbol = '2';
+    break;
+  case (INT_PTR) HBMMENU_POPUP_MINIMIZE:
+    symbol = '0';
+    break;
+  case (INT_PTR) HBMMENU_POPUP_MAXIMIZE:
+    symbol = '1';
+    break;
+  case (INT_PTR) HBMMENU_POPUP_CLOSE:
+    symbol = 'r';
+    break;
+  default:
+    ERR("Invalid popup magic bitmap %d\n", (int)popupMagic);
+    return;
+  }
+  ZeroMemory(&lf, sizeof(LOGFONTW));
+  InflateRect(r, -2, -2);
+  lf.lfHeight = r->bottom - r->top;
+  lf.lfWidth = 0;
+  lf.lfWeight = FW_NORMAL;
+  lf.lfCharSet = DEFAULT_CHARSET;
+  lstrcpy(lf.lfFaceName, TEXT("Marlett"));
+  hFont = CreateFontIndirect(&lf);
+  /* save font and text color */
+  hOldFont = SelectObject(dc, hFont);
+  clrsave = GetTextColor(dc);
+  bkmode = GetBkMode(dc);
+  /* set color and drawing mode */
+  SetBkMode(dc, TRANSPARENT);
+  if (inactive)
+  {
+    /* draw shadow */
+    if (!hilite)
+    {
+      SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+      TextOut(dc, r->left + 1, r->top + 1, &symbol, 1);
+    }
+  }
+  SetTextColor(dc, GetSysColor(inactive ? COLOR_GRAYTEXT : (hilite ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)));
+  /* draw selected symbol */
+  TextOut(dc, r->left, r->top, &symbol, 1);
+  /* restore previous settings */
+  SetTextColor(dc, clrsave);
+  SelectObject(dc, hOldFont);
+  SetBkMode(dc, bkmode);
+  DeleteObject(hFont);
 }

 /***********************************************************************
@@ -382,7 +442,7 @@
  Bmp = hbmpToDraw;

  /* Check if there is a magic menu item associated with this item */
-  if (IS_MAGIC_ITEM(hbmpToDraw))
+  if (IS_MAGIC_BITMAP(hbmpToDraw))
    {
      UINT Flags = 0;
      RECT r;
@@ -459,8 +519,7 @@
          case (INT_PTR) HBMMENU_POPUP_RESTORE:
          case (INT_PTR) HBMMENU_POPUP_MAXIMIZE:
          case (INT_PTR) HBMMENU_POPUP_MINIMIZE:
-          default:
-            FIXME("Magic menu bitmap not implemented\n");
+            MenuDrawPopupGlyph(Dc, &r, (INT_PTR)hbmpToDraw, Item->fState & MF_GRAYED, Item->fState & MF_HILITE);
            return;
        }
      InflateRect(&r, -1, -1);
@@ -736,9 +795,17 @@
           checked = TRUE;
        }
     }
-     if ((Item->hbmpItem)&& !( checked && (MenuInfo->dwStyle & MNS_CHECKORBMP)))
+     if (Item->hbmpItem)
     {
-        MenuDrawBitmapItem(Dc, Item, &Rect, MenuInfo->Self, WndOwner, Action, MenuBar);
+       RECT bmpRect;
+       CopyRect(&bmpRect, &Rect);
+       if (!(MenuInfo->dwStyle & MNS_CHECKORBMP) && !(MenuInfo->dwStyle & MNS_NOCHECK))
+         bmpRect.left += CheckBitmapWidth + 2;
+       if (!(checked && (MenuInfo->dwStyle & MNS_CHECKORBMP)))
+       {
+         bmpRect.right = bmpRect.left + MenuInfo->maxBmpSize.cx;
+         MenuDrawBitmapItem(Dc, Item, &bmpRect, MenuInfo->Self, WndOwner, Action, MenuBar);
+       }
     }
     /* Draw the popup-menu arrow */
     if (0 != (Item->fType & MF_POPUP))
@@ -767,7 +834,9 @@
      UINT uFormat = MenuBar ? DT_CENTER | DT_VCENTER | DT_SINGLELINE
                     : DT_LEFT | DT_VCENTER | DT_SINGLELINE;

-      if( !(MenuInfo->dwStyle & MNS_CHECKORBMP))
+      if(MenuInfo->dwStyle & MNS_CHECKORBMP)
+             Rect.left += max(0, MenuInfo->maxBmpSize.cx - GetSystemMetrics(SM_CXMENUCHECK));
+      else
             Rect.left += MenuInfo->maxBmpSize.cx;

      if (0 != (Item->fState & MFS_DEFAULT))
@@ -779,11 +848,6 @@
        {
          Rect.left += MENU_BAR_ITEMS_SPACE / 2;
          Rect.right -= MENU_BAR_ITEMS_SPACE / 2;
-        }
-      if (Item->hbmpItem == HBMMENU_CALLBACK || MenuInfo->maxBmpSize.cx != 0 )
-        {
-          Rect.left += MenuInfo->maxBmpSize.cx;
-          Rect.right -= MenuInfo->maxBmpSize.cx;
        }

      Text = (PWCHAR) Item->dwTypeData;
@@ -1103,8 +1167,30 @@
 NTSTATUS WINAPI
 User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
 {
-  LRESULT Result;
-  Result = (LRESULT)LoadMenuW(User32Instance, L"SYSMENU");
+  HMENU hmenu = LoadMenuW(User32Instance, L"SYSMENU");
+  LRESULT Result = (LRESULT)hmenu;
+
+  // removing space for checkboxes from menu
+  MENUINFO menuinfo = {0};
+  menuinfo.cbSize = sizeof(menuinfo);
+  menuinfo.fMask = MIM_STYLE;
+  GetMenuInfo(hmenu, &menuinfo);
+  menuinfo.dwStyle |= MNS_NOCHECK;
+  SetMenuInfo(hmenu, &menuinfo);
+
+  // adding bitmaps to menu items
+  MENUITEMINFOW info = {0};
+  info.cbSize = sizeof(info);
+  info.fMask |= MIIM_BITMAP;
+  info.hbmpItem = HBMMENU_POPUP_MINIMIZE;
+  SetMenuItemInfoW(hmenu, SC_MINIMIZE, FALSE, &info);
+  info.hbmpItem = HBMMENU_POPUP_RESTORE;
+  SetMenuItemInfoW(hmenu, SC_RESTORE, FALSE, &info);
+  info.hbmpItem = HBMMENU_POPUP_MAXIMIZE;
+  SetMenuItemInfoW(hmenu, SC_MAXIMIZE, FALSE, &info);
+  info.hbmpItem = HBMMENU_POPUP_CLOSE;
+  SetMenuItemInfoW(hmenu, SC_CLOSE, FALSE, &info);
+
  return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
 }

@@ -1247,7 +1333,6 @@
             MenuInfo->maxBmpSize.cy = abs(Size.cy);
         }
         MenuSetRosMenuInfo(MenuInfo);
-         ItemInfo->Rect.right += Size.cx + 2;
         itemheight = Size.cy + 2;

         if( !(MenuInfo->dwStyle & MNS_NOCHECK))




------------------------------

Message: 2
Date: Wed, 1 Jul 2009 20:26:20 -0500
From: James Tabor <jimtabor.rosdev@gmail.com>
Subject: Re: [ros-dev] [ros-diffs] [mkupfer] 41733: Mikhail Denisenko
       <denisenkom AT gmail DOT com> - Add symbols to system menu by   using
       marlett font. - See issue #4450 for details.
To: ReactOS Development List <ros-dev@reactos.org>
Message-ID:
       <b93fa9340907011826s2b31d0d3va7674a0446a00020@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi!

On Wed, Jul 1, 2009 at 5:10 PM, Ged<gedmurphy@gmail.com> wrote:
> Did you read this patch before committing it?
> Your last patch fixed tchar usage and then this next patch introduces new ones.
>
>
Looks okay, interesting way for setting up the system menu for kernel
space. Need to test this with every application in our test library to
make sure this all works!

> @@ -1103,8 +1167,30 @@
>  NTSTATUS WINAPI
>  User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
>  {
> -  LRESULT Result;
> -  Result = (LRESULT)LoadMenuW(User32Instance, L"SYSMENU");
> +  HMENU hmenu = LoadMenuW(User32Instance, L"SYSMENU");
> +  LRESULT Result = (LRESULT)hmenu;
> +
> +  // removing space for checkboxes from menu
> +  MENUINFO menuinfo = {0};
> +  menuinfo.cbSize = sizeof(menuinfo);
> +  menuinfo.fMask = MIM_STYLE;
> +  GetMenuInfo(hmenu, &menuinfo);
> +  menuinfo.dwStyle |= MNS_NOCHECK;
> +  SetMenuInfo(hmenu, &menuinfo);
> +
> +  // adding bitmaps to menu items
> +  MENUITEMINFOW info = {0};
> +  info.cbSize = sizeof(info);
> +  info.fMask |= MIIM_BITMAP;
> +  info.hbmpItem = HBMMENU_POPUP_MINIMIZE;
> +  SetMenuItemInfoW(hmenu, SC_MINIMIZE, FALSE, &info);
> +  info.hbmpItem = HBMMENU_POPUP_RESTORE;
> +  SetMenuItemInfoW(hmenu, SC_RESTORE, FALSE, &info);
> +  info.hbmpItem = HBMMENU_POPUP_MAXIMIZE;
> +  SetMenuItemInfoW(hmenu, SC_MAXIMIZE, FALSE, &info);
> +  info.hbmpItem = HBMMENU_POPUP_CLOSE;
> +  SetMenuItemInfoW(hmenu, SC_CLOSE, FALSE, &info);
> +
>   return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
>  }
>


------------------------------

_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

End of Ros-dev Digest, Vol 59, Issue 2
**************************************