Author: ekohl Date: Sun Oct 11 18:36:22 2015 New Revision: 69501
URL: http://svn.reactos.org/svn/reactos?rev=69501&view=rev Log: [INTL] Update number and currency examples according to the current settings. CORE-10074 #resolve
Modified: trunk/reactos/dll/cpl/intl/currency.c trunk/reactos/dll/cpl/intl/generalp.c trunk/reactos/dll/cpl/intl/intl.h trunk/reactos/dll/cpl/intl/numbers.c
Modified: trunk/reactos/dll/cpl/intl/currency.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/currency.c?rev... ============================================================================== --- trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] Sun Oct 11 18:36:22 2015 @@ -33,18 +33,28 @@ UpdateExamples(HWND hwndDlg, PGLOBALDATA pGlobalData) { WCHAR szBuffer[MAX_FMT_SIZE]; + CURRENCYFMTW CurrencyFormat; + + CurrencyFormat.NumDigits = pGlobalData->nCurrDigits; + CurrencyFormat.LeadingZero = pGlobalData->nNumLeadingZero; + CurrencyFormat.Grouping = GroupingFormats[pGlobalData->nCurrGrouping].nInteger; + CurrencyFormat.lpDecimalSep = pGlobalData->szCurrDecimalSep; + CurrencyFormat.lpThousandSep = pGlobalData->szCurrThousandSep; + CurrencyFormat.NegativeOrder = pGlobalData->nCurrNegFormat; + CurrencyFormat.PositiveOrder = pGlobalData->nCurrPosFormat; + CurrencyFormat.lpCurrencySymbol = pGlobalData->szCurrSymbol;
/* Positive example */ GetCurrencyFormatW(pGlobalData->UserLCID, 0, POSITIVE_EXAMPLE, - NULL, szBuffer, MAX_FMT_SIZE); + &CurrencyFormat, szBuffer, MAX_FMT_SIZE);
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSSAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer);
/* Negative example */ GetCurrencyFormatW(pGlobalData->UserLCID, 0, NEGATIVE_EXAMPLE, - NULL, szBuffer, MAX_FMT_SIZE); + &CurrencyFormat, szBuffer, MAX_FMT_SIZE);
SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGSAMPLE, WM_SETTEXT, 0, (LPARAM)szBuffer); } @@ -219,6 +229,7 @@ { WCHAR szBuffer[MAX_FMT_SIZE]; CURRENCYFMTW cyFmt; + INT i;
/* Digit grouping */ cyFmt.NumDigits = 0; @@ -228,37 +239,19 @@ cyFmt.PositiveOrder = 0; cyFmt.NegativeOrder = 0; cyFmt.lpCurrencySymbol = L""; - cyFmt.Grouping = 0; - GetCurrencyFormatW(pGlobalData->UserLCID, 0, - L"123456789", - &cyFmt, szBuffer, MAX_FMT_SIZE); - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, - CB_INSERTSTRING, - -1, - (LPARAM)szBuffer); - - cyFmt.Grouping = 3; - GetCurrencyFormatW(pGlobalData->UserLCID, 0, - L"123456789", - &cyFmt, szBuffer, MAX_FMT_SIZE); - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, - CB_INSERTSTRING, - -1, - (LPARAM)szBuffer); - - cyFmt.Grouping = 32; - GetCurrencyFormatW(pGlobalData->UserLCID, 0, - L"123456789", - &cyFmt, szBuffer, MAX_FMT_SIZE); - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, - CB_INSERTSTRING, - -1, - (LPARAM)szBuffer); - - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, - CB_SETCURSEL, - pGlobalData->nCurrGrouping, /* Index */ - 0); + + for (i = 0 ; i < MAX_GROUPINGFORMATS ; i++) + { + cyFmt.Grouping = GroupingFormats[i].nInteger; + + GetCurrencyFormatW(pGlobalData->UserLCID, 0, + L"123456789", + &cyFmt, szBuffer, MAX_FMT_SIZE); + SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, + CB_INSERTSTRING, + -1, + (LPARAM)szBuffer); + } }
Modified: trunk/reactos/dll/cpl/intl/generalp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/generalp.c?rev... ============================================================================== --- trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] Sun Oct 11 18:36:22 2015 @@ -30,28 +30,22 @@ #include <debug.h>
#define SAMPLE_NUMBER L"123456789" -#define NO_FLAG 0
#define NUM_SHEETS 4
#define MAX_FIELD_DIG_SAMPLES 3
-typedef struct -{ - LCTYPE lcType; - PWSTR pKeyName; -} LOCALE_KEY_DATA, *PLOCALE_KEY_DATA;
HWND hList; HWND hLocaleList, hGeoList; BOOL bSpain = FALSE;
- -PWSTR szCurrencyGrouping[3] = +GROUPINGDATA +GroupingFormats[MAX_GROUPINGFORMATS] = { - L"0;0", - L"3;0", - L"3;2;0" + {0, L"0;0"}, + {3, L"3;0"}, + {32, L"3;2;0"} };
static BOOL CALLBACK @@ -111,16 +105,36 @@ PGLOBALDATA pGlobalData) { WCHAR OutBuffer[MAX_SAMPLES_STR_SIZE]; + NUMBERFMT NumberFormat; + CURRENCYFMTW CurrencyFormat; + + NumberFormat.NumDigits = pGlobalData->nNumDigits; + NumberFormat.LeadingZero = pGlobalData->nNumLeadingZero; + NumberFormat.Grouping = GroupingFormats[pGlobalData->nNumGrouping].nInteger; + NumberFormat.lpDecimalSep = pGlobalData->szNumDecimalSep; + NumberFormat.lpThousandSep = pGlobalData->szNumThousandSep; + NumberFormat.NegativeOrder = pGlobalData->nNumNegFormat; + + CurrencyFormat.NumDigits = pGlobalData->nCurrDigits; + CurrencyFormat.LeadingZero = pGlobalData->nNumLeadingZero; + CurrencyFormat.Grouping = GroupingFormats[pGlobalData->nCurrGrouping].nInteger; + CurrencyFormat.lpDecimalSep = pGlobalData->szCurrDecimalSep; + CurrencyFormat.lpThousandSep = pGlobalData->szCurrThousandSep; + CurrencyFormat.NegativeOrder = pGlobalData->nCurrNegFormat; + CurrencyFormat.PositiveOrder = pGlobalData->nCurrPosFormat; + CurrencyFormat.lpCurrencySymbol = pGlobalData->szCurrSymbol;
/* Get number format sample */ - GetNumberFormatW(pGlobalData->UserLCID, NO_FLAG, SAMPLE_NUMBER, NULL, + GetNumberFormatW(pGlobalData->UserLCID, 0, SAMPLE_NUMBER, + &NumberFormat, OutBuffer, MAX_SAMPLES_STR_SIZE); SendDlgItemMessageW(hwndDlg, IDC_NUMSAMPLE_EDIT, WM_SETTEXT, 0, (LPARAM)OutBuffer); ZeroMemory(OutBuffer, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
/* Get monetary format sample */ - GetCurrencyFormatW(pGlobalData->UserLCID, NO_FLAG, SAMPLE_NUMBER, NULL, + GetCurrencyFormatW(pGlobalData->UserLCID, 0, SAMPLE_NUMBER, + &CurrencyFormat, OutBuffer, MAX_SAMPLES_STR_SIZE); SendDlgItemMessageW(hwndDlg, IDC_MONEYSAMPLE_EDIT, WM_SETTEXT, 0, (LPARAM)OutBuffer); @@ -833,8 +847,8 @@ L"sGrouping", 0, REG_SZ, - (PBYTE)szCurrencyGrouping[pGlobalData->nNumGrouping], - (wcslen(szCurrencyGrouping[pGlobalData->nNumGrouping]) + 1) * sizeof(WCHAR)); + (PBYTE)GroupingFormats[pGlobalData->nNumGrouping].pszString, + (wcslen(GroupingFormats[pGlobalData->nNumGrouping].pszString) + 1) * sizeof(WCHAR));
RegSetValueExW(hLocaleKey, L"sList", @@ -921,8 +935,8 @@ L"sMonGrouping", 0, REG_SZ, - (PBYTE)szCurrencyGrouping[pGlobalData->nCurrGrouping], - (wcslen(szCurrencyGrouping[pGlobalData->nCurrGrouping]) + 1) * sizeof(WCHAR)); + (PBYTE)GroupingFormats[pGlobalData->nCurrGrouping].pszString, + (wcslen(GroupingFormats[pGlobalData->nCurrGrouping].pszString) + 1) * sizeof(WCHAR));
_itow(pGlobalData->nCurrPosFormat, szBuffer, DECIMAL_RADIX);
Modified: trunk/reactos/dll/cpl/intl/intl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.h?rev=695... ============================================================================== --- trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] Sun Oct 11 18:36:22 2015 @@ -48,6 +48,8 @@
#define MAX_MISCCOUNTRY 80 #define MAX_MISCLANGUAGE 80 + +#define MAX_GROUPINGFORMATS 3
typedef struct _APPLET @@ -116,9 +118,16 @@
} GLOBALDATA, *PGLOBALDATA;
+typedef struct +{ + UINT nInteger; + PWSTR pszString; +} GROUPINGDATA; + extern HINSTANCE hApplet; extern DWORD IsUnattendedSetupEnabled; extern DWORD UnattendLCID; +extern GROUPINGDATA GroupingFormats[MAX_GROUPINGFORMATS];
/* intl.c */ VOID PrintErrorMsgBox(UINT msg);
Modified: trunk/reactos/dll/cpl/intl/numbers.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/numbers.c?rev=... ============================================================================== --- trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] Sun Oct 11 18:36:22 2015 @@ -420,12 +420,20 @@ PGLOBALDATA pGlobalData) { WCHAR OutBuffer[MAX_FMT_SIZE]; + NUMBERFMT NumberFormat; + + NumberFormat.NumDigits = pGlobalData->nNumDigits; + NumberFormat.LeadingZero = pGlobalData->nNumLeadingZero; + NumberFormat.Grouping = GroupingFormats[pGlobalData->nNumGrouping].nInteger; + NumberFormat.lpDecimalSep = pGlobalData->szNumDecimalSep; + NumberFormat.lpThousandSep = pGlobalData->szNumThousandSep; + NumberFormat.NegativeOrder = pGlobalData->nNumNegFormat;
/* Get positive number format sample */ GetNumberFormatW(pGlobalData->UserLCID, 0, SAMPLE_NUMBER, - NULL, + &NumberFormat, OutBuffer, MAX_FMT_SIZE);
@@ -438,7 +446,7 @@ GetNumberFormatW(pGlobalData->UserLCID, 0, SAMPLE_NEG_NUMBER, - NULL, + &NumberFormat, OutBuffer, MAX_FMT_SIZE);