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
91
92
93
94
95
96
97
98
99
|
// EditPage.cpp
#include "StdAfx.h"
#include "EditPage.h"
#include "EditPageRes.h"
#include "BrowseDialog.h"
#include "HelpUtils.h"
#include "LangUtils.h"
#include "RegistryUtils.h"
using namespace NWindows;
static CIDLangPair kIDLangPairs[] =
{
{ IDC_EDIT_STATIC_EDITOR, 0x03010201},
{ IDC_EDIT_STATIC_DIFF, 0x03010202}
};
static LPCWSTR kEditTopic = L"FM/options.htm#editor";
bool CEditPage::OnInit()
{
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_editor.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
_diff.Attach(GetItem(IDC_EDIT_EDIT_DIFF));
{
UString path;
ReadRegEditor(path);
_editor.SetText(path);
}
{
UString path;
ReadRegDiff(path);
_diff.SetText(path);
}
return CPropertyPage::OnInit();
}
LONG CEditPage::OnApply()
{
{
UString path;
_editor.GetText(path);
SaveRegEditor(path);
}
{
UString path;
_diff.GetText(path);
SaveRegDiff(path);
}
return PSNRET_NOERROR;
}
void CEditPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kEditTopic);
}
static void Edit_BrowseForFile(NWindows::NControl::CEdit &edit, HWND hwnd)
{
UString path;
edit.GetText(path);
UString resPath;
if (MyBrowseForFile(hwnd, 0, path, L"*.exe", resPath))
{
edit.SetText(resPath);
// Changed();
}
}
bool CEditPage::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch (buttonID)
{
case IDC_EDIT_BUTTON_EDITOR:
Edit_BrowseForFile(_editor, *this);
return true;
case IDC_EDIT_BUTTON_DIFF:
Edit_BrowseForFile(_diff, *this);
return true;
}
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
}
bool CEditPage::OnCommand(int code, int itemID, LPARAM param)
{
if (code == EN_CHANGE &&
(itemID == IDC_EDIT_EDIT_EDITOR ||
itemID == IDC_EDIT_EDIT_DIFF))
{
Changed();
return true;
}
return CPropertyPage::OnCommand(code, itemID, param);
}
|