mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 08:33:11 +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
|
@ -17,6 +17,7 @@ AdvancedPageProc(HWND hwndDlg,
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define POSITIVE_EXAMPLE L"123456789.00"
|
#define POSITIVE_EXAMPLE _T("123456789.00")
|
||||||
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
#define NEGATIVE_EXAMPLE _T("-123456789.00")
|
||||||
#define MAX_FIELD_DIG_SAMPLES 3
|
#define MAX_FIELD_DIG_SAMPLES 3
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get decimal separator */
|
/* Get decimal separator */
|
||||||
ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SMONDECIMALSEP,
|
LOCALE_SMONDECIMALSEP,
|
||||||
pGlobalData->szDecimalSep, 4);
|
pGlobalData->szDecimalSep, 4);
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SMONGROUPING,
|
LOCALE_SMONGROUPING,
|
||||||
pGlobalData->szGrouping, 10);
|
pGlobalData->szGrouping, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,18 +122,18 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
||||||
|
|
||||||
/* positive example */
|
/* positive example */
|
||||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
POSITIVE_EXAMPLE,
|
POSITIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&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 */
|
/* negative example */
|
||||||
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
NEGATIVE_EXAMPLE,
|
NEGATIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&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);
|
GetInitialCurrencyValues(pGlobalData);
|
||||||
|
|
||||||
/* Set currency symbol */
|
/* Set currency symbol */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szCurrencySymbol);
|
(LPARAM)pGlobalData->szCurrencySymbol);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -175,13 +174,13 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
_T("1.1"),
|
_T("1.1"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->PositiveOrder,
|
pGlobalData->PositiveOrder,
|
||||||
0);
|
0);
|
||||||
|
@ -195,53 +194,52 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
_T("-1.1"),
|
_T("-1.1"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NegativeOrder, /* index */
|
pGlobalData->NegativeOrder, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* decimal separator */
|
/* decimal separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szDecimalSep);
|
(LPARAM)pGlobalData->szDecimalSep);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
szBuffer[0] = _T('0') + i;
|
szBuffer[0] = _T('0') + i;
|
||||||
szBuffer[1] = 0;
|
szBuffer[1] = 0;
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NumDigits, /* index */
|
pGlobalData->NumDigits, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
/* digit group separator */
|
/* digit group separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szThousandSep);
|
(LPARAM)pGlobalData->szThousandSep);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -257,7 +255,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -266,7 +264,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -275,7 +273,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -290,7 +288,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
i, /* index */
|
i, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -300,149 +298,148 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of digidts in field */
|
/* Set number of digidts in field */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyDigNum(HWND hwndDlg)
|
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",
|
_T("0;0"),
|
||||||
L"3;0",
|
_T("3;0"),
|
||||||
L"3;2;0"
|
_T("3;2;0")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCurrSel;
|
int nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of digidts in field */
|
/* Get setted number of digidts in field */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Save number of digidts in field */
|
/* Save number of digidts in field */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency field separator */
|
/* Set currency field separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyFieldSep(HWND hwndDlg)
|
SetCurrencyFieldSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency field separator */
|
/* Get setted currency field separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencyFieldSep);
|
(LPARAM)szCurrencyFieldSep);
|
||||||
|
|
||||||
/* Save currency field separator */
|
/* Save currency field separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of fractional symbols */
|
/* Set number of fractional symbols */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyFracSymNum(HWND hwndDlg)
|
SetCurrencyFracSymNum(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of fractional symbols */
|
/* Get setted number of fractional symbols */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX);
|
_itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save number of fractional symbols */
|
/* Save number of fractional symbols */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency separator */
|
/* Set currency separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencySep(HWND hwndDlg)
|
SetCurrencySep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency decimal separator */
|
/* Get setted currency decimal separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencySep);
|
(LPARAM)szCurrencySep);
|
||||||
|
|
||||||
/* TODO: Add check for correctly input */
|
/* TODO: Add check for correctly input */
|
||||||
|
|
||||||
/* Save currency separator */
|
/* Save currency separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, szCurrencySep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set negative currency sum format */
|
/* Set negative currency sum format */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNegCurrencySumFmt(HWND hwndDlg)
|
SetNegCurrencySumFmt(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX);
|
_itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save currency sum format */
|
/* Save currency sum format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, szNegCurrencySumFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set positive currency sum format */
|
/* Set positive currency sum format */
|
||||||
BOOL
|
static BOOL
|
||||||
SetPosCurrencySumFmt(HWND hwndDlg)
|
SetPosCurrencySumFmt(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX);
|
_itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save currency sum format */
|
/* Save currency sum format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, szPosCurrencySumFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set currency unit */
|
/* Set currency unit */
|
||||||
BOOL
|
static BOOL
|
||||||
SetCurrencyUnit(HWND hwndDlg)
|
SetCurrencyUnit(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted currency unit */
|
/* Get setted currency unit */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
(LPARAM)(LPCSTR)szCurrencyUnit);
|
||||||
|
|
||||||
/* Save currency unit */
|
/* Save currency unit */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, szCurrencyUnit);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -461,14 +458,12 @@ CurrencyPageProc(HWND hwndDlg,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
|
||||||
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
|
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
|
||||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
||||||
OnInitDialog(hwndDlg, pGlobalData);
|
OnInitDialog(hwndDlg, pGlobalData);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_CURRENCYSYMBOL:
|
case IDC_CURRENCYSYMBOL:
|
||||||
|
@ -484,25 +479,40 @@ CurrencyPageProc(HWND hwndDlg,
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
/* If push apply button */
|
/* If push apply button */
|
||||||
if (lpnm->code == (UINT)PSN_APPLY)
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
{
|
{
|
||||||
if(!SetCurrencyDigNum(hwndDlg)) break;
|
if (!SetCurrencyDigNum(hwndDlg))
|
||||||
if(!SetCurrencyUnit(hwndDlg)) break;
|
break;
|
||||||
if(!SetPosCurrencySumFmt(hwndDlg)) break;
|
|
||||||
if(!SetNegCurrencySumFmt(hwndDlg)) break;
|
if (!SetCurrencyUnit(hwndDlg))
|
||||||
if(!SetCurrencySep(hwndDlg)) break;
|
break;
|
||||||
if(!SetCurrencyFracSymNum(hwndDlg)) break;
|
|
||||||
if(!SetCurrencyFieldSep(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);
|
UpdateExamples(hwndDlg, pGlobalData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,23 +24,21 @@
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WINVER 0x0500
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
const INT YEAR_STR_MAX_SIZE=4;
|
#define YEAR_STR_MAX_SIZE 4
|
||||||
const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
|
||||||
#define MAX_SHORT_FMT_SAMPLES 5
|
#define MAX_SHORT_FMT_SAMPLES 5
|
||||||
#define MAX_LONG_FMT_SAMPLES 2
|
#define MAX_LONG_FMT_SAMPLES 2
|
||||||
#define MAX_SHRT_DATE_SEPARATORS 3
|
#define MAX_SHRT_DATE_SEPARATORS 3
|
||||||
#define STD_DATE_SEP L"."
|
#define STD_DATE_SEP _T(".")
|
||||||
#define YEAR_DIFF (99)
|
#define YEAR_DIFF (99)
|
||||||
#define MAX_YEAR (9999)
|
#define MAX_YEAR (9999)
|
||||||
|
|
||||||
|
@ -48,124 +46,126 @@ const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
||||||
|
|
||||||
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
||||||
BOOL
|
BOOL
|
||||||
isDateCompAl(WCHAR walpha)
|
isDateCompAl(TCHAR alpha)
|
||||||
{
|
{
|
||||||
|
if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' ')))
|
||||||
if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE;
|
return TRUE;
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find first date separator in string */
|
/* Find first date separator in string */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
FindDateSep(const WCHAR *wszSourceStr)
|
FindDateSep(const TCHAR *szSourceStr)
|
||||||
{
|
{
|
||||||
int nDateCompCount=0;
|
LPTSTR pszFoundSep;
|
||||||
int nDateSepCount=0;
|
INT nDateCompCount=0;
|
||||||
|
INT nDateSepCount=0;
|
||||||
|
|
||||||
WCHAR* wszFindedSep;
|
pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
nDateCompCount++;
|
nDateCompCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wszFindedSep;
|
pszFoundSep[nDateSepCount] = _T('\0');
|
||||||
|
return pszFoundSep;
|
||||||
|
}
|
||||||
|
|
||||||
|
nDateCompCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pszFoundSep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
|
|
||||||
|
|
||||||
/* Setted up short date separator to registry */
|
/* Setted up short date separator to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetShortDateSep(HWND hwndDlg)
|
SetShortDateSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
int nSepStrSize;
|
INT nSepStrSize;
|
||||||
int nSepCount;
|
INT nSepCount;
|
||||||
|
|
||||||
/* Get setted separator */
|
/* Get setted separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* Get setted separator string size */
|
/* Get setted separator string size */
|
||||||
nSepStrSize = wcslen(wszShortDateSep);
|
nSepStrSize = _tcslen(szShortDateSep);
|
||||||
|
|
||||||
/* Check date components */
|
/* 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,
|
MessageBox(NULL,
|
||||||
L"Entered short date separator contain incorrect symbol",
|
_T("Entered short date separator contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save date separator */
|
/* Save date separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDATE, wszShortDateSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, szShortDateSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setted up short date format to registry */
|
/* Setted up short date format to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetShortDateFormat(HWND hwndDlg)
|
SetShortDateFormat(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
LPTSTR pszResultStr;
|
||||||
WCHAR* pwszResultStr;
|
|
||||||
BOOL OpenApostFlg = FALSE;
|
BOOL OpenApostFlg = FALSE;
|
||||||
int nFmtStrSize;
|
INT nFmtStrSize;
|
||||||
int nDateCompCount;
|
INT nDateCompCount;
|
||||||
|
|
||||||
/* Get setted format */
|
/* Get setted format */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
|
|
||||||
/* Get setted separator */
|
/* Get setted separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* Get setted format-string size */
|
/* Get setted format-string size */
|
||||||
nFmtStrSize = wcslen(wszShortDateFmt);
|
nFmtStrSize = _tcslen(szShortDateFmt);
|
||||||
|
|
||||||
/* Check date components */
|
/* 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]) &&
|
if (_istalnum(szShortDateFmt[nDateCompCount]) &&
|
||||||
|
!isDateCompAl(szShortDateFmt[nDateCompCount]) &&
|
||||||
!OpenApostFlg)
|
!OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBox(NULL,
|
||||||
L"Entered short date format contain incorrect symbol",
|
_T("Entered short date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,55 +174,56 @@ SetShortDateFormat(HWND hwndDlg)
|
||||||
if (OpenApostFlg)
|
if (OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBoxW(NULL,
|
||||||
L"Entered short date format contain incorrect symbol",
|
_T("Entered short date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* substring replacement of separator */
|
/* substring replacement of separator */
|
||||||
wcscpy(wszFindedDateSep,FindDateSep(wszShortDateFmt));
|
_tcscpy(szFindedDateSep, FindDateSep(szShortDateFmt));
|
||||||
pwszResultStr = ReplaceSubStr(wszShortDateFmt,wszShortDateSep,wszFindedDateSep);
|
pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFindedDateSep);
|
||||||
wcscpy(wszShortDateFmt,pwszResultStr);
|
_tcscpy(szShortDateFmt, pszResultStr);
|
||||||
free(pwszResultStr);
|
free(pszResultStr);
|
||||||
|
|
||||||
/* Save short date format */
|
/* Save short date format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, wszShortDateFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, szShortDateFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setted up long date format to registry */
|
/* Setted up long date format to registry */
|
||||||
BOOL
|
static BOOL
|
||||||
SetLongDateFormat(HWND hwndDlg)
|
SetLongDateFormat(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
BOOL OpenApostFlg = FALSE;
|
BOOL OpenApostFlg = FALSE;
|
||||||
int nFmtStrSize;
|
INT nFmtStrSize;
|
||||||
int nDateCompCount;
|
INT nDateCompCount;
|
||||||
|
|
||||||
/* Get setted format */
|
/* Get setted format */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
|
|
||||||
/* Get setted format string size */
|
/* Get setted format string size */
|
||||||
nFmtStrSize = wcslen(wszLongDateFmt);
|
nFmtStrSize = _tcslen(szLongDateFmt);
|
||||||
|
|
||||||
/* Check date components */
|
/* 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]) &&
|
if (_istalnum(szLongDateFmt[nDateCompCount]) &&
|
||||||
|
!isDateCompAl(szLongDateFmt[nDateCompCount]) &&
|
||||||
!OpenApostFlg)
|
!OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBox(NULL,
|
||||||
L"Entered long date format contain incorrect symbol",
|
_T("Entered long date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,42 +232,39 @@ SetLongDateFormat(HWND hwndDlg)
|
||||||
if (OpenApostFlg)
|
if (OpenApostFlg)
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL,
|
MessageBoxW(NULL,
|
||||||
L"Entered long date format contain incorrect symbol",
|
_T("Entered long date format contain incorrect symbol"),
|
||||||
L"Error", MB_OK | MB_ICONERROR);
|
_T("Error"), MB_OK | MB_ICONERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save short date format */
|
/* Save short date format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, wszLongDateFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, szLongDateFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init short date separator control box */
|
/* Init short date separator control box */
|
||||||
VOID
|
static VOID
|
||||||
InitShortDateSepSamples(HWND hwndDlg)
|
InitShortDateSepSamples(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
|
||||||
{
|
{
|
||||||
L".",
|
_T("."),
|
||||||
L"/",
|
_T("/"),
|
||||||
L"-"
|
_T("-")
|
||||||
};
|
};
|
||||||
|
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current short date separator */
|
/* Get current short date separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SDATE,
|
LOCALE_SDATE,
|
||||||
wszShortDateSep,
|
szShortDateSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -281,22 +279,22 @@ InitShortDateSepSamples(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* 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),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_SHRT_DATE_SEPARATORS+1,
|
MAX_SHRT_DATE_SEPARATORS+1,
|
||||||
(LPARAM)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateSep);
|
(LPARAM)szShortDateSep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,29 +302,26 @@ InitShortDateSepSamples(HWND hwndDlg)
|
||||||
VOID
|
VOID
|
||||||
InitShortDateCB(HWND hwndDlg)
|
InitShortDateCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"dd.MM.yyyy",
|
_T("dd.MM.yyyy"),
|
||||||
L"dd.MM.yy",
|
_T("dd.MM.yy"),
|
||||||
L"d.M.yy",
|
_T("d.M.yy"),
|
||||||
L"dd/MM/yy",
|
_T("dd/MM/yy"),
|
||||||
L"yyyy-MM-dd"
|
_T("yyyy-MM-dd")
|
||||||
};
|
};
|
||||||
|
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current short date format */
|
/* Get current short date format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SSHORTDATE,
|
LOCALE_SSHORTDATE,
|
||||||
wszShortDateFmt,
|
szShortDateFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -334,57 +329,54 @@ InitShortDateCB(HWND hwndDlg)
|
||||||
/* Create standart list of date formats */
|
/* 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),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* 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),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_SHORT_FMT_SAMPLES+1,
|
MAX_SHORT_FMT_SAMPLES+1,
|
||||||
(LPARAM)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszShortDateFmt);
|
(LPARAM)szShortDateFmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init long date control box */
|
/* Init long date control box */
|
||||||
VOID
|
static VOID
|
||||||
InitLongDateCB(HWND hwndDlg)
|
InitLongDateCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
/* Where this data stored? */
|
/* 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.'",
|
_T("d MMMM yyyy 'y.'"),
|
||||||
L"dd MMMM yyyy 'y.'"
|
_T("dd MMMM yyyy 'y.'")
|
||||||
};
|
};
|
||||||
|
TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nCBIndex;
|
INT nCBIndex;
|
||||||
int nRetCode;
|
INT nRetCode;
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current long date format */
|
/* Get current long date format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SLONGDATE,
|
LOCALE_SLONGDATE,
|
||||||
wszLongDateFmt,
|
szLongDateFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -392,40 +384,42 @@ InitLongDateCB(HWND hwndDlg)
|
||||||
/* Create standart list of date formats */
|
/* 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),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* 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),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_LONG_FMT_SAMPLES+1,
|
MAX_LONG_FMT_SAMPLES+1,
|
||||||
(LPARAM)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszLongDateFmt);
|
(LPARAM)szLongDateFmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up max date value to registry */
|
/* Set up max date value to registry */
|
||||||
VOID
|
static VOID
|
||||||
SetMaxDate(HWND hwndDlg)
|
SetMaxDate(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
TCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||||
WCHAR wszMaxDateVal[YEAR_STR_MAX_SIZE];
|
HWND hWndYearSpin;
|
||||||
INT nSpinVal;
|
INT nSpinVal;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Get spin value */
|
/* Get spin value */
|
||||||
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||||
UDM_GETPOS,
|
UDM_GETPOS,
|
||||||
|
@ -433,22 +427,22 @@ SetMaxDate(HWND hwndDlg)
|
||||||
0));
|
0));
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nSpinVal,wszMaxDateVal,DECIMAL_RADIX);
|
_itot(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save max date value */
|
/* Save max date value */
|
||||||
SetCalendarInfoW(LOCALE_USER_DEFAULT,
|
SetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||||
CAL_GREGORIAN,
|
CAL_GREGORIAN,
|
||||||
48 , /* CAL_ITWODIGITYEARMAX */
|
48 , /* CAL_ITWODIGITYEARMAX */
|
||||||
(LPCWSTR)&wszMaxDateVal);
|
(LPCTSTR)&szMaxDateVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get max date value from registry set */
|
/* Get max date value from registry set */
|
||||||
INT
|
static INT
|
||||||
GetMaxDate()
|
GetMaxDate(VOID)
|
||||||
{
|
{
|
||||||
int nMaxDateVal;
|
INT nMaxDateVal;
|
||||||
|
|
||||||
GetCalendarInfoW(LOCALE_USER_DEFAULT,
|
GetCalendarInfo(LOCALE_USER_DEFAULT,
|
||||||
CAL_GREGORIAN,
|
CAL_GREGORIAN,
|
||||||
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -459,82 +453,83 @@ GetMaxDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set's MIN data edit control value to MAX-99 */
|
/* Set's MIN data edit control value to MAX-99 */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
SetMinData(HWND hwndDlg)
|
SetMinData(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
HWND hWndYearSpin;
|
||||||
|
INT nSpinVal;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Get spin value */
|
/* Get spin value */
|
||||||
INT nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
nSpinVal = LOWORD(SendMessage(hWndYearSpin,
|
||||||
UDM_GETPOS,
|
UDM_GETPOS,
|
||||||
0,
|
0,
|
||||||
0));
|
0));
|
||||||
|
|
||||||
/* Set min year value */
|
/* Set min year value */
|
||||||
wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal-YEAR_DIFF);
|
wsprintf(OutBuffer, _T("%d"), (DWORD)nSpinVal - YEAR_DIFF);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init spin control */
|
/* Init spin control */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
InitMinMaxDateSpin(HWND hwndDlg)
|
InitMinMaxDateSpin(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
HWND hWndYearSpin;
|
||||||
|
|
||||||
|
hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
/* Init max date value */
|
/* Init max date value */
|
||||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate());
|
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate());
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Init min date value */
|
/* Init min date value */
|
||||||
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate()-YEAR_DIFF);
|
wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate()-YEAR_DIFF);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Init updown control */
|
/* Init updown control */
|
||||||
/* Set bounds */
|
/* Set bounds */
|
||||||
SendMessageW(hWndYearSpin,
|
SendMessage(hWndYearSpin,
|
||||||
UDM_SETRANGE,
|
UDM_SETRANGE,
|
||||||
0,
|
0,
|
||||||
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||||
|
|
||||||
/* Set current value */
|
/* Set current value */
|
||||||
SendMessageW(hWndYearSpin,
|
SendMessage(hWndYearSpin,
|
||||||
UDM_SETPOS,
|
UDM_SETPOS,
|
||||||
0,
|
0,
|
||||||
MAKELONG(GetMaxDate(),0));
|
MAKELONG(GetMaxDate(),0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all date locale samples */
|
/* Update all date locale samples */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
UpdateDateLocaleSamples(HWND hwndDlg,
|
UpdateDateLocaleSamples(HWND hwndDlg,
|
||||||
LCID lcidLocale)
|
LCID lcidLocale)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
/* Get short date format sample */
|
/* Get short date format sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||||
0, (LPARAM)OutBuffer);
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get long date sample */
|
/* Get long date sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,15 +543,14 @@ DatePageProc(HWND hwndDlg,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
|
||||||
InitMinMaxDateSpin(hwndDlg);
|
InitMinMaxDateSpin(hwndDlg);
|
||||||
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
InitShortDateCB(hwndDlg);
|
InitShortDateCB(hwndDlg);
|
||||||
InitLongDateCB(hwndDlg);
|
InitLongDateCB(hwndDlg);
|
||||||
InitShortDateSepSamples(hwndDlg);
|
InitShortDateSepSamples(hwndDlg);
|
||||||
/* TODO: Add other calendar types */
|
/* TODO: Add other calendar types */
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
|
@ -609,6 +603,7 @@ DatePageProc(HWND hwndDlg,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,41 +26,39 @@
|
||||||
* Aleksey Bragin
|
* Aleksey Bragin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WINVER 0x0501
|
|
||||||
#define SAMPLE_NUMBER L"123456789"
|
|
||||||
#define NO_FLAG 0
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define SAMPLE_NUMBER _T("123456789")
|
||||||
|
#define NO_FLAG 0
|
||||||
|
|
||||||
HWND hList;
|
HWND hList;
|
||||||
HWND hLocaleList, hGeoList;
|
HWND hLocaleList, hGeoList;
|
||||||
|
|
||||||
BOOL CALLBACK LocalesEnumProc(
|
BOOL CALLBACK
|
||||||
LPTSTR lpLocale // locale id
|
LocalesEnumProc(LPTSTR lpLocale)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
LCID lcid;
|
LCID lcid;
|
||||||
TCHAR lang[255];
|
TCHAR lang[255];
|
||||||
int index;
|
INT index;
|
||||||
|
|
||||||
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
//swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
|
||||||
lcid = wcstoul(lpLocale, NULL, 16);
|
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,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)lang);
|
(LPARAM)lang);
|
||||||
|
|
||||||
SendMessageW(hList,
|
SendMessage(hList,
|
||||||
CB_SETITEMDATA,
|
CB_SETITEMDATA,
|
||||||
index,
|
index,
|
||||||
(LPARAM)lcid);
|
(LPARAM)lcid);
|
||||||
|
@ -69,41 +67,40 @@ BOOL CALLBACK LocalesEnumProc(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all locale samples */
|
/* Update all locale samples */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
/* Get number format sample */
|
/* Get number format sample */
|
||||||
GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get monetary format sample */
|
/* 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);
|
OutBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get time format sample */
|
/* Get time format sample */
|
||||||
GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get short date format sample */
|
/* Get short date format sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
||||||
0, (LPARAM)OutBuffer);
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get long date sample */
|
/* Get long date sample */
|
||||||
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
||||||
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,19 +110,20 @@ CreateLanguagesList(HWND hwnd)
|
||||||
TCHAR langSel[255];
|
TCHAR langSel[255];
|
||||||
|
|
||||||
hList = hwnd;
|
hList = hwnd;
|
||||||
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
|
||||||
|
|
||||||
// Select current locale
|
// Select current locale
|
||||||
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
|
||||||
|
|
||||||
SendMessageW(hList,
|
SendMessage(hList,
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)langSel);
|
(LPARAM)langSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets new locale
|
// Sets new locale
|
||||||
void SetNewLocale(LCID lcid)
|
VOID
|
||||||
|
SetNewLocale(LCID lcid)
|
||||||
{
|
{
|
||||||
// HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
|
// HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
|
||||||
// HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
|
// HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
|
||||||
|
@ -137,111 +135,113 @@ void SetNewLocale(LCID lcid)
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
TCHAR value[9];
|
TCHAR value[9];
|
||||||
DWORD valuesize;
|
DWORD valuesize;
|
||||||
WCHAR ACPPage[9];
|
TCHAR ACPPage[9];
|
||||||
WCHAR OEMPage[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)
|
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;
|
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)
|
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;
|
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)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// some serious error
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintf(value, L"%04X", (DWORD)lcid);
|
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);
|
RegSetValueEx(localeKey, _T("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);
|
|
||||||
RegCloseKey(localeKey);
|
RegCloseKey(localeKey);
|
||||||
|
|
||||||
// Set language
|
// 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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize );
|
RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||||
RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE *)value, valuesize );
|
RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value, valuesize );
|
||||||
|
|
||||||
RegCloseKey(langKey);
|
RegCloseKey(langKey);
|
||||||
|
|
||||||
|
|
||||||
// Set language
|
/* Set language */
|
||||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
|
ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
|
||||||
|
|
||||||
if (ret != ERROR_SUCCESS)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR) );
|
RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
|
||||||
RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR) );
|
RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
|
||||||
|
|
||||||
RegCloseKey(langKey);
|
RegCloseKey(langKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Location enumerate procedure */
|
/* Location enumerate procedure */
|
||||||
|
#if 0
|
||||||
BOOL
|
BOOL
|
||||||
CALLBACK
|
CALLBACK
|
||||||
LocationsEnumProc(GEOID gId)
|
LocationsEnumProc(GEOID gId)
|
||||||
{
|
{
|
||||||
TCHAR loc[MAX_STR_SIZE];
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
int index;
|
INT index;
|
||||||
|
|
||||||
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
||||||
index = (int) SendMessageW(hGeoList,
|
index = (INT)SendMessage(hGeoList,
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)loc);
|
(LPARAM)loc);
|
||||||
|
|
||||||
SendMessageW(hGeoList,
|
SendMessage(hGeoList,
|
||||||
CB_SETITEMDATA,
|
CB_SETITEMDATA,
|
||||||
index,
|
index,
|
||||||
(LPARAM)gId);
|
(LPARAM)gId);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enumerate all system locations identifiers */
|
/* Enumerate all system locations identifiers */
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
CreateLocationsList(HWND hWnd)
|
CreateLocationsList(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
GEOID userGeoID;
|
GEOID userGeoID;
|
||||||
TCHAR loc[MAX_STR_SIZE];
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
|
|
||||||
|
@ -257,16 +257,18 @@ CreateLocationsList(HWND hWnd)
|
||||||
MAX_FMT_SIZE,
|
MAX_FMT_SIZE,
|
||||||
LANG_SYSTEM_DEFAULT);
|
LANG_SYSTEM_DEFAULT);
|
||||||
|
|
||||||
SendMessageW(hGeoList,
|
SendMessage(hGeoList,
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
(WPARAM) -1,
|
(WPARAM) -1,
|
||||||
(LPARAM)loc);
|
(LPARAM)loc);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
VerifyUnattendLCID(HWND hwndDlg)
|
VerifyUnattendLCID(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
LRESULT lCount, lIndex, lResult;
|
LRESULT lCount, lIndex, lResult;
|
||||||
|
|
||||||
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
||||||
if (lCount == CB_ERR)
|
if (lCount == CB_ERR)
|
||||||
{
|
{
|
||||||
|
@ -340,14 +342,14 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
int iCurSel;
|
int iCurSel;
|
||||||
|
|
||||||
// Acquire new value
|
// Acquire new value
|
||||||
iCurSel = SendMessageW(hList,
|
iCurSel = SendMessage(hList,
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
if (iCurSel == CB_ERR)
|
if (iCurSel == CB_ERR)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
NewLcid = SendMessageW(hList,
|
NewLcid = SendMessage(hList,
|
||||||
CB_GETITEMDATA,
|
CB_GETITEMDATA,
|
||||||
iCurSel,
|
iCurSel,
|
||||||
0);
|
0);
|
||||||
|
@ -355,7 +357,6 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
if (NewLcid == (LCID)CB_ERR)
|
if (NewLcid == (LCID)CB_ERR)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
// Actually set new locale
|
// Actually set new locale
|
||||||
SetNewLocale(NewLcid);
|
SetNewLocale(NewLcid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
OpenSetupInf()
|
OpenSetupInf(VOID)
|
||||||
{
|
{
|
||||||
LPTSTR lpCmdLine;
|
LPTSTR lpCmdLine;
|
||||||
LPTSTR lpSwitch;
|
LPTSTR lpSwitch;
|
||||||
|
@ -101,7 +101,7 @@ OpenSetupInf()
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ParseSetupInf()
|
ParseSetupInf(VOID)
|
||||||
{
|
{
|
||||||
INFCONTEXT InfContext;
|
INFCONTEXT InfContext;
|
||||||
TCHAR szBuffer[30];
|
TCHAR szBuffer[30];
|
||||||
|
|
|
@ -82,11 +82,11 @@ TimePageProc(HWND hwndDlg,
|
||||||
void SetNewLocale(LCID lcid);
|
void SetNewLocale(LCID lcid);
|
||||||
|
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
|
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr);
|
||||||
|
|
||||||
WCHAR*
|
LPTSTR
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
|
ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl);
|
||||||
|
|
||||||
LONG
|
LONG
|
||||||
APIENTRY
|
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" />
|
<importlibrary definition="intl.def" />
|
||||||
<include base="intl">.</include>
|
<include base="intl">.</include>
|
||||||
<define name="UNICODE" />
|
|
||||||
<define name="_UNICODE" />
|
|
||||||
<define name="__REACTOS__" />
|
<define name="__REACTOS__" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<define name="_WIN32_IE">0x600</define>
|
<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>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>comctl32</library>
|
<library>comctl32</library>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -12,11 +13,13 @@ LanguagesPageProc(HWND hwndDlg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOW shInputDll;
|
SHELLEXECUTEINFO shInputDll;
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -24,24 +27,25 @@ LanguagesPageProc(HWND hwndDlg,
|
||||||
case IDC_DETAIL_BUTTON:
|
case IDC_DETAIL_BUTTON:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
|
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
|
||||||
shInputDll.cbSize = sizeof(shInputDll);
|
shInputDll.cbSize = sizeof(shInputDll);
|
||||||
shInputDll.hwnd = hwndDlg;
|
shInputDll.hwnd = hwndDlg;
|
||||||
shInputDll.lpVerb = L"open";
|
shInputDll.lpVerb = _T("open");
|
||||||
shInputDll.lpFile = L"RunDll32.exe";
|
shInputDll.lpFile = _T("RunDll32.exe");
|
||||||
shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
|
shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL input.dll");
|
||||||
if(ShellExecuteExW(&shInputDll)==0)
|
if (ShellExecuteEx(&shInputDll) == 0)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"Can't start input.dll", L"Error", MB_OK | MB_ICONERROR);
|
MessageBox(NULL,
|
||||||
|
_T("Can't start input.dll"),
|
||||||
|
_T("Error"),
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -8,68 +9,69 @@
|
||||||
#define NUM_SHEETS 4
|
#define NUM_SHEETS 4
|
||||||
|
|
||||||
/* Insert the space */
|
/* Insert the space */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
InsSpacePos(LPCTSTR szInsStr, const int nPos)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
INT nDestStrCnt = 0;
|
||||||
|
INT nStrCnt;
|
||||||
|
INT nStrSize;
|
||||||
|
|
||||||
int nDestStrCnt=0;
|
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
int nStrCnt;
|
|
||||||
int nStrSize;
|
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszInsStr);
|
_tcscpy(pszDestStr, szInsStr);
|
||||||
|
|
||||||
nStrSize = wcslen(wszInsStr);
|
nStrSize = _tcslen(szInsStr);
|
||||||
|
|
||||||
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||||
{
|
{
|
||||||
if (nStrCnt == nStrSize - nPos)
|
if (nStrCnt == nStrSize - nPos)
|
||||||
{
|
{
|
||||||
pwszDestStr[nDestStrCnt]=' ';
|
pszDestStr[nDestStrCnt] = _T(' ');
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
|
||||||
nDestStrCnt++;
|
|
||||||
}
|
|
||||||
pwszDestStr[nDestStrCnt]='\0';
|
|
||||||
|
|
||||||
return pwszDestStr;
|
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszDestStr[nDestStrCnt] = _T('\0');
|
||||||
|
|
||||||
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the spaces by format string separated by ';' */
|
/* Insert the spaces by format string separated by ';' */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(255);
|
LPTSTR pszTempStr;
|
||||||
|
TCHAR szFmtVal[255];
|
||||||
WCHAR* pwszTempStr;
|
INT nFmtCount = 0;
|
||||||
|
INT nValCount = 0;
|
||||||
WCHAR wszFmtVal[255];
|
INT nLastVal = 0;
|
||||||
|
INT nSpaceOffset = 0;
|
||||||
int nFmtCount=0;
|
|
||||||
int nValCount=0;
|
|
||||||
int nLastVal=0;
|
|
||||||
int nSpaceOffset=0;
|
|
||||||
|
|
||||||
BOOL wasNul=FALSE;
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszSourceStr);
|
pszDestStr = (LPTSTR)malloc(255 * sizeof(TCHAR));
|
||||||
|
|
||||||
|
_tcscpy(pszDestStr, szSourceStr);
|
||||||
|
|
||||||
/* if format is clean return source string */
|
/* if format is clean return source string */
|
||||||
if(!*wszFmtStr) return pwszDestStr;
|
if (!*szFmtStr)
|
||||||
|
return pszDestStr;
|
||||||
|
|
||||||
/* Search for all format values */
|
/* 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;
|
wasNul=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If was 0, repeat spaces */
|
/* If was 0, repeat spaces */
|
||||||
if (wasNul)
|
if (wasNul)
|
||||||
{
|
{
|
||||||
|
@ -77,70 +79,71 @@ InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||||
}
|
}
|
||||||
else
|
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 */
|
|
||||||
|
|
||||||
|
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)
|
if (!wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset++;
|
nSpaceOffset++;
|
||||||
nLastVal=_wtoi(wszFmtVal);
|
nLastVal = _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create spaces for rest part of string */
|
/* 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);
|
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
_tcscpy(pszDestStr, pszTempStr);
|
||||||
free(pwszTempStr);
|
free(pszTempStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pwszDestStr;
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
ReplaceSubStr(LPCTSTR szSourceStr,
|
||||||
const WCHAR *wszStrToReplace,
|
LPCTSTR szStrToReplace,
|
||||||
const WCHAR *wszTempl)
|
LPCTSTR szTempl)
|
||||||
{
|
{
|
||||||
int nCharCnt;
|
LPTSTR szDestStr;
|
||||||
int nSubStrCnt;
|
INT nCharCnt;
|
||||||
int nDestStrCnt;
|
INT nSubStrCnt;
|
||||||
int nFirstCharCnt;
|
INT nDestStrCnt;
|
||||||
|
INT nFirstCharCnt;
|
||||||
|
|
||||||
WCHAR* wszDestStr;
|
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
|
||||||
|
|
||||||
nDestStrCnt = 0;
|
nDestStrCnt = 0;
|
||||||
nFirstCharCnt = 0;
|
nFirstCharCnt = 0;
|
||||||
|
|
||||||
wcscpy(wszDestStr,L"");
|
_tcscpy(szDestStr, _T(""));
|
||||||
|
|
||||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
while (nFirstCharCnt < _tcslen(szSourceStr))
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||||
{
|
{
|
||||||
nSubStrCnt = 0;
|
nSubStrCnt = 0;
|
||||||
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + _tcslen(szTempl); nCharCnt++)
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
|
||||||
{
|
{
|
||||||
nSubStrCnt++;
|
nSubStrCnt++;
|
||||||
}
|
}
|
||||||
|
@ -148,24 +151,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
|
||||||
|
if (_tcslen(szTempl) == nSubStrCnt)
|
||||||
{
|
{
|
||||||
wcscat(wszDestStr,wszStrToReplace);
|
_tcscat(szDestStr, szStrToReplace);
|
||||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
nDestStrCnt = _tcslen(szDestStr);
|
||||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
nFirstCharCnt += _tcslen(szTempl) - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
|
||||||
wszDestStr[nDestStrCnt]='\0';
|
szDestStr[nDestStrCnt] = _T('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
nFirstCharCnt++;
|
nFirstCharCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wszDestStr;
|
return szDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create applets */
|
/* Create applets */
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define SAMPLE_NUMBER L"123456789"
|
#define SAMPLE_NUMBER _T("123456789")
|
||||||
#define SAMPLE_NEG_NUMBER L"-123456789"
|
#define SAMPLE_NEG_NUMBER _T("-123456789")
|
||||||
#define MAX_NUM_SEP_SAMPLES 2
|
#define MAX_NUM_SEP_SAMPLES 2
|
||||||
#define MAX_FRAC_NUM_SAMPLES 9
|
#define MAX_FRAC_NUM_SAMPLES 9
|
||||||
#define MAX_FIELD_SEP_SAMPLES 1
|
#define MAX_FIELD_SEP_SAMPLES 1
|
||||||
|
@ -42,130 +43,114 @@
|
||||||
#define MAX_LEAD_ZEROES_SAMPLES 2
|
#define MAX_LEAD_ZEROES_SAMPLES 2
|
||||||
#define MAX_LIST_SEP_SAMPLES 1
|
#define MAX_LIST_SEP_SAMPLES 1
|
||||||
#define MAX_UNITS_SYS_SAMPLES 2
|
#define MAX_UNITS_SYS_SAMPLES 2
|
||||||
#define EOLN_SIZE sizeof(WCHAR)
|
|
||||||
|
|
||||||
/* Init num decimal separator control box */
|
/* Init num decimal separator control box */
|
||||||
VOID
|
static VOID
|
||||||
InitNumDecimalSepCB(HWND hwndDlg)
|
InitNumDecimalSepCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNumSepSamples[MAX_NUM_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES] = {_T(","), _T(".")};
|
||||||
{
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
L",",
|
INT nCBIndex;
|
||||||
L"."
|
INT nRetCode;
|
||||||
};
|
|
||||||
|
|
||||||
int nCBIndex;
|
|
||||||
int nRetCode;
|
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current decimal separator */
|
/* Get current decimal separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SDECIMAL,
|
LOCALE_SDECIMAL,
|
||||||
wszNumSep,
|
szNumSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Create standart list of decimal separators */
|
/* Create standard list of decimal separators */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszNumSepSamples[nCBIndex]);
|
(LPARAM)lpNumSepSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszNumSep);
|
(LPARAM)(LPCSTR)szNumSep);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if (nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_NUM_SEP_SAMPLES+1,
|
MAX_NUM_SEP_SAMPLES,
|
||||||
(LPARAM)wszNumSep);
|
(LPARAM)szNumSep);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszNumSep);
|
(LPARAM)szNumSep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init number of fractional symbols control box */
|
/* Init number of fractional symbols control box */
|
||||||
VOID
|
static VOID
|
||||||
InitNumOfFracSymbCB(HWND hwndDlg)
|
InitNumOfFracSymbCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
int nCBIndex;
|
TCHAR szFracNum[MAX_SAMPLES_STR_SIZE];
|
||||||
int nRetCode;
|
TCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCBIndex;
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
INT nRetCode;
|
||||||
WCHAR wszFracNum[MAX_SAMPLES_STR_SIZE];
|
|
||||||
WCHAR wszFracCount[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current number of fractional symbols */
|
/* Get current number of fractional symbols */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_IDIGITS,
|
LOCALE_IDIGITS,
|
||||||
wszFracNum,
|
szFracNum,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Create standart list of fractional symbols */
|
/* Create standard list of fractional symbols */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCBIndex,wszFracCount,DECIMAL_RADIX);
|
_itot(nCBIndex, szFracCount, DECIMAL_RADIX);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszFracCount);
|
(LPARAM)szFracCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
(WPARAM)_wtoi(wszFracNum),
|
(WPARAM)_ttoi(szFracNum),
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init field separator control box */
|
/* Init field separator control box */
|
||||||
VOID
|
static VOID
|
||||||
InitNumFieldSepCB(HWND hwndDlg)
|
InitNumFieldSepCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFieldSepSamples[MAX_FIELD_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES] = {_T(" ")};
|
||||||
{
|
TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
L" "
|
INT nCBIndex;
|
||||||
};
|
INT nRetCode;
|
||||||
|
|
||||||
int nCBIndex;
|
|
||||||
int nRetCode;
|
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current field separator */
|
/* Get current field separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_STHOUSAND,
|
LOCALE_STHOUSAND,
|
||||||
wszFieldSep,
|
szFieldSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -173,58 +158,56 @@ InitNumFieldSepCB(HWND hwndDlg)
|
||||||
/* Create standart list of field separators */
|
/* Create standart list of field separators */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszFieldSepSamples[nCBIndex]);
|
(LPARAM)lpFieldSepSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszFieldSep);
|
(LPARAM)szFieldSep);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if (nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_FIELD_SEP_SAMPLES+1,
|
MAX_FIELD_SEP_SAMPLES+1,
|
||||||
(LPARAM)wszFieldSep);
|
(LPARAM)szFieldSep);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszFieldSep);
|
(LPARAM)szFieldSep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init number of digidts in field control box */
|
/* Init number of digidts in field control box */
|
||||||
VOID
|
static VOID
|
||||||
InitFieldDigNumCB(HWND hwndDlg)
|
InitFieldDigNumCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"0;0",
|
_T("0;0"),
|
||||||
L"3;0",
|
_T("3;0"),
|
||||||
L"3;2;0"
|
_T("3;2;0")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCBIndex;
|
TCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
||||||
int nRetCode;
|
LPTSTR pszFieldDigNumSmpl;
|
||||||
|
INT nCBIndex;
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
INT nRetCode;
|
||||||
WCHAR wszFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
|
||||||
WCHAR* pwszFieldDigNumSmpl;
|
|
||||||
|
|
||||||
/* Get current field digits num */
|
/* Get current field digits num */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SGROUPING,
|
LOCALE_SGROUPING,
|
||||||
wszFieldDigNum,
|
szFieldDigNum,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -233,60 +216,54 @@ InitFieldDigNumCB(HWND hwndDlg)
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
|
|
||||||
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNumSamples[nCBIndex]);
|
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)pwszFieldDigNumSmpl);
|
(LPARAM)pszFieldDigNumSmpl);
|
||||||
free(pwszFieldDigNumSmpl);
|
free(pszFieldDigNumSmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNum);
|
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, szFieldDigNum);
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
(LPARAM)pszFieldDigNumSmpl);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if (nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_FIELD_DIG_SAMPLES+1,
|
MAX_FIELD_DIG_SAMPLES+1,
|
||||||
(LPARAM)pwszFieldDigNumSmpl);
|
(LPARAM)pszFieldDigNumSmpl);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
(LPARAM)pszFieldDigNumSmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pwszFieldDigNumSmpl);
|
free(pszFieldDigNumSmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init negative sign control box */
|
/* Init negative sign control box */
|
||||||
VOID
|
static VOID
|
||||||
InitNegSignCB(HWND hwndDlg)
|
InitNegSignCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegSignSamples[MAX_NEG_SIGN_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES] = {_T("-")};
|
||||||
{
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
L"-"
|
INT nCBIndex;
|
||||||
};
|
INT nRetCode;
|
||||||
|
|
||||||
int nCBIndex;
|
|
||||||
int nRetCode;
|
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current negative sign */
|
/* Get current negative sign */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SNEGATIVESIGN,
|
LOCALE_SNEGATIVESIGN,
|
||||||
wszNegSign,
|
szNegSign,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -294,184 +271,174 @@ InitNegSignCB(HWND hwndDlg)
|
||||||
/* Create standart list of signs */
|
/* Create standart list of signs */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszNegSignSamples[nCBIndex]);
|
(LPARAM)lpNegSignSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszNegSign);
|
(LPARAM)szNegSign);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if (nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_NUM_SEP_SAMPLES+1,
|
MAX_NUM_SEP_SAMPLES+1,
|
||||||
(LPARAM)wszNegSign);
|
(LPARAM)szNegSign);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszNegSign);
|
(LPARAM)szNegSign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init negative numbers format control box */
|
/* Init negative numbers format control box */
|
||||||
VOID
|
static VOID
|
||||||
InitNegNumFmtCB(HWND hwndDlg)
|
InitNegNumFmtCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"(1,1)",
|
_T("(1,1)"),
|
||||||
L"-1,1",
|
_T("-1,1"),
|
||||||
L"- 1,1",
|
_T("- 1,1"),
|
||||||
L"1,1-",
|
_T("1,1-"),
|
||||||
L"1,1 -"
|
_T("1,1 -")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCBIndex;
|
TCHAR szNegNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nRetCode;
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszNegNumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szNewSample[MAX_SAMPLES_STR_SIZE];
|
||||||
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
LPTSTR pszResultStr;
|
||||||
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
INT nCBIndex;
|
||||||
WCHAR wszNewSample[MAX_SAMPLES_STR_SIZE];
|
INT nRetCode;
|
||||||
WCHAR* pwszResultStr;
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
|
|
||||||
/* Get current negative numbers format */
|
/* Get current negative numbers format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_INEGNUMBER,
|
LOCALE_INEGNUMBER,
|
||||||
wszNegNumFmt,
|
szNegNumFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Get current decimal separator */
|
/* Get current decimal separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SDECIMAL,
|
LOCALE_SDECIMAL,
|
||||||
wszNumSep,
|
szNumSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Get current negative sign */
|
/* Get current negative sign */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SNEGATIVESIGN,
|
LOCALE_SNEGATIVESIGN,
|
||||||
wszNegSign,
|
szNegSign,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Create standart list of negative numbers formats */
|
/* Create standart list of negative numbers formats */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
/* Replace standart separator to setted */
|
/* Replace standart separator to setted */
|
||||||
pwszResultStr = ReplaceSubStr(wszNegNumFmtSamples[nCBIndex],
|
pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
|
||||||
wszNumSep,
|
szNumSep,
|
||||||
L",");
|
_T(","));
|
||||||
wcscpy(wszNewSample,pwszResultStr);
|
_tcscpy(szNewSample, pszResultStr);
|
||||||
free(pwszResultStr);
|
free(pszResultStr);
|
||||||
/* Replace standart negative sign to setted */
|
/* Replace standart negative sign to setted */
|
||||||
pwszResultStr = ReplaceSubStr(wszNewSample,
|
pszResultStr = ReplaceSubStr(szNewSample,
|
||||||
wszNegSign,
|
szNegSign,
|
||||||
L"-");
|
_T("-"));
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)pwszResultStr);
|
(LPARAM)pszResultStr);
|
||||||
free(pwszResultStr);
|
free(pszResultStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
(WPARAM)_wtoi(wszNegNumFmt),
|
(WPARAM)_ttoi(szNegNumFmt),
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init leading zeroes control box */
|
/* Init leading zeroes control box */
|
||||||
VOID
|
static VOID
|
||||||
InitLeadingZeroesCB(HWND hwndDlg)
|
InitLeadingZeroesCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES] =
|
||||||
{
|
{
|
||||||
L",7",
|
_T(",7"),
|
||||||
L"0,7"
|
_T("0,7")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCBIndex;
|
TCHAR szLeadNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
int nRetCode;
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
LPTSTR pszResultStr;
|
||||||
WCHAR wszLeadNumFmt[MAX_SAMPLES_STR_SIZE];
|
INT nCBIndex;
|
||||||
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
INT nRetCode;
|
||||||
WCHAR* pwszResultStr;
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
|
|
||||||
/* Get current leading zeroes format */
|
/* Get current leading zeroes format */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_ILZERO,
|
LOCALE_ILZERO,
|
||||||
wszLeadNumFmt,
|
szLeadNumFmt,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Get current decimal separator */
|
/* Get current decimal separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SDECIMAL,
|
LOCALE_SDECIMAL,
|
||||||
wszNumSep,
|
szNumSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Create list of standart leading zeroes formats */
|
/* Create list of standart leading zeroes formats */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
pwszResultStr = ReplaceSubStr(wszLeadNumFmtSamples[nCBIndex],
|
pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
|
||||||
wszNumSep,
|
szNumSep,
|
||||||
L",");
|
_T(","));
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)pwszResultStr);
|
(LPARAM)pszResultStr);
|
||||||
free(pwszResultStr);
|
free(pszResultStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
(WPARAM)_wtoi(wszLeadNumFmt),
|
(WPARAM)_ttoi(szLeadNumFmt),
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
static VOID
|
||||||
InitListSepCB(HWND hwndDlg)
|
InitListSepCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszListSepSamples[MAX_LIST_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] = {_T(";")};
|
||||||
{
|
TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
||||||
L";"
|
INT nCBIndex;
|
||||||
};
|
INT nRetCode;
|
||||||
|
|
||||||
int nCBIndex;
|
|
||||||
int nRetCode;
|
|
||||||
|
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current list separator */
|
/* Get current list separator */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SLIST,
|
LOCALE_SLIST,
|
||||||
wszListSep,
|
szListSep,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -479,29 +446,29 @@ InitListSepCB(HWND hwndDlg)
|
||||||
/* Create standart list of signs */
|
/* Create standart list of signs */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszListSepSamples[nCBIndex]);
|
(LPARAM)lpListSepSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszListSep);
|
(LPARAM)szListSep);
|
||||||
|
|
||||||
/* if is not success, add new value to list and select them */
|
/* if is not success, add new value to list and select them */
|
||||||
if (nRetCode == CB_ERR)
|
if (nRetCode == CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
MAX_LIST_SEP_SAMPLES+1,
|
MAX_LIST_SEP_SAMPLES+1,
|
||||||
(LPARAM)wszListSep);
|
(LPARAM)szListSep);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
CB_SELECTSTRING,
|
CB_SELECTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)(LPCSTR)wszListSep);
|
(LPARAM)szListSep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,26 +476,24 @@ InitListSepCB(HWND hwndDlg)
|
||||||
VOID
|
VOID
|
||||||
InitUnitsSysCB(HWND hwndDlg)
|
InitUnitsSysCB(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszUnitsSysSamples[MAX_UNITS_SYS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpUnitsSysSamples[MAX_UNITS_SYS_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"Metrics",
|
_T("Metrics"),
|
||||||
L"Americans"
|
_T("Americans")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCBIndex;
|
TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||||
int nRetCode;
|
INT nCBIndex;
|
||||||
|
INT nRetCode;
|
||||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
|
||||||
WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
|
|
||||||
|
|
||||||
/* Get current system of units */
|
/* Get current system of units */
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_IMEASURE,
|
LOCALE_IMEASURE,
|
||||||
wszUnitsSys,
|
szUnitsSys,
|
||||||
dwValueSize);
|
MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
/* Clear all box content */
|
/* Clear all box content */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
CB_RESETCONTENT,
|
CB_RESETCONTENT,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
@ -536,182 +501,181 @@ InitUnitsSysCB(HWND hwndDlg)
|
||||||
/* Create list of standart system of units */
|
/* Create list of standart system of units */
|
||||||
for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
|
for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
nCBIndex,
|
nCBIndex,
|
||||||
(LPARAM)wszUnitsSysSamples[nCBIndex]);
|
(LPARAM)lpUnitsSysSamples[nCBIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current item to value from registry */
|
/* Set current item to value from registry */
|
||||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
(WPARAM)_wtoi(wszUnitsSys),
|
(WPARAM)_ttoi(szUnitsSys),
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all numbers locale samples */
|
/* Update all numbers locale samples */
|
||||||
static
|
static VOID
|
||||||
VOID
|
|
||||||
UpdateNumSamples(HWND hwndDlg,
|
UpdateNumSamples(HWND hwndDlg,
|
||||||
LCID lcidLocale)
|
LCID lcidLocale)
|
||||||
{
|
{
|
||||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
/* Get positive number format sample */
|
/* Get positive number format sample */
|
||||||
GetNumberFormatW(lcidLocale,
|
GetNumberFormat(lcidLocale,
|
||||||
0,
|
0,
|
||||||
SAMPLE_NUMBER,
|
SAMPLE_NUMBER,
|
||||||
NULL,
|
NULL,
|
||||||
OutBuffer,
|
OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
/* Get positive number format sample */
|
/* Get positive number format sample */
|
||||||
GetNumberFormatW(lcidLocale,
|
GetNumberFormat(lcidLocale,
|
||||||
0,
|
0,
|
||||||
SAMPLE_NEG_NUMBER,
|
SAMPLE_NEG_NUMBER,
|
||||||
NULL,
|
NULL,
|
||||||
OutBuffer,
|
OutBuffer,
|
||||||
MAX_FMT_SIZE);
|
MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
|
||||||
WM_SETTEXT,
|
WM_SETTEXT,
|
||||||
0,
|
0,
|
||||||
(LPARAM)OutBuffer);
|
(LPARAM)OutBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set num decimal separator */
|
/* Set num decimal separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumDecimalSep(HWND hwndDlg)
|
SetNumDecimalSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszDecimalSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szDecimalSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted decimal separator */
|
/* Get setted decimal separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszDecimalSep);
|
(LPARAM)szDecimalSep);
|
||||||
|
|
||||||
/* Save decimal separator */
|
/* Save decimal separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDecimalSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of fractional symbols */
|
/* Set number of fractional symbols */
|
||||||
BOOL
|
static BOOL
|
||||||
SetFracSymNum(HWND hwndDlg)
|
SetFracSymNum(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFracSymNum[MAX_SAMPLES_STR_SIZE];
|
TCHAR szFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of fractional symbols */
|
/* Get setted number of fractional symbols */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszFracSymNum,DECIMAL_RADIX);
|
_itot(nCurrSel, szFracSymNum, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save number of fractional symbols */
|
/* Save number of fractional symbols */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDIGITS, wszFracSymNum);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDIGITS, szFracSymNum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set field separator */
|
/* Set field separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumFieldSep(HWND hwndDlg)
|
SetNumFieldSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted field separator */
|
/* Get setted field separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszFieldSep);
|
(LPARAM)szFieldSep);
|
||||||
|
|
||||||
/* Save field separator */
|
/* Save field separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wszFieldSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szFieldSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set number of digidts in field */
|
/* Set number of digidts in field */
|
||||||
BOOL
|
static BOOL
|
||||||
SetFieldDigNum(HWND hwndDlg)
|
SetFieldDigNum(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
LPTSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
|
||||||
{
|
{
|
||||||
L"0;0",
|
_T("0;0"),
|
||||||
L"3;0",
|
_T("3;0"),
|
||||||
L"3;2;0"
|
_T("3;2;0")
|
||||||
};
|
};
|
||||||
|
|
||||||
int nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted number of digidts in field */
|
/* Get setted number of digidts in field */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
nCurrSel=SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* Save number of digidts in field */
|
/* Save number of digidts in field */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, lpFieldDigNumSamples[nCurrSel]);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set negative sign */
|
/* Set negative sign */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumNegSign(HWND hwndDlg)
|
SetNumNegSign(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted negative sign */
|
/* Get setted negative sign */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszNegSign);
|
(LPARAM)szNegSign);
|
||||||
|
|
||||||
/* Save negative sign */
|
/* Save negative sign */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, wszNegSign);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, szNegSign);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set negative sum format */
|
/* Set negative sum format */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNegSumFmt(HWND hwndDlg)
|
SetNegSumFmt(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszNegSumFmt[MAX_SAMPLES_STR_SIZE];
|
TCHAR szNegSumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted negative sum format */
|
/* Get setted negative sum format */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszNegSumFmt,DECIMAL_RADIX);
|
_itot(nCurrSel, szNegSumFmt,DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save negative sum format */
|
/* Save negative sum format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, wszNegSumFmt);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, szNegSumFmt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set leading zero */
|
/* Set leading zero */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumLeadZero(HWND hwndDlg)
|
SetNumLeadZero(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszLeadZero[MAX_SAMPLES_STR_SIZE];
|
TCHAR szLeadZero[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted leading zero format */
|
/* Get setted leading zero format */
|
||||||
|
@ -721,50 +685,50 @@ SetNumLeadZero(HWND hwndDlg)
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszLeadZero,DECIMAL_RADIX);
|
_itot(nCurrSel, szLeadZero, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save leading zero format */
|
/* Save leading zero format */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ILZERO, wszLeadZero);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, szLeadZero);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set elements list separator */
|
/* Set elements list separator */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumListSep(HWND hwndDlg)
|
SetNumListSep(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
|
TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
/* Get setted list separator */
|
/* Get setted list separator */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
(LPARAM)(LPCSTR)wszListSep);
|
(LPARAM)szListSep);
|
||||||
|
|
||||||
/* Save list separator */
|
/* Save list separator */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLIST, wszListSep);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, szListSep);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set units system */
|
/* Set units system */
|
||||||
BOOL
|
static BOOL
|
||||||
SetNumUnitsSys(HWND hwndDlg)
|
SetNumUnitsSys(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
|
TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||||
INT nCurrSel;
|
INT nCurrSel;
|
||||||
|
|
||||||
/* Get setted units system */
|
/* Get setted units system */
|
||||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
CB_GETCURSEL,
|
CB_GETCURSEL,
|
||||||
(WPARAM)0,
|
(WPARAM)0,
|
||||||
(LPARAM)0);
|
(LPARAM)0);
|
||||||
|
|
||||||
/* convert to wide char */
|
/* convert to wide char */
|
||||||
_itow(nCurrSel,wszUnitsSys,DECIMAL_RADIX);
|
_itot(nCurrSel, szUnitsSys, DECIMAL_RADIX);
|
||||||
|
|
||||||
/* Save units system */
|
/* Save units system */
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, wszUnitsSys);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, szUnitsSys);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -22,68 +23,69 @@
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
/* Insert the space */
|
/* Insert the space */
|
||||||
WCHAR*
|
TCHAR*
|
||||||
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
InsSpacePos(const TCHAR *szInsStr, const int nPos)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
|
||||||
|
|
||||||
int nDestStrCnt=0;
|
int nDestStrCnt=0;
|
||||||
int nStrCnt;
|
int nStrCnt;
|
||||||
int nStrSize;
|
int nStrSize;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszInsStr);
|
pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
|
|
||||||
nStrSize = wcslen(wszInsStr);
|
_tcscpy(pszDestStr, szInsStr);
|
||||||
|
|
||||||
|
nStrSize = _tcslen(szInsStr);
|
||||||
|
|
||||||
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
|
||||||
{
|
{
|
||||||
if (nStrCnt == nStrSize - nPos)
|
if (nStrCnt == nStrSize - nPos)
|
||||||
{
|
{
|
||||||
pwszDestStr[nDestStrCnt]=' ';
|
pszDestStr[nDestStrCnt] = _T(' ');
|
||||||
nDestStrCnt++;
|
nDestStrCnt++;
|
||||||
}
|
}
|
||||||
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
|
||||||
nDestStrCnt++;
|
|
||||||
}
|
|
||||||
pwszDestStr[nDestStrCnt]='\0';
|
|
||||||
|
|
||||||
return pwszDestStr;
|
pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszDestStr[nDestStrCnt] = _T('\0');
|
||||||
|
|
||||||
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the spaces by format string separated by ';' */
|
/* Insert the spaces by format string separated by ';' */
|
||||||
WCHAR*
|
LPTSTR
|
||||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
InsSpacesFmt(const TCHAR *szSourceStr, const TCHAR *szFmtStr)
|
||||||
{
|
{
|
||||||
WCHAR* pwszDestStr;
|
LPTSTR pszDestStr;
|
||||||
pwszDestStr=(WCHAR*) malloc(255);
|
LPTSTR pszTempStr;
|
||||||
|
TCHAR szFmtVal[255];
|
||||||
WCHAR* pwszTempStr;
|
|
||||||
|
|
||||||
WCHAR wszFmtVal[255];
|
|
||||||
|
|
||||||
int nFmtCount=0;
|
int nFmtCount=0;
|
||||||
int nValCount=0;
|
int nValCount=0;
|
||||||
int nLastVal=0;
|
int nLastVal=0;
|
||||||
int nSpaceOffset=0;
|
int nSpaceOffset=0;
|
||||||
|
|
||||||
BOOL wasNul=FALSE;
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
wcscpy(pwszDestStr,wszSourceStr);
|
pszDestStr = (LPTSTR) malloc(255 * sizeof(TCHAR));
|
||||||
|
|
||||||
|
_tcscpy(pszDestStr, szSourceStr);
|
||||||
|
|
||||||
/* if format is clean return source string */
|
/* if format is clean return source string */
|
||||||
if(!*wszFmtStr) return pwszDestStr;
|
if (!*szFmtStr)
|
||||||
|
return pszDestStr;
|
||||||
|
|
||||||
/* Search for all format values */
|
/* 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If was 0, repeat spaces */
|
/* If was 0, repeat spaces */
|
||||||
if (wasNul)
|
if (wasNul)
|
||||||
{
|
{
|
||||||
|
@ -91,70 +93,70 @@ InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||||
}
|
}
|
||||||
else
|
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 */
|
|
||||||
|
|
||||||
|
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)
|
if (!wasNul)
|
||||||
{
|
{
|
||||||
nSpaceOffset++;
|
nSpaceOffset++;
|
||||||
nLastVal=_wtoi(wszFmtVal);
|
nLastVal = _ttoi(szFmtVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create spaces for rest part of string */
|
/* 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);
|
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
|
||||||
wcscpy(pwszDestStr,pwszTempStr);
|
_tcscpy(pszDestStr,pszTempStr);
|
||||||
free(pwszTempStr);
|
free(pszTempStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pwszDestStr;
|
return pszDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace given template in source string with string to replace and return recieved string */
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
WCHAR*
|
TCHAR*
|
||||||
ReplaceSubStr(const WCHAR *wszSourceStr,
|
ReplaceSubStr(const TCHAR *szSourceStr,
|
||||||
const WCHAR *wszStrToReplace,
|
const TCHAR *szStrToReplace,
|
||||||
const WCHAR *wszTempl)
|
const TCHAR *szTempl)
|
||||||
{
|
{
|
||||||
int nCharCnt;
|
int nCharCnt;
|
||||||
int nSubStrCnt;
|
int nSubStrCnt;
|
||||||
int nDestStrCnt;
|
int nDestStrCnt;
|
||||||
int nFirstCharCnt;
|
int nFirstCharCnt;
|
||||||
|
LPTSTR szDestStr;
|
||||||
|
|
||||||
WCHAR* wszDestStr;
|
szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
|
||||||
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
|
||||||
|
|
||||||
nDestStrCnt = 0;
|
nDestStrCnt = 0;
|
||||||
nFirstCharCnt = 0;
|
nFirstCharCnt = 0;
|
||||||
|
|
||||||
wcscpy(wszDestStr,L"");
|
_tcscpy(szDestStr, _T(L""));
|
||||||
|
|
||||||
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
while (nFirstCharCnt < (int)_tcslen(szSourceStr))
|
||||||
{
|
{
|
||||||
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
if (szSourceStr[nFirstCharCnt] == szTempl[0])
|
||||||
{
|
{
|
||||||
nSubStrCnt=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++;
|
nSubStrCnt++;
|
||||||
}
|
}
|
||||||
|
@ -162,24 +164,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((int)wcslen(wszTempl)==nSubStrCnt)
|
|
||||||
|
if ((int)_tcslen(szTempl) == nSubStrCnt)
|
||||||
{
|
{
|
||||||
wcscat(wszDestStr,wszStrToReplace);
|
_tcscat(szDestStr, szStrToReplace);
|
||||||
nDestStrCnt=(int)wcslen(wszDestStr);
|
nDestStrCnt = (int)_tcslen(szDestStr);
|
||||||
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
nFirstCharCnt += (int)_tcslen(szTempl) - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
szDestStr[nDestStrCnt++] = wszSourceStr[nFirstCharCnt];
|
||||||
wszDestStr[nDestStrCnt]='\0';
|
szDestStr[nDestStrCnt] = _T('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
nFirstCharCnt++;
|
nFirstCharCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wszDestStr;
|
return szDestStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -26,26 +26,27 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - Enumerate available time formats (use EnumTimeformatsW)
|
* - Enumerate available time formats (use EnumTimeFormats)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
UpdateTimeSample(HWND hWnd)
|
UpdateTimeSample(HWND hWnd)
|
||||||
{
|
{
|
||||||
WCHAR InBuffer[80];
|
TCHAR InBuffer[80];
|
||||||
WCHAR OutBuffer[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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,77 +61,77 @@ TimePageProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
WCHAR Buffer[80];
|
TCHAR Buffer[80];
|
||||||
int nLen;
|
int nLen;
|
||||||
|
|
||||||
/* Update the time format sample */
|
/* Update the time format sample */
|
||||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||||
|
|
||||||
/* Get the time format (max. 80 characters) */
|
/* Get the time format (max. 80 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_LIMITTEXT, 80, 0);
|
CB_LIMITTEXT, 80, 0);
|
||||||
|
|
||||||
/* FIXME: add available time formats to the list */
|
/* FIXME: add available time formats to the list */
|
||||||
|
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the time separator (max. 4 characters) */
|
/* Get the time separator (max. 4 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_LIMITTEXT, 4, 0);
|
CB_LIMITTEXT, 4, 0);
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the AM symbol (max. 9 characters) */
|
/* Get the AM symbol (max. 9 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
if (nLen != 0)
|
if (nLen != 0)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Get the PM symbol (max. 9 characters) */
|
/* Get the PM symbol (max. 9 characters) */
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
if (nLen != 0)
|
if (nLen != 0)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -159,49 +160,49 @@ TimePageProc(HWND hwndDlg,
|
||||||
|
|
||||||
if (lpnm->code == (UINT)PSN_APPLY)
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
{
|
{
|
||||||
WCHAR Buffer[80];
|
TCHAR Buffer[80];
|
||||||
int nIndex;
|
int nIndex;
|
||||||
|
|
||||||
/* Set time format */
|
/* Set time format */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||||
|
|
||||||
/* Set time separator */
|
/* Set time separator */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||||
|
|
||||||
/* Set the AM symbol */
|
/* Set the AM symbol */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L"");
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, _T(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the PM symbol */
|
/* Set the PM symbol */
|
||||||
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L"");
|
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, _T(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the time format sample */
|
/* Update the time format sample */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue