mirror of
https://github.com/reactos/reactos.git
synced 2024-07-05 12:15:46 +00:00
Alexey Zavyalov: Add functionally Numbers, Currency, Time, Date tabs. Fix some bugs.
See issue #1988 for more details. svn path=/trunk/; revision=25603
This commit is contained in:
parent
89056c2f7a
commit
12e90157e6
|
@ -39,6 +39,139 @@ BEGIN
|
|||
LTEXT "This option...", -1, 14, 18, 223, 33
|
||||
LTEXT "Select language...", -1, 14, 55, 223, 18
|
||||
GROUPBOX "Transformation tables codepages", -1, 5, 101, 242, 88
|
||||
/* TODO: add other components*/
|
||||
END
|
||||
|
||||
IDD_LANGSOPTSPAGE DIALOGEX 0, 0, 252, 236
|
||||
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, 3, 242, 52
|
||||
LTEXT "To view or change language or text input methods press ""Detail...""", -1, 12, 13, 230, 18
|
||||
PUSHBUTTON "De&tail...", IDC_DETAIL_BUTTON, 186, 34, 54, 14
|
||||
GROUPBOX "Additionary language support", IDC_GROUPBOX, 5, 60, 242, 82
|
||||
/* TODO: add other components*/
|
||||
END
|
||||
|
||||
IDD_NUMSOPTSSETUP DIALOGEX 0, 0, 252, 236
|
||||
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Numbers"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Samples", IDC_GROUPBOX, 5, 7, 242, 48
|
||||
LTEXT "Positive:", -1, 11, 20, 28, 10
|
||||
EDITTEXT IDC_NUM_EDIT, 42, 18, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Negative:", -1, 128, 20, 31, 10
|
||||
EDITTEXT IDC_NEGNUM_EDIT, 162, 18, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Positive:", -1, 11, 38, 28, 10
|
||||
EDITTEXT IDC_NUM1_EDIT, 42, 36, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Negative:", -1, 128, 38, 31, 10
|
||||
EDITTEXT IDC_NEGNUM1_EDIT, 162, 36, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Whole and fractional part separator:", -1, 18, 61, 126, 9
|
||||
COMBOBOX IDC_NUMDECIMALSEP_COMBO, 147, 59, 100, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Number of fractional symbols:", -1, 18, 77, 126, 9
|
||||
COMBOBOX IDC_NUMFRACSYBMS_COMBO, 147, 75, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Field separator:", -1, 18, 93, 126, 9
|
||||
COMBOBOX IDC_NUMFIELDSEP_COMBO, 147, 91, 100, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Number of digidts in field:", -1, 18, 109, 126, 9
|
||||
COMBOBOX IDC_NUMDIGFIELD_COMBO, 147, 107, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Negative number sign:", -1, 18, 125, 126, 9
|
||||
COMBOBOX IDC_NUMNEGSIGN_COMBO, 147, 123, 100, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Negative numbers format:", -1, 18, 141, 126, 9
|
||||
COMBOBOX IDC_NUMNEGFMT_COMBO, 147, 139, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Leading zeroes:", -1, 18, 157, 126, 9
|
||||
COMBOBOX IDC_NUMLEADZERO_COMBO, 147, 155, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Elements list separator:", -1, 18, 173, 126, 9
|
||||
COMBOBOX IDC_NUMELEMLISTSEP_COMBO, 147, 171, 100, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "System of units:", -1, 18, 189, 126, 9
|
||||
COMBOBOX IDC_NUMUNITSSYS_COMBO, 147, 187, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Region corresponding digits:", -1, 18, 205, 126, 9
|
||||
COMBOBOX IDC_NUMREGDIG_COMBO, 147, 203, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Digit replacement:", -1, 18, 221, 126, 9
|
||||
COMBOBOX IDC_NUMDIGREPL_COMBO, 147, 219, 100, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_CURRENCYOPTSSETUP DIALOGEX 0, 0, 252, 236
|
||||
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Currency"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Samples", IDC_GROUPBOX, 5, 7, 242, 40
|
||||
LTEXT "Positive:", -1, 10, 25, 30, 10
|
||||
EDITTEXT IDC_CURRENCY_EDIT, 42, 23, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Negative:", -1, 128, 25, 31, 10
|
||||
EDITTEXT IDC_NEGCURRENCY_EDIT, 162, 23, 80, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Monetary unit:", -1, 20, 61, 126, 9
|
||||
COMBOBOX IDC_CURRENCYUNIT_COMBO, 148, 59, 90, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE | CBS_SORT
|
||||
LTEXT "Positive sum of money format:", -1, 20, 78, 126, 9
|
||||
COMBOBOX IDC_POSCURRENCYSUM_COMBO, 148, 76, 90, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Negative sum of money format:", -1, 20, 95, 126, 9
|
||||
COMBOBOX IDC_NEGCURRENCYSUM_COMBO, 148, 93, 90, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Whole and fractional part separator:", -1, 20, 121, 126, 9
|
||||
COMBOBOX IDC_WHOLEFRACTSEP_COMBO, 148, 119, 90, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE | CBS_SORT
|
||||
LTEXT "Number of fractional symbols:", -1, 20, 137, 126, 9
|
||||
COMBOBOX IDC_FRACSYMBSNUM_COMBO, 148, 136, 90, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE | CBS_SORT
|
||||
LTEXT "Field separator:", -1, 20, 166, 126, 9
|
||||
COMBOBOX IDC_FIELDSEP_COMBO, 148, 164, 90, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE | CBS_SORT
|
||||
LTEXT "Number of digidts in field:", -1, 20, 183, 126, 9
|
||||
COMBOBOX IDC_DIGINFIELDNUM_COMBO, 148, 181, 90, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_TIMEOPTSSETUP DIALOGEX 0, 0, 252, 236
|
||||
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Time"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Samples", IDC_GROUPBOX, 5, 7, 242, 33
|
||||
LTEXT "Sample:", -1, 13, 21, 52, 10
|
||||
EDITTEXT IDC_TIME_EDIT, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
EDITTEXT IDC_UNKNOWN_EDIT, 156, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
LTEXT "Time format:", -1, 10, 52, 147, 10
|
||||
COMBOBOX IDC_TIMEFMT_COMBO, 161, 50, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Time components separator:", -1, 10, 69, 147, 10
|
||||
COMBOBOX IDC_TIMESEP_COMBO, 161, 67, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Time about midday notation (AM):", -1, 10, 86, 147, 10
|
||||
COMBOBOX IDC_TIMEAM_COMBO, 161, 84, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Time afternoon notation (PM):", -1, 10, 104, 147, 10
|
||||
COMBOBOX IDC_TIMEPM_COMBO, 161, 102, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
GROUPBOX "", IDC_GROUPBOX, 7, 132, 238, 80
|
||||
LTEXT "The designation of the time format\nh = hour m = minute s = second t = €Œ or <20>Œ\n\nh = 12-hour day format\nH = 24-hour day format\n\nhh, mm, ss = with zeroes in beginning\nh, m, s = without zeroes", -1, 13, 141, 226, 65
|
||||
END
|
||||
|
||||
IDD_DATEOPTSSETUP DIALOGEX 0, 0, 252, 236
|
||||
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Date"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Calendar", IDC_GROUPBOX, 5, 7, 242, 74
|
||||
LTEXT "If year typed as two digits, then show it as year between:", -1, 13, 18, 225, 8
|
||||
EDITTEXT IDC_FIRSTYEAR_EDIT, 13, 30, 36, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP
|
||||
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, 161, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
|
||||
WS_VSCROLL | WS_TABSTOP | CBS_SORT | WS_DISABLED
|
||||
LTEXT "Chronology by Hijra:", -1, 13, 59, 60, 16
|
||||
COMBOBOX IDC_HIJCHRON_COMBO, 77, 64, 161, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
|
||||
WS_VSCROLL | WS_TABSTOP | CBS_SORT | WS_DISABLED
|
||||
GROUPBOX "Short date format", IDC_GROUPBOX, 7, 83, 238, 81
|
||||
LTEXT "Sample:", -1, 13, 95, 63, 10
|
||||
EDITTEXT IDC_SHRTDATESAMPLE_EDIT, 77, 93, 161, 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, 161, 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, 161, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
LTEXT "Date components separator:", -1, 13, 148, 113, 10
|
||||
COMBOBOX IDC_SHRTDATESEP_COMBO, 187, 146, 51, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
GROUPBOX "Long date format", IDC_GROUPBOX, 7, 167, 238, 64
|
||||
LTEXT "Sample:", -1, 13, 179, 61, 10
|
||||
EDITTEXT IDC_LONGDATESAMPLE_EDIT, 77, 177, 161, 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, 161, 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, 161, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
727
reactos/dll/cpl/intl_new/currency.c
Normal file
727
reactos/dll/cpl/intl_new/currency.c
Normal file
|
@ -0,0 +1,727 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/intl/monetary.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 SAMPLE_NUMBER L"123456789"
|
||||
#define SAMPLE_NEG_NUMBER L"-123456789"
|
||||
#define MAX_CURRENCY_UNIT_SAMPLES 2
|
||||
#define MAX_POS_CURRENCY_SAMPLES 4
|
||||
#define MAX_NEG_CURRENCY_SAMPLES 16
|
||||
#define MAX_CURRENCY_SEP_SAMPLES 2
|
||||
#define MAX_CURRENCY_FRAC_SAMPLES 10
|
||||
#define MAX_FIELD_SEP_SAMPLES 1
|
||||
#define MAX_FIELD_DIG_SAMPLES 3
|
||||
#define EOLN_SIZE sizeof(WCHAR)
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/* Init number of digidts in field control box */
|
||||
VOID
|
||||
InitCurrencyDigNumCB(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_SMONGROUPING,
|
||||
wszFieldDigNum,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_DIGINFIELDNUM_COMBO),
|
||||
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_DIGINFIELDNUM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszFieldDigNumSmpl);
|
||||
free(pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNum);
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_DIGINFIELDNUM_COMBO),
|
||||
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_DIGINFIELDNUM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_FIELD_DIG_SAMPLES+1,
|
||||
(LPARAM)pwszFieldDigNumSmpl);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_DIGINFIELDNUM_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
free(pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
|
||||
/* Init currency field separator control box */
|
||||
VOID
|
||||
InitCurrencyFieldSepCB(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_SMONTHOUSANDSEP,
|
||||
wszFieldSep,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIELDSEP_COMBO),
|
||||
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_FIELDSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszFieldSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_FIELDSEP_COMBO),
|
||||
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_FIELDSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_FIELD_SEP_SAMPLES+1,
|
||||
(LPARAM)wszFieldSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FIELDSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszFieldSep);
|
||||
}
|
||||
}
|
||||
|
||||
/* Init number of fractional symbols control box */
|
||||
VOID
|
||||
InitCurrencyFracNumCB(HWND hwndDlg)
|
||||
{
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszCurrencyFracNum[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszFracCount[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current number of fractional symbols */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_ICURRDIGITS,
|
||||
wszCurrencyFracNum,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FRACSYMBSNUM_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of fractional symbols */
|
||||
for(nCBIndex=0;nCBIndex<MAX_CURRENCY_FRAC_SAMPLES;nCBIndex++)
|
||||
{
|
||||
/* convert to wide char */
|
||||
_itow(nCBIndex,wszFracCount,DECIMAL_RADIX);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_FRACSYMBSNUM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszFracCount);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_FRACSYMBSNUM_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszCurrencyFracNum),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
|
||||
/* Init positive currency sum format control box */
|
||||
VOID
|
||||
InitPosCurrencySumCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszPosCurrencySumSamples[MAX_POS_CURRENCY_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"$1,1",
|
||||
L"1,1$",
|
||||
L"$ 1,1",
|
||||
L"1,1 $"
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
WCHAR wszCurrPosFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszNewSample[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR* pwszResultStr;
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
|
||||
/* Get current currency sum format */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_ICURRENCY,
|
||||
wszCurrPosFmt,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_POSCURRENCYSUM_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Get current currency separator */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
wszCurrencySep,
|
||||
dwValueSize);
|
||||
|
||||
/* Get current currency unit */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SCURRENCY,
|
||||
wszCurrencyUnit,
|
||||
dwValueSize);
|
||||
|
||||
/* Create standart list of currency sum formats */
|
||||
for(nCBIndex=0;nCBIndex<MAX_POS_CURRENCY_SAMPLES;nCBIndex++)
|
||||
{
|
||||
pwszResultStr = ReplaceSubStr(wszPosCurrencySumSamples[nCBIndex],
|
||||
wszCurrencyUnit,
|
||||
L"$");
|
||||
wcscpy(wszNewSample,pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
pwszResultStr = ReplaceSubStr(wszNewSample,
|
||||
wszCurrencySep,
|
||||
L",");
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_POSCURRENCYSUM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_POSCURRENCYSUM_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszCurrPosFmt),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* Init negative currency sum format control box */
|
||||
VOID
|
||||
InitNegCurrencySumCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszNegCurrencySumSamples[MAX_NEG_CURRENCY_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"(?1,1)",
|
||||
L"-?1,1",
|
||||
L"?-1,1",
|
||||
L"?1,1-",
|
||||
L"(1,1?)",
|
||||
L"-1,1?",
|
||||
L"1,1-?",
|
||||
L"1,1?-",
|
||||
L"-1,1 ?",
|
||||
L"-? 1,1",
|
||||
L"1,1 ?-",
|
||||
L"? 1,1-",
|
||||
L"? -1,1",
|
||||
L"1,1- ?",
|
||||
L"(? 1,1)",
|
||||
L"(1,1 ?)" /* 16 */
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
WCHAR wszCurrNegFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszNewSample[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR* pwszResultStr;
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
|
||||
/* Get current currency sum format */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_INEGCURR,
|
||||
wszCurrNegFmt,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NEGCURRENCYSUM_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Get current currency unit */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SCURRENCY,
|
||||
wszCurrencyUnit,
|
||||
dwValueSize);
|
||||
|
||||
/* Get current currency separator */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
wszCurrencySep,
|
||||
dwValueSize);
|
||||
|
||||
/* Create standart list of currency sum formats */
|
||||
for(nCBIndex=0;nCBIndex<MAX_NEG_CURRENCY_SAMPLES;nCBIndex++)
|
||||
{
|
||||
pwszResultStr = ReplaceSubStr(wszNegCurrencySumSamples[nCBIndex],
|
||||
wszCurrencyUnit,
|
||||
L"?");
|
||||
wcscpy(wszNewSample,pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
pwszResultStr = ReplaceSubStr(wszNewSample,
|
||||
wszCurrencySep,
|
||||
L",");
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NEGCURRENCYSUM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NEGCURRENCYSUM_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszCurrNegFmt),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* Init currency separator control box */
|
||||
VOID
|
||||
InitCurrencySepCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencySepSamples[MAX_CURRENCY_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L",",
|
||||
L"."
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current currency separator */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SMONDECIMALSEP,
|
||||
wszCurrencySep,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_WHOLEFRACTSEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of currency separators */
|
||||
for(nCBIndex=0;nCBIndex<MAX_CURRENCY_SEP_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_WHOLEFRACTSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszCurrencySepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_WHOLEFRACTSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszCurrencySep);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_WHOLEFRACTSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_CURRENCY_SEP_SAMPLES+1,
|
||||
(LPARAM)wszCurrencySep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_WHOLEFRACTSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszCurrencySep);
|
||||
}
|
||||
}
|
||||
|
||||
/* Init currency unit control box */
|
||||
VOID
|
||||
InitCurrencyUnitCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszCurrencyUnitSamples[MAX_CURRENCY_UNIT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"$"
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current currency unit */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SCURRENCY,
|
||||
wszCurrencyUnit,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYUNIT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of currency units */
|
||||
for(nCBIndex=0;nCBIndex<MAX_CURRENCY_UNIT_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYUNIT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszCurrencyUnitSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYUNIT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYUNIT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_CURRENCY_UNIT_SAMPLES+1,
|
||||
(LPARAM)wszCurrencyUnit);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYUNIT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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_DIGINFIELDNUM_COMBO),
|
||||
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_FIELDSEP_COMBO),
|
||||
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_FRACSYMBSNUM_COMBO),
|
||||
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_WHOLEFRACTSEP_COMBO),
|
||||
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_NEGCURRENCYSUM_COMBO),
|
||||
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_POSCURRENCYSUM_COMBO),
|
||||
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_CURRENCYUNIT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszCurrencyUnit);
|
||||
|
||||
/* Save currency unit */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Update all currency locale samples */
|
||||
static
|
||||
VOID
|
||||
UpdateCurrencyLocaleSamples(HWND hwndDlg,
|
||||
LCID lcidLocale)
|
||||
{
|
||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Get currency format sample */
|
||||
GetCurrencyFormatW(lcidLocale,
|
||||
LOCALE_USE_CP_ACP,
|
||||
SAMPLE_NUMBER,
|
||||
NULL,
|
||||
OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCY_EDIT),
|
||||
WM_SETTEXT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* Get negative currency format sample */
|
||||
GetCurrencyFormatW(lcidLocale,
|
||||
LOCALE_USE_CP_ACP,
|
||||
SAMPLE_NEG_NUMBER,
|
||||
NULL,
|
||||
OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NEGCURRENCY_EDIT),
|
||||
WM_SETTEXT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Currency options setup page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
CurrencyOptsSetProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
InitCurrencyUnitCB(hwndDlg);
|
||||
InitCurrencySepCB(hwndDlg);
|
||||
InitCurrencyFieldSepCB(hwndDlg);
|
||||
InitCurrencyFracNumCB(hwndDlg);
|
||||
InitPosCurrencySumCB(hwndDlg);
|
||||
InitNegCurrencySumCB(hwndDlg);
|
||||
InitCurrencyDigNumCB(hwndDlg);
|
||||
|
||||
UpdateCurrencyLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CURRENCYUNIT_COMBO:
|
||||
case IDC_POSCURRENCYSUM_COMBO:
|
||||
case IDC_NEGCURRENCYSUM_COMBO:
|
||||
case IDC_WHOLEFRACTSEP_COMBO:
|
||||
case IDC_FRACSYMBSNUM_COMBO:
|
||||
case IDC_FIELDSEP_COMBO:
|
||||
case IDC_DIGINFIELDNUM_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)
|
||||
{
|
||||
if(!SetCurrencyUnit(hwndDlg)) break;
|
||||
if(!SetPosCurrencySumFmt(hwndDlg)) break;
|
||||
if(!SetNegCurrencySumFmt(hwndDlg)) break;
|
||||
if(!SetCurrencySep(hwndDlg)) break;
|
||||
if(!SetCurrencyFracSymNum(hwndDlg)) break;
|
||||
if(!SetCurrencyFieldSep(hwndDlg)) break;
|
||||
if(!SetCurrencyDigNum(hwndDlg)) break;
|
||||
|
||||
/* Update sum format samples */
|
||||
InitPosCurrencySumCB(hwndDlg);
|
||||
InitNegCurrencySumCB(hwndDlg);
|
||||
|
||||
/* FIXME: */
|
||||
_sleep(15);
|
||||
UpdateCurrencyLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
609
reactos/dll/cpl/intl_new/date.c
Normal file
609
reactos/dll/cpl/intl_new/date.c
Normal file
|
@ -0,0 +1,609 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/intl/date.c
|
||||
* PURPOSE: ReactOS International Control Panel
|
||||
* PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#define WINVER 0x0500
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
const INT YEAR_STR_MAX_SIZE=4;
|
||||
const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
|
||||
#define 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);
|
||||
}
|
||||
|
||||
/* Date options setup page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
DateOptsSetProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
//int i,j;
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
InitMinMaxDateSpin(hwndDlg);
|
||||
UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
InitShortDateCB(hwndDlg);
|
||||
InitLongDateCB(hwndDlg);
|
||||
InitShortDateSepSamples(hwndDlg);
|
||||
/* TODO: Add other calendar types */
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_SECONDYEAR_EDIT:
|
||||
{
|
||||
if(HIWORD(wParam)==EN_CHANGE)
|
||||
{
|
||||
SetMinData(hwndDlg);
|
||||
}
|
||||
}
|
||||
|
||||
case IDC_SCR_MAX_YEAR:
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
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;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: lib/cpl/intl/extra.c
|
||||
* FILE: dll/cpl/intl/extra.c
|
||||
* PURPOSE: Extra parameters page
|
||||
* PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
|
||||
*/
|
||||
|
@ -73,7 +73,10 @@ CreateLanguagesList(HWND hWnd)
|
|||
/* Extra Parameters page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
ExtraOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
ExtraOptsProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
switch(uMsg)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/* GLOBALS ******************************************************************/
|
||||
|
||||
#define NUM_APPLETS (1)
|
||||
#define NUM_SHEETS 2
|
||||
#define NUM_SHEETS 3
|
||||
|
||||
LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
||||
|
||||
|
@ -74,6 +74,7 @@ Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
|
|||
|
||||
InitPropSheetPage(&PsPage[0], IDD_REGOPTSPAGE, RegOptsProc);
|
||||
InitPropSheetPage(&PsPage[1], IDD_EXTRAOPTSPAGE, ExtraOptsProc);
|
||||
InitPropSheetPage(&PsPage[2], IDD_LANGSOPTSPAGE, LangsOptsProc);
|
||||
|
||||
return (LONG)(PropertySheet(&psh) != -1);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
#define MAX_STR_SIZE 128
|
||||
#define MAX_FMT_SIZE 30
|
||||
#define MAX_STR_SIZE 128
|
||||
#define MAX_FMT_SIZE 30
|
||||
#define MAX_SAMPLES_STR_SIZE 70
|
||||
#define DECIMAL_RADIX 10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -26,6 +28,46 @@ INT_PTR
|
|||
CALLBACK
|
||||
ExtraOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* langs.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
LangsOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* date.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
DateOptsSetProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* nums.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
NumsOptsSetProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* monetary.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
CurrencyOptsSetProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* time.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
TimeOptsSetProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* setupreg.c */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
RegOptsSetProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
WCHAR*
|
||||
ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
|
||||
|
||||
WCHAR*
|
||||
InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
|
||||
|
||||
LONG
|
||||
APIENTRY
|
||||
SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
|
||||
|
||||
#endif /* __INTL_H */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -11,9 +11,16 @@
|
|||
<library>user32</library>
|
||||
<library>comctl32</library>
|
||||
<library>advapi32</library>
|
||||
<library>shell32</library>
|
||||
<library>msvcrt</library>
|
||||
<file>intl.c</file>
|
||||
<file>locale.c</file>
|
||||
<file>extra.c</file>
|
||||
<file>setupreg.c</file>
|
||||
<file>langs.c</file>
|
||||
<file>date.c</file>
|
||||
<file>time.c</file>
|
||||
<file>nums.c</file>
|
||||
<file>currency.c</file>
|
||||
<file>intl.rc</file>
|
||||
</module>
|
||||
|
|
78
reactos/dll/cpl/intl_new/langs.c
Normal file
78
reactos/dll/cpl/intl_new/langs.c
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/intl/langs.c
|
||||
* PURPOSE: Extra parameters page
|
||||
* PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
#include <cpl.h>
|
||||
|
||||
#include "intl.h"
|
||||
#include "resource.h"
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/* Languages Parameters page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
LangsOptsProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
SHELLEXECUTEINFOW shInputDll;
|
||||
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
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;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR Lpnm = (LPNMHDR)lParam;
|
||||
/* If push apply button */
|
||||
if (Lpnm->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
// TODO: Implement
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: lib/cpl/intl/locale.h
|
||||
* FILE: dll/cpl/intl/locale.h
|
||||
* PURPOSE: Regional parameters page
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
* Alexey Zavyalov (gen_x@mail.ru)
|
||||
|
@ -235,10 +235,9 @@ RegOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
/* If setup button pressed */
|
||||
case IDC_SETUP_BUTTON:
|
||||
// setup button code...
|
||||
MessageBox(NULL, L"Not implemented yet", L"Info",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
SetupApplet(hwndDlg, uMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
/* If selected other locale */
|
||||
|
@ -256,10 +255,12 @@ RegOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
break;
|
||||
|
||||
/* If changed location */
|
||||
case IDC_LOCATION_COMBO:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE ||
|
||||
HIWORD(wParam) == CBN_EDITCHANGE)
|
||||
{
|
||||
/* Set "Apply" button enabled */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
|
|
851
reactos/dll/cpl/intl_new/nums.c
Normal file
851
reactos/dll/cpl/intl_new/nums.c
Normal file
|
@ -0,0 +1,851 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/intl/nums.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 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)
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/* 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_NUMUNITSSYS_COMBO),
|
||||
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_NUMUNITSSYS_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszUnitsSysSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMUNITSSYS_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszUnitsSys),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* Init elements list separator control box */
|
||||
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_NUMELEMLISTSEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of signs */
|
||||
for(nCBIndex=0;nCBIndex<MAX_LIST_SEP_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMELEMLISTSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszListSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMELEMLISTSEP_COMBO),
|
||||
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_NUMELEMLISTSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_LIST_SEP_SAMPLES+1,
|
||||
(LPARAM)wszListSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMELEMLISTSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszListSep);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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_NUMLEADZERO_COMBO),
|
||||
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_NUMLEADZERO_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMLEADZERO_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszLeadNumFmt),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* 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_NUMNEGFMT_COMBO),
|
||||
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_NUMNEGFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMNEGFMT_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszNegNumFmt),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* 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_NUMNEGSIGN_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of signs */
|
||||
for(nCBIndex=0;nCBIndex<MAX_NEG_SIGN_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMNEGSIGN_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszNegSignSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMNEGSIGN_COMBO),
|
||||
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_NUMNEGSIGN_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_NUM_SEP_SAMPLES+1,
|
||||
(LPARAM)wszNegSign);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMNEGSIGN_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszNegSign);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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_NUMDIGFIELD_COMBO),
|
||||
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_NUMDIGFIELD_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)pwszFieldDigNumSmpl);
|
||||
free(pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNum);
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMDIGFIELD_COMBO),
|
||||
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_NUMDIGFIELD_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_FIELD_DIG_SAMPLES+1,
|
||||
(LPARAM)pwszFieldDigNumSmpl);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMDIGFIELD_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
free(pwszFieldDigNumSmpl);
|
||||
}
|
||||
|
||||
/* 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_NUMFIELDSEP_COMBO),
|
||||
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_NUMFIELDSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszFieldSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMFIELDSEP_COMBO),
|
||||
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_NUMFIELDSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_FIELD_SEP_SAMPLES+1,
|
||||
(LPARAM)wszFieldSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMFIELDSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszFieldSep);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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_NUMFRACSYBMS_COMBO),
|
||||
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_NUMFRACSYBMS_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszFracCount);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMFRACSYBMS_COMBO),
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)_wtoi(wszFracNum),
|
||||
(LPARAM)0);
|
||||
}
|
||||
|
||||
/* 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_NUMDECIMALSEP_COMBO),
|
||||
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_NUMDECIMALSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszNumSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMDECIMALSEP_COMBO),
|
||||
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_NUMDECIMALSEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_NUM_SEP_SAMPLES+1,
|
||||
(LPARAM)wszNumSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMDECIMALSEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszNumSep);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set units system */
|
||||
BOOL
|
||||
SetNumUnitsSys(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
|
||||
INT nCurrSel;
|
||||
|
||||
/* Get setted units system */
|
||||
nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMUNITSSYS_COMBO),
|
||||
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;
|
||||
}
|
||||
|
||||
/* Set elements list separator */
|
||||
BOOL
|
||||
SetNumListSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted list separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMELEMLISTSEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszListSep);
|
||||
|
||||
/* Save list separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLIST, wszListSep);
|
||||
|
||||
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_NUMLEADZERO_COMBO),
|
||||
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 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_NUMNEGFMT_COMBO),
|
||||
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 negative sign */
|
||||
BOOL
|
||||
SetNumNegSign(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted negative sign */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMNEGSIGN_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszNegSign);
|
||||
|
||||
/* Save negative sign */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, wszNegSign);
|
||||
|
||||
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_NUMDIGFIELD_COMBO),
|
||||
CB_GETCURSEL,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Save number of digidts in field */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, wszFieldDigNumSamples[nCurrSel]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set field separator */
|
||||
BOOL
|
||||
SetNumFieldSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted field separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMFIELDSEP_COMBO),
|
||||
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 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_NUMFRACSYBMS_COMBO),
|
||||
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 num decimal separator */
|
||||
BOOL
|
||||
SetNumDecimalSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszDecimalSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted decimal separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_NUMDECIMALSEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszDecimalSep);
|
||||
|
||||
/* Save decimal separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 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_NUM_EDIT),
|
||||
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_NEGNUM_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
}
|
||||
|
||||
/* Numbers options setup page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
NumsOptsSetProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
/* Init combo boxes */
|
||||
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_NUMDECIMALSEP_COMBO:
|
||||
case IDC_NUMFRACSYBMS_COMBO:
|
||||
case IDC_NUMFIELDSEP_COMBO:
|
||||
case IDC_NUMDIGFIELD_COMBO:
|
||||
case IDC_NUMNEGSIGN_COMBO:
|
||||
case IDC_NUMNEGFMT_COMBO:
|
||||
case IDC_NUMLEADZERO_COMBO:
|
||||
case IDC_NUMELEMLISTSEP_COMBO:
|
||||
case IDC_NUMUNITSSYS_COMBO:
|
||||
case IDC_NUMREGDIG_COMBO:
|
||||
case IDC_NUMDIGREPL_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)
|
||||
{
|
||||
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;
|
||||
|
||||
/* Update sum format combo boxes */
|
||||
InitLeadingZeroesCB(hwndDlg);
|
||||
InitNegNumFmtCB(hwndDlg);
|
||||
|
||||
/* FIXME: */
|
||||
_sleep(15);
|
||||
/* Update sum format samples */
|
||||
UpdateNumSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
|
@ -27,7 +27,72 @@
|
|||
|
||||
#define IDD_EXTRAOPTSPAGE 200
|
||||
|
||||
#define IDC_LANGUAGE_COMBO 103
|
||||
#define IDC_LANGUAGE_COMBO 201
|
||||
|
||||
/* Language page options */
|
||||
|
||||
#define IDD_LANGSOPTSPAGE 300
|
||||
|
||||
#define IDC_DETAIL_BUTTON 301
|
||||
|
||||
/* Date options setup page */
|
||||
|
||||
#define IDD_DATEOPTSSETUP 400
|
||||
#define IDC_FIRSTYEAR_EDIT 401
|
||||
#define IDC_SECONDYEAR_EDIT 402
|
||||
#define IDC_SCR_MAX_YEAR 403
|
||||
#define IDC_CALTYPE_COMBO 404
|
||||
#define IDC_HIJCHRON_COMBO 405
|
||||
#define IDC_SHRTDATESAMPLE_EDIT 406
|
||||
#define IDC_SHRTDATERTOL_EDIT 407
|
||||
#define IDC_SHRTDATEFMT_COMBO 408
|
||||
#define IDC_SHRTDATESEP_COMBO 409
|
||||
#define IDC_LONGDATESAMPLE_EDIT 410
|
||||
#define IDC_LONGDATERTOL_EDIT 411
|
||||
#define IDC_LONGDATEFMT_COMBO 412
|
||||
|
||||
/* Numbers options setup page */
|
||||
|
||||
#define IDD_NUMSOPTSSETUP 500
|
||||
#define IDC_NUM_EDIT 501
|
||||
#define IDC_NEGNUM_EDIT 502
|
||||
#define IDC_NUM1_EDIT 503
|
||||
#define IDC_NEGNUM1_EDIT 504
|
||||
#define IDC_NUMDECIMALSEP_COMBO 505
|
||||
#define IDC_NUMFRACSYBMS_COMBO 506
|
||||
#define IDC_NUMFIELDSEP_COMBO 507
|
||||
#define IDC_NUMDIGFIELD_COMBO 508
|
||||
#define IDC_NUMNEGSIGN_COMBO 509
|
||||
#define IDC_NUMNEGFMT_COMBO 510
|
||||
#define IDC_NUMLEADZERO_COMBO 511
|
||||
#define IDC_NUMELEMLISTSEP_COMBO 512
|
||||
#define IDC_NUMUNITSSYS_COMBO 513
|
||||
#define IDC_NUMREGDIG_COMBO 514
|
||||
#define IDC_NUMDIGREPL_COMBO 515
|
||||
|
||||
/* Monetary options setup page */
|
||||
|
||||
#define IDD_CURRENCYOPTSSETUP 600
|
||||
#define IDC_CURRENCY_EDIT 601
|
||||
#define IDC_NEGCURRENCY_EDIT 602
|
||||
#define IDC_CURRENCYUNIT_COMBO 603
|
||||
#define IDC_POSCURRENCYSUM_COMBO 604
|
||||
#define IDC_NEGCURRENCYSUM_COMBO 605
|
||||
#define IDC_WHOLEFRACTSEP_COMBO 606
|
||||
#define IDC_FRACSYMBSNUM_COMBO 607
|
||||
#define IDC_FIELDSEP_COMBO 608
|
||||
#define IDC_DIGINFIELDNUM_COMBO 609
|
||||
|
||||
/* Time options setup page */
|
||||
|
||||
#define IDD_TIMEOPTSSETUP 700
|
||||
#define IDC_TIME_EDIT 701
|
||||
#define IDC_UNKNOWN_EDIT 702
|
||||
#define IDC_TIMEFMT_COMBO 703
|
||||
#define IDC_TIMESEP_COMBO 704
|
||||
#define IDC_TIMEAM_COMBO 705
|
||||
#define IDC_TIMEPM_COMBO 706
|
||||
|
||||
|
||||
/* Other page options */
|
||||
|
||||
|
|
233
reactos/dll/cpl/intl_new/setupreg.c
Normal file
233
reactos/dll/cpl/intl_new/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 */
|
536
reactos/dll/cpl/intl_new/time.c
Normal file
536
reactos/dll/cpl/intl_new/time.c
Normal file
|
@ -0,0 +1,536 @@
|
|||
/*
|
||||
* PROJECT: ReactOS International Control Panel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/intl/time.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 NO_FLAG 0
|
||||
#define MAX_TIME_FMT_SAMPLES 3
|
||||
#define MAX_TIME_SEP_SAMPLES 1
|
||||
#define MAX_TIME_AM_SAMPLES 2
|
||||
#define MAX_TIME_PM_SAMPLES 2
|
||||
#define EOLN_SIZE sizeof(WCHAR)
|
||||
#define STD_TIME_SEP L":"
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/* if char is 'h' or 'H' or 'm' or 's' or 't' or ' ' return TRUE, else FALSE */
|
||||
BOOL
|
||||
isTimeComp(WCHAR walpha)
|
||||
{
|
||||
|
||||
if((walpha == L'h') ||
|
||||
(walpha == L'H') ||
|
||||
(walpha == L'm') ||
|
||||
(walpha == L's') ||
|
||||
(walpha == L't') ||
|
||||
(walpha == L' ')) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
/* Find first time separator in string */
|
||||
WCHAR*
|
||||
FindTimeSep(const WCHAR *wszSourceStr)
|
||||
{
|
||||
int nDateCompCount=0;
|
||||
int nDateSepCount=0;
|
||||
|
||||
WCHAR* wszFindedSep;
|
||||
wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
|
||||
|
||||
wcscpy(wszFindedSep,STD_TIME_SEP);
|
||||
|
||||
while(nDateCompCount<wcslen(wszSourceStr))
|
||||
{
|
||||
if(!isTimeComp(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||
{
|
||||
while(!isTimeComp(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
|
||||
{
|
||||
wszFindedSep[nDateSepCount++]=wszSourceStr[nDateCompCount];
|
||||
nDateCompCount++;
|
||||
}
|
||||
wszFindedSep[nDateSepCount]='\0';
|
||||
return wszFindedSep;
|
||||
}
|
||||
nDateCompCount++;
|
||||
}
|
||||
|
||||
return wszFindedSep;
|
||||
}
|
||||
|
||||
/* Init time PM control box */
|
||||
VOID
|
||||
InitPM(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimePMSamples[MAX_TIME_PM_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"PM",
|
||||
L""
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszTimePM[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current time PM */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_S2359,
|
||||
wszTimePM,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of time PM */
|
||||
for(nCBIndex=0;nCBIndex<MAX_TIME_PM_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszTimePMSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimePM);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_TIME_PM_SAMPLES+1,
|
||||
(LPARAM)wszTimePM);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimePM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Init time AM control box */
|
||||
VOID
|
||||
InitAM(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeAMSamples[MAX_TIME_AM_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"AM",
|
||||
L""
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszTimeAM[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current time AM */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_S1159,
|
||||
wszTimeAM,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of time AM */
|
||||
for(nCBIndex=0;nCBIndex<MAX_TIME_AM_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszTimeAMSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeAM);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_TIME_AM_SAMPLES+1,
|
||||
(LPARAM)wszTimeAM);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeAM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Init time separator control box */
|
||||
VOID
|
||||
InitTimeSeparatorCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeSepSamples[MAX_TIME_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L":"
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszTimeSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current time separator*/
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_STIME,
|
||||
wszTimeSep,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of time separators */
|
||||
for(nCBIndex=0;nCBIndex<MAX_TIME_SEP_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszTimeSepSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeSep);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_TIME_SEP_SAMPLES+1,
|
||||
(LPARAM)wszTimeSep);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeSep);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Init time format control box */
|
||||
VOID
|
||||
InitTimeFormatCB(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeFmtSamples[MAX_TIME_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
|
||||
{
|
||||
L"H:mm:ss",
|
||||
L"HH:mm:ss",
|
||||
L"h:mm:ss tt"
|
||||
};
|
||||
|
||||
int nCBIndex;
|
||||
int nRetCode;
|
||||
|
||||
DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
|
||||
WCHAR wszTimeFmt[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get current time format */
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_STIMEFORMAT,
|
||||
wszTimeFmt,
|
||||
dwValueSize);
|
||||
|
||||
/* Clear all box content */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
CB_RESETCONTENT,
|
||||
(WPARAM)0,
|
||||
(LPARAM)0);
|
||||
|
||||
/* Create standart list of time formats */
|
||||
for(nCBIndex=0;nCBIndex<MAX_TIME_FMT_SAMPLES;nCBIndex++)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
nCBIndex,
|
||||
(LPARAM)wszTimeFmtSamples[nCBIndex]);
|
||||
}
|
||||
|
||||
/* Set current item to value from registry */
|
||||
nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeFmt);
|
||||
|
||||
/* if is not success, add new value to list and select them */
|
||||
if(nRetCode == CB_ERR)
|
||||
{
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
CB_ADDSTRING,
|
||||
MAX_TIME_FMT_SAMPLES+1,
|
||||
(LPARAM)wszTimeFmt);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
CB_SELECTSTRING,
|
||||
-1,
|
||||
(LPARAM)(LPCSTR)wszTimeFmt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set time format to registry */
|
||||
BOOL
|
||||
SetTimeFormat(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeFmt[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszTimeSep[MAX_SAMPLES_STR_SIZE];
|
||||
WCHAR wszFindedTimeSep[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
WCHAR* pwszResultStr;
|
||||
BOOL OpenApostFlg = FALSE;
|
||||
int nFmtStrSize;
|
||||
int nTimeCompCount;
|
||||
|
||||
/* Get setted format */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFMT_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszTimeFmt);
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszTimeSep);
|
||||
|
||||
/* Get setted format-string size */
|
||||
nFmtStrSize = wcslen(wszTimeFmt);
|
||||
|
||||
/* Check date components */
|
||||
for(nTimeCompCount=0;nTimeCompCount<nFmtStrSize;nTimeCompCount++)
|
||||
{
|
||||
if(wszTimeFmt[nTimeCompCount]==L'\'')
|
||||
{
|
||||
OpenApostFlg=!OpenApostFlg;
|
||||
}
|
||||
if(iswalnum(wszTimeFmt[nTimeCompCount]) &&
|
||||
!isTimeComp(wszTimeFmt[nTimeCompCount]) &&
|
||||
!OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered time format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(OpenApostFlg)
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered time format contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* substring replacement of separator */
|
||||
wcscpy(wszFindedTimeSep,FindTimeSep(wszTimeFmt));
|
||||
pwszResultStr = ReplaceSubStr(wszTimeFmt,wszTimeSep,wszFindedTimeSep);
|
||||
wcscpy(wszTimeFmt,pwszResultStr);
|
||||
free(pwszResultStr);
|
||||
|
||||
/* Save time format */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, wszTimeFmt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up time separator to registry */
|
||||
BOOL
|
||||
SetTimeSep(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeSep[MAX_SAMPLES_STR_SIZE];
|
||||
int nSepStrSize;
|
||||
int nSepCount;
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEP_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszTimeSep);
|
||||
|
||||
/* Get setted separator string size */
|
||||
nSepStrSize = wcslen(wszTimeSep);
|
||||
|
||||
/* Check time components */
|
||||
for(nSepCount=0;nSepCount<nSepStrSize;nSepCount++)
|
||||
{
|
||||
if(iswalnum(wszTimeSep[nSepCount]) || (wszTimeSep[nSepCount]=='\''))
|
||||
{
|
||||
MessageBoxW(NULL,
|
||||
L"Entered time separator contain incorrect symbol",
|
||||
L"Error", MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Save time separator */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, wszTimeSep);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up time AM to registry */
|
||||
BOOL
|
||||
SetTimeAM(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimeAM[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAM_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszTimeAM);
|
||||
|
||||
/* Save time AM */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, wszTimeAM);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Setted up time PM to registry */
|
||||
BOOL
|
||||
SetTimePM(HWND hwndDlg)
|
||||
{
|
||||
WCHAR wszTimePM[MAX_SAMPLES_STR_SIZE];
|
||||
|
||||
/* Get setted separator */
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPM_COMBO),
|
||||
WM_GETTEXT,
|
||||
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
||||
(LPARAM)(LPCSTR)wszTimePM);
|
||||
|
||||
/* Save time PM */
|
||||
SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, wszTimePM);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Update all time locale samples */
|
||||
static
|
||||
VOID
|
||||
UpdateTimeLocaleSamples(HWND hwndDlg,
|
||||
LCID lcidLocale)
|
||||
{
|
||||
WCHAR OutBuffer[MAX_FMT_SIZE];
|
||||
|
||||
/* Get time format sample */
|
||||
GetTimeFormatW(lcidLocale,
|
||||
NO_FLAG,
|
||||
NULL,
|
||||
NULL,
|
||||
OutBuffer,
|
||||
MAX_FMT_SIZE);
|
||||
SendMessageW(GetDlgItem(hwndDlg, IDC_TIME_EDIT),
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)OutBuffer);
|
||||
|
||||
/* TODO: Add unknown control box processing */
|
||||
}
|
||||
|
||||
/* Date options setup page dialog callback */
|
||||
INT_PTR
|
||||
CALLBACK
|
||||
TimeOptsSetProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
InitTimeFormatCB(hwndDlg);
|
||||
InitTimeSeparatorCB(hwndDlg);
|
||||
InitAM(hwndDlg);
|
||||
InitPM(hwndDlg);
|
||||
UpdateTimeLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_TIMEFMT_COMBO:
|
||||
case IDC_TIMESEP_COMBO:
|
||||
case IDC_TIMEAM_COMBO:
|
||||
case IDC_TIMEPM_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)
|
||||
{
|
||||
if(!SetTimeFormat(hwndDlg)) break;
|
||||
if(!SetTimeSep(hwndDlg)) break;
|
||||
if(!SetTimeAM(hwndDlg)) break;
|
||||
if(!SetTimePM(hwndDlg)) break;
|
||||
|
||||
InitTimeFormatCB(hwndDlg);
|
||||
|
||||
|
||||
/* FIXME: */
|
||||
_sleep(15);
|
||||
UpdateTimeLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
Loading…
Reference in a new issue