Add the 'Date and Time' page.

Selecting a timezone does not work yet.

svn path=/trunk/; revision=11526
This commit is contained in:
Eric Kohl 2004-11-02 15:42:09 +00:00
parent 7d6071de5d
commit 983347820f
7 changed files with 418 additions and 29 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dllmain.c,v 1.4 2004/08/28 11:08:50 ekohl Exp $
/* $Id: dllmain.c,v 1.5 2004/11/02 15:42:09 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -48,7 +48,11 @@ DllMain (HINSTANCE hInstance,
{
if (dwReason == DLL_PROCESS_ATTACH)
{
InitCommonControls();
INITCOMMONCONTROLSEX InitControls;
InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitControls.dwICC = ICC_DATE_CLASSES | ICC_PROGRESS_CLASS | ICC_UPDOWN_CLASS;
InitCommonControlsEx(&InitControls);
hDllInstance = hInstance;
}

View file

@ -42,8 +42,14 @@
#define IDC_LAYOUTTEXT 1012
#define IDC_CUSTOMLAYOUT 1013
#define IDD_PROCESSPAGE 1014
#define IDC_PROCESSPROGRESS 1015
#define IDD_DATETIMEPAGE 1014
#define IDC_DATEPICKER 1015
#define IDC_TIMEPICKER 1016
#define IDC_TIMEZONELIST 1017
#define IDC_DAYLIGHTSAVINGS 1018
#define IDD_PROCESSPAGE 1020
#define IDC_PROCESSPROGRESS 1021
#define IDD_FINISHPAGE 1050
#define IDC_FINISHTITLE 1051
@ -62,7 +68,10 @@
#define IDS_LOCALETITLE 3004
#define IDS_LOCALESUBTITLE 3005
#define IDS_PROCESSTITLE 3004
#define IDS_PROCESSSUBTITLE 3005
#define IDS_DATETIMETITLE 3006
#define IDS_DATETIMESUBTITLE 3007
#define IDS_PROCESSTITLE 3008
#define IDS_PROCESSSUBTITLE 3009
#endif /* RESOURCE_H */

View file

@ -88,6 +88,24 @@ BEGIN
END
IDD_DATETIMEPAGE DIALOG DISCARDABLE 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Date and Time", IDC_STATIC, 53, 7, 253, 8
CONTROL "", IDC_DATEPICKER, "SysDateTimePick32",
DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 29, 137, 14
CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32",
DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 29, 54, 14
LTEXT "Timezone", IDC_STATIC, 53, 80, 253, 8
COMBOBOX "", IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Daylight savings",
IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
END
IDD_PROCESSPAGE DIALOG 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"

View file

@ -90,6 +90,24 @@ BEGIN
END
IDD_DATETIMEPAGE DIALOG DISCARDABLE 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Datum und Zeit", IDC_STATIC, 53, 7, 253, 8
CONTROL "", IDC_DATEPICKER, "SysDateTimePick32",
DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 29, 137, 14
CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32",
DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 29, 54, 14
LTEXT "Zeitzone", IDC_STATIC, 53, 80, 253, 8
COMBOBOX "", IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Automatiche Umstellung auf Sommer-/Winterzeit",
IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
END
IDD_PROCESSPAGE DIALOG 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
@ -131,12 +149,14 @@ END
STRINGTABLE
BEGIN
IDS_OWNERTITLE "Owner page title"
IDS_OWNERSUBTITLE "Owner page subtitle"
IDS_COMPUTERTITLE "Computer page title"
IDS_COMPUTERSUBTITLE "Computer page subtitle"
IDS_LOCALETITLE "Locale page title"
IDS_LOCALESUBTITLE "Locale page subtitle"
IDS_OWNERTITLE "Personalize your Software"
IDS_OWNERSUBTITLE "Setup uses this information about yourself to personalize ReactOS."
IDS_COMPUTERTITLE "Computer Name and Administrator Password"
IDS_COMPUTERSUBTITLE "You must provide a name and an Administrator Password for your computer."
IDS_LOCALETITLE "Regional settings"
IDS_LOCALESUBTITLE "You can customize ReactOS for different regions and languages."
IDS_DATETIMETITLE "Date and Time"
IDS_DATETIMESUBTITLE "Set the correct date and time for your computer."
IDS_PROCESSTITLE "Process page title"
IDS_PROCESSSUBTITLE "Process page subtitle"
END

View file

