reactos/base/applications/magnify/settings.c
Amine Khaldi c424146e2c Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
2010-07-24 18:52:44 +00:00

89 lines
2.7 KiB
C

#include <windows.h>
#include <tchar.h>
#include "magnifier.h"
int iZoom = 3;
BOOL bShowWarning = TRUE;
BOOL bFollowMouse = TRUE;
BOOL bFollowFocus = TRUE;
BOOL bFollowCaret = TRUE;
BOOL bInvertColors = FALSE;
BOOL bStartMinimized = FALSE;
BOOL bShowMagnifier = TRUE;
void LoadSettings()
{
HKEY hkey;
LONG value;
ULONG len;
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0,
_T(""), 0, KEY_READ, NULL, &hkey, NULL);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len))
{
if(value >= 0 && value <= 9)
iZoom = value;
}
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len))
bShowWarning = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len))
bInvertColors = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len))
bStartMinimized = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len))
bFollowMouse = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len))
bFollowFocus = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len))
bFollowFocus = (value == 0 ? FALSE : TRUE);
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len))
bFollowCaret = (value == 0 ? FALSE : TRUE);
RegCloseKey(hkey);
}
void SaveSettings()
{
HKEY hkey;
LONG value;
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0,
_T(""), 0, KEY_WRITE, NULL, &hkey, NULL);
value = iZoom;
RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bShowWarning;
RegSetValueEx(hkey, _T("ShowWarning"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bInvertColors;
RegSetValueEx(hkey, _T("StationaryInvertColors"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bStartMinimized;
RegSetValueEx(hkey, _T("StationaryStartMinimized"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bFollowMouse;
RegSetValueEx(hkey, _T("StationaryTrackCursor"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bFollowFocus;
RegSetValueEx(hkey, _T("StationaryTrackFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bFollowFocus;
RegSetValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
value = bFollowCaret;
RegSetValueEx(hkey, _T("StationaryTrackText"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
RegCloseKey(hkey);
}