#include "StdAfx.h"
#include "LanguageSelect.h"
#include <locale.h>
- #include <sstream>
- #include "OptionsDef.h"
- #include "OptionsMgr.h"
- #include "Merge.h"
#include "version.h"
- #include "resource.h"
#include "BCMenu.h"
- #include "MainFrm.h"
- #include "OpenFrm.h"
- #include "ChildFrm.h"
- #include "DirFrame.h"
- #include "HexMergeFrm.h"
- #include "ImgMergeFrm.h"
+#include "paths.h"
#include "Environment.h"
+#include "unicoder.h"
// Escaped character constants in range 0x80-0xFF are interpreted in current codepage
// Using C locale gets us direct mapping to Unicode codepoints
FreeLibrary(m_hCurrentDll);
m_hCurrentDll = 0;
m_strarray.clear();
+ m_map_lineno.clear();
m_codepage = 0;
- if (m_hWnd)
+ if (bShowError)
{
- std_tchar(ostringstream) stm;
- stm << _T("Unresolved or mismatched references detected when ")
- _T("attempting to read translations from\n") << strPath.c_str();
- AfxMessageBox(stm.str().c_str(), MB_ICONSTOP);
+ String str = _T("Unresolved or mismatched references detected when ")
+ _T("attempting to read translations from\n") + strPath;
+ AfxMessageBox(str.c_str(), MB_ICONSTOP);
}
return FALSE;
}
/**
* @brief Load languages available on disk, and display in list, and select current
*/
- void CLanguageSelect::LoadAndDisplayLanguages()
+ std::vector<std::pair<LANGID, String> > CLanguageSelect::GetAvailableLanguages() const
{
- String path = env_GetProgPath().append(szRelativePath);
- String pattern = path + _T("*.po");
+ std::vector<std::pair<LANGID, String> > list;
+ String path = paths_ConcatPath(env_GetProgPath(), szRelativePath);
+ String pattern = paths_ConcatPath(path, _T("*.po"));
WIN32_FIND_DATA ff;
HANDLE h = INVALID_HANDLE_VALUE;
do
LangFileInfo &lfi =
h == INVALID_HANDLE_VALUE
? LangFileInfo(wSourceLangId)
- : LangFileInfo((path + ff.cFileName).c_str());
+ : LangFileInfo(paths_ConcatPath(path, ff.cFileName).c_str());
- std_tchar(ostringstream) stm;
- stm << lfi.GetString(LOCALE_SLANGUAGE).c_str();
- stm << _T(" - ");
- stm << lfi.GetString(LOCALE_SNATIVELANGNAME|LOCALE_USE_CP_ACP).c_str();
- stm << _T(" (");
- stm << lfi.GetString(LOCALE_SNATIVECTRYNAME|LOCALE_USE_CP_ACP).c_str();
- stm << _T(")");
- /*stm << _T(" - ");
- stm << lfi.GetString(LOCALE_SABBREVLANGNAME|LOCALE_USE_CP_ACP).c_str();
- stm << _T(" (");
- stm << lfi.GetString(LOCALE_SABBREVCTRYNAME|LOCALE_USE_CP_ACP).c_str();
- stm << _T(") ");*/
- stm << _T(" - ");
- stm << lfi.GetString(LOCALE_SENGLANGUAGE).c_str();
- stm << _T(" (");
- stm << lfi.GetString(LOCALE_SENGCOUNTRY).c_str();
- stm << _T(")");
- int i = m_ctlLangList.AddString(stm.str().c_str());
- m_ctlLangList.SetItemData(i, lfi.id);
- if (lfi.id == m_wCurLanguage)
- m_ctlLangList.SetCurSel(i);
+ String str;
+ str += lfi.GetString(LOCALE_SLANGUAGE);
+ str += _T(" - ");
+ str += lfi.GetString(LOCALE_SNATIVELANGNAME | LOCALE_USE_CP_ACP);
+ str += _T(" (");
+ str += lfi.GetString(LOCALE_SNATIVECTRYNAME | LOCALE_USE_CP_ACP);
+ str += _T(")");
+ str += _T(" - ");
+ str += lfi.GetString(LOCALE_SENGLANGUAGE);
+ str += _T(" (");
+ str += lfi.GetString(LOCALE_SENGCOUNTRY);
+ str += _T(")");
+ list.emplace_back(lfi.id, str);
} while ((h = FindFile(h, pattern.c_str(), &ff)) != INVALID_HANDLE_VALUE);
+ return list;
}
/**
// Dialog Data
//{{AFX_DATA(PropGeneral)
enum { IDD = IDD_PROPPAGE_GENERAL };
- BOOL m_bScroll;
- BOOL m_bSingleInstance;
- BOOL m_bVerifyPaths;
- BOOL m_bCloseWindowWithEsc;
- BOOL m_bAskMultiWindowClose;
- BOOL m_bMultipleFileCmp;
- BOOL m_bMultipleDirCmp;
- int m_nAutoCompleteSource;
- BOOL m_bPreserveFiletime;
- BOOL m_bShowSelectFolderOnStartup;
- BOOL m_bCloseWithOK;
+ bool m_bScroll;
+ bool m_bSingleInstance;
+ bool m_bVerifyPaths;
+ bool m_bCloseWindowWithEsc;
+ bool m_bAskMultiWindowClose;
+ bool m_bMultipleFileCmp;
+ bool m_bMultipleDirCmp;
+ int m_nAutoCompleteSource;
+ bool m_bPreserveFiletime;
+ bool m_bShowSelectFolderOnStartup;
+ bool m_bCloseWithOK;
+ CComboBox m_ctlLangList;
//}}AFX_DATA