2013-03-16 20:25:38 +00:00
|
|
|
/*
|
2007-08-19 16:11:04 +00:00
|
|
|
* PROJECT: ReactOS Accessibility Control Panel
|
2006-04-07 13:03:59 +00:00
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2007-08-12 21:19:52 +00:00
|
|
|
* FILE: dll/cpl/access/mouse.c
|
2007-08-19 16:11:04 +00:00
|
|
|
* PURPOSE: Mouse-related accessibility settings
|
2013-09-15 13:06:05 +00:00
|
|
|
* COPYRIGHT: Copyright 2004 Johannes Anderwald (johannes.anderwald@reactos.org)
|
2007-08-19 16:11:04 +00:00
|
|
|
* Copyright 2007 Eric Kohl
|
2004-06-30 12:16:27 +00:00
|
|
|
*/
|
2007-08-19 16:11:04 +00:00
|
|
|
|
2004-06-30 12:16:27 +00:00
|
|
|
#include "access.h"
|
|
|
|
|
2007-08-19 16:11:04 +00:00
|
|
|
#define SPEEDTICKS 9
|
|
|
|
#define ACCELTICKS 9
|
|
|
|
|
2008-10-25 17:32:54 +00:00
|
|
|
static UINT nSpeedArray[SPEEDTICKS] = {10, 20, 30, 40, 60, 80, 120, 180, 360};
|
2007-08-19 16:11:04 +00:00
|
|
|
|
|
|
|
|
2007-08-12 21:19:52 +00:00
|
|
|
INT_PTR CALLBACK
|
|
|
|
MouseKeysDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
PGLOBAL_DATA pGlobalData;
|
2007-08-19 16:11:04 +00:00
|
|
|
INT i;
|
2007-08-12 21:19:52 +00:00
|
|
|
|
|
|
|
pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
pGlobalData = (PGLOBAL_DATA)lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
|
|
|
|
2007-08-19 16:11:04 +00:00
|
|
|
CheckDlgButton(hwndDlg,
|
|
|
|
IDC_MOUSEKEYS_ACTIVATE_CHECK,
|
|
|
|
pGlobalData->mouseKeys.dwFlags & MKF_HOTKEYACTIVE ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
|
|
|
|
/* Set the number of ticks for the speed trackbar */
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_SPEED_TRACK, TBM_SETRANGE,
|
|
|
|
TRUE, MAKELONG(0, SPEEDTICKS - 1));
|
|
|
|
|
|
|
|
/* Calculate the matching tick */
|
|
|
|
for (i = 0; i < SPEEDTICKS; i++)
|
|
|
|
{
|
|
|
|
if (pGlobalData->mouseKeys.iMaxSpeed <= nSpeedArray[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the thumb */
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_SPEED_TRACK, TBM_SETPOS, TRUE, i);
|
|
|
|
|
2014-02-13 19:10:28 +00:00
|
|
|
/* Set the number of ticks for the acceleration trackbar */
|
2007-08-19 16:11:04 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_ACCEL_TRACK, TBM_SETRANGE,
|
|
|
|
TRUE, MAKELONG(0, ACCELTICKS - 1));
|
|
|
|
|
|
|
|
/* Calculate the matching tick */
|
|
|
|
i = (ACCELTICKS + 1) - pGlobalData->mouseKeys.iTimeToMaxSpeed / 500;
|
|
|
|
if (i > ACCELTICKS - 1)
|
|
|
|
i = ACCELTICKS - 1;
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
/* Set the thumb */
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_ACCEL_TRACK, TBM_SETPOS, TRUE, i);
|
|
|
|
|
|
|
|
CheckDlgButton(hwndDlg,
|
|
|
|
IDC_MOUSEKEYS_SPEED_CHECK,
|
|
|
|
pGlobalData->mouseKeys.dwFlags & MKF_MODIFIERS ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
|
|
|
|
CheckRadioButton(hwndDlg,
|
|
|
|
IDC_MOUSEKEYS_ON_RADIO,
|
|
|
|
IDC_MOUSEKEYS_OFF_RADIO,
|
|
|
|
pGlobalData->mouseKeys.dwFlags & MKF_REPLACENUMBERS ? IDC_MOUSEKEYS_ON_RADIO : IDC_MOUSEKEYS_OFF_RADIO);
|
|
|
|
|
|
|
|
CheckDlgButton(hwndDlg,
|
|
|
|
IDC_MOUSEKEYS_STATUS_CHECK,
|
|
|
|
pGlobalData->mouseKeys.dwFlags & MKF_INDICATOR ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_HSCROLL:
|
2009-05-09 12:27:40 +00:00
|
|
|
switch (GetWindowLongPtr((HWND) lParam, GWL_ID))
|
2007-08-19 16:11:04 +00:00
|
|
|
{
|
|
|
|
case IDC_MOUSEKEYS_SPEED_TRACK:
|
|
|
|
i = SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_SPEED_TRACK, TBM_GETPOS, 0, 0);
|
|
|
|
if (i >= 0 && i < SPEEDTICKS)
|
|
|
|
pGlobalData->mouseKeys.iMaxSpeed = nSpeedArray[i];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSEKEYS_ACCEL_TRACK:
|
|
|
|
i = SendDlgItemMessage(hwndDlg, IDC_MOUSEKEYS_ACCEL_TRACK, TBM_GETPOS, 0, 0);
|
|
|
|
if (i >= 0 && i < ACCELTICKS)
|
|
|
|
pGlobalData->mouseKeys.iTimeToMaxSpeed = (ACCELTICKS + 1 - i) * 500;
|
|
|
|
break;
|
|
|
|
}
|
2007-08-12 21:19:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2007-08-19 16:11:04 +00:00
|
|
|
case IDC_MOUSEKEYS_ACTIVATE_CHECK:
|
|
|
|
pGlobalData->mouseKeys.dwFlags ^= MKF_HOTKEYACTIVE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSEKEYS_SPEED_CHECK:
|
|
|
|
pGlobalData->mouseKeys.dwFlags ^= MKF_MODIFIERS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSEKEYS_ON_RADIO:
|
|
|
|
pGlobalData->mouseKeys.dwFlags |= MKF_REPLACENUMBERS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSEKEYS_OFF_RADIO:
|
|
|
|
pGlobalData->mouseKeys.dwFlags &= ~MKF_REPLACENUMBERS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSEKEYS_STATUS_CHECK:
|
|
|
|
pGlobalData->mouseKeys.dwFlags ^= MKF_INDICATOR;
|
|
|
|
break;
|
|
|
|
|
2007-08-12 21:19:52 +00:00
|
|
|
case IDOK:
|
|
|
|
EndDialog(hwndDlg, TRUE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hwndDlg, FALSE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-30 12:16:27 +00:00
|
|
|
/* Property page dialog callback */
|
2004-10-11 21:08:06 +00:00
|
|
|
INT_PTR CALLBACK
|
2007-05-01 13:55:11 +00:00
|
|
|
MousePageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2004-06-30 12:16:27 +00:00
|
|
|
{
|
2007-08-12 21:19:52 +00:00
|
|
|
PGLOBAL_DATA pGlobalData;
|
|
|
|
LPPSHNOTIFY lppsn;
|
|
|
|
|
|
|
|
pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2007-05-01 13:55:11 +00:00
|
|
|
|
|
|
|
switch (uMsg)
|
2004-06-30 12:16:27 +00:00
|
|
|
{
|
2007-05-01 13:55:11 +00:00
|
|
|
case WM_INITDIALOG:
|
2007-09-17 22:29:35 +00:00
|
|
|
pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
2007-08-12 21:19:52 +00:00
|
|
|
if (pGlobalData == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
|
|
|
|
|
|
|
/* Set the checkbox */
|
|
|
|
CheckDlgButton(hwndDlg,
|
|
|
|
IDC_MOUSE_BOX,
|
|
|
|
pGlobalData->mouseKeys.dwFlags & MKF_MOUSEKEYSON ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
2007-05-01 13:55:11 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_MOUSE_BOX:
|
2007-08-12 21:19:52 +00:00
|
|
|
pGlobalData->mouseKeys.dwFlags ^= MKF_MOUSEKEYSON;
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_MOUSE_BUTTON:
|
2007-08-12 21:19:52 +00:00
|
|
|
if (DialogBoxParam(hApplet,
|
|
|
|
MAKEINTRESOURCE(IDD_MOUSEKEYSOPTIONS),
|
|
|
|
hwndDlg,
|
2017-10-30 23:37:37 +00:00
|
|
|
MouseKeysDlgProc,
|
2007-08-12 21:19:52 +00:00
|
|
|
(LPARAM)pGlobalData))
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2007-08-12 21:19:52 +00:00
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
lppsn = (LPPSHNOTIFY)lParam;
|
|
|
|
if (lppsn->hdr.code == PSN_APPLY)
|
|
|
|
{
|
|
|
|
SystemParametersInfo(SPI_SETMOUSEKEYS,
|
|
|
|
sizeof(MOUSEKEYS),
|
|
|
|
&pGlobalData->mouseKeys,
|
|
|
|
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE /*0*/);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-06-30 12:16:27 +00:00
|
|
|
}
|
2007-05-01 13:55:11 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2004-06-30 12:16:27 +00:00
|
|
|
}
|