-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.c
More file actions
153 lines (118 loc) · 5.09 KB
/
settings.c
File metadata and controls
153 lines (118 loc) · 5.09 KB
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
#include "clix.h"
#include "settings.h"
#include "resources.h"
#include "key_button.h"
static PCLIX_SETTINGS pSettings;
static struct
{
HWND hWnd;
UINT uSettingHK;
HWND hSSHKButton;
HWND hTargetHKButton;
HWND hEditMaxClicks;
HWND hSendLMBDOWN;
HWND hSendLMBUP;
}SettingsCtx;
VOID
StartStopCallback(PVOID param)
{
}
VOID
SetTargetWndCallback(PVOID param)
{
}
typedef VOID (*SETTING_CB)(PVOID p);
static
SETTING_CB pFnArray[] = {StartStopCallback, SetTargetWndCallback};
INT_PTR
CALLBACK
SettingsDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
UCHAR Buffer[260];
switch (Msg)
{
case WM_INITDIALOG:
pSettings = (PCLIX_SETTINGS)lParam;
SettingsCtx.hWnd = hWnd;
SettingsCtx.hSSHKButton = GetDlgItem(hWnd, IDC_BUTTON_SET_HK_SS);
SettingsCtx.hTargetHKButton = GetDlgItem(hWnd, IDC_BUTTON_SET_HK_TARGET);
SettingsCtx.hEditMaxClicks = GetDlgItem(hWnd, IDC_EDIT_MAX_CLICKS);
SettingsCtx.hSendLMBDOWN = GetDlgItem(hWnd, IDC_CHECK_LMBDOWN);
SettingsCtx.hSendLMBUP = GetDlgItem(hWnd, IDC_CHECK_LMBUP);
SettingsCtx.uSettingHK = 0;
SetKeyButtonKey(SettingsCtx.hSSHKButton, pSettings->hotkeys[0].lParam, pSettings->hotkeys[0].wParam);
SetKeyButtonKey(SettingsCtx.hTargetHKButton, pSettings->hotkeys[1].lParam, pSettings->hotkeys[1].wParam);
sprintf(Buffer, "%d", pSettings->MaxClicksPS);
SetDlgItemText(SettingsCtx.hWnd, IDC_EDIT_MAX_CLICKS, Buffer);
if (pSettings->SendLMBDOWN)
PostMessage(SettingsCtx.hSendLMBDOWN, BM_SETCHECK, BST_CHECKED, 0);
if (pSettings->SendLMBUP)
PostMessage(SettingsCtx.hSendLMBUP, BM_SETCHECK, BST_CHECKED, 0);
return TRUE;
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON_UNSET_HK_SS:
SettingsCtx.uSettingHK = 0;
SetKeyButtonKey(SettingsCtx.hSSHKButton, 0, 0);
return TRUE;
break;
case IDC_BUTTON_UNSET_HK_TARGET:
SettingsCtx.uSettingHK = 0;
SetKeyButtonKey(SettingsCtx.hTargetHKButton, 0, 0);
return TRUE;
break;
case IDC_BUTTON_SET_HK_SS:
SettingsCtx.uSettingHK = 1;
return TRUE;
break;
case IDC_BUTTON_SET_HK_TARGET:
SettingsCtx.uSettingHK = 2;
return TRUE;
break;
case IDOK:
if (SendDlgItemMessage(SettingsCtx.hWnd, IDC_CHECK_LMBDOWN, BM_GETCHECK, 0, 0) == BST_CHECKED)
pSettings->SendLMBDOWN = TRUE;
else
pSettings->SendLMBDOWN = FALSE;
if (SendDlgItemMessage(SettingsCtx.hWnd, IDC_CHECK_LMBUP, BM_GETCHECK, 0, 0) == BST_CHECKED)
pSettings->SendLMBUP = TRUE;
else
pSettings->SendLMBUP = FALSE;
GetWindowText(SettingsCtx.hEditMaxClicks, Buffer, 20);
pSettings->MaxClicksPS = atoi(Buffer);
//hotkeys
pSettings->hotkeys[0].lParam = GetKeyButtonKey(SettingsCtx.hSSHKButton, KEY_LPARAM);
pSettings->hotkeys[0].wParam = GetKeyButtonKey(SettingsCtx.hSSHKButton, KEY_WPARAM);
pSettings->hotkeys[1].lParam = GetKeyButtonKey(SettingsCtx.hTargetHKButton, KEY_LPARAM);
pSettings->hotkeys[1].wParam = GetKeyButtonKey(SettingsCtx.hTargetHKButton, KEY_WPARAM);
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
break;
}
return FALSE;
break;
case WM_KEYUP:
if (wParam == VK_ESCAPE)// && SettingsCtx.uSettingHK)
{
// set state
// unset key
// unset settinghk
return FALSE;
}
/*if (SettingsCtx.uSettingHK)
{
pSettings->hotkeys[SettingsCtx.uSettingHK].Id = SettingsCtx.uSettingHK;
pSettings->hotkeys[SettingsCtx.uSettingHK].KeyCode = wParam;
pSettings->hotkeys[SettingsCtx.uSettingHK].Modifier = lParam;
pSettings->hotkeys[SettingsCtx.uSettingHK].callback = pFnArray[SettingsCtx.uSettingHK];
SettingsCtx.uSettingHK = 0;
return TRUE;
}*/
break;
return FALSE;
}
return FALSE;
}