- converted 1st stage setup stub from message box style to property sheet style
authorMatthias Kupfer <mkupfer@reactos.org>
Sat, 5 Jul 2008 17:55:38 +0000 (17:55 +0000)
committerMatthias Kupfer <mkupfer@reactos.org>
Sat, 5 Jul 2008 17:55:38 +0000 (17:55 +0000)
- property page for English and German added
- other languages needs to be translated and enabled in rsrc.rc

svn path=/trunk/; revision=34307

reactos/base/setup/reactos/lang/de-DE.rc
reactos/base/setup/reactos/lang/en-US.rc
reactos/base/setup/reactos/reactos.c
reactos/base/setup/reactos/reactos.rbuild
reactos/base/setup/reactos/reactos.rc
reactos/base/setup/reactos/res/header.bmp [new file with mode: 0644]
reactos/base/setup/reactos/res/watermark.bmp [new file with mode: 0644]
reactos/base/setup/reactos/resource.h
reactos/base/setup/reactos/rsrc.rc

index 7fd838e..615b477 100644 (file)
@@ -2,12 +2,16 @@
 
 LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
 
-/* String Tables */
-
-STRINGTABLE DISCARDABLE
+IDD_STARTPAGE DIALOGEX DISCARDABLE  0, 0, 317, 193
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "ReactOS Setup"
+FONT 8, "MS Shell Dlg"
 BEGIN
-    IDS_CAPTION  "ReactOS Setup"
-    IDS_TEXT     "ReactOS kann nicht direkt von dieser CD installiert werden!\n\nBitte starten Sie Ihren Computer mit dieser CD um ReactOS zu installieren."
+    LTEXT "Willkommen beim ReactOS Setup Assistenten.", IDC_STARTTITLE, 115, 8, 195, 24
+    LTEXT "ReactOS kann noch nicht direkt von dieser CD installiert werden! "\
+          "Bitte starten Sie Ihren Computer mit dieser CD um ReactOS zu "\
+          "installieren.", IDC_STATIC, 115, 40, 195, 100
+    LTEXT "Klicken Sie auf Beenden um das Setup zu verlassen.", IDC_STATIC, 115, 169, 195, 17
 END
 
 /* EOF */
index 180f364..3d879bf 100644 (file)
@@ -2,11 +2,16 @@
 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
-/* String Tables */
-STRINGTABLE DISCARDABLE
+IDD_STARTPAGE DIALOGEX DISCARDABLE  0, 0, 317, 193
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "ReactOS Setup"
+FONT 8, "MS Shell Dlg"
 BEGIN
-    IDS_CAPTION  "ReactOS Setup"
-    IDS_TEXT     "You cannot install ReactOS directly from this CD!\n\nPlease restart your computer from this CD in order to install ReactOS."
+    LTEXT "Welcome to the ReactOS Setup Wizard.", IDC_STARTTITLE, 115, 8, 195, 24
+    LTEXT "You cannot install ReactOS directly from this CD yet! "\
+          "Please restart your computer from this CD in order to "\
+         "install ReactOS.", IDC_STATIC, 115, 40, 195, 100
+    LTEXT "Click Finish to exit the Setup.", IDC_STATIC, 115, 169, 195, 17
 END
 
 /* EOF */
index 0a24f10..31c71c5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ReactOS applications
- *  Copyright (C) 2004 ReactOS Team
+ *  Copyright (C) 2004-2008 ReactOS Team
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  * COPYRIGHT:   See COPYING in the top level directory
  * PROJECT:     ReactOS GUI first stage setup application
  * FILE:        subsys/system/reactos/reactos.c
- * PROGRAMMERS: Eric Kohl
+ * PROGRAMMERS: Eric Kohl, Matthias Kupfer
  */
 
 #include <windows.h>
-#include <tchar.h>
+#include <commctrl.h>
 
 #include "resource.h"
 
 
-/* GLOBALS ******************************************************************/
+/* FUNCTIONS ****************************************************************/
 
