[desk.cpl]

- Formatting: Convert tabs to spaces
- No code changes

svn path=/trunk/; revision=58797
This commit is contained in:
Giannis Adamopoulos 2013-04-21 12:00:37 +00:00
parent d2577f2eff
commit 78cb9a84f2
12 changed files with 2493 additions and 2493 deletions

File diff suppressed because it is too large Load diff

View file

@ -15,245 +15,245 @@
static void static void
AppearancePage_ShowColorScemes(GLOBALS *g, HWND hwndColor, INT ThemeId) AppearancePage_ShowColorScemes(GLOBALS *g, HWND hwndColor, INT ThemeId)
{ {
int i, iListIndex; int i, iListIndex;
SendMessage(hwndColor, CB_RESETCONTENT , 0, 0); SendMessage(hwndColor, CB_RESETCONTENT , 0, 0);
if(g->bThemeActive == FALSE) if(g->bThemeActive == FALSE)
{ {
for(i = 0; i < g_TemplateCount; i++) for(i = 0; i < g_TemplateCount; i++)
{ {
iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)g_ColorSchemes[i].strLegacyName); iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)g_ColorSchemes[i].strLegacyName);
SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i); SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i);
if (lstrcmp(g_ColorSchemes[i].strKeyName, g->strSelectedStyle) == 0) if (lstrcmp(g_ColorSchemes[i].strKeyName, g->strSelectedStyle) == 0)
{ {
g->SchemeId = i; g->SchemeId = i;
SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0); SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0);
} }
} }
} }
else else
{ {
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, ThemeId); PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, ThemeId);
for(i = 0; i < pTheme->ColorsCount; i++) for(i = 0; i < pTheme->ColorsCount; i++)
{ {
PTHEME_STYLE pStyleName; PTHEME_STYLE pStyleName;
pStyleName = (PTHEME_STYLE)DSA_GetItemPtr(pTheme->Colors, i); pStyleName = (PTHEME_STYLE)DSA_GetItemPtr(pTheme->Colors, i);
iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)pStyleName->DisplayName); iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)pStyleName->DisplayName);
SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i); SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i);
if(i == 0 || (g->pszColorName && wcscmp(pStyleName->StlyeName, g->pszColorName) == 0)) if(i == 0 || (g->pszColorName && wcscmp(pStyleName->StlyeName, g->pszColorName) == 0))
{ {
g->SchemeId = i; g->SchemeId = i;
SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0); SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0);
} }
} }
} }
} }
static INT_PTR static INT_PTR
AppearancePage_OnInit(HWND hwndDlg) AppearancePage_OnInit(HWND hwndDlg)
{ {
INT i, /*TemplateCount,*/ iListIndex; INT i, /*TemplateCount,*/ iListIndex;
HWND hwndColor, hwndTheme; HWND hwndColor, hwndTheme;
GLOBALS *g; GLOBALS *g;
g = (GLOBALS*)LocalAlloc(LPTR, sizeof(GLOBALS)); g = (GLOBALS*)LocalAlloc(LPTR, sizeof(GLOBALS));
if (g == NULL) if (g == NULL)
return FALSE; return FALSE;
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
LoadCurrentScheme(&g->Scheme); LoadCurrentScheme(&g->Scheme);
g->SchemeAdv = g->Scheme; g->SchemeAdv = g->Scheme;
g->bThemeChanged = FALSE; g->bThemeChanged = FALSE;
g->bSchemeChanged = FALSE; g->bSchemeChanged = FALSE;
g->hBoldFont = g->hItalicFont = NULL; g->hBoldFont = g->hItalicFont = NULL;
g->hbmpColor[0] = g->hbmpColor[1] = g->hbmpColor[2] = NULL; g->hbmpColor[0] = g->hbmpColor[1] = g->hbmpColor[2] = NULL;
g->bInitializing = FALSE; g->bInitializing = FALSE;
g->bThemeActive = FALSE; g->bThemeActive = FALSE;
LoadThemes(g); LoadThemes(g);
/*TemplateCount = */ LoadSchemePresetEntries(g->strSelectedStyle); /*TemplateCount = */ LoadSchemePresetEntries(g->strSelectedStyle);
hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME); hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
g->SchemeId = -1; g->SchemeId = -1;
g->bInitializing = TRUE; g->bInitializing = TRUE;
hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE); hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
for(i = 0; i < g->ThemesCount; i++) for(i = 0; i < g->ThemesCount; i++)
{ {
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, i); PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, i);
iListIndex = SendMessage(hwndTheme, CB_ADDSTRING, 0, (LPARAM)pTheme->displayName); iListIndex = SendMessage(hwndTheme, CB_ADDSTRING, 0, (LPARAM)pTheme->displayName);
SendMessage(hwndTheme, CB_SETITEMDATA, iListIndex, i); SendMessage(hwndTheme, CB_SETITEMDATA, iListIndex, i);
if((!pTheme->themeFileName && !IsThemeActive()) || if((!pTheme->themeFileName && !IsThemeActive()) ||
(pTheme->themeFileName && g->pszThemeFileName && wcscmp(pTheme->themeFileName, g->pszThemeFileName) == 0 )) (pTheme->themeFileName && g->pszThemeFileName && wcscmp(pTheme->themeFileName, g->pszThemeFileName) == 0 ))
{ {
g->ThemeId = i; g->ThemeId = i;
g->bThemeActive = (pTheme->themeFileName != NULL); g->bThemeActive = (pTheme->themeFileName != NULL);
SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0); SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0);
AppearancePage_ShowColorScemes(g, hwndColor, i); AppearancePage_ShowColorScemes(g, hwndColor, i);
} }
} }
g->bInitializing = FALSE; g->bInitializing = FALSE;
return FALSE; return FALSE;
} }
static VOID static VOID
AppearancePage_OnDestroy(HWND hwndDlg, GLOBALS *g) AppearancePage_OnDestroy(HWND hwndDlg, GLOBALS *g)
{ {
LocalFree(g); LocalFree(g);
} }
static INT static INT
GetSelectedId(HWND hwndDlg, int nIDDlgItem) GetSelectedId(HWND hwndDlg, int nIDDlgItem)
{ {
HWND hwndCombo; HWND hwndCombo;
INT sel; INT sel;
hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem); hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem);
sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0); sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
if (sel == CB_ERR) if (sel == CB_ERR)
return -1; return -1;
return (INT)SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM)sel, 0); return (INT)SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM)sel, 0);
} }
INT_PTR CALLBACK INT_PTR CALLBACK
AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
GLOBALS *g; GLOBALS *g;
LPNMHDR lpnm; LPNMHDR lpnm;
g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER); g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
return AppearancePage_OnInit(hwndDlg); return AppearancePage_OnInit(hwndDlg);
case WM_DESTROY: case WM_DESTROY:
AppearancePage_OnDestroy(hwndDlg, g); AppearancePage_OnDestroy(hwndDlg, g);
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_APPEARANCE_EFFECTS: case IDC_APPEARANCE_EFFECTS:
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_EFFAPPEARANCE), if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_EFFAPPEARANCE),
hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK) hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK)
{ {
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->Scheme = g->SchemeAdv; g->Scheme = g->SchemeAdv;
g->bSchemeChanged = TRUE; g->bSchemeChanged = TRUE;
// Effects dialog doesn't change the color scheme, therefore the following lines are commented out, until fixed finally // Effects dialog doesn't change the color scheme, therefore the following lines are commented out, until fixed finally
//g->SchemeId = -1; /* Customized */ //g->SchemeId = -1; /* Customized */
//SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0); //SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0);
//SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT("")); //SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT(""));
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
} }
break; break;
case IDC_APPEARANCE_ADVANCED: case IDC_APPEARANCE_ADVANCED:
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_ADVAPPEARANCE), if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_ADVAPPEARANCE),
hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK) hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK)
{ {
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->bSchemeChanged = TRUE; g->bSchemeChanged = TRUE;
g->Scheme = g->SchemeAdv; g->Scheme = g->SchemeAdv;
g->SchemeId = -1; /* Customized */ g->SchemeId = -1; /* Customized */
g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP]; g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0);
SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT("")); SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT(""));
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
} }
break; break;
case IDC_APPEARANCE_COLORSCHEME: case IDC_APPEARANCE_COLORSCHEME:
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing) if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
{ {
INT SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME); INT SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
if(g->bThemeActive == FALSE) if(g->bThemeActive == FALSE)
{ {
COLOR_SCHEME Scheme; COLOR_SCHEME Scheme;
g->bSchemeChanged = TRUE; g->bSchemeChanged = TRUE;
if (SchemeId != -1 && LoadSchemeFromReg(&Scheme, SchemeId)) if (SchemeId != -1 && LoadSchemeFromReg(&Scheme, SchemeId))
{ {
g->Scheme = Scheme; g->Scheme = Scheme;
g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP]; g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&Scheme); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&Scheme);
} }
} }
else else
{ {
g->bThemeChanged = TRUE; g->bThemeChanged = TRUE;
} }
} }
break; break;
case IDC_APPEARANCE_VISUAL_STYLE: case IDC_APPEARANCE_VISUAL_STYLE:
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing) if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
{ {
INT ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE); INT ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
HWND hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME); HWND hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->bThemeActive = (ThemeId!=0); g->bThemeActive = (ThemeId!=0);
g->bThemeChanged = TRUE; g->bThemeChanged = TRUE;
AppearancePage_ShowColorScemes(g, hwndColor, ThemeId); AppearancePage_ShowColorScemes(g, hwndColor, ThemeId);
} }
break; break;
} }
break; break;
case WM_NOTIFY: case WM_NOTIFY:
lpnm = (LPNMHDR)lParam; lpnm = (LPNMHDR)lParam;
switch (lpnm->code) switch (lpnm->code)
{ {
case PSN_APPLY: case PSN_APPLY:
g->ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE); g->ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
g->SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME); g->SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
if(g->bSchemeChanged) if(g->bSchemeChanged)
{ {
ApplyScheme(&g->Scheme, g->SchemeId); ApplyScheme(&g->Scheme, g->SchemeId);
} }
if(g->bThemeChanged) if(g->bThemeChanged)
{ {
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, g->ThemeId); PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, g->ThemeId);
ActivateTheme(pTheme, g->SchemeId, 0); ActivateTheme(pTheme, g->SchemeId, 0);
} }
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
g->bThemeChanged = FALSE; g->bThemeChanged = FALSE;
g->bSchemeChanged = FALSE; g->bSchemeChanged = FALSE;
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)PSNRET_NOERROR); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)PSNRET_NOERROR);
return TRUE; return TRUE;
case PSN_KILLACTIVE: case PSN_KILLACTIVE:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)FALSE); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)FALSE);
return TRUE; return TRUE;
case PSN_SETACTIVE: case PSN_SETACTIVE:
if (g->Scheme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color) if (g->Scheme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color)
{ {
g->Scheme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color; g->Scheme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme); SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
} }
break; break;
} }
break; break;
} }
return FALSE; return FALSE;
} }

View file

@ -40,57 +40,57 @@
/* Most (but not all) fields below correspond to HKCU\Control Panel\Desktop\UserPreferencesMask */ /* Most (but not all) fields below correspond to HKCU\Control Panel\Desktop\UserPreferencesMask */
typedef struct typedef struct
{ {
BOOL bActiveWindowTracking; BOOL bActiveWindowTracking;
BOOL bMenuAnimation; BOOL bMenuAnimation;
BOOL bComboBoxAnimation; BOOL bComboBoxAnimation;
BOOL bListBoxSmoothScrolling; BOOL bListBoxSmoothScrolling;
BOOL bGradientCaptions; BOOL bGradientCaptions;
BOOL bKeyboardCues; BOOL bKeyboardCues;
BOOL bActiveWndTrkZorder; BOOL bActiveWndTrkZorder;
BOOL bHotTracking; BOOL bHotTracking;
BOOL bMenuFade; BOOL bMenuFade;
BOOL bSelectionFade; BOOL bSelectionFade;
BOOL bTooltipAnimation; BOOL bTooltipAnimation;
BOOL bTooltipFade; BOOL bTooltipFade;
BOOL bCursorShadow; BOOL bCursorShadow;
BOOL bUiEffects; BOOL bUiEffects;
BOOL bFontSmoothing; BOOL bFontSmoothing;
BOOL bDragFullWindows; BOOL bDragFullWindows;
UINT uiFontSmoothingType; UINT uiFontSmoothingType;
} EFFECTS; } EFFECTS;
typedef struct typedef struct
{ {
COLORREF crColor[NUM_COLORS]; COLORREF crColor[NUM_COLORS];
LOGFONT lfFont[NUM_FONTS]; LOGFONT lfFont[NUM_FONTS];
INT Size[NUM_SIZES]; INT Size[NUM_SIZES];
BOOL bFlatMenus; BOOL bFlatMenus;
EFFECTS Effects; EFFECTS Effects;
} COLOR_SCHEME; } COLOR_SCHEME;
typedef struct typedef struct
{ {
TCHAR strKeyName[4]; TCHAR strKeyName[4];
TCHAR strSizeName[4]; TCHAR strSizeName[4];
TCHAR strDisplayName[MAX_TEMPLATENAMELENTGH]; TCHAR strDisplayName[MAX_TEMPLATENAMELENTGH];
TCHAR strLegacyName[MAX_TEMPLATENAMELENTGH]; TCHAR strLegacyName[MAX_TEMPLATENAMELENTGH];
} SCHEME_PRESET; } SCHEME_PRESET;
/* struct for holding theme colors and sizes */ /* struct for holding theme colors and sizes */
typedef struct _THEME_STYLE typedef struct _THEME_STYLE
{ {
WCHAR* StlyeName; WCHAR* StlyeName;
WCHAR* DisplayName; WCHAR* DisplayName;
} THEME_STYLE, *PTHEME_STYLE; } THEME_STYLE, *PTHEME_STYLE;
typedef struct _THEME typedef struct _THEME
{ {
WCHAR* themeFileName; WCHAR* themeFileName;
WCHAR* displayName; WCHAR* displayName;
HDSA Colors; HDSA Colors;
int ColorsCount; int ColorsCount;
HDSA Sizes; HDSA Sizes;
int SizesCount; int SizesCount;
} THEME, *PTHEME; } THEME, *PTHEME;
@ -99,27 +99,27 @@ typedef struct _THEME
or by passing hwnd and getting the pointer by GetWindowLongPtr */ or by passing hwnd and getting the pointer by GetWindowLongPtr */
typedef struct tagGLOBALS typedef struct tagGLOBALS
{ {
HDSA Themes; HDSA Themes;
int ThemesCount; int ThemesCount;
BOOL bThemeActive; BOOL bThemeActive;
INT ThemeId; INT ThemeId;
INT SchemeId; /* Theme is customized if SchemeId == -1 */ INT SchemeId; /* Theme is customized if SchemeId == -1 */
INT SizeID; INT SizeID;
TCHAR strSelectedStyle[4]; TCHAR strSelectedStyle[4];
LPWSTR pszThemeFileName; LPWSTR pszThemeFileName;
LPWSTR pszColorName; LPWSTR pszColorName;
LPWSTR pszSizeName; LPWSTR pszSizeName;
COLOR_SCHEME Scheme; COLOR_SCHEME Scheme;
COLOR_SCHEME SchemeAdv; COLOR_SCHEME SchemeAdv;
BOOL bThemeChanged; BOOL bThemeChanged;
BOOL bSchemeChanged; BOOL bSchemeChanged;
HBITMAP hbmpColor[3]; HBITMAP hbmpColor[3];
INT CurrentElement; INT CurrentElement;
HFONT hBoldFont; HFONT hBoldFont;
HFONT hItalicFont; HFONT hItalicFont;
BOOL bInitializing; BOOL bInitializing;
} GLOBALS; } GLOBALS;

View file

@ -14,218 +14,218 @@
DWORD WINAPI DWORD WINAPI
DisplayClassInstaller( DisplayClassInstaller(
IN DI_FUNCTION InstallFunction, IN DI_FUNCTION InstallFunction,
IN HDEVINFO DeviceInfoSet, IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL) IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
{ {
SP_DEVINSTALL_PARAMS InstallParams; SP_DEVINSTALL_PARAMS InstallParams;
SP_DRVINFO_DATA DriverInfoData; SP_DRVINFO_DATA DriverInfoData;
HINF hInf = INVALID_HANDLE_VALUE; HINF hInf = INVALID_HANDLE_VALUE;
TCHAR SectionName[MAX_PATH]; TCHAR SectionName[MAX_PATH];
TCHAR ServiceName[MAX_SERVICE_NAME_LEN]; TCHAR ServiceName[MAX_SERVICE_NAME_LEN];
SP_DRVINFO_DETAIL_DATA DriverInfoDetailData; SP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
HKEY hDriverKey = INVALID_HANDLE_VALUE; /* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */ HKEY hDriverKey = INVALID_HANDLE_VALUE; /* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
HKEY hSettingsKey = NULL; HKEY hSettingsKey = NULL;
HKEY hServicesKey = NULL; HKEY hServicesKey = NULL;
HKEY hServiceKey = NULL; HKEY hServiceKey = NULL;
HKEY hDeviceSubKey = NULL; HKEY hDeviceSubKey = NULL;
DWORD disposition; DWORD disposition;
BOOL result; BOOL result;
LONG rc; LONG rc;
if (InstallFunction != DIF_INSTALLDEVICE) if (InstallFunction != DIF_INSTALLDEVICE)
return ERROR_DI_DO_DEFAULT; return ERROR_DI_DO_DEFAULT;
/* Set DI_DONOTCALLCONFIGMG flag */ /* Set DI_DONOTCALLCONFIGMG flag */
InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
result = SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams); result = SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc); DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
InstallParams.Flags |= DI_DONOTCALLCONFIGMG; InstallParams.Flags |= DI_DONOTCALLCONFIGMG;
result = SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams); result = SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc); DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Do normal install */ /* Do normal install */
result = SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData); result = SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiInstallDevice() failed with error 0x%lx\n", rc); DPRINT("SetupDiInstallDevice() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Get .inf file name and section name */ /* Get .inf file name and section name */
DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA); DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, &DriverInfoData); result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, &DriverInfoData);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiGetSelectedDriver() failed with error 0x%lx\n", rc); DPRINT("SetupDiGetSelectedDriver() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
result = SetupDiGetDriverInfoDetail( result = SetupDiGetDriverInfoDetail(
DeviceInfoSet, DeviceInfoData, DeviceInfoSet, DeviceInfoData,
&DriverInfoData, &DriverInfoDetailData, &DriverInfoData, &DriverInfoDetailData,
sizeof(SP_DRVINFO_DETAIL_DATA), NULL); sizeof(SP_DRVINFO_DETAIL_DATA), NULL);
if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER) if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", rc); DPRINT("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL); hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL);
if (hInf == INVALID_HANDLE_VALUE) if (hInf == INVALID_HANDLE_VALUE)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupOpenInfFile() failed with error 0x%lx\n", rc); DPRINT("SetupOpenInfFile() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
result = SetupDiGetActualSectionToInstall( result = SetupDiGetActualSectionToInstall(
hInf, DriverInfoDetailData.SectionName, hInf, DriverInfoDetailData.SectionName,
SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL); SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiGetActualSectionToInstall() failed with error 0x%lx\n", rc); DPRINT("SetupDiGetActualSectionToInstall() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
_tcscat(SectionName, _T(".SoftwareSettings")); _tcscat(SectionName, _T(".SoftwareSettings"));
/* Open driver registry key and create Settings subkey */ /* Open driver registry key and create Settings subkey */
hDriverKey = SetupDiOpenDevRegKey( hDriverKey = SetupDiOpenDevRegKey(
DeviceInfoSet, DeviceInfoData, DeviceInfoSet, DeviceInfoData,
DICS_FLAG_GLOBAL, 0, DIREG_DRV, DICS_FLAG_GLOBAL, 0, DIREG_DRV,
KEY_CREATE_SUB_KEY); KEY_CREATE_SUB_KEY);
if (hDriverKey == INVALID_HANDLE_VALUE) if (hDriverKey == INVALID_HANDLE_VALUE)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiOpenDevRegKey() failed with error 0x%lx\n", rc); DPRINT("SetupDiOpenDevRegKey() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
rc = RegCreateKeyEx( rc = RegCreateKeyEx(
hDriverKey, L"Settings", hDriverKey, L"Settings",
0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, REG_OPTION_NON_VOLATILE,
#if _WIN32_WINNT >= 0x502 #if _WIN32_WINNT >= 0x502
KEY_READ | KEY_WRITE, KEY_READ | KEY_WRITE,
#else #else
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
#endif #endif
NULL, &hSettingsKey, &disposition); NULL, &hSettingsKey, &disposition);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc); DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Install .SoftwareSettings to Settings subkey */ /* Install .SoftwareSettings to Settings subkey */
result = SetupInstallFromInfSection( result = SetupInstallFromInfSection(
InstallParams.hwndParent, hInf, SectionName, InstallParams.hwndParent, hInf, SectionName,
SPINST_REGISTRY, hSettingsKey, SPINST_REGISTRY, hSettingsKey,
NULL, 0, NULL, NULL, NULL, 0, NULL, NULL,
NULL, NULL); NULL, NULL);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc); DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Get service name and open service registry key */ /* Get service name and open service registry key */
result = SetupDiGetDeviceRegistryProperty( result = SetupDiGetDeviceRegistryProperty(
DeviceInfoSet, DeviceInfoData, DeviceInfoSet, DeviceInfoData,
SPDRP_SERVICE, NULL, SPDRP_SERVICE, NULL,
(PBYTE)ServiceName, MAX_SERVICE_NAME_LEN * sizeof(TCHAR), NULL); (PBYTE)ServiceName, MAX_SERVICE_NAME_LEN * sizeof(TCHAR), NULL);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupDiGetDeviceRegistryProperty() failed with error 0x%lx\n", rc); DPRINT("SetupDiGetDeviceRegistryProperty() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
rc = RegOpenKeyEx( rc = RegOpenKeyEx(
HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services"), HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services"),
0, KEY_ENUMERATE_SUB_KEYS, &hServicesKey); 0, KEY_ENUMERATE_SUB_KEYS, &hServicesKey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc); DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
rc = RegOpenKeyEx( rc = RegOpenKeyEx(
hServicesKey, ServiceName, hServicesKey, ServiceName,
0, KEY_CREATE_SUB_KEY, &hServiceKey); 0, KEY_CREATE_SUB_KEY, &hServiceKey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc); DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* Create a Device0 subkey (FIXME: do a loop to find a free number?) */ /* Create a Device0 subkey (FIXME: do a loop to find a free number?) */
rc = RegCreateKeyEx( rc = RegCreateKeyEx(
hServiceKey, _T("Device0"), 0, NULL, hServiceKey, _T("Device0"), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
&hDeviceSubKey, &disposition); &hDeviceSubKey, &disposition);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc); DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
if (disposition != REG_CREATED_NEW_KEY) if (disposition != REG_CREATED_NEW_KEY)
{ {
rc = ERROR_GEN_FAILURE; rc = ERROR_GEN_FAILURE;
DPRINT("RegCreateKeyEx() failed\n"); DPRINT("RegCreateKeyEx() failed\n");
goto cleanup; goto cleanup;
} }
/* Install SoftwareSettings section */ /* Install SoftwareSettings section */
/* Yes, we're installing this section for the second time. /* Yes, we're installing this section for the second time.
* We don't want to create a link to Settings subkey */ * We don't want to create a link to Settings subkey */
result = SetupInstallFromInfSection( result = SetupInstallFromInfSection(
InstallParams.hwndParent, hInf, SectionName, InstallParams.hwndParent, hInf, SectionName,
SPINST_REGISTRY, hDeviceSubKey, SPINST_REGISTRY, hDeviceSubKey,
NULL, 0, NULL, NULL, NULL, 0, NULL, NULL,
NULL, NULL); NULL, NULL);
if (!result) if (!result)
{ {
rc = GetLastError(); rc = GetLastError();
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc); DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
goto cleanup; goto cleanup;
} }
/* FIXME: install OpenGLSoftwareSettings section */ /* FIXME: install OpenGLSoftwareSettings section */
rc = ERROR_SUCCESS; rc = ERROR_SUCCESS;
cleanup: cleanup:
if (hInf != INVALID_HANDLE_VALUE) if (hInf != INVALID_HANDLE_VALUE)
SetupCloseInfFile(hInf); SetupCloseInfFile(hInf);
if (hDriverKey != INVALID_HANDLE_VALUE) if (hDriverKey != INVALID_HANDLE_VALUE)
{ {
/* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */ /* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
RegCloseKey(hDriverKey); RegCloseKey(hDriverKey);
} }
if (hSettingsKey != NULL) if (hSettingsKey != NULL)
RegCloseKey(hSettingsKey); RegCloseKey(hSettingsKey);
if (hServicesKey != NULL) if (hServicesKey != NULL)
RegCloseKey(hServicesKey); RegCloseKey(hServicesKey);
if (hServiceKey != NULL) if (hServiceKey != NULL)
RegCloseKey(hServiceKey); RegCloseKey(hServiceKey);
if (hDeviceSubKey != NULL) if (hDeviceSubKey != NULL)
RegCloseKey(hDeviceSubKey); RegCloseKey(hDeviceSubKey);
return rc; return rc;
} }

View file

@ -9,7 +9,7 @@
#include "desk.h" #include "desk.h"
#define NUM_APPLETS (1) #define NUM_APPLETS (1)
static LONG APIENTRY DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam); static LONG APIENTRY DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);

View file

@ -69,39 +69,39 @@ ULONG __cdecl DbgPrint(PCCH Format,...);
*/ */
typedef struct _RESOLUTION_INFO typedef struct _RESOLUTION_INFO
{ {
DWORD dmPelsWidth; DWORD dmPelsWidth;
DWORD dmPelsHeight; DWORD dmPelsHeight;
} RESOLUTION_INFO, *PRESOLUTION_INFO; } RESOLUTION_INFO, *PRESOLUTION_INFO;
typedef struct _SETTINGS_ENTRY typedef struct _SETTINGS_ENTRY
{ {
struct _SETTINGS_ENTRY *Blink; struct _SETTINGS_ENTRY *Blink;
struct _SETTINGS_ENTRY *Flink; struct _SETTINGS_ENTRY *Flink;
DWORD dmBitsPerPel; DWORD dmBitsPerPel;
DWORD dmPelsWidth; DWORD dmPelsWidth;
DWORD dmPelsHeight; DWORD dmPelsHeight;
DWORD dmDisplayFrequency; DWORD dmDisplayFrequency;
} SETTINGS_ENTRY, *PSETTINGS_ENTRY; } SETTINGS_ENTRY, *PSETTINGS_ENTRY;
typedef struct _DISPLAY_DEVICE_ENTRY typedef struct _DISPLAY_DEVICE_ENTRY
{ {
struct _DISPLAY_DEVICE_ENTRY *Flink; struct _DISPLAY_DEVICE_ENTRY *Flink;
LPTSTR DeviceDescription; LPTSTR DeviceDescription;
LPTSTR DeviceName; LPTSTR DeviceName;
LPTSTR DeviceKey; LPTSTR DeviceKey;
LPTSTR DeviceID; LPTSTR DeviceID;
DWORD DeviceStateFlags; DWORD DeviceStateFlags;
PSETTINGS_ENTRY Settings; /* Sorted by increasing dmPelsHeight, BPP */ PSETTINGS_ENTRY Settings; /* Sorted by increasing dmPelsHeight, BPP */
DWORD SettingsCount; DWORD SettingsCount;
PRESOLUTION_INFO Resolutions; PRESOLUTION_INFO Resolutions;
DWORD ResolutionsCount; DWORD ResolutionsCount;
PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */ PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */
SETTINGS_ENTRY InitialSettings; SETTINGS_ENTRY InitialSettings;
} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY; } DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY;
typedef struct _GLOBAL_DATA typedef struct _GLOBAL_DATA
{ {
COLORREF desktop_color; COLORREF desktop_color;
} GLOBAL_DATA, *PGLOBAL_DATA; } GLOBAL_DATA, *PGLOBAL_DATA;
extern GLOBAL_DATA g_GlobalData; extern GLOBAL_DATA g_GlobalData;

View file

@ -58,226 +58,226 @@ static const signed char LTRBInnerMono[] = {
static BOOL static BOOL
MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme) MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme)
{ {
signed char LTInnerI, LTOuterI; signed char LTInnerI, LTOuterI;
signed char RBInnerI, RBOuterI; signed char RBInnerI, RBOuterI;
HPEN LTInnerPen, LTOuterPen; HPEN LTInnerPen, LTOuterPen;
HPEN RBInnerPen, RBOuterPen; HPEN RBInnerPen, RBOuterPen;
RECT InnerRect = *rc; RECT InnerRect = *rc;
POINT SavePoint; POINT SavePoint;
HPEN SavePen; HPEN SavePen;
int LBpenplus = 0; int LBpenplus = 0;
int LTpenplus = 0; int LTpenplus = 0;
int RTpenplus = 0; int RTpenplus = 0;
int RBpenplus = 0; int RBpenplus = 0;
/* Init some vars */ /* Init some vars */
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN); LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, LTInnerPen); SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
/* Determine the colors of the edges */ /* Determine the colors of the edges */
LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)]; LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)]; LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)]; RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)]; RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
LBpenplus = 1; LBpenplus = 1;
if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
RTpenplus = 1; RTpenplus = 1;
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
RBpenplus = 1; RBpenplus = 1;
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
LTpenplus = 1; LTpenplus = 1;
if(LTInnerI != -1) if(LTInnerI != -1)
LTInnerPen = GetStockObject(DC_PEN); LTInnerPen = GetStockObject(DC_PEN);
if(LTOuterI != -1) if(LTOuterI != -1)
LTOuterPen = GetStockObject(DC_PEN); LTOuterPen = GetStockObject(DC_PEN);
if(RBInnerI != -1) if(RBInnerI != -1)
RBInnerPen = GetStockObject(DC_PEN); RBInnerPen = GetStockObject(DC_PEN);
if(RBOuterI != -1) if(RBOuterI != -1)
RBOuterPen = GetStockObject(DC_PEN); RBOuterPen = GetStockObject(DC_PEN);
{ {
HBRUSH hbr; HBRUSH hbr;
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]); hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
FillRect(hdc, &InnerRect, hbr); FillRect(hdc, &InnerRect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
MoveToEx(hdc, 0, 0, &SavePoint); MoveToEx(hdc, 0, 0, &SavePoint);
/* Draw the outer edge */ /* Draw the outer edge */
SelectObject(hdc, LTOuterPen); SelectObject(hdc, LTOuterPen);
SetDCPenColor(hdc, scheme->crColor[LTOuterI]); SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
if(uFlags & BF_TOP) if(uFlags & BF_TOP)
{ {
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL); MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
LineTo(hdc, InnerRect.right, InnerRect.top); LineTo(hdc, InnerRect.right, InnerRect.top);
} }
if(uFlags & BF_LEFT) if(uFlags & BF_LEFT)
{ {
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL); MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
LineTo(hdc, InnerRect.left, InnerRect.bottom); LineTo(hdc, InnerRect.left, InnerRect.bottom);
} }
SelectObject(hdc, RBOuterPen); SelectObject(hdc, RBOuterPen);
SetDCPenColor(hdc, scheme->crColor[RBOuterI]); SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
if(uFlags & BF_BOTTOM) if(uFlags & BF_BOTTOM)
{ {
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL); MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
LineTo(hdc, InnerRect.right, InnerRect.bottom-1); LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
} }
if(uFlags & BF_RIGHT) if(uFlags & BF_RIGHT)
{ {
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL); MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
LineTo(hdc, InnerRect.right-1, InnerRect.bottom); LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
} }
/* Draw the inner edge */ /* Draw the inner edge */
SelectObject(hdc, LTInnerPen); SelectObject(hdc, LTInnerPen);
SetDCPenColor(hdc, scheme->crColor[LTInnerI]); SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
if(uFlags & BF_TOP) if(uFlags & BF_TOP)
{ {
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL); MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1); LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
} }
if(uFlags & BF_LEFT) if(uFlags & BF_LEFT)
{ {
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL); MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus); LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
} }
SelectObject(hdc, RBInnerPen); SelectObject(hdc, RBInnerPen);
SetDCPenColor(hdc, scheme->crColor[RBInnerI]); SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
if(uFlags & BF_BOTTOM) if(uFlags & BF_BOTTOM)
{ {
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL); MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2); LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
} }
if(uFlags & BF_RIGHT) if(uFlags & BF_RIGHT)
{ {
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL); MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus); LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
} }
if (uFlags & BF_ADJUST) if (uFlags & BF_ADJUST)
{ {
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0) int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0); + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
if(uFlags & BF_LEFT) if(uFlags & BF_LEFT)
InnerRect.left += add; InnerRect.left += add;
if(uFlags & BF_RIGHT) if(uFlags & BF_RIGHT)
InnerRect.right -= add; InnerRect.right -= add;
if(uFlags & BF_TOP) if(uFlags & BF_TOP)
InnerRect.top += add; InnerRect.top += add;
if(uFlags & BF_BOTTOM) if(uFlags & BF_BOTTOM)
InnerRect.bottom -= add; InnerRect.bottom -= add;
if(uFlags & BF_ADJUST) if(uFlags & BF_ADJUST)
*rc = InnerRect; *rc = InnerRect;
} }
/* Cleanup */ /* Cleanup */
SelectObject(hdc, SavePen); SelectObject(hdc, SavePen);
MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL); MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
return TRUE; return TRUE;
} }
static BOOL static BOOL
MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme) MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme)
{ {
UINT edge; UINT edge;
if(uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT)) if(uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
edge = EDGE_SUNKEN; edge = EDGE_SUNKEN;
else else
edge = EDGE_RAISED; edge = EDGE_RAISED;
return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, scheme); return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, scheme);
} }
static int static int
MyMakeSquareRect(LPRECT src, LPRECT dst) MyMakeSquareRect(LPRECT src, LPRECT dst)
{ {
int Width = src->right - src->left; int Width = src->right - src->left;
int Height = src->bottom - src->top; int Height = src->bottom - src->top;
int SmallDiam = Width > Height ? Height : Width; int SmallDiam = Width > Height ? Height : Width;
*dst = *src; *dst = *src;
/* Make it a square box */ /* Make it a square box */
if (Width < Height) /* SmallDiam == Width */ if (Width < Height) /* SmallDiam == Width */
{ {
dst->top += (Height-Width)/2; dst->top += (Height-Width)/2;
dst->bottom = dst->top + SmallDiam; dst->bottom = dst->top + SmallDiam;
} }
else if(Width > Height) /* SmallDiam == Height */ else if(Width > Height) /* SmallDiam == Height */
{ {
dst->left += (Width-Height)/2; dst->left += (Width-Height)/2;
dst->right = dst->left + SmallDiam; dst->right = dst->left + SmallDiam;
} }
return SmallDiam; return SmallDiam;
} }
static BOOL static BOOL
MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme) MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
{ {
LOGFONT lf; LOGFONT lf;
HFONT hFont, hOldFont; HFONT hFont, hOldFont;
COLORREF clrsave; COLORREF clrsave;
RECT myr; RECT myr;
INT bkmode; INT bkmode;
TCHAR Symbol; TCHAR Symbol;
switch(uFlags & 0xff) switch(uFlags & 0xff)
{ {
case DFCS_CAPTIONCLOSE: case DFCS_CAPTIONCLOSE:
Symbol = 'r'; Symbol = 'r';
break; break;
case DFCS_CAPTIONHELP: case DFCS_CAPTIONHELP:
Symbol = 's'; Symbol = 's';
break; break;
case DFCS_CAPTIONMIN: case DFCS_CAPTIONMIN:
Symbol = '0'; Symbol = '0';
break; break;
case DFCS_CAPTIONMAX: case DFCS_CAPTIONMAX:
Symbol = '1'; Symbol = '1';
break; break;
case DFCS_CAPTIONRESTORE: case DFCS_CAPTIONRESTORE:
Symbol = '2'; Symbol = '2';
break; break;
} }
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme); MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme);
ZeroMemory(&lf, sizeof(LOGFONT)); ZeroMemory(&lf, sizeof(LOGFONT));
MyMakeSquareRect(r, &myr); MyMakeSquareRect(r, &myr);
myr.left += 1; myr.left += 1;
myr.top += 1; myr.top += 1;
myr.right -= 1; myr.right -= 1;
myr.bottom -= 1; myr.bottom -= 1;
if(uFlags & DFCS_PUSHED) if(uFlags & DFCS_PUSHED)
OffsetRect(&myr,1,1); OffsetRect(&myr,1,1);
lf.lfHeight = myr.bottom - myr.top; lf.lfHeight = myr.bottom - myr.top;
lf.lfWidth = 0; lf.lfWidth = 0;
lf.lfWeight = FW_NORMAL; lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET; lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, TEXT("Marlett")); lstrcpy(lf.lfFaceName, TEXT("Marlett"));
hFont = CreateFontIndirect(&lf); hFont = CreateFontIndirect(&lf);
/* Save font and text color */ /* Save font and text color */
hOldFont = SelectObject(dc, hFont); hOldFont = SelectObject(dc, hFont);
clrsave = GetTextColor(dc); clrsave = GetTextColor(dc);
bkmode = GetBkMode(dc); bkmode = GetBkMode(dc);
/* Set color and drawing mode */ /* Set color and drawing mode */
SetBkMode(dc, TRANSPARENT); SetBkMode(dc, TRANSPARENT);
if(uFlags & DFCS_INACTIVE) if(uFlags & DFCS_INACTIVE)
{ {
/* Draw shadow */ /* Draw shadow */
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]); SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1); TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
} }
SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]); SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
/* Draw selected symbol */ /* Draw selected symbol */
TextOut(dc, myr.left, myr.top, &Symbol, 1); TextOut(dc, myr.left, myr.top, &Symbol, 1);
/* Restore previous settings */ /* Restore previous settings */
SetTextColor(dc, clrsave); SetTextColor(dc, clrsave);
SelectObject(dc, hOldFont); SelectObject(dc, hOldFont);
SetBkMode(dc, bkmode); SetBkMode(dc, bkmode);
DeleteObject(hFont); DeleteObject(hFont);
return TRUE; return TRUE;
} }
/******************************************************************************/ /******************************************************************************/
@ -285,151 +285,151 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
static BOOL static BOOL
MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme) MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
{ {
LOGFONT lf; LOGFONT lf;
HFONT hFont, hOldFont; HFONT hFont, hOldFont;
COLORREF clrsave; COLORREF clrsave;
RECT myr; RECT myr;
INT bkmode; INT bkmode;
TCHAR Symbol; TCHAR Symbol;
switch(uFlags & 0xff) switch(uFlags & 0xff)
{ {
case DFCS_SCROLLCOMBOBOX: case DFCS_SCROLLCOMBOBOX:
case DFCS_SCROLLDOWN: case DFCS_SCROLLDOWN:
Symbol = '6'; Symbol = '6';
break; break;
case DFCS_SCROLLUP: case DFCS_SCROLLUP:
Symbol = '5'; Symbol = '5';
break; break;
case DFCS_SCROLLLEFT: case DFCS_SCROLLLEFT:
Symbol = '3'; Symbol = '3';
break; break;
case DFCS_SCROLLRIGHT: case DFCS_SCROLLRIGHT:
Symbol = '4'; Symbol = '4';
break; break;
} }
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme); MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme);
ZeroMemory(&lf, sizeof(LOGFONT)); ZeroMemory(&lf, sizeof(LOGFONT));
MyMakeSquareRect(r, &myr); MyMakeSquareRect(r, &myr);
myr.left += 1; myr.left += 1;
myr.top += 1; myr.top += 1;
myr.right -= 1; myr.right -= 1;
myr.bottom -= 1; myr.bottom -= 1;
if(uFlags & DFCS_PUSHED) if(uFlags & DFCS_PUSHED)
OffsetRect(&myr,1,1); OffsetRect(&myr,1,1);
lf.lfHeight = myr.bottom - myr.top; lf.lfHeight = myr.bottom - myr.top;
lf.lfWidth = 0; lf.lfWidth = 0;
lf.lfWeight = FW_NORMAL; lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET; lf.lfCharSet = DEFAULT_CHARSET;
lstrcpy(lf.lfFaceName, TEXT("Marlett")); lstrcpy(lf.lfFaceName, TEXT("Marlett"));
hFont = CreateFontIndirect(&lf); hFont = CreateFontIndirect(&lf);
/* Save font and text color */ /* Save font and text color */
hOldFont = SelectObject(dc, hFont); hOldFont = SelectObject(dc, hFont);
clrsave = GetTextColor(dc); clrsave = GetTextColor(dc);
bkmode = GetBkMode(dc); bkmode = GetBkMode(dc);
/* Set color and drawing mode */ /* Set color and drawing mode */
SetBkMode(dc, TRANSPARENT); SetBkMode(dc, TRANSPARENT);
if(uFlags & DFCS_INACTIVE) if(uFlags & DFCS_INACTIVE)
{ {
/* Draw shadow */ /* Draw shadow */
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]); SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1); TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
} }
SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]); SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
/* Draw selected symbol */ /* Draw selected symbol */
TextOut(dc, myr.left, myr.top, &Symbol, 1); TextOut(dc, myr.left, myr.top, &Symbol, 1);
/* restore previous settings */ /* restore previous settings */
SetTextColor(dc, clrsave); SetTextColor(dc, clrsave);
SelectObject(dc, hOldFont); SelectObject(dc, hOldFont);
SetBkMode(dc, bkmode); SetBkMode(dc, bkmode);
DeleteObject(hFont); DeleteObject(hFont);
return TRUE; return TRUE;
} }
BOOL BOOL
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme) MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
{ {
switch(uType) switch(uType)
{ {
case DFC_BUTTON: case DFC_BUTTON:
return MyDrawFrameButton(hDC, rc, uState, scheme); return MyDrawFrameButton(hDC, rc, uState, scheme);
case DFC_CAPTION: case DFC_CAPTION:
return MyDrawFrameCaption(hDC, rc, uState, scheme); return MyDrawFrameCaption(hDC, rc, uState, scheme);
case DFC_SCROLL: case DFC_SCROLL:
return MyDrawFrameScroll(hDC, rc, uState, scheme); return MyDrawFrameScroll(hDC, rc, uState, scheme);
} }
return FALSE; return FALSE;
} }
BOOL BOOL
MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, COLOR_SCHEME *scheme) MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, COLOR_SCHEME *scheme)
{ {
return MyIntDrawRectEdge(hDC, rc, edge, flags, scheme); return MyIntDrawRectEdge(hDC, rc, edge, flags, scheme);
} }
VOID VOID
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme) MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme)
{ {
RECT rc3; RECT rc3;
RECT rc4; RECT rc4;
RECT rc5; RECT rc5;
rc3.left = lpRect->right - 2 - x; rc3.left = lpRect->right - 2 - x;
rc3.top = lpRect->top + 2; rc3.top = lpRect->top + 2;
rc3.right = lpRect->right - 2; rc3.right = lpRect->right - 2;
rc3.bottom = lpRect->bottom - 2; rc3.bottom = lpRect->bottom - 2;
MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, scheme); MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, scheme);
if (bMinMax) if (bMinMax)
{ {
rc4.left = rc3.left - x - 2; rc4.left = rc3.left - x - 2;
rc4.top = rc3.top; rc4.top = rc3.top;
rc4.right = rc3.right - x - 2; rc4.right = rc3.right - x - 2;
rc4.bottom = rc3.bottom; rc4.bottom = rc3.bottom;
MyDrawFrameControl(hdc, &rc4, DFC_CAPTION, DFCS_CAPTIONMAX, scheme); MyDrawFrameControl(hdc, &rc4, DFC_CAPTION, DFCS_CAPTIONMAX, scheme);
rc5.left = rc4.left - x; rc5.left = rc4.left - x;
rc5.top = rc4.top; rc5.top = rc4.top;
rc5.right = rc4.right - x; rc5.right = rc4.right - x;
rc5.bottom = rc4.bottom; rc5.bottom = rc4.bottom;
MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, scheme); MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, scheme);
} }
} }
VOID VOID
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme) MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme)
{ {
RECT rcTop; RECT rcTop;
RECT rcBottom; RECT rcBottom;
RECT rcMiddle; RECT rcMiddle;
int width; int width;
width = rc->right - rc->left; width = rc->right - rc->left;
rcTop.left = rc->left; rcTop.left = rc->left;
rcTop.right = rc->right; rcTop.right = rc->right;
rcTop.top = rc->top; rcTop.top = rc->top;
rcTop.bottom = rc->top + width; rcTop.bottom = rc->top + width;
rcMiddle.left = rc->left; rcMiddle.left = rc->left;
rcMiddle.right = rc->right; rcMiddle.right = rc->right;
rcMiddle.top = rc->top + width; rcMiddle.top = rc->top + width;
rcMiddle.bottom = rc->bottom - width; rcMiddle.bottom = rc->bottom - width;
rcBottom.left = rc->left; rcBottom.left = rc->left;
rcBottom.right = rc->right; rcBottom.right = rc->right;
rcBottom.top = rc->bottom - width; rcBottom.top = rc->bottom - width;
rcBottom.bottom = rc->bottom; rcBottom.bottom = rc->bottom;
MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, scheme); MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, scheme);
MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, scheme); MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, scheme);
FillRect(hdc, &rcMiddle, hbrScrollbar); FillRect(hdc, &rcMiddle, hbrScrollbar);
} }
/******************************************************************************/ /******************************************************************************/
@ -437,69 +437,69 @@ MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme)
BOOL BOOL
MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, COLOR_SCHEME *scheme) MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, COLOR_SCHEME *scheme)
{ {
//ULONG Height; //ULONG Height;
//UINT VCenter, Padding; //UINT VCenter, Padding;
//LONG ButtonWidth; //LONG ButtonWidth;
HBRUSH hbr; HBRUSH hbr;
HGDIOBJ hFontOld; HGDIOBJ hFontOld;
RECT rc; RECT rc;
//Height = scheme->Size[SIZE_CAPTION_Y] - 1; //Height = scheme->Size[SIZE_CAPTION_Y] - 1;
//VCenter = (rect->bottom - rect->top) / 2; //VCenter = (rect->bottom - rect->top) / 2;
//Padding = VCenter - (Height / 2); //Padding = VCenter - (Height / 2);
//ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2; //ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2;
if (uFlags & DC_GRADIENT) if (uFlags & DC_GRADIENT)
{ {
GRADIENT_RECT gcap = {0, 1}; GRADIENT_RECT gcap = {0, 1};
TRIVERTEX vert[2]; TRIVERTEX vert[2];
COLORREF Colors[2]; COLORREF Colors[2];
Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ? Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ?
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)]; COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)];
Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ? Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ?
COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)]; COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)];
vert[0].x = rect->left; vert[0].x = rect->left;
vert[0].y = rect->top; vert[0].y = rect->top;
vert[0].Red = (WORD)Colors[0]<<8; vert[0].Red = (WORD)Colors[0]<<8;
vert[0].Green = (WORD)Colors[0] & 0xFF00; vert[0].Green = (WORD)Colors[0] & 0xFF00;
vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00; vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
vert[0].Alpha = 0; vert[0].Alpha = 0;
vert[1].x = rect->right; vert[1].x = rect->right;
vert[1].y = rect->bottom; vert[1].y = rect->bottom;
vert[1].Red = (WORD)Colors[1]<<8; vert[1].Red = (WORD)Colors[1]<<8;
vert[1].Green = (WORD)Colors[1] & 0xFF00; vert[1].Green = (WORD)Colors[1] & 0xFF00;
vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00; vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
vert[1].Alpha = 0; vert[1].Alpha = 0;
GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H); GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
} }
else else
{ {
if (uFlags & DC_ACTIVE) if (uFlags & DC_ACTIVE)
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVECAPTION]); hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVECAPTION]);
else else
hbr = CreateSolidBrush(scheme->crColor[COLOR_INACTIVECAPTION]); hbr = CreateSolidBrush(scheme->crColor[COLOR_INACTIVECAPTION]);
FillRect(hdc, rect, hbr); FillRect(hdc, rect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
hFontOld = SelectObject(hdc, hFont); hFontOld = SelectObject(hdc, hFont);
SetBkMode(hdc, TRANSPARENT); SetBkMode(hdc, TRANSPARENT);
if (uFlags & DC_ACTIVE) if (uFlags & DC_ACTIVE)
SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]); SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]);
else else
SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]); SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]);
rc.left = rect->left + 2; rc.left = rect->left + 2;
rc.top = rect->top; rc.top = rect->top;
rc.right = rect->right; rc.right = rect->right;
rc.bottom = rect->bottom; rc.bottom = rect->bottom;
DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER); DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER);
SelectObject(hdc, hFontOld); SelectObject(hdc, hFontOld);
return TRUE; return TRUE;
} }
/******************************************************************************/ /******************************************************************************/
@ -507,99 +507,99 @@ MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon
DWORD DWORD
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme) MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme)
{ {
HBRUSH hbr; HBRUSH hbr;
HPEN hPen; HPEN hPen;
HGDIOBJ hPenOld, hFontOld; HGDIOBJ hPenOld, hFontOld;
BOOL flat_menu; BOOL flat_menu;
INT i, bkgnd, x; INT i, bkgnd, x;
RECT rect; RECT rect;
WCHAR Text[128]; WCHAR Text[128];
UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE; UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
flat_menu = scheme->bFlatMenus; flat_menu = scheme->bFlatMenus;
if (flat_menu) if (flat_menu)
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]); hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]);
else else
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]); hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]);
FillRect(DC, Rect, hbr); FillRect(DC, Rect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
hPen = CreatePen(PS_SOLID, 0, scheme->crColor[COLOR_3DFACE]); hPen = CreatePen(PS_SOLID, 0, scheme->crColor[COLOR_3DFACE]);
hPenOld = SelectObject(DC, hPen); hPenOld = SelectObject(DC, hPen);
MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL); MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL);
LineTo(DC, Rect->right, Rect->bottom - 1); LineTo(DC, Rect->right, Rect->bottom - 1);
SelectObject(DC, hPenOld); SelectObject(DC, hPenOld);
DeleteObject(hPen); DeleteObject(hPen);
bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU); bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU);
x = Rect->left; x = Rect->left;
hFontOld = SelectObject(DC, Font); hFontOld = SelectObject(DC, Font);
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
{ {
GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION); GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
rect.left = rect.right = x; rect.left = rect.right = x;
rect.top = Rect->top; rect.top = Rect->top;
rect.bottom = Rect->bottom; rect.bottom = Rect->bottom;
DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT); DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
rect.bottom = Rect->bottom; rect.bottom = Rect->bottom;
rect.right += MENU_BAR_ITEMS_SPACE; rect.right += MENU_BAR_ITEMS_SPACE;
x += rect.right - rect.left; x += rect.right - rect.left;
if (i == 2) if (i == 2)
{ {
if (flat_menu) if (flat_menu)
{ {
SetTextColor(DC, scheme->crColor[COLOR_HIGHLIGHTTEXT]); SetTextColor(DC, scheme->crColor[COLOR_HIGHLIGHTTEXT]);
SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]); SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]);
InflateRect (&rect, -1, -1); InflateRect (&rect, -1, -1);
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]); hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]);
FillRect(DC, &rect, hbr); FillRect(DC, &rect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
InflateRect (&rect, 1, 1); InflateRect (&rect, 1, 1);
hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]); hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]);
FrameRect(DC, &rect, hbr); FrameRect(DC, &rect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
else else
{ {
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]); SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
SetBkColor(DC, scheme->crColor[COLOR_MENU]); SetBkColor(DC, scheme->crColor[COLOR_MENU]);
DrawEdge(DC, &rect, BDR_SUNKENOUTER, BF_RECT); DrawEdge(DC, &rect, BDR_SUNKENOUTER, BF_RECT);
} }
} }
else else
{ {
if (i == 1) if (i == 1)
SetTextColor(DC, scheme->crColor[COLOR_GRAYTEXT]); SetTextColor(DC, scheme->crColor[COLOR_GRAYTEXT]);
else else
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]); SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
SetBkColor(DC, scheme->crColor[bkgnd]); SetBkColor(DC, scheme->crColor[bkgnd]);
hbr = CreateSolidBrush(scheme->crColor[bkgnd]); hbr = CreateSolidBrush(scheme->crColor[bkgnd]);
FillRect(DC, &rect, hbr); FillRect(DC, &rect, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
SetBkMode(DC, TRANSPARENT); SetBkMode(DC, TRANSPARENT);
rect.left += MENU_BAR_ITEMS_SPACE / 2; rect.left += MENU_BAR_ITEMS_SPACE / 2;
rect.right -= MENU_BAR_ITEMS_SPACE / 2; rect.right -= MENU_BAR_ITEMS_SPACE / 2;
if (i == 1) if (i == 1)
{ {
++rect.left; ++rect.top; ++rect.right; ++rect.bottom; ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
SetTextColor(DC, RGB(0xff, 0xff, 0xff)); SetTextColor(DC, RGB(0xff, 0xff, 0xff));
DrawTextW(DC, Text, -1, &rect, uFormat); DrawTextW(DC, Text, -1, &rect, uFormat);
--rect.left; --rect.top; --rect.right; --rect.bottom; --rect.left; --rect.top; --rect.right; --rect.bottom;
SetTextColor(DC, RGB(0x80, 0x80, 0x80)); SetTextColor(DC, RGB(0x80, 0x80, 0x80));
} }
DrawTextW(DC, Text, -1, &rect, uFormat); DrawTextW(DC, Text, -1, &rect, uFormat);
} }
SelectObject(DC, hFontOld); SelectObject(DC, hFontOld);
return TRUE; return TRUE;
} }

