forked from keizi666/charu3
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
OptAdvanced.cpp
156 lines (137 loc) · 4.77 KB
/
OptAdvanced.cpp
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*----------------------------------------------------------
Setting Dialog - Advanced
----------------------------------------------------------*/
#include "stdafx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "OptAdvanced.h"
#include "Charu3.h" // for theApp.m_ini
#include "resource.h"
//---------------------------------------------------
//関数名 DoDataExchange(CDataExchange* pDX)
//機能 データエクスチェンジ
//---------------------------------------------------
void COptAdvanced::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptEtc)
if (GetDlgItem(IDC_OPT_CLIPBOARD_OPEN_DELAY)) {
DDX_Text(pDX, IDC_OPT_CLIPBOARD_OPEN_DELAY, theApp.m_ini.m_nClipboardOpenDelay);
// Not worked correctly
//DDV_MinMaxInt(pDX, theApp.m_ini.m_nClipboardOpenDelay, 0, 4000);
}
if (GetDlgItem(IDC_OPT_CLIPBOARD_RETRY_INTERVAL)) {
DDX_Text(pDX, IDC_OPT_CLIPBOARD_RETRY_INTERVAL, theApp.m_ini.m_nClipboardRetryInterval);
// Not worked correctly
//DDV_MinMaxInt(pDX, theApp.m_ini.m_nClipboardRetryInterval, 1, 1000);
}
if (GetDlgItem(IDC_OPT_CLIPBOARD_RETRY_TIMES)) {
DDX_Text(pDX, IDC_OPT_CLIPBOARD_RETRY_TIMES, theApp.m_ini.m_nClipboardRetryTimes);
// Not worked correctly
//DDV_MinMaxInt(pDX, theApp.m_ini.m_nClipboardRetryTimes, 0, 100);
}
if (GetDlgItem(IDC_OPT_WINDOW_CHECK_INTERVAL)) {
DDX_Text(pDX, IDC_OPT_WINDOW_CHECK_INTERVAL, theApp.m_ini.m_nWindowCheckInterval);
// Not worked correctly
//DDV_MinMaxInt(pDX, theApp.m_ini.m_nWindowCheckInterval, 1, 2000);
}
if (GetDlgItem(IDC_LIST_STEALTH)) {
DDX_Control(pDX, IDC_LIST_STEALTH, m_stealthList);
}
if (GetDlgItem(IDC_STEALTH_INPUT)) {
DDX_Control(pDX, IDC_STEALTH_INPUT, m_ctrlStealthInput);
}
if (GetDlgItem(IDC_STEALTH_ADD)) {
DDX_Control(pDX, IDC_STEALTH_ADD, m_ctrlStealthAdd);
}
if (GetDlgItem(IDC_STEALTH_DELETE)) {
DDX_Control(pDX, IDC_STEALTH_DELETE, m_ctrlStealthDelete);
}
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptAdvanced, CDialog)
//{{AFX_MSG_MAP(COptAdvanced)
//}}AFX_MSG_MAP
ON_WM_DROPFILES()
ON_LBN_SELCHANGE(IDC_LIST_STEALTH, &COptAdvanced::OnLbnSelchangeListStealth)
ON_EN_CHANGE(IDC_STEALTH_INPUT, &COptAdvanced::OnEnChangeStealthInput)
ON_BN_CLICKED(IDC_STEALTH_ADD, &COptAdvanced::OnBnClickedStealthAdd)
ON_BN_CLICKED(IDC_STEALTH_SELECT, &COptAdvanced::OnBnClickedStealthSelect)
ON_BN_CLICKED(IDC_STEALTH_DELETE, &COptAdvanced::OnBnClickedStealthDelete)
END_MESSAGE_MAP()
BOOL COptAdvanced::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB && ::GetKeyState(VK_CONTROL) < 0) {
::PostMessage(::GetParent(this->m_hWnd), pMsg->message, VK_PRIOR, pMsg->lParam);
}
return CDialog::PreTranslateMessage(pMsg);
}
BOOL COptAdvanced::OnInitDialog()
{
CDialog::OnInitDialog();
m_stealthList.SetHorizontalExtent(2000);
m_stealthList.ResetContent();
for (const CString& s : theApp.m_ini.m_stealth) {
m_stealthList.AddString(s);
}
return TRUE;
}
BOOL COptAdvanced::DestroyWindow()
{
theApp.m_ini.m_stealth.clear();
int stealthCount = m_stealthList.GetCount();
for (int i = 0; i < stealthCount; i++) {
CString s;
m_stealthList.GetText(i, s);
theApp.m_ini.m_stealth.push_back(s);
}
return CDialog::DestroyWindow();
}
void COptAdvanced::OnLbnSelchangeListStealth()
{
const int index = m_stealthList.GetCurSel();
m_ctrlStealthDelete.EnableWindow(LB_ERR != index);
}
void COptAdvanced::OnEnChangeStealthInput()
{
CString input;
m_ctrlStealthInput.GetWindowText(input);
input.Trim();
m_ctrlStealthAdd.EnableWindow(input.GetLength() > 0);
}
void COptAdvanced::OnBnClickedStealthAdd()
{
CString input;
m_ctrlStealthInput.GetWindowText(input);
AddStealthProgram(input);
m_ctrlStealthInput.SetWindowText(_T(""));
}
void COptAdvanced::OnBnClickedStealthSelect()
{
CFileDialog* pFileDialog;
CString strRes;
(void)strRes.LoadString(APP_INF_FILE_FILTER6);
pFileDialog = new CFileDialog(TRUE, _T("*.*"), NULL, NULL, strRes);
if (pFileDialog && IDOK == pFileDialog->DoModal()) {
AddStealthProgram(pFileDialog->GetPathName());
delete pFileDialog;
}
}
void COptAdvanced::OnBnClickedStealthDelete()
{
const int index = m_stealthList.GetCurSel();
if (LB_ERR != index) {
m_stealthList.DeleteString(index);
m_ctrlStealthDelete.EnableWindow(FALSE);
}
}
void COptAdvanced::AddStealthProgram(CString name)
{
name.Trim();
if (name.GetLength() > 0 && m_stealthList.FindStringExact(0, name) == LB_ERR) {
m_stealthList.AddString(name);
}
}