Changed locale options doesn't reload correctly before next reboot.
- Added SetNumberSetting, SetCurrencySetting, SetDateSetting and SetTimeSetting functions to get and check values.
- Don't directly change pGlobalData.
- Post WM_WININICHANGE after all changes have been applied.
Based on a patch by Katayama Hirofumi MZ.
CORE-10170

svn path=/trunk/; revision=74487
This commit is contained in:
Eric Kohl 2017-05-06 13:43:03 +00:00
parent 80aa7fd7f9
commit 3ac350cfe0
5 changed files with 230 additions and 168 deletions

View file

@ -20,7 +20,8 @@
* PROJECT: ReactOS International Control Panel
* FILE: dll/cpl/intl/currency.c
* PURPOSE: Currency property page
* PROGRAMMER: Eric Kohl
* PROGRAMMERS: Eric Kohl
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include "intl.h"
@ -262,7 +263,7 @@ InitDigitGroupCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
/* Set number of digits in field */
static BOOL
SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetCurrencyDigNum(HWND hwndDlg, PINT pnCurrGrouping)
{
INT nCurrSel;
@ -271,30 +272,30 @@ SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
CB_GETCURSEL,
(WPARAM)0,
(LPARAM)0);
if (nCurrSel == CB_ERR)
return FALSE;
/* Save number of digits in field */
if (nCurrSel != CB_ERR)
pGlobalData->nCurrGrouping = nCurrSel;
*pnCurrGrouping = nCurrSel;
return TRUE;
}
/* Set currency field separator */
static BOOL
SetCurrencyFieldSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetCurrencyFieldSep(HWND hwndDlg, PWSTR pszCurrThousandSep)
{
/* Get setted currency field separator */
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)pGlobalData->szCurrThousandSep);
(WPARAM)MAX_CURRTHOUSANDSEP,
(LPARAM)pszCurrThousandSep);
return TRUE;
}
/* Set number of fractional symbols */
static BOOL
SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetCurrencyFracSymNum(HWND hwndDlg, PINT pnCurrDigits)
{
INT nCurrSel;
@ -306,27 +307,27 @@ SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData)
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nCurrDigits = nCurrSel;
*pnCurrDigits = nCurrSel;
return TRUE;
}
/* Set currency separator */
static BOOL
SetCurrencySep(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetCurrencySep(HWND hwndDlg, PWSTR pszCurrDecimalSep)
{
/* Get setted currency decimal separator */
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)pGlobalData->szCurrDecimalSep);
(WPARAM)MAX_CURRDECIMALSEP,
(LPARAM)pszCurrDecimalSep);
return TRUE;
}
/* Set negative currency sum format */
static BOOL
SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetNegCurrencySumFmt(HWND hwndDlg, PINT pnCurrNegFormat)
{
INT nCurrSel;
@ -338,14 +339,14 @@ SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nCurrNegFormat = nCurrSel;
*pnCurrNegFormat = nCurrSel;
return TRUE;
}
/* Set positive currency sum format */
static BOOL
SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetPosCurrencySumFmt(HWND hwndDlg, PINT pnCurrPosFormat)
{
INT nCurrSel;
@ -357,20 +358,55 @@ SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData)
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nCurrPosFormat = nCurrSel;
*pnCurrPosFormat = nCurrSel;
return TRUE;
}
/* Set currency symbol */
static BOOL
SetCurrencySymbol(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetCurrencySymbol(HWND hwndDlg, PWSTR pszCurrSymbol)
{
/* Get setted currency unit */
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)(PCWSTR)pGlobalData->szCurrSymbol);
(WPARAM)MAX_CURRSYMBOL,
(LPARAM)pszCurrSymbol);
return TRUE;
}
static BOOL
SetCurrencySetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
{
WCHAR szCurrSymbol[MAX_CURRSYMBOL];
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP];
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP];
INT nCurrGrouping;
INT nCurrPosFormat;
INT nCurrNegFormat;
INT nCurrDigits;
if (!SetCurrencySymbol(hwndDlg, szCurrSymbol) ||
!SetCurrencyDigNum(hwndDlg, &nCurrGrouping) ||
!SetPosCurrencySumFmt(hwndDlg, &nCurrPosFormat) ||
!SetNegCurrencySumFmt(hwndDlg, &nCurrNegFormat) ||
!SetCurrencySep(hwndDlg, szCurrDecimalSep) ||
!SetCurrencyFracSymNum(hwndDlg, &nCurrDigits) ||
!SetCurrencyFieldSep(hwndDlg, szCurrThousandSep))
{
return FALSE;
}
/* store to global data */
wcscpy(pGlobalData->szCurrSymbol, szCurrSymbol);
pGlobalData->nCurrGrouping = nCurrGrouping;
wcscpy(pGlobalData->szCurrDecimalSep, szCurrDecimalSep);
wcscpy(pGlobalData->szCurrThousandSep, szCurrThousandSep);
pGlobalData->nCurrPosFormat = nCurrPosFormat;
pGlobalData->nCurrNegFormat = nCurrNegFormat;
pGlobalData->nCurrDigits = nCurrDigits;
return TRUE;
}
@ -414,7 +450,7 @@ CurrencyPageProc(HWND hwndDlg,
case IDC_CURRENCYGRPNUM:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
{
/* Set "Apply" button enabled */
/* Enable the Apply button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
}
@ -423,30 +459,11 @@ CurrencyPageProc(HWND hwndDlg,
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
if (!SetCurrencySymbol(hwndDlg, pGlobalData))
break;
if (!SetCurrencyDigNum(hwndDlg, pGlobalData))
break;
if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData))
break;
if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData))
break;
if (!SetCurrencySep(hwndDlg, pGlobalData))
break;
if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData))
break;
if (!SetCurrencyFieldSep(hwndDlg, pGlobalData))
break;
pGlobalData->bUserLocaleChanged = TRUE;
UpdateExamples(hwndDlg, pGlobalData);
if (SetCurrencySetting(hwndDlg, pGlobalData))
{
pGlobalData->bUserLocaleChanged = TRUE;
UpdateExamples(hwndDlg, pGlobalData);
}
}
break;
}

View file

@ -20,7 +20,8 @@
* PROJECT: ReactOS International Control Panel
* FILE: dll/cpl/intl/date.c
* PURPOSE: Date property page
* PROGRAMMER: Eric Kohl
* PROGRAMMERS: Eric Kohl
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include "intl.h"
@ -86,9 +87,8 @@ FindDateSep(const WCHAR *szSourceStr)
/* Setted up short date separator to registry */
static BOOL
SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetShortDateSep(HWND hwndDlg, PWSTR pszShortDateSep)
{
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
INT nSepStrSize;
INT nSepCount;
@ -96,32 +96,34 @@ SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData)
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)szShortDateSep);
(LPARAM)pszShortDateSep);
/* Get separator string size */
nSepStrSize = wcslen(szShortDateSep);
nSepStrSize = wcslen(pszShortDateSep);
/* Check date components */
for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
{
if (iswalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == L'\''))
if (iswalnum(pszShortDateSep[nSepCount]) || (pszShortDateSep[nSepCount] == L'\''))
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE);
return FALSE;
}
}
/* Save date separator */
wcscpy(pGlobalData->szDateSep, szShortDateSep);
if (nSepStrSize == 0)
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE);
return FALSE;
}
return TRUE;
}
/* Setted up short date format to registry */
static BOOL
SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetShortDateFormat(HWND hwndDlg, PWSTR pszShortDateFmt)
{
WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
WCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE];
PWSTR pszResultStr;
@ -134,7 +136,7 @@ SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)szShortDateFmt);
(LPARAM)pszShortDateFmt);
/* Get separator */
SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO,
@ -143,18 +145,18 @@ SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
(LPARAM)szShortDateSep);
/* Get format-string size */
nFmtStrSize = wcslen(szShortDateFmt);
nFmtStrSize = wcslen(pszShortDateFmt);
/* Check date components */
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
{
if (szShortDateFmt[nDateCompCount] == L'\'')
if (pszShortDateFmt[nDateCompCount] == L'\'')
{
OpenApostFlg = !OpenApostFlg;
}
if (iswalnum(szShortDateFmt[nDateCompCount]) &&
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
if (iswalnum(pszShortDateFmt[nDateCompCount]) &&
!isDateCompAl(pszShortDateFmt[nDateCompCount]) &&
!OpenApostFlg)
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT);
@ -163,38 +165,34 @@ SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
}
if (OpenApostFlg)
if (OpenApostFlg || nFmtStrSize == 0)
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT);
return FALSE;
}
pszFoundSep = FindDateSep(szShortDateFmt);
pszFoundSep = FindDateSep(pszShortDateFmt);
if (pszFoundSep != NULL)
{
/* Substring replacement of separator */
wcscpy(szFoundDateSep, pszFoundSep);
pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep);
pszResultStr = ReplaceSubStr(pszShortDateFmt, szShortDateSep, szFoundDateSep);
if (pszResultStr != NULL)
{
wcscpy(szShortDateFmt, pszResultStr);
wcscpy(pszShortDateFmt, pszResultStr);
HeapFree(GetProcessHeap(), 0, pszResultStr);
}
HeapFree(GetProcessHeap(), 0, pszFoundSep);
}
/* Save short date format */
wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt);
return TRUE;
}
/* Setted up long date format to registry */
static BOOL
SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
SetLongDateFormat(HWND hwndDlg, PWSTR pszLongDateFmt)
{
WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
BOOL OpenApostFlg = FALSE;
INT nFmtStrSize;
INT nDateCompCount;
@ -203,21 +201,21 @@ SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO,
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)szLongDateFmt);
(LPARAM)pszLongDateFmt);
/* Get format string size */
nFmtStrSize = wcslen(szLongDateFmt);
nFmtStrSize = wcslen(pszLongDateFmt);
/* Check date components */
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
{
if (szLongDateFmt[nDateCompCount] == L'\'')
if (pszLongDateFmt[nDateCompCount] == L'\'')
{
OpenApostFlg = !OpenApostFlg;
}
if (iswalnum(szLongDateFmt[nDateCompCount]) &&
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
if (iswalnum(pszLongDateFmt[nDateCompCount]) &&
!isDateCompAl(pszLongDateFmt[nDateCompCount]) &&
!OpenApostFlg)
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG);
@ -226,15 +224,12 @@ SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData)
}
if (OpenApostFlg)
if (OpenApostFlg || nFmtStrSize == 0)
{
PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG);
return FALSE;
}
/* Save long date format */
wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt);
return TRUE;
}
@ -520,6 +515,28 @@ UpdateDateLocaleSamples(HWND hwndDlg,
WM_SETTEXT, 0, (LPARAM)OutBuffer);
}
static BOOL
SetDateSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
{
WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
if (!SetLongDateFormat(hwndDlg, szLongDateFmt) ||
!SetShortDateFormat(hwndDlg, szShortDateFmt) ||
!SetShortDateSep(hwndDlg, szShortDateSep))
{
return FALSE;
}
/* store to global data */
wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt);
wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt);
wcscpy(pGlobalData->szDateSep, szShortDateSep);
return TRUE;
}
/* Property page dialog callback */
INT_PTR CALLBACK
DatePageProc(HWND hwndDlg,
@ -568,7 +585,7 @@ DatePageProc(HWND hwndDlg,
case IDC_SHRTDATESEP_COMBO:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
{
/* Set "Apply" button enabled */
/* Enable the Apply button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
@ -578,20 +595,12 @@ DatePageProc(HWND hwndDlg,
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->bUserLocaleChanged = TRUE;
SetMaxDate(hwndDlg, pGlobalData->UserLCID);
InitShortDateCB(hwndDlg, pGlobalData);
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
if (SetDateSetting(hwndDlg, pGlobalData))
{
pGlobalData->bUserLocaleChanged = TRUE;
SetMaxDate(hwndDlg, pGlobalData->UserLCID);
UpdateDateLocaleSamples(hwndDlg, pGlobalData);
}
}
break;
}

View file

@ -1494,6 +1494,9 @@ GeneralPageProc(HWND hwndDlg,
}
AddNewKbLayoutsByLcid(pGlobalData->UserLCID);
/* Post WM_WININICHANGE messages to system */
PostMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L"intl");
}
break;
}

View file

@ -20,7 +20,8 @@
* PROJECT: ReactOS International Control Panel
* FILE: dll/cpl/intl/numbers.c
* PURPOSE: Numbers property page
* PROGRAMMER: Eric Kohl
* PROGRAMMERS: Eric Kohl
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include "intl.h"
@ -471,13 +472,13 @@ UpdateNumSamples(HWND hwndDlg,
/* Set num decimal separator */
static BOOL
SetNumDecimalSep(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PWSTR pszNumDecimalSep)
{
/* Get setted decimal separator */
SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
WM_GETTEXT,
(WPARAM)MAX_NUMDECIMALSEP,
(LPARAM)pGlobalData->szNumDecimalSep);
(LPARAM)pszNumDecimalSep);
return TRUE;
}
@ -485,7 +486,7 @@ SetNumDecimalSep(HWND hwndDlg,
/* Set number of fractional symbols */
static BOOL
SetFracSymNum(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PINT pnNumDigits)
{
INT nCurrSel;
@ -497,7 +498,7 @@ SetFracSymNum(HWND hwndDlg,
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nNumDigits = nCurrSel;
*pnNumDigits = nCurrSel;
return TRUE;
}
@ -505,13 +506,13 @@ SetFracSymNum(HWND hwndDlg,
/* Set field separator */
static BOOL
SetNumFieldSep(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PWSTR pszNumThousandSep)
{
/* Get thousand separator */
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
WM_GETTEXT,
(WPARAM)MAX_NUMTHOUSANDSEP,
(LPARAM)pGlobalData->szNumThousandSep);
(LPARAM)pszNumThousandSep);
return TRUE;
}
@ -519,7 +520,7 @@ SetNumFieldSep(HWND hwndDlg,
/* Set number of digits in field */
static BOOL
SetFieldDigNum(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PINT pnNumGrouping)
{
INT nCurrSel;
@ -531,7 +532,7 @@ SetFieldDigNum(HWND hwndDlg,
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nNumGrouping = nCurrSel;
*pnNumGrouping = nCurrSel;
return TRUE;
}
@ -539,13 +540,13 @@ SetFieldDigNum(HWND hwndDlg,
/* Set negative sign */
static BOOL
SetNumNegSign(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PWSTR pszNumNegativeSign)
{
/* Get setted negative sign */
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
WM_GETTEXT,
(WPARAM)MAX_NUMNEGATIVESIGN,
(LPARAM)pGlobalData->szNumNegativeSign);
(LPARAM)pszNumNegativeSign);
return TRUE;
}
@ -553,7 +554,7 @@ SetNumNegSign(HWND hwndDlg,
/* Set negative sum format */
static BOOL
SetNegSumFmt(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PINT pnNumNegFormat)
{
INT nCurrSel;
@ -565,7 +566,7 @@ SetNegSumFmt(HWND hwndDlg,
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nNumNegFormat = nCurrSel;
*pnNumNegFormat = nCurrSel;
return TRUE;
}
@ -573,7 +574,7 @@ SetNegSumFmt(HWND hwndDlg,
/* Set leading zero */
static BOOL
SetNumLeadZero(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PINT pnNumLeadingZero)
{
INT nCurrSel;
@ -585,7 +586,7 @@ SetNumLeadZero(HWND hwndDlg,
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nNumLeadingZero = nCurrSel;
*pnNumLeadingZero = nCurrSel;
return TRUE;
}
@ -593,13 +594,13 @@ SetNumLeadZero(HWND hwndDlg,
/* Set elements list separator */
static BOOL
SetNumListSep(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PWSTR pszNumListSep)
{
/* Get setted list separator */
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
WM_GETTEXT,
(WPARAM)MAX_NUMLISTSEP,
(LPARAM)pGlobalData->szNumListSep);
(LPARAM)pszNumListSep);
return TRUE;
}
@ -607,7 +608,7 @@ SetNumListSep(HWND hwndDlg,
/* Set units system */
static BOOL
SetNumUnitsSys(HWND hwndDlg,
PGLOBALDATA pGlobalData)
PINT pnNumMeasure)
{
INT nCurrSel;
@ -619,7 +620,49 @@ SetNumUnitsSys(HWND hwndDlg,
if (nCurrSel == CB_ERR)
return FALSE;
pGlobalData->nNumMeasure = nCurrSel;
*pnNumMeasure = nCurrSel;
return TRUE;
}
static BOOL
SetNumberSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
{
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP];
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP];
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN];
WCHAR szNumListSep[MAX_NUMLISTSEP];
WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS];
int nNumGrouping;
int nNumDigits;
int nNumNegFormat;
int nNumLeadingZero;
int nNumMeasure;
if (!SetNumDecimalSep(hwndDlg, szNumDecimalSep) ||
!SetNumFieldSep(hwndDlg, szNumThousandSep) ||
!SetNumNegSign(hwndDlg, szNumNegativeSign) ||
!SetNumListSep(hwndDlg, szNumListSep) ||
!SetFieldDigNum(hwndDlg, &nNumGrouping) ||
!SetFracSymNum(hwndDlg, &nNumDigits) ||
!SetNegSumFmt(hwndDlg, &nNumNegFormat) ||
!SetNumLeadZero(hwndDlg, &nNumLeadingZero) ||
!SetNumUnitsSys(hwndDlg, &nNumMeasure))
{
return FALSE;
}
/* store to global data */
wcscpy(pGlobalData->szNumDecimalSep, szNumDecimalSep);
wcscpy(pGlobalData->szNumThousandSep, szNumThousandSep);
wcscpy(pGlobalData->szNumNegativeSign, szNumNegativeSign);
wcscpy(pGlobalData->szNumListSep, szNumListSep);
wcscpy(pGlobalData->szNumNativeDigits, szNumNativeDigits);
pGlobalData->nNumGrouping = nNumGrouping;
pGlobalData->nNumDigits = nNumDigits;
pGlobalData->nNumNegFormat = nNumNegFormat;
pGlobalData->nNumLeadingZero = nNumLeadingZero;
pGlobalData->nNumMeasure = nNumMeasure;
return TRUE;
}
@ -667,7 +710,7 @@ NumbersPageProc(HWND hwndDlg,
case IDC_NUMBERSMEASSYS:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
{
/* Set "Apply" button enabled */
/* Enable the Apply button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
}
@ -677,36 +720,11 @@ NumbersPageProc(HWND hwndDlg,
/* If push apply button */
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
if (!SetNumDecimalSep(hwndDlg, pGlobalData))
break;
if (!SetFracSymNum(hwndDlg, pGlobalData))
break;
if (!SetNumFieldSep(hwndDlg, pGlobalData))
break;
if (!SetFieldDigNum(hwndDlg, pGlobalData))
break;
if (!SetNumNegSign(hwndDlg, pGlobalData))
break;
if (!SetNegSumFmt(hwndDlg, pGlobalData))
break;
if (!SetNumLeadZero(hwndDlg, pGlobalData))
break;
if (!SetNumListSep(hwndDlg, pGlobalData))
break;
if (!SetNumUnitsSys(hwndDlg, pGlobalData))
break;
pGlobalData->bUserLocaleChanged = TRUE;
UpdateNumSamples(hwndDlg, pGlobalData);
if (SetNumberSetting(hwndDlg, pGlobalData))
{
pGlobalData->bUserLocaleChanged = TRUE;
UpdateNumSamples(hwndDlg, pGlobalData);
}
}
break;
}

View file

@ -20,7 +20,8 @@
* PROJECT: ReactOS International Control Panel
* FILE: dll/cpl/intl/time.c
* PURPOSE: Time property page
* PROGRAMMER: Eric Kohl
* PROGRAMMERS: Eric Kohl
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include "intl.h"
@ -194,6 +195,38 @@ InitPmSymbol(
0);
}
static BOOL
SetTimeSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
{
WCHAR szTimeFormat[MAX_TIMEFORMAT];
WCHAR szTimeSep[MAX_TIMEFORMAT];
WCHAR szTimeAM[MAX_TIMEFORMAT];
WCHAR szTimePM[MAX_TIMEFORMAT];
/* Get selected/typed time format text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, szTimeFormat, MAX_TIMEFORMAT);
/* Get selected/typed time separator text */
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, szTimeSep, MAX_TIMESEPARATOR);
/* Get selected/typed AM symbol text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, szTimeAM, MAX_TIMEAMSYMBOL);
/* Get selected/typed PM symbol text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, szTimePM, MAX_TIMEPMSYMBOL);
/* verify values */
if (szTimeFormat[0] == L'\0' || szTimeSep[0] == L'\0')
return FALSE;
/* store to global data */
wcscpy(pGlobalData->szTimeFormat, szTimeFormat);
wcscpy(pGlobalData->szTimeSep, szTimeSep);
wcscpy(pGlobalData->szTimeAM, szTimeAM);
wcscpy(pGlobalData->szTimePM, szTimePM);
return TRUE;
}
/* Property page dialog callback */
INT_PTR CALLBACK
@ -238,6 +271,7 @@ TimePageProc(HWND hwndDlg,
if (HIWORD(wParam) == CBN_SELCHANGE ||
HIWORD(wParam) == CBN_EDITCHANGE)
{
/* Enable the Apply button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
@ -247,30 +281,11 @@ TimePageProc(HWND hwndDlg,
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
/* Get selected/typed time format text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT,
pGlobalData->szTimeFormat,
MAX_TIMEFORMAT);
/* Get selected/typed time separator text */
GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR,
pGlobalData->szTimeSep,
MAX_TIMESEPARATOR);
/* Get selected/typed AM symbol text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL,
pGlobalData->szTimeAM,
MAX_TIMEAMSYMBOL);
/* Get selected/typed PM symbol text */
GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL,
pGlobalData->szTimePM,
MAX_TIMEPMSYMBOL);
pGlobalData->bUserLocaleChanged = TRUE;
/* Update the time format sample */
UpdateTimeSample(hwndDlg, pGlobalData);
if (SetTimeSetting(hwndDlg, pGlobalData))
{
pGlobalData->bUserLocaleChanged = TRUE;
UpdateTimeSample(hwndDlg, pGlobalData);
}
}
break;
}