-TCHAR szCaption[256];
-TCHAR szText[256];
+static VOID
+CenterWindow(HWND hWnd)
+{
+  HWND hWndParent;
+  RECT rcParent;
+  RECT rcWindow;
 
-HINSTANCE hInstance;
+  hWndParent = GetParent(hWnd);
+  if (hWndParent == NULL)
+    hWndParent = GetDesktopWindow();
 
+  GetWindowRect(hWndParent, &rcParent);
+  GetWindowRect(hWnd, &rcWindow);
 
-/* FUNCTIONS ****************************************************************/
+  SetWindowPos(hWnd,
+              HWND_TOP,
+              ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
+              ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
+              0,
+              0,
+              SWP_NOSIZE);
+}
+
+static INT_PTR CALLBACK
+StartDlgProc(HWND hwndDlg,
+               UINT uMsg,
+               WPARAM wParam,
+               LPARAM lParam)
+{
+  switch (uMsg)
+  {
+         case WM_INITDIALOG:
+         {
+               HWND hwndControl;
+               DWORD dwStyle;
+
+               hwndControl = GetParent(hwndDlg);
+
+               /* Center the wizard window */
+                CenterWindow (hwndControl);
+
+               dwStyle = GetWindowLong(hwndControl, GWL_STYLE);
+               SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
+               
+               /* Hide and disable the 'Cancel' button at the moment,
+                * later we use this button to cancel the setup process
+                * like F3 in usetup
+                */
+               hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
+               ShowWindow (hwndControl, SW_HIDE);
+               EnableWindow (hwndControl, FALSE);
+         }
+         break;
+         case WM_NOTIFY:
+         {
+          LPNMHDR lpnm = (LPNMHDR)lParam;
+
+                 switch (lpnm->code)
+                 {             
+                     case PSN_SETACTIVE: // Only "Finish" for closing the App
+                       PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH);
+                       break;
+                     default:
+                       break;
+                 }
+         break;
+         default:
+               break;
+         }
+
+  }
+  return FALSE;
+}
 
 int WINAPI
 WinMain(HINSTANCE hInst,
@@ -46,26 +112,38 @@ WinMain(HINSTANCE hInst,
        LPSTR lpszCmdLine,
        int nCmdShow)
 {
-  hInstance = hInst;
+  PROPSHEETHEADER psh;
+  HPROPSHEETPAGE ahpsp[1];
+  PROPSHEETPAGE psp = {0};
+  UINT nPages = 0;
+
+  /* Create the Start page */
+  psp.dwSize = sizeof(PROPSHEETPAGE);
+  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
+  psp.hInstance = hInst;
+  psp.lParam = 0;
+  psp.pfnDlgProc = StartDlgProc;
+  psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE);
+  ahpsp[nPages++] = CreatePropertySheetPage(&psp);
 
-  if (!LoadString(hInstance,
-                  IDS_CAPTION,
-                  szCaption,
-                  (sizeof szCaption / sizeof szCaption[0])))
-    return 0;
+  // Here we can add the next pages and switch on later
 
-  if (!LoadString(hInstance,
-                  IDS_TEXT,
-                  szText,
-                  (sizeof szText / sizeof szText[0])))
-    return 0;
+  /* Create the property sheet */
+  psh.dwSize = sizeof(PROPSHEETHEADER);
+  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
+  psh.hInstance = hInst;
+  psh.hwndParent = NULL;
+  psh.nPages = nPages;
+  psh.nStartPage = 0;
+  psh.phpage = ahpsp;
+  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
+  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
 
-  MessageBox(NULL,
-            szText,
-            szCaption,
-            MB_OK | MB_ICONINFORMATION);
+  /* Display the wizard */
+  PropertySheet(&psh);
 
   return 0;
+
 }
 
 /* EOF */
index 073d681..d1f4774 100644 (file)
@@ -8,6 +8,7 @@
        <library>kernel32</library>
        <library>gdi32</library>
        <library>user32</library>
+       <library>comctl32</library>
        <file>reactos.c</file>
        <file>reactos.rc</file>
 </module>
index 093c683..58040d8 100644 (file)
@@ -14,6 +14,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 /* Icons */
 IDI_MAIN ICON "res/reactos.ico"
 
+/* Bitmaps */
+IDB_WATERMARK BITMAP "res/watermark.bmp"
+IDB_HEADER    BITMAP "res/header.bmp"
 
 /* Language-specific resources */
 #include "rsrc.rc"
diff --git a/reactos/base/setup/reactos/res/header.bmp b/reactos/base/setup/reactos/res/header.bmp
new file mode 100644 (file)
index 0000000..af7bf7a
Binary files /dev/null and b/reactos/base/setup/reactos/res/header.bmp differ
diff --git a/reactos/base/setup/reactos/res/watermark.bmp b/reactos/base/setup/reactos/res/watermark.bmp
new file mode 100644 (file)
index 0000000..1b42e5b
Binary files /dev/null and b/reactos/base/setup/reactos/res/watermark.bmp differ
index ffb9c7a..4dd4813 100644 (file)
@@ -1,5 +1,15 @@
 
-#define IDS_CAPTION   1000
-#define IDS_TEXT      1001
+#ifndef RESOURCE_H
+#define RESOURCE_H
+
+#define IDB_WATERMARK                  100
+#define IDB_HEADER                             101
+
+#define IDC_STATIC -1
+
+#define IDD_STARTPAGE  2000
+#define IDC_STARTTITLE  2001
 
 #define IDI_MAIN      3000
+
+#endif
index 31d1b9c..b333f88 100644 (file)
@@ -2,12 +2,12 @@
 #include "resource.h"
 
 /* Language-specific resources */
-#include "lang/bg-BG.rc"
-#include "lang/cs-CZ.rc"
+/*#include "lang/bg-BG.rc"
+#include "lang/cs-CZ.rc"*/
 #include "lang/de-DE.rc"
-#include "lang/el-GR.rc"
+//#include "lang/el-GR.rc"
 #include "lang/en-US.rc"
-#include "lang/es-ES.rc"
+/*#include "lang/es-ES.rc"
 #include "lang/fi-FI.rc"
 #include "lang/fr-FR.rc"
 #include "lang/hu-HU.rc"
@@ -24,4 +24,4 @@
 #include "lang/sv-SE.rc"
 #include "lang/th-TH.rc"
 #include "lang/uk-UA.rc"
-#include "lang/zh-CN.rc"
+#include "lang/zh-CN.rc"*/