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.

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