View file

@ -82,61 +82,61 @@ EffAppearanceDlg_CleanUp(HWND hwndDlg, GLOBALS* g)
INT_PTR CALLBACK INT_PTR CALLBACK
EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
GLOBALS* g; GLOBALS* g;
g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER); g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
g = (GLOBALS*)lParam; g = (GLOBALS*)lParam;
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
EffAppearanceDlg_Init(hwndDlg, g); EffAppearanceDlg_Init(hwndDlg, g);
break; break;
case WM_DESTROY: case WM_DESTROY:
EffAppearanceDlg_CleanUp(hwndDlg, g); EffAppearanceDlg_CleanUp(hwndDlg, g);
break; break;
case WM_COMMAND: case WM_COMMAND:
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case IDOK: case IDOK:
SaveCurrentValues(hwndDlg, g); SaveCurrentValues(hwndDlg, g);
EndDialog(hwndDlg, IDOK); EndDialog(hwndDlg, IDOK);
break; break;
case IDCANCEL: case IDCANCEL:
g->SchemeAdv = g->Scheme; g->SchemeAdv = g->Scheme;
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
break; break;
case IDC_EFFAPPEARANCE_ANIMATION: case IDC_EFFAPPEARANCE_ANIMATION:
case IDC_EFFAPPEARANCE_KEYBOARDCUES: case IDC_EFFAPPEARANCE_KEYBOARDCUES:
case IDC_EFFAPPEARANCE_DRAGFULLWINDOWS: case IDC_EFFAPPEARANCE_DRAGFULLWINDOWS:
if (HIWORD(wParam) == BN_CLICKED) if (HIWORD(wParam) == BN_CLICKED)
{ {
UpdateControls(hwndDlg, g); UpdateControls(hwndDlg, g);
} }
break; break;
case IDC_EFFAPPEARANCE_ANIMATIONTYPE: case IDC_EFFAPPEARANCE_ANIMATIONTYPE:
if (HIWORD(wParam) == CBN_SELCHANGE) if (HIWORD(wParam) == CBN_SELCHANGE)
{ {
SaveCurrentValues(hwndDlg, g); SaveCurrentValues(hwndDlg, g);
g->SchemeAdv.Effects.bMenuFade = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_GETCURSEL, 0, 0); g->SchemeAdv.Effects.bMenuFade = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_GETCURSEL, 0, 0);
UpdateControls(hwndDlg, g); UpdateControls(hwndDlg, g);
} }
break; break;
default: default:
return FALSE; return FALSE;
} }
break; break;
default: default:
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }

