1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// LangPage.cpp
#include "StdAfx.h"
#include "resource.h"
#include "LangPage.h"
#include "Common/StringConvert.h"
#include "Windows/ResourceString.h"
#include "../../RegistryUtils.h"
#include "../../HelpUtils.h"
#include "../../LangUtils.h"
static CIDLangPair kIDLangPairs[] =
{
{ IDC_LANG_STATIC_LANG, 0x01000401}
};
static LPCWSTR kLangTopic = L"fm/options.htm#language";
bool CLangPage::OnInit()
{
_langWasChanged = false;
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH);
s += L" (";
s += NWindows::MyLoadStringW(IDS_LANG_NATIVE);
s += L")";
int index = _langCombo.AddString(s);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(L"-");
_langCombo.SetCurSel(0);
CObjectVector<CLangEx> langs;
LoadLangs(langs);
for (int i = 0; i < langs.Size(); i++)
{
const CLangEx &lang = langs[i];
UString name;
UString englishName, nationalName;
if (lang.Lang.GetMessage(0x00000000, englishName))
name = englishName;
else
name = lang.ShortName;
if (lang.Lang.GetMessage(0x00000001, nationalName))
{
if (!nationalName.IsEmpty())
{
name += L" (";
name += nationalName;
name += L")";
}
}
index = _langCombo.AddString(name);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(lang.ShortName);
if (g_LangID.CompareNoCase(lang.ShortName) == 0)
_langCombo.SetCurSel(index);
}
return CPropertyPage::OnInit();
}
LONG CLangPage::OnApply()
{
int selectedIndex = _langCombo.GetCurSel();
int pathIndex = _langCombo.GetItemData(selectedIndex);
SaveRegLang(_paths[pathIndex]);
ReloadLang();
_langWasChanged = true;
return PSNRET_NOERROR;
}
void CLangPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kLangTopic); // change it
}
bool CLangPage::OnCommand(int code, int itemID, LPARAM param)
{
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
{
Changed();
return true;
}
return CPropertyPage::OnCommand(code, itemID, param);
}
|