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-05-15 21:59:14 +00:00
|
|
|
* FILE: dll/cpl/access/sound.c
|
2016-11-12 21:53:33 +00:00
|
|
|
* PURPOSE: Sound-related accessibility settings
|
2013-09-15 13:06:05 +00:00
|
|
|
* COPYRIGHT: Copyright 2004 Johannes Anderwald (johannes.anderwald@reactos.org)
|
2007-05-15 21:59:14 +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-05-15 21:59:14 +00:00
|
|
|
static VOID
|
2007-09-17 22:29:35 +00:00
|
|
|
OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
|
2007-05-15 21:59:14 +00:00
|
|
|
{
|
|
|
|
TCHAR szBuffer[256];
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
/* Add strings to the combo-box */
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
LoadString(hApplet, IDS_SENTRY_NONE + i, szBuffer, 256);
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_SENTRY_COMBO, CB_ADDSTRING, 0, (LPARAM)szBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Select a combo-box item */
|
2007-09-17 22:29:35 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_SENTRY_COMBO, CB_SETCURSEL, pGlobalData->ssSoundSentry.iWindowsEffect, 0);
|
2007-05-15 21:59:14 +00:00
|
|
|
|
|
|
|
/* Initialize SoundSentry settings */
|
2007-09-17 22:29:35 +00:00
|
|
|
if (!(pGlobalData->ssSoundSentry.dwFlags & SSF_AVAILABLE))
|
2007-05-15 21:59:14 +00:00
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_BOX), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-09-17 22:29:35 +00:00
|
|
|
if (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)
|
2007-05-15 21:59:14 +00:00
|
|
|
{
|
|
|
|
CheckDlgButton(hwndDlg, IDC_SENTRY_BOX, BST_CHECKED);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO), FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize ShowSounds settings */
|
2007-09-17 22:29:35 +00:00
|
|
|
if (pGlobalData->bShowSounds)
|
2007-05-15 21:59:14 +00:00
|
|
|
CheckDlgButton(hwndDlg, IDC_SSHOW_BOX, BST_CHECKED);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
SoundPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2004-06-30 12:16:27 +00:00
|
|
|
{
|
2007-09-17 22:29:35 +00:00
|
|
|
PGLOBAL_DATA pGlobalData;
|
2007-05-15 21:59:14 +00:00
|
|
|
|
2007-09-17 22:29:35 +00:00
|
|
|
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-05-15 21:59:14 +00:00
|
|
|
|
2007-09-17 22:29:35 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
|
|
|
|
|
|
|
OnInitDialog(hwndDlg, pGlobalData);
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
2007-05-15 21:59:14 +00:00
|
|
|
|
2007-05-01 13:55:11 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_SENTRY_BOX:
|
2007-09-17 22:29:35 +00:00
|
|
|
pGlobalData->ssSoundSentry.dwFlags ^= SSF_SOUNDSENTRYON;
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT), (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO), (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
|
2007-05-15 21:59:14 +00:00
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
|
|
|
|
2007-05-15 21:59:14 +00:00
|
|
|
case IDC_SENTRY_COMBO:
|
|
|
|
if (HIWORD(wParam) == CBN_SELENDOK)
|
|
|
|
{
|
2007-09-17 22:29:35 +00:00
|
|
|
pGlobalData->ssSoundSentry.iWindowsEffect =
|
2007-05-15 21:59:14 +00:00
|
|
|
(DWORD)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
|
|
|
}
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_SSHOW_BOX:
|
2007-09-17 22:29:35 +00:00
|
|
|
pGlobalData->bShowSounds = !pGlobalData->bShowSounds;
|
2007-05-15 21:59:14 +00:00
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-05-01 13:55:11 +00:00
|
|
|
break;
|
2007-05-15 21:59:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
switch (((LPNMHDR)lParam)->code)
|
|
|
|
{
|
|
|
|
case PSN_APPLY:
|
|
|
|
SystemParametersInfo(SPI_SETSOUNDSENTRY,
|
|
|
|
sizeof(SOUNDSENTRY),
|
2007-09-17 22:29:35 +00:00
|
|
|
&pGlobalData->ssSoundSentry,
|
2007-05-15 21:59:14 +00:00
|
|
|
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
|
|
|
SystemParametersInfo(SPI_SETSHOWSOUNDS,
|
2007-09-17 22:29:35 +00:00
|
|
|
pGlobalData->bShowSounds,
|
2007-05-15 21:59:14 +00:00
|
|
|
0,
|
|
|
|
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
|
|
|
return TRUE;
|
2007-05-01 13:55:11 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|