mirror of
https://github.com/reactos/reactos.git
synced 2025-06-14 20:58:28 +00:00
Implement the time format page for the regional settings control panel.
svn path=/trunk/; revision=14792
This commit is contained in:
parent
63b33dd9b3
commit
4fd3eee227
4 changed files with 221 additions and 11 deletions
|
@ -34,7 +34,25 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Uhrzeit"
|
CAPTION "Uhrzeit"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Property Page 4",-1,73,74,90,8
|
GROUPBOX "Darstellung", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE
|
||||||
|
LTEXT "Beispiel:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "&Zeitformat:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "&Trennzeichen:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "Symbol für &Vormittag:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "Symbol für &Nachmittag:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
GROUPBOX "", -1, 7, 132, 228, 88, WS_VISIBLE
|
||||||
|
LTEXT "Zeitformat\n\n"
|
||||||
|
"h = Stunde m = Minute s = Sekunde t = Vor-/Nachmittag\n\n"
|
||||||
|
"h = 12 Stunden\n"
|
||||||
|
"H = 24 Stunden\n\n"
|
||||||
|
"hh, mm, ss = führende Null\n"
|
||||||
|
"h, m, s = keine führende Null",
|
||||||
|
-1, 13, 141, 214, 74, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,25 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Time"
|
CAPTION "Time"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Property Page 4",-1,73,74,90,8
|
GROUPBOX "Appearance sample", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE
|
||||||
|
LTEXT "Time sample:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "&Time format:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "Time &separator:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "A&M symbol:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
LTEXT "&PM symbol:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
GROUPBOX "", -1, 7, 132, 228, 88, WS_VISIBLE
|
||||||
|
LTEXT "Time format notation\n\n"
|
||||||
|
"h = hour m = minute s = second t = am or pm\n\n"
|
||||||
|
"h = 12 hour\n"
|
||||||
|
"H = 24 hour\n\n"
|
||||||
|
"hh, mm, ss = leading zero\n"
|
||||||
|
"h, m, s = no leading zero",
|
||||||
|
-1, 13, 141, 214, 74, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,14 @@
|
||||||
#define IDD_GENERALPAGE 100
|
#define IDD_GENERALPAGE 100
|
||||||
#define IDD_NUMBERSPAGE 101
|
#define IDD_NUMBERSPAGE 101
|
||||||
#define IDD_CURRENCYPAGE 102
|
#define IDD_CURRENCYPAGE 102
|
||||||
|
|
||||||
#define IDD_TIMEPAGE 103
|
#define IDD_TIMEPAGE 103
|
||||||
|
#define IDC_TIMESAMPLE 107
|
||||||
|
#define IDC_TIMEFORMAT 108
|
||||||
|
#define IDC_TIMESEPARATOR 109
|
||||||
|
#define IDC_TIMEAMSYMBOL 110
|
||||||
|
#define IDC_TIMEPMSYMBOL 111
|
||||||
|
|
||||||
#define IDD_DATEPAGE 104
|
#define IDD_DATEPAGE 104
|
||||||
#define IDD_LOCALEPAGE 105
|
#define IDD_LOCALEPAGE 105
|
||||||
#define IDC_LANGUAGELIST 106
|
#define IDC_LANGUAGELIST 106
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/*
|
||||||
*
|
|
||||||
* PROJECT: ReactOS International Control Panel
|
* PROJECT: ReactOS International Control Panel
|
||||||
* FILE: lib/cpl/intl/time.c
|
* FILE: lib/cpl/intl/time.c
|
||||||
* PURPOSE: Time property page
|
* PURPOSE: Time property page
|
||||||
|
@ -31,6 +30,24 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO:
|
||||||
|
* - Enumerate available time formats (use EnumTimeformatsW)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
UpdateTimeSample(HWND hWnd)
|
||||||
|
{
|
||||||
|
WCHAR InBuffer[80];
|
||||||
|
WCHAR OutBuffer[80];
|
||||||
|
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
|
||||||
|
|
||||||
|
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
|
||||||
|
|
||||||
|
SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
@ -42,8 +59,158 @@ TimePageProc(HWND hwndDlg,
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
WCHAR Buffer[80];
|
||||||
|
int nLen;
|
||||||
|
|
||||||
|
/* Update the time format sample */
|
||||||
|
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||||
|
|
||||||
|
/* Get the time format (max. 80 characters) */
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
|
CB_LIMITTEXT, 80, 0);
|
||||||
|
|
||||||
|
/* FIXME: add available time formats to the list */
|
||||||
|
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)Buffer);
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
0, /* index */
|
||||||
|
0);
|
||||||
|
|
||||||
|
/* Get the time separator (max. 4 characters) */
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
|
CB_LIMITTEXT, 4, 0);
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)Buffer);
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
0, /* index */
|
||||||
|
0);
|
||||||
|
|
||||||
|
/* Get the AM symbol (max. 9 characters) */
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_LIMITTEXT, 9, 0);
|
||||||
|
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)Buffer);
|
||||||
|
if (nLen != 0)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)L"");
|
||||||
|
}
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
0, /* index */
|
||||||
|
0);
|
||||||
|
|
||||||
|
/* Get the PM symbol (max. 9 characters) */
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_LIMITTEXT, 9, 0);
|
||||||
|
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)Buffer);
|
||||||
|
if (nLen != 0)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)L"");
|
||||||
|
}
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
0, /* index */
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_TIMEFORMAT:
|
||||||
|
case IDC_TIMESEPARATOR:
|
||||||
|
case IDC_TIMEAMSYMBOL:
|
||||||
|
case IDC_TIMEPMSYMBOL:
|
||||||
|
if (HIWORD(wParam) == CBN_SELCHANGE ||
|
||||||
|
HIWORD(wParam) == CBN_EDITCHANGE)
|
||||||
|
{
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
|
|
||||||
|
if (lpnm->code == PSN_APPLY)
|
||||||
|
{
|
||||||
|
WCHAR Buffer[80];
|
||||||
|
int nIndex;
|
||||||
|
|
||||||
|
/* Set time format */
|
||||||
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
|
CB_GETCURSEL, 0, 0);
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||||
|
|
||||||
|
/* Set time separator */
|
||||||
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
|
CB_GETCURSEL, 0, 0);
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||||
|
|
||||||
|
/* Set the AM symbol */
|
||||||
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_GETCURSEL, 0, 0);
|
||||||
|
if (nIndex != CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L"");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the PM symbol */
|
||||||
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_GETCURSEL, 0, 0);
|
||||||
|
if (nIndex != CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L"");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the time format sample */
|
||||||
|
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue