Leaked source code of windows server 2003
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.

118 lines
4.1 KiB

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