- Spanish localization by Javier Remacha <remialdo at gmail dot com>
[reactos.git] / reactos / dll / cpl / input / advanced.c
1 /*
2 * ReactOS
3 * Copyright (C) 2007 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 *
21 * PROJECT: input.dll
22 * FILE: dll/win32/input/advanced.c
23 * PURPOSE: input.dll
24 * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
25 * UPDATE HISTORY:
26 * 06-09-2007 Created
27 */
28
29 #include "resource.h"
30 #include "input.h"
31
32 static VOID
33 InitControls(HWND hWnd)
34 {
35 HKEY hKey;
36 DWORD dwValue, dwType, dwSize;
37
38 if (SendDlgItemMessage(hWnd, IDC_TURNOFF_ADV_TXTSERV_CHECKBOX, BM_GETCHECK, 0, 0) == BST_CHECKED)
39 {
40 EnableWindow(GetDlgItem(hWnd, IDC_SUPPORT_ADV_SERV_CHECKBOX),FALSE);
41 EnableWindow(GetDlgItem(hWnd, IDC_SUPPORT_ADV_SERV_TEXT),FALSE);
42 }
43 if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\CTF", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
44 {
45 dwType = REG_DWORD;
46 dwSize = sizeof(DWORD);
47 if (RegQueryValueEx(hKey,
48 L"Disable Thread Input Manager",
49 NULL,
50 &dwType,
51 (LPBYTE)&dwValue,
52 &dwSize) == ERROR_SUCCESS)
53 {
54 if (dwValue == 0x0)
55 SendDlgItemMessage(hWnd, IDC_TURNOFF_ADV_TXTSERV_CHECKBOX, BM_SETCHECK, 0, 0);
56 if (dwValue == 0x1)
57 SendDlgItemMessage(hWnd, IDC_TURNOFF_ADV_TXTSERV_CHECKBOX, BM_SETCHECK, 1, 1);
58 }
59 }
60 RegCloseKey(hKey);
61 }
62
63 static VOID
64 SaveSettings(HWND hWnd)
65 {
66 HKEY hKey;
67 DWORD dwValue, dwType, dwSize;
68
69 if (RegOpenKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\CTF",&hKey) == ERROR_SUCCESS)
70 {
71 dwType = REG_DWORD;
72 dwSize = sizeof(DWORD);
73 if (SendDlgItemMessage(hWnd, IDC_TURNOFF_ADV_TXTSERV_CHECKBOX, BM_GETCHECK, 0, 0) == BST_CHECKED)
74 dwValue = 0x1;
75 else
76 dwValue = 0x0;
77 RegSetValueEx(hKey,
78 L"Disable Thread Input Manager",
79 0,
80 REG_DWORD,
81 (LPBYTE)&dwValue,
82 sizeof(DWORD));
83 }
84 RegCloseKey(hKey);
85 }
86
87 /* Property page dialog callback */
88 INT_PTR CALLBACK
89 AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
90 {
91 UNREFERENCED_PARAMETER(lParam);
92 UNREFERENCED_PARAMETER(wParam);
93 UNREFERENCED_PARAMETER(hwndDlg);
94
95 switch (uMsg)
96 {
97 case WM_INITDIALOG:
98 {
99 InitControls(hwndDlg);
100 }
101 break;
102 case WM_NOTIFY:
103 {
104 LPNMHDR lpnm = (LPNMHDR)lParam;
105 if (lpnm->code == (UINT)PSN_APPLY)
106 {
107 SaveSettings(hwndDlg);
108 }
109 }
110 break;
111 case WM_COMMAND:
112 switch (LOWORD(wParam))
113 {
114 case IDC_SUPPORT_ADV_SERV_CHECKBOX:
115 case IDC_TURNOFF_ADV_TXTSERV_CHECKBOX:
116 {
117 if (SendDlgItemMessage(hwndDlg, IDC_TURNOFF_ADV_TXTSERV_CHECKBOX, BM_GETCHECK, 0, 0) == BST_CHECKED)
118 {
119 EnableWindow(GetDlgItem(hwndDlg, IDC_SUPPORT_ADV_SERV_CHECKBOX),FALSE);
120 EnableWindow(GetDlgItem(hwndDlg, IDC_SUPPORT_ADV_SERV_TEXT),FALSE);
121 }
122 else
123 {
124 EnableWindow(GetDlgItem(hwndDlg, IDC_SUPPORT_ADV_SERV_CHECKBOX),TRUE);
125 EnableWindow(GetDlgItem(hwndDlg, IDC_SUPPORT_ADV_SERV_TEXT),TRUE);
126 }
127 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
128 }
129 break;
130 }
131 break;
132 }
133
134 return FALSE;
135 }
136
137 /* EOF */