Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.0 KiB

  1. /*******************************************************************
  2. * DESCRIPTION: Sound Dialog handler
  3. *******************************************************************/
  4. #include "Access.h"
  5. // *******************************************************************
  6. // SoundDialog handler
  7. // *******************************************************************
  8. INT_PTR CALLBACK SoundDlg (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  9. SOUNDSENTRY ss;
  10. BOOL fSSOn;
  11. BOOL fProcessed = TRUE;
  12. TCHAR szBuf[100];
  13. int i;
  14. switch (uMsg) {
  15. case WM_INITDIALOG:
  16. // init sound sentry options
  17. for (i= 0; i < 4; i++)
  18. {
  19. LoadString(g_hinst, IDS_WINDOWED + i, szBuf, ARRAY_SIZE(szBuf));
  20. ComboBox_AddString(GetDlgItem(hwnd, IDC_SS_WINDOWED), szBuf);
  21. }
  22. // init controls based on current settings
  23. fSSOn = g_ss.dwFlags & SSF_SOUNDSENTRYON;
  24. CheckDlgButton(hwnd, IDC_SS_ENABLE_SOUND, (fSSOn) ? TRUE : FALSE);
  25. if (!(g_ss.dwFlags & SSF_AVAILABLE))
  26. {
  27. EnableWindow(GetDlgItem(hwnd, IDC_SS_ENABLE_SOUND), FALSE);
  28. EnableWindow(GetDlgItem(hwnd, IDC_SS_WINDOWED), FALSE);
  29. EnableWindow(GetDlgItem(hwnd, IDC_SS_CHOOSE), FALSE);
  30. ComboBox_SetCurSel(GetDlgItem(hwnd, IDC_SS_WINDOWED), -1);
  31. }
  32. if (!fSSOn)
  33. {
  34. EnableWindow(GetDlgItem(hwnd, IDC_SS_WINDOWED), FALSE);
  35. EnableWindow(GetDlgItem(hwnd, IDC_SS_CHOOSE), FALSE);
  36. g_ss.iWindowsEffect = 0;
  37. ComboBox_SetCurSel(GetDlgItem(hwnd, IDC_SS_WINDOWED), g_ss.iWindowsEffect);
  38. } else
  39. {
  40. // Select the correct items from the comboboxes.
  41. ComboBox_SetCurSel(GetDlgItem(hwnd, IDC_SS_WINDOWED), g_ss.iWindowsEffect);
  42. }
  43. CheckDlgButton(hwnd, IDC_SS_ENABLE_SHOW, g_fShowSounds);
  44. break;
  45. case WM_HELP: // F1
  46. WinHelp(((LPHELPINFO) lParam)->hItemHandle, __TEXT("access.hlp"), HELP_WM_HELP, (DWORD_PTR) (LPSTR) g_aIds);
  47. break;
  48. case WM_CONTEXTMENU: // right mouse click
  49. WinHelp((HWND) wParam, __TEXT("access.hlp"), HELP_CONTEXTMENU, (DWORD_PTR) (LPSTR) g_aIds);
  50. break;
  51. case WM_COMMAND:
  52. switch (GET_WM_COMMAND_ID(wParam, lParam)) {
  53. case IDC_SS_ENABLE_SOUND:
  54. g_ss.dwFlags ^= SSF_SOUNDSENTRYON;
  55. if (!(g_ss.dwFlags & SSF_SOUNDSENTRYON))
  56. {
  57. EnableWindow(GetDlgItem(hwnd, IDC_SS_CHOOSE), FALSE);
  58. EnableWindow(GetDlgItem(hwnd, IDC_SS_WINDOWED), FALSE);
  59. g_ss.iWindowsEffect = 0;
  60. } else
  61. {
  62. EnableWindow(GetDlgItem(hwnd, IDC_SS_CHOOSE), TRUE);
  63. EnableWindow(GetDlgItem(hwnd, IDC_SS_WINDOWED), TRUE);
  64. g_ss.iWindowsEffect = 1;
  65. }
  66. ComboBox_SetCurSel(GetDlgItem(hwnd, IDC_SS_WINDOWED), g_ss.iWindowsEffect);
  67. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  68. break;
  69. case IDC_SS_ENABLE_SHOW:
  70. g_fShowSounds = !g_fShowSounds;
  71. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  72. break;
  73. case IDC_SS_WINDOWED:
  74. switch (HIWORD(wParam))
  75. {
  76. DWORD dw;
  77. case CBN_CLOSEUP:
  78. dw = ComboBox_GetCurSel(GetDlgItem(hwnd, IDC_SS_WINDOWED));
  79. if (dw != g_ss.iWindowsEffect)
  80. {
  81. g_ss.iWindowsEffect = dw;
  82. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  83. }
  84. break;
  85. }
  86. break;
  87. }
  88. break;
  89. case WM_NOTIFY:
  90. switch (((NMHDR *)lParam)->code) {
  91. case PSN_APPLY: SetAccessibilitySettings(); break;
  92. break;
  93. }
  94. break;
  95. default: fProcessed = FALSE; break;
  96. }
  97. return(fProcessed);
  98. }
  99. ///////////////////////////////// End of File /////////////////////////////////