- Update to r53061
[reactos.git] / base / applications / magnify / settings.c
1
2 #include "magnifier.h"
3
4 int iZoom = 3;
5
6 BOOL bShowWarning = TRUE;
7
8 BOOL bFollowMouse = TRUE;
9 BOOL bFollowFocus = TRUE;
10 BOOL bFollowCaret = TRUE;
11
12 BOOL bInvertColors = FALSE;
13 BOOL bStartMinimized = FALSE;
14 BOOL bShowMagnifier = TRUE;
15
16 void LoadSettings()
17 {
18 HKEY hkey;
19 LONG value;
20 ULONG len;
21
22 RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0,
23 _T(""), 0, KEY_READ, NULL, &hkey, NULL);
24
25 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len))
26 {
27 if(value >= 0 && value <= 9)
28 iZoom = value;
29 }
30
31 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len))
32 bShowWarning = (value == 0 ? FALSE : TRUE);
33
34 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len))
35 bInvertColors = (value == 0 ? FALSE : TRUE);
36
37 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len))
38 bStartMinimized = (value == 0 ? FALSE : TRUE);
39
40 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len))
41 bFollowMouse = (value == 0 ? FALSE : TRUE);
42
43 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len))
44 bFollowFocus = (value == 0 ? FALSE : TRUE);
45
46 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len))
47 bFollowFocus = (value == 0 ? FALSE : TRUE);
48
49 if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len))
50 bFollowCaret = (value == 0 ? FALSE : TRUE);
51
52 RegCloseKey(hkey);
53 }
54
55 void SaveSettings()
56 {
57 HKEY hkey;
58 LONG value;
59
60 RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0,
61 _T(""), 0, KEY_WRITE, NULL, &hkey, NULL);
62
63 value = iZoom;
64 RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
65
66 value = bShowWarning;
67 RegSetValueEx(hkey, _T("ShowWarning"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
68
69 value = bInvertColors;
70 RegSetValueEx(hkey, _T("StationaryInvertColors"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
71
72 value = bStartMinimized;
73 RegSetValueEx(hkey, _T("StationaryStartMinimized"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
74
75 value = bFollowMouse;
76 RegSetValueEx(hkey, _T("StationaryTrackCursor"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
77
78 value = bFollowFocus;
79 RegSetValueEx(hkey, _T("StationaryTrackFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
80
81 value = bFollowFocus;
82 RegSetValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
83
84 value = bFollowCaret;
85 RegSetValueEx(hkey, _T("StationaryTrackText"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
86
87 RegCloseKey(hkey);
88 }