[ros-diffs] [mkupfer] 34588: Display of ReactOS bitmap implemented.

mkupfer at svn.reactos.org mkupfer at svn.reactos.org
Sat Jul 19 19:20:21 CEST 2008


Author: mkupfer
Date: Sat Jul 19 12:20:20 2008
New Revision: 34588

URL: http://svn.reactos.org/svn/reactos?rev=34588&view=rev
Log:
Display of ReactOS bitmap implemented.

Modified:
    trunk/reactos/base/setup/reactos/lang/en-US.rc
    trunk/reactos/base/setup/reactos/reactos.c

Modified: trunk/reactos/base/setup/reactos/lang/en-US.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/lang/en-US.rc?rev=34588&r1=34587&r2=34588&view=diff
==============================================================================
--- trunk/reactos/base/setup/reactos/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/setup/reactos/lang/en-US.rc [iso-8859-1] Sat Jul 19 12:20:20 2008
@@ -19,11 +19,11 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, 18, 7, 290, 74
-    CONTROL "Setup language:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 99, 106, 11
-    CONTROL "", IDC_LANGUAGES,"ComboBox",WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 97, 176, 142
-    CONTROL "Keyboard or input method:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 132, 106, 11
-    CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 131, 176, 81
+    CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, 18, 0, 290, 99
+    CONTROL "Setup language:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11
+    CONTROL "", IDC_LANGUAGES, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 107, 176, 142
+    CONTROL "Keyboard or input method:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11
+    CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 141, 176, 81
     LTEXT "Click Next to select the setup type.", IDC_STATIC, 10, 180 ,297, 10
 END
 

Modified: trunk/reactos/base/setup/reactos/reactos.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos.c?rev=34588&r1=34587&r2=34588&view=diff
==============================================================================
--- trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] Sat Jul 19 12:20:20 2008
@@ -51,7 +51,15 @@
 	BOOLEAN RepairUpdateFlag; // flag for update/repair an installed reactos
 } SetupData;
 
+typedef struct _IMGINFO
+{
+    HBITMAP hBitmap;
+    INT cxSource;
+    INT cySource;
+} IMGINFO, *PIMGINFO;
+
 TCHAR abort_msg[512],abort_title[64];
+HINSTANCE hInstance;
 BOOL isUnattend;
 
 /* FUNCTIONS ****************************************************************/
@@ -102,6 +110,29 @@
   ReleaseDC(NULL, hdc);
 
   return hFont;
+}
+
+static VOID
+InitImageInfo(PIMGINFO ImgInfo)
+{
+    BITMAP bitmap;
+
+    ZeroMemory(ImgInfo, sizeof(*ImgInfo));
+
+    ImgInfo->hBitmap = LoadImage(hInstance,
+                                 MAKEINTRESOURCE(IDB_ROSLOGO),
+                                 IMAGE_BITMAP,
+                                 0,
+                                 0,
+                                 LR_DEFAULTCOLOR);
+
+    if (ImgInfo->hBitmap != NULL)
+    {
+        GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap);
+
+        ImgInfo->cxSource = bitmap.bmWidth;
+        ImgInfo->cySource = bitmap.bmHeight;
+    }
 }
 
 static INT_PTR CALLBACK
@@ -169,6 +200,8 @@
                WPARAM wParam,
                LPARAM lParam)
 {
+  PIMGINFO pImgInfo;
+  pImgInfo = (PIMGINFO)GetWindowLongPtr(hwndDlg, DWLP_USER);
   switch (uMsg)
   {
 	  case WM_INITDIALOG:
@@ -188,14 +221,55 @@
 		ShowWindow (hwndControl, SW_SHOW);
 		EnableWindow (hwndControl, TRUE);
 
+                pImgInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMGINFO));
+                if (pImgInfo == NULL)
+                {
+                   EndDialog(hwndDlg, 0);
+                   return FALSE;
+                }
+
+                SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pImgInfo);
+
+                InitImageInfo(pImgInfo);
+
 		/* Set title font */
 		/*SendDlgItemMessage(hwndDlg,
                              IDC_STARTTITLE,
                              WM_SETFONT,
                              (WPARAM)hTitleFont,
                              (LPARAM)TRUE);*/
-}
-	  break;
+          }
+	  break;
+          case WM_DRAWITEM:
+          {
+            LPDRAWITEMSTRUCT lpDrawItem;
+            lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
+            if (lpDrawItem->CtlID == IDB_ROSLOGO)
+            {
+                HDC hdcMem;
+                LONG left;
+
+                /* position image in centre of dialog */
+                left = (lpDrawItem->rcItem.right - pImgInfo->cxSource) / 2;
+
+                hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
+                if (hdcMem != NULL)
+                {
+                    SelectObject(hdcMem, pImgInfo->hBitmap);
+                    BitBlt(lpDrawItem->hDC,
+                           left,
+                           lpDrawItem->rcItem.top,
+                           lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
+                           lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
+                           hdcMem,
+                           0,
+                           0,
+                           SRCCOPY);
+                    DeleteDC(hdcMem);
+                }
+            }
+            return TRUE;
+          }
 	  case WM_NOTIFY:
 	  {
           LPNMHDR lpnm = (LPNMHDR)lParam;
@@ -551,6 +625,7 @@
   HPROPSHEETPAGE ahpsp[7];
   PROPSHEETPAGE psp = {0};
   UINT nPages = 0;
+  hInstance = hInst;
   isUnattend = isUnattendSetup();
 
   if (!isUnattend)



More information about the Ros-diffs mailing list