* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 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.
*/
/* $Id$
*
* PROGRAMMER: Eric Kohl
*/
-#include <windows.h>
-#include <commctrl.h>
-#include <cpl.h>
-#include <tchar.h>
-
#include "intl.h"
-#include "resource.h"
#define SAMPLE_NUMBER _T("123456789")
#define SAMPLE_NEG_NUMBER _T("-123456789")
{_T(",7"), _T("0,7")};
static LPTSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] =
{_T(";")};
-static LPTSTR lpUnitsSysSamples[MAX_UNITS_SYS_SAMPLES] =
- {_T("Metrics"), _T("Americans")};
/* Init num decimal separator control box */
INT nCBIndex;
INT nRetCode;
+ /* Limit text length */
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+ CB_LIMITTEXT,
+ MAX_NUMBERDSYMBOL,
+ 0);
+
/* Get current decimal separator */
GetLocaleInfo(lcid,
LOCALE_SDECIMAL,
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)lpNumSepSamples[nCBIndex]);
}
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)szFracCount);
}
INT nCBIndex;
INT nRetCode;
+ /* Limit text length */
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+ CB_LIMITTEXT,
+ MAX_NUMBERSDIGITGRSYM,
+ 0);
+
/* Get current field separator */
GetLocaleInfo(lcid,
LOCALE_STHOUSAND,
(WPARAM)0,
(LPARAM)0);
- /* Create standart list of field separators */
+ /* Create standard list of field separators */
for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)lpFieldSepSamples[nCBIndex]);
}
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
CB_ADDSTRING,
- MAX_FIELD_SEP_SAMPLES+1,
+ 0,
(LPARAM)szFieldSep);
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
CB_SELECTSTRING,
}
}
-/* Init number of digidts in field control box */
+/* Init number of digits in field control box */
static VOID
InitFieldDigNumCB(HWND hwndDlg, LCID lcid)
{
(WPARAM)0,
(LPARAM)0);
- /* Create standart list of field digits num */
+ /* Create standard list of field digits num */
for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
{
pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)pszFieldDigNumSmpl);
free(pszFieldDigNumSmpl);
}
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
CB_ADDSTRING,
- MAX_FIELD_DIG_SAMPLES+1,
+ 0,
(LPARAM)pszFieldDigNumSmpl);
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
CB_SELECTSTRING,
INT nCBIndex;
INT nRetCode;
+ /* Limit text length */
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+ CB_LIMITTEXT,
+ MAX_NUMBERSNSIGNSYM,
+ 0);
+
/* Get current negative sign */
- GetLocaleInfoW(lcid,
- LOCALE_SNEGATIVESIGN,
- szNegSign,
- MAX_SAMPLES_STR_SIZE);
+ GetLocaleInfo(lcid,
+ LOCALE_SNEGATIVESIGN,
+ szNegSign,
+ MAX_SAMPLES_STR_SIZE);
/* Clear all box content */
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
(WPARAM)0,
(LPARAM)0);
- /* Create standart list of signs */
+ /* Create standard list of signs */
for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)lpNegSignSamples[nCBIndex]);
}
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
CB_ADDSTRING,
- MAX_NUM_SEP_SAMPLES+1,
+ 0,
(LPARAM)szNegSign);
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
CB_SELECTSTRING,
szNegSign,
MAX_SAMPLES_STR_SIZE);
- /* Create standart list of negative numbers formats */
+ /* Create standard list of negative numbers formats */
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
{
- /* Replace standart separator to setted */
+ /* Replace standard separator to setted */
pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
szNumSep,
_T(","));
_tcscpy(szNewSample, pszResultStr);
free(pszResultStr);
- /* Replace standart negative sign to setted */
+ /* Replace standard negative sign to setted */
pszResultStr = ReplaceSubStr(szNewSample,
szNegSign,
_T("-"));
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)pszResultStr);
free(pszResultStr);
}
szNumSep,
MAX_SAMPLES_STR_SIZE);
- /* Create list of standart leading zeroes formats */
+ /* Create list of standard leading zeroes formats */
for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
{
pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
_T(","));
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)pszResultStr);
free(pszResultStr);
}
INT nCBIndex;
INT nRetCode;
+ /* Limit text length */
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+ CB_LIMITTEXT,
+ MAX_NUMBERSLSEP,
+ 0);
+
/* Get current list separator */
GetLocaleInfo(lcid,
LOCALE_SLIST,
(WPARAM)0,
(LPARAM)0);
- /* Create standart list of signs */
+ /* Create standard list of signs */
for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
CB_ADDSTRING,
- nCBIndex,
+ 0,
(LPARAM)lpListSepSamples[nCBIndex]);
}
{
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
CB_ADDSTRING,
- MAX_LIST_SEP_SAMPLES+1,
+ 0,
(LPARAM)szListSep);
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
CB_SELECTSTRING,
LCID lcid)
{
TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
+ TCHAR szUnitName[128];
INT nCBIndex;
/* Get current system of units */
(WPARAM)0,
(LPARAM)0);
- /* Create list of standart system of units */
+ /* Create list of standard system of units */
for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
{
+ LoadString(hApplet, IDS_METRIC + nCBIndex, szUnitName, 128);
+
SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
CB_ADDSTRING,
- 0, //nCBIndex,
- (LPARAM)lpUnitsSysSamples[nCBIndex]);
+ 0,
+ (LPARAM)szUnitName);
}
/* Set current item to value from registry */
TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
/* Get setted field separator */
- SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
WM_GETTEXT,
(WPARAM)MAX_SAMPLES_STR_SIZE,
(LPARAM)szFieldSep);
return TRUE;
}
-/* Set number of digidts in field */
+/* Set number of digits in field */
static BOOL
SetFieldDigNum(HWND hwndDlg,
LCID lcid)
{
- INT nCurrSel;
+ TCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
/* Get setted number of digidts in field */
- nCurrSel=SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
- CB_GETCURSEL,
- (WPARAM)0,
- (LPARAM)0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+ WM_GETTEXT,
+ (WPARAM)MAX_SAMPLES_STR_SIZE,
+ (LPARAM)szFieldDigNum);
- /* Save number of digidts in field */
- SetLocaleInfo(lcid, LOCALE_SGROUPING, lpFieldDigNumSamples[nCurrSel]);
+ /* Save number of digits in field */
+ SetLocaleInfo(lcid, LOCALE_SGROUPING, szFieldDigNum);
return TRUE;
}