-
Notifications
You must be signed in to change notification settings - Fork 5
/
OptKeySetEditDlg.cpp
147 lines (123 loc) · 4.3 KB
/
OptKeySetEditDlg.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
// OptKeySetEditDlg.cpp : インプリメンテーション ファイル
//
#include "stdafx.h"
#include "charu3.h"
#include "OptKeySetEditDlg.h"
#include "General.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptKeySetEditDlg ダイアログ
COptKeySetEditDlg::COptKeySetEditDlg(CWnd* pParent /*=NULL*/)
: CDialog(COptKeySetEditDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COptKeySetEditDlg)
m_pasteMessage = _T("");
m_copyMessage = _T("");
m_keyAction = -1;
m_matchCombo = -1;
m_caption = _T("");
m_copyWait = 0;
m_pasteWait = 0;
//}}AFX_DATA_INIT
}
void COptKeySetEditDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptKeySetEditDlg)
//}}AFX_DATA_MAP
if(GetDlgItem(IDC_OPT_PASTKEY2))
DDX_Control(pDX, IDC_OPT_PASTKEY2, m_pasteKey);
if(GetDlgItem(IDC_OPT_COPYKEY2))
DDX_Control(pDX, IDC_OPT_COPYKEY2, m_copyKey);
if(GetDlgItem(IDC_OPT_PASTE_MESS))
DDX_Text(pDX, IDC_OPT_PASTE_MESS, m_pasteMessage);
if(GetDlgItem(IDC_OPT_COPY_MESS))
DDX_Text(pDX, IDC_OPT_COPY_MESS, m_copyMessage);
if(GetDlgItem(IDC_OPT_KEY_ACTION2_01))
DDX_Radio(pDX, IDC_OPT_KEY_ACTION2_01, m_keyAction);
if(GetDlgItem(IDC_OPT_MATCH_COMBO))
DDX_CBIndex(pDX, IDC_OPT_MATCH_COMBO, m_matchCombo);
if(GetDlgItem(IDC_OPT_WINCAP_COMBO))
DDX_CBString(pDX, IDC_OPT_WINCAP_COMBO, m_caption);
if(GetDlgItem(IDC_OPT_COPY_WAIT2)) {
DDX_Text(pDX, IDC_OPT_COPY_WAIT2, m_copyWait);
DDV_MinMaxUInt(pDX, m_copyWait, 0, 1000);
}
if(GetDlgItem(IDC_OPT_PASTE_WAIT2)) {
DDX_Text(pDX, IDC_OPT_PASTE_WAIT2, m_pasteWait);
DDV_MinMaxUInt(pDX, m_pasteWait, 0, 1000);
}
if(GetDlgItem(IDC_OPT_HISTORY_SIZE_LIMIT)) {
DDX_Text(pDX, IDC_OPT_HISTORY_SIZE_LIMIT, m_nHistoryLimit);
}
if(!pDX->m_bSaveAndValidate) {
UINT uMod = m_key.m_sCopyPasteKey.m_uMod_Paste;
if(m_key.m_sCopyPasteKey.m_uVK_Paste >= 0x60)
m_pasteKey.SetHotKey(m_key.m_sCopyPasteKey.m_uVK_Paste,CGeneral::mod2Hotkey(uMod));
else
m_pasteKey.SetHotKey(m_key.m_sCopyPasteKey.m_uVK_Paste,CGeneral::mod2Hotkey(uMod) | HOTKEYF_EXT);
uMod = m_key.m_sCopyPasteKey.m_uMod_Copy;
if(m_key.m_sCopyPasteKey.m_uVK_Copy >= 0x60)
m_copyKey.SetHotKey(m_key.m_sCopyPasteKey.m_uVK_Copy,CGeneral::mod2Hotkey(uMod));
else
m_copyKey.SetHotKey(m_key.m_sCopyPasteKey.m_uVK_Copy,CGeneral::mod2Hotkey(uMod) | HOTKEYF_EXT);
}
else {
CHANGE_KEY key;
WORD wMod,wVkCode;
key.m_nHistoryLimit = m_nHistoryLimit;
//ペーストキー変換
m_pasteKey.GetHotKey(wVkCode,wMod);
key.m_sCopyPasteKey.m_uMod_Paste = CGeneral::hotkey2MOD(wMod);
key.m_sCopyPasteKey.m_uVK_Paste = wVkCode;
//コピーキー変換
m_copyKey.GetHotKey(wVkCode,wMod);
key.m_sCopyPasteKey.m_uMod_Copy = CGeneral::hotkey2MOD(wMod);
key.m_sCopyPasteKey.m_uVK_Copy = wVkCode;
_stscanf(m_pasteMessage,_T("%x,%x,%x"),&key.m_sCopyPasteKey.m_pasteMessage.Msg,
&key.m_sCopyPasteKey.m_pasteMessage.wParam,
&key.m_sCopyPasteKey.m_pasteMessage.lParam);
_stscanf(m_copyMessage,_T("%x,%x,%x"),&key.m_sCopyPasteKey.m_copyMessage.Msg,
&key.m_sCopyPasteKey.m_copyMessage.wParam,
&key.m_sCopyPasteKey.m_copyMessage.lParam);
key.m_sCopyPasteKey.m_nMessage = m_keyAction;
key.m_nMatch = m_matchCombo;
key.m_strTitle = m_caption;
key.m_sCopyPasteKey.m_nCopyWait = m_copyWait;
key.m_sCopyPasteKey.m_nPasteWait = m_pasteWait;
m_key = key;
}
}
//---------------------------------------------------
//関数名 EnumWindowTitle [friend]
//機能 ウィンドウタイトルを列挙
//---------------------------------------------------
BOOL CALLBACK EnumWindowTitle(HWND hwnd, LPARAM lParam)
{
CComboBox* combo = (CComboBox*)lParam;
TCHAR WindowName[1024];
*WindowName = (char)NULL;
if(IsWindowVisible(hwnd)) {
int resalt = GetWindowText(hwnd,WindowName,sizeof(WindowName));
if(resalt && _tcsclen(WindowName) > 0) {
if(combo) combo->AddString(WindowName);
}
}
return TRUE; /* 列挙を続ける */
}
BEGIN_MESSAGE_MAP(COptKeySetEditDlg, CDialog)
//{{AFX_MSG_MAP(COptKeySetEditDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptKeySetEditDlg メッセージ ハンドラ
BOOL COptKeySetEditDlg::OnInitDialog()
{
CDialog::OnInitDialog();
EnumWindows(&EnumWindowTitle,(LPARAM)GetDlgItem(IDC_OPT_WINCAP_COMBO));
return TRUE;
}