diff --git a/src/celestia/win32/winbookmarks.cpp b/src/celestia/win32/winbookmarks.cpp index 588aee680..9e51715e2 100644 --- a/src/celestia/win32/winbookmarks.cpp +++ b/src/celestia/win32/winbookmarks.cpp @@ -364,7 +364,7 @@ void BuildFavoritesMenu(HMENU menuBar, void AddNewBookmarkFolderInTree(HWND hTree, CelestiaCore* appCore, char* folderName) { // Add new item to bookmark item after other folders but before root items - HTREEITEM hParent, hItem, hInsertAfter; + HTREEITEM hParent, hItem, hInsertAfter = nullptr; TVINSERTSTRUCT tvis; TVITEM tvItem; diff --git a/src/celestia/win32/windatepicker.cpp b/src/celestia/win32/windatepicker.cpp index a3f9a0090..f3f35ae48 100644 --- a/src/celestia/win32/windatepicker.cpp +++ b/src/celestia/win32/windatepicker.cpp @@ -154,22 +154,15 @@ DatePicker::redraw(HDC hdc) SetBkMode(hdc, TRANSPARENT); char dayBuf[32]; - char monthBuf[32]; char yearBuf[32]; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif + string monthStr = UTF8ToCurrentCP(_(Months[date.month - 1])); sprintf(dayBuf, "%02d", date.day); - sprintf(monthBuf, "%s", _(Months[date.month - 1])); sprintf(yearBuf, "%5d", date.year); -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif char* fieldText[NumFields]; fieldText[DayField] = dayBuf; - fieldText[MonthField] = monthBuf; + fieldText[MonthField] = const_cast(monthStr.c_str()); fieldText[YearField] = yearBuf; int right = 2; diff --git a/src/celestia/win32/wineclipses.cpp b/src/celestia/win32/wineclipses.cpp index 9c689b0de..1fcb954d6 100644 --- a/src/celestia/win32/wineclipses.cpp +++ b/src/celestia/win32/wineclipses.cpp @@ -54,22 +54,22 @@ bool InitEclipseFinderColumns(HWND listView) for (i = 0; i < nColumns; i++) columns[i] = lvc; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif - columns[0].pszText = _("Planet"); + string header0 = UTF8ToCurrentCP(_("Planet")); + string header1 = UTF8ToCurrentCP(_("Satellite")); + string header2 = UTF8ToCurrentCP(_("Date")); + string header3 = UTF8ToCurrentCP(_("Start")); + string header4 = UTF8ToCurrentCP(_("Duration")); + + columns[0].pszText = const_cast(header0.c_str()); columns[0].cx = 65; - columns[1].pszText = _("Satellite"); + columns[1].pszText = const_cast(header1.c_str()); columns[1].cx = 65; - columns[2].pszText = _("Date"); + columns[2].pszText = const_cast(header2.c_str()); columns[2].cx = 80; - columns[3].pszText = _("Start"); + columns[3].pszText = const_cast(header3.c_str()); columns[3].cx = 55; - columns[4].pszText = _("Duration"); + columns[4].pszText = const_cast(header4.c_str()); columns[4].cx = 135; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif for (i = 0; i < nColumns; i++) { @@ -128,18 +128,13 @@ void EclipseFinderDisplayItem(LPNMLVDISPINFOA nm) case 2: { -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif astro::Date startDate(eclipse->startTime); + string monthStr = UTF8ToCurrentCP(_(MonthNames[startDate.month - 1])); sprintf(callbackScratch, "%2d %s %4d", startDate.day, - _(MonthNames[startDate.month - 1]), + monthStr.c_str(), startDate.year); nm->item.pszText = callbackScratch; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif } break; @@ -288,23 +283,24 @@ BOOL APIENTRY EclipseFinderProc(HWND hDlg, InitEclipseFinderColumns(hwnd); SendDlgItemMessage(hDlg, IDC_ECLIPSES_LIST, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif CheckRadioButton(hDlg, IDC_SOLARECLIPSE, IDC_LUNARECLIPSE, IDC_SOLARECLIPSE); efd->type = Eclipse::Solar; - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Earth")); - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Jupiter")); - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Saturn")); - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Uranus")); - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Neptune")); - SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, (LPARAM)_("Pluto")); + string item0 = UTF8ToCurrentCP(_("Earth")); + string item1 = UTF8ToCurrentCP(_("Jupiter")); + string item2 = UTF8ToCurrentCP(_("Saturn")); + string item3 = UTF8ToCurrentCP(_("Uranus")); + string item4 = UTF8ToCurrentCP(_("Neptune")); + string item5 = UTF8ToCurrentCP(_("Pluto")); + + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item0.c_str())); + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item1.c_str())); + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item2.c_str())); + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item3.c_str())); + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item4.c_str())); + SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_ADDSTRING, 0, reinterpret_cast(item5.c_str())); SendDlgItemMessage(hDlg, IDC_ECLIPSETARGET, CB_SETCURSEL, 0, 0); efd->strPlaneteToFindOn = "Earth"; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif InitDateControls(hDlg, astro::Date(efd->appCore->getSimulation()->getTime()), efd->fromTime, efd->toTime); diff --git a/src/celestia/win32/winmain.cpp b/src/celestia/win32/winmain.cpp index 4f8d8f6f4..422206131 100644 --- a/src/celestia/win32/winmain.cpp +++ b/src/celestia/win32/winmain.cpp @@ -1308,14 +1308,9 @@ BOOL APIENTRY SelectDisplayModeProc(HWND hDlg, HWND hwnd = GetDlgItem(hDlg, IDC_COMBO_RESOLUTION); // Add windowed mode as the first item on the menu -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif + string str = UTF8ToCurrentCP(_("Windowed Mode")); SendMessage(hwnd, CB_INSERTSTRING, -1, - reinterpret_cast(_("Windowed Mode"))); -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif + reinterpret_cast(str.c_str())); for (vector::const_iterator iter= displayModes->begin(); iter != displayModes->end(); iter++) diff --git a/src/celestia/win32/winstarbrowser.cpp b/src/celestia/win32/winstarbrowser.cpp index d7e1d88fc..ddc846748 100644 --- a/src/celestia/win32/winstarbrowser.cpp +++ b/src/celestia/win32/winstarbrowser.cpp @@ -57,26 +57,24 @@ bool InitStarBrowserColumns(HWND listView) for (i = 0; i < nColumns; i++) columns[i] = lvc; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif + string header0 = UTF8ToCurrentCP(_("Name")); + string header1 = UTF8ToCurrentCP(_("Distance (ly)")); + string header2 = UTF8ToCurrentCP(_("App. mag")); + string header3 = UTF8ToCurrentCP(_("Abs. mag")); + string header4 = UTF8ToCurrentCP(_("Type")); - columns[0].pszText = _("Name"); + columns[0].pszText = const_cast(header0.c_str()); columns[0].cx = 100; - columns[1].pszText = _("Distance (ly)"); + columns[1].pszText = const_cast(header1.c_str()); columns[1].fmt = LVCFMT_RIGHT; columns[1].cx = 115; - columns[2].pszText = _("App. mag"); + columns[2].pszText = const_cast(header2.c_str()); columns[2].fmt = LVCFMT_RIGHT; columns[2].cx = 65; - columns[3].pszText = _("Abs. mag"); + columns[3].pszText = const_cast(header3.c_str()); columns[3].fmt = LVCFMT_RIGHT; columns[3].cx = 65; - columns[4].pszText = _("Type"); - -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif + columns[4].pszText = const_cast(header4.c_str()); for (i = 0; i < nColumns; i++) { diff --git a/src/celestia/win32/wintime.cpp b/src/celestia/win32/wintime.cpp index 05ff22d8f..315ff3d85 100644 --- a/src/celestia/win32/wintime.cpp +++ b/src/celestia/win32/wintime.cpp @@ -91,16 +91,15 @@ SetTimeDialog::init(HWND _hDlg) useLocalTime = appCore->getTimeZoneBias() != 0; useUTCOffset = appCore->getDateFormat() == 2; -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", CurrentCP()); -#endif - SendDlgItemMessage(hDlg, IDC_COMBOBOX_TIMEZONE, CB_ADDSTRING, 0, (LPARAM) _("Universal Time")); - SendDlgItemMessage(hDlg, IDC_COMBOBOX_TIMEZONE, CB_ADDSTRING, 0, (LPARAM) _("Local Time")); - SendDlgItemMessage(hDlg, IDC_COMBOBOX_DATE_FORMAT, CB_ADDSTRING, 0, (LPARAM) _("Time Zone Name")); - SendDlgItemMessage(hDlg, IDC_COMBOBOX_DATE_FORMAT, CB_ADDSTRING, 0, (LPARAM) _("UTC Offset")); -#ifdef ENABLE_NLS - bind_textdomain_codeset("celestia", "UTF8"); -#endif + string item0 = UTF8ToCurrentCP(_("Universal Time")); + string item1 = UTF8ToCurrentCP(_("Local Time")); + string item2 = UTF8ToCurrentCP(_("Time Zone Name")); + string item3 = UTF8ToCurrentCP(_("UTC Offset")); + + SendDlgItemMessage(hDlg, IDC_COMBOBOX_TIMEZONE, CB_ADDSTRING, 0, reinterpret_cast(item0.c_str())); + SendDlgItemMessage(hDlg, IDC_COMBOBOX_TIMEZONE, CB_ADDSTRING, 0, reinterpret_cast(item1.c_str())); + SendDlgItemMessage(hDlg, IDC_COMBOBOX_DATE_FORMAT, CB_ADDSTRING, 0, reinterpret_cast(item2.c_str())); + SendDlgItemMessage(hDlg, IDC_COMBOBOX_DATE_FORMAT, CB_ADDSTRING, 0, reinterpret_cast(item3.c_str())); SendDlgItemMessage(hDlg, IDC_COMBOBOX_TIMEZONE, CB_SETCURSEL, useLocalTime ? 1 : 0, 0); SendDlgItemMessage(hDlg, IDC_COMBOBOX_DATE_FORMAT, CB_SETCURSEL, useUTCOffset ? 1 : 0, 0);