@ -90,6 +90,24 @@ BEGIN
END
IDD_DATETIMEPAGE DIALOG DISCARDABLE 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Date and Time", IDC_STATIC, 53, 7, 253, 8
CONTROL "", IDC_DATEPICKER, "SysDateTimePick32",
DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 29, 137, 14
CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32",
DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 29, 54, 14
LTEXT "Timezone", IDC_STATIC, 53, 80, 253, 8
COMBOBOX "", IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Daylight savings",
IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
END
IDD_PROCESSPAGE DIALOG 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
@ -97,7 +115,8 @@ FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
END
@ -131,12 +150,14 @@ END
STRINGTABLE
BEGIN
IDS_OWNERTITLE "Owner page title"
IDS_OWNERSUBTITLE "Owner page subtitle"
IDS_COMPUTERTITLE "Computer page title"
IDS_COMPUTERSUBTITLE "Computer page subtitle"
IDS_LOCALETITLE "Locale page title"
IDS_LOCALESUBTITLE "Locale page subtitle"
IDS_OWNERTITLE "Personalize your Software"
IDS_OWNERSUBTITLE "Setup uses this information about yourself to personalize ReactOS."
IDS_COMPUTERTITLE "Computer Name and Administrator Password"
IDS_COMPUTERSUBTITLE "You must provide a name and an Administrator Password for your computer."
IDS_LOCALETITLE "Regional settings"
IDS_LOCALESUBTITLE "You can customize ReactOS for different regions and languages."
IDS_DATETIMETITLE "Date and Time"
IDS_DATETIMESUBTITLE "Set the correct date and time for your computer."
IDS_PROCESSTITLE "Process page title"
IDS_PROCESSSUBTITLE "Process page subtitle"
END

View file

