2004-10-30 12:33:51 +00:00
|
|
|
/*
|
|
|
|
* ReactOS
|
|
|
|
* Copyright (C) 2004 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-10-30 12:33:51 +00:00
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2004-10-30 12:33:51 +00:00
|
|
|
*
|
|
|
|
* PROJECT: ReactOS International Control Panel
|
2011-11-29 14:55:58 +00:00
|
|
|
* FILE: dll/cpl/intl/numbers.c
|
2004-10-30 12:33:51 +00:00
|
|
|
* PURPOSE: Numbers property page
|
|
|
|
* PROGRAMMER: Eric Kohl
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "intl.h"
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
#define SAMPLE_NUMBER _T("123456789")
|
|
|
|
#define SAMPLE_NEG_NUMBER _T("-123456789")
|
2007-09-02 20:42:08 +00:00
|
|
|
#define MAX_NUM_SEP_SAMPLES 2
|
2007-09-10 20:40:27 +00:00
|
|
|
#define MAX_FRAC_NUM_SAMPLES 10
|
2007-09-02 20:42:08 +00:00
|
|
|
#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
|
|
|
|
|
2007-09-10 20:40:27 +00:00
|
|
|
static LPTSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES] =
|
|
|
|
{_T(","), _T(".")};
|
|
|
|
static LPTSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES] =
|
|
|
|
{_T(" ")};
|
|
|
|
static LPTSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
|
|
|
|
{_T("0;0"), _T("3;0"), _T("3;2;0")};
|
|
|
|
static LPTSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES] =
|
|
|
|
{_T("-")};
|
|
|
|
static LPTSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES] =
|
|
|
|
{_T("(1,1)"), _T("-1,1"), _T("- 1,1"), _T("1,1-"), _T("1,1 -")};
|
|
|
|
static LPTSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES] =
|
|
|
|
{_T(",7"), _T("0,7")};
|
|
|
|
static LPTSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] =
|
|
|
|
{_T(";")};
|
|
|
|
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Init num decimal separator control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitNumDecimalSepCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
|
|
|
INT nCBIndex;
|
|
|
|
INT nRetCode;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Limit text length */
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
CB_LIMITTEXT,
|
|
|
|
MAX_NUMBERDSYMBOL,
|
|
|
|
0);
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Get current decimal separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SDECIMAL,
|
|
|
|
szNumSep,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
/* Create standard list of decimal separators */
|
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)lpNumSepSamples[nCBIndex]);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2007-09-05 14:24:45 +00:00
|
|
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
2007-09-02 20:42:08 +00:00
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)(LPCSTR)szNumSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* If it is not successful, add new values to list and select them */
|
2007-09-05 14:24:45 +00:00
|
|
|
if (nRetCode == CB_ERR)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
CB_ADDSTRING,
|
|
|
|
MAX_NUM_SEP_SAMPLES,
|
|
|
|
(LPARAM)szNumSep);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
|
|
|
(LPARAM)szNumSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Init number of fractional symbols control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitNumOfFracSymbCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szFracNum[MAX_SAMPLES_STR_SIZE];
|
|
|
|
TCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
|
|
|
|
INT nCBIndex;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current number of fractional symbols */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_IDIGITS,
|
|
|
|
szFracNum,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
/* Create standard list of fractional symbols */
|
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2011-11-29 14:55:58 +00:00
|
|
|
/* Convert to wide char */
|
2007-09-05 14:24:45 +00:00
|
|
|
_itot(nCBIndex, szFracCount, DECIMAL_RADIX);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szFracCount);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2011-09-10 21:31:09 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
|
|
|
CB_SETCURSEL,
|
|
|
|
(WPARAM)_ttoi(szFracNum),
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Init field separator control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitNumFieldSepCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
|
|
|
INT nCBIndex;
|
|
|
|
INT nRetCode;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Limit text length */
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
|
|
|
CB_LIMITTEXT,
|
|
|
|
MAX_NUMBERSDIGITGRSYM,
|
|
|
|
0);
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Get current field separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_STHOUSAND,
|
|
|
|
szFieldSep,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create standard list of field separators */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)lpFieldSepSamples[nCBIndex]);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2007-09-05 14:24:45 +00:00
|
|
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
2007-09-02 20:42:08 +00:00
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szFieldSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* If it is not success, add new values to list and select them */
|
2007-09-05 14:24:45 +00:00
|
|
|
if (nRetCode == CB_ERR)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szFieldSep);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
|
|
|
(LPARAM)szFieldSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Init number of digits in field control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitFieldDigNumCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
|
|
|
LPTSTR pszFieldDigNumSmpl;
|
|
|
|
INT nCBIndex;
|
|
|
|
INT nRetCode;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current field digits num */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SGROUPING,
|
|
|
|
szFieldDigNum,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create standard list of field digits num */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
|
2007-09-10 20:40:27 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-10 20:40:27 +00:00
|
|
|
(LPARAM)pszFieldDigNumSmpl);
|
2007-09-05 14:24:45 +00:00
|
|
|
free(pszFieldDigNumSmpl);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, szFieldDigNum);
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Set current item to value from registry */
|
2007-09-05 14:24:45 +00:00
|
|
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
2007-09-02 20:42:08 +00:00
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)pszFieldDigNumSmpl);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* If it is not successful, add new values to list and select them */
|
2007-09-05 14:24:45 +00:00
|
|
|
if (nRetCode == CB_ERR)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)pszFieldDigNumSmpl);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
|
|
|
(LPARAM)pszFieldDigNumSmpl);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
free(pszFieldDigNumSmpl);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Init negative sign control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitNegSignCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
|
|
|
INT nCBIndex;
|
|
|
|
INT nRetCode;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Limit text length */
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
CB_LIMITTEXT,
|
|
|
|
MAX_NUMBERSNSIGNSYM,
|
|
|
|
0);
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Get current negative sign */
|
2009-10-28 23:20:28 +00:00
|
|
|
GetLocaleInfo(lcid,
|
|
|
|
LOCALE_SNEGATIVESIGN,
|
|
|
|
szNegSign,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create standard list of signs */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)lpNegSignSamples[nCBIndex]);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2007-09-05 14:24:45 +00:00
|
|
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
2007-09-02 20:42:08 +00:00
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szNegSign);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* If it is not successful, add new values to list and select them */
|
2007-09-05 14:24:45 +00:00
|
|
|
if (nRetCode == CB_ERR)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szNegSign);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
|
|
|
(LPARAM)szNegSign);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Init negative numbers format control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitNegNumFmtCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szNegNumFmt[MAX_SAMPLES_STR_SIZE];
|
|
|
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
|
|
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
|
|
|
TCHAR szNewSample[MAX_SAMPLES_STR_SIZE];
|
|
|
|
LPTSTR pszResultStr;
|
|
|
|
INT nCBIndex;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current negative numbers format */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_INEGNUMBER,
|
|
|
|
szNegNumFmt,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current decimal separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SDECIMAL,
|
|
|
|
szNumSep,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current negative sign */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SNEGATIVESIGN,
|
|
|
|
szNegSign,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create standard list of negative numbers formats */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Replace standard separator to setted */
|
2007-09-05 14:24:45 +00:00
|
|
|
pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
|
|
|
|
szNumSep,
|
|
|
|
_T(","));
|
|
|
|
_tcscpy(szNewSample, pszResultStr);
|
|
|
|
free(pszResultStr);
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Replace standard negative sign to setted */
|
2007-09-05 14:24:45 +00:00
|
|
|
pszResultStr = ReplaceSubStr(szNewSample,
|
|
|
|
szNegSign,
|
|
|
|
_T("-"));
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)pszResultStr);
|
|
|
|
free(pszResultStr);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2011-09-10 21:31:09 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
|
|
|
CB_SETCURSEL,
|
|
|
|
(WPARAM)_ttoi(szNegNumFmt),
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Init leading zeroes control box */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitLeadingZeroesCB(HWND hwndDlg, LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szLeadNumFmt[MAX_SAMPLES_STR_SIZE];
|
|
|
|
TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
|
|
|
|
LPTSTR pszResultStr;
|
|
|
|
INT nCBIndex;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current leading zeroes format */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_ILZERO,
|
|
|
|
szLeadNumFmt,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current decimal separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SDECIMAL,
|
|
|
|
szNumSep,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create list of standard leading zeroes formats */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
|
|
|
|
szNumSep,
|
|
|
|
_T(","));
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)pszResultStr);
|
|
|
|
free(pszResultStr);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2011-09-10 21:31:09 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
|
|
|
CB_SETCURSEL,
|
|
|
|
(WPARAM)_ttoi(szLeadNumFmt),
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-10 20:40:27 +00:00
|
|
|
InitListSepCB(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
|
|
|
INT nCBIndex;
|
|
|
|
INT nRetCode;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Limit text length */
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
CB_LIMITTEXT,
|
|
|
|
MAX_NUMBERSLSEP,
|
|
|
|
0);
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Get current list separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_SLIST,
|
|
|
|
szListSep,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create standard list of signs */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)lpListSepSamples[nCBIndex]);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2007-09-05 14:24:45 +00:00
|
|
|
nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
2007-09-02 20:42:08 +00:00
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szListSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* If it is not successful, add new values to list and select them */
|
2007-09-05 14:24:45 +00:00
|
|
|
if (nRetCode == CB_ERR)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2007-09-05 14:24:45 +00:00
|
|
|
(LPARAM)szListSep);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
CB_SELECTSTRING,
|
|
|
|
-1,
|
|
|
|
(LPARAM)szListSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Init system of units control box */
|
2007-09-10 20:40:27 +00:00
|
|
|
static VOID
|
|
|
|
InitUnitsSysCB(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
2010-05-22 10:20:56 +00:00
|
|
|
TCHAR szUnitName[128];
|
2007-09-05 14:24:45 +00:00
|
|
|
INT nCBIndex;
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get current system of units */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetLocaleInfo(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
LOCALE_IMEASURE,
|
|
|
|
szUnitsSys,
|
|
|
|
MAX_SAMPLES_STR_SIZE);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Clear all box content */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
|
|
|
CB_RESETCONTENT,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Create list of standard system of units */
|
2007-09-05 14:24:45 +00:00
|
|
|
for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2010-05-22 10:20:56 +00:00
|
|
|
LoadString(hApplet, IDS_METRIC + nCBIndex, szUnitName, 128);
|
|
|
|
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
|
|
|
CB_ADDSTRING,
|
2009-10-28 23:20:28 +00:00
|
|
|
0,
|
2010-05-22 10:20:56 +00:00
|
|
|
(LPARAM)szUnitName);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set current item to value from registry */
|
2007-09-10 20:40:27 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
|
|
|
CB_SETCURSEL,
|
|
|
|
(WPARAM)_ttoi(szUnitsSys),
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update all numbers locale samples */
|
2007-09-05 14:24:45 +00:00
|
|
|
static VOID
|
2007-09-02 20:42:08 +00:00
|
|
|
UpdateNumSamples(HWND hwndDlg,
|
2007-09-10 20:40:27 +00:00
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR OutBuffer[MAX_FMT_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get positive number format sample */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetNumberFormat(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
0,
|
|
|
|
SAMPLE_NUMBER,
|
|
|
|
NULL,
|
|
|
|
OutBuffer,
|
|
|
|
MAX_FMT_SIZE);
|
|
|
|
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
|
|
|
|
WM_SETTEXT,
|
|
|
|
0,
|
|
|
|
(LPARAM)OutBuffer);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get positive number format sample */
|
2007-09-10 20:40:27 +00:00
|
|
|
GetNumberFormat(lcid,
|
2007-09-05 14:24:45 +00:00
|
|
|
0,
|
|
|
|
SAMPLE_NEG_NUMBER,
|
|
|
|
NULL,
|
|
|
|
OutBuffer,
|
|
|
|
MAX_FMT_SIZE);
|
|
|
|
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
|
|
|
|
WM_SETTEXT,
|
|
|
|
0,
|
|
|
|
(LPARAM)OutBuffer);
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set num decimal separator */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumDecimalSep(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szDecimalSep[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get setted decimal separator */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
|
|
|
|
WM_GETTEXT,
|
|
|
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
|
|
|
(LPARAM)szDecimalSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save decimal separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_SDECIMAL, szDecimalSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set number of fractional symbols */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetFracSymNum(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szFracSymNum[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
INT nCurrSel;
|
|
|
|
|
|
|
|
/* Get setted number of fractional symbols */
|
2007-09-05 14:24:45 +00:00
|
|
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
|
|
|
|
CB_GETCURSEL,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* Convert to wide char */
|
2007-09-05 14:24:45 +00:00
|
|
|
_itot(nCurrSel, szFracSymNum, DECIMAL_RADIX);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save number of fractional symbols */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_IDIGITS, szFracSymNum);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set field separator */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumFieldSep(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get setted field separator */
|
2009-10-28 23:20:28 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
|
2007-09-05 14:24:45 +00:00
|
|
|
WM_GETTEXT,
|
|
|
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
|
|
|
(LPARAM)szFieldSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save field separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_STHOUSAND, szFieldSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Set number of digits in field */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetFieldDigNum(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2009-10-28 23:20:28 +00:00
|
|
|
TCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get setted number of digidts in field */
|
2009-10-28 23:20:28 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
|
|
|
|
WM_GETTEXT,
|
|
|
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
|
|
|
(LPARAM)szFieldDigNum);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2009-10-28 23:20:28 +00:00
|
|
|
/* Save number of digits in field */
|
|
|
|
SetLocaleInfo(lcid, LOCALE_SGROUPING, szFieldDigNum);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set negative sign */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumNegSign(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get setted negative sign */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
|
|
|
|
WM_GETTEXT,
|
|
|
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
|
|
|
(LPARAM)szNegSign);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save negative sign */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_SNEGATIVESIGN, szNegSign);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set negative sum format */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNegSumFmt(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szNegSumFmt[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
INT nCurrSel;
|
|
|
|
|
|
|
|
/* Get setted negative sum format */
|
2007-09-05 14:24:45 +00:00
|
|
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
|
|
|
|
CB_GETCURSEL,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* convert to wide char */
|
2007-09-05 14:24:45 +00:00
|
|
|
_itot(nCurrSel, szNegSumFmt,DECIMAL_RADIX);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save negative sum format */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_INEGNUMBER, szNegSumFmt);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set leading zero */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumLeadZero(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szLeadZero[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
INT nCurrSel;
|
|
|
|
|
|
|
|
/* Get setted leading zero format */
|
2007-09-05 14:24:45 +00:00
|
|
|
nCurrSel = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
|
|
|
|
CB_GETCURSEL,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
/* Convert to wide char */
|
2007-09-05 14:24:45 +00:00
|
|
|
_itot(nCurrSel, szLeadZero, DECIMAL_RADIX);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save leading zero format */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_ILZERO, szLeadZero);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set elements list separator */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumListSep(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Get setted list separator */
|
2007-09-05 14:24:45 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
|
|
|
|
WM_GETTEXT,
|
|
|
|
(WPARAM)MAX_SAMPLES_STR_SIZE,
|
|
|
|
(LPARAM)szListSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save list separator */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_SLIST, szListSep);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set units system */
|
2007-09-05 14:24:45 +00:00
|
|
|
static BOOL
|
2007-09-10 20:40:27 +00:00
|
|
|
SetNumUnitsSys(HWND hwndDlg,
|
|
|
|
LCID lcid)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-05 14:24:45 +00:00
|
|
|
TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
|
2007-09-02 20:42:08 +00:00
|
|
|
INT nCurrSel;
|
|
|
|
|
|
|
|
/* Get setted units system */
|
2007-09-05 14:24:45 +00:00
|
|
|
nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
|
|
|
|
CB_GETCURSEL,
|
|
|
|
(WPARAM)0,
|
|
|
|
(LPARAM)0);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* convert to wide char */
|
2007-09-05 14:24:45 +00:00
|
|
|
_itot(nCurrSel, szUnitsSys, DECIMAL_RADIX);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
/* Save units system */
|
2007-09-10 20:40:27 +00:00
|
|
|
SetLocaleInfo(lcid, LOCALE_IMEASURE, szUnitsSys);
|
2007-09-02 20:42:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-10-30 12:33:51 +00:00
|
|
|
|
|
|
|
/* Property page dialog callback */
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
NumbersPageProc(HWND hwndDlg,
|
2007-09-10 20:40:27 +00:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2004-10-30 12:33:51 +00:00
|
|
|
{
|
2007-09-10 20:40:27 +00:00
|
|
|
PGLOBALDATA pGlobalData;
|
|
|
|
|
|
|
|
pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
|
|
|
|
|
|
|
InitNumDecimalSepCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitNumOfFracSymbCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitNumFieldSepCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitFieldDigNumCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitNegSignCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitNegNumFmtCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitLeadingZeroesCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitListSepCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
InitUnitsSysCB(hwndDlg, pGlobalData->lcid);
|
|
|
|
UpdateNumSamples(hwndDlg, pGlobalData->lcid);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2007-09-10 20:40:27 +00:00
|
|
|
case IDC_NUMBERDSYMBOL:
|
|
|
|
case IDC_NUMBERSNDIGDEC:
|
|
|
|
case IDC_NUMBERSDIGITGRSYM:
|
|
|
|
case IDC_NUMBERSDGROUPING:
|
|
|
|
case IDC_NUMBERSNSIGNSYM:
|
|
|
|
case IDC_NUMBERSNNUMFORMAT:
|
|
|
|
case IDC_NUMBERSDISPLEADZER:
|
|
|
|
case IDC_NUMBERSLSEP:
|
|
|
|
case IDC_NUMBERSMEASSYS:
|
|
|
|
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
|
|
|
|
{
|
|
|
|
/* Set "Apply" button enabled */
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
|
|
|
}
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
2007-09-10 20:40:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
/* If push apply button */
|
|
|
|
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
|
|
|
{
|
|
|
|
if (!SetNumDecimalSep(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetFracSymNum(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNumFieldSep(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetFieldDigNum(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNumNegSign(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNegSumFmt(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNumLeadZero(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNumListSep(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!SetNumUnitsSys(hwndDlg, pGlobalData->lcid))
|
|
|
|
break;
|
|
|
|
|
|
|
|
UpdateNumSamples(hwndDlg, pGlobalData->lcid);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2004-10-30 12:33:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|