mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[INTL]
- Improve the internal locale storage. Replace the array of strings by a customized struct. - Implement the locale customization properly. The customization property sheet modifies the internal locale storage rather than the registry. Now, cancelling changes works properly. CORE-10074 svn path=/trunk/; revision=69449
This commit is contained in:
parent
a1100ebbb1
commit
b099514289
8 changed files with 1393 additions and 927 deletions
|
@ -27,7 +27,6 @@
|
|||
|
||||
#define POSITIVE_EXAMPLE L"123456789.00"
|
||||
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
||||
#define MAX_FIELD_DIG_SAMPLES 3
|
||||
|
||||
|
||||
static VOID
|
||||
|
@ -36,14 +35,14 @@ UpdateExamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Positive example */
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
POSITIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSSAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
/* Negative example */
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
NEGATIVE_EXAMPLE,
|
||||
NULL, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
|
@ -54,23 +53,17 @@ UpdateExamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencySymbols(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYSYMBOL,
|
||||
MAX_CURRSYMBOL - 1,
|
||||
0);
|
||||
|
||||
/* Set currency symbols */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
(LPARAM)pGlobalData->szCurrSymbol);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
|
@ -82,65 +75,23 @@ InitCurrencySymbols(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT nPositiveOrder = 0;
|
||||
INT ret;
|
||||
INT i;
|
||||
|
||||
|
||||
/* Get positive format */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRENCY,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
nPositiveOrder = _wtoi(szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
cyFmt.NumDigits = _wtoi(szBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
cyFmt.NumDigits = 0;
|
||||
}
|
||||
|
||||
/* Get decimal separator */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get group separator */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get currency symbol */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
|
||||
/* positive currency values */
|
||||
cyFmt.NumDigits = pGlobalData->nCurrDigits;
|
||||
cyFmt.LeadingZero = 0;
|
||||
cyFmt.Grouping = 3;
|
||||
cyFmt.lpDecimalSep = szDecimalSep;
|
||||
cyFmt.lpThousandSep = szThousandSep;
|
||||
cyFmt.lpCurrencySymbol = szCurrencySymbol;
|
||||
cyFmt.lpDecimalSep = pGlobalData->szCurrDecimalSep;
|
||||
cyFmt.lpThousandSep = pGlobalData->szCurrThousandSep;
|
||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrSymbol;
|
||||
cyFmt.NegativeOrder = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
cyFmt.PositiveOrder = i;
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
L"1.1",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
|
@ -152,7 +103,7 @@ InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSVALUE,
|
||||
CB_SETCURSEL,
|
||||
nPositiveOrder,
|
||||
pGlobalData->nCurrPosFormat,
|
||||
0);
|
||||
}
|
||||
|
||||
|
@ -160,64 +111,23 @@ InitCurrencyPositiveFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szDecimalSep[MAX_FMT_SIZE];
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szCurrencySymbol[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT nNegativeOrder = 0;
|
||||
INT ret;
|
||||
int i;
|
||||
|
||||
/* Get negative format */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_INEGCURR,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
nNegativeOrder = _wtoi(szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
cyFmt.NumDigits = _wtoi(szBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
cyFmt.NumDigits = 0;
|
||||
}
|
||||
|
||||
/* Get decimal separator */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szDecimalSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get group separator */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get currency symbol */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SCURRENCY,
|
||||
szCurrencySymbol, MAX_FMT_SIZE);
|
||||
|
||||
/* negative currency values */
|
||||
cyFmt.NumDigits = pGlobalData->nCurrDigits;
|
||||
cyFmt.LeadingZero = 0;
|
||||
cyFmt.Grouping = 3;
|
||||
cyFmt.lpDecimalSep = szDecimalSep;
|
||||
cyFmt.lpThousandSep = szThousandSep;
|
||||
cyFmt.lpCurrencySymbol = szCurrencySymbol;
|
||||
cyFmt.lpDecimalSep = pGlobalData->szCurrDecimalSep;
|
||||
cyFmt.lpThousandSep = pGlobalData->szCurrThousandSep;
|
||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrSymbol;
|
||||
cyFmt.PositiveOrder = 0;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
cyFmt.NegativeOrder = i;
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
L"-1.1",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
|
@ -229,7 +139,7 @@ InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGVALUE,
|
||||
CB_SETCURSEL,
|
||||
nNegativeOrder,
|
||||
pGlobalData->nCurrNegFormat,
|
||||
0);
|
||||
}
|
||||
|
||||
|
@ -237,24 +147,17 @@ InitCurrencyNegativeFormats(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyDecimalSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYDECSEP,
|
||||
MAX_CURRDECIMALSEP - 1,
|
||||
0);
|
||||
|
||||
/* Get decimal separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
/* Decimal separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
(LPARAM)pGlobalData->szCurrDecimalSep);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
CB_SETCURSEL,
|
||||
|
@ -268,7 +171,6 @@ static VOID
|
|||
InitCurrencyNumFracDigits(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Create standard list of fractional symbols */
|
||||
|
@ -282,24 +184,10 @@ InitCurrencyNumFracDigits(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
/* Get number of fractional digits */
|
||||
ret = GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ICURRDIGITS,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_SETCURSEL,
|
||||
_wtoi(szBuffer),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_SETCURSEL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM,
|
||||
CB_SETCURSEL,
|
||||
pGlobalData->nCurrDigits,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,24 +195,17 @@ InitCurrencyNumFracDigits(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitCurrencyGroupSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_LIMITTEXT,
|
||||
MAX_CURRENCYGRPSEP,
|
||||
MAX_CURRTHOUSANDSEP - 1,
|
||||
0);
|
||||
|
||||
/* Get group separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
/* Digit group separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
(LPARAM)pGlobalData->szCurrThousandSep);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
CB_SETCURSEL,
|
||||
|
@ -336,32 +217,19 @@ InitCurrencyGroupSeparators(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szThousandSep[MAX_FMT_SIZE];
|
||||
WCHAR szGrouping[MAX_FMT_SIZE];
|
||||
WCHAR szBuffer[MAX_FMT_SIZE];
|
||||
CURRENCYFMTW cyFmt;
|
||||
INT i;
|
||||
|
||||
/* Get group separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONTHOUSANDSEP,
|
||||
szThousandSep, MAX_FMT_SIZE);
|
||||
|
||||
/* Get grouping */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SMONGROUPING,
|
||||
szGrouping, MAX_FMT_SIZE);
|
||||
|
||||
/* Digit grouping */
|
||||
cyFmt.NumDigits = 0;
|
||||
cyFmt.LeadingZero = 0;
|
||||
cyFmt.lpDecimalSep = L"";
|
||||
cyFmt.lpThousandSep = szThousandSep;
|
||||
cyFmt.lpThousandSep = pGlobalData->szCurrThousandSep;
|
||||
cyFmt.PositiveOrder = 0;
|
||||
cyFmt.NegativeOrder = 0;
|
||||
cyFmt.lpCurrencySymbol = L"";
|
||||
cyFmt.Grouping = 0;
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
|
@ -370,7 +238,7 @@ InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
(LPARAM)szBuffer);
|
||||
|
||||
cyFmt.Grouping = 3;
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
|
@ -379,7 +247,7 @@ InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
(LPARAM)szBuffer);
|
||||
|
||||
cyFmt.Grouping = 32;
|
||||
GetCurrencyFormatW(pGlobalData->lcid, 0,
|
||||
GetCurrencyFormatW(pGlobalData->UserLCID, 0,
|
||||
L"123456789",
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
|
@ -387,19 +255,9 @@ InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
||||
i = 0;
|
||||
if (szGrouping[0] == L'3')
|
||||
{
|
||||
if ((szGrouping[1] == L';') &&
|
||||
(szGrouping[2] == L'2'))
|
||||
i = 2;
|
||||
else
|
||||
i = 1;
|
||||
}
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
CB_SETCURSEL,
|
||||
i, /* Index */
|
||||
pGlobalData->nCurrGrouping, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
@ -408,14 +266,7 @@ InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
PWSTR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES]=
|
||||
{
|
||||
L"0;0",
|
||||
L"3;0",
|
||||
L"3;2;0"
|
||||
};
|
||||
|
||||
int nCurrSel;
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of digits in field */
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM,
|
||||
|
@ -425,7 +276,7 @@ SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
|
||||
/* Save number of digits in field */
|
||||
if (nCurrSel != CB_ERR)
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||
pGlobalData->nCurrGrouping = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -434,16 +285,11 @@ SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetCurrencyFieldSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency field separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencyFieldSep);
|
||||
|
||||
/* Save currency field separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||
(LPARAM)pGlobalData->szCurrThousandSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -452,7 +298,6 @@ SetCurrencyFieldSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of fractional symbols */
|
||||
|
@ -460,12 +305,10 @@ SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to wide char */
|
||||
_itow(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||
|
||||
/* Save number of fractional symbols */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||
pGlobalData->nCurrDigits = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -474,18 +317,11 @@ SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetCurrencySep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency decimal separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencySep);
|
||||
|
||||
/* TODO: Add check for correctly input */
|
||||
|
||||
/* Save currency separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||
(LPARAM)pGlobalData->szCurrDecimalSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -494,7 +330,6 @@ SetCurrencySep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
|
@ -502,12 +337,10 @@ SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to wide char */
|
||||
_itow(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||
pGlobalData->nCurrNegFormat = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -516,7 +349,6 @@ SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static BOOL
|
||||
SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
|
@ -524,30 +356,23 @@ SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to wide char */
|
||||
_itow(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||
pGlobalData->nCurrPosFormat = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency unit */
|
||||
/* Set currency symbol */
|
||||
static BOOL
|
||||
SetCurrencyUnit(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
SetCurrencySymbol(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency unit */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(PCWSTR)szCurrencyUnit);
|
||||
|
||||
/* Save currency unit */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||
(LPARAM)(PCWSTR)pGlobalData->szCurrSymbol);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -598,34 +423,32 @@ CurrencyPageProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
/* If push apply button */
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
if (!SetCurrencyDigNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetCurrencySymbol(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyUnit(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetCurrencyDigNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencySep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetCurrencySep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFieldSep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
if (!SetCurrencyFieldSep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
UpdateExamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
pGlobalData->fUserLocaleChanged = TRUE;
|
||||
|
||||
UpdateExamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -93,13 +93,13 @@ SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
INT nSepStrSize;
|
||||
INT nSepCount;
|
||||
|
||||
/* Get setted separator */
|
||||
/* Get separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted separator string size */
|
||||
/* Get separator string size */
|
||||
nSepStrSize = wcslen(szShortDateSep);
|
||||
|
||||
/* Check date components */
|
||||
|
@ -113,7 +113,7 @@ SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
}
|
||||
|
||||
/* Save date separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SDATE, szShortDateSep);
|
||||
wcscpy(pGlobalData->szDateSep, szShortDateSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -131,19 +131,19 @@ SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
/* Get format */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateFmt);
|
||||
|
||||
/* Get setted separator */
|
||||
/* Get separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted format-string size */
|
||||
/* Get format-string size */
|
||||
nFmtStrSize = wcslen(szShortDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
|
@ -178,11 +178,11 @@ SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
wcscpy(szShortDateFmt, pszResultStr);
|
||||
free(pszResultStr);
|
||||
|
||||
if(pszFoundSep)
|
||||
if (pszFoundSep)
|
||||
free(pszFoundSep);
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||
wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -196,13 +196,13 @@ SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
/* Get format */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szLongDateFmt);
|
||||
|
||||
/* Get setted format string size */
|
||||
/* Get format string size */
|
||||
nFmtStrSize = wcslen(szLongDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
|
@ -229,8 +229,8 @@ SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SLONGDATE, szLongDateFmt);
|
||||
/* Save long date format */
|
||||
wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -245,16 +245,9 @@ InitShortDateSepSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
L"/",
|
||||
L"-"
|
||||
};
|
||||
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current short date separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SDATE,
|
||||
szShortDateSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -274,7 +267,7 @@ InitShortDateSepSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
(LPARAM)pGlobalData->szDateSep);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -282,11 +275,11 @@ InitShortDateSepSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateSep);
|
||||
(LPARAM)pGlobalData->szDateSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateSep);
|
||||
(LPARAM)pGlobalData->szDateSep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,25 +298,18 @@ ShortDateFormatEnumProc(PWSTR lpTimeFormatString)
|
|||
VOID
|
||||
InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text lengths */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATEFMT,
|
||||
MAX_SHORTDATEFORMAT,
|
||||
0);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_SHRTDATESEP,
|
||||
MAX_DATESEPARATOR,
|
||||
0);
|
||||
|
||||
/* Get current short date format */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SSHORTDATE,
|
||||
szShortDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -332,13 +318,13 @@ InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
|
||||
/* Enumerate short date formats */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->lcid, DATE_SHORTDATE);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->UserLCID, DATE_SHORTDATE);
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
(LPARAM)pGlobalData->szShortDateFormat);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -346,11 +332,11 @@ InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szShortDateFmt);
|
||||
(LPARAM)pGlobalData->szShortDateFormat);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
(LPARAM)pGlobalData->szShortDateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,21 +344,14 @@ InitShortDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitLongDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_LIMITTEXT,
|
||||
MAX_LONGDATEFMT,
|
||||
MAX_LONGDATEFORMAT,
|
||||
0);
|
||||
|
||||
/* Get current long date format */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SLONGDATE,
|
||||
szLongDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -381,13 +360,13 @@ InitLongDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
|
||||
/* Enumerate short long formats */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->lcid, DATE_LONGDATE);
|
||||
EnumDateFormatsW(ShortDateFormatEnumProc, pGlobalData->UserLCID, DATE_LONGDATE);
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
(LPARAM)pGlobalData->szLongDateFormat);
|
||||
|
||||
/* If it is not successful, add new value to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -395,11 +374,11 @@ InitLongDateCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szLongDateFmt);
|
||||
(LPARAM)pGlobalData->szLongDateFormat);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
(LPARAM)pGlobalData->szLongDateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +426,7 @@ GetMaxDate(LCID lcid)
|
|||
|
||||
/* Set's MIN data edit control value to MAX-99 */
|
||||
static VOID
|
||||
SetMinData(HWND hwndDlg)
|
||||
SetMinDate(HWND hwndDlg)
|
||||
{
|
||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
|
@ -489,14 +468,14 @@ InitMinMaxDateSpin(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Init max date value */
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->lcid));
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->UserLCID));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SECONDYEAR_EDIT,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Init min date value */
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->lcid) - YEAR_DIFF);
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate(pGlobalData->UserLCID) - YEAR_DIFF);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_FIRSTYEAR_EDIT,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
|
@ -513,7 +492,7 @@ InitMinMaxDateSpin(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendMessageW(hWndYearSpin,
|
||||
UDM_SETPOS,
|
||||
0,
|
||||
MAKELONG(GetMaxDate(pGlobalData->lcid),0));
|
||||
MAKELONG(GetMaxDate(pGlobalData->UserLCID),0));
|
||||
}
|
||||
|
||||
/* Update all date locale samples */
|
||||
|
@ -524,13 +503,13 @@ UpdateDateLocaleSamples(HWND hwndDlg,
|
|||
WCHAR OutBuffer[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get short date format sample */
|
||||
GetDateFormatW(pGlobalData->lcid, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormatW(pGlobalData->UserLCID, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESAMPLE_EDIT, WM_SETTEXT,
|
||||
0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get long date sample */
|
||||
GetDateFormatW(pGlobalData->lcid, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormatW(pGlobalData->UserLCID, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_LONGDATESAMPLE_EDIT,
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
|
@ -562,56 +541,54 @@ DatePageProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_SECONDYEAR_EDIT:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
if(HIWORD(wParam)==EN_CHANGE)
|
||||
{
|
||||
SetMinData(hwndDlg);
|
||||
}
|
||||
}
|
||||
case IDC_SCR_MAX_YEAR:
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
/* FIXME */
|
||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
case IDC_CALTYPE_COMBO:
|
||||
case IDC_HIJCHRON_COMBO:
|
||||
case IDC_SHRTDATEFMT_COMBO:
|
||||
case IDC_SHRTDATESEP_COMBO:
|
||||
case IDC_LONGDATEFMT_COMBO:
|
||||
{
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
case IDC_SECONDYEAR_EDIT:
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
{
|
||||
SetMinDate(hwndDlg);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_SCR_MAX_YEAR:
|
||||
/* Set "Apply" button enabled */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
/* FIXME */
|
||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
||||
case IDC_CALTYPE_COMBO:
|
||||
case IDC_HIJCHRON_COMBO:
|
||||
case IDC_SHRTDATEFMT_COMBO:
|
||||
case IDC_LONGDATEFMT_COMBO:
|
||||
case IDC_SHRTDATESEP_COMBO:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
if (!SetLongDateFormat(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetShortDateFormat(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
if (!SetShortDateSep(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
pGlobalData->fUserLocaleChanged = TRUE;
|
||||
|
||||
SetMaxDate(hwndDlg, pGlobalData->UserLCID);
|
||||
InitShortDateCB(hwndDlg, pGlobalData);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
/* If push apply button */
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
SetMaxDate(hwndDlg, pGlobalData->lcid);
|
||||
if(!SetShortDateSep(hwndDlg, pGlobalData)) break;
|
||||
if(!SetShortDateFormat(hwndDlg, pGlobalData)) break;
|
||||
if(!SetLongDateFormat(hwndDlg, pGlobalData)) break;
|
||||
InitShortDateCB(hwndDlg, pGlobalData);
|
||||
/* FIXME: */
|
||||
//Sleep(15);
|
||||
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,25 +24,32 @@
|
|||
#define MAX_STR_SIZE 128
|
||||
#define MAX_SAMPLES_STR_SIZE 70
|
||||
|
||||
#define MAX_NUMBERDSYMBOL 3
|
||||
#define MAX_NUMBERSDIGITGRSYM 3
|
||||
#define MAX_NUMBERSNSIGNSYM 4
|
||||
#define MAX_NUMBERSLSEP 3
|
||||
#define MAX_NUMDECIMALSEP 4
|
||||
#define MAX_NUMTHOUSANDSEP 4
|
||||
#define MAX_NUMNEGATIVESIGN 5
|
||||
#define MAX_NUMPOSITIVESIGN 5
|
||||
#define MAX_NUMLISTSEP 4
|
||||
#define MAX_NUMNATIVEDIGITS 11
|
||||
|
||||
#define MAX_CURRENCYSYMBOL 5
|
||||
#define MAX_CURRENCYDECSEP 3
|
||||
#define MAX_CURRENCYGRPSEP 3
|
||||
#define MAX_CURRSYMBOL 13
|
||||
#define MAX_CURRDECIMALSEP 4
|
||||
#define MAX_CURRTHOUSANDSEP 4
|
||||
#define MAX_CURRGROUPING 10
|
||||
|
||||
#define MAX_TIMEFORMAT 80
|
||||
#define MAX_TIMESEPARATOR 3
|
||||
#define MAX_TIMEAMSYMBOL 12
|
||||
#define MAX_TIMEPMSYMBOL 12
|
||||
#define MAX_TIMESEPARATOR 4
|
||||
#define MAX_TIMEAMSYMBOL 15
|
||||
#define MAX_TIMEPMSYMBOL 15
|
||||
|
||||
#define MAX_SHRTDATEFMT 80
|
||||
#define MAX_SHRTDATESEP 3
|
||||
#define MAX_LONGDATEFMT 80
|
||||
#define MAX_SHORTDATEFORMAT 80
|
||||
#define MAX_LONGDATEFORMAT 80
|
||||
#define MAX_DATESEPARATOR 4
|
||||
#define MAX_YEAR_EDIT 4
|
||||
|
||||
#define MAX_MISCCOUNTRY 80
|
||||
#define MAX_MISCLANGUAGE 80
|
||||
|
||||
|
||||
typedef struct _APPLET
|
||||
{
|
||||
UINT idIcon;
|
||||
|
@ -53,15 +60,59 @@ typedef struct _APPLET
|
|||
|
||||
typedef struct _GLOBALDATA
|
||||
{
|
||||
/* Number */
|
||||
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP];
|
||||
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP];
|
||||
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN];
|
||||
WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN];
|
||||
WCHAR szNumListSep[MAX_NUMLISTSEP];
|
||||
WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS];
|
||||
INT nNumNegFormat;
|
||||
INT nNumDigits;
|
||||
INT nNumLeadingZero;
|
||||
INT nNumGrouping;
|
||||
INT nNumMeasure;
|
||||
INT nNumShape;
|
||||
|
||||
/* Currency */
|
||||
WCHAR szCurrSymbol[MAX_CURRSYMBOL];
|
||||
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP];
|
||||
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP];
|
||||
INT nCurrPosFormat;
|
||||
INT nCurrNegFormat;
|
||||
INT nCurrDigits;
|
||||
INT nCurrGrouping;
|
||||
|
||||
/* Time */
|
||||
WCHAR szTimeFormat[MAX_TIMEFORMAT];
|
||||
WCHAR szTimeSep[MAX_TIMESEPARATOR];
|
||||
WCHAR szTimeAM[MAX_TIMEAMSYMBOL];
|
||||
WCHAR szTimePM[MAX_TIMEPMSYMBOL];
|
||||
INT nTime;
|
||||
INT nTimePrefix;
|
||||
INT nTimeLeadingZero;
|
||||
|
||||
/* Date */
|
||||
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT];
|
||||
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT];
|
||||
WCHAR szDateSep[MAX_DATESEPARATOR];
|
||||
INT nFirstDayOfWeek;
|
||||
INT nFirstWeekOfYear;
|
||||
INT nDate;
|
||||
INT nCalendarType;
|
||||
|
||||
/* Other */
|
||||
WCHAR szMiscCountry[MAX_MISCCOUNTRY];
|
||||
WCHAR szMiscLanguage[MAX_MISCLANGUAGE];
|
||||
INT nMiscCountry;
|
||||
|
||||
LCID UserLCID;
|
||||
BOOL fUserLocaleChanged;
|
||||
BOOL bApplyToDefaultUser;
|
||||
|
||||
GEOID geoid;
|
||||
BOOL fGeoIdChanged;
|
||||
|
||||
LCID lcid;
|
||||
DWORD dwLocaleCount;
|
||||
PWSTR *pLocaleArray;
|
||||
BOOL fUserLocaleChanged;
|
||||
} GLOBALDATA, *PGLOBALDATA;
|
||||
|
||||
extern HINSTANCE hApplet;
|
||||
|
@ -85,8 +136,6 @@ LanguagesPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|||
/* advanced.c */
|
||||
INT_PTR CALLBACK
|
||||
AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
VOID
|
||||
SetNonUnicodeLang(HWND hwnd, LCID lcid);
|
||||
|
||||
/* currency.c */
|
||||
INT_PTR CALLBACK
|
||||
|
@ -100,6 +149,11 @@ DatePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|||
INT_PTR CALLBACK
|
||||
GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
PWSTR
|
||||
GetLocaleString(
|
||||
PWSTR *pLocaleArray,
|
||||
LCTYPE lcType);
|
||||
|
||||
/* locale.c */
|
||||
INT_PTR CALLBACK
|
||||
InpLocalePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
@ -126,10 +180,6 @@ InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr);
|
|||
PWSTR
|
||||
ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl);
|
||||
|
||||
LONG
|
||||
APIENTRY
|
||||
SetupApplet(HWND hwndDlg, PGLOBALDATA pGlobalData);
|
||||
|
||||
/* kblayouts.c */
|
||||
VOID AddNewKbLayoutsByLcid(LCID Lcid);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "intl.h"
|
||||
|
||||
#define NUM_SHEETS 4
|
||||
|
||||
/* Insert the space */
|
||||
PWSTR
|
||||
InsSpacePos(PCWSTR szInsStr, const int nPos)
|
||||
|
@ -167,59 +165,4 @@ ReplaceSubStr(PCWSTR szSourceStr,
|
|||
return szDestStr;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGEW));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGEW);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hApplet;
|
||||
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
||||
psp->pfnDlgProc = DlgProc;
|
||||
psp->lParam = (LPARAM)pGlobalData;
|
||||
}
|
||||
|
||||
|
||||
/* Create applets */
|
||||
LONG
|
||||
APIENTRY
|
||||
SetupApplet(
|
||||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
PROPSHEETPAGEW PsPage[NUM_SHEETS + 1];
|
||||
PROPSHEETHEADERW psh;
|
||||
WCHAR Caption[MAX_STR_SIZE];
|
||||
INT_PTR ret;
|
||||
|
||||
LoadStringW(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK;
|
||||
psh.hwndParent = hwndDlg;
|
||||
psh.hInstance = hApplet;
|
||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||
psh.pszCaption = Caption;
|
||||
psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1;
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = PsPage;
|
||||
|
||||
InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc, pGlobalData);
|
||||
InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc, pGlobalData);
|
||||
InitPropSheetPage(&PsPage[2], IDD_TIMEPAGE, TimePageProc, pGlobalData);
|
||||
InitPropSheetPage(&PsPage[3], IDD_DATEPAGE, DatePageProc, pGlobalData);
|
||||
|
||||
if (IsSortPageNeeded(pGlobalData->lcid))
|
||||
{
|
||||
psh.nPages++;
|
||||
InitPropSheetPage(&PsPage[4], IDD_SORTPAGE, SortPageProc, pGlobalData);
|
||||
}
|
||||
|
||||
ret = PropertySheetW(&psh);
|
||||
|
||||
return (LONG)(ret != -1);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -57,22 +57,15 @@ static PWSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] =
|
|||
static VOID
|
||||
InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
CB_LIMITTEXT,
|
||||
MAX_NUMBERDSYMBOL,
|
||||
MAX_NUMDECIMALSEP - 1,
|
||||
0);
|
||||
|
||||
/* Get current decimal separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SDECIMAL,
|
||||
szNumSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -92,7 +85,7 @@ InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)szNumSep);
|
||||
(LPARAM)pGlobalData->szNumDecimalSep);
|
||||
|
||||
/* If it is not successful, add new values to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -100,11 +93,11 @@ InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
MAX_NUM_SEP_SAMPLES,
|
||||
(LPARAM)szNumSep);
|
||||
(LPARAM)pGlobalData->szNumDecimalSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szNumSep);
|
||||
(LPARAM)pGlobalData->szNumDecimalSep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,16 +105,9 @@ InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitNumOfFracSymbCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFracNum[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
|
||||
/* Get current number of fractional symbols */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_IDIGITS,
|
||||
szFracNum,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -143,7 +129,7 @@ InitNumOfFracSymbCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
/* Set current item to value from registry */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(szFracNum),
|
||||
(WPARAM)pGlobalData->nNumDigits,
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
|
@ -151,22 +137,15 @@ InitNumOfFracSymbCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
CB_LIMITTEXT,
|
||||
MAX_NUMBERSDIGITGRSYM,
|
||||
MAX_NUMTHOUSANDSEP - 1,
|
||||
0);
|
||||
|
||||
/* Get current field separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_STHOUSAND,
|
||||
szFieldSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -186,7 +165,7 @@ InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szFieldSep);
|
||||
(LPARAM)pGlobalData->szNumThousandSep);
|
||||
|
||||
/* If it is not success, add new values to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -194,11 +173,11 @@ InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szFieldSep);
|
||||
(LPARAM)pGlobalData->szNumThousandSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szFieldSep);
|
||||
(LPARAM)pGlobalData->szNumThousandSep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,16 +185,8 @@ InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitFieldDigNumCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
||||
PWSTR pszFieldDigNumSmpl;
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current field digits num */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SGROUPING,
|
||||
szFieldDigNum,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
|
@ -234,49 +205,25 @@ InitFieldDigNumCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
free(pszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, szFieldDigNum);
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)pszFieldDigNumSmpl);
|
||||
|
||||
/* If it is not successful, add new values to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pszFieldDigNumSmpl);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)pszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
free(pszFieldDigNumSmpl);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)pGlobalData->nNumGrouping,
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* Init negative sign control box */
|
||||
static VOID
|
||||
InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
CB_LIMITTEXT,
|
||||
MAX_NUMBERSNSIGNSYM,
|
||||
MAX_NUMNEGATIVESIGN - 1,
|
||||
0);
|
||||
|
||||
/* Get current negative sign */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SNEGATIVESIGN,
|
||||
szNegSign,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -296,7 +243,7 @@ InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szNegSign);
|
||||
(LPARAM)pGlobalData->szNumNegativeSign);
|
||||
|
||||
/* If it is not successful, add new values to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -304,11 +251,11 @@ InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szNegSign);
|
||||
(LPARAM)pGlobalData->szNumNegativeSign);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szNegSign);
|
||||
(LPARAM)pGlobalData->szNumNegativeSign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,50 +263,29 @@ InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNegNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szNewSample[MAX_SAMPLES_STR_SIZE];
|
||||
PWSTR pszResultStr;
|
||||
INT nCBIndex;
|
||||
|
||||
/* Get current negative numbers format */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_INEGNUMBER,
|
||||
szNegNumFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Get current decimal separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SDECIMAL,
|
||||
szNumSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Get current negative sign */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SNEGATIVESIGN,
|
||||
szNegSign,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Create standard list of negative numbers formats */
|
||||
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
|
||||
{
|
||||
/* Replace standard separator to setted */
|
||||
pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
|
||||
szNumSep,
|
||||
pGlobalData->szNumDecimalSep,
|
||||
L",");
|
||||
wcscpy(szNewSample, pszResultStr);
|
||||
free(pszResultStr);
|
||||
|
||||
/* Replace standard negative sign to setted */
|
||||
pszResultStr = ReplaceSubStr(szNewSample,
|
||||
szNegSign,
|
||||
pGlobalData->szNumNegativeSign,
|
||||
L"-");
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
|
||||
CB_ADDSTRING,
|
||||
|
@ -371,7 +297,7 @@ InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
/* Set current item to value from registry */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(szNegNumFmt),
|
||||
(WPARAM)pGlobalData->nNumNegFormat,
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
|
@ -379,34 +305,20 @@ InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
static VOID
|
||||
InitLeadingZeroesCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szLeadNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||
PWSTR pszResultStr;
|
||||
INT nCBIndex;
|
||||
|
||||
/* Get current leading zeroes format */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_ILZERO,
|
||||
szLeadNumFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER,
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Get current decimal separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SDECIMAL,
|
||||
szNumSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Create list of standard leading zeroes formats */
|
||||
for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
|
||||
{
|
||||
pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
|
||||
szNumSep,
|
||||
pGlobalData->szNumDecimalSep,
|
||||
L",");
|
||||
SendDlgItemMessage(hwndDlg, IDC_NUMBERSDISPLEADZER,
|
||||
CB_ADDSTRING,
|
||||
|
@ -418,7 +330,7 @@ InitLeadingZeroesCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
|
|||
/* Set current item to value from registry */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(szLeadNumFmt),
|
||||
(WPARAM)pGlobalData->nNumLeadingZero,
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
|
@ -426,22 +338,15 @@ static VOID
|
|||
InitListSepCB(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Limit text length */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
CB_LIMITTEXT,
|
||||
MAX_NUMBERSLSEP,
|
||||
MAX_NUMLISTSEP - 1,
|
||||
0);
|
||||
|
||||
/* Get current list separator */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_SLIST,
|
||||
szListSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -461,7 +366,7 @@ InitListSepCB(HWND hwndDlg,
|
|||
nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szListSep);
|
||||
(LPARAM)pGlobalData->szNumListSep);
|
||||
|
||||
/* If it is not successful, add new values to list and select them */
|
||||
if (nRetCode == CB_ERR)
|
||||
|
@ -469,11 +374,11 @@ InitListSepCB(HWND hwndDlg,
|
|||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szListSep);
|
||||
(LPARAM)pGlobalData->szNumListSep);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szListSep);
|
||||
(LPARAM)pGlobalData->szNumListSep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,16 +387,9 @@ static VOID
|
|||
InitUnitsSysCB(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR szUnitName[128];
|
||||
INT nCBIndex;
|
||||
|
||||
/* Get current system of units */
|
||||
GetLocaleInfoW(pGlobalData->lcid,
|
||||
LOCALE_IMEASURE,
|
||||
szUnitsSys,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
|
||||
CB_RESETCONTENT,
|
||||
|
@ -512,7 +410,7 @@ InitUnitsSysCB(HWND hwndDlg,
|
|||
/* Set current item to value from registry */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(szUnitsSys),
|
||||
(WPARAM)pGlobalData->nNumMeasure,
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
|
@ -524,7 +422,7 @@ UpdateNumSamples(HWND hwndDlg,
|
|||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Get positive number format sample */
|
||||
GetNumberFormatW(pGlobalData->lcid,
|
||||
GetNumberFormatW(pGlobalData->UserLCID,
|
||||
0,
|
||||
SAMPLE_NUMBER,
|
||||
NULL,
|
||||
|
@ -537,7 +435,7 @@ UpdateNumSamples(HWND hwndDlg,
|
|||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Get positive number format sample */
|
||||
GetNumberFormatW(pGlobalData->lcid,
|
||||
GetNumberFormatW(pGlobalData->UserLCID,
|
||||
0,
|
||||
SAMPLE_NEG_NUMBER,
|
||||
NULL,
|
||||
|
@ -555,16 +453,11 @@ static BOOL
|
|||
SetNumDecimalSep(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szDecimalSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted decimal separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szDecimalSep);
|
||||
|
||||
/* Save decimal separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SDECIMAL, szDecimalSep);
|
||||
(WPARAM)MAX_NUMDECIMALSEP,
|
||||
(LPARAM)pGlobalData->szNumDecimalSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -574,7 +467,6 @@ static BOOL
|
|||
SetFracSymNum(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of fractional symbols */
|
||||
|
@ -582,12 +474,10 @@ SetFracSymNum(HWND hwndDlg,
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to wide char */
|
||||
_itow(nCurrSel, szFracSymNum, DECIMAL_RADIX);
|
||||
|
||||
/* Save number of fractional symbols */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_IDIGITS, szFracSymNum);
|
||||
pGlobalData->nNumDigits = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -597,35 +487,31 @@ static BOOL
|
|||
SetNumFieldSep(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted field separator */
|
||||
/* Get thousand separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szFieldSep);
|
||||
|
||||
/* Save field separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_STHOUSAND, szFieldSep);
|
||||
(WPARAM)MAX_NUMTHOUSANDSEP,
|
||||
(LPARAM)pGlobalData->szNumThousandSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set number of digits in field */
|
||||
/* Set number of digits in field */
|
||||
static BOOL
|
||||
SetFieldDigNum(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of digidts in field */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szFieldDigNum);
|
||||
/* Get setted negative sum format */
|
||||
nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Save number of digits in field */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SGROUPING, szFieldDigNum);
|
||||
pGlobalData->nNumGrouping = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -635,16 +521,11 @@ static BOOL
|
|||
SetNumNegSign(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted negative sign */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szNegSign);
|
||||
|
||||
/* Save negative sign */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SNEGATIVESIGN, szNegSign);
|
||||
(WPARAM)MAX_NUMNEGATIVESIGN,
|
||||
(LPARAM)pGlobalData->szNumNegativeSign);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -654,7 +535,6 @@ static BOOL
|
|||
SetNegSumFmt(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szNegSumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted negative sum format */
|
||||
|
@ -662,12 +542,10 @@ SetNegSumFmt(HWND hwndDlg,
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nCurrSel, szNegSumFmt,DECIMAL_RADIX);
|
||||
|
||||
/* Save negative sum format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_INEGNUMBER, szNegSumFmt);
|
||||
pGlobalData->nNumNegFormat = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -677,7 +555,6 @@ static BOOL
|
|||
SetNumLeadZero(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szLeadZero[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted leading zero format */
|
||||
|
@ -685,12 +562,10 @@ SetNumLeadZero(HWND hwndDlg,
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to wide char */
|
||||
_itow(nCurrSel, szLeadZero, DECIMAL_RADIX);
|
||||
|
||||
/* Save leading zero format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_ILZERO, szLeadZero);
|
||||
pGlobalData->nNumLeadingZero = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -700,16 +575,11 @@ static BOOL
|
|||
SetNumListSep(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted list separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szListSep);
|
||||
|
||||
/* Save list separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_SLIST, szListSep);
|
||||
(WPARAM)MAX_NUMLISTSEP,
|
||||
(LPARAM)pGlobalData->szNumListSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -719,7 +589,6 @@ static BOOL
|
|||
SetNumUnitsSys(HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted units system */
|
||||
|
@ -727,12 +596,10 @@ SetNumUnitsSys(HWND hwndDlg,
|
|||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
if (nCurrSel == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nCurrSel, szUnitsSys, DECIMAL_RADIX);
|
||||
|
||||
/* Save units system */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_IMEASURE, szUnitsSys);
|
||||
pGlobalData->nNumMeasure = nCurrSel;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -817,6 +684,8 @@ NumbersPageProc(HWND hwndDlg,
|
|||
if (!SetNumUnitsSys(hwndDlg, pGlobalData))
|
||||
break;
|
||||
|
||||
pGlobalData->fUserLocaleChanged = TRUE;
|
||||
|
||||
UpdateNumSamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -159,7 +159,7 @@ SortPageProc(HWND hwndDlg,
|
|||
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||
|
||||
CreateSortList(GetDlgItem(hwndDlg, IDC_SORTLIST_COMBO), pGlobalData->lcid);
|
||||
CreateSortList(GetDlgItem(hwndDlg, IDC_SORTLIST_COMBO), pGlobalData->UserLCID);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -168,28 +168,6 @@ SortPageProc(HWND hwndDlg,
|
|||
case IDC_SORTLIST_COMBO:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
LCID NewLcid;
|
||||
INT iCurSel;
|
||||
|
||||
iCurSel = SendDlgItemMessage(hwndDlg,
|
||||
IDC_SORTLIST_COMBO,
|
||||
CB_GETCURSEL,
|
||||
0,
|
||||
0);
|
||||
if (iCurSel == CB_ERR)
|
||||
break;
|
||||
|
||||
NewLcid = SendDlgItemMessage(hwndDlg,
|
||||
IDC_SORTLIST_COMBO,
|
||||
CB_GETITEMDATA,
|
||||
iCurSel,
|
||||
0);
|
||||
if (NewLcid == (LCID)CB_ERR)
|
||||
break;
|
||||
|
||||
/* Save the new LCID */
|
||||
pGlobalData->lcid = NewLcid;
|
||||
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
|
@ -199,7 +177,28 @@ SortPageProc(HWND hwndDlg,
|
|||
case WM_NOTIFY:
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
/* FIXME: Set locale ID: pGlobalData->lcid */
|
||||
LCID NewLcid;
|
||||
INT iCurSel;
|
||||
|
||||
iCurSel = SendDlgItemMessage(hwndDlg,
|
||||
IDC_SORTLIST_COMBO,
|
||||
CB_GETCURSEL,
|
||||
0,
|
||||
0);
|
||||
if (iCurSel == CB_ERR)
|
||||
break;
|
||||
|
||||
NewLcid = SendDlgItemMessage(hwndDlg,
|
||||
IDC_SORTLIST_COMBO,
|
||||
CB_GETITEMDATA,
|
||||
iCurSel,
|
||||
0);
|
||||
if (NewLcid == (LCID)CB_ERR)
|
||||
break;
|
||||
|
||||
/* Save the new LCID */
|
||||
pGlobalData->UserLCID = NewLcid;
|
||||
pGlobalData->fUserLocaleChanged = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ TimeFormatEnumProc(PWSTR lpTimeFormatString)
|
|||
}
|
||||
|
||||
static VOID
|
||||
UpdateTimeSample(HWND hWnd, LCID lcid)
|
||||
UpdateTimeSample(HWND hWnd, PGLOBALDATA pGlobalData)
|
||||
{
|
||||
WCHAR szBuffer[80];
|
||||
|
||||
GetTimeFormatW(lcid, 0, NULL, NULL, szBuffer, 80);
|
||||
GetTimeFormatW(pGlobalData->UserLCID, 0, NULL, pGlobalData->szTimeFormat, szBuffer, 80);
|
||||
SendDlgItemMessageW(hWnd, IDC_TIMESAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,111 @@ GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, WCHAR *Buffer, UINT uSize)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
InitTimeFormatCB(
|
||||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
/* Get the time format */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_LIMITTEXT, MAX_TIMEFORMAT, 0);
|
||||
|
||||
/* Add available time formats to the list */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_TIMEFORMAT);
|
||||
EnumTimeFormatsW(TimeFormatEnumProc, pGlobalData->UserLCID, 0);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)pGlobalData->szTimeFormat);
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
InitTimeSeparatorCB(
|
||||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_LIMITTEXT, MAX_TIMESEPARATOR, 0);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szTimeSep);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
InitAmSymbol(
|
||||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
int nLen;
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEAMSYMBOL, 0);
|
||||
|
||||
nLen = wcslen(pGlobalData->szTimeAM);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szTimeAM);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
InitPmSymbol(
|
||||
HWND hwndDlg,
|
||||
PGLOBALDATA pGlobalData)
|
||||
{
|
||||
int nLen;
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEPMSYMBOL, 0);
|
||||
|
||||
nLen = wcslen(pGlobalData->szTimeAM);
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szTimePM);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
TimePageProc(HWND hwndDlg,
|
||||
|
@ -92,84 +197,24 @@ TimePageProc(HWND hwndDlg,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
WCHAR Buffer[80];
|
||||
int nLen;
|
||||
|
||||
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(hwndDlg, pGlobalData->lcid);
|
||||
|
||||
/* Get the time format */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_LIMITTEXT, MAX_TIMEFORMAT, 0);
|
||||
|
||||
/* Add available time formats to the list */
|
||||
hwndEnum = GetDlgItem(hwndDlg, IDC_TIMEFORMAT);
|
||||
EnumTimeFormatsW(TimeFormatEnumProc, pGlobalData->lcid, 0);
|
||||
|
||||
GetLocaleInfoW(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEFORMAT,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)Buffer);
|
||||
InitTimeFormatCB(hwndDlg, pGlobalData);
|
||||
|
||||
/* Get the time separator */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_LIMITTEXT, MAX_TIMESEPARATOR, 0);
|
||||
GetLocaleInfoW(pGlobalData->lcid, LOCALE_STIME, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMESEPARATOR,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
InitTimeSeparatorCB(hwndDlg, pGlobalData);
|
||||
|
||||
/* Get the AM symbol */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEAMSYMBOL, 0);
|
||||
nLen = GetLocaleInfoW(pGlobalData->lcid, LOCALE_S1159, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
InitAmSymbol(hwndDlg, pGlobalData);
|
||||
|
||||
/* Get the PM symbol */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_LIMITTEXT, MAX_TIMEPMSYMBOL, 0);
|
||||
nLen = GetLocaleInfoW(pGlobalData->lcid, LOCALE_S2359, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)Buffer);
|
||||
if (nLen != 0)
|
||||
{
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)L"");
|
||||
}
|
||||
SendDlgItemMessageW(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
CB_SETCURSEL,
|
||||
0, /* Index */
|
||||
0);
|
||||
}
|
||||
break;
|
||||
InitPmSymbol(hwndDlg, pGlobalData);
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(hwndDlg, pGlobalData);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
|
@ -183,47 +228,39 @@ TimePageProc(HWND hwndDlg,
|
|||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
WCHAR Buffer[80];
|
||||
|
||||
/* Get selected/typed time format text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set time format */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_STIMEFORMAT, Buffer);
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT,
|
||||
pGlobalData->szTimeFormat,
|
||||
MAX_TIMEFORMAT);
|
||||
|
||||
/* Get selected/typed time separator text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set time separator */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_STIME, Buffer);
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR,
|
||||
pGlobalData->szTimeSep,
|
||||
MAX_TIMESEPARATOR);
|
||||
|
||||
/* Get selected/typed AM symbol text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
|
||||
/* Set the AM symbol */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_S1159, Buffer);
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL,
|
||||
pGlobalData->szTimeAM,
|
||||
MAX_TIMEAMSYMBOL);
|
||||
|
||||
/* Get selected/typed PM symbol text */
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, Buffer, sizeof(Buffer)/sizeof(WCHAR));
|
||||
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL,
|
||||
pGlobalData->szTimePM,
|
||||
MAX_TIMEPMSYMBOL);
|
||||
|
||||
/* Set the PM symbol */
|
||||
SetLocaleInfoW(pGlobalData->lcid, LOCALE_S2359, Buffer);
|
||||
pGlobalData->fUserLocaleChanged = TRUE;
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(hwndDlg, pGlobalData->lcid);
|
||||
UpdateTimeSample(hwndDlg, pGlobalData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue