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.

123 lines
4.6 KiB

  1. /*******************************************************************
  2. * DESCRIPTION: Keyboard Dialog handler
  3. *******************************************************************/
  4. #include "Access.h"
  5. extern GetAccessibilitySettings();
  6. extern BOOL g_SPISetValue;
  7. extern BOOL g_bFKOn;
  8. extern DWORD g_dwOrigFKFlags ;
  9. extern LPTSTR HelpFile();
  10. // *******************************************************************
  11. // KeyboardDialog handler
  12. // *******************************************************************
  13. BOOL WINAPI KeyboardDlg (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  14. STICKYKEYS sk; // Tmp holder for settings.
  15. FILTERKEYS fk;
  16. TOGGLEKEYS tk;
  17. BOOL fProcessed = TRUE;
  18. switch (uMsg) {
  19. case WM_INITDIALOG:
  20. CheckDlgButton(hwnd, IDC_STK_ENABLE, (g_sk.dwFlags & SKF_STICKYKEYSON) ? TRUE : FALSE);
  21. if (!(g_sk.dwFlags & SKF_AVAILABLE)) {
  22. EnableWindow(GetDlgItem(hwnd, IDC_STK_SETTINGS), FALSE);
  23. EnableWindow(GetDlgItem(hwnd, IDC_STK_ENABLE), FALSE);
  24. }
  25. CheckDlgButton(hwnd, IDC_FK_ENABLE, (g_fk.dwFlags & FKF_FILTERKEYSON) ? TRUE : FALSE);
  26. CheckDlgButton(hwnd, IDC_TK_ENABLE, (g_tk.dwFlags & TKF_TOGGLEKEYSON) ? TRUE : FALSE);
  27. if (!(g_tk.dwFlags & TKF_AVAILABLE)) {
  28. EnableWindow(GetDlgItem(hwnd, IDC_TK_SETTINGS), FALSE);
  29. EnableWindow(GetDlgItem(hwnd, IDC_TK_ENABLE), FALSE);
  30. }
  31. CheckDlgButton(hwnd, IDC_SHOWEXTRAKYBDHELP, g_fExtraKeyboardHelp);
  32. break;
  33. case WM_HELP: // F1
  34. WinHelp(((LPHELPINFO) lParam)->hItemHandle, HelpFile(), HELP_WM_HELP, (DWORD_PTR) (LPSTR) g_aIds);
  35. break;
  36. case WM_CONTEXTMENU: // right mouse click
  37. WinHelp((HWND) wParam, HelpFile(), HELP_CONTEXTMENU, (DWORD_PTR) (LPSTR) g_aIds);
  38. break;
  39. case WM_COMMAND:
  40. switch (GET_WM_COMMAND_ID(wParam, lParam)) {
  41. case IDC_STK_ENABLE:
  42. g_sk.dwFlags ^= SKF_STICKYKEYSON;
  43. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  44. break;
  45. case IDC_FK_ENABLE:
  46. g_fk.dwFlags ^= FKF_FILTERKEYSON;
  47. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  48. g_bFKOn = !g_bFKOn;
  49. break;
  50. case IDC_TK_ENABLE:
  51. g_tk.dwFlags ^= TKF_TOGGLEKEYSON;
  52. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  53. break;
  54. case IDC_STK_SETTINGS:
  55. sk = g_sk;
  56. if (DialogBox(g_hinst, MAKEINTRESOURCE(IDD_STICKYSETTINGS), hwnd, StickyKeyDlg) == IDCANCEL)
  57. g_sk = sk;
  58. else SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  59. break;
  60. case IDC_FK_SETTINGS:
  61. fk = g_fk;
  62. if (DialogBox(g_hinst, MAKEINTRESOURCE(IDD_FILTERSETTINGS), hwnd, FilterKeyDlg) == IDCANCEL)
  63. g_fk = fk;
  64. else SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  65. break;
  66. case IDC_TK_SETTINGS:
  67. tk = g_tk;
  68. if (DialogBox(g_hinst, MAKEINTRESOURCE(IDD_TOGGLESETTINGS), hwnd, ToggleKeySettingsDlg) == IDCANCEL) {
  69. g_tk = tk;
  70. } else SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  71. break;
  72. case IDC_SHOWEXTRAKYBDHELP:
  73. g_fExtraKeyboardHelp = !g_fExtraKeyboardHelp;
  74. CheckDlgButton(hwnd, IDC_SHOWEXTRAKYBDHELP, g_fExtraKeyboardHelp);
  75. SendMessage(GetParent(hwnd), PSM_CHANGED, (WPARAM) hwnd, 0);
  76. break;
  77. }
  78. break;
  79. case WM_SETTINGCHANGE:
  80. // This is because, When you setting the values could generate this
  81. /* if ( FALSE == g_SPISetValue )
  82. {
  83. // This needs to be monitered, as in the cases where settings chnage (say in
  84. // case of hotkey press. The settings are re-loaded. This is done here so that
  85. // Keyboard dialog is shown first. a-anilk
  86. // NOTE: But if you get this up from system tary icons. BUG still EXISTS!!!
  87. GetAccessibilitySettings();
  88. }*/
  89. break;
  90. case WM_NOTIFY:
  91. switch (((NMHDR *)lParam)->code) {
  92. case PSN_APPLY: SetAccessibilitySettings(); break;
  93. }
  94. break;
  95. default: fProcessed = FALSE; break;
  96. }
  97. return(fProcessed);
  98. }
  99. ///////////////////////////////// End of File /////////////////////////////////