ReactOS  0.4.15-dev-1201-gb2cf5a4
numbers.c File Reference
#include "intl.h"
Include dependency graph for numbers.c:

Go to the source code of this file.

Macros

#define SAMPLE_NUMBER   L"123456789"
 
#define SAMPLE_NEG_NUMBER   L"-123456789"
 
#define MAX_NUM_SEP_SAMPLES   2
 
#define MAX_FRAC_NUM_SAMPLES   10
 
#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
 

Functions

static VOID InitNumDecimalSepCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitNumOfFracSymbCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitNumFieldSepCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitFieldDigNumCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitNegSignCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitNegNumFmtCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitLeadingZeroesCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitListSepCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitUnitsSysCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID UpdateNumSamples (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static BOOL GetNumberSetting (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
INT_PTR CALLBACK NumbersPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static PWSTR lpNumSepSamples [MAX_NUM_SEP_SAMPLES]
 
static PWSTR lpFieldSepSamples [MAX_FIELD_SEP_SAMPLES]
 
static PWSTR lpFieldDigNumSamples [MAX_FIELD_DIG_SAMPLES]
 
static PWSTR lpNegSignSamples [MAX_NEG_SIGN_SAMPLES]
 
static PWSTR lpNegNumFmtSamples [MAX_NEG_NUMBERS_SAMPLES]
 
static PWSTR lpLeadNumFmtSamples [MAX_LEAD_ZEROES_SAMPLES]
 
static PWSTR lpListSepSamples [MAX_LIST_SEP_SAMPLES]
 

Macro Definition Documentation

◆ MAX_FIELD_DIG_SAMPLES

#define MAX_FIELD_DIG_SAMPLES   3

Definition at line 34 of file numbers.c.

◆ MAX_FIELD_SEP_SAMPLES

#define MAX_FIELD_SEP_SAMPLES   1

Definition at line 33 of file numbers.c.

◆ MAX_FRAC_NUM_SAMPLES

#define MAX_FRAC_NUM_SAMPLES   10

Definition at line 32 of file numbers.c.

◆ MAX_LEAD_ZEROES_SAMPLES

#define MAX_LEAD_ZEROES_SAMPLES   2

Definition at line 37 of file numbers.c.

◆ MAX_LIST_SEP_SAMPLES

#define MAX_LIST_SEP_SAMPLES   1

Definition at line 38 of file numbers.c.

◆ MAX_NEG_NUMBERS_SAMPLES

#define MAX_NEG_NUMBERS_SAMPLES   5

Definition at line 36 of file numbers.c.

◆ MAX_NEG_SIGN_SAMPLES

#define MAX_NEG_SIGN_SAMPLES   1

Definition at line 35 of file numbers.c.

◆ MAX_NUM_SEP_SAMPLES

#define MAX_NUM_SEP_SAMPLES   2

Definition at line 31 of file numbers.c.

◆ MAX_UNITS_SYS_SAMPLES

#define MAX_UNITS_SYS_SAMPLES   2

Definition at line 39 of file numbers.c.

◆ SAMPLE_NEG_NUMBER

#define SAMPLE_NEG_NUMBER   L"-123456789"

Definition at line 30 of file numbers.c.

◆ SAMPLE_NUMBER

#define SAMPLE_NUMBER   L"123456789"

Definition at line 29 of file numbers.c.

Function Documentation

◆ GetNumberSetting()

static BOOL GetNumberSetting ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 474 of file numbers.c.

477 {
478  WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP];
479  WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP];
480  WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN];
481  WCHAR szNumListSep[MAX_NUMLISTSEP];
482  INT nNumDigits;
483  INT nNumGrouping;
484  INT nNumNegFormat;
485  INT nNumLeadingZero;
486  INT nNumMeasure;
487 
488  /* Decimal symbol */
489  GetSelectedComboBoxText(hwndDlg,
491  szNumDecimalSep,
493 
494  if (szNumDecimalSep[0] == L'\0')
495  {
496  /* TODO: Show error message */
497 
498  return FALSE;
499  }
500 
501  /* Number of digits after decimal */
502  GetSelectedComboBoxIndex(hwndDlg,
504  &nNumDigits);
505 
506  /* Digit grouping symbol */
507  GetSelectedComboBoxText(hwndDlg,
509  szNumThousandSep,
511 
512  if (szNumThousandSep[0] == L'\0')
513  {
514  /* TODO: Show error message */
515 
516  return FALSE;
517  }
518 
519  /* Digit grouping */
520  GetSelectedComboBoxIndex(hwndDlg,
522  &nNumGrouping);
523 
524  /* Negative sign symbol */
525  GetSelectedComboBoxText(hwndDlg,
527  szNumNegativeSign,
529 
530  if (szNumNegativeSign[0] == L'\0')
531  {
532  /* TODO: Show error message */
533 
534  return FALSE;
535  }
536 
537  /* Negative number format */
538  GetSelectedComboBoxIndex(hwndDlg,
540  &nNumNegFormat);
541 
542  /* Display leading zeros */
543  GetSelectedComboBoxIndex(hwndDlg,
545  &nNumLeadingZero);
546 
547  /* List separator */
548  GetSelectedComboBoxText(hwndDlg,
550  szNumListSep,
552 
553  if (szNumListSep[0] == L'\0')
554  {
555  /* TODO: Show error message */
556 
557  return FALSE;
558  }
559 
560  /* Measurement system */
561  GetSelectedComboBoxIndex(hwndDlg,
563  &nNumMeasure);
564 
565  /* Store settings in global data */
566  wcscpy(pGlobalData->szNumDecimalSep, szNumDecimalSep);
567  wcscpy(pGlobalData->szNumThousandSep, szNumThousandSep);
568  wcscpy(pGlobalData->szNumNegativeSign, szNumNegativeSign);
569  wcscpy(pGlobalData->szNumListSep, szNumListSep);
570  pGlobalData->nNumGrouping = nNumGrouping;
571  pGlobalData->nNumDigits = nNumDigits;
572  pGlobalData->nNumNegFormat = nNumNegFormat;
573  pGlobalData->nNumLeadingZero = nNumLeadingZero;
574  pGlobalData->nNumMeasure = nNumMeasure;
575 
576  return TRUE;
577 }
VOID GetSelectedComboBoxText(HWND hwndDlg, INT nIdDlgItem, PWSTR Buffer, UINT uSize)
Definition: misc.c:176
VOID GetSelectedComboBoxIndex(HWND hwndDlg, INT nIdDlgItem, PINT pValue)
Definition: misc.c:223
#define MAX_NUMNEGATIVESIGN
Definition: intl.h:28
#define IDC_NUMBERSNDIGDEC
Definition: resource.h:37
#define IDC_NUMBERSDGROUPING
Definition: resource.h:39
#define TRUE
Definition: numbers.c:17
#define IDC_NUMBERSNSIGNSYM
Definition: resource.h:40
#define MAX_NUMDECIMALSEP
Definition: intl.h:26
INT nNumNegFormat
Definition: intl.h:73
#define IDC_NUMBERSLSEP
Definition: resource.h:43
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
#define MAX_NUMTHOUSANDSEP
Definition: intl.h:27
int32_t INT
Definition: typedefs.h:58
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
INT nNumLeadingZero
Definition: intl.h:75
INT nNumGrouping
Definition: intl.h:76
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR szNumListSep[MAX_NUMLISTSEP]
Definition: intl.h:72
#define IDC_NUMBERSNNUMFORMAT
Definition: resource.h:41
#define IDC_NUMBERSDIGITGRSYM
Definition: resource.h:38
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
INT nNumMeasure
Definition: intl.h:77
INT nNumDigits
Definition: intl.h:74
#define IDC_NUMBERSDISPLEADZER
Definition: resource.h:42
#define IDC_NUMBERDSYMBOL
Definition: resource.h:36
#define FALSE
Definition: numbers.c:16
#define MAX_NUMLISTSEP
Definition: intl.h:30
#define IDC_NUMBERSMEASSYS
Definition: resource.h:44

Referenced by NumbersPageProc().

◆ InitFieldDigNumCB()

static VOID InitFieldDigNumCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 187 of file numbers.c.

188 {
189  PWSTR pszFieldDigNumSmpl;
190  INT nCBIndex;
191 
192  /* Clear all box content */
195  (WPARAM)0,
196  (LPARAM)0);
197 
198  /* Create standard list of field digits num */
199  for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
200  {
201  pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
202  if (pszFieldDigNumSmpl != NULL)
203  {
205  CB_ADDSTRING,
206  0,
207  (LPARAM)pszFieldDigNumSmpl);
208  HeapFree(GetProcessHeap(), 0, pszFieldDigNumSmpl);
209  }
210  }
211 
213  CB_SETCURSEL,
214  (WPARAM)pGlobalData->nNumGrouping,
215  (LPARAM)0);
216 }
static PWSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES]
Definition: numbers.c:45
uint16_t * PWSTR
Definition: typedefs.h:56
#define IDC_NUMBERSDGROUPING
Definition: resource.h:39
UINT_PTR WPARAM
Definition: windef.h:207
PWSTR InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr)
Definition: misc.c:39
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define GetProcessHeap()
Definition: compat.h:595
INT nNumGrouping
Definition: intl.h:76
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETCURSEL
Definition: winuser.h:1943
#define SAMPLE_NUMBER
Definition: numbers.c:29
#define MAX_FIELD_DIG_SAMPLES
Definition: numbers.c:34
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by NumbersPageProc().

◆ InitLeadingZeroesCB()

static VOID InitLeadingZeroesCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 315 of file numbers.c.

316 {
317  PWSTR pszResultStr;
318  INT nCBIndex;
319 
320  /* Clear all box content */
323  (WPARAM)0,
324  (LPARAM)0);
325 
326  /* Create list of standard leading zeroes formats */
327  for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
328  {
329  pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
330  pGlobalData->szNumDecimalSep,
331  L",");
332  if (pszResultStr != NULL)
333  {
335  CB_ADDSTRING,
336  0,
337  (LPARAM)pszResultStr);
338  HeapFree(GetProcessHeap(), 0, pszResultStr);
339  }
340  }
341 
342  /* Set current item to value from registry */
344  CB_SETCURSEL,
345  (WPARAM)pGlobalData->nNumLeadingZero,
346  (LPARAM)0);
347 }
PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl)
Definition: misc.c:118
uint16_t * PWSTR
Definition: typedefs.h:56
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
INT nNumLeadingZero
Definition: intl.h:75
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define GetProcessHeap()
Definition: compat.h:595
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
static const WCHAR L[]
Definition: oid.c:1250
#define MAX_LEAD_ZEROES_SAMPLES
Definition: numbers.c:37
#define CB_SETCURSEL
Definition: winuser.h:1943
#define IDC_NUMBERSDISPLEADZER
Definition: resource.h:42
#define HeapFree(x, y, z)
Definition: compat.h:594
static PWSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES]
Definition: numbers.c:51

Referenced by NumbersPageProc().

◆ InitListSepCB()

static VOID InitListSepCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 350 of file numbers.c.

352 {
353  INT nCBIndex;
354  INT nRetCode;
355 
356  /* Limit text length */
358  CB_LIMITTEXT,
359  MAX_NUMLISTSEP - 1,
360  0);
361 
362  /* Clear all box content */
365  (WPARAM)0,
366  (LPARAM)0);
367 
368  /* Create standard list of signs */
369  for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
370  {
372  CB_ADDSTRING,
373  0,
374  (LPARAM)lpListSepSamples[nCBIndex]);
375  }
376 
377  /* Set current item to value from registry */
378  nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
380  -1,
381  (LPARAM)pGlobalData->szNumListSep);
382 
383  /* If it is not successful, add new values to list and select them */
384  if (nRetCode == CB_ERR)
385  {
387  CB_ADDSTRING,
388  0,
389  (LPARAM)pGlobalData->szNumListSep);
392  -1,
393  (LPARAM)pGlobalData->szNumListSep);
394  }
395 }
UINT_PTR WPARAM
Definition: windef.h:207
#define IDC_NUMBERSLSEP
Definition: resource.h:43
static PWSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES]
Definition: numbers.c:53
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_LIMITTEXT
Definition: winuser.h:1940
#define MAX_LIST_SEP_SAMPLES
Definition: numbers.c:38
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
WCHAR szNumListSep[MAX_NUMLISTSEP]
Definition: intl.h:72
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define MAX_NUMLISTSEP
Definition: intl.h:30

Referenced by NumbersPageProc().

◆ InitNegNumFmtCB()

static VOID InitNegNumFmtCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 268 of file numbers.c.

269 {
270  PWSTR pszString1, pszString2;
271  INT nCBIndex;
272 
273  /* Clear all box content */
276  (WPARAM)0,
277  (LPARAM)0);
278 
279  /* Create standard list of negative numbers formats */
280  for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
281  {
282  /* Replace standard separator to setted */
283  pszString1 = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
284  pGlobalData->szNumDecimalSep,
285  L",");
286  if (pszString1 != NULL)
287  {
288  /* Replace standard negative sign to setted */
289  pszString2 = ReplaceSubStr(pszString1,
290  pGlobalData->szNumNegativeSign,
291  L"-");
292  if (pszString2 != NULL)
293  {
295  CB_ADDSTRING,
296  0,
297  (LPARAM)pszString2);
298 
299  HeapFree(GetProcessHeap(), 0, pszString2);
300  }
301 
302  HeapFree(GetProcessHeap(), 0, pszString1);
303  }
304  }
305 
306  /* Set current item to value from registry */
308  CB_SETCURSEL,
309  (WPARAM)pGlobalData->nNumNegFormat,
310  (LPARAM)0);
311 }
PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl)
Definition: misc.c:118
static PWSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES]
Definition: numbers.c:49
uint16_t * PWSTR
Definition: typedefs.h:56
INT nNumNegFormat
Definition: intl.h:73
UINT_PTR WPARAM
Definition: windef.h:207
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define GetProcessHeap()
Definition: compat.h:595
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_NUMBERSNNUMFORMAT
Definition: resource.h:41
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
static const WCHAR L[]
Definition: oid.c:1250
#define CB_SETCURSEL
Definition: winuser.h:1943
#define MAX_NEG_NUMBERS_SAMPLES
Definition: numbers.c:36
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by NumbersPageProc().

◆ InitNegSignCB()

static VOID InitNegSignCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 220 of file numbers.c.

221 {
222  INT nCBIndex;
223  INT nRetCode;
224 
225  /* Limit text length */
227  CB_LIMITTEXT,
229  0);
230 
231  /* Clear all box content */
234  (WPARAM)0,
235  (LPARAM)0);
236 
237  /* Create standard list of signs */
238  for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
239  {
241  CB_ADDSTRING,
242  0,
243  (LPARAM)lpNegSignSamples[nCBIndex]);
244  }
245 
246  /* Set current item to value from registry */
247  nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
249  -1,
250  (LPARAM)pGlobalData->szNumNegativeSign);
251 
252  /* If it is not successful, add new values to list and select them */
253  if (nRetCode == CB_ERR)
254  {
256  CB_ADDSTRING,
257  0,
258  (LPARAM)pGlobalData->szNumNegativeSign);
261  -1,
262  (LPARAM)pGlobalData->szNumNegativeSign);
263  }
264 }
#define MAX_NUMNEGATIVESIGN
Definition: intl.h:28
#define IDC_NUMBERSNSIGNSYM
Definition: resource.h:40
UINT_PTR WPARAM
Definition: windef.h:207
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_LIMITTEXT
Definition: winuser.h:1940
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SELECTSTRING
Definition: winuser.h:1942
static PWSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES]
Definition: numbers.c:47
#define MAX_NEG_SIGN_SAMPLES
Definition: numbers.c:35

Referenced by NumbersPageProc().

◆ InitNumDecimalSepCB()

static VOID InitNumDecimalSepCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 59 of file numbers.c.

60 {
61  INT nCBIndex;
62  INT nRetCode;
63 
64  /* Limit text length */
68  0);
69 
70  /* Clear all box content */
73  (WPARAM)0,
74  (LPARAM)0);
75 
76  /* Create standard list of decimal separators */
77  for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
78  {
81  0,
82  (LPARAM)lpNumSepSamples[nCBIndex]);
83  }
84 
85  /* Set current item to value from registry */
86  nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
88  -1,
89  (LPARAM)pGlobalData->szNumDecimalSep);
90 
91  /* If it is not successful, add new values to list and select them */
92  if (nRetCode == CB_ERR)
93  {
97  (LPARAM)pGlobalData->szNumDecimalSep);
100  -1,
101  (LPARAM)pGlobalData->szNumDecimalSep);
102  }
103 }
#define MAX_NUMDECIMALSEP
Definition: intl.h:26
#define MAX_NUM_SEP_SAMPLES
Definition: numbers.c:31
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:58
static PWSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES]
Definition: numbers.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_LIMITTEXT
Definition: winuser.h:1940
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define IDC_NUMBERDSYMBOL
Definition: resource.h:36

Referenced by NumbersPageProc().

◆ InitNumFieldSepCB()

static VOID InitNumFieldSepCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 139 of file numbers.c.

140 {
141  INT nCBIndex;
142  INT nRetCode;
143 
144  /* Limit text length */
146  CB_LIMITTEXT,
147  MAX_NUMTHOUSANDSEP - 1,
148  0);
149 
150  /* Clear all box content */
153  (WPARAM)0,
154  (LPARAM)0);
155 
156  /* Create standard list of field separators */
157  for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
158  {
160  CB_ADDSTRING,
161  0,
162  (LPARAM)lpFieldSepSamples[nCBIndex]);
163  }
164 
165  /* Set current item to value from registry */
166  nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
168  -1,
169  (LPARAM)pGlobalData->szNumThousandSep);
170 
171  /* If it is not success, add new values to list and select them */
172  if (nRetCode == CB_ERR)
173  {
175  CB_ADDSTRING,
176  0,
177  (LPARAM)pGlobalData->szNumThousandSep);
180  -1,
181  (LPARAM)pGlobalData->szNumThousandSep);
182  }
183 }
UINT_PTR WPARAM
Definition: windef.h:207
#define MAX_NUMTHOUSANDSEP
Definition: intl.h:27
int32_t INT
Definition: typedefs.h:58
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_LIMITTEXT
Definition: winuser.h:1940
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_NUMBERSDIGITGRSYM
Definition: resource.h:38
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define MAX_FIELD_SEP_SAMPLES
Definition: numbers.c:33
static PWSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES]
Definition: numbers.c:43

Referenced by NumbersPageProc().

◆ InitNumOfFracSymbCB()

static VOID InitNumOfFracSymbCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 107 of file numbers.c.

108 {
109  WCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
110  INT nCBIndex;
111 
112  /* Clear all box content */
115  (WPARAM)0,
116  (LPARAM)0);
117 
118  /* Create standard list of fractional symbols */
119  for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
120  {
121  /* Convert to wide char */
122  _itow(nCBIndex, szFracCount, DECIMAL_RADIX);
123 
125  CB_ADDSTRING,
126  0,
127  (LPARAM)szFracCount);
128  }
129 
130  /* Set current item to value from registry */
132  CB_SETCURSEL,
133  (WPARAM)pGlobalData->nNumDigits,
134  (LPARAM)0);
135 }
#define IDC_NUMBERSNDIGDEC
Definition: resource.h:37
UINT_PTR WPARAM
Definition: windef.h:207
_CRTIMP wchar_t *__cdecl _itow(_In_ int _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
int32_t INT
Definition: typedefs.h:58
#define MAX_FRAC_NUM_SAMPLES
Definition: numbers.c:32
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define MAX_SAMPLES_STR_SIZE
Definition: intl.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT nNumDigits
Definition: intl.h:74
#define CB_SETCURSEL
Definition: winuser.h:1943
#define DECIMAL_RADIX
Definition: intl.h:19

Referenced by NumbersPageProc().

◆ InitUnitsSysCB()

static VOID InitUnitsSysCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 399 of file numbers.c.

401 {
402  WCHAR szUnitName[128];
403  INT nCBIndex;
404 
405  /* Clear all box content */
408  (WPARAM)0,
409  (LPARAM)0);
410 
411  /* Create list of standard system of units */
412  for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
413  {
414  LoadStringW(hApplet, IDS_METRIC + nCBIndex, szUnitName, 128);
415 
417  CB_ADDSTRING,
418  0,
419  (LPARAM)szUnitName);
420  }
421 
422  /* Set current item to value from registry */
424  CB_SETCURSEL,
425  (WPARAM)pGlobalData->nNumMeasure,
426  (LPARAM)0);
427 }
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define IDS_METRIC
Definition: resource.h:77
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define MAX_UNITS_SYS_SAMPLES
Definition: numbers.c:39
#define CB_RESETCONTENT
Definition: winuser.h:1941
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT nNumMeasure
Definition: intl.h:77
#define CB_SETCURSEL
Definition: winuser.h:1943
#define IDC_NUMBERSMEASSYS
Definition: resource.h:44

Referenced by NumbersPageProc().

◆ NumbersPageProc()

INT_PTR CALLBACK NumbersPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 581 of file numbers.c.

585 {
586  PGLOBALDATA pGlobalData;
587 
588  pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
589 
590  switch (uMsg)
591  {
592  case WM_INITDIALOG:
593  pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
594  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
595 
596  InitNumDecimalSepCB(hwndDlg, pGlobalData);
597  InitNumOfFracSymbCB(hwndDlg, pGlobalData);
598  InitNumFieldSepCB(hwndDlg, pGlobalData);
599  InitFieldDigNumCB(hwndDlg, pGlobalData);
600  InitNegSignCB(hwndDlg, pGlobalData);
601  InitNegNumFmtCB(hwndDlg, pGlobalData);
602  InitLeadingZeroesCB(hwndDlg, pGlobalData);
603  InitListSepCB(hwndDlg, pGlobalData);
604  InitUnitsSysCB(hwndDlg, pGlobalData);
605  UpdateNumSamples(hwndDlg, pGlobalData);
606  break;
607 
608  case WM_COMMAND:
609  switch (LOWORD(wParam))
610  {
611  case IDC_NUMBERDSYMBOL:
612  case IDC_NUMBERSNDIGDEC:
615  case IDC_NUMBERSNSIGNSYM:
618  case IDC_NUMBERSLSEP:
619  case IDC_NUMBERSMEASSYS:
621  {
622  /* Enable the Apply button */
623  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
624  }
625  }
626  break;
627 
628  case WM_NOTIFY:
629  if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
630  {
631  if (GetNumberSetting(hwndDlg, pGlobalData))
632  {
633  pGlobalData->bUserLocaleChanged = TRUE;
634  UpdateNumSamples(hwndDlg, pGlobalData);
635  }
636  }
637  break;
638  }
639  return FALSE;
640 }
static VOID InitNumOfFracSymbCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:107
static VOID InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:59
struct _GLOBALDATA * PGLOBALDATA
static VOID InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:268
static VOID InitListSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:350
#define IDC_NUMBERSNDIGDEC
Definition: resource.h:37
#define IDC_NUMBERSDGROUPING
Definition: resource.h:39
static BOOL GetNumberSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:474
#define TRUE
Definition: numbers.c:17
#define IDC_NUMBERSNSIGNSYM
Definition: resource.h:40
BOOL bUserLocaleChanged
Definition: intl.h:115
#define IDC_NUMBERSLSEP
Definition: resource.h:43
#define PSN_APPLY
Definition: prsht.h:117
#define SetWindowLongPtr
Definition: treelist.c:70
static VOID InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:139
WPARAM wParam
Definition: combotst.c:138
static VOID UpdateNumSamples(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:431
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define CBN_EDITCHANGE
Definition: winuser.h:1957
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define IDC_NUMBERSNNUMFORMAT
Definition: resource.h:41
#define IDC_NUMBERSDIGITGRSYM
Definition: resource.h:38
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
static VOID InitUnitsSysCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:399
HWND WINAPI GetParent(_In_ HWND)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define IDC_NUMBERSDISPLEADZER
Definition: resource.h:42
#define IDC_NUMBERDSYMBOL
Definition: resource.h:36
static VOID InitFieldDigNumCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:187
#define FALSE
Definition: numbers.c:16
static VOID InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:220
#define HIWORD(l)
Definition: typedefs.h:247
static VOID InitLeadingZeroesCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: numbers.c:315
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_NUMBERSMEASSYS
Definition: resource.h:44
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by CustomizeLocalePropertySheet().

◆ UpdateNumSamples()

static VOID UpdateNumSamples ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 431 of file numbers.c.

433 {
435  NUMBERFMT NumberFormat;
436 
437  NumberFormat.NumDigits = pGlobalData->nNumDigits;
438  NumberFormat.LeadingZero = pGlobalData->nNumLeadingZero;
439  NumberFormat.Grouping = GroupingFormats[pGlobalData->nNumGrouping].nInteger;
440  NumberFormat.lpDecimalSep = pGlobalData->szNumDecimalSep;
441  NumberFormat.lpThousandSep = pGlobalData->szNumThousandSep;
442  NumberFormat.NegativeOrder = pGlobalData->nNumNegFormat;
443 
444  /* Get positive number format sample */
445  GetNumberFormatW(pGlobalData->UserLCID,
446  0,
448  &NumberFormat,
449  OutBuffer,
450  MAX_FMT_SIZE);
451 
453  WM_SETTEXT,
454  0,
455  (LPARAM)OutBuffer);
456 
457  /* Get positive number format sample */
458  GetNumberFormatW(pGlobalData->UserLCID,
459  0,
461  &NumberFormat,
462  OutBuffer,
463  MAX_FMT_SIZE);
464 
466  WM_SETTEXT,
467  0,
468  (LPARAM)OutBuffer);
469 }
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
INT nNumNegFormat
Definition: intl.h:73
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
INT nNumLeadingZero
Definition: intl.h:75
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_NUMBERSNEGSAMPLE
Definition: resource.h:35
#define WM_SETTEXT
Definition: winuser.h:1599
UINT LeadingZero
Definition: winnls.h:632
INT nNumGrouping
Definition: intl.h:76
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
GROUPINGDATA GroupingFormats[MAX_GROUPINGFORMATS]
Definition: generalp.c:44
INT nNumDigits
Definition: intl.h:74
#define MAX_FMT_SIZE
Definition: intl.h:22
UINT NumDigits
Definition: winnls.h:631
#define SAMPLE_NEG_NUMBER
Definition: numbers.c:30
#define SAMPLE_NUMBER
Definition: numbers.c:29
LPSTR lpThousandSep
Definition: winnls.h:635
LPSTR lpDecimalSep
Definition: winnls.h:634
#define IDC_NUMBERSPOSSAMPLE
Definition: resource.h:34
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198
UINT nInteger
Definition: intl.h:127
UINT Grouping
Definition: winnls.h:633
UINT NegativeOrder
Definition: winnls.h:636
LCID UserLCID
Definition: intl.h:113

Referenced by NumbersPageProc().

Variable Documentation

◆ lpFieldDigNumSamples

PWSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES]
static
Initial value:
=
{L"0;0", L"3;0", L"3;2;0"}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 45 of file numbers.c.

Referenced by InitFieldDigNumCB().

◆ lpFieldSepSamples

PWSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES]
static
Initial value:
=
{L" "}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 43 of file numbers.c.

Referenced by InitNumFieldSepCB().

◆ lpLeadNumFmtSamples

PWSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES]
static
Initial value:
=
{L",7", L"0,7"}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 51 of file numbers.c.

Referenced by InitLeadingZeroesCB().

◆ lpListSepSamples

PWSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES]
static
Initial value:
=
{L";"}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 53 of file numbers.c.

Referenced by InitListSepCB().

◆ lpNegNumFmtSamples

PWSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES]
static
Initial value:
=
{L"(1,1)", L"-1,1", L"- 1,1", L"1,1-", L"1,1 -"}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 49 of file numbers.c.

Referenced by InitNegNumFmtCB().

◆ lpNegSignSamples

PWSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES]
static
Initial value:
=
{L"-"}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 47 of file numbers.c.

Referenced by InitNegSignCB().

◆ lpNumSepSamples

PWSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES]
static
Initial value:
=
{L",", L"."}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 41 of file numbers.c.

Referenced by InitNumDecimalSepCB().