@ -91,6 +91,24 @@ BEGIN
END
IDD_DATETIMEPAGE DIALOG DISCARDABLE 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Date and Time", IDC_STATIC, 53, 7, 253, 8
CONTROL "", IDC_DATEPICKER, "SysDateTimePick32",
DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 29, 137, 14
CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32",
DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 29, 54, 14
LTEXT "Timezone", IDC_STATIC, 53, 80, 253, 8
COMBOBOX "", IDC_TIMEZONELIST, 53, 96, 201, 42,
CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTOCHECKBOX "Daylight savings",
IDC_DAYLIGHTSAVINGS, 53, 124, 201, 10
END
IDD_PROCESSPAGE DIALOG 0, 0, 317, 143
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "ReactOS Setup"
@ -132,12 +150,14 @@ END
STRINGTABLE
BEGIN
IDS_OWNERTITLE "Owner page title"
IDS_OWNERSUBTITLE "Owner page subtitle"
IDS_COMPUTERTITLE "Computer page title"
IDS_COMPUTERSUBTITLE "Computer page subtitle"
IDS_LOCALETITLE "Locale page title"
IDS_LOCALESUBTITLE "Locale page subtitle"
IDS_OWNERTITLE "Personalize your Software"
IDS_OWNERSUBTITLE "Setup uses this information about yourself to personalize ReactOS."
IDS_COMPUTERTITLE "Computer Name and Administrator Password"
IDS_COMPUTERSUBTITLE "You must provide a name and an Administrator Password for your computer."
IDS_LOCALETITLE "Regional settings"
IDS_LOCALESUBTITLE "You can customize ReactOS for different regions and languages."
IDS_DATETIMETITLE "Date and Time"
IDS_DATETIMESUBTITLE "Set the correct date and time for your computer."
IDS_PROCESSTITLE "Process page title"
IDS_PROCESSSUBTITLE "Process page subtitle"
END

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: wizard.c,v 1.9 2004/10/11 21:08:04 weiden Exp $
/* $Id: wizard.c,v 1.10 2004/11/02 15:42:09 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -355,6 +355,99 @@ ComputerPageDlgProc(HWND hwndDlg,
}
static VOID
SetKeyboardLayoutName(HWND hwnd)
{
#if 0
WCHAR szLayoutPath[256];
WCHAR szLocaleName[32];
DWORD dwLocaleSize;
HKEY hKey;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Locale",
0,
KEY_ALL_ACCESS,
&hKey))
return;
dwValueSize = 16 * sizeof(WCHAR);
if (RegQueryValueExW(hKey,
NULL,
NULL,
NULL,
szLocaleName,
&dwLocaleSize))
{
RegCloseKey(hKey);
return;
}
wcscpy(szLayoutPath,
L"SYSTEM\\CurrentControlSet\\Control\\KeyboardLayouts\\"
wcscat(szLayoutPath,
szLocaleName);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
szLayoutPath,
0,
KEY_ALL_ACCESS,
&hKey))
return;
dwValueSize = 32 * sizeof(WCHAR);
if (RegQueryValueExW(hKey,
L"Layout Text",
NULL,
NULL,
szLocaleName,
&dwLocaleSize))
{
RegCloseKey(hKey);
return;
}
RegCloseKey(hKey);
#endif
}
static VOID
RunLocalePage(VOID)
{
PROPSHEETPAGE psp;
PROPSHEETHEADER psh;
HMODULE hDll;
// TCHAR Caption[256];
hDll = LoadLibraryW(L"intl.cpl");
ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT;
psp.hInstance = hDll;
psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
psp.pfnDlgProc = GetProcAddress(hDll, "LocalePageProc");
// LoadString(hDll, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE; // | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.hInstance = hDll;
// psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
// psh.pszCaption = Caption;
psh.nPages = 1;
psh.nStartPage = 0;
psh.ppsp = &psp;
PropertySheet(&psh);
FreeLibrary(hDll);
}
INT_PTR CALLBACK
LocalePageDlgProc(HWND hwndDlg,
UINT uMsg,
@ -374,6 +467,196 @@ LocalePageDlgProc(HWND hwndDlg,
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)SetupData);
SetKeyboardLayoutName(GetDlgItem(hwndDlg, IDC_LAYOUTTEXT));
}
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDC_CUSTOMLOCALE:
{
RunLocalePage();
}
break;
}
}
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
switch (lpnm->code)
{
case PSN_SETACTIVE:
/* Enable the Back and Next buttons */
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
break;
case PSN_WIZNEXT:
break;
default:
break;
}
}
break;
default:
break;
}
return FALSE;
}
static VOID
InitTimeZoneList(HWND hwnd)
{
WCHAR szKeyName[256];
WCHAR szValue[256];
DWORD dwIndex;
DWORD dwNameSize;
DWORD dwValueSize;
LONG lError;
HKEY hZonesKey;
HKEY hZoneKey;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones",
0,
KEY_ALL_ACCESS,
&hZonesKey))
return;
dwIndex = 0;
while (TRUE)
{
dwNameSize = 256;
lError = RegEnumKeyExW(hZonesKey,
dwIndex,
szKeyName,
&dwNameSize,
NULL,
NULL,
NULL,
NULL);
if (lError != ERROR_SUCCESS && lError != ERROR_MORE_DATA)
break;
if (RegOpenKeyExW(hZonesKey,
szKeyName,
0,
KEY_ALL_ACCESS,
&hZoneKey))
break;
dwValueSize = 256 * sizeof(WCHAR);
if (RegQueryValueExW(hZoneKey,
L"Display",
NULL,
NULL,
(LPBYTE)szValue,
&dwValueSize))
{
RegCloseKey(hZoneKey);
break;
}
SendMessageW(hwnd,
CB_ADDSTRING,
0,
(LPARAM)szValue);
RegCloseKey(hZoneKey);
dwIndex++;
}
RegCloseKey(hZonesKey);
SendMessageW(hwnd,
CB_SETCURSEL,
(WPARAM)0, // index
0);
#if 0
SendMessage(hwnd,
CB_ADDSTRING,
0,
(LPARAM)"Test0");
SendMessage(hwnd,
CB_ADDSTRING,
0,
(LPARAM)"Test1");
SendMessage(hwnd,
CB_ADDSTRING,
0,
(LPARAM)"Test2");
SendMessage(hwnd,
CB_ADDSTRING,
0,
(LPARAM)"Test3");
SendMessage(hwnd,
CB_SETCURSEL,
(WPARAM)0, // index
0);
#endif
}
static VOID
SetLocalDateTime(HWND hwnd)
{
SYSTEMTIME Date;
SYSTEMTIME Time;
SYSTEMTIME SystemTime;
if (DateTime_GetSystemTime(GetDlgItem(hwnd, IDC_DATEPICKER), &Date) == GDT_VALID)
{
if (DateTime_GetSystemTime(GetDlgItem(hwnd, IDC_TIMEPICKER), &Time) == GDT_VALID)
{
SystemTime.wYear = Date.wYear;
SystemTime.wMonth = Date.wMonth;
SystemTime.wDayOfWeek = Date.wDayOfWeek;
SystemTime.wDay = Date.wDay;
SystemTime.wHour = Time.wHour;
SystemTime.wMinute = Time.wMinute;
SystemTime.wSecond = Time.wSecond;
SystemTime.wMilliseconds = Time.wMilliseconds;
SetLocalTime(&SystemTime);
}
}
}
INT_PTR CALLBACK
DateTimePageDlgProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
PSETUPDATA SetupData;
/* Retrieve pointer to the global setup data */
SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
switch (uMsg)
{
case WM_INITDIALOG:
{
/* Save pointer to the global setup data */
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)SetupData);
InitTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST));
}
break;
@ -390,6 +673,11 @@ LocalePageDlgProc(HWND hwndDlg,
break;
case PSN_WIZNEXT:
{
// SetTimeZoneInformation();
SetLocalDateTime(hwndDlg);
}
break;
default:
@ -585,27 +873,36 @@ InstallWizard(VOID)
ahpsp[3] = CreatePropertySheetPage(&psp);
/* Create the DateTime page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
psp.pfnDlgProc = DateTimePageDlgProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
ahpsp[4] = CreatePropertySheetPage(&psp);
/* Create the Process page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
psp.pfnDlgProc = ProcessPageDlgProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
ahpsp[4] = CreatePropertySheetPage(&psp);
ahpsp[5] = CreatePropertySheetPage(&psp);
/* Create the Finish page */
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
psp.pfnDlgProc = FinishDlgProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
ahpsp[5] = CreatePropertySheetPage(&psp);
ahpsp[6] = CreatePropertySheetPage(&psp);
/* Create the property sheet */
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
psh.hInstance = hDllInstance;
psh.hwndParent = NULL;
psh.nPages = 6;
psh.nPages = 7;
psh.nStartPage = 0;
psh.phpage = ahpsp;
psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);