ReactOS 0.4.15-dev-5669-g09dde2c
mouse.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Accessibility Control Panel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/access/mouse.c
5 * PURPOSE: Mouse-related accessibility settings
6 * COPYRIGHT: Copyright 2004 Johannes Anderwald (johannes.anderwald@reactos.org)
7 * Copyright 2007 Eric Kohl
8 */
9
10#include "access.h"
11
12#define SPEEDTICKS 9
13#define ACCELTICKS 9
14
15static UINT nSpeedArray[SPEEDTICKS] = {10, 20, 30, 40, 60, 80, 120, 180, 360};
16
17
20 UINT uMsg,
23{
24 PGLOBAL_DATA pGlobalData;
25 INT i;
26
27 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
28
29 switch (uMsg)
30 {
31 case WM_INITDIALOG:
32 pGlobalData = (PGLOBAL_DATA)lParam;
33 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
34
35 CheckDlgButton(hwndDlg,
37 pGlobalData->mouseKeys.dwFlags & MKF_HOTKEYACTIVE ? BST_CHECKED : BST_UNCHECKED);
38
39 /* Set the number of ticks for the speed trackbar */
41 TRUE, MAKELONG(0, SPEEDTICKS - 1));
42
43 /* Calculate the matching tick */
44 for (i = 0; i < SPEEDTICKS; i++)
45 {
46 if (pGlobalData->mouseKeys.iMaxSpeed <= nSpeedArray[i])
47 break;
48 }
49
50 /* Set the thumb */
52
53 /* Set the number of ticks for the acceleration trackbar */
55 TRUE, MAKELONG(0, ACCELTICKS - 1));
56
57 /* Calculate the matching tick */
58 i = (ACCELTICKS + 1) - pGlobalData->mouseKeys.iTimeToMaxSpeed / 500;
59 if (i > ACCELTICKS - 1)
60 i = ACCELTICKS - 1;
61
62 if (i < 0)
63 i = 0;
64
65 /* Set the thumb */
67
68 CheckDlgButton(hwndDlg,
70 pGlobalData->mouseKeys.dwFlags & MKF_MODIFIERS ? BST_CHECKED : BST_UNCHECKED);
71
72 CheckRadioButton(hwndDlg,
75 pGlobalData->mouseKeys.dwFlags & MKF_REPLACENUMBERS ? IDC_MOUSEKEYS_ON_RADIO : IDC_MOUSEKEYS_OFF_RADIO);
76
77 CheckDlgButton(hwndDlg,
79 pGlobalData->mouseKeys.dwFlags & MKF_INDICATOR ? BST_CHECKED : BST_UNCHECKED);
80 break;
81
82 case WM_HSCROLL:
84 {
87 if (i >= 0 && i < SPEEDTICKS)
88 pGlobalData->mouseKeys.iMaxSpeed = nSpeedArray[i];
89 break;
90
93 if (i >= 0 && i < ACCELTICKS)
94 pGlobalData->mouseKeys.iTimeToMaxSpeed = (ACCELTICKS + 1 - i) * 500;
95 break;
96 }
97 break;
98
99 case WM_COMMAND:
100 switch (LOWORD(wParam))
101 {
103 pGlobalData->mouseKeys.dwFlags ^= MKF_HOTKEYACTIVE;
104 break;
105
107 pGlobalData->mouseKeys.dwFlags ^= MKF_MODIFIERS;
108 break;
109
111 pGlobalData->mouseKeys.dwFlags |= MKF_REPLACENUMBERS;
112 break;
113
115 pGlobalData->mouseKeys.dwFlags &= ~MKF_REPLACENUMBERS;
116 break;
117
119 pGlobalData->mouseKeys.dwFlags ^= MKF_INDICATOR;
120 break;
121
122 case IDOK:
123 EndDialog(hwndDlg, TRUE);
124 break;
125
126 case IDCANCEL:
127 EndDialog(hwndDlg, FALSE);
128 break;
129
130 default:
131 break;
132 }
133 break;
134 }
135
136 return FALSE;
137}
138
139
140/* Property page dialog callback */
143 UINT uMsg,
146{
147 PGLOBAL_DATA pGlobalData;
148 LPPSHNOTIFY lppsn;
149
150 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
151
152 switch (uMsg)
153 {
154 case WM_INITDIALOG:
155 pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
156 if (pGlobalData == NULL)
157 return FALSE;
158
159 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
160
161 /* Set the checkbox */
162 CheckDlgButton(hwndDlg,
164 pGlobalData->mouseKeys.dwFlags & MKF_MOUSEKEYSON ? BST_CHECKED : BST_UNCHECKED);
165 return TRUE;
166
167
168 case WM_COMMAND:
169 switch (LOWORD(wParam))
170 {
171 case IDC_MOUSE_BOX:
172 pGlobalData->mouseKeys.dwFlags ^= MKF_MOUSEKEYSON;
173 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
174 break;
175
176 case IDC_MOUSE_BUTTON:
179 hwndDlg,
181 (LPARAM)pGlobalData))
182 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
183 break;
184
185 default:
186 break;
187 }
188 break;
189
190 case WM_NOTIFY:
191 lppsn = (LPPSHNOTIFY)lParam;
192 if (lppsn->hdr.code == PSN_APPLY)
193 {
195 sizeof(MOUSEKEYS),
196 &pGlobalData->mouseKeys,
198 return TRUE;
199 }
200 break;
201 }
202
203 return FALSE;
204}
struct _GLOBAL_DATA * PGLOBAL_DATA
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
INT_PTR CALLBACK MouseKeysDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: mouse.c:19
#define ACCELTICKS
Definition: mouse.c:13
static UINT nSpeedArray[SPEEDTICKS]
Definition: mouse.c:15
#define SPEEDTICKS
Definition: mouse.c:12
INT_PTR CALLBACK MousePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: mouse.c:142
#define IDD_MOUSEKEYSOPTIONS
Definition: resource.h:19
#define IDC_MOUSEKEYS_ACTIVATE_CHECK
Definition: resource.h:93
#define IDC_MOUSE_BUTTON
Definition: resource.h:50
#define IDC_MOUSEKEYS_OFF_RADIO
Definition: resource.h:98
#define IDC_MOUSEKEYS_SPEED_CHECK
Definition: resource.h:96
#define IDC_MOUSEKEYS_STATUS_CHECK
Definition: resource.h:99
#define IDC_MOUSEKEYS_ON_RADIO
Definition: resource.h:97
#define IDC_MOUSE_BOX
Definition: resource.h:49
#define IDC_MOUSEKEYS_SPEED_TRACK
Definition: resource.h:94
#define IDC_MOUSEKEYS_ACCEL_TRACK
Definition: resource.h:95
#define CALLBACK
Definition: compat.h:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
if(dx< 0)
Definition: linetemp.h:194
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
#define TBM_GETPOS
Definition: commctrl.h:2031
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
#define WM_NOTIFY
Definition: richedit.h:61
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3149
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define DWLP_USER
Definition: winuser.h:866
#define WM_HSCROLL
Definition: winuser.h:1733
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define SPI_SETMOUSEKEYS
Definition: winuser.h:1394
#define IDCANCEL
Definition: winuser.h:825
#define BST_UNCHECKED
Definition: winuser.h:199
#define GWL_ID
Definition: winuser.h:853
#define WM_COMMAND
Definition: winuser.h:1730
#define MKF_MODIFIERS
Definition: winuser.h:2138
#define DialogBoxParam
Definition: winuser.h:5754
#define WM_INITDIALOG
Definition: winuser.h:1729
#define MKF_HOTKEYACTIVE
Definition: winuser.h:2134
#define IDOK
Definition: winuser.h:824
#define SPIF_SENDCHANGE
Definition: winuser.h:1562
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1561
#define MKF_INDICATOR
Definition: winuser.h:2137
#define MKF_REPLACENUMBERS
Definition: winuser.h:2139
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define SystemParametersInfo
Definition: winuser.h:5848
#define SendDlgItemMessage
Definition: winuser.h:5832
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define MKF_MOUSEKEYSON
Definition: winuser.h:2132
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)