BOOL CLangPage::OnInitDialog() { CPropertyPage::OnInitDialog(); LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs)); UString temp = NWindows::MyLoadString(IDS_LANG_ENGLISH); NativeLangString(temp, NWindows::MyLoadString(IDS_LANG_NATIVE)); int index = (int)m_cmbLang.AddString(GetSystemString(temp)); m_cmbLang.SetItemData(index, _paths.Size()); _paths.Add(L"-"); m_cmbLang.SetCurSel(0); const FString dirPrefix = GetLangDirPrefix(); NWindows::NFile::NFind::CEnumerator enumerator(dirPrefix + FTEXT("*.txt")); NWindows::NFile::NFind::CFileInfo fi; CLang lang; UString error; while (enumerator.Next(fi)) { if (fi.IsDir()) continue; const int kExtSize = 4; if (fi.Name.Len() < kExtSize) continue; unsigned pos = fi.Name.Len() - kExtSize; if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".txt")) continue; if (!LangOpen(lang, dirPrefix + fi.Name)) { error.Add_Space_if_NotEmpty(); error += fs2us(fi.Name); continue; } const UString shortName = fs2us(fi.Name.Left(pos)); UString s = shortName; const wchar_t *eng = lang.Get(IDS_LANG_ENGLISH); if (eng) s = eng; const wchar_t *native = lang.Get(IDS_LANG_NATIVE); if (native) NativeLangString(s, native); index = (int)m_cmbLang.AddString(GetSystemString(s)); m_cmbLang.SetItemData(index, _paths.Size()); _paths.Add(shortName); if (g_LangID.IsEqualTo_NoCase(shortName)) m_cmbLang.SetCurSel(index); } if (!error.IsEmpty()) ::MessageBoxW(m_hWnd, error, L"Error in Lang file", MB_ICONERROR); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
bool CLangPage::OnInit() { LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs)); _langCombo.Attach(GetItem(IDC_LANG_LANG)); UString temp = MyLoadString(IDS_LANG_ENGLISH); NativeLangString(temp, MyLoadString(IDS_LANG_NATIVE)); int index = (int)_langCombo.AddString(temp); _langCombo.SetItemData(index, _paths.Size()); _paths.Add(L"-"); _langCombo.SetCurSel(0); const FString dirPrefix = GetLangDirPrefix(); NFile::NFind::CEnumerator enumerator(dirPrefix + FTEXT("*.txt")); NFile::NFind::CFileInfo fi; CLang lang; UString error; while (enumerator.Next(fi)) { if (fi.IsDir()) continue; const int kExtSize = 4; if (fi.Name.Len() < kExtSize) continue; unsigned pos = fi.Name.Len() - kExtSize; if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".txt")) continue; if (!LangOpen(lang, dirPrefix + fi.Name)) { error.Add_Space_if_NotEmpty(); error += fs2us(fi.Name); continue; } const UString shortName = fs2us(fi.Name.Left(pos)); UString s = shortName; const wchar_t *eng = lang.Get(IDS_LANG_ENGLISH); if (eng) s = eng; const wchar_t *native = lang.Get(IDS_LANG_NATIVE); if (native) NativeLangString(s, native); index = (int)_langCombo.AddString(s); _langCombo.SetItemData(index, _paths.Size()); _paths.Add(shortName); if (g_LangID.IsEqualTo_NoCase(shortName)) _langCombo.SetCurSel(index); } if (!error.IsEmpty()) MessageBoxW(0, error, L"Error in Lang file", MB_ICONERROR); return CPropertyPage::OnInit(); }
void CThreadCrc::SetStatus(const UString &s2) { UString s = s2; if (!Enumerator.BasePrefix.IsEmpty()) { s.Add_Space_if_NotEmpty(); s += fs2us(Enumerator.BasePrefix); } ProgressDialog.Sync.Set_Status(s); }