ReactOS  0.4.14-dev-98-gb0d4763
sound.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/sound.c
5  * PURPOSE: Sound-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 static VOID
13 OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
14 {
15  TCHAR szBuffer[256];
16  UINT i;
17 
18  /* Add strings to the combo-box */
19  for (i = 0; i < 4; i++)
20  {
21  LoadString(hApplet, IDS_SENTRY_NONE + i, szBuffer, 256);
22  SendDlgItemMessage(hwndDlg, IDC_SENTRY_COMBO, CB_ADDSTRING, 0, (LPARAM)szBuffer);
23  }
24 
25  /* Select a combo-box item */
27 
28  /* Initialize SoundSentry settings */
29  if (!(pGlobalData->ssSoundSentry.dwFlags & SSF_AVAILABLE))
30  {
34  }
35  else
36  {
37  if (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)
38  {
40  }
41  else
42  {
45  }
46  }
47 
48  /* Initialize ShowSounds settings */
49  if (pGlobalData->bShowSounds)
51 }
52 
53 
54 /* Property page dialog callback */
57  UINT uMsg,
58  WPARAM wParam,
59  LPARAM lParam)
60 {
61  PGLOBAL_DATA pGlobalData;
62 
63  pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
64 
65  switch (uMsg)
66  {
67  case WM_INITDIALOG:
68  pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
69 
70  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
71 
72  OnInitDialog(hwndDlg, pGlobalData);
73  break;
74 
75  case WM_COMMAND:
76  switch (LOWORD(wParam))
77  {
78  case IDC_SENTRY_BOX:
79  pGlobalData->ssSoundSentry.dwFlags ^= SSF_SOUNDSENTRYON;
80  EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_TEXT), (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
81  EnableWindow(GetDlgItem(hwndDlg, IDC_SENTRY_COMBO), (pGlobalData->ssSoundSentry.dwFlags & SSF_SOUNDSENTRYON)?TRUE:FALSE);
82  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
83  break;
84 
85  case IDC_SENTRY_COMBO:
86  if (HIWORD(wParam) == CBN_SELENDOK)
87  {
88  pGlobalData->ssSoundSentry.iWindowsEffect =
90  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
91  }
92  break;
93 
94  case IDC_SSHOW_BOX:
95  pGlobalData->bShowSounds = !pGlobalData->bShowSounds;
96  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
97  break;
98 
99  default:
100  break;
101  }
102  break;
103 
104  case WM_NOTIFY:
105  switch (((LPNMHDR)lParam)->code)
106  {
107  case PSN_APPLY:
109  sizeof(SOUNDSENTRY),
110  &pGlobalData->ssSoundSentry,
113  pGlobalData->bShowSounds,
114  0,
116  return TRUE;
117 
118  default:
119  break;
120  }
121  break;
122  }
123 
124  return FALSE;
125 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
BOOL bShowSounds
Definition: access.h:40
#define CALLBACK
Definition: compat.h:27
#define SystemParametersInfo
Definition: winuser.h:5759
DWORD iWindowsEffect
Definition: winuser.h:3473
#define IDC_SSHOW_BOX
Definition: resource.h:45
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5743
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
#define DWORD
Definition: nt_native.h:44
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
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
#define CBN_SELENDOK
Definition: winuser.h:1963
#define CB_ADDSTRING
Definition: winuser.h:1918
#define LPPROPSHEETPAGE
Definition: prsht.h:372
SOUNDSENTRY ssSoundSentry
Definition: access.h:39
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static VOID OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
Definition: sound.c:13
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_SENTRY_BOX
Definition: resource.h:42
#define SPI_SETSOUNDSENTRY
Definition: winuser.h:1398
#define DWLP_USER
Definition: winuser.h:866
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
#define SSF_SOUNDSENTRYON
Definition: winuser.h:2136
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1553
#define IDC_SENTRY_TEXT
Definition: resource.h:43
#define IDS_SENTRY_NONE
Definition: resource.h:26
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define SPIF_SENDCHANGE
Definition: winuser.h:1554
#define BST_CHECKED
Definition: winuser.h:197
INT_PTR CALLBACK SoundPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: sound.c:56
struct _GLOBAL_DATA * PGLOBAL_DATA
#define SendMessage
Definition: winuser.h:5744
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_SENTRY_COMBO
Definition: resource.h:44
#define GetWindowLongPtr
Definition: treelist.c:73
#define SPI_SETSHOWSOUNDS
Definition: winuser.h:1388
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define LoadString
Definition: winuser.h:5720
#define WM_NOTIFY
Definition: richedit.h:61
#define SSF_AVAILABLE
Definition: winuser.h:2135