View file

@ -123,21 +123,21 @@ AdvGeneralPageProc(HWND hwndDlg,
Ret = TRUE; Ret = TRUE;
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_FONTSIZE_COMBO: case IDC_FONTSIZE_COMBO:
if (HIWORD(wParam) == CBN_SELCHANGE) if (HIWORD(wParam) == CBN_SELCHANGE)
{ {
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
} }
break; break;
case IDC_RESTART_RB: case IDC_RESTART_RB:
case IDC_WITHOUTREBOOT_RB: case IDC_WITHOUTREBOOT_RB:
case IDC_ASKME_RB: case IDC_ASKME_RB:
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break; break;
} }
break; break;
} }
return Ret; return Ret;

View file

@ -157,9 +157,9 @@
#define IDS_UNKNOWNMONITOR 3301 #define IDS_UNKNOWNMONITOR 3301
#define IDS_ADVANCEDTITLEFMT 3302 #define IDS_ADVANCEDTITLEFMT 3302
#define IDS_DISPLAY_SETTINGS 3400 #define IDS_DISPLAY_SETTINGS 3400
#define IDS_APPLY_FAILED 3500 #define IDS_APPLY_FAILED 3500
#define IDS_APPLY_NEEDS_RESTART 3501 #define IDS_APPLY_NEEDS_RESTART 3501
/* Effects Appearance Dialog */ /* Effects Appearance Dialog */

