mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
Dmitry Chapyshev <lentind@yandex.ru>:
- Improve intl.cpl, include almost all code from intl_new branch (it's pending for deletion now) - ReactOS's intl.cpl now works and behaves similar to Windows XP's intl.cpl, only the last tab is unfinished - Tested in Windows and ReactOS (in ROS it obviously has reduced functionality, since some of needed registry entries are absent) - As a result, all other languages (other than en-us) need to be re-translated. svn path=/trunk/; revision=28786
This commit is contained in:
parent
0eb52138ba
commit
3a3645aa1e
23
reactos/dll/cpl/intl/advanced.c
Normal file
23
reactos/dll/cpl/intl/advanced.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <cpl.h>
|
||||||
|
|
||||||
|
#include "intl.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
/* Property page dialog callback */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
AdvancedPageProc(HWND hwndDlg,
|
||||||
|
UINT uMsg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -32,6 +32,10 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define POSITIVE_EXAMPLE L"123456789.00"
|
||||||
|
#define NEGATIVE_EXAMPLE L"-123456789.00"
|
||||||
|
#define MAX_FIELD_DIG_SAMPLES 3
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GLOBAL_DATA
|
typedef struct _GLOBAL_DATA
|
||||||
{
|
{
|
||||||
|
@ -50,7 +54,7 @@ typedef struct _GLOBAL_DATA
|
||||||
static VOID
|
static VOID
|
||||||
GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
{
|
{
|
||||||
TCHAR szBuffer[256];
|
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Get currency symbol */
|
/* Get currency symbol */
|
||||||
|
@ -61,7 +65,7 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
/* Get positive format */
|
/* Get positive format */
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_ICURRENCY,
|
LOCALE_ICURRENCY,
|
||||||
szBuffer, 256);
|
szBuffer, MAX_FMT_SIZE);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
pGlobalData->PositiveOrder = _ttoi(szBuffer);
|
pGlobalData->PositiveOrder = _ttoi(szBuffer);
|
||||||
|
@ -70,7 +74,7 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
/* Get negative format */
|
/* Get negative format */
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_INEGCURR,
|
LOCALE_INEGCURR,
|
||||||
szBuffer, 256);
|
szBuffer, MAX_FMT_SIZE);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
pGlobalData->NegativeOrder = _ttoi(szBuffer);
|
pGlobalData->NegativeOrder = _ttoi(szBuffer);
|
||||||
|
@ -79,7 +83,7 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
/* Get number of fractional digits */
|
/* Get number of fractional digits */
|
||||||
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_ICURRDIGITS,
|
LOCALE_ICURRDIGITS,
|
||||||
szBuffer, 256);
|
szBuffer, MAX_FMT_SIZE);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
pGlobalData->NumDigits = _ttoi(szBuffer);
|
pGlobalData->NumDigits = _ttoi(szBuffer);
|
||||||
|
@ -106,7 +110,7 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
|
||||||
static VOID
|
static VOID
|
||||||
UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
{
|
{
|
||||||
TCHAR szBuffer[256];
|
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||||
CURRENCYFMT cyFmt;
|
CURRENCYFMT cyFmt;
|
||||||
|
|
||||||
cyFmt.NumDigits = pGlobalData->NumDigits;
|
cyFmt.NumDigits = pGlobalData->NumDigits;
|
||||||
|
@ -117,43 +121,39 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.PositiveOrder = pGlobalData->PositiveOrder;
|
cyFmt.PositiveOrder = pGlobalData->PositiveOrder;
|
||||||
cyFmt.NegativeOrder = pGlobalData->NegativeOrder;
|
cyFmt.NegativeOrder = pGlobalData->NegativeOrder;
|
||||||
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
|
||||||
|
|
||||||
/* positive example */
|
/* positive example */
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789.00"),
|
POSITIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg,
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||||
IDC_CURRENCYPOSSAMPLE,
|
|
||||||
szBuffer);
|
|
||||||
|
|
||||||
/* negative example */
|
/* negative example */
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("-123456789.00"),
|
NEGATIVE_EXAMPLE,
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg,
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
|
||||||
IDC_CURRENCYNEGSAMPLE,
|
|
||||||
szBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
{
|
{
|
||||||
TCHAR szBuffer[256];
|
TCHAR szBuffer[MAX_FMT_SIZE];
|
||||||
CURRENCYFMT cyFmt;
|
CURRENCYFMT cyFmt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GetInitialCurrencyValues(pGlobalData);
|
GetInitialCurrencyValues(pGlobalData);
|
||||||
|
|
||||||
/* Set currency symbol */
|
/* Set currency symbol */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szCurrencySymbol);
|
(LPARAM)pGlobalData->szCurrencySymbol);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -173,15 +173,15 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.PositiveOrder = i;
|
cyFmt.PositiveOrder = i;
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("1.1"),
|
_T("1.1"),
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->PositiveOrder,
|
pGlobalData->PositiveOrder,
|
||||||
0);
|
0);
|
||||||
|
@ -193,26 +193,26 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.NegativeOrder = i;
|
cyFmt.NegativeOrder = i;
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("-1.1"),
|
_T("-1.1"),
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NegativeOrder, /* index */
|
pGlobalData->NegativeOrder, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* decimal separator */
|
/* decimal separator */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szDecimalSep);
|
(LPARAM)pGlobalData->szDecimalSep);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -223,25 +223,25 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
{
|
{
|
||||||
szBuffer[0] = _T('0') + i;
|
szBuffer[0] = _T('0') + i;
|
||||||
szBuffer[1] = 0;
|
szBuffer[1] = 0;
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
pGlobalData->NumDigits, /* index */
|
pGlobalData->NumDigits, /* index */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
/* digit group separator */
|
/* digit group separator */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pGlobalData->szThousandSep);
|
(LPARAM)pGlobalData->szThousandSep);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -256,8 +256,8 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.Grouping = 0;
|
cyFmt.Grouping = 0;
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -265,8 +265,8 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.Grouping = 3;
|
cyFmt.Grouping = 3;
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -274,8 +274,8 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
cyFmt.Grouping = 32;
|
cyFmt.Grouping = 32;
|
||||||
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
|
||||||
_T("123456789"),
|
_T("123456789"),
|
||||||
&cyFmt, szBuffer, 256);
|
&cyFmt, szBuffer, MAX_FMT_SIZE);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_INSERTSTRING,
|
CB_INSERTSTRING,
|
||||||
-1,
|
-1,
|
||||||
(LPARAM)szBuffer);
|
(LPARAM)szBuffer);
|
||||||
|
@ -290,7 +290,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
i, /* index */
|
i, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -299,6 +299,153 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
||||||
UpdateExamples(hwndDlg, pGlobalData);
|
UpdateExamples(hwndDlg, pGlobalData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set number of digidts in field */
|
||||||
|
BOOL
|
||||||
|
SetCurrencyDigNum(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"0;0",
|
||||||
|
L"3;0",
|
||||||
|
L"3;2;0"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted number of digidts in field */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Save number of digidts in field */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set currency field separator */
|
||||||
|
BOOL
|
||||||
|
SetCurrencyFieldSep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted currency field separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszCurrencyFieldSep);
|
||||||
|
|
||||||
|
/* Save currency field separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set number of fractional symbols */
|
||||||
|
BOOL
|
||||||
|
SetCurrencyFracSymNum(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted number of fractional symbols */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save number of fractional symbols */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set currency separator */
|
||||||
|
BOOL
|
||||||
|
SetCurrencySep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted currency decimal separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszCurrencySep);
|
||||||
|
|
||||||
|
/* TODO: Add check for correctly input */
|
||||||
|
|
||||||
|
/* Save currency separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set negative currency sum format */
|
||||||
|
BOOL
|
||||||
|
SetNegCurrencySumFmt(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted currency unit */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save currency sum format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set positive currency sum format */
|
||||||
|
BOOL
|
||||||
|
SetPosCurrencySumFmt(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted currency unit */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save currency sum format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set currency unit */
|
||||||
|
BOOL
|
||||||
|
SetCurrencyUnit(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted currency unit */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
||||||
|
|
||||||
|
/* Save currency unit */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
@ -314,12 +461,48 @@ 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:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_CURRENCYSYMBOL:
|
||||||
|
case IDC_CURRENCYPOSVALUE:
|
||||||
|
case IDC_CURRENCYNEGVALUE:
|
||||||
|
case IDC_CURRENCYDECSEP:
|
||||||
|
case IDC_CURRENCYDECNUM:
|
||||||
|
case IDC_CURRENCYGRPSEP:
|
||||||
|
case IDC_CURRENCYGRPNUM:
|
||||||
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||||
|
{
|
||||||
|
/* Set "Apply" button enabled */
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
|
/* If push apply button */
|
||||||
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
|
{
|
||||||
|
if(!SetCurrencyDigNum(hwndDlg)) break;
|
||||||
|
if(!SetCurrencyUnit(hwndDlg)) break;
|
||||||
|
if(!SetPosCurrencySumFmt(hwndDlg)) break;
|
||||||
|
if(!SetNegCurrencySumFmt(hwndDlg)) break;
|
||||||
|
if(!SetCurrencySep(hwndDlg)) break;
|
||||||
|
if(!SetCurrencyFracSymNum(hwndDlg)) break;
|
||||||
|
if(!SetCurrencyFieldSep(hwndDlg)) break;
|
||||||
|
UpdateExamples(hwndDlg, pGlobalData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
HeapFree(GetProcessHeap(), 0, pGlobalData);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
* 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>
|
||||||
|
@ -31,6 +33,510 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
|
const INT YEAR_STR_MAX_SIZE=4;
|
||||||
|
const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
||||||
|
#define MAX_SHORT_FMT_SAMPLES 5
|
||||||
|
#define MAX_LONG_FMT_SAMPLES 2
|
||||||
|
#define MAX_SHRT_DATE_SEPARATORS 3
|
||||||
|
#define STD_DATE_SEP L"."
|
||||||
|
#define YEAR_DIFF (99)
|
||||||
|
#define MAX_YEAR (9999)
|
||||||
|
|
||||||
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
/* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
|
||||||
|
BOOL
|
||||||
|
isDateCompAl(WCHAR walpha)
|
||||||
|
{
|
||||||
|
|
||||||
|
if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE;
|
||||||
|
else return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find first date separator in string */
|
||||||
|
WCHAR*
|
||||||
|
FindDateSep(const WCHAR *wszSourceStr)
|
||||||
|
{
|
||||||
|
int nDateCompCount=0;
|
||||||
|
int nDateSepCount=0;
|
||||||
|
|
||||||
|
WCHAR* wszFindedSep;
|
||||||
|
wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||||
|
|
||||||
|
wcscpy(wszFindedSep,STD_DATE_SEP);
|
||||||
|
|
||||||
|
while(nDateCompCount<wcslen(wszSourceStr))
|
||||||
|
{
|
||||||
|
if(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||||
|
{
|
||||||
|
while(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||||
|
{
|
||||||
|
wszFindedSep[nDateSepCount++]=wszSourceStr[nDateCompCount];
|
||||||
|
nDateCompCount++;
|
||||||
|
}
|
||||||
|
wszFindedSep[nDateSepCount]='\0';
|
||||||
|
return wszFindedSep;
|
||||||
|
}
|
||||||
|
nDateCompCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wszFindedSep;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
|
|
||||||
|
|
||||||
|
/* Setted up short date separator to registry */
|
||||||
|
BOOL
|
||||||
|
SetShortDateSep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
int nSepStrSize;
|
||||||
|
int nSepCount;
|
||||||
|
|
||||||
|
/* Get setted separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||||
|
|
||||||
|
/* Get setted separator string size */
|
||||||
|
nSepStrSize = wcslen(wszShortDateSep);
|
||||||
|
|
||||||
|
/* Check date components */
|
||||||
|
for(nSepCount=0;nSepCount<nSepStrSize;nSepCount++)
|
||||||
|
{
|
||||||
|
if(iswalnum(wszShortDateSep[nSepCount]) || (wszShortDateSep[nSepCount]=='\''))
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL,
|
||||||
|
L"Entered short date separator contain incorrect symbol",
|
||||||
|
L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save date separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDATE, wszShortDateSep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setted up short date format to registry */
|
||||||
|
BOOL
|
||||||
|
SetShortDateFormat(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszFindedDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
WCHAR* pwszResultStr;
|
||||||
|
BOOL OpenApostFlg = FALSE;
|
||||||
|
int nFmtStrSize;
|
||||||
|
int nDateCompCount;
|
||||||
|
|
||||||
|
/* Get setted format */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||||
|
|
||||||
|
/* Get setted separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||||
|
|
||||||
|
/* Get setted format-string size */
|
||||||
|
nFmtStrSize = wcslen(wszShortDateFmt);
|
||||||
|
|
||||||
|
/* Check date components */
|
||||||
|
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
||||||
|
{
|
||||||
|
if(wszShortDateFmt[nDateCompCount]==L'\'')
|
||||||
|
{
|
||||||
|
OpenApostFlg=!OpenApostFlg;
|
||||||
|
}
|
||||||
|
if(iswalnum(wszShortDateFmt[nDateCompCount]) &&
|
||||||
|
!isDateCompAl(wszShortDateFmt[nDateCompCount]) &&
|
||||||
|
!OpenApostFlg)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL,
|
||||||
|
L"Entered short date format contain incorrect symbol",
|
||||||
|
L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OpenApostFlg)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL,
|
||||||
|
L"Entered short date format contain incorrect symbol",
|
||||||
|
L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* substring replacement of separator */
|
||||||
|
wcscpy(wszFindedDateSep,FindDateSep(wszShortDateFmt));
|
||||||
|
pwszResultStr = ReplaceSubStr(wszShortDateFmt,wszShortDateSep,wszFindedDateSep);
|
||||||
|
wcscpy(wszShortDateFmt,pwszResultStr);
|
||||||
|
free(pwszResultStr);
|
||||||
|
|
||||||
|
/* Save short date format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, wszShortDateFmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setted up long date format to registry */
|
||||||
|
BOOL
|
||||||
|
SetLongDateFormat(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
BOOL OpenApostFlg = FALSE;
|
||||||
|
int nFmtStrSize;
|
||||||
|
int nDateCompCount;
|
||||||
|
|
||||||
|
/* Get setted format */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||||
|
|
||||||
|
/* Get setted format string size */
|
||||||
|
nFmtStrSize = wcslen(wszLongDateFmt);
|
||||||
|
|
||||||
|
/* Check date components */
|
||||||
|
for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
|
||||||
|
{
|
||||||
|
if(wszLongDateFmt[nDateCompCount]==L'\'')
|
||||||
|
{
|
||||||
|
OpenApostFlg=!OpenApostFlg;
|
||||||
|
}
|
||||||
|
if(iswalnum(wszLongDateFmt[nDateCompCount]) &&
|
||||||
|
!isDateCompAl(wszLongDateFmt[nDateCompCount]) &&
|
||||||
|
!OpenApostFlg)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL,
|
||||||
|
L"Entered long date format contain incorrect symbol",
|
||||||
|
L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OpenApostFlg)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL,
|
||||||
|
L"Entered long date format contain incorrect symbol",
|
||||||
|
L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save short date format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, wszLongDateFmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init short date separator control box */
|
||||||
|
VOID
|
||||||
|
InitShortDateSepSamples(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L".",
|
||||||
|
L"/",
|
||||||
|
L"-"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current short date separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SDATE,
|
||||||
|
wszShortDateSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of separators */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_SHRT_DATE_SEPARATORS;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)ShortDateSepSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_SHRT_DATE_SEPARATORS+1,
|
||||||
|
(LPARAM)wszShortDateSep);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateSep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init short date control box */
|
||||||
|
VOID
|
||||||
|
InitShortDateCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"dd.MM.yyyy",
|
||||||
|
L"dd.MM.yy",
|
||||||
|
L"d.M.yy",
|
||||||
|
L"dd/MM/yy",
|
||||||
|
L"yyyy-MM-dd"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current short date format */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SSHORTDATE,
|
||||||
|
wszShortDateFmt,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of date formats */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_SHORT_FMT_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)ShortDateFmtSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_SHORT_FMT_SAMPLES+1,
|
||||||
|
(LPARAM)wszShortDateFmt);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszShortDateFmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init long date control box */
|
||||||
|
VOID
|
||||||
|
InitLongDateCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
/* Where this data stored? */
|
||||||
|
WCHAR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"d MMMM yyyy 'y.'",
|
||||||
|
L"dd MMMM yyyy 'y.'"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current long date format */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SLONGDATE,
|
||||||
|
wszLongDateFmt,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of date formats */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_LONG_FMT_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)LongDateFmtSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_LONG_FMT_SAMPLES+1,
|
||||||
|
(LPARAM)wszLongDateFmt);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszLongDateFmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up max date value to registry */
|
||||||
|
VOID
|
||||||
|
SetMaxDate(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
WCHAR wszMaxDateVal[YEAR_STR_MAX_SIZE];
|
||||||
|
INT nSpinVal;
|
||||||
|
|
||||||
|
/* Get spin value */
|
||||||
|
nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||||
|
UDM_GETPOS,
|
||||||
|
0,
|
||||||
|
0));
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nSpinVal,wszMaxDateVal,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save max date value */
|
||||||
|
SetCalendarInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
CAL_GREGORIAN,
|
||||||
|
48 , /* CAL_ITWODIGITYEARMAX */
|
||||||
|
(LPCWSTR)&wszMaxDateVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get max date value from registry set */
|
||||||
|
INT
|
||||||
|
GetMaxDate()
|
||||||
|
{
|
||||||
|
int nMaxDateVal;
|
||||||
|
|
||||||
|
GetCalendarInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
CAL_GREGORIAN,
|
||||||
|
CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
|
||||||
|
NULL,
|
||||||
|
0, /* ret type - number */
|
||||||
|
(LPDWORD)&nMaxDateVal);
|
||||||
|
|
||||||
|
return nMaxDateVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set's MIN data edit control value to MAX-99 */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
SetMinData(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
|
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
|
/* Get spin value */
|
||||||
|
INT nSpinVal=LOWORD(SendMessage(hWndYearSpin,
|
||||||
|
UDM_GETPOS,
|
||||||
|
0,
|
||||||
|
0));
|
||||||
|
|
||||||
|
/* Set min year value */
|
||||||
|
wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal-YEAR_DIFF);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init spin control */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
InitMinMaxDateSpin(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
|
||||||
|
const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
|
||||||
|
|
||||||
|
/* Init max date value */
|
||||||
|
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate());
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Init min date value */
|
||||||
|
wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate()-YEAR_DIFF);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Init updown control */
|
||||||
|
/* Set bounds */
|
||||||
|
SendMessageW(hWndYearSpin,
|
||||||
|
UDM_SETRANGE,
|
||||||
|
0,
|
||||||
|
MAKELONG(MAX_YEAR,YEAR_DIFF));
|
||||||
|
|
||||||
|
/* Set current value */
|
||||||
|
SendMessageW(hWndYearSpin,
|
||||||
|
UDM_SETPOS,
|
||||||
|
0,
|
||||||
|
MAKELONG(GetMaxDate(),0));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update all date locale samples */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
UpdateDateLocaleSamples(HWND hwndDlg,
|
||||||
|
LCID lcidLocale)
|
||||||
|
{
|
||||||
|
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
|
/* Get short date format sample */
|
||||||
|
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
|
||||||
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get long date sample */
|
||||||
|
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
|
||||||
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
@ -42,7 +548,66 @@ DatePageProc(HWND hwndDlg,
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
{
|
||||||
|
InitMinMaxDateSpin(hwndDlg);
|
||||||
|
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
|
InitShortDateCB(hwndDlg);
|
||||||
|
InitLongDateCB(hwndDlg);
|
||||||
|
InitShortDateSepSamples(hwndDlg);
|
||||||
|
/* TODO: Add other calendar types */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_SECONDYEAR_EDIT:
|
||||||
|
{
|
||||||
|
if(HIWORD(wParam)==EN_CHANGE)
|
||||||
|
{
|
||||||
|
SetMinData(hwndDlg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case IDC_SCR_MAX_YEAR:
|
||||||
|
{
|
||||||
|
/* Set "Apply" button enabled */
|
||||||
|
/* FIXME */
|
||||||
|
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_CALTYPE_COMBO:
|
||||||
|
case IDC_HIJCHRON_COMBO:
|
||||||
|
case IDC_SHRTDATEFMT_COMBO:
|
||||||
|
case IDC_SHRTDATESEP_COMBO:
|
||||||
|
case IDC_LONGDATEFMT_COMBO:
|
||||||
|
{
|
||||||
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||||
|
{
|
||||||
|
/* Set "Apply" button enabled */
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
|
/* If push apply button */
|
||||||
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
|
{
|
||||||
|
SetMaxDate(hwndDlg);
|
||||||
|
if(!SetShortDateSep(hwndDlg)) break;
|
||||||
|
if(!SetShortDateFormat(hwndDlg)) break;
|
||||||
|
if(!SetLongDateFormat(hwndDlg)) break;
|
||||||
|
InitShortDateCB(hwndDlg);
|
||||||
|
/* FIXME: */
|
||||||
|
//Sleep(15);
|
||||||
|
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WINVER 0x0501
|
#define WINVER 0x0501
|
||||||
|
#define SAMPLE_NUMBER L"123456789"
|
||||||
|
#define NO_FLAG 0
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
@ -38,6 +40,7 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
HWND hList;
|
HWND hList;
|
||||||
|
HWND hLocaleList, hGeoList;
|
||||||
|
|
||||||
BOOL CALLBACK LocalesEnumProc(
|
BOOL CALLBACK LocalesEnumProc(
|
||||||
LPTSTR lpLocale // locale id
|
LPTSTR lpLocale // locale id
|
||||||
|
@ -65,6 +68,44 @@ BOOL CALLBACK LocalesEnumProc(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update all locale samples */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
|
||||||
|
{
|
||||||
|
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
|
/* Get number format sample */
|
||||||
|
GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
|
||||||
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get monetary format sample */
|
||||||
|
GetCurrencyFormatW(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
|
||||||
|
OutBuffer, MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
|
||||||
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get time format sample */
|
||||||
|
GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get short date format sample */
|
||||||
|
GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
|
||||||
|
0, (LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get long date sample */
|
||||||
|
GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
|
||||||
|
WM_SETTEXT, 0, (LPARAM)OutBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
CreateLanguagesList(HWND hwnd)
|
CreateLanguagesList(HWND hwnd)
|
||||||
|
@ -173,6 +214,55 @@ void SetNewLocale(LCID lcid)
|
||||||
RegCloseKey(langKey);
|
RegCloseKey(langKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Location enumerate procedure */
|
||||||
|
BOOL
|
||||||
|
CALLBACK
|
||||||
|
LocationsEnumProc(GEOID gId)
|
||||||
|
{
|
||||||
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
|
int index;
|
||||||
|
|
||||||
|
GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
|
||||||
|
index = (int) SendMessageW(hGeoList,
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)loc);
|
||||||
|
|
||||||
|
SendMessageW(hGeoList,
|
||||||
|
CB_SETITEMDATA,
|
||||||
|
index,
|
||||||
|
(LPARAM)gId);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enumerate all system locations identifiers */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CreateLocationsList(HWND hWnd)
|
||||||
|
{
|
||||||
|
GEOID userGeoID;
|
||||||
|
TCHAR loc[MAX_STR_SIZE];
|
||||||
|
|
||||||
|
hGeoList = hWnd;
|
||||||
|
|
||||||
|
EnumSystemGeoID(GEOCLASS_NATION, 0, LocationsEnumProc);
|
||||||
|
|
||||||
|
/* Select current location */
|
||||||
|
userGeoID = GetUserGeoID(GEOCLASS_NATION);
|
||||||
|
GetGeoInfo(userGeoID,
|
||||||
|
GEO_FRIENDLYNAME,
|
||||||
|
loc,
|
||||||
|
MAX_FMT_SIZE,
|
||||||
|
LANG_SYSTEM_DEFAULT);
|
||||||
|
|
||||||
|
SendMessageW(hGeoList,
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
(WPARAM) -1,
|
||||||
|
(LPARAM)loc);
|
||||||
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
VerifyUnattendLCID(HWND hwndDlg)
|
VerifyUnattendLCID(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
|
@ -213,6 +303,8 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
|
CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
|
||||||
|
UpdateLocaleSample(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
|
CreateLocationsList(GetDlgItem(hwndDlg, IDC_LOCATION_COMBO));
|
||||||
if (IsUnattendedSetupEnabled)
|
if (IsUnattendedSetupEnabled)
|
||||||
{
|
{
|
||||||
if (VerifyUnattendLCID(hwndDlg))
|
if (VerifyUnattendLCID(hwndDlg))
|
||||||
|
@ -232,6 +324,9 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_SETUP_BUTTON:
|
||||||
|
SetupApplet(hwndDlg, uMsg, wParam, lParam);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ ParseSetupInf()
|
||||||
static LONG APIENTRY
|
static LONG APIENTRY
|
||||||
Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE psp[6];
|
PROPSHEETPAGE psp[3];
|
||||||
PROPSHEETHEADER psh;
|
PROPSHEETHEADER psh;
|
||||||
TCHAR Caption[256];
|
TCHAR Caption[256];
|
||||||
|
|
||||||
|
@ -156,11 +156,8 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
psh.ppsp = psp;
|
psh.ppsp = psp;
|
||||||
|
|
||||||
InitPropSheetPage(&psp[0], IDD_GENERALPAGE, GeneralPageProc);
|
InitPropSheetPage(&psp[0], IDD_GENERALPAGE, GeneralPageProc);
|
||||||
InitPropSheetPage(&psp[1], IDD_NUMBERSPAGE, NumbersPageProc);
|
InitPropSheetPage(&psp[1], IDD_LANGUAGESPAGE, LanguagesPageProc);
|
||||||
InitPropSheetPage(&psp[2], IDD_CURRENCYPAGE, CurrencyPageProc);
|
InitPropSheetPage(&psp[2], IDD_ADVANCEDPAGE, AdvancedPageProc);
|
||||||
InitPropSheetPage(&psp[3], IDD_TIMEPAGE, TimePageProc);
|
|
||||||
InitPropSheetPage(&psp[4], IDD_DATEPAGE, DatePageProc);
|
|
||||||
InitPropSheetPage(&psp[5], IDD_LOCALEPAGE, InpLocalePageProc);
|
|
||||||
|
|
||||||
return (LONG)(PropertySheet(&psh) != -1);
|
return (LONG)(PropertySheet(&psh) != -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef __CPL_INTL_H
|
#ifndef __CPL_INTL_H
|
||||||
#define __CPL_INTL_H
|
#define __CPL_INTL_H
|
||||||
|
|
||||||
|
#define MAX_FMT_SIZE 30
|
||||||
|
#define MAX_STR_SIZE 128
|
||||||
|
#define MAX_SAMPLES_STR_SIZE 70
|
||||||
|
#define DECIMAL_RADIX 10
|
||||||
|
|
||||||
typedef struct _APPLET
|
typedef struct _APPLET
|
||||||
{
|
{
|
||||||
|
@ -14,6 +18,24 @@ extern HINSTANCE hApplet;
|
||||||
extern DWORD IsUnattendedSetupEnabled;
|
extern DWORD IsUnattendedSetupEnabled;
|
||||||
extern DWORD UnattendLCID;
|
extern DWORD UnattendLCID;
|
||||||
|
|
||||||
|
/* intl.c */
|
||||||
|
VOID
|
||||||
|
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc);
|
||||||
|
|
||||||
|
/* languages.c */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
LanguagesPageProc(HWND hwndDlg,
|
||||||
|
UINT uMsg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam);
|
||||||
|
|
||||||
|
/* advanced.c */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
AdvancedPageProc(HWND hwndDlg,
|
||||||
|
UINT uMsg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam);
|
||||||
|
|
||||||
/* currency.c */
|
/* currency.c */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
CurrencyPageProc(HWND hwndDlg,
|
CurrencyPageProc(HWND hwndDlg,
|
||||||
|
@ -59,6 +81,17 @@ TimePageProc(HWND hwndDlg,
|
||||||
|
|
||||||
void SetNewLocale(LCID lcid);
|
void SetNewLocale(LCID lcid);
|
||||||
|
|
||||||
|
/* misc.c */
|
||||||
|
WCHAR*
|
||||||
|
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
|
||||||
|
|
||||||
|
WCHAR*
|
||||||
|
ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
|
||||||
|
|
||||||
|
LONG
|
||||||
|
APIENTRY
|
||||||
|
SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
||||||
|
|
||||||
#endif /* __CPL_INTL_H */
|
#endif /* __CPL_INTL_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>setupapi</library>
|
<library>setupapi</library>
|
||||||
<library>msvcrt</library>
|
<library>msvcrt</library>
|
||||||
|
<library>shell32</library>
|
||||||
<file>currency.c</file>
|
<file>currency.c</file>
|
||||||
<file>date.c</file>
|
<file>date.c</file>
|
||||||
<file>generalp.c</file>
|
<file>generalp.c</file>
|
||||||
|
@ -20,5 +21,8 @@
|
||||||
<file>inplocale.c</file>
|
<file>inplocale.c</file>
|
||||||
<file>numbers.c</file>
|
<file>numbers.c</file>
|
||||||
<file>time.c</file>
|
<file>time.c</file>
|
||||||
|
<file>misc.c</file>
|
||||||
|
<file>languages.c</file>
|
||||||
|
<file>advanced.c</file>
|
||||||
<file>intl.rc</file>
|
<file>intl.rc</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
|
|
||||||
IDC_CPLICON ICON "resources/applet.ico"
|
IDC_CPLICON ICON "resources/applet.ico"
|
||||||
IDC_FLAGS ICON "resources/flags.ico"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,17 +20,17 @@ IDC_FLAGS ICON "resources/flags.ico"
|
||||||
* a neutral version. This is to get localized bitmaps for example.
|
* a neutral version. This is to get localized bitmaps for example.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lang/cs-CZ.rc"
|
//#include "lang/cs-CZ.rc"
|
||||||
#include "lang/de-DE.rc"
|
//#include "lang/de-DE.rc"
|
||||||
#include "lang/el-GR.rc"
|
//#include "lang/el-GR.rc"
|
||||||
#include "lang/en-US.rc"
|
#include "lang/en-US.rc"
|
||||||
#include "lang/es-ES.rc"
|
//#include "lang/es-ES.rc"
|
||||||
#include "lang/fr-FR.rc"
|
//#include "lang/fr-FR.rc"
|
||||||
#include "lang/hu-HU.rc"
|
//#include "lang/hu-HU.rc"
|
||||||
#include "lang/id-ID.rc"
|
//#include "lang/id-ID.rc"
|
||||||
#include "lang/it-IT.rc"
|
//#include "lang/it-IT.rc"
|
||||||
#include "lang/ja-JP.rc"
|
//#include "lang/ja-JP.rc"
|
||||||
#include "lang/nl-NL.rc"
|
//#include "lang/nl-NL.rc"
|
||||||
#include "lang/ru-RU.rc"
|
//#include "lang/ru-RU.rc"
|
||||||
#include "lang/sv-SE.rc"
|
//#include "lang/sv-SE.rc"
|
||||||
#include "lang/uk-UA.rc"
|
//#include "lang/uk-UA.rc"
|
||||||
|
|
|
@ -2,35 +2,101 @@
|
||||||
|
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
IDD_GENERALPAGE DIALOGEX 0, 0, 246, 188
|
IDD_GENERALPAGE DIALOGEX 0, 0, 246, 230
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "General"
|
CAPTION "Regional Options"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "Primary language", -1, 8, 11, 228, 74
|
GROUPBOX "Standarts and formats", -1, 5, 5, 234, 162
|
||||||
ICON IDC_FLAGS, IDC_ICON1, 12, 26, 21, 20, SS_ICON
|
LTEXT "This option affects how some programs format numbers, currencies, dates, and time.", -1, 14, 17, 220, 25
|
||||||
LTEXT "Select the primary language and region you want to use:", -1, 38, 25, 193, 22
|
LTEXT "Select an item to match its proferences, or click Customize to choose your own formats:", -1, 14, 37, 220, 22
|
||||||
COMBOBOX IDC_LANGUAGELIST, 39, 49, 191, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
COMBOBOX IDC_LANGUAGELIST, 14, 56, 160, 83, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
PUSHBUTTON "Customi&ze...", IDC_SETUP_BUTTON, 178, 56, 52, 13
|
||||||
|
LTEXT "Samples", -1, 14, 73, 70, 10
|
||||||
|
LTEXT "Number:", -1, 16, 86, 48, 10
|
||||||
|
LTEXT "Monetary:", -1, 16, 101, 48, 10
|
||||||
|
LTEXT "Time:", -1, 16, 116, 48, 10
|
||||||
|
LTEXT "Short date:", -1, 16, 131, 48, 10
|
||||||
|
LTEXT "Long date:", -1, 16, 146, 48, 10
|
||||||
|
EDITTEXT IDC_NUMSAMPLE_EDIT, 89, 86, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_MONEYSAMPLE_EDIT, 89, 101, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_TIMESAMPLE_EDIT, 89, 116, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_SHORTTIMESAMPLE_EDIT, 89, 131, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_FULLTIMESAMPLE_EDIT, 89, 146, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
GROUPBOX "Geographic location", -1, 5, 172, 234, 55
|
||||||
|
LTEXT "Set up your location that services could supply you with the local information, for example, news and reports of weather", -1, 14, 184, 210, 24
|
||||||
|
COMBOBOX IDC_LOCATION_COMBO, 14, 207, 217, 40, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
|
||||||
|
WS_VSCROLL | WS_TABSTOP | CBS_SORT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_LANGUAGESPAGE DIALOGEX 0, 0, 246, 230
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Languages"
|
||||||
|
FONT 8, "MS Shell Dlg"
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Text input languages and services", IDC_GROUPBOX, 5, 5, 234, 52
|
||||||
|
LTEXT "To view or change language or text input methods press ""Details...""", -1, 12, 15, 220, 18
|
||||||
|
PUSHBUTTON "De&tails...", IDC_DETAIL_BUTTON, 177, 34, 54, 14
|
||||||
|
GROUPBOX "Additional language support", IDC_GROUPBOX, 5, 62, 234, 82
|
||||||
|
LTEXT "Most languages are installed by default. To install additional languages, select the appropriate check box below.", -1, 12, 72, 220, 18
|
||||||
|
CHECKBOX "I&nstall files for complex script and right-to-left languages", IDC_INST_FILES_FOR_RTOL_LANG, 12, 92, 215, 22
|
||||||
|
CHECKBOX "In&stall files for East Asian languages", IDC_INST_FILES_FOR_ASIAN, 12, 114, 180, 22
|
||||||
|
END
|
||||||
|
|
||||||
IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 188
|
IDD_ADVANCEDPAGE DIALOGEX 0, 0, 246, 230
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Advanced"
|
||||||
|
FONT 8, "MS Shell Dlg"
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Language for non-Unicode programs", IDC_GROUPBOX, 5, 5, 234, 90
|
||||||
|
COMBOBOX IDC_LANGUAGE_COMBO, 14, 75, 217, 60, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT
|
||||||
|
LTEXT "This system setting enables non-Unicode programs to display menus and dialogs in their native language. It does not affect Unicode programs, but it does apply to all users of this computer.", -1, 14, 18, 223, 33
|
||||||
|
LTEXT "Select a language to match the language version of the non-Unicode programs you want to use:", -1, 14, 55, 223, 18
|
||||||
|
GROUPBOX "Code page conversion tables", -1, 5, 101, 234, 88
|
||||||
|
LISTBOX IDC_CONV_TABLES, 14, 114, 217, 77, LBS_STANDARD
|
||||||
|
GROUPBOX "Default user account settings", -1, 5, 193, 234, 30
|
||||||
|
CHECKBOX "Apply all settings to the current user account and to the default", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 234
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Numbers"
|
CAPTION "Numbers"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Property Page 2",-1,73,74,90,8
|
GROUPBOX "Appearance sample", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE
|
||||||
|
LTEXT "Positive:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_NUMBERSPOSSAMPLE, 43, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "Negative:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
EDITTEXT IDC_NUMBERSNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "&Decimal symbol:", -1, 8, 67, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERDSYMBOL, 137, 65, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "No. of digits a&fter decimal:", -1, 8, 83, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSNDIGDEC, 137, 81, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "Digit &grouping symbol:", -1, 8, 100, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSDIGITGRSYM, 137, 97, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "Di&git grouping:", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSDGROUPING, 137, 113, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "N&egative sign symbol:", -1, 8, 134, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSNSIGNSYM, 137, 129, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "Negative number &format:", -1, 8, 149, 100, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSNNUMFORMAT, 137, 145, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "Display leading &zeros:", -1, 8, 166, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSDISPLEADZER, 137, 161, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "&List separator:", -1, 8, 181, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSLSEP, 137, 177, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
|
LTEXT "&Measurement system:", -1, 8, 197, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
COMBOBOX IDC_NUMBERSMEASSYS, 137, 193, 100, 83, CBS_DROPDOWN | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 188
|
IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 234
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Currency"
|
CAPTION "Currency"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "Appearance sample", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE
|
GROUPBOX "Appearance sample", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE
|
||||||
LTEXT "Positive:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
LTEXT "Positive:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
EDITTEXT IDC_CURRENCYPOSSAMPLE, 42, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
EDITTEXT IDC_CURRENCYPOSSAMPLE, 43, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
LTEXT "Negative:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
LTEXT "Negative:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
EDITTEXT IDC_CURRENCYNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
EDITTEXT IDC_CURRENCYNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
LTEXT "&Currency symbol:", -1, 20, 51, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
LTEXT "&Currency symbol:", -1, 20, 51, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
|
@ -50,49 +116,71 @@ BEGIN
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
IDD_TIMEPAGE DIALOGEX 0, 0, 246, 188
|
IDD_TIMEPAGE DIALOGEX 0, 0, 246, 234
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Time"
|
CAPTION "Time"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "Appearance sample", -1, 7, 7, 228, 33, WS_CHILD | WS_VISIBLE
|
GROUPBOX "Appearance sample", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE
|
||||||
LTEXT "Time sample:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
LTEXT "Time sample:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
LTEXT "&Time format:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
LTEXT "&Time format:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
COMBOBOX IDC_TIMEFORMAT, 68, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
COMBOBOX IDC_TIMEFORMAT, 88, 50, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
LTEXT "Time &separator:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP
|
LTEXT "Time &separator:", -1, 13, 70, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
COMBOBOX IDC_TIMESEPARATOR, 68, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
COMBOBOX IDC_TIMESEPARATOR, 88, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
LTEXT "A&M symbol:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP
|
LTEXT "A&M symbol:", -1, 13, 88, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
COMBOBOX IDC_TIMEAMSYMBOL, 68, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
COMBOBOX IDC_TIMEAMSYMBOL, 88, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
LTEXT "&PM symbol:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP
|
LTEXT "&PM symbol:", -1, 13, 106, 54, 10, WS_VISIBLE | WS_GROUP
|
||||||
COMBOBOX IDC_TIMEPMSYMBOL, 68, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
COMBOBOX IDC_TIMEPMSYMBOL, 88, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
GROUPBOX "", -1, 7, 124, 228, 60, WS_VISIBLE
|
GROUPBOX "", -1, 7, 140, 230, 80, WS_VISIBLE
|
||||||
LTEXT "Time format notation\n\n\
|
LTEXT "Time format notation\n\n\
|
||||||
h = hour m = minute s = second t = am or pm\n\n\
|
h = hour m = minute s = second t = am or pm\n\n\
|
||||||
h = 12 hour H = 24 hour\n\
|
h = 12 hour H = 24 hour\n\
|
||||||
hh, mm, ss = leading zero h, m, s = no leading zero",
|
hh, mm, ss = leading zero h, m, s = no leading zero",
|
||||||
-1, 13, 133, 214, 47, WS_CHILD |WS_VISIBLE | WS_GROUP
|
-1, 13, 150, 214, 50, WS_CHILD |WS_VISIBLE | WS_GROUP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
IDD_DATEPAGE DIALOGEX 0, 0, 246, 188
|
IDD_DATEPAGE DIALOGEX 0, 0, 246, 234
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
CAPTION "Date"
|
CAPTION "Date"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Property Page 5",-1,73,74,90,8
|
GROUPBOX "Calendar", IDC_GROUPBOX, 7, 7, 230, 74
|
||||||
|
LTEXT "If year typed as two digits, then show it as year between:", -1, 13, 18, 215, 8
|
||||||
|
EDITTEXT IDC_FIRSTYEAR_EDIT, 13, 30, 36, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED
|
||||||
|
LTEXT "and", -1, 55, 32, 17, 8
|
||||||
|
EDITTEXT IDC_SECONDYEAR_EDIT, 77, 30, 36, 12, ES_LEFT | ES_NUMBER | WS_GROUP
|
||||||
|
CONTROL "",IDC_SCR_MAX_YEAR, "msctls_updown32", UDS_NOTHOUSANDS | UDS_WRAP | UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_CHILD | WS_VISIBLE, 113, 30, 10, 12
|
||||||
|
LTEXT "Calendar type:", -1, 13, 48, 56, 10
|
||||||
|
COMBOBOX IDC_CALTYPE_COMBO, 77, 46, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
|
||||||
|
WS_VSCROLL | WS_TABSTOP | CBS_SORT | WS_DISABLED
|
||||||
|
LTEXT "Muslim Calendar:", -1, 13, 65, 60, 12
|
||||||
|
COMBOBOX IDC_HIJCHRON_COMBO, 77, 64, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
|
||||||
|
WS_VSCROLL | WS_TABSTOP | CBS_SORT | WS_DISABLED
|
||||||
|
GROUPBOX "Short date format", IDC_GROUPBOX, 7, 83, 230, 81
|
||||||
|
LTEXT "Sample:", -1, 13, 95, 63, 10
|
||||||
|
EDITTEXT IDC_SHRTDATESAMPLE_EDIT, 77, 93, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "Sample - right to left read:", -1, 13, 109, 60, 16
|
||||||
|
EDITTEXT IDC_SHRTDATERTOL_EDIT, 77, 111, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED
|
||||||
|
LTEXT "Short format:", -1, 13, 131, 60, 10
|
||||||
|
COMBOBOX IDC_SHRTDATEFMT_COMBO, 77, 129, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||||
|
LTEXT "Date components separator:", -1, 13, 148, 113, 10
|
||||||
|
COMBOBOX IDC_SHRTDATESEP_COMBO, 180, 146, 51, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||||
|
GROUPBOX "Long date format", IDC_GROUPBOX, 7, 167, 230, 64
|
||||||
|
LTEXT "Sample:", -1, 13, 179, 61, 10
|
||||||
|
EDITTEXT IDC_LONGDATESAMPLE_EDIT, 77, 177, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||||
|
LTEXT "Sample - right to left read:", -1, 13, 193, 61, 16
|
||||||
|
EDITTEXT IDC_LONGDATERTOL_EDIT, 77, 195, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED
|
||||||
|
LTEXT "Long format:", -1, 13, 215, 60, 10
|
||||||
|
COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
IDD_LOCALEPAGE DIALOGEX 0, 0, 246, 188
|
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
|
||||||
CAPTION "Input Locale"
|
|
||||||
FONT 8, "MS Shell Dlg"
|
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Input Locale Page",-1,73,74,90,8
|
IDS_CUSTOMIZE_TITLE "Customize Regional Options"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
STRINGTABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_CPLNAME "Regional Options"
|
IDS_CPLNAME "Regional Options"
|
||||||
|
|
48
reactos/dll/cpl/intl/languages.c
Normal file
48
reactos/dll/cpl/intl/languages.c
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <cpl.h>
|
||||||
|
|
||||||
|
#include "intl.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
/* Property page dialog callback */
|
||||||
|
INT_PTR CALLBACK
|
||||||
|
LanguagesPageProc(HWND hwndDlg,
|
||||||
|
UINT uMsg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
SHELLEXECUTEINFOW shInputDll;
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
/* If "detail" button pressed */
|
||||||
|
case IDC_DETAIL_BUTTON:
|
||||||
|
if(HIWORD(wParam)==BN_CLICKED)
|
||||||
|
{
|
||||||
|
memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
|
||||||
|
shInputDll.cbSize = sizeof(shInputDll);
|
||||||
|
shInputDll.hwnd = hwndDlg;
|
||||||
|
shInputDll.lpVerb = L"open";
|
||||||
|
shInputDll.lpFile = L"RunDll32.exe";
|
||||||
|
shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
|
||||||
|
if(ShellExecuteExW(&shInputDll)==0)
|
||||||
|
{
|
||||||
|
MessageBox(NULL, L"Can't start input.dll", L"Error", MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
206
reactos/dll/cpl/intl/misc.c
Normal file
206
reactos/dll/cpl/intl/misc.c
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <cpl.h>
|
||||||
|
|
||||||
|
#include "intl.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define NUM_SHEETS 4
|
||||||
|
|
||||||
|
/* Insert the space */
|
||||||
|
WCHAR*
|
||||||
|
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
||||||
|
{
|
||||||
|
WCHAR* pwszDestStr;
|
||||||
|
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
|
int nDestStrCnt=0;
|
||||||
|
int nStrCnt;
|
||||||
|
int nStrSize;
|
||||||
|
|
||||||
|
wcscpy(pwszDestStr,wszInsStr);
|
||||||
|
|
||||||
|
nStrSize = wcslen(wszInsStr);
|
||||||
|
|
||||||
|
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
||||||
|
{
|
||||||
|
if(nStrCnt==nStrSize-nPos)
|
||||||
|
{
|
||||||
|
pwszDestStr[nDestStrCnt]=' ';
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
pwszDestStr[nDestStrCnt]='\0';
|
||||||
|
|
||||||
|
return pwszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert the spaces by format string separated by ';' */
|
||||||
|
WCHAR*
|
||||||
|
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||||
|
{
|
||||||
|
WCHAR* pwszDestStr;
|
||||||
|
pwszDestStr=(WCHAR*) malloc(255);
|
||||||
|
|
||||||
|
WCHAR* pwszTempStr;
|
||||||
|
|
||||||
|
WCHAR wszFmtVal[255];
|
||||||
|
|
||||||
|
int nFmtCount=0;
|
||||||
|
int nValCount=0;
|
||||||
|
int nLastVal=0;
|
||||||
|
int nSpaceOffset=0;
|
||||||
|
|
||||||
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
|
wcscpy(pwszDestStr,wszSourceStr);
|
||||||
|
|
||||||
|
/* if format is clean return source string */
|
||||||
|
if(!*wszFmtStr) return pwszDestStr;
|
||||||
|
|
||||||
|
/* Search for all format values */
|
||||||
|
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
||||||
|
{
|
||||||
|
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
||||||
|
{
|
||||||
|
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
||||||
|
{
|
||||||
|
wasNul=TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* If was 0, repeat spaces */
|
||||||
|
if(wasNul)
|
||||||
|
{
|
||||||
|
nSpaceOffset+=nLastVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nSpaceOffset+=_wtoi(wszFmtVal);
|
||||||
|
}
|
||||||
|
wszFmtVal[nValCount]='\0';
|
||||||
|
nValCount=0;
|
||||||
|
/* insert space to finded position plus all pos before */
|
||||||
|
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
||||||
|
wcscpy(pwszDestStr,pwszTempStr);
|
||||||
|
free(pwszTempStr);
|
||||||
|
/* num of spaces total increment */
|
||||||
|
|
||||||
|
if(!wasNul)
|
||||||
|
{
|
||||||
|
nSpaceOffset++;
|
||||||
|
nLastVal=_wtoi(wszFmtVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create spaces for rest part of string */
|
||||||
|
if(wasNul && nLastVal!=0)
|
||||||
|
{
|
||||||
|
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
||||||
|
{
|
||||||
|
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
||||||
|
wcscpy(pwszDestStr,pwszTempStr);
|
||||||
|
free(pwszTempStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pwszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
|
WCHAR*
|
||||||
|
ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
|
const WCHAR *wszStrToReplace,
|
||||||
|
const WCHAR *wszTempl)
|
||||||
|
{
|
||||||
|
int nCharCnt;
|
||||||
|
int nSubStrCnt;
|
||||||
|
int nDestStrCnt;
|
||||||
|
int nFirstCharCnt;
|
||||||
|
|
||||||
|
WCHAR* wszDestStr;
|
||||||
|
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||||
|
|
||||||
|
nDestStrCnt=0;
|
||||||
|
nFirstCharCnt=0;
|
||||||
|
|
||||||
|
wcscpy(wszDestStr,L"");
|
||||||
|
|
||||||
|
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
||||||
|
{
|
||||||
|
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
||||||
|
{
|
||||||
|
nSubStrCnt=0;
|
||||||
|
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
||||||
|
{
|
||||||
|
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
||||||
|
{
|
||||||
|
nSubStrCnt++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((int)wcslen(wszTempl)==nSubStrCnt)
|
||||||
|
{
|
||||||
|
wcscat(wszDestStr,wszStrToReplace);
|
||||||
|
nDestStrCnt=(int)wcslen(wszDestStr);
|
||||||
|
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
||||||
|
wszDestStr[nDestStrCnt]='\0';
|
||||||
|
}
|
||||||
|
nFirstCharCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create applets */
|
||||||
|
LONG
|
||||||
|
APIENTRY
|
||||||
|
SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||||
|
{
|
||||||
|
PROPSHEETPAGE PsPage[NUM_SHEETS];
|
||||||
|
PROPSHEETHEADER psh;
|
||||||
|
TCHAR Caption[MAX_STR_SIZE];
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
|
UNREFERENCED_PARAMETER(wParam);
|
||||||
|
UNREFERENCED_PARAMETER(uMsg);
|
||||||
|
UNREFERENCED_PARAMETER(hwnd);
|
||||||
|
|
||||||
|
LoadString(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||||
|
|
||||||
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
|
||||||
|
psh.hwndParent = NULL;
|
||||||
|
psh.hInstance = hApplet;
|
||||||
|
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||||
|
psh.pszCaption = Caption;
|
||||||
|
psh.nPages = sizeof(PsPage) / sizeof(PROPSHEETPAGE);
|
||||||
|
psh.nStartPage = 0;
|
||||||
|
psh.ppsp = PsPage;
|
||||||
|
|
||||||
|
InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc);
|
||||||
|
InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc);
|
||||||
|
InitPropSheetPage(&PsPage[2], IDD_TIMEPAGE, TimePageProc);
|
||||||
|
InitPropSheetPage(&PsPage[3], IDD_DATEPAGE, DatePageProc);
|
||||||
|
|
||||||
|
return (LONG)(PropertySheet(&psh) != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -31,6 +31,743 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define SAMPLE_NUMBER L"123456789"
|
||||||
|
#define SAMPLE_NEG_NUMBER L"-123456789"
|
||||||
|
#define MAX_NUM_SEP_SAMPLES 2
|
||||||
|
#define MAX_FRAC_NUM_SAMPLES 9
|
||||||
|
#define MAX_FIELD_SEP_SAMPLES 1
|
||||||
|
#define MAX_FIELD_DIG_SAMPLES 3
|
||||||
|
#define MAX_NEG_SIGN_SAMPLES 1
|
||||||
|
#define MAX_NEG_NUMBERS_SAMPLES 5
|
||||||
|
#define MAX_LEAD_ZEROES_SAMPLES 2
|
||||||
|
#define MAX_LIST_SEP_SAMPLES 1
|
||||||
|
#define MAX_UNITS_SYS_SAMPLES 2
|
||||||
|
#define EOLN_SIZE sizeof(WCHAR)
|
||||||
|
|
||||||
|
/* Init num decimal separator control box */
|
||||||
|
VOID
|
||||||
|
InitNumDecimalSepCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNumSepSamples[MAX_NUM_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L",",
|
||||||
|
L"."
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current decimal separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SDECIMAL,
|
||||||
|
wszNumSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of decimal separators */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_NUM_SEP_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszNumSepSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszNumSep);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_NUM_SEP_SAMPLES+1,
|
||||||
|
(LPARAM)wszNumSep);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszNumSep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init number of fractional symbols control box */
|
||||||
|
VOID
|
||||||
|
InitNumOfFracSymbCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszFracNum[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszFracCount[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current number of fractional symbols */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_IDIGITS,
|
||||||
|
wszFracNum,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of fractional symbols */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_FRAC_NUM_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCBIndex,wszFracCount,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszFracCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
(WPARAM)_wtoi(wszFracNum),
|
||||||
|
(LPARAM)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init field separator control box */
|
||||||
|
VOID
|
||||||
|
InitNumFieldSepCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFieldSepSamples[MAX_FIELD_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L" "
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current field separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_STHOUSAND,
|
||||||
|
wszFieldSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of field separators */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_FIELD_SEP_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszFieldSepSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszFieldSep);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_FIELD_SEP_SAMPLES+1,
|
||||||
|
(LPARAM)wszFieldSep);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszFieldSep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init number of digidts in field control box */
|
||||||
|
VOID
|
||||||
|
InitFieldDigNumCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"0;0",
|
||||||
|
L"3;0",
|
||||||
|
L"3;2;0"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR* pwszFieldDigNumSmpl;
|
||||||
|
|
||||||
|
/* Get current field digits num */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SGROUPING,
|
||||||
|
wszFieldDigNum,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of field digits num */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_FIELD_DIG_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
|
||||||
|
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNumSamples[nCBIndex]);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)pwszFieldDigNumSmpl);
|
||||||
|
free(pwszFieldDigNumSmpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNum);
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_FIELD_DIG_SAMPLES+1,
|
||||||
|
(LPARAM)pwszFieldDigNumSmpl);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pwszFieldDigNumSmpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init negative sign control box */
|
||||||
|
VOID
|
||||||
|
InitNegSignCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNegSignSamples[MAX_NEG_SIGN_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"-"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current negative sign */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SNEGATIVESIGN,
|
||||||
|
wszNegSign,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of signs */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_NEG_SIGN_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszNegSignSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszNegSign);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_NUM_SEP_SAMPLES+1,
|
||||||
|
(LPARAM)wszNegSign);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszNegSign);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init negative numbers format control box */
|
||||||
|
VOID
|
||||||
|
InitNegNumFmtCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"(1,1)",
|
||||||
|
L"-1,1",
|
||||||
|
L"- 1,1",
|
||||||
|
L"1,1-",
|
||||||
|
L"1,1 -"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
WCHAR wszNegNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszNewSample[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR* pwszResultStr;
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
|
||||||
|
/* Get current negative numbers format */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_INEGNUMBER,
|
||||||
|
wszNegNumFmt,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Get current decimal separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SDECIMAL,
|
||||||
|
wszNumSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Get current negative sign */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SNEGATIVESIGN,
|
||||||
|
wszNegSign,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Create standart list of negative numbers formats */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_NEG_NUMBERS_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
/* Replace standart separator to setted */
|
||||||
|
pwszResultStr = ReplaceSubStr(wszNegNumFmtSamples[nCBIndex],
|
||||||
|
wszNumSep,
|
||||||
|
L",");
|
||||||
|
wcscpy(wszNewSample,pwszResultStr);
|
||||||
|
free(pwszResultStr);
|
||||||
|
/* Replace standart negative sign to setted */
|
||||||
|
pwszResultStr = ReplaceSubStr(wszNewSample,
|
||||||
|
wszNegSign,
|
||||||
|
L"-");
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)pwszResultStr);
|
||||||
|
free(pwszResultStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
(WPARAM)_wtoi(wszNegNumFmt),
|
||||||
|
(LPARAM)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init leading zeroes control box */
|
||||||
|
VOID
|
||||||
|
InitLeadingZeroesCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L",7",
|
||||||
|
L"0,7"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
WCHAR wszLeadNumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
WCHAR* pwszResultStr;
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
|
||||||
|
/* Get current leading zeroes format */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_ILZERO,
|
||||||
|
wszLeadNumFmt,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Get current decimal separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SDECIMAL,
|
||||||
|
wszNumSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Create list of standart leading zeroes formats */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_LEAD_ZEROES_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
pwszResultStr = ReplaceSubStr(wszLeadNumFmtSamples[nCBIndex],
|
||||||
|
wszNumSep,
|
||||||
|
L",");
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)pwszResultStr);
|
||||||
|
free(pwszResultStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
(WPARAM)_wtoi(wszLeadNumFmt),
|
||||||
|
(LPARAM)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InitListSepCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszListSepSamples[MAX_LIST_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L";"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCBIndex;
|
||||||
|
int nRetCode;
|
||||||
|
|
||||||
|
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||||
|
WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get current list separator */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_SLIST,
|
||||||
|
wszListSep,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create standart list of signs */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_LIST_SEP_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszListSepSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszListSep);
|
||||||
|
|
||||||
|
/* if is not success, add new value to list and select them */
|
||||||
|
if(nRetCode == CB_ERR)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
MAX_LIST_SEP_SAMPLES+1,
|
||||||
|
(LPARAM)wszListSep);
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
CB_SELECTSTRING,
|
||||||
|
-1,
|
||||||
|
(LPARAM)(LPCSTR)wszListSep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init system of units control box */
|
||||||
|
VOID
|
||||||
|
InitUnitsSysCB(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszUnitsSysSamples[MAX_UNITS_SYS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"Metrics",
|
||||||
|
L"Americans"
|
||||||
|
};
|
||||||
|
|
||||||
|
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 */
|
||||||
|
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||||
|
LOCALE_IMEASURE,
|
||||||
|
wszUnitsSys,
|
||||||
|
dwValueSize);
|
||||||
|
|
||||||
|
/* Clear all box content */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Create list of standart system of units */
|
||||||
|
for(nCBIndex=0;nCBIndex<MAX_UNITS_SYS_SAMPLES;nCBIndex++)
|
||||||
|
{
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
|
CB_ADDSTRING,
|
||||||
|
nCBIndex,
|
||||||
|
(LPARAM)wszUnitsSysSamples[nCBIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set current item to value from registry */
|
||||||
|
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
|
CB_SETCURSEL,
|
||||||
|
(WPARAM)_wtoi(wszUnitsSys),
|
||||||
|
(LPARAM)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update all numbers locale samples */
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
UpdateNumSamples(HWND hwndDlg,
|
||||||
|
LCID lcidLocale)
|
||||||
|
{
|
||||||
|
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||||
|
|
||||||
|
/* Get positive number format sample */
|
||||||
|
GetNumberFormatW(lcidLocale,
|
||||||
|
0,
|
||||||
|
SAMPLE_NUMBER,
|
||||||
|
NULL,
|
||||||
|
OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
|
||||||
|
/* Get positive number format sample */
|
||||||
|
GetNumberFormatW(lcidLocale,
|
||||||
|
0,
|
||||||
|
SAMPLE_NEG_NUMBER,
|
||||||
|
NULL,
|
||||||
|
OutBuffer,
|
||||||
|
MAX_FMT_SIZE);
|
||||||
|
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)OutBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set num decimal separator */
|
||||||
|
BOOL
|
||||||
|
SetNumDecimalSep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszDecimalSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted decimal separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszDecimalSep);
|
||||||
|
|
||||||
|
/* Save decimal separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set number of fractional symbols */
|
||||||
|
BOOL
|
||||||
|
SetFracSymNum(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFracSymNum[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted number of fractional symbols */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszFracSymNum,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save number of fractional symbols */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDIGITS, wszFracSymNum);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set field separator */
|
||||||
|
BOOL
|
||||||
|
SetNumFieldSep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted field separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszFieldSep);
|
||||||
|
|
||||||
|
/* Save field separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wszFieldSep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set number of digidts in field */
|
||||||
|
BOOL
|
||||||
|
SetFieldDigNum(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||||
|
{
|
||||||
|
L"0;0",
|
||||||
|
L"3;0",
|
||||||
|
L"3;2;0"
|
||||||
|
};
|
||||||
|
|
||||||
|
int nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted number of digidts in field */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* Save number of digidts in field */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set negative sign */
|
||||||
|
BOOL
|
||||||
|
SetNumNegSign(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted negative sign */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszNegSign);
|
||||||
|
|
||||||
|
/* Save negative sign */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, wszNegSign);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set negative sum format */
|
||||||
|
BOOL
|
||||||
|
SetNegSumFmt(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszNegSumFmt[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted negative sum format */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszNegSumFmt,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save negative sum format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, wszNegSumFmt);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set leading zero */
|
||||||
|
BOOL
|
||||||
|
SetNumLeadZero(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszLeadZero[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted leading zero format */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszLeadZero,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save leading zero format */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ILZERO, wszLeadZero);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set elements list separator */
|
||||||
|
BOOL
|
||||||
|
SetNumListSep(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
|
||||||
|
|
||||||
|
/* Get setted list separator */
|
||||||
|
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
||||||
|
WM_GETTEXT,
|
||||||
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||||
|
(LPARAM)(LPCSTR)wszListSep);
|
||||||
|
|
||||||
|
/* Save list separator */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLIST, wszListSep);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set units system */
|
||||||
|
BOOL
|
||||||
|
SetNumUnitsSys(HWND hwndDlg)
|
||||||
|
{
|
||||||
|
WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||||
|
INT nCurrSel;
|
||||||
|
|
||||||
|
/* Get setted units system */
|
||||||
|
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
||||||
|
CB_GETCURSEL,
|
||||||
|
(WPARAM)0,
|
||||||
|
(LPARAM)0);
|
||||||
|
|
||||||
|
/* convert to wide char */
|
||||||
|
_itow(nCurrSel,wszUnitsSys,DECIMAL_RADIX);
|
||||||
|
|
||||||
|
/* Save units system */
|
||||||
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, wszUnitsSys);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
@ -42,7 +779,60 @@ NumbersPageProc(HWND hwndDlg,
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
break;
|
{
|
||||||
|
InitNumDecimalSepCB(hwndDlg);
|
||||||
|
InitNumOfFracSymbCB(hwndDlg);
|
||||||
|
InitNumFieldSepCB(hwndDlg);
|
||||||
|
InitFieldDigNumCB(hwndDlg);
|
||||||
|
InitNegSignCB(hwndDlg);
|
||||||
|
InitNegNumFmtCB(hwndDlg);
|
||||||
|
InitLeadingZeroesCB(hwndDlg);
|
||||||
|
InitListSepCB(hwndDlg);
|
||||||
|
InitUnitsSysCB(hwndDlg);
|
||||||
|
UpdateNumSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_NUMBERDSYMBOL:
|
||||||
|
case IDC_NUMBERSNDIGDEC:
|
||||||
|
case IDC_NUMBERSDIGITGRSYM:
|
||||||
|
case IDC_NUMBERSDGROUPING:
|
||||||
|
case IDC_NUMBERSNSIGNSYM:
|
||||||
|
case IDC_NUMBERSNNUMFORMAT:
|
||||||
|
case IDC_NUMBERSDISPLEADZER:
|
||||||
|
case IDC_NUMBERSLSEP:
|
||||||
|
case IDC_NUMBERSMEASSYS:
|
||||||
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
||||||
|
{
|
||||||
|
/* Set "Apply" button enabled */
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||||
|
/* If push apply button */
|
||||||
|
if (lpnm->code == (UINT)PSN_APPLY)
|
||||||
|
{
|
||||||
|
if(!SetNumDecimalSep(hwndDlg)) break;
|
||||||
|
if(!SetFracSymNum(hwndDlg)) break;
|
||||||
|
if(!SetNumFieldSep(hwndDlg)) break;
|
||||||
|
if(!SetFieldDigNum(hwndDlg)) break;
|
||||||
|
if(!SetNumNegSign(hwndDlg)) break;
|
||||||
|
if(!SetNegSumFmt(hwndDlg)) break;
|
||||||
|
if(!SetNumLeadZero(hwndDlg)) break;
|
||||||
|
if(!SetNumListSep(hwndDlg)) break;
|
||||||
|
if(!SetNumUnitsSys(hwndDlg)) break;
|
||||||
|
|
||||||
|
UpdateNumSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,21 @@
|
||||||
|
|
||||||
#define IDC_CPLICON 200
|
#define IDC_CPLICON 200
|
||||||
#define IDC_FLAGS 2
|
#define IDC_FLAGS 2
|
||||||
#define IDC_ICON1 3
|
|
||||||
|
|
||||||
#define IDD_GENERALPAGE 100
|
#define IDD_GENERALPAGE 100
|
||||||
#define IDD_NUMBERSPAGE 101
|
#define IDD_NUMBERSPAGE 101
|
||||||
|
|
||||||
|
#define IDC_NUMSAMPLE_EDIT 300
|
||||||
|
#define IDC_MONEYSAMPLE_EDIT 301
|
||||||
|
#define IDC_TIMESAMPLE_EDIT 302
|
||||||
|
#define IDC_SHORTTIMESAMPLE_EDIT 303
|
||||||
|
#define IDC_FULLTIMESAMPLE_EDIT 304
|
||||||
|
#define IDC_SETUP_BUTTON 305
|
||||||
|
|
||||||
#define IDD_CURRENCYPAGE 140
|
#define IDD_CURRENCYPAGE 140
|
||||||
#define IDC_CURRENCYPOSSAMPLE 141
|
#define IDC_CURRENCYPOSSAMPLE 141
|
||||||
#define IDC_CURRENCYNEGSAMPLE 142
|
#define IDC_CURRENCYNEGSAMPLE 142
|
||||||
#define IDC_CURRENCYSYMBOL 143
|
#define IDC_CURRENCYSYMBOL 143
|
||||||
#define IDC_CURRENCYPOSVALUE 144
|
#define IDC_CURRENCYPOSVALUE 144
|
||||||
#define IDC_CURRENCYNEGVALUE 145
|
#define IDC_CURRENCYNEGVALUE 145
|
||||||
#define IDC_CURRENCYDECSEP 146
|
#define IDC_CURRENCYDECSEP 146
|
||||||
|
@ -20,6 +26,18 @@
|
||||||
#define IDC_CURRENCYGRPSEP 149
|
#define IDC_CURRENCYGRPSEP 149
|
||||||
#define IDC_CURRENCYGRPNUM 150
|
#define IDC_CURRENCYGRPNUM 150
|
||||||
|
|
||||||
|
#define IDC_NUMBERSPOSSAMPLE 250
|
||||||
|
#define IDC_NUMBERSNEGSAMPLE 251
|
||||||
|
#define IDC_NUMBERDSYMBOL 252
|
||||||
|
#define IDC_NUMBERSNDIGDEC 253
|
||||||
|
#define IDC_NUMBERSDIGITGRSYM 254
|
||||||
|
#define IDC_NUMBERSDGROUPING 255
|
||||||
|
#define IDC_NUMBERSNSIGNSYM 256
|
||||||
|
#define IDC_NUMBERSNNUMFORMAT 257
|
||||||
|
#define IDC_NUMBERSDISPLEADZER 258
|
||||||
|
#define IDC_NUMBERSLSEP 259
|
||||||
|
#define IDC_NUMBERSMEASSYS 260
|
||||||
|
|
||||||
#define IDD_TIMEPAGE 103
|
#define IDD_TIMEPAGE 103
|
||||||
#define IDC_TIMESAMPLE 107
|
#define IDC_TIMESAMPLE 107
|
||||||
#define IDC_TIMEFORMAT 108
|
#define IDC_TIMEFORMAT 108
|
||||||
|
@ -28,11 +46,34 @@
|
||||||
#define IDC_TIMEPMSYMBOL 111
|
#define IDC_TIMEPMSYMBOL 111
|
||||||
|
|
||||||
#define IDD_DATEPAGE 104
|
#define IDD_DATEPAGE 104
|
||||||
#define IDD_LOCALEPAGE 105
|
|
||||||
#define IDC_LANGUAGELIST 106
|
#define IDC_LANGUAGELIST 106
|
||||||
|
#define IDD_LANGUAGESPAGE 112
|
||||||
|
#define IDD_ADVANCEDPAGE 113
|
||||||
|
#define IDC_LOCATION_COMBO 114
|
||||||
|
#define IDC_DETAIL_BUTTON 115
|
||||||
|
#define IDC_LANGUAGE_COMBO 116
|
||||||
|
|
||||||
#define IDS_CPLNAME 1000
|
#define IDC_GROUPBOX 350
|
||||||
|
#define IDC_FIRSTYEAR_EDIT 351
|
||||||
|
#define IDC_SECONDYEAR_EDIT 352
|
||||||
|
#define IDC_SCR_MAX_YEAR 353
|
||||||
|
#define IDC_CALTYPE_COMBO 354
|
||||||
|
#define IDC_HIJCHRON_COMBO 355
|
||||||
|
#define IDC_SHRTDATESAMPLE_EDIT 356
|
||||||
|
#define IDC_SHRTDATERTOL_EDIT 357
|
||||||
|
#define IDC_SHRTDATEFMT_COMBO 358
|
||||||
|
#define IDC_SHRTDATESEP_COMBO 359
|
||||||
|
#define IDC_LONGDATESAMPLE_EDIT 361
|
||||||
|
#define IDC_LONGDATERTOL_EDIT 362
|
||||||
|
#define IDC_LONGDATEFMT_COMBO 363
|
||||||
|
#define IDC_INST_FILES_FOR_RTOL_LANG 364
|
||||||
|
#define IDC_INST_FILES_FOR_ASIAN 365
|
||||||
|
#define IDC_APPLY_CUR_USER_DEF_PROFILE 366
|
||||||
|
#define IDC_CONV_TABLES 367
|
||||||
|
|
||||||
|
#define IDS_CPLNAME 1000
|
||||||
#define IDS_CPLDESCRIPTION 1001
|
#define IDS_CPLDESCRIPTION 1001
|
||||||
|
#define IDS_CUSTOMIZE_TITLE 1002
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CPL_RESOURCE_H */
|
#endif /* __CPL_RESOURCE_H */
|
||||||
|
|
233
reactos/dll/cpl/intl/setupreg.c
Normal file
233
reactos/dll/cpl/intl/setupreg.c
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS International Control Panel
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: dll/cpl/intl/setupreg.c
|
||||||
|
* PURPOSE: ReactOS International Control Panel
|
||||||
|
* PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <cpl.h>
|
||||||
|
|
||||||
|
#include "intl.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
|
#define NUM_SHEETS 4
|
||||||
|
|
||||||
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
/* Insert the space */
|
||||||
|
WCHAR*
|
||||||
|
InsSpacePos(const WCHAR *wszInsStr, const int nPos)
|
||||||
|
{
|
||||||
|
WCHAR* pwszDestStr;
|
||||||
|
pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
|
||||||
|
|
||||||
|
int nDestStrCnt=0;
|
||||||
|
int nStrCnt;
|
||||||
|
int nStrSize;
|
||||||
|
|
||||||
|
wcscpy(pwszDestStr,wszInsStr);
|
||||||
|
|
||||||
|
nStrSize = wcslen(wszInsStr);
|
||||||
|
|
||||||
|
for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
|
||||||
|
{
|
||||||
|
if(nStrCnt==nStrSize-nPos)
|
||||||
|
{
|
||||||
|
pwszDestStr[nDestStrCnt]=' ';
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
|
||||||
|
nDestStrCnt++;
|
||||||
|
}
|
||||||
|
pwszDestStr[nDestStrCnt]='\0';
|
||||||
|
|
||||||
|
return pwszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert the spaces by format string separated by ';' */
|
||||||
|
WCHAR*
|
||||||
|
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
|
||||||
|
{
|
||||||
|
WCHAR* pwszDestStr;
|
||||||
|
pwszDestStr=(WCHAR*) malloc(255);
|
||||||
|
|
||||||
|
WCHAR* pwszTempStr;
|
||||||
|
|
||||||
|
WCHAR wszFmtVal[255];
|
||||||
|
|
||||||
|
int nFmtCount=0;
|
||||||
|
int nValCount=0;
|
||||||
|
int nLastVal=0;
|
||||||
|
int nSpaceOffset=0;
|
||||||
|
|
||||||
|
BOOL wasNul=FALSE;
|
||||||
|
|
||||||
|
wcscpy(pwszDestStr,wszSourceStr);
|
||||||
|
|
||||||
|
/* if format is clean return source string */
|
||||||
|
if(!*wszFmtStr) return pwszDestStr;
|
||||||
|
|
||||||
|
/* Search for all format values */
|
||||||
|
for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
|
||||||
|
{
|
||||||
|
if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
|
||||||
|
{
|
||||||
|
if(_wtoi(wszFmtVal)==0 && !wasNul)
|
||||||
|
{
|
||||||
|
wasNul=TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* If was 0, repeat spaces */
|
||||||
|
if(wasNul)
|
||||||
|
{
|
||||||
|
nSpaceOffset+=nLastVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nSpaceOffset+=_wtoi(wszFmtVal);
|
||||||
|
}
|
||||||
|
wszFmtVal[nValCount]='\0';
|
||||||
|
nValCount=0;
|
||||||
|
/* insert space to finded position plus all pos before */
|
||||||
|
pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
|
||||||
|
wcscpy(pwszDestStr,pwszTempStr);
|
||||||
|
free(pwszTempStr);
|
||||||
|
/* num of spaces total increment */
|
||||||
|
|
||||||
|
if(!wasNul)
|
||||||
|
{
|
||||||
|
nSpaceOffset++;
|
||||||
|
nLastVal=_wtoi(wszFmtVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create spaces for rest part of string */
|
||||||
|
if(wasNul && nLastVal!=0)
|
||||||
|
{
|
||||||
|
for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
|
||||||
|
{
|
||||||
|
pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
|
||||||
|
wcscpy(pwszDestStr,pwszTempStr);
|
||||||
|
free(pwszTempStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pwszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace given template in source string with string to replace and return recieved string */
|
||||||
|
WCHAR*
|
||||||
|
ReplaceSubStr(const WCHAR *wszSourceStr,
|
||||||
|
const WCHAR *wszStrToReplace,
|
||||||
|
const WCHAR *wszTempl)
|
||||||
|
{
|
||||||
|
int nCharCnt;
|
||||||
|
int nSubStrCnt;
|
||||||
|
int nDestStrCnt;
|
||||||
|
int nFirstCharCnt;
|
||||||
|
|
||||||
|
WCHAR* wszDestStr;
|
||||||
|
wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||||
|
|
||||||
|
nDestStrCnt=0;
|
||||||
|
nFirstCharCnt=0;
|
||||||
|
|
||||||
|
wcscpy(wszDestStr,L"");
|
||||||
|
|
||||||
|
while(nFirstCharCnt<(int)wcslen(wszSourceStr))
|
||||||
|
{
|
||||||
|
if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
|
||||||
|
{
|
||||||
|
nSubStrCnt=0;
|
||||||
|
for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
|
||||||
|
{
|
||||||
|
if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
|
||||||
|
{
|
||||||
|
nSubStrCnt++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((int)wcslen(wszTempl)==nSubStrCnt)
|
||||||
|
{
|
||||||
|
wcscat(wszDestStr,wszStrToReplace);
|
||||||
|
nDestStrCnt=(int)wcslen(wszDestStr);
|
||||||
|
nFirstCharCnt+=(int)wcslen(wszTempl)-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
|
||||||
|
wszDestStr[nDestStrCnt]='\0';
|
||||||
|
}
|
||||||
|
nFirstCharCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wszDestStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
InitPropSheetPage(PROPSHEETPAGE *PsPage, WORD IdDlg, DLGPROC DlgProc)
|
||||||
|
{
|
||||||
|
ZeroMemory(PsPage, sizeof(PROPSHEETPAGE));
|
||||||
|
PsPage->dwSize = sizeof(PROPSHEETPAGE);
|
||||||
|
PsPage->dwFlags = PSP_DEFAULT;
|
||||||
|
PsPage->hInstance = hApplet;
|
||||||
|
PsPage->pszTemplate = MAKEINTRESOURCE(IdDlg);
|
||||||
|
PsPage->pfnDlgProc = DlgProc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create applets */
|
||||||
|
LONG
|
||||||
|
APIENTRY
|
||||||
|
SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
||||||
|
{
|
||||||
|
|
||||||
|
PROPSHEETPAGE PsPage[NUM_SHEETS];
|
||||||
|
PROPSHEETHEADER psh;
|
||||||
|
TCHAR Caption[MAX_STR_SIZE];
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
|
UNREFERENCED_PARAMETER(wParam);
|
||||||
|
UNREFERENCED_PARAMETER(uMsg);
|
||||||
|
UNREFERENCED_PARAMETER(hwnd);
|
||||||
|
|
||||||
|
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||||
|
|
||||||
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
|
||||||
|
psh.hwndParent = NULL;
|
||||||
|
psh.hInstance = hApplet;
|
||||||
|
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
|
||||||
|
psh.pszCaption = Caption;
|
||||||
|
psh.nPages = sizeof(PsPage) / sizeof(PROPSHEETPAGE);
|
||||||
|
psh.nStartPage = 0;
|
||||||
|
psh.ppsp = PsPage;
|
||||||
|
|
||||||
|
InitPropSheetPage(&PsPage[0], IDD_NUMSOPTSSETUP, NumsOptsSetProc);
|
||||||
|
InitPropSheetPage(&PsPage[1], IDD_CURRENCYOPTSSETUP, CurrencyOptsSetProc);
|
||||||
|
InitPropSheetPage(&PsPage[2], IDD_TIMEOPTSSETUP, TimeOptsSetProc);
|
||||||
|
InitPropSheetPage(&PsPage[3], IDD_DATEOPTSSETUP, DateOptsSetProc);
|
||||||
|
|
||||||
|
return (LONG)(PropertySheet(&psh) != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -67,7 +67,7 @@ TimePageProc(HWND hwndDlg,
|
||||||
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
|
||||||
|
|
||||||
/* Get the time format (max. 80 characters) */
|
/* Get the time format (max. 80 characters) */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessageW(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 */
|
||||||
|
@ -77,26 +77,26 @@ TimePageProc(HWND hwndDlg,
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessageW(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) */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_LIMITTEXT, 4, 0);
|
CB_LIMITTEXT, 4, 0);
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_ADDSTRING,
|
CB_ADDSTRING,
|
||||||
0,
|
0,
|
||||||
(LPARAM)Buffer);
|
(LPARAM)Buffer);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessageW(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) */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
|
@ -110,13 +110,13 @@ TimePageProc(HWND hwndDlg,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)L"");
|
||||||
}
|
}
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessageW(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) */
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_LIMITTEXT, 9, 0);
|
CB_LIMITTEXT, 9, 0);
|
||||||
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
|
||||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
|
@ -130,7 +130,7 @@ TimePageProc(HWND hwndDlg,
|
||||||
0,
|
0,
|
||||||
(LPARAM)L"");
|
(LPARAM)L"");
|
||||||
}
|
}
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_SETCURSEL,
|
CB_SETCURSEL,
|
||||||
0, /* index */
|
0, /* index */
|
||||||
0);
|
0);
|
||||||
|
@ -163,25 +163,25 @@ TimePageProc(HWND hwndDlg,
|
||||||
int nIndex;
|
int nIndex;
|
||||||
|
|
||||||
/* Set time format */
|
/* Set time format */
|
||||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
|
||||||
|
|
||||||
/* Set time separator */
|
/* Set time separator */
|
||||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
|
||||||
|
|
||||||
/* Set the AM symbol */
|
/* Set the AM symbol */
|
||||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
|
||||||
}
|
}
|
||||||
|
@ -191,11 +191,11 @@ TimePageProc(HWND hwndDlg,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the PM symbol */
|
/* Set the PM symbol */
|
||||||
nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETCURSEL, 0, 0);
|
CB_GETCURSEL, 0, 0);
|
||||||
if (nIndex != CB_ERR)
|
if (nIndex != CB_ERR)
|
||||||
{
|
{
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
|
||||||
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
|
||||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue