3b9e887883e25f1e27bb5cf7055ca0c250134390
[reactos.git] / reactos / dll / cpl / intl / numbers.c
1 /*
2 * ReactOS
3 * Copyright (C) 2004 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /*
20 * PROJECT: ReactOS International Control Panel
21 * FILE: dll/cpl/intl/numbers.c
22 * PURPOSE: Numbers property page
23 * PROGRAMMER: Eric Kohl
24 */
25
26 #include "intl.h"
27
28 #define SAMPLE_NUMBER L"123456789"
29 #define SAMPLE_NEG_NUMBER L"-123456789"
30 #define MAX_NUM_SEP_SAMPLES 2
31 #define MAX_FRAC_NUM_SAMPLES 10
32 #define MAX_FIELD_SEP_SAMPLES 1
33 #define MAX_FIELD_DIG_SAMPLES 3
34 #define MAX_NEG_SIGN_SAMPLES 1
35 #define MAX_NEG_NUMBERS_SAMPLES 5
36 #define MAX_LEAD_ZEROES_SAMPLES 2
37 #define MAX_LIST_SEP_SAMPLES 1
38 #define MAX_UNITS_SYS_SAMPLES 2
39
40 static PWSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES] =
41 {L",", L"."};
42 static PWSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES] =
43 {L" "};
44 static PWSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
45 {L"0;0", L"3;0", L"3;2;0"};
46 static PWSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES] =
47 {L"-"};
48 static PWSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES] =
49 {L"(1,1)", L"-1,1", L"- 1,1", L"1,1-", L"1,1 -"};
50 static PWSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES] =
51 {L",7", L"0,7"};
52 static PWSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] =
53 {L";"};
54
55
56 /* Init num decimal separator control box */
57 static VOID
58 InitNumDecimalSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
59 {
60 INT nCBIndex;
61 INT nRetCode;
62
63 /* Limit text length */
64 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
65 CB_LIMITTEXT,
66 MAX_NUMDECIMALSEP - 1,
67 0);
68
69 /* Clear all box content */
70 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
71 CB_RESETCONTENT,
72 (WPARAM)0,
73 (LPARAM)0);
74
75 /* Create standard list of decimal separators */
76 for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
77 {
78 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
79 CB_ADDSTRING,
80 0,
81 (LPARAM)lpNumSepSamples[nCBIndex]);
82 }
83
84 /* Set current item to value from registry */
85 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
86 CB_SELECTSTRING,
87 -1,
88 (LPARAM)pGlobalData->szNumDecimalSep);
89
90 /* If it is not successful, add new values to list and select them */
91 if (nRetCode == CB_ERR)
92 {
93 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
94 CB_ADDSTRING,
95 MAX_NUM_SEP_SAMPLES,
96 (LPARAM)pGlobalData->szNumDecimalSep);
97 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
98 CB_SELECTSTRING,
99 -1,
100 (LPARAM)pGlobalData->szNumDecimalSep);
101 }
102 }
103
104 /* Init number of fractional symbols control box */
105 static VOID
106 InitNumOfFracSymbCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
107 {
108 WCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
109 INT nCBIndex;
110
111 /* Clear all box content */
112 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
113 CB_RESETCONTENT,
114 (WPARAM)0,
115 (LPARAM)0);
116
117 /* Create standard list of fractional symbols */
118 for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
119 {
120 /* Convert to wide char */
121 _itow(nCBIndex, szFracCount, DECIMAL_RADIX);
122
123 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
124 CB_ADDSTRING,
125 0,
126 (LPARAM)szFracCount);
127 }
128
129 /* Set current item to value from registry */
130 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
131 CB_SETCURSEL,
132 (WPARAM)pGlobalData->nNumDigits,
133 (LPARAM)0);
134 }
135
136 /* Init field separator control box */
137 static VOID
138 InitNumFieldSepCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
139 {
140 INT nCBIndex;
141 INT nRetCode;
142
143 /* Limit text length */
144 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
145 CB_LIMITTEXT,
146 MAX_NUMTHOUSANDSEP - 1,
147 0);
148
149 /* Clear all box content */
150 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
151 CB_RESETCONTENT,
152 (WPARAM)0,
153 (LPARAM)0);
154
155 /* Create standard list of field separators */
156 for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
157 {
158 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
159 CB_ADDSTRING,
160 0,
161 (LPARAM)lpFieldSepSamples[nCBIndex]);
162 }
163
164 /* Set current item to value from registry */
165 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
166 CB_SELECTSTRING,
167 -1,
168 (LPARAM)pGlobalData->szNumThousandSep);
169
170 /* If it is not success, add new values to list and select them */
171 if (nRetCode == CB_ERR)
172 {
173 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
174 CB_ADDSTRING,
175 0,
176 (LPARAM)pGlobalData->szNumThousandSep);
177 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
178 CB_SELECTSTRING,
179 -1,
180 (LPARAM)pGlobalData->szNumThousandSep);
181 }
182 }
183
184 /* Init number of digits in field control box */
185 static VOID
186 InitFieldDigNumCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
187 {
188 PWSTR pszFieldDigNumSmpl;
189 INT nCBIndex;
190
191 /* Clear all box content */
192 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
193 CB_RESETCONTENT,
194 (WPARAM)0,
195 (LPARAM)0);
196
197 /* Create standard list of field digits num */
198 for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
199 {
200 pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
201 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
202 CB_ADDSTRING,
203 0,
204 (LPARAM)pszFieldDigNumSmpl);
205 free(pszFieldDigNumSmpl);
206 }
207
208 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
209 CB_SETCURSEL,
210 (WPARAM)pGlobalData->nNumGrouping,
211 (LPARAM)0);
212 }
213
214 /* Init negative sign control box */
215 static VOID
216 InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
217 {
218 INT nCBIndex;
219 INT nRetCode;
220
221 /* Limit text length */
222 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
223 CB_LIMITTEXT,
224 MAX_NUMNEGATIVESIGN - 1,
225 0);
226
227 /* Clear all box content */
228 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
229 CB_RESETCONTENT,
230 (WPARAM)0,
231 (LPARAM)0);
232
233 /* Create standard list of signs */
234 for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
235 {
236 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
237 CB_ADDSTRING,
238 0,
239 (LPARAM)lpNegSignSamples[nCBIndex]);
240 }
241
242 /* Set current item to value from registry */
243 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
244 CB_SELECTSTRING,
245 -1,
246 (LPARAM)pGlobalData->szNumNegativeSign);
247
248 /* If it is not successful, add new values to list and select them */
249 if (nRetCode == CB_ERR)
250 {
251 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
252 CB_ADDSTRING,
253 0,
254 (LPARAM)pGlobalData->szNumNegativeSign);
255 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
256 CB_SELECTSTRING,
257 -1,
258 (LPARAM)pGlobalData->szNumNegativeSign);
259 }
260 }
261
262 /* Init negative numbers format control box */
263 static VOID
264 InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
265 {
266 WCHAR szNewSample[MAX_SAMPLES_STR_SIZE];
267 PWSTR pszResultStr;
268 INT nCBIndex;
269
270 /* Clear all box content */
271 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
272 CB_RESETCONTENT,
273 (WPARAM)0,
274 (LPARAM)0);
275
276 /* Create standard list of negative numbers formats */
277 for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
278 {
279 /* Replace standard separator to setted */
280 pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
281 pGlobalData->szNumDecimalSep,
282 L",");
283 wcscpy(szNewSample, pszResultStr);
284 free(pszResultStr);
285
286 /* Replace standard negative sign to setted */
287 pszResultStr = ReplaceSubStr(szNewSample,
288 pGlobalData->szNumNegativeSign,
289 L"-");
290 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
291 CB_ADDSTRING,
292 0,
293 (LPARAM)pszResultStr);
294 free(pszResultStr);
295 }
296
297 /* Set current item to value from registry */
298 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
299 CB_SETCURSEL,
300 (WPARAM)pGlobalData->nNumNegFormat,
301 (LPARAM)0);
302 }
303
304 /* Init leading zeroes control box */
305 static VOID
306 InitLeadingZeroesCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
307 {
308 PWSTR pszResultStr;
309 INT nCBIndex;
310
311 /* Clear all box content */
312 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER,
313 CB_RESETCONTENT,
314 (WPARAM)0,
315 (LPARAM)0);
316
317 /* Create list of standard leading zeroes formats */
318 for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
319 {
320 pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
321 pGlobalData->szNumDecimalSep,
322 L",");
323 SendDlgItemMessage(hwndDlg, IDC_NUMBERSDISPLEADZER,
324 CB_ADDSTRING,
325 0,
326 (LPARAM)pszResultStr);
327 free(pszResultStr);
328 }
329
330 /* Set current item to value from registry */
331 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER,
332 CB_SETCURSEL,
333 (WPARAM)pGlobalData->nNumLeadingZero,
334 (LPARAM)0);
335 }
336
337 static VOID
338 InitListSepCB(HWND hwndDlg,
339 PGLOBALDATA pGlobalData)
340 {
341 INT nCBIndex;
342 INT nRetCode;
343
344 /* Limit text length */
345 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
346 CB_LIMITTEXT,
347 MAX_NUMLISTSEP - 1,
348 0);
349
350 /* Clear all box content */
351 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
352 CB_RESETCONTENT,
353 (WPARAM)0,
354 (LPARAM)0);
355
356 /* Create standard list of signs */
357 for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
358 {
359 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
360 CB_ADDSTRING,
361 0,
362 (LPARAM)lpListSepSamples[nCBIndex]);
363 }
364
365 /* Set current item to value from registry */
366 nRetCode = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
367 CB_SELECTSTRING,
368 -1,
369 (LPARAM)pGlobalData->szNumListSep);
370
371 /* If it is not successful, add new values to list and select them */
372 if (nRetCode == CB_ERR)
373 {
374 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
375 CB_ADDSTRING,
376 0,
377 (LPARAM)pGlobalData->szNumListSep);
378 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
379 CB_SELECTSTRING,
380 -1,
381 (LPARAM)pGlobalData->szNumListSep);
382 }
383 }
384
385 /* Init system of units control box */
386 static VOID
387 InitUnitsSysCB(HWND hwndDlg,
388 PGLOBALDATA pGlobalData)
389 {
390 WCHAR szUnitName[128];
391 INT nCBIndex;
392
393 /* Clear all box content */
394 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
395 CB_RESETCONTENT,
396 (WPARAM)0,
397 (LPARAM)0);
398
399 /* Create list of standard system of units */
400 for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
401 {
402 LoadStringW(hApplet, IDS_METRIC + nCBIndex, szUnitName, 128);
403
404 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
405 CB_ADDSTRING,
406 0,
407 (LPARAM)szUnitName);
408 }
409
410 /* Set current item to value from registry */
411 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
412 CB_SETCURSEL,
413 (WPARAM)pGlobalData->nNumMeasure,
414 (LPARAM)0);
415 }
416
417 /* Update all numbers locale samples */
418 static VOID
419 UpdateNumSamples(HWND hwndDlg,
420 PGLOBALDATA pGlobalData)
421 {
422 WCHAR OutBuffer[MAX_FMT_SIZE];
423 NUMBERFMT NumberFormat;
424
425 NumberFormat.NumDigits = pGlobalData->nNumDigits;
426 NumberFormat.LeadingZero = pGlobalData->nNumLeadingZero;
427 NumberFormat.Grouping = GroupingFormats[pGlobalData->nNumGrouping].nInteger;
428 NumberFormat.lpDecimalSep = pGlobalData->szNumDecimalSep;
429 NumberFormat.lpThousandSep = pGlobalData->szNumThousandSep;
430 NumberFormat.NegativeOrder = pGlobalData->nNumNegFormat;
431
432 /* Get positive number format sample */
433 GetNumberFormatW(pGlobalData->UserLCID,
434 0,
435 SAMPLE_NUMBER,
436 &NumberFormat,
437 OutBuffer,
438 MAX_FMT_SIZE);
439
440 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSPOSSAMPLE,
441 WM_SETTEXT,
442 0,
443 (LPARAM)OutBuffer);
444
445 /* Get positive number format sample */
446 GetNumberFormatW(pGlobalData->UserLCID,
447 0,
448 SAMPLE_NEG_NUMBER,
449 &NumberFormat,
450 OutBuffer,
451 MAX_FMT_SIZE);
452
453 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNEGSAMPLE,
454 WM_SETTEXT,
455 0,
456 (LPARAM)OutBuffer);
457 }
458
459 /* Set num decimal separator */
460 static BOOL
461 SetNumDecimalSep(HWND hwndDlg,
462 PGLOBALDATA pGlobalData)
463 {
464 /* Get setted decimal separator */
465 SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL,
466 WM_GETTEXT,
467 (WPARAM)MAX_NUMDECIMALSEP,
468 (LPARAM)pGlobalData->szNumDecimalSep);
469
470 return TRUE;
471 }
472
473 /* Set number of fractional symbols */
474 static BOOL
475 SetFracSymNum(HWND hwndDlg,
476 PGLOBALDATA pGlobalData)
477 {
478 INT nCurrSel;
479
480 /* Get setted number of fractional symbols */
481 nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC,
482 CB_GETCURSEL,
483 (WPARAM)0,
484 (LPARAM)0);
485 if (nCurrSel == CB_ERR)
486 return FALSE;
487
488 pGlobalData->nNumDigits = nCurrSel;
489
490 return TRUE;
491 }
492
493 /* Set field separator */
494 static BOOL
495 SetNumFieldSep(HWND hwndDlg,
496 PGLOBALDATA pGlobalData)
497 {
498 /* Get thousand separator */
499 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM,
500 WM_GETTEXT,
501 (WPARAM)MAX_NUMTHOUSANDSEP,
502 (LPARAM)pGlobalData->szNumThousandSep);
503
504 return TRUE;
505 }
506
507 /* Set number of digits in field */
508 static BOOL
509 SetFieldDigNum(HWND hwndDlg,
510 PGLOBALDATA pGlobalData)
511 {
512 INT nCurrSel;
513
514 /* Get setted negative sum format */
515 nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING,
516 CB_GETCURSEL,
517 (WPARAM)0,
518 (LPARAM)0);
519 if (nCurrSel == CB_ERR)
520 return FALSE;
521
522 pGlobalData->nNumGrouping = nCurrSel;
523
524 return TRUE;
525 }
526
527 /* Set negative sign */
528 static BOOL
529 SetNumNegSign(HWND hwndDlg,
530 PGLOBALDATA pGlobalData)
531 {
532 /* Get setted negative sign */
533 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM,
534 WM_GETTEXT,
535 (WPARAM)MAX_NUMNEGATIVESIGN,
536 (LPARAM)pGlobalData->szNumNegativeSign);
537
538 return TRUE;
539 }
540
541 /* Set negative sum format */
542 static BOOL
543 SetNegSumFmt(HWND hwndDlg,
544 PGLOBALDATA pGlobalData)
545 {
546 INT nCurrSel;
547
548 /* Get setted negative sum format */
549 nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
550 CB_GETCURSEL,
551 (WPARAM)0,
552 (LPARAM)0);
553 if (nCurrSel == CB_ERR)
554 return FALSE;
555
556 pGlobalData->nNumNegFormat = nCurrSel;
557
558 return TRUE;
559 }
560
561 /* Set leading zero */
562 static BOOL
563 SetNumLeadZero(HWND hwndDlg,
564 PGLOBALDATA pGlobalData)
565 {
566 INT nCurrSel;
567
568 /* Get setted leading zero format */
569 nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER,
570 CB_GETCURSEL,
571 (WPARAM)0,
572 (LPARAM)0);
573 if (nCurrSel == CB_ERR)
574 return FALSE;
575
576 pGlobalData->nNumLeadingZero = nCurrSel;
577
578 return TRUE;
579 }
580
581 /* Set elements list separator */
582 static BOOL
583 SetNumListSep(HWND hwndDlg,
584 PGLOBALDATA pGlobalData)
585 {
586 /* Get setted list separator */
587 SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP,
588 WM_GETTEXT,
589 (WPARAM)MAX_NUMLISTSEP,
590 (LPARAM)pGlobalData->szNumListSep);
591
592 return TRUE;
593 }
594
595 /* Set units system */
596 static BOOL
597 SetNumUnitsSys(HWND hwndDlg,
598 PGLOBALDATA pGlobalData)
599 {
600 INT nCurrSel;
601
602 /* Get setted units system */
603 nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS,
604 CB_GETCURSEL,
605 (WPARAM)0,
606 (LPARAM)0);
607 if (nCurrSel == CB_ERR)
608 return FALSE;
609
610 pGlobalData->nNumMeasure = nCurrSel;
611
612 return TRUE;
613 }
614
615 /* Property page dialog callback */
616 INT_PTR CALLBACK
617 NumbersPageProc(HWND hwndDlg,
618 UINT uMsg,
619 WPARAM wParam,
620 LPARAM lParam)
621 {
622 PGLOBALDATA pGlobalData;
623
624 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
625
626 switch (uMsg)
627 {
628 case WM_INITDIALOG:
629 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
630 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
631
632 InitNumDecimalSepCB(hwndDlg, pGlobalData);
633 InitNumOfFracSymbCB(hwndDlg, pGlobalData);
634 InitNumFieldSepCB(hwndDlg, pGlobalData);
635 InitFieldDigNumCB(hwndDlg, pGlobalData);
636 InitNegSignCB(hwndDlg, pGlobalData);
637 InitNegNumFmtCB(hwndDlg, pGlobalData);
638 InitLeadingZeroesCB(hwndDlg, pGlobalData);
639 InitListSepCB(hwndDlg, pGlobalData);
640 InitUnitsSysCB(hwndDlg, pGlobalData);
641 UpdateNumSamples(hwndDlg, pGlobalData);
642 break;
643
644 case WM_COMMAND:
645 switch (LOWORD(wParam))
646 {
647 case IDC_NUMBERDSYMBOL:
648 case IDC_NUMBERSNDIGDEC:
649 case IDC_NUMBERSDIGITGRSYM:
650 case IDC_NUMBERSDGROUPING:
651 case IDC_NUMBERSNSIGNSYM:
652 case IDC_NUMBERSNNUMFORMAT:
653 case IDC_NUMBERSDISPLEADZER:
654 case IDC_NUMBERSLSEP:
655 case IDC_NUMBERSMEASSYS:
656 if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
657 {
658 /* Set "Apply" button enabled */
659 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
660 }
661 }
662 break;
663
664 case WM_NOTIFY:
665 /* If push apply button */
666 if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
667 {
668 if (!SetNumDecimalSep(hwndDlg, pGlobalData))
669 break;
670
671 if (!SetFracSymNum(hwndDlg, pGlobalData))
672 break;
673
674 if (!SetNumFieldSep(hwndDlg, pGlobalData))
675 break;
676
677 if (!SetFieldDigNum(hwndDlg, pGlobalData))
678 break;
679
680 if (!SetNumNegSign(hwndDlg, pGlobalData))
681 break;
682
683 if (!SetNegSumFmt(hwndDlg, pGlobalData))
684 break;
685
686 if (!SetNumLeadZero(hwndDlg, pGlobalData))
687 break;
688
689 if (!SetNumListSep(hwndDlg, pGlobalData))
690 break;
691
692 if (!SetNumUnitsSys(hwndDlg, pGlobalData))
693 break;
694
695 pGlobalData->fUserLocaleChanged = TRUE;
696
697 UpdateNumSamples(hwndDlg, pGlobalData);
698 }
699 break;
700 }
701 return FALSE;
702 }
703
704 /* EOF */