File diff suppressed because it is too large Load diff

View file

@ -24,360 +24,360 @@ SCHEME_PRESET g_ColorSchemes[MAX_TEMPLATES];
/* This is the list of names for the colors stored in the registry */ /* This is the list of names for the colors stored in the registry */
static const TCHAR *g_RegColorNames[NUM_COLORS] = static const TCHAR *g_RegColorNames[NUM_COLORS] =
{TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */ {TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */
TEXT("Background"), /* 01 = COLOR_DESKTOP */ TEXT("Background"), /* 01 = COLOR_DESKTOP */
TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */ TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */
TEXT("InactiveTitle"), /* 03 = COLOR_INACTIVECAPTION */ TEXT("InactiveTitle"), /* 03 = COLOR_INACTIVECAPTION */
TEXT("Menu"), /* 04 = COLOR_MENU */ TEXT("Menu"), /* 04 = COLOR_MENU */
TEXT("Window"), /* 05 = COLOR_WINDOW */ TEXT("Window"), /* 05 = COLOR_WINDOW */
TEXT("WindowFrame"), /* 06 = COLOR_WINDOWFRAME */ TEXT("WindowFrame"), /* 06 = COLOR_WINDOWFRAME */
TEXT("MenuText"), /* 07 = COLOR_MENUTEXT */ TEXT("MenuText"), /* 07 = COLOR_MENUTEXT */
TEXT("WindowText"), /* 08 = COLOR_WINDOWTEXT */ TEXT("WindowText"), /* 08 = COLOR_WINDOWTEXT */
TEXT("TitleText"), /* 09 = COLOR_CAPTIONTEXT */ TEXT("TitleText"), /* 09 = COLOR_CAPTIONTEXT */
TEXT("ActiveBorder"), /* 10 = COLOR_ACTIVEBORDER */ TEXT("ActiveBorder"), /* 10 = COLOR_ACTIVEBORDER */
TEXT("InactiveBorder"), /* 11 = COLOR_INACTIVEBORDER */ TEXT("InactiveBorder"), /* 11 = COLOR_INACTIVEBORDER */
TEXT("AppWorkSpace"), /* 12 = COLOR_APPWORKSPACE */ TEXT("AppWorkSpace"), /* 12 = COLOR_APPWORKSPACE */
TEXT("Hilight"), /* 13 = COLOR_HIGHLIGHT */ TEXT("Hilight"), /* 13 = COLOR_HIGHLIGHT */
TEXT("HilightText"), /* 14 = COLOR_HIGHLIGHTTEXT */ TEXT("HilightText"), /* 14 = COLOR_HIGHLIGHTTEXT */
TEXT("ButtonFace"), /* 15 = COLOR_BTNFACE */ TEXT("ButtonFace"), /* 15 = COLOR_BTNFACE */
TEXT("ButtonShadow"), /* 16 = COLOR_BTNSHADOW */ TEXT("ButtonShadow"), /* 16 = COLOR_BTNSHADOW */
TEXT("GrayText"), /* 17 = COLOR_GRAYTEXT */ TEXT("GrayText"), /* 17 = COLOR_GRAYTEXT */
TEXT("ButtonText"), /* 18 = COLOR_BTNTEXT */ TEXT("ButtonText"), /* 18 = COLOR_BTNTEXT */
TEXT("InactiveTitleText"), /* 19 = COLOR_INACTIVECAPTIONTEXT */ TEXT("InactiveTitleText"), /* 19 = COLOR_INACTIVECAPTIONTEXT */
TEXT("ButtonHilight"), /* 20 = COLOR_BTNHIGHLIGHT */ TEXT("ButtonHilight"), /* 20 = COLOR_BTNHIGHLIGHT */
TEXT("ButtonDkShadow"), /* 21 = COLOR_3DDKSHADOW */ TEXT("ButtonDkShadow"), /* 21 = COLOR_3DDKSHADOW */
TEXT("ButtonLight"), /* 22 = COLOR_3DLIGHT */ TEXT("ButtonLight"), /* 22 = COLOR_3DLIGHT */
TEXT("InfoText"), /* 23 = COLOR_INFOTEXT */ TEXT("InfoText"), /* 23 = COLOR_INFOTEXT */
TEXT("InfoWindow"), /* 24 = COLOR_INFOBK */ TEXT("InfoWindow"), /* 24 = COLOR_INFOBK */
TEXT("ButtonAlternateFace"), /* 25 = COLOR_ALTERNATEBTNFACE */ TEXT("ButtonAlternateFace"), /* 25 = COLOR_ALTERNATEBTNFACE */
TEXT("HotTrackingColor"), /* 26 = COLOR_HOTLIGHT */ TEXT("HotTrackingColor"), /* 26 = COLOR_HOTLIGHT */
TEXT("GradientActiveTitle"), /* 27 = COLOR_GRADIENTACTIVECAPTION */ TEXT("GradientActiveTitle"), /* 27 = COLOR_GRADIENTACTIVECAPTION */
TEXT("GradientInactiveTitle"), /* 28 = COLOR_GRADIENTINACTIVECAPTION */ TEXT("GradientInactiveTitle"), /* 28 = COLOR_GRADIENTINACTIVECAPTION */
TEXT("MenuHilight"), /* 29 = COLOR_MENUHILIGHT */ TEXT("MenuHilight"), /* 29 = COLOR_MENUHILIGHT */
TEXT("MenuBar"), /* 30 = COLOR_MENUBAR */ TEXT("MenuBar"), /* 30 = COLOR_MENUBAR */
}; };
/* This is the list of used metrics and their numbers */ /* This is the list of used metrics and their numbers */
static const int g_SizeMetric[NUM_SIZES] = static const int g_SizeMetric[NUM_SIZES] =
{ {
SM_CXBORDER, /* 00: SIZE_BORDER_X */ SM_CXBORDER, /* 00: SIZE_BORDER_X */
SM_CYBORDER, /* 01: SIZE_BORDER_Y */ SM_CYBORDER, /* 01: SIZE_BORDER_Y */
SM_CYSIZE, /* 02: SIZE_CAPTION_Y */ SM_CYSIZE, /* 02: SIZE_CAPTION_Y */
SM_CXICON, /* 03: SIZE_ICON_X */ SM_CXICON, /* 03: SIZE_ICON_X */
SM_CYICON, /* 04: SIZE_ICON_Y */ SM_CYICON, /* 04: SIZE_ICON_Y */
SM_CXICONSPACING, /* 05: SIZE_ICON_SPC_X */ SM_CXICONSPACING, /* 05: SIZE_ICON_SPC_X */
SM_CYICONSPACING, /* 06: SIZE_ICON_SPC_Y */ SM_CYICONSPACING, /* 06: SIZE_ICON_SPC_Y */
SM_CXMENUSIZE, /* 07: SIZE_MENU_SIZE_X */ SM_CXMENUSIZE, /* 07: SIZE_MENU_SIZE_X */
SM_CYMENU, /* 08: SIZE_MENU_Y */ SM_CYMENU, /* 08: SIZE_MENU_Y */
SM_CXVSCROLL, /* 09: SIZE_SCROLL_X */ SM_CXVSCROLL, /* 09: SIZE_SCROLL_X */
SM_CYHSCROLL, /* 10: SIZE_SCROLL_Y */ SM_CYHSCROLL, /* 10: SIZE_SCROLL_Y */
SM_CYSMSIZE, /* 11: SIZE_SMCAPTION_Y */ SM_CYSMSIZE, /* 11: SIZE_SMCAPTION_Y */
SM_CXEDGE, /* 12: SIZE_EDGE_X */ SM_CXEDGE, /* 12: SIZE_EDGE_X */
SM_CYEDGE, /* 13: SIZE_EDGE_Y */ SM_CYEDGE, /* 13: SIZE_EDGE_Y */
SM_CYSIZEFRAME, /* 14: SIZE_FRAME_Y */ SM_CYSIZEFRAME, /* 14: SIZE_FRAME_Y */
SM_CXMENUCHECK, /* 15: SIZE_MENU_CHECK_X */ SM_CXMENUCHECK, /* 15: SIZE_MENU_CHECK_X */
SM_CYMENUCHECK, /* 16: SIZE_MENU_CHECK_Y */ SM_CYMENUCHECK, /* 16: SIZE_MENU_CHECK_Y */
SM_CYMENUSIZE, /* 17: SIZE_MENU_SIZE_Y */ SM_CYMENUSIZE, /* 17: SIZE_MENU_SIZE_Y */
SM_CXSIZE, /* 18: SIZE_SIZE_X */ SM_CXSIZE, /* 18: SIZE_SIZE_X */
SM_CYSIZE /* 19: SIZE_SIZE_Y */ SM_CYSIZE /* 19: SIZE_SIZE_Y */
}; };
/******************************************************************************/ /******************************************************************************/
VOID LoadCurrentScheme(COLOR_SCHEME* scheme) VOID LoadCurrentScheme(COLOR_SCHEME* scheme)
{ {
INT i; INT i;
NONCLIENTMETRICS NonClientMetrics; NONCLIENTMETRICS NonClientMetrics;
/* Load colors */ /* Load colors */
for (i = 0; i < NUM_COLORS; i++) for (i = 0; i < NUM_COLORS; i++)
{ {
g_ColorList[i] = i; g_ColorList[i] = i;
scheme->crColor[i] = (COLORREF)GetSysColor(i); scheme->crColor[i] = (COLORREF)GetSysColor(i);
} }
/* Load sizes */ /* Load sizes */
for (i = 0; i < NUM_SIZES; i++) for (i = 0; i < NUM_SIZES; i++)
{ {
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]); scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
} }
/* Load fonts */ /* Load fonts */
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS); NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
scheme->lfFont[FONT_CAPTION] = NonClientMetrics.lfCaptionFont; scheme->lfFont[FONT_CAPTION] = NonClientMetrics.lfCaptionFont;
scheme->lfFont[FONT_SMCAPTION] = NonClientMetrics.lfSmCaptionFont; scheme->lfFont[FONT_SMCAPTION] = NonClientMetrics.lfSmCaptionFont;
scheme->lfFont[FONT_MENU] = NonClientMetrics.lfMenuFont; scheme->lfFont[FONT_MENU] = NonClientMetrics.lfMenuFont;
scheme->lfFont[FONT_INFO] = NonClientMetrics.lfStatusFont; scheme->lfFont[FONT_INFO] = NonClientMetrics.lfStatusFont;
scheme->lfFont[FONT_DIALOG] = NonClientMetrics.lfMessageFont; scheme->lfFont[FONT_DIALOG] = NonClientMetrics.lfMessageFont;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &scheme->lfFont[FONT_ICON], 0); SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &scheme->lfFont[FONT_ICON], 0);
/* Effects */ /* Effects */
/* "Use the following transition effect for menus and tooltips" */ /* "Use the following transition effect for menus and tooltips" */
SystemParametersInfo(SPI_GETMENUANIMATION, sizeof(BOOL), &scheme->Effects.bMenuAnimation, 0); SystemParametersInfo(SPI_GETMENUANIMATION, sizeof(BOOL), &scheme->Effects.bMenuAnimation, 0);
SystemParametersInfo(SPI_GETMENUFADE, sizeof(BOOL), &scheme->Effects.bMenuFade, 0); SystemParametersInfo(SPI_GETMENUFADE, sizeof(BOOL), &scheme->Effects.bMenuFade, 0);
/* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings /* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
* Just keep them in sync for now: * Just keep them in sync for now:
*/ */
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation; scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade; scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
/* Show content of windows during dragging */ /* Show content of windows during dragging */
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &scheme->Effects.bDragFullWindows, 0); SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &scheme->Effects.bDragFullWindows, 0);
/* "Hide underlined letters for keyboard navigation until I press the Alt key" */ /* "Hide underlined letters for keyboard navigation until I press the Alt key" */
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &scheme->Effects.bKeyboardCues, 0); SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &scheme->Effects.bKeyboardCues, 0);
} }
BOOL LoadSchemeFromReg(COLOR_SCHEME* scheme, INT SchemeId) BOOL LoadSchemeFromReg(COLOR_SCHEME* scheme, INT SchemeId)
{ {
INT i; INT i;
TCHAR strSelectedStyle[4]; TCHAR strSelectedStyle[4];
TCHAR strSizeName[20] = TEXT("Sizes\\0"); TCHAR strSizeName[20] = TEXT("Sizes\\0");
TCHAR strValueName[10]; TCHAR strValueName[10];
HKEY hkNewSchemes, hkScheme, hkSize; HKEY hkNewSchemes, hkScheme, hkSize;
DWORD dwType, dwLength; DWORD dwType, dwLength;
UINT64 iSize; UINT64 iSize;
BOOL Ret = FALSE; BOOL Ret = FALSE;
if (!g_PresetLoaded) if (!g_PresetLoaded)
LoadSchemePresetEntries(strSelectedStyle); LoadSchemePresetEntries(strSelectedStyle);
if (SchemeId == -1) if (SchemeId == -1)
return FALSE; return FALSE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_READ, &hkNewSchemes) == ERROR_SUCCESS) if (RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_READ, &hkNewSchemes) == ERROR_SUCCESS)
{ {
if (RegOpenKeyEx(hkNewSchemes, g_ColorSchemes[SchemeId].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS) if (RegOpenKeyEx(hkNewSchemes, g_ColorSchemes[SchemeId].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS)
{ {
lstrcpyn(&strSizeName[6], g_ColorSchemes[SchemeId].strSizeName, 3); lstrcpyn(&strSizeName[6], g_ColorSchemes[SchemeId].strSizeName, 3);
if (RegOpenKeyEx(hkScheme, strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS) if (RegOpenKeyEx(hkScheme, strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
{ {
Ret = TRUE; Ret = TRUE;
dwLength = sizeof(DWORD); dwLength = sizeof(DWORD);
if (RegQueryValueEx(hkSize, TEXT("FlatMenus"), NULL, &dwType, (LPBYTE)&scheme->bFlatMenus, &dwLength) != ERROR_SUCCESS || if (RegQueryValueEx(hkSize, TEXT("FlatMenus"), NULL, &dwType, (LPBYTE)&scheme->bFlatMenus, &dwLength) != ERROR_SUCCESS ||
dwType != REG_DWORD) dwType != REG_DWORD)
{ {
/* Failed to read registry value */ /* Failed to read registry value */
scheme->bFlatMenus = FALSE; scheme->bFlatMenus = FALSE;
} }
for (i = 0; i < NUM_COLORS; i++) for (i = 0; i < NUM_COLORS; i++)
{ {
wsprintf(strValueName, TEXT("Color #%d"), i); wsprintf(strValueName, TEXT("Color #%d"), i);
dwLength = sizeof(COLORREF); dwLength = sizeof(COLORREF);
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->crColor[i], &dwLength) != ERROR_SUCCESS || if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->crColor[i], &dwLength) != ERROR_SUCCESS ||
dwType != REG_DWORD) dwType != REG_DWORD)
{ {
/* Failed to read registry value, initialize with current setting for now */ /* Failed to read registry value, initialize with current setting for now */
scheme->crColor[i] = GetSysColor(i); scheme->crColor[i] = GetSysColor(i);
} }
} }
for (i = 0; i < NUM_FONTS; i++) for (i = 0; i < NUM_FONTS; i++)
{ {
wsprintf(strValueName, TEXT("Font #%d"), i); wsprintf(strValueName, TEXT("Font #%d"), i);
dwLength = sizeof(LOGFONT); dwLength = sizeof(LOGFONT);
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->lfFont[i], &dwLength) != ERROR_SUCCESS || if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->lfFont[i], &dwLength) != ERROR_SUCCESS ||
dwType != REG_BINARY || dwLength != sizeof(LOGFONT)) dwType != REG_BINARY || dwLength != sizeof(LOGFONT))
{ {
/* Failed to read registry value */ /* Failed to read registry value */
Ret = FALSE; Ret = FALSE;
} }
} }
for (i = 0; i < NUM_SIZES; i++) for (i = 0; i < NUM_SIZES; i++)
{ {
wsprintf(strValueName, TEXT("Size #%d"), i); wsprintf(strValueName, TEXT("Size #%d"), i);
dwLength = sizeof(UINT64); dwLength = sizeof(UINT64);
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&iSize, &dwLength) != ERROR_SUCCESS || if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&iSize, &dwLength) != ERROR_SUCCESS ||
dwType != REG_QWORD || dwLength != sizeof(UINT64)) dwType != REG_QWORD || dwLength != sizeof(UINT64))
{ {
/* Failed to read registry value, initialize with current setting for now */ /* Failed to read registry value, initialize with current setting for now */
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]); scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
} }
else else
scheme->Size[i] = (INT)iSize; scheme->Size[i] = (INT)iSize;
} }
RegCloseKey(hkSize); RegCloseKey(hkSize);
} }
RegCloseKey(hkScheme); RegCloseKey(hkScheme);
} }
RegCloseKey(hkNewSchemes); RegCloseKey(hkNewSchemes);
} }
return Ret; return Ret;
} }
VOID ApplyScheme(COLOR_SCHEME* scheme, INT SchemeId) VOID ApplyScheme(COLOR_SCHEME* scheme, INT SchemeId)
{ {
INT i, Result; INT i, Result;
HKEY hKey; HKEY hKey;
TCHAR clText[16]; TCHAR clText[16];
NONCLIENTMETRICS NonClientMetrics; NONCLIENTMETRICS NonClientMetrics;
ICONMETRICS IconMetrics; ICONMETRICS IconMetrics;
/* Apply Colors from global variable */ /* Apply Colors from global variable */
SetSysColors(NUM_COLORS, g_ColorList, scheme->crColor); SetSysColors(NUM_COLORS, g_ColorList, scheme->crColor);
/* Save colors to registry */ /* Save colors to registry */
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL); Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
if (Result == ERROR_SUCCESS) if (Result == ERROR_SUCCESS)
{ {
for (i = 0; i < NUM_COLORS; i++) for (i = 0; i < NUM_COLORS; i++)
{ {
DWORD red = GetRValue(scheme->crColor[i]); DWORD red = GetRValue(scheme->crColor[i]);
DWORD green = GetGValue(scheme->crColor[i]); DWORD green = GetGValue(scheme->crColor[i]);
DWORD blue = GetBValue(scheme->crColor[i]); DWORD blue = GetBValue(scheme->crColor[i]);
wsprintf(clText, TEXT("%d %d %d"), red, green, blue); wsprintf(clText, TEXT("%d %d %d"), red, green, blue);
RegSetValueEx(hKey, g_RegColorNames[i], 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR)); RegSetValueEx(hKey, g_RegColorNames[i], 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
/* Apply non client metrics */ /* Apply non client metrics */
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS); NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
NonClientMetrics.lfCaptionFont = scheme->lfFont[FONT_CAPTION]; NonClientMetrics.lfCaptionFont = scheme->lfFont[FONT_CAPTION];
NonClientMetrics.lfSmCaptionFont = scheme->lfFont[FONT_SMCAPTION]; NonClientMetrics.lfSmCaptionFont = scheme->lfFont[FONT_SMCAPTION];
NonClientMetrics.lfMenuFont = scheme->lfFont[FONT_MENU]; NonClientMetrics.lfMenuFont = scheme->lfFont[FONT_MENU];
NonClientMetrics.lfStatusFont = scheme->lfFont[FONT_INFO]; NonClientMetrics.lfStatusFont = scheme->lfFont[FONT_INFO];
NonClientMetrics.lfMessageFont = scheme->lfFont[FONT_DIALOG]; NonClientMetrics.lfMessageFont = scheme->lfFont[FONT_DIALOG];
NonClientMetrics.iBorderWidth = scheme->Size[SIZE_BORDER_X]; NonClientMetrics.iBorderWidth = scheme->Size[SIZE_BORDER_X];
NonClientMetrics.iScrollWidth = scheme->Size[SIZE_SCROLL_X]; NonClientMetrics.iScrollWidth = scheme->Size[SIZE_SCROLL_X];
NonClientMetrics.iScrollHeight = scheme->Size[SIZE_SCROLL_Y]; NonClientMetrics.iScrollHeight = scheme->Size[SIZE_SCROLL_Y];
NonClientMetrics.iCaptionWidth = scheme->Size[SIZE_CAPTION_Y]; NonClientMetrics.iCaptionWidth = scheme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iCaptionHeight = scheme->Size[SIZE_CAPTION_Y]; NonClientMetrics.iCaptionHeight = scheme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iSmCaptionWidth = scheme->Size[SIZE_SMCAPTION_Y]; NonClientMetrics.iSmCaptionWidth = scheme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iSmCaptionHeight = scheme->Size[SIZE_SMCAPTION_Y]; NonClientMetrics.iSmCaptionHeight = scheme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iMenuWidth = scheme->Size[SIZE_MENU_SIZE_X]; NonClientMetrics.iMenuWidth = scheme->Size[SIZE_MENU_SIZE_X];
NonClientMetrics.iMenuHeight = scheme->Size[SIZE_MENU_Y]; NonClientMetrics.iMenuHeight = scheme->Size[SIZE_MENU_Y];
SystemParametersInfo(SPI_SETNONCLIENTMETRICS, SystemParametersInfo(SPI_SETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), sizeof(NONCLIENTMETRICS),
&NonClientMetrics, &NonClientMetrics,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
/* Apply icon metrics */ /* Apply icon metrics */
IconMetrics.cbSize = sizeof(ICONMETRICS); IconMetrics.cbSize = sizeof(ICONMETRICS);
SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &IconMetrics, 0); SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &IconMetrics, 0);
IconMetrics.iHorzSpacing = scheme->Size[SIZE_ICON_SPC_X]; IconMetrics.iHorzSpacing = scheme->Size[SIZE_ICON_SPC_X];
IconMetrics.iVertSpacing = scheme->Size[SIZE_ICON_SPC_Y]; IconMetrics.iVertSpacing = scheme->Size[SIZE_ICON_SPC_Y];
IconMetrics.lfFont = scheme->lfFont[FONT_ICON]; IconMetrics.lfFont = scheme->lfFont[FONT_ICON];
SystemParametersInfo(SPI_SETICONMETRICS, SystemParametersInfo(SPI_SETICONMETRICS,
sizeof(ICONMETRICS), sizeof(ICONMETRICS),
&IconMetrics, &IconMetrics,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
/* Effects, save only when needed: */ /* Effects, save only when needed: */
/* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings /* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
* Just keep them in sync for now. * Just keep them in sync for now.
*/ */
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation; scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade; scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, scheme->Effects.bDragFullWindows, (PVOID)&scheme->Effects.bDragFullWindows, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, scheme->Effects.bDragFullWindows, (PVOID)&scheme->Effects.bDragFullWindows, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, IntToPtr(scheme->Effects.bKeyboardCues), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, IntToPtr(scheme->Effects.bKeyboardCues), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
//SystemParametersInfo(SPI_SETACTIVEWINDOWTRACKING, 0, (PVOID)&scheme->Effects.bActiveWindowTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETACTIVEWINDOWTRACKING, 0, (PVOID)&scheme->Effects.bActiveWindowTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)&scheme->Effects.bMenuAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)&scheme->Effects.bMenuAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETCOMBOBOXANIMATION, 0, (PVOID)&scheme->Effects.bComboBoxAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETCOMBOBOXANIMATION, 0, (PVOID)&scheme->Effects.bComboBoxAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&scheme->Effects.bListBoxSmoothScrolling, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&scheme->Effects.bListBoxSmoothScrolling, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETGRADIENTCAPTIONS, 0, (PVOID)&scheme->Effects.bGradientCaptions, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETGRADIENTCAPTIONS, 0, (PVOID)&scheme->Effects.bGradientCaptions, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETACTIVEWNDTRKZORDER, 0, (PVOID)&scheme->Effects.bActiveWndTrkZorder, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETACTIVEWNDTRKZORDER, 0, (PVOID)&scheme->Effects.bActiveWndTrkZorder, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETHOTTRACKING, 0, (PVOID)&scheme->Effects.bHotTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETHOTTRACKING, 0, (PVOID)&scheme->Effects.bHotTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETMENUFADE, 0, (PVOID)&scheme->Effects.bMenuFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); SystemParametersInfo(SPI_SETMENUFADE, 0, (PVOID)&scheme->Effects.bMenuFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETSELECTIONFADE, 0, (PVOID)&scheme->Effects.bSelectionFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETSELECTIONFADE, 0, (PVOID)&scheme->Effects.bSelectionFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETTOOLTIPANIMATION, 0, (PVOID)&scheme->Effects.bTooltipAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); SystemParametersInfo(SPI_SETTOOLTIPANIMATION, 0, (PVOID)&scheme->Effects.bTooltipAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETTOOLTIPFADE, 0, (PVOID)&scheme->Effects.bTooltipFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); SystemParametersInfo(SPI_SETTOOLTIPFADE, 0, (PVOID)&scheme->Effects.bTooltipFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)&scheme->Effects.bCursorShadow, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)&scheme->Effects.bCursorShadow, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETUIEFFECTS, 0, (PVOID)&scheme->Effects.bUiEffects, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); //SystemParametersInfo(SPI_SETUIEFFECTS, 0, (PVOID)&scheme->Effects.bUiEffects, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
/* Save SchemeId */ /* Save SchemeId */
Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey); Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey);
if (Result == ERROR_SUCCESS) if (Result == ERROR_SUCCESS)
{ {
if (SchemeId == -1) if (SchemeId == -1)
clText[0] = TEXT('\0'); clText[0] = TEXT('\0');
else else
lstrcpy(clText, g_ColorSchemes[SchemeId].strKeyName); lstrcpy(clText, g_ColorSchemes[SchemeId].strKeyName);
RegSetValueEx(hKey, g_SelectedStyle, 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR)); RegSetValueEx(hKey, g_SelectedStyle, 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
RegCloseKey(hKey); RegCloseKey(hKey);
} }
} }
BOOL SaveScheme(COLOR_SCHEME* scheme, LPCTSTR strLegacyName) BOOL SaveScheme(COLOR_SCHEME* scheme, LPCTSTR strLegacyName)
{ {
/* FIXME: Implement */ /* FIXME: Implement */
return FALSE; return FALSE;
} }
INT LoadSchemePresetEntries(LPTSTR pszSelectedStyle) INT LoadSchemePresetEntries(LPTSTR pszSelectedStyle)
{ {
HKEY hkNewSchemes, hkScheme, hkSizes, hkSize; HKEY hkNewSchemes, hkScheme, hkSizes, hkSize;
FILETIME ftLastWriteTime; FILETIME ftLastWriteTime;
DWORD dwLength, dwType; DWORD dwLength, dwType;
DWORD dwDisposition; DWORD dwDisposition;
INT iStyle, iSize, iTemplateIndex; INT iStyle, iSize, iTemplateIndex;
INT Result; INT Result;
lstrcpy(pszSelectedStyle, TEXT("")); lstrcpy(pszSelectedStyle, TEXT(""));
iTemplateIndex = 0; iTemplateIndex = 0;
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkNewSchemes, &dwDisposition); Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkNewSchemes, &dwDisposition);
if (Result == ERROR_SUCCESS) if (Result == ERROR_SUCCESS)
{ {
/* First find out the currently selected template */ /* First find out the currently selected template */
dwLength = 4 * sizeof(TCHAR); dwLength = 4 * sizeof(TCHAR);
RegQueryValueEx(hkNewSchemes, g_SelectedStyle, NULL, &dwType, (LPBYTE)pszSelectedStyle, &dwLength); RegQueryValueEx(hkNewSchemes, g_SelectedStyle, NULL, &dwType, (LPBYTE)pszSelectedStyle, &dwLength);
/* Check if already loaded */ /* Check if already loaded */
if (g_PresetLoaded) if (g_PresetLoaded)
{ {
RegCloseKey(hkNewSchemes); RegCloseKey(hkNewSchemes);
return g_TemplateCount; return g_TemplateCount;
} }
iStyle = 0; iStyle = 0;
dwLength = MAX_TEMPLATENAMELENTGH; dwLength = MAX_TEMPLATENAMELENTGH;
while((RegEnumKeyEx(hkNewSchemes, iStyle, g_ColorSchemes[iTemplateIndex].strKeyName, &dwLength, while((RegEnumKeyEx(hkNewSchemes, iStyle, g_ColorSchemes[iTemplateIndex].strKeyName, &dwLength,
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iTemplateIndex < MAX_TEMPLATES)) NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iTemplateIndex < MAX_TEMPLATES))
{ {
/* Is it really a template or one of the other entries */ /* Is it really a template or one of the other entries */
if (dwLength <= 4) if (dwLength <= 4)
{ {
if (RegOpenKeyEx(hkNewSchemes, g_ColorSchemes[iTemplateIndex].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS) if (RegOpenKeyEx(hkNewSchemes, g_ColorSchemes[iTemplateIndex].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS)
{ {
if (RegOpenKeyEx(hkScheme, TEXT("Sizes"), 0, KEY_READ, &hkSizes) == ERROR_SUCCESS) if (RegOpenKeyEx(hkScheme, TEXT("Sizes"), 0, KEY_READ, &hkSizes) == ERROR_SUCCESS)
{ {
iSize = 0; iSize = 0;
dwLength = 3; dwLength = 3;
while((RegEnumKeyEx(hkSizes, iSize, g_ColorSchemes[iTemplateIndex].strSizeName, &dwLength, while((RegEnumKeyEx(hkSizes, iSize, g_ColorSchemes[iTemplateIndex].strSizeName, &dwLength,
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iSize <= 4)) NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iSize <= 4))
{ {
if(RegOpenKeyEx(hkSizes, g_ColorSchemes[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS) if(RegOpenKeyEx(hkSizes, g_ColorSchemes[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
{ {
dwLength = MAX_TEMPLATENAMELENTGH; dwLength = MAX_TEMPLATENAMELENTGH;
RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strDisplayName, &dwLength); RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strDisplayName, &dwLength);
dwLength = MAX_TEMPLATENAMELENTGH; dwLength = MAX_TEMPLATENAMELENTGH;
RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strLegacyName, &dwLength); RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strLegacyName, &dwLength);
RegCloseKey(hkSize); RegCloseKey(hkSize);
} }
iSize++; iSize++;
iTemplateIndex++; iTemplateIndex++;
dwLength = 3; dwLength = 3;
} }
RegCloseKey(hkSizes); RegCloseKey(hkSizes);
} }
RegCloseKey(hkScheme); RegCloseKey(hkScheme);
} }
} }
iStyle++; iStyle++;
dwLength = MAX_TEMPLATENAMELENTGH; dwLength = MAX_TEMPLATENAMELENTGH;
} }
RegCloseKey(hkNewSchemes); RegCloseKey(hkNewSchemes);
g_PresetLoaded = TRUE; g_PresetLoaded = TRUE;
g_TemplateCount = iTemplateIndex; g_TemplateCount = iTemplateIndex;
} }
return iTemplateIndex; return iTemplateIndex;
} }
typedef HRESULT (WINAPI * ENUMTHEMESTYLE) (LPCWSTR, LPWSTR, DWORD, PTHEMENAMES); typedef HRESULT (WINAPI * ENUMTHEMESTYLE) (LPCWSTR, LPWSTR, DWORD, PTHEMENAMES);