mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
- Replace the hardcoded calls to Unicode-Functions. Use the module configuration to build a Unicode version instead.
- Cleaned up a lot of coding-style and indentation issues. - No code changes. svn path=/trunk/; revision=28876
This commit is contained in:
parent
9674b37837
commit
63d106c29f
13 changed files with 1168 additions and 1184 deletions
|
@ -8,16 +8,17 @@
|
|||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
AdvancedPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define POSITIVE_EXAMPLE L"123456789.00"
|
||||
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
||||
#define POSITIVE_EXAMPLE _T("123456789.00")
|
||||
#define NEGATIVE_EXAMPLE _T("-123456789.00")
|
||||
#define MAX_FIELD_DIG_SAMPLES 3
|
||||
|
||||
|
||||
|
@ -90,9 +90,9 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
|||
}
|
||||
|
||||
/* Get decimal separator */
|
||||
ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
pGlobalData->szDecimalSep, 4);
|
||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
pGlobalData->szDecimalSep, 4);
|
||||
|
||||
/* Get group separator */
|
||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
|
@ -103,7 +103,6 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
|||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONGROUPING,
|
||||
pGlobalData->szGrouping, 10);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,20 +120,20 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
cyFmt.PositiveOrder = pGlobalData->PositiveOrder;
|
||||
cyFmt.NegativeOrder = pGlobalData->NegativeOrder;
|
||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
||||
|
||||
|
||||
/* positive example */
|
||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||
POSITIVE_EXAMPLE,
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
/* negative example */
|
||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||
NEGATIVE_EXAMPLE,
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,12 +147,12 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
GetInitialCurrencyValues(pGlobalData);
|
||||
|
||||
/* Set currency symbol */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szCurrencySymbol);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* index */
|
||||
0);
|
||||
|
@ -175,13 +174,13 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
_T("1.1"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_SETCURSEL,
|
||||
pGlobalData->PositiveOrder,
|
||||
0);
|
||||
|
@ -195,53 +194,52 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
_T("-1.1"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_SETCURSEL,
|
||||
pGlobalData->NegativeOrder, /* index */
|
||||
0);
|
||||
|
||||
/* decimal separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szDecimalSep);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
CB_SETCURSEL,
|
||||
0, /* index */
|
||||
0);
|
||||
|
||||
|
||||
/* */
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
szBuffer[0] = _T('0') + i;
|
||||
szBuffer[1] = 0;
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)szBuffer);
|
||||
}
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_SETCURSEL,
|
||||
pGlobalData->NumDigits, /* index */
|
||||
0);
|
||||
|
||||
|
||||
/* digit group separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)pGlobalData->szThousandSep);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
CB_SETCURSEL,
|
||||
0, /* index */
|
||||
0);
|
||||
|
@ -257,7 +255,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
@ -266,7 +264,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
@ -275,7 +273,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||
_T("123456789"),
|
||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_INSERTSTRING,
|
||||
-1,
|
||||
(LPARAM)szBuffer);
|
||||
|
@ -290,7 +288,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
i = 1;
|
||||
}
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_SETCURSEL,
|
||||
i, /* index */
|
||||
0);
|
||||
|
@ -300,149 +298,148 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
|||
}
|
||||
|
||||
/* Set number of digidts in field */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetCurrencyDigNum(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
TCHAR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"0;0",
|
||||
L"3;0",
|
||||
L"3;2;0"
|
||||
_T("0;0"),
|
||||
_T("3;0"),
|
||||
_T("3;2;0")
|
||||
};
|
||||
|
||||
int nCurrSel;
|
||||
|
||||
/* Get setted number of digidts in field */
|
||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Save number of digidts in field */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
||||
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency field separator */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetCurrencyFieldSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency field separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszCurrencyFieldSep);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencyFieldSep);
|
||||
|
||||
/* Save currency field separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set number of fractional symbols */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetCurrencyFracSymNum(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted number of fractional symbols */
|
||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX);
|
||||
_itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||
|
||||
/* Save number of fractional symbols */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency separator */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetCurrencySep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency decimal separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszCurrencySep);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szCurrencySep);
|
||||
|
||||
/* TODO: Add check for correctly input */
|
||||
|
||||
/* Save currency separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set negative currency sum format */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetNegCurrencySumFmt(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX);
|
||||
_itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set positive currency sum format */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetPosCurrencySumFmt(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted currency unit */
|
||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX);
|
||||
_itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||
|
||||
/* Save currency sum format */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set currency unit */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetCurrencyUnit(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted currency unit */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)szCurrencyUnit);
|
||||
|
||||
/* Save currency unit */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -461,48 +458,61 @@ CurrencyPageProc(HWND hwndDlg,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||
OnInitDialog(hwndDlg, pGlobalData);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CURRENCYSYMBOL:
|
||||
case IDC_CURRENCYPOSVALUE:
|
||||
case IDC_CURRENCYNEGVALUE:
|
||||
case IDC_CURRENCYDECSEP:
|
||||
case IDC_CURRENCYDECNUM:
|
||||
case IDC_CURRENCYGRPSEP:
|
||||
case IDC_CURRENCYGRPNUM:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
/* If push apply button */
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
if(!SetCurrencyDigNum(hwndDlg)) break;
|
||||
if(!SetCurrencyUnit(hwndDlg)) break;
|
||||
if(!SetPosCurrencySumFmt(hwndDlg)) break;
|
||||
if(!SetNegCurrencySumFmt(hwndDlg)) break;
|
||||
if(!SetCurrencySep(hwndDlg)) break;
|
||||
if(!SetCurrencyFracSymNum(hwndDlg)) break;
|
||||
if(!SetCurrencyFieldSep(hwndDlg)) break;
|
||||
UpdateExamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CURRENCYSYMBOL:
|
||||
case IDC_CURRENCYPOSVALUE:
|
||||
case IDC_CURRENCYNEGVALUE:
|
||||
case IDC_CURRENCYDECSEP:
|
||||
case IDC_CURRENCYDECNUM:
|
||||
case IDC_CURRENCYGRPSEP:
|
||||
case IDC_CURRENCYGRPNUM:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
/* If push apply button */
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
if (!SetCurrencyDigNum(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyUnit(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetPosCurrencySumFmt(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetNegCurrencySumFmt(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetCurrencySep(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFracSymNum(hwndDlg))
|
||||
break;
|
||||
|
||||
if (!SetCurrencyFieldSep(hwndDlg))
|
||||
break;
|
||||
|
||||
UpdateExamples(hwndDlg, pGlobalData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
||||
break;
|
||||
|
|
|
@ -24,23 +24,21 @@
|
|||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
#define WINVER 0x0500
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
const INT YEAR_STR_MAX_SIZE=4;
|
||||
const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
||||
#define YEAR_STR_MAX_SIZE 4
|
||||
#define MAX_SHORT_FMT_SAMPLES 5
|
||||
#define MAX_LONG_FMT_SAMPLES 2
|
||||
#define MAX_SHRT_DATE_SEPARATORS 3
|
||||
#define STD_DATE_SEP L"."
|
||||
#define STD_DATE_SEP _T(".")
|
||||
#define YEAR_DIFF (99)
|
||||
#define MAX_YEAR (9999)
|
||||
|
||||
|
@ -48,231 +46,231 @@ const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
|||
|
||||
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
||||
BOOL
|
||||
isDateCompAl(WCHAR walpha)
|
||||
isDateCompAl(TCHAR alpha)
|
||||
{
|
||||
|
||||
if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE;
|
||||
else return FALSE;
|
||||
if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' ')))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Find first date separator in string */
|
||||
WCHAR*
|
||||
FindDateSep(const WCHAR *wszSourceStr)
|
||||
LPTSTR
|
||||
FindDateSep(const TCHAR *szSourceStr)
|
||||
{
|
||||
int nDateCompCount=0;
|
||||
int nDateSepCount=0;
|
||||
LPTSTR pszFoundSep;
|
||||
INT nDateCompCount=0;
|
||||
INT nDateSepCount=0;
|
||||
|
||||
WCHAR* wszFindedSep;
|
||||
wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||
pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
|
||||
wcscpy(wszFindedSep,STD_DATE_SEP);
|
||||
_tcscpy(pszFoundSep,STD_DATE_SEP);
|
||||
|
||||
while(nDateCompCount<wcslen(wszSourceStr))
|
||||
while (nDateCompCount < _tcslen(szSourceStr))
|
||||
{
|
||||
if(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||
if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||
{
|
||||
while(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
|
||||
{
|
||||
wszFindedSep[nDateSepCount++]=wszSourceStr[nDateCompCount];
|
||||
pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
|
||||
nDateCompCount++;
|
||||
}
|
||||
wszFindedSep[nDateSepCount]='\0';
|
||||
return wszFindedSep;
|
||||
|
||||
pszFoundSep[nDateSepCount] = _T('\0');
|
||||
return pszFoundSep;
|
||||
}
|
||||
|
||||
nDateCompCount++;
|
||||
}
|
||||
|
||||
return wszFindedSep;
|
||||
return pszFoundSep;
|
||||
}
|
||||
|
||||
/* Replace given template in source string with string to replace and return recieved string */
|
||||
|
||||
|
||||
/* Setted up short date separator to registry */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetShortDateSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
int nSepStrSize;
|
||||
int nSepCount;
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nSepStrSize;
|
||||
INT nSepCount;
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted separator string size */
|
||||
nSepStrSize = wcslen(wszShortDateSep);
|
||||
nSepStrSize = _tcslen(szShortDateSep);
|
||||
|
||||
/* Check date components */
|
||||
for(nSepCount=0;nSepCount<nSepStrSize;nSepCount++)
|
||||
for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
|
||||
{
|
||||
if(iswalnum(wszShortDateSep[nSepCount]) || (wszShortDateSep[nSepCount]=='\''))
|
||||
if (_istalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == _T('\'')))
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered short date separator contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
MessageBox(NULL,
|
||||
_T("Entered short date separator contain incorrect symbol"),
|
||||
_T("Error"), MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Save date separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDATE, wszShortDateSep);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, szShortDateSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up short date format to registry */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetShortDateFormat(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
WCHAR* pwszResultStr;
|
||||
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
LPTSTR pszResultStr;
|
||||
BOOL OpenApostFlg = FALSE;
|
||||
int nFmtStrSize;
|
||||
int nDateCompCount;
|
||||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateFmt);
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* Get setted format-string size */
|
||||
nFmtStrSize = wcslen(wszShortDateFmt);
|
||||
nFmtStrSize = _tcslen(szShortDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
||||
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||
{
|
||||
if(wszShortDateFmt[nDateCompCount]==L'\'')
|
||||
if (szShortDateFmt[nDateCompCount] == _T('\''))
|
||||
{
|
||||
OpenApostFlg=!OpenApostFlg;
|
||||
OpenApostFlg = !OpenApostFlg;
|
||||
}
|
||||
if(iswalnum(wszShortDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(wszShortDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
|
||||
if (_istalnum(szShortDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered short date format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
MessageBox(NULL,
|
||||
_T("Entered short date format contain incorrect symbol"),
|
||||
_T("Error"), MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(OpenApostFlg)
|
||||
if (OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered short date format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
_T("Entered short date format contain incorrect symbol"),
|
||||
_T("Error"), MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* substring replacement of separator */
|
||||
wcscpy(wszFindedDateSep,FindDateSep(wszShortDateFmt));
|
||||
pwszResultStr = ReplaceSubStr(wszShortDateFmt,wszShortDateSep,wszFindedDateSep);
|
||||
wcscpy(wszShortDateFmt,pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
_tcscpy(szFindedDateSep, FindDateSep(szShortDateFmt));
|
||||
pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFindedDateSep);
|
||||
_tcscpy(szShortDateFmt, pszResultStr);
|
||||
free(pszResultStr);
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, wszShortDateFmt);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up long date format to registry */
|
||||
BOOL
|
||||
static BOOL
|
||||
SetLongDateFormat(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
BOOL OpenApostFlg = FALSE;
|
||||
int nFmtStrSize;
|
||||
int nDateCompCount;
|
||||
INT nFmtStrSize;
|
||||
INT nDateCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)szLongDateFmt);
|
||||
|
||||
/* Get setted format string size */
|
||||
nFmtStrSize = wcslen(wszLongDateFmt);
|
||||
nFmtStrSize = _tcslen(szLongDateFmt);
|
||||
|
||||
/* Check date components */
|
||||
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
||||
for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
|
||||
{
|
||||
if(wszLongDateFmt[nDateCompCount]==L'\'')
|
||||
if (szLongDateFmt[nDateCompCount] == _T('\''))
|
||||
{
|
||||
OpenApostFlg=!OpenApostFlg;
|
||||
OpenApostFlg = !OpenApostFlg;
|
||||
}
|
||||
if(iswalnum(wszLongDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(wszLongDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
|
||||
if (_istalnum(szLongDateFmt[nDateCompCount]) &&
|
||||
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered long date format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
MessageBox(NULL,
|
||||
_T("Entered long date format contain incorrect symbol"),
|
||||
_T("Error"), MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(OpenApostFlg)
|
||||
if (OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered long date format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
_T("Entered long date format contain incorrect symbol"),
|
||||
_T("Error"), MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Save short date format */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, wszLongDateFmt);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, szLongDateFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Init short date separator control box */
|
||||
VOID
|
||||
static VOID
|
||||
InitShortDateSepSamples(HWND hwndDlg)
|
||||
{
|
||||
WCHAR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS][MAX_SAMPLES_STR_SIZE]=
|
||||
LPTSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
|
||||
{
|
||||
L".",
|
||||
L"/",
|
||||
L"-"
|
||||
_T("."),
|
||||
_T("/"),
|
||||
_T("-")
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current short date separator */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SDATE,
|
||||
wszShortDateSep,
|
||||
dwValueSize);
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SDATE,
|
||||
szShortDateSep,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of separators */
|
||||
for(nCBIndex=0;nCBIndex<MAX_SHRT_DATE_SEPARATORS;nCBIndex++)
|
||||
for (nCBIndex = 0; nCBIndex < MAX_SHRT_DATE_SEPARATORS; nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
|
@ -281,22 +279,22 @@ InitShortDateSepSamples(HWND hwndDlg)
|
|||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||
(LPARAM)szShortDateSep);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_SHRT_DATE_SEPARATORS+1,
|
||||
(LPARAM)wszShortDateSep);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_SHRT_DATE_SEPARATORS+1,
|
||||
(LPARAM)szShortDateSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||
(LPARAM)szShortDateSep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,128 +302,124 @@ InitShortDateSepSamples(HWND hwndDlg)
|
|||
VOID
|
||||
InitShortDateCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
LPTSTR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES] =
|
||||
{
|
||||
L"dd.MM.yyyy",
|
||||
L"dd.MM.yy",
|
||||
L"d.M.yy",
|
||||
L"dd/MM/yy",
|
||||
L"yyyy-MM-dd"
|
||||
_T("dd.MM.yyyy"),
|
||||
_T("dd.MM.yy"),
|
||||
_T("d.M.yy"),
|
||||
_T("dd/MM/yy"),
|
||||
_T("yyyy-MM-dd")
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current short date format */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SSHORTDATE,
|
||||
wszShortDateFmt,
|
||||
dwValueSize);
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SSHORTDATE,
|
||||
szShortDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of date formats */
|
||||
for(nCBIndex=0;nCBIndex<MAX_SHORT_FMT_SAMPLES;nCBIndex++)
|
||||
for (nCBIndex = 0; nCBIndex < MAX_SHORT_FMT_SAMPLES; nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||
(LPARAM)szShortDateFmt);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_SHORT_FMT_SAMPLES+1,
|
||||
(LPARAM)wszShortDateFmt);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_SHORT_FMT_SAMPLES+1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szShortDateFmt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Init long date control box */
|
||||
VOID
|
||||
static VOID
|
||||
InitLongDateCB(HWND hwndDlg)
|
||||
{
|
||||
/* Where this data stored? */
|
||||
WCHAR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
LPTSTR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES] =
|
||||
{
|
||||
L"d MMMM yyyy 'y.'",
|
||||
L"dd MMMM yyyy 'y.'"
|
||||
_T("d MMMM yyyy 'y.'"),
|
||||
_T("dd MMMM yyyy 'y.'")
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCBIndex;
|
||||
INT nRetCode;
|
||||
|
||||
/* Get current long date format */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SLONGDATE,
|
||||
wszLongDateFmt,
|
||||
dwValueSize);
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SLONGDATE,
|
||||
szLongDateFmt,
|
||||
MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of date formats */
|
||||
for(nCBIndex=0;nCBIndex<MAX_LONG_FMT_SAMPLES;nCBIndex++)
|
||||
for (nCBIndex = 0; nCBIndex < MAX_LONG_FMT_SAMPLES; nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||
(LPARAM)szLongDateFmt);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
if (nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_LONG_FMT_SAMPLES+1,
|
||||
(LPARAM)wszLongDateFmt);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_LONG_FMT_SAMPLES+1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)szLongDateFmt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up max date value to registry */
|
||||
VOID
|
||||
static VOID
|
||||
SetMaxDate(HWND hwndDlg)
|
||||
{
|
||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
WCHAR wszMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||
TCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
INT nSpinVal;
|
||||
|
||||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Get spin value */
|
||||
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
|
@ -433,131 +427,131 @@ SetMaxDate(HWND hwndDlg)
|
|||
0));
|
||||
|
||||
/* convert to wide char */
|
||||
_itow(nSpinVal,wszMaxDateVal,DECIMAL_RADIX);
|
||||
_itot(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
|
||||
|
||||
/* Save max date value */
|
||||
SetCalendarInfoW(LOCALE_USER_DEFAULT,
|
||||
CAL_GREGORIAN,
|
||||
48 , /* CAL_ITWODIGITYEARMAX */
|
||||
(LPCWSTR)&wszMaxDateVal);
|
||||
SetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||
CAL_GREGORIAN,
|
||||
48 , /* CAL_ITWODIGITYEARMAX */
|
||||
(LPCTSTR)&szMaxDateVal);
|
||||
}
|
||||
|
||||
/* Get max date value from registry set */
|
||||
INT
|
||||
GetMaxDate()
|
||||
static INT
|
||||
GetMaxDate(VOID)
|
||||
{
|
||||
int nMaxDateVal;
|
||||
INT nMaxDateVal;
|
||||
|
||||
GetCalendarInfoW(LOCALE_USER_DEFAULT,
|
||||
CAL_GREGORIAN,
|
||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||
NULL,
|
||||
0, /* ret type - number */
|
||||
(LPDWORD)&nMaxDateVal);
|
||||
GetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||
CAL_GREGORIAN,
|
||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||
NULL,
|
||||
0, /* ret type - number */
|
||||
(LPDWORD)&nMaxDateVal);
|
||||
|
||||
return nMaxDateVal;
|
||||
}
|
||||
|
||||
/* Set's MIN data edit control value to MAX-99 */
|
||||
static
|
||||
VOID
|
||||
static VOID
|
||||
SetMinData(HWND hwndDlg)
|
||||
{
|
||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
INT nSpinVal;
|
||||
|
||||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Get spin value */
|
||||
INT nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
0,
|
||||
0));
|
||||
nSpinVal = LOWORD(SendMessage(hWndYearSpin,
|
||||
UDM_GETPOS,
|
||||
0,
|
||||
0));
|
||||
|
||||
/* Set min year value */
|
||||
wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal-YEAR_DIFF);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, _T("%d"), (DWORD)nSpinVal - YEAR_DIFF);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Init spin control */
|
||||
static
|
||||
VOID
|
||||
static VOID
|
||||
InitMinMaxDateSpin(HWND hwndDlg)
|
||||
{
|
||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||
HWND hWndYearSpin;
|
||||
|
||||
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||
|
||||
/* Init max date value */
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate());
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate());
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Init min date value */
|
||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate()-YEAR_DIFF);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate()-YEAR_DIFF);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Init updown control */
|
||||
/* Set bounds */
|
||||
SendMessageW(hWndYearSpin,
|
||||
UDM_SETRANGE,
|
||||
0,
|
||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||
SendMessage(hWndYearSpin,
|
||||
UDM_SETRANGE,
|
||||
0,
|
||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||
|
||||
/* Set current value */
|
||||
SendMessageW(hWndYearSpin,
|
||||
UDM_SETPOS,
|
||||
0,
|
||||
MAKELONG(GetMaxDate(),0));
|
||||
|
||||
SendMessage(hWndYearSpin,
|
||||
UDM_SETPOS,
|
||||
0,
|
||||
MAKELONG(GetMaxDate(),0));
|
||||
}
|
||||
|
||||
/* Update all date locale samples */
|
||||
static
|
||||
VOID
|
||||
static VOID
|
||||
UpdateDateLocaleSamples(HWND hwndDlg,
|
||||
LCID lcidLocale)
|
||||
{
|
||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Get short date format sample */
|
||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||
0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get long date sample */
|
||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
DatePageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
switch (uMsg)
|
||||
{
|
||||
InitMinMaxDateSpin(hwndDlg);
|
||||
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
InitShortDateCB(hwndDlg);
|
||||
InitLongDateCB(hwndDlg);
|
||||
InitShortDateSepSamples(hwndDlg);
|
||||
/* TODO: Add other calendar types */
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
case WM_INITDIALOG:
|
||||
InitMinMaxDateSpin(hwndDlg);
|
||||
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
InitShortDateCB(hwndDlg);
|
||||
InitLongDateCB(hwndDlg);
|
||||
InitShortDateSepSamples(hwndDlg);
|
||||
/* TODO: Add other calendar types */
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
|
@ -608,8 +602,9 @@ DatePageProc(HWND hwndDlg,
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -26,106 +26,104 @@
|
|||
* Aleksey Bragin
|
||||
*/
|
||||
|
||||
#define WINVER 0x0501
|
||||
#define SAMPLE_NUMBER L"123456789"
|
||||
#define NO_FLAG 0
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define SAMPLE_NUMBER _T("123456789")
|
||||
#define NO_FLAG 0
|
||||
|
||||
HWND hList;
|
||||
HWND hLocaleList, hGeoList;
|
||||
|
||||
BOOL CALLBACK LocalesEnumProc(
|
||||
LPTSTR lpLocale // locale id
|
||||
)
|
||||
BOOL CALLBACK
|
||||
LocalesEnumProc(LPTSTR lpLocale)
|
||||
{
|
||||
LCID lcid;
|
||||
TCHAR lang[255];
|
||||
int index;
|
||||
LCID lcid;
|
||||
TCHAR lang[255];
|
||||
INT index;
|
||||
|
||||
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
||||
lcid = wcstoul(lpLocale, NULL, 16);
|
||||
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
||||
lcid = _tcstoul(lpLocale, NULL, 16);
|
||||
|
||||
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
|
||||
GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
|
||||
|
||||
index = SendMessageW(hList,
|
||||
index = SendMessage(hList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)lang);
|
||||
|
||||
SendMessageW(hList,
|
||||
SendMessage(hList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)lcid);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Update all locale samples */
|
||||
static
|
||||
VOID
|
||||
static VOID
|
||||
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
||||
{
|
||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Get number format sample */
|
||||
GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
||||
GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get monetary format sample */
|
||||
GetCurrencyFormatW(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
|
||||
GetCurrencyFormat(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
|
||||
OutBuffer, MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get time format sample */
|
||||
GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
||||
GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Get short date format sample */
|
||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
||||
0, (LPARAM)OutBuffer);
|
||||
|
||||
/* Get long date sample */
|
||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
static VOID
|
||||
CreateLanguagesList(HWND hwnd)
|
||||
{
|
||||
TCHAR langSel[255];
|
||||
TCHAR langSel[255];
|
||||
|
||||
hList = hwnd;
|
||||
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
||||
hList = hwnd;
|
||||
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
|
||||
|
||||
// Select current locale
|
||||
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
||||
|
||||
SendMessageW(hList,
|
||||
// Select current locale
|
||||
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
||||
|
||||
SendMessage(hList,
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)langSel);
|
||||
}
|
||||
|
||||
// Sets new locale
|
||||
void SetNewLocale(LCID lcid)
|
||||
VOID
|
||||
SetNewLocale(LCID lcid)
|
||||
{
|
||||
// HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
|
||||
// HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
|
||||
|
@ -137,111 +135,113 @@ void SetNewLocale(LCID lcid)
|
|||
DWORD ret;
|
||||
TCHAR value[9];
|
||||
DWORD valuesize;
|
||||
WCHAR ACPPage[9];
|
||||
WCHAR OEMPage[9];
|
||||
TCHAR ACPPage[9];
|
||||
TCHAR OEMPage[9];
|
||||
|
||||
ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
|
||||
ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
|
||||
if (ret == 0)
|
||||
{
|
||||
MessageBoxW(NULL, L"Problem reading OEM code page", L"Big Problem", MB_OK);
|
||||
MessageBox(NULL, _T("Problem reading OEM code page"), _T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
|
||||
GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
|
||||
if (ret == 0)
|
||||
{
|
||||
MessageBoxW(NULL, L"Problem reading ANSI code page", L"Big Problem", MB_OK);
|
||||
MessageBox(NULL, _T("Problem reading ANSI code page"), _T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\International", &localeKey);
|
||||
|
||||
ret = RegOpenKey(HKEY_CURRENT_USER, _T("Control Panel\\International"), &localeKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
// some serious error
|
||||
MessageBoxW(NULL, L"Problem opening HKCU\\Control Panel\\International key", L"Big Problem", MB_OK);
|
||||
MessageBox(NULL, _T("Problem opening HKCU\\Control Panel\\International key"),
|
||||
_T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
wsprintf(value, _T("%04X"), (DWORD)lcid);
|
||||
valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
|
||||
|
||||
RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (LPBYTE)value, valuesize);
|
||||
RegCloseKey(localeKey);
|
||||
|
||||
ret = RegOpenKey(HKEY_USERS, _T(".DEFAULT\\Control Panel\\International"), &localeKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
// some serious error
|
||||
MessageBox(NULL, _T("Problem opening HKU\\.DEFAULT\\Control Panel\\International key"),
|
||||
_T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
wsprintf(value, L"%04X", (DWORD)lcid);
|
||||
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
||||
valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
|
||||
|
||||
RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
|
||||
RegCloseKey(localeKey);
|
||||
|
||||
ret = RegOpenKeyW(HKEY_USERS, L".DEFAULT\\Control Panel\\International", &localeKey);
|
||||
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
// some serious error
|
||||
MessageBoxW(NULL, L"Problem opening HKU\\.DEFAULT\\Control Panel\\International key", L"Big Problem", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
wsprintf(value, L"%04X", (DWORD)lcid);
|
||||
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
||||
|
||||
RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
|
||||
RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (BYTE *)value, valuesize);
|
||||
RegCloseKey(localeKey);
|
||||
|
||||
// Set language
|
||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
|
||||
|
||||
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key", L"Big Problem", MB_OK);
|
||||
MessageBoxW(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key"),
|
||||
_T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize );
|
||||
RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE *)value, valuesize );
|
||||
RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||
RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||
|
||||
RegCloseKey(langKey);
|
||||
|
||||
|
||||
// Set language
|
||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
|
||||
|
||||
/* Set language */
|
||||
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key", L"Big Problem", MB_OK);
|
||||
MessageBox(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key"),
|
||||
_T("Big Problem"), MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR) );
|
||||
RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR) );
|
||||
RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
|
||||
RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
|
||||
|
||||
RegCloseKey(langKey);
|
||||
|
||||
}
|
||||
|
||||
/* Location enumerate procedure */
|
||||
#if 0
|
||||
BOOL
|
||||
CALLBACK
|
||||
LocationsEnumProc(GEOID gId)
|
||||
{
|
||||
TCHAR loc[MAX_STR_SIZE];
|
||||
int index;
|
||||
INT index;
|
||||
|
||||
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
||||
index = (int) SendMessageW(hGeoList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)loc);
|
||||
index = (INT)SendMessage(hGeoList,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)loc);
|
||||
|
||||
SendMessageW(hGeoList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)gId);
|
||||
SendMessage(hGeoList,
|
||||
CB_SETITEMDATA,
|
||||
index,
|
||||
(LPARAM)gId);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Enumerate all system locations identifiers */
|
||||
static
|
||||
VOID
|
||||
CreateLocationsList(HWND hWnd)
|
||||
{
|
||||
#if 0
|
||||
GEOID userGeoID;
|
||||
TCHAR loc[MAX_STR_SIZE];
|
||||
|
||||
|
@ -257,16 +257,18 @@ CreateLocationsList(HWND hWnd)
|
|||
MAX_FMT_SIZE,
|
||||
LANG_SYSTEM_DEFAULT);
|
||||
|
||||
SendMessageW(hGeoList,
|
||||
SendMessage(hGeoList,
|
||||
CB_SELECTSTRING,
|
||||
(WPARAM) -1,
|
||||
(LPARAM)loc);
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD
|
||||
VerifyUnattendLCID(HWND hwndDlg)
|
||||
{
|
||||
LRESULT lCount, lIndex, lResult;
|
||||
LRESULT lCount, lIndex, lResult;
|
||||
|
||||
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
||||
if (lCount == CB_ERR)
|
||||
{
|
||||
|
@ -340,22 +342,21 @@ GeneralPageProc(HWND hwndDlg,
|
|||
int iCurSel;
|
||||
|
||||
// Acquire new value
|
||||
iCurSel = SendMessageW(hList,
|
||||
iCurSel = SendMessage(hList,
|
||||
CB_GETCURSEL,
|
||||
0,
|
||||
0);
|
||||
if (iCurSel == CB_ERR)
|
||||
break;
|
||||
|
||||
NewLcid = SendMessageW(hList,
|
||||
NewLcid = SendMessage(hList,
|
||||
CB_GETITEMDATA,
|
||||
iCurSel,
|
||||
0);
|
||||
|
||||
if (NewLcid == (LCID)CB_ERR)
|
||||
break;
|
||||
|
||||
|
||||
|
||||
// Actually set new locale
|
||||
SetNewLocale(NewLcid);
|
||||
}
|
||||
|
|
|
@ -36,16 +36,16 @@
|
|||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
InpLocalePageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -64,14 +64,14 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
|||
}
|
||||
|
||||
BOOL
|
||||
OpenSetupInf()
|
||||
OpenSetupInf(VOID)
|
||||
{
|
||||
LPTSTR lpCmdLine;
|
||||
LPTSTR lpSwitch;
|
||||
size_t len;
|
||||
|
||||
lpCmdLine = GetCommandLine();
|
||||
|
||||
|
||||
lpSwitch = _tcsstr(lpCmdLine, _T("/f:\""));
|
||||
|
||||
if(!lpSwitch)
|
||||
|
@ -101,7 +101,7 @@ OpenSetupInf()
|
|||
}
|
||||
|
||||
VOID
|
||||
ParseSetupInf()
|
||||
ParseSetupInf(VOID)
|
||||
{
|
||||
INFCONTEXT InfContext;
|
||||
TCHAR szBuffer[30];
|
||||
|
|
|
@ -82,11 +82,11 @@ TimePageProc(HWND hwndDlg,
|
|||
void SetNewLocale(LCID lcid);
|
||||
|
||||
/* misc.c */
|
||||
WCHAR*
|
||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
|
||||
LPTSTR
|
||||
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr);
|
||||
|
||||
WCHAR*
|
||||
ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
|
||||
LPTSTR
|
||||
ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl);
|
||||
|
||||
LONG
|
||||
APIENTRY
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl">
|
||||
<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes">
|
||||
<importlibrary definition="intl.def" />
|
||||
<include base="intl">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<define name="WINVER">0x609</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>comctl32</library>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
@ -8,41 +9,44 @@
|
|||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
LanguagesPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
SHELLEXECUTEINFOW shInputDll;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
/* If "detail" button pressed */
|
||||
case IDC_DETAIL_BUTTON:
|
||||
if(HIWORD(wParam)==BN_CLICKED)
|
||||
{
|
||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
|
||||
shInputDll.cbSize = sizeof(shInputDll);
|
||||
shInputDll.hwnd = hwndDlg;
|
||||
shInputDll.lpVerb = L"open";
|
||||
shInputDll.lpFile = L"RunDll32.exe";
|
||||
shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
|
||||
if(ShellExecuteExW(&shInputDll)==0)
|
||||
SHELLEXECUTEINFO shInputDll;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
/* If "detail" button pressed */
|
||||
case IDC_DETAIL_BUTTON:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
{
|
||||
MessageBox(NULL, L"Can't start input.dll", L"Error", MB_OK | MB_ICONERROR);
|
||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
|
||||
shInputDll.cbSize = sizeof(shInputDll);
|
||||
shInputDll.hwnd = hwndDlg;
|
||||
shInputDll.lpVerb = _T("open");
|
||||
shInputDll.lpFile = _T("RunDll32.exe");
|
||||
shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL input.dll");
|
||||
if (ShellExecuteEx(&shInputDll) == 0)
|
||||
{
|
||||
MessageBox(NULL,
|
||||
_T("Can't start input.dll"),
|
||||
_T("Error"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
@ -8,139 +9,141 @@
|
|||
#define NUM_SHEETS 4
|
||||
|
||||
/* Insert the space */
|
||||
WCHAR*
|
||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
||||
LPTSTR
|
||||
InsSpacePos(LPCTSTR szInsStr, const int nPos)
|
||||
{
|
||||
WCHAR* pwszDestStr;
|
||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
int nDestStrCnt=0;
|
||||
int nStrCnt;
|
||||
int nStrSize;
|
||||
LPTSTR pszDestStr;
|
||||
INT nDestStrCnt = 0;
|
||||
INT nStrCnt;
|
||||
INT nStrSize;
|
||||
|
||||
wcscpy(pwszDestStr,wszInsStr);
|
||||
|
||||
nStrSize = wcslen(wszInsStr);
|
||||
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
|
||||
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
||||
_tcscpy(pszDestStr, szInsStr);
|
||||
|
||||
nStrSize = _tcslen(szInsStr);
|
||||
|
||||
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||
{
|
||||
if(nStrCnt==nStrSize-nPos)
|
||||
if (nStrCnt == nStrSize - nPos)
|
||||
{
|
||||
pwszDestStr[nDestStrCnt]=' ';
|
||||
pszDestStr[nDestStrCnt] = _T(' ');
|
||||
nDestStrCnt++;
|
||||
}
|
||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
||||
|
||||
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||
nDestStrCnt++;
|
||||
}
|
||||
pwszDestStr[nDestStrCnt]='\0';
|
||||
|
||||
return pwszDestStr;
|
||||
|
||||
pszDestStr[nDestStrCnt] = _T('\0');
|
||||
|
||||
return pszDestStr;
|
||||
}
|
||||
|
||||
/* Insert the spaces by format string separated by ';' */
|
||||
WCHAR*
|
||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||
LPTSTR
|
||||
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
||||
{
|
||||
WCHAR* pwszDestStr;
|
||||
pwszDestStr=(WCHAR*) malloc(255);
|
||||
|
||||
WCHAR* pwszTempStr;
|
||||
|
||||
WCHAR wszFmtVal[255];
|
||||
|
||||
int nFmtCount=0;
|
||||
int nValCount=0;
|
||||
int nLastVal=0;
|
||||
int nSpaceOffset=0;
|
||||
|
||||
LPTSTR pszDestStr;
|
||||
LPTSTR pszTempStr;
|
||||
TCHAR szFmtVal[255];
|
||||
INT nFmtCount = 0;
|
||||
INT nValCount = 0;
|
||||
INT nLastVal = 0;
|
||||
INT nSpaceOffset = 0;
|
||||
BOOL wasNul=FALSE;
|
||||
|
||||
wcscpy(pwszDestStr,wszSourceStr);
|
||||
pszDestStr = (LPTSTR)malloc(255 * sizeof(TCHAR));
|
||||
|
||||
_tcscpy(pszDestStr, szSourceStr);
|
||||
|
||||
/* if format is clean return source string */
|
||||
if(!*wszFmtStr) return pwszDestStr;
|
||||
if (!*szFmtStr)
|
||||
return pszDestStr;
|
||||
|
||||
/* Search for all format values */
|
||||
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
||||
for (nFmtCount = 0; nFmtCount <= _tcslen(szFmtStr); nFmtCount++)
|
||||
{
|
||||
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
||||
if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
|
||||
{
|
||||
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
||||
if (_ttoi(szFmtVal) == 0 && !wasNul)
|
||||
{
|
||||
wasNul=TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If was 0, repeat spaces */
|
||||
if(wasNul)
|
||||
if (wasNul)
|
||||
{
|
||||
nSpaceOffset+=nLastVal;
|
||||
nSpaceOffset += nLastVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
nSpaceOffset+=_wtoi(wszFmtVal);
|
||||
nSpaceOffset += _ttoi(szFmtVal);
|
||||
}
|
||||
wszFmtVal[nValCount]='\0';
|
||||
nValCount=0;
|
||||
/* insert space to finded position plus all pos before */
|
||||
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
||||
wcscpy(pwszDestStr,pwszTempStr);
|
||||
free(pwszTempStr);
|
||||
/* num of spaces total increment */
|
||||
|
||||
if(!wasNul)
|
||||
szFmtVal[nValCount] = _T('\0');
|
||||
nValCount=0;
|
||||
|
||||
/* insert space to finded position plus all pos before */
|
||||
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
|
||||
_tcscpy(pszDestStr,pszTempStr);
|
||||
free(pszTempStr);
|
||||
|
||||
/* num of spaces total increment */
|
||||
if (!wasNul)
|
||||
{
|
||||
nSpaceOffset++;
|
||||
nLastVal=_wtoi(wszFmtVal);
|
||||
nLastVal = _ttoi(szFmtVal);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
||||
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||
}
|
||||
}
|
||||
|
||||
/* Create spaces for rest part of string */
|
||||
if(wasNul && nLastVal!=0)
|
||||
if (wasNul && nLastVal != 0)
|
||||
{
|
||||
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
||||
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||
{
|
||||
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
||||
wcscpy(pwszDestStr,pwszTempStr);
|
||||
free(pwszTempStr);
|
||||
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||
_tcscpy(pszDestStr, pszTempStr);
|
||||
free(pszTempStr);
|
||||
}
|
||||
}
|
||||
|
||||
return pwszDestStr;
|
||||
return pszDestStr;
|
||||
}
|
||||
|
||||
/* Replace given template in source string with string to replace and return recieved string */
|
||||
WCHAR*
|
||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||
const WCHAR *wszStrToReplace,
|
||||
const WCHAR *wszTempl)
|
||||
LPTSTR
|
||||
ReplaceSubStr(LPCTSTR szSourceStr,
|
||||
LPCTSTR szStrToReplace,
|
||||
LPCTSTR szTempl)
|
||||
{
|
||||
int nCharCnt;
|
||||
int nSubStrCnt;
|
||||
int nDestStrCnt;
|
||||
int nFirstCharCnt;
|
||||
LPTSTR szDestStr;
|
||||
INT nCharCnt;
|
||||
INT nSubStrCnt;
|
||||
INT nDestStrCnt;
|
||||
INT nFirstCharCnt;
|
||||
|
||||
WCHAR* wszDestStr;
|
||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
|
||||
nDestStrCnt=0;
|
||||
nFirstCharCnt=0;
|
||||
nDestStrCnt = 0;
|
||||
nFirstCharCnt = 0;
|
||||
|
||||
wcscpy(wszDestStr,L"");
|
||||
_tcscpy(szDestStr, _T(""));
|
||||
|
||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
||||
{
|
||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
||||
while (nFirstCharCnt < _tcslen(szSourceStr))
|
||||
{
|
||||
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||
{
|
||||
nSubStrCnt=0;
|
||||
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
||||
nSubStrCnt = 0;
|
||||
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + _tcslen(szTempl); nCharCnt++)
|
||||
{
|
||||
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
||||
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||
{
|
||||
nSubStrCnt++;
|
||||
}
|
||||
|
@ -148,24 +151,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
|||
{
|
||||
break;
|
||||
}
|
||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
||||
|
||||
if (_tcslen(szTempl) == nSubStrCnt)
|
||||
{
|
||||
wcscat(wszDestStr,wszStrToReplace);
|
||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
||||
_tcscat(szDestStr, szStrToReplace);
|
||||
nDestStrCnt = _tcslen(szDestStr);
|
||||
nFirstCharCnt += _tcslen(szTempl) - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
||||
wszDestStr[nDestStrCnt]='\0';
|
||||
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
|
||||
szDestStr[nDestStrCnt] = _T('\0');
|
||||
}
|
||||
nFirstCharCnt++;
|
||||
}
|
||||
|
||||
return wszDestStr;
|
||||
nFirstCharCnt++;
|
||||
}
|
||||
|
||||
return szDestStr;
|
||||
}
|
||||
|
||||
/* Create applets */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,12 +5,13 @@
|
|||
* PURPOSE: ReactOS International Control Panel
|
||||
* PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
|
||||
*/
|
||||
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
@ -22,139 +23,140 @@
|
|||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/* Insert the space */
|
||||
WCHAR*
|
||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
||||
TCHAR*
|
||||
InsSpacePos(const TCHAR *szInsStr, const int nPos)
|
||||
{
|
||||
WCHAR* pwszDestStr;
|
||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
||||
|
||||
LPTSTR pszDestStr;
|
||||
int nDestStrCnt=0;
|
||||
int nStrCnt;
|
||||
int nStrSize;
|
||||
|
||||
wcscpy(pwszDestStr,wszInsStr);
|
||||
|
||||
nStrSize = wcslen(wszInsStr);
|
||||
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
|
||||
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
||||
_tcscpy(pszDestStr, szInsStr);
|
||||
|
||||
nStrSize = _tcslen(szInsStr);
|
||||
|
||||
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||
{
|
||||
if(nStrCnt==nStrSize-nPos)
|
||||
if (nStrCnt == nStrSize - nPos)
|
||||
{
|
||||
pwszDestStr[nDestStrCnt]=' ';
|
||||
pszDestStr[nDestStrCnt] = _T(' ');
|
||||
nDestStrCnt++;
|
||||
}
|
||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
||||
|
||||
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||
nDestStrCnt++;
|
||||
}
|
||||
pwszDestStr[nDestStrCnt]='\0';
|
||||
|
||||
return pwszDestStr;
|
||||
|
||||
pszDestStr[nDestStrCnt] = _T('\0');
|
||||
|
||||
return pszDestStr;
|
||||
}
|
||||
|
||||
/* Insert the spaces by format string separated by ';' */
|
||||
WCHAR*
|
||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||
LPTSTR
|
||||
InsSpacesFmt(const TCHAR *szSourceStr, const TCHAR *szFmtStr)
|
||||
{
|
||||
WCHAR* pwszDestStr;
|
||||
pwszDestStr=(WCHAR*) malloc(255);
|
||||
|
||||
WCHAR* pwszTempStr;
|
||||
|
||||
WCHAR wszFmtVal[255];
|
||||
|
||||
int nFmtCount=0;
|
||||
int nValCount=0;
|
||||
LPTSTR pszDestStr;
|
||||
LPTSTR pszTempStr;
|
||||
TCHAR szFmtVal[255];
|
||||
int nFmtCount=0;
|
||||
int nValCount=0;
|
||||
int nLastVal=0;
|
||||
int nSpaceOffset=0;
|
||||
|
||||
BOOL wasNul=FALSE;
|
||||
|
||||
wcscpy(pwszDestStr,wszSourceStr);
|
||||
pszDestStr = (LPTSTR) malloc(255 * sizeof(TCHAR));
|
||||
|
||||
_tcscpy(pszDestStr, szSourceStr);
|
||||
|
||||
/* if format is clean return source string */
|
||||
if(!*wszFmtStr) return pwszDestStr;
|
||||
if (!*szFmtStr)
|
||||
return pszDestStr;
|
||||
|
||||
/* Search for all format values */
|
||||
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
||||
for (nFmtCount = 0; nFmtCount <= (int)_tcslen(szFmtStr); nFmtCount++)
|
||||
{
|
||||
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
||||
if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
|
||||
{
|
||||
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
||||
if (_ttoi(szFmtVal) == 0 && !wasNul)
|
||||
{
|
||||
wasNul=TRUE;
|
||||
wasNul = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If was 0, repeat spaces */
|
||||
if(wasNul)
|
||||
if (wasNul)
|
||||
{
|
||||
nSpaceOffset+=nLastVal;
|
||||
nSpaceOffset += nLastVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
nSpaceOffset+=_wtoi(wszFmtVal);
|
||||
nSpaceOffset += _ttoi(szFmtVal);
|
||||
}
|
||||
wszFmtVal[nValCount]='\0';
|
||||
nValCount=0;
|
||||
/* insert space to finded position plus all pos before */
|
||||
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
||||
wcscpy(pwszDestStr,pwszTempStr);
|
||||
free(pwszTempStr);
|
||||
/* num of spaces total increment */
|
||||
|
||||
if(!wasNul)
|
||||
szFmtVal[nValCount] = _T('\0');
|
||||
nValCount=0;
|
||||
|
||||
/* insert space to finded position plus all pos before */
|
||||
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
|
||||
_tcscpy(pszDestStr, pszTempStr);
|
||||
free(pszTempStr);
|
||||
|
||||
/* num of spaces total increment */
|
||||
if (!wasNul)
|
||||
{
|
||||
nSpaceOffset++;
|
||||
nLastVal=_wtoi(wszFmtVal);
|
||||
nLastVal = _ttoi(szFmtVal);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
||||
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||
}
|
||||
}
|
||||
|
||||
/* Create spaces for rest part of string */
|
||||
if(wasNul && nLastVal!=0)
|
||||
if (wasNul && nLastVal!=0)
|
||||
{
|
||||
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
||||
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
|
||||
{
|
||||
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
||||
wcscpy(pwszDestStr,pwszTempStr);
|
||||
free(pwszTempStr);
|
||||
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||
_tcscpy(pszDestStr,pszTempStr);
|
||||
free(pszTempStr);
|
||||
}
|
||||
}
|
||||
|
||||
return pwszDestStr;
|
||||
return pszDestStr;
|
||||
}
|
||||
|
||||
/* Replace given template in source string with string to replace and return recieved string */
|
||||
WCHAR*
|
||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||
const WCHAR *wszStrToReplace,
|
||||
const WCHAR *wszTempl)
|
||||
TCHAR*
|
||||
ReplaceSubStr(const TCHAR *szSourceStr,
|
||||
const TCHAR *szStrToReplace,
|
||||
const TCHAR *szTempl)
|
||||
{
|
||||
int nCharCnt;
|
||||
int nSubStrCnt;
|
||||
int nDestStrCnt;
|
||||
int nCharCnt;
|
||||
int nSubStrCnt;
|
||||
int nDestStrCnt;
|
||||
int nFirstCharCnt;
|
||||
LPTSTR szDestStr;
|
||||
|
||||
WCHAR* wszDestStr;
|
||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||
nDestStrCnt = 0;
|
||||
nFirstCharCnt = 0;
|
||||
|
||||
nDestStrCnt=0;
|
||||
nFirstCharCnt=0;
|
||||
_tcscpy(szDestStr, _T(L""));
|
||||
|
||||
wcscpy(wszDestStr,L"");
|
||||
|
||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
||||
{
|
||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
||||
while (nFirstCharCnt < (int)_tcslen(szSourceStr))
|
||||
{
|
||||
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||
{
|
||||
nSubStrCnt=0;
|
||||
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
||||
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + (int)_tcslen(szTempl); nCharCnt++)
|
||||
{
|
||||
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
||||
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||
{
|
||||
nSubStrCnt++;
|
||||
}
|
||||
|
@ -162,24 +164,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
|||
{
|
||||
break;
|
||||
}
|
||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
||||
|
||||
if ((int)_tcslen(szTempl) == nSubStrCnt)
|
||||
{
|
||||
wcscat(wszDestStr,wszStrToReplace);
|
||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
||||
_tcscat(szDestStr, szStrToReplace);
|
||||
nDestStrCnt = (int)_tcslen(szDestStr);
|
||||
nFirstCharCnt += (int)_tcslen(szTempl) - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
||||
wszDestStr[nDestStrCnt]='\0';
|
||||
szDestStr[nDestStrCnt++] = wszSourceStr[nFirstCharCnt];
|
||||
szDestStr[nDestStrCnt] = _T('\0');
|
||||
}
|
||||
nFirstCharCnt++;
|
||||
}
|
||||
|
||||
return wszDestStr;
|
||||
nFirstCharCnt++;
|
||||
}
|
||||
|
||||
return szDestStr;
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
@ -26,26 +26,27 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* - Enumerate available time formats (use EnumTimeformatsW)
|
||||
* - Enumerate available time formats (use EnumTimeFormats)
|
||||
*/
|
||||
|
||||
static VOID
|
||||
UpdateTimeSample(HWND hWnd)
|
||||
{
|
||||
WCHAR InBuffer[80];
|
||||
WCHAR OutBuffer[80];
|
||||
TCHAR InBuffer[80];
|
||||
TCHAR OutBuffer[80];
|
||||
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
|
||||
|
||||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
|
||||
|
||||
SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,81 +57,81 @@ TimePageProc(HWND hwndDlg,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
WCHAR Buffer[80];
|
||||
TCHAR Buffer[80];
|
||||
int nLen;
|
||||
|
||||
/* Update the time format sample */
|
||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||
|
||||
/* Get the time format (max. 80 characters) */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
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);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
||||
SendMessage(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) */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
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);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
||||
SendMessage(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) */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
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);
|
||||
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
||||
SendMessage(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_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)_T(""));
|
||||
}
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* index */
|
||||
0);
|
||||
|
||||
/* Get the PM symbol (max. 9 characters) */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
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);
|
||||
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
||||
SendMessage(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_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)_T(""));
|
||||
}
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_SETCURSEL,
|
||||
0, /* index */
|
||||
0);
|
||||
|
@ -159,49 +160,49 @@ TimePageProc(HWND hwndDlg,
|
|||
|
||||
if (lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
WCHAR Buffer[80];
|
||||
TCHAR Buffer[80];
|
||||
int nIndex;
|
||||
|
||||
/* Set time format */
|
||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
CB_GETCURSEL, 0, 0);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||
|
||||
/* Set time separator */
|
||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
CB_GETCURSEL, 0, 0);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||
|
||||
/* Set the AM symbol */
|
||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_GETCURSEL, 0, 0);
|
||||
if (nIndex != CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L"");
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, _T(""));
|
||||
}
|
||||
|
||||
/* Set the PM symbol */
|
||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_GETCURSEL, 0, 0);
|
||||
if (nIndex != CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L"");
|
||||
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, _T(""));
|
||||
}
|
||||
|
||||
/* Update the time format sample */
|
||||
|
|
Loading…
Reference in a new issue