[desk.cpl]

- Merge from themes branch

svn path=/trunk/; revision=53752
This commit is contained in:
Giannis Adamopoulos 2011-09-19 13:18:33 +00:00
parent 7af68227cb
commit 22cbaa54ac
18 changed files with 689 additions and 398 deletions

View file

@ -1,6 +1,7 @@
add_definitions(-D_WIN32)
set_unicode()
set_rc_compiler()
spec2def(desk.cpl desk.spec)
@ -26,7 +27,7 @@ add_library(desk SHARED
theme.c
${CMAKE_CURRENT_BINARY_DIR}/desk.def)
set_module_type(desk cpl UNICODE)
set_module_type(desk cpl)
target_link_libraries(desk uuid)
@ -40,7 +41,6 @@ add_importlibs(desk
ole32
setupapi
shell32
msimg32
kernel32
ntdll)

View file

@ -78,7 +78,7 @@ UpdateButtonColor(HWND hwndDlg, GLOBALS* g, INT ID, INT nButton, INT nColor)
rect.top = 2;
rect.right = 22;
rect.bottom = 13;
hbrush = CreateSolidBrush(g->ThemeAdv.crColor[nColor]);
hbrush = CreateSolidBrush(g->SchemeAdv.crColor[nColor]);
FillRect(hdcCompat, &rect, hbrush);
DeleteObject(hbrush);
@ -108,7 +108,7 @@ InitColorButtons(HWND hwndDlg, GLOBALS* g)
HPEN hPen;
HWND hwndColorButton;
HGDIOBJ hgdiTemp;
THEME *theme = &g->ThemeAdv;
COLOR_SCHEME *scheme = &g->SchemeAdv;
const POINT Points[3] = {{29,6},{33,6},{31,8}};
@ -130,7 +130,7 @@ InitColorButtons(HWND hwndDlg, GLOBALS* g)
rect.top = 0;
rect.right = 36;
rect.bottom = 15;
hbrush = CreateSolidBrush(theme->crColor[COLOR_BTNFACE]);
hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
FillRect(hdcCompat, &rect, hbrush);
DeleteObject(hbrush);
@ -139,12 +139,12 @@ InitColorButtons(HWND hwndDlg, GLOBALS* g)
rect.top = 1;
rect.right = 23;
rect.bottom = 14;
hbrush = CreateSolidBrush(theme->crColor[COLOR_BTNTEXT]);
hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNTEXT]);
FillRect(hdcCompat, &rect, hbrush);
DeleteObject(hbrush);
/* Draw left side of line */
hPen = CreatePen(PS_SOLID, 1, theme->crColor[COLOR_BTNSHADOW]);
hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNSHADOW]);
SelectObject(hdcCompat, hPen);
MoveToEx(hdcCompat, 26, 1, NULL);
LineTo(hdcCompat, 26, 14);
@ -152,7 +152,7 @@ InitColorButtons(HWND hwndDlg, GLOBALS* g)
DeleteObject(hPen);
/* Draw right side of line */
hPen = CreatePen(PS_SOLID, 1, theme->crColor[COLOR_BTNHIGHLIGHT]);
hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNHIGHLIGHT]);
SelectObject(hdcCompat,hPen);
MoveToEx(hdcCompat, 27, 1, NULL);
LineTo(hdcCompat, 27, 14);
@ -160,8 +160,8 @@ InitColorButtons(HWND hwndDlg, GLOBALS* g)
DeleteObject(hPen);
/* Draw triangle */
hPen = CreatePen(PS_SOLID, 1, theme->crColor[COLOR_BTNTEXT]);
hbrush = CreateSolidBrush(theme->crColor[COLOR_BTNTEXT]);
hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNTEXT]);
hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNTEXT]);
SelectObject(hdcCompat, hPen);
SelectObject(hdcCompat, hbrush);
SetPolyFillMode(hdcCompat, WINDING);
@ -232,20 +232,20 @@ UpdateControls(HWND hwndDlg, GLOBALS *g)
UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_FONTCOLOR_B, 2, g_Assignment[iElement].FontColor);
if (g_Assignment[iElement].Size != -1)
SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, g->ThemeAdv.Size[g_Assignment[iElement].Size], FALSE);
SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, g->SchemeAdv.Size[g_Assignment[iElement].Size], FALSE);
else
SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, TEXT(""));
hdcDlg = GetDC(hwndDlg);
if (g_Assignment[iElement].Font != -1)
{
LOGFONT lfFont = g->ThemeAdv.lfFont[g_Assignment[iElement].Font];
LOGFONT lfFont = g->SchemeAdv.lfFont[g_Assignment[iElement].Font];
SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, lfFont.lfFaceName);
SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, -MulDiv(g->ThemeAdv.lfFont[g_Assignment[iElement].Font].lfHeight, 72, GetDeviceCaps(hdcDlg, LOGPIXELSY)),FALSE);
SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, -MulDiv(g->SchemeAdv.lfFont[g_Assignment[iElement].Font].lfHeight, 72, GetDeviceCaps(hdcDlg, LOGPIXELSY)),FALSE);
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, CB_FINDSTRINGEXACT, -1, (WPARAM)lfFont.lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_SETCHECK, g->ThemeAdv.lfFont[g_Assignment[iElement].Font].lfWeight == FW_BOLD?1:0, 0);
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_SETCHECK, g->ThemeAdv.lfFont[g_Assignment[iElement].Font].lfItalic, 0);
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_SETCHECK, g->SchemeAdv.lfFont[g_Assignment[iElement].Font].lfWeight == FW_BOLD?1:0, 0);
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_SETCHECK, g->SchemeAdv.lfFont[g_Assignment[iElement].Font].lfItalic, 0);
}
else
{
@ -267,15 +267,15 @@ SaveCurrentValues(HWND hwndDlg, GLOBALS *g)
if (g_Assignment[g->CurrentElement].Size != -1)
{
g->ThemeAdv.Size[g_Assignment[g->CurrentElement].Size] = GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, &bTranslated, FALSE);
g->SchemeAdv.Size[g_Assignment[g->CurrentElement].Size] = GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, &bTranslated, FALSE);
}
if (g_Assignment[g->CurrentElement].Font != -1)
{
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL;
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName, LF_FACESIZE * sizeof(TCHAR));
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL;
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName, LF_FACESIZE * sizeof(TCHAR));
}
ReleaseDC(hwndDlg, hdcDlg);
@ -311,7 +311,7 @@ GetColor(HWND hwndDlg, GLOBALS* g, INT nButton)
break;
}
crColor = g->ThemeAdv.crColor[ColorIndex];
crColor = g->SchemeAdv.crColor[ColorIndex];
/* Prepare cc structure */
cc.lStructSize = sizeof(CHOOSECOLOR);
@ -327,11 +327,11 @@ GetColor(HWND hwndDlg, GLOBALS* g, INT nButton)
/* Create the colorpicker */
if (ChooseColor(&cc))
{
g->ThemeAdv.crColor[ColorIndex] = cc.rgbResult;
g->SchemeAdv.crColor[ColorIndex] = cc.rgbResult;
if (crColor != cc.rgbResult)
{
UpdateButtonColor(hwndDlg, g, ID, nButton, ColorIndex);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
return TRUE;
}
}
@ -353,9 +353,9 @@ AdvAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
TCHAR Size[4];
/* Copy the current theme values */
g->ThemeAdv = g->Theme;
g->SchemeAdv = g->Scheme;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
/* Add the elements to the combo */
@ -380,7 +380,7 @@ AdvAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_SETCURSEL, iDeskIndex, 0);
/* Create font for bold button */
lfButtonFont = g->Theme.lfFont[FONT_DIALOG];
lfButtonFont = g->Scheme.lfFont[FONT_DIALOG];
lfButtonFont.lfWeight = FW_BOLD;
lfButtonFont.lfItalic = FALSE;
hMyFont = CreateFontIndirect(&lfButtonFont);
@ -547,7 +547,7 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case IDCANCEL:
g->ThemeAdv = g->Theme;
g->SchemeAdv = g->Scheme;
EndDialog(hwndDlg, IDCANCEL);
break;
@ -605,20 +605,20 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDX_INACTIVE_CAPTION:
case IDX_ACTIVE_CAPTION:
GetSelectedComboText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C,
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_MENU:
GetSelectedComboText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C,
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_DIALOG:
GetSelectedComboText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C,
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
}
}
@ -635,23 +635,23 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDX_INACTIVE_CAPTION:
case IDX_ACTIVE_CAPTION:
i = GetSelectedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_MENU:
i = GetSelectedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_DIALOG:
i = GetSelectedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
}
@ -667,23 +667,23 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDX_INACTIVE_CAPTION:
case IDX_ACTIVE_CAPTION:
i = GetEditedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_MENU:
i = GetEditedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_DIALOG:
i = GetEditedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight =
-MulDiv(i , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
}
@ -701,24 +701,24 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDX_INACTIVE_CAPTION:
case IDX_ACTIVE_CAPTION:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
(i == BST_CHECKED) ? FW_BOLD : FW_NORMAL;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_MENU:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
(i == BST_CHECKED) ? FW_BOLD : FW_NORMAL;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_DIALOG:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight =
(i == BST_CHECKED) ? FW_BOLD : FW_NORMAL;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
}
}
@ -734,23 +734,23 @@ AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDX_INACTIVE_CAPTION:
case IDX_ACTIVE_CAPTION:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
(i == BST_CHECKED) ? TRUE : FALSE;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_MENU:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
(i == BST_CHECKED) ? TRUE : FALSE;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
case IDX_DIALOG:
i = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
g->SchemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic =
(i == BST_CHECKED) ? TRUE : FALSE;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv);
break;
}
}

View file

@ -88,8 +88,11 @@ DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
IDataObject *pdo;
#ifdef _MSC_VER
HMODULE hShell32 = NULL;
CPSEAE msvc_SHCreatePropSheetExtArrayEx;
#endif
CPSEAE msvc_SHCreatePropSheetExtArrayEx;
/* silence gcc warning */
msvc_SHCreatePropSheetExtArrayEx = NULL;
/* FIXME: Build the "%s and %s" caption string for the monitor and adapter name */
szCaption[0] = _T('\0');

View file

@ -12,12 +12,49 @@
/******************************************************************************/
static void
AppearancePage_ShowColorScemes(GLOBALS *g, HWND hwndColor, INT ThemeId)
{
int i, iListIndex;
SendMessage(hwndColor, CB_RESETCONTENT , 0, 0);
if(g->bThemeActive == FALSE)
{
for(i = 0; i < g_TemplateCount; i++)
{
iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)g_ColorSchemes[i].strLegacyName);
SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i);
if (lstrcmp(g_ColorSchemes[i].strKeyName, g->strSelectedStyle) == 0)
{
g->SchemeId = i;
SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0);
}
}
}
else
{
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, ThemeId);
for(i = 0; i < pTheme->ColorsCount; i++)
{
PTHEME_STYLE pStyleName;
pStyleName = (PTHEME_STYLE)DSA_GetItemPtr(pTheme->Colors, i);
iListIndex = SendMessage(hwndColor, CB_ADDSTRING, 0, (LPARAM)pStyleName->DisplayName);
SendMessage(hwndColor, CB_SETITEMDATA, iListIndex, i);
if(i == 0 || (g->pszColorName && wcscmp(pStyleName->StlyeName, g->pszColorName) == 0))
{
g->SchemeId = i;
SendMessage(hwndColor, CB_SETCURSEL, (WPARAM)iListIndex, 0);
}
}
}
}
static INT_PTR
AppearancePage_OnInit(HWND hwndDlg)
{
TCHAR strSelectedStyle[4];
INT i, TemplateCount, iListIndex;
HWND hwndCombo;
HWND hwndColor, hwndTheme;
GLOBALS *g;
g = (GLOBALS*)LocalAlloc(LPTR, sizeof(GLOBALS));
@ -26,28 +63,40 @@ AppearancePage_OnInit(HWND hwndDlg)
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
LoadCurrentTheme(&g->Theme);
g->ThemeAdv = g->Theme;
g->bHasChanged = FALSE;
LoadCurrentScheme(&g->Scheme);
g->SchemeAdv = g->Scheme;
g->bThemeChanged = FALSE;
g->bSchemeChanged = FALSE;
g->hBoldFont = g->hItalicFont = NULL;
g->hbmpColor[0] = g->hbmpColor[1] = g->hbmpColor[2] = NULL;
g->bInitializing = FALSE;
g->bThemeActive = FALSE;
TemplateCount = LoadThemePresetEntries(strSelectedStyle);
LoadThemes(g);
hwndCombo = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
g->ThemeId = -1;
TemplateCount = LoadSchemePresetEntries(g->strSelectedStyle);
hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
g->SchemeId = -1;
g->bInitializing = TRUE;
for(i = 0; i < TemplateCount; i++)
hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
for(i = 0; i < g->ThemesCount; i++)
{
iListIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_ThemeTemplates[i].strLegacyName);
SendMessage(hwndCombo, CB_SETITEMDATA, iListIndex, i);
if (lstrcmp(g_ThemeTemplates[i].strKeyName, strSelectedStyle) == 0)
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, i);
iListIndex = SendMessage(hwndTheme, CB_ADDSTRING, 0, (LPARAM)pTheme->displayName);
SendMessage(hwndTheme, CB_SETITEMDATA, iListIndex, i);
if((!pTheme->themeFileName && !IsThemeActive()) ||
(pTheme->themeFileName && g->pszThemeFileName && wcscmp(pTheme->themeFileName, g->pszThemeFileName) == 0 ))
{
g->ThemeId = i;
SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM)iListIndex, 0);
g->bThemeActive = (pTheme->themeFileName != NULL);
SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0);
AppearancePage_ShowColorScemes(g, hwndColor, i);
}
}
g->bInitializing = FALSE;
return FALSE;
@ -60,12 +109,12 @@ AppearancePage_OnDestroy(HWND hwndDlg, GLOBALS *g)
}
static INT
GetSelectedThemeId(HWND hwndDlg)
GetSelectedId(HWND hwndDlg, int nIDDlgItem)
{
HWND hwndCombo;
INT sel;
hwndCombo = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem);
sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
if (sel == CB_ERR)
return -1;
@ -97,13 +146,13 @@ AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->Theme = g->ThemeAdv;
g->bHasChanged = TRUE;
g->Scheme = g->SchemeAdv;
g->bSchemeChanged = TRUE;
// Effects dialog doesn't change the color scheme, therefore the following lines are commented out, until fixed finally
//g->ThemeId = -1; /* Customized */
//g->SchemeId = -1; /* Customized */
//SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0);
//SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT(""));
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Theme);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
}
break;
@ -112,32 +161,54 @@ AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->bHasChanged = TRUE;
g->Theme = g->ThemeAdv;
g->ThemeId = -1; /* Customized */
g_GlobalData.desktop_color = g->Theme.crColor[COLOR_DESKTOP];
g->bSchemeChanged = TRUE;
g->Scheme = g->SchemeAdv;
g->SchemeId = -1; /* Customized */
g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0);
SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT(""));
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Theme);
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
}
break;
case IDC_APPEARANCE_COLORSCHEME:
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
{
THEME Theme;
INT ThemeId = GetSelectedThemeId(hwndDlg);
INT SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->bHasChanged = TRUE;
if (ThemeId != -1 && LoadThemeFromReg(&Theme, ThemeId))
if(g->bThemeActive == FALSE)
{
g->Theme = Theme;
g->ThemeId = ThemeId;
g_GlobalData.desktop_color = g->Theme.crColor[COLOR_DESKTOP];
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&Theme);
COLOR_SCHEME Scheme;
g->bSchemeChanged = TRUE;
if (SchemeId != -1 && LoadSchemeFromReg(&Scheme, SchemeId))
{
g->Scheme = Scheme;
g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&Scheme);
}
}
else
{
g->bThemeChanged = TRUE;
}
}
break;
case IDC_APPEARANCE_VISUAL_STYLE:
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
{
INT ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
HWND hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
g->bThemeActive = (ThemeId!=0);
g->bThemeChanged = TRUE;
AppearancePage_ShowColorScemes(g, hwndColor, ThemeId);
}
break;
}
@ -148,14 +219,24 @@ AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (lpnm->code)
{
case PSN_APPLY:
if (g->bHasChanged)
g->ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
g->SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
if(g->bSchemeChanged)
{
INT ThemeId = GetSelectedThemeId(hwndDlg);
ApplyTheme(&g->Theme, ThemeId);
g->ThemeId = ThemeId;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Theme);
g->bHasChanged = FALSE;
ApplyScheme(&g->Scheme, g->SchemeId);
}
if(g->bThemeChanged)
{
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, g->ThemeId);
ActivateTheme(pTheme, g->SchemeId, 0);
}
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
g->bThemeChanged = FALSE;
g->bSchemeChanged = FALSE;
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)PSNRET_NOERROR);
return TRUE;
@ -164,10 +245,10 @@ AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
case PSN_SETACTIVE:
if (g->Theme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color)
if (g->Scheme.crColor[COLOR_DESKTOP] != g_GlobalData.desktop_color)
{
g->Theme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Theme);
g->Scheme.crColor[COLOR_DESKTOP] = g_GlobalData.desktop_color;
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
}
break;
}

View file

@ -1,14 +1,121 @@
/* Some typedefs for appearance */
/* Some definitions for theme */
#define SIZE_BORDER_X 0
#define SIZE_BORDER_Y 1
#define SIZE_CAPTION_Y 2
#define SIZE_ICON_X 3
#define SIZE_ICON_Y 4
#define SIZE_ICON_SPC_X 5
#define SIZE_ICON_SPC_Y 6
#define SIZE_MENU_SIZE_X 7
#define SIZE_MENU_Y 8
#define SIZE_SCROLL_X 9
#define SIZE_SCROLL_Y 10
#define SIZE_SMCAPTION_Y 11
#define SIZE_EDGE_X 12
#define SIZE_EDGE_Y 13
#define SIZE_FRAME_Y 14
#define SIZE_MENU_CHECK_X 15
#define SIZE_MENU_CHECK_Y 16
#define SIZE_MENU_SIZE_Y 17
#define SIZE_SIZE_X 18
#define SIZE_SIZE_Y 19
#define FONT_CAPTION 0
#define FONT_SMCAPTION 1
#define FONT_HILIGHT 2
#define FONT_MENU 2
#define FONT_ICON 3
#define FONT_INFO 4
#define FONT_DIALOG 5
#define NUM_ELEMENTS 22
#define NUM_FONTS 6
#define NUM_SIZES 20
#define NUM_COLORS 31
#define MAX_TEMPLATES 50
#define MAX_TEMPLATENAMELENTGH 80
/* Some typedefs for theme */
/* Most (but not all) fields below correspond to HKCU\Control Panel\Desktop\UserPreferencesMask */
typedef struct
{
BOOL bActiveWindowTracking;
BOOL bMenuAnimation;
BOOL bComboBoxAnimation;
BOOL bListBoxSmoothScrolling;
BOOL bGradientCaptions;
BOOL bKeyboardCues;
BOOL bActiveWndTrkZorder;
BOOL bHotTracking;
BOOL bMenuFade;
BOOL bSelectionFade;
BOOL bTooltipAnimation;
BOOL bTooltipFade;
BOOL bCursorShadow;
BOOL bUiEffects;
BOOL bFontSmoothing;
BOOL bDragFullWindows;
UINT uiFontSmoothingType;
} EFFECTS;
typedef struct
{
COLORREF crColor[NUM_COLORS];
LOGFONT lfFont[NUM_FONTS];
INT Size[NUM_SIZES];
BOOL bFlatMenus;
EFFECTS Effects;
} COLOR_SCHEME;
typedef struct
{
TCHAR strKeyName[4];
TCHAR strSizeName[4];
TCHAR strDisplayName[MAX_TEMPLATENAMELENTGH];
TCHAR strLegacyName[MAX_TEMPLATENAMELENTGH];
} SCHEME_PRESET;
/* struct for holding theme colors and sizes */
typedef struct _THEME_STYLE
{
WCHAR* StlyeName;
WCHAR* DisplayName;
} THEME_STYLE, *PTHEME_STYLE;
typedef struct _THEME
{
WCHAR* themeFileName;
WCHAR* displayName;
HDSA Colors;
int ColorsCount;
HDSA Sizes;
int SizesCount;
} THEME, *PTHEME;
/* This is the global structure used to store the current values.
A pointer of this get's passed to the functions either directly
or by passing hwnd and getting the pointer by GetWindowLongPtr */
typedef struct tagGLOBALS
{
INT ThemeId; /* Theme is customized if ThemeId == -1 */
THEME Theme;
THEME ThemeAdv;
BOOL bHasChanged;
HDSA Themes;
int ThemesCount;
BOOL bThemeActive;
INT ThemeId;
INT SchemeId; /* Theme is customized if SchemeId == -1 */
INT SizeID;
TCHAR strSelectedStyle[4];
LPWSTR pszThemeFileName;
LPWSTR pszColorName;
LPWSTR pszSizeName;
COLOR_SCHEME Scheme;
COLOR_SCHEME SchemeAdv;
BOOL bThemeChanged;
BOOL bSchemeChanged;
HBITMAP hbmpColor[3];
INT CurrentElement;
HFONT hBoldFont;
@ -16,6 +123,19 @@ typedef struct tagGLOBALS
BOOL bInitializing;
} GLOBALS;
extern SCHEME_PRESET g_ColorSchemes[MAX_TEMPLATES];
extern INT g_TemplateCount;
/* prototypes for theme.c */
VOID LoadCurrentScheme(COLOR_SCHEME* scheme);
BOOL LoadSchemeFromReg(COLOR_SCHEME* scheme, INT SchemeId);
VOID ApplyScheme(COLOR_SCHEME* scheme, INT SchemeId);
BOOL SaveScheme(COLOR_SCHEME* scheme, LPCTSTR strLegacyName);
INT LoadSchemePresetEntries(LPTSTR pszSelectedStyle);
VOID LoadThemes(GLOBALS *g);
HRESULT ActivateTheme(PTHEME pTheme, int iColor, int iSize);
void CleanupThemes(GLOBALS *g);
/* prototypes for appearance.c */
INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

View file

@ -649,14 +649,14 @@ DrawBackgroundPreview(LPDRAWITEMSTRUCT draw, PDATA pData)
}
}
TransparentBlt(draw->hDC,
draw->rcItem.left, draw->rcItem.top,
draw->rcItem.right-draw->rcItem.left+1,
draw->rcItem.bottom-draw->rcItem.top+1,
hDC,
0, 0,
pData->cxSource, pData->cySource,
0xFF00FF);
GdiTransparentBlt(draw->hDC,
draw->rcItem.left, draw->rcItem.top,
draw->rcItem.right-draw->rcItem.left+1,
draw->rcItem.bottom-draw->rcItem.top+1,
hDC,
0, 0,
pData->cxSource, pData->cySource,
0xFF00FF);
SelectObject(hDC, hOldObj);
DeleteDC(hDC);

View file

@ -11,8 +11,9 @@
#include <cplext.h>
#include <dll/desk/deskcplx.h>
#include <cfgmgr32.h>
#include <uxtheme.h>
#include <uxundoc.h>
#include "theme.h"
#include "appearance.h"
#include "preview.h"
#include "draw.h"

View file

@ -13,8 +13,8 @@
<library>setupapi</library>
<library>shell32</library>
<library>ntdll</library>
<library>msimg32</library>
<library>uuid</library>
<library>uxtheme</library>
<file>advmon.c</file>
<file>appearance.c</file>
<file>background.c</file>

View file

@ -181,19 +181,19 @@ pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
CM_LOCATE_DEVNODE_NORMAL);
if (cr == CR_SUCCESS)
{
DbgPrint("Success1\n");
DPRINT1("Success1\n");
cr = CM_Get_Device_ID_Size(&BufLen,
DevInst,
0);
if (cr == CR_SUCCESS)
{
DbgPrint("Success2\n");
DPRINT1("Success2\n");
lpDevInstId = LocalAlloc(LMEM_FIXED,
(BufLen + 1) * sizeof(WCHAR));
if (lpDevInstId != NULL)
{
DbgPrint("Success3\n");
DPRINT1("Success3\n");
cr = CM_Get_Device_IDW(DevInst,
lpDevInstId,
BufLen,
@ -204,7 +204,7 @@ pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
LocalFree((HLOCAL)lpDevInstId);
lpDevInstId = NULL;
}
DbgPrint("instance id: %ws\n", lpDevInstId);
DPRINT1("instance id: %ws\n", lpDevInstId);
}
}
}

View file

@ -56,7 +56,7 @@ static const signed char LTRBInnerMono[] = {
};
static BOOL
MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme)
{
signed char LTInnerI, LTOuterI;
signed char RBInnerI, RBOuterI;
@ -98,7 +98,7 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
RBOuterPen = GetStockObject(DC_PEN);
{
HBRUSH hbr;
hbr = CreateSolidBrush(theme->crColor[COLOR_BTNFACE]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
FillRect(hdc, &InnerRect, hbr);
DeleteObject(hbr);
}
@ -106,7 +106,7 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
/* Draw the outer edge */
SelectObject(hdc, LTOuterPen);
SetDCPenColor(hdc, theme->crColor[LTOuterI]);
SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
if(uFlags & BF_TOP)
{
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
@ -118,7 +118,7 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
LineTo(hdc, InnerRect.left, InnerRect.bottom);
}
SelectObject(hdc, RBOuterPen);
SetDCPenColor(hdc, theme->crColor[RBOuterI]);
SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
if(uFlags & BF_BOTTOM)
{
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
@ -132,7 +132,7 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
/* Draw the inner edge */
SelectObject(hdc, LTInnerPen);
SetDCPenColor(hdc, theme->crColor[LTInnerI]);
SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
if(uFlags & BF_TOP)
{
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
@ -144,7 +144,7 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
}
SelectObject(hdc, RBInnerPen);
SetDCPenColor(hdc, theme->crColor[RBInnerI]);
SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
if(uFlags & BF_BOTTOM)
{
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
@ -181,14 +181,14 @@ MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
}
static BOOL
MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, THEME *theme)
MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme)
{
UINT edge;
if(uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
edge = EDGE_SUNKEN;
else
edge = EDGE_RAISED;
return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, theme);
return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, scheme);
}
static int
@ -216,7 +216,7 @@ MyMakeSquareRect(LPRECT src, LPRECT dst)
}
static BOOL
MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
{
LOGFONT lf;
HFONT hFont, hOldFont;
@ -242,7 +242,7 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
Symbol = '2';
break;
}
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, theme);
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme);
ZeroMemory(&lf, sizeof(LOGFONT));
MyMakeSquareRect(r, &myr);
myr.left += 1;
@ -266,10 +266,10 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
if(uFlags & DFCS_INACTIVE)
{
/* draw shadow */
SetTextColor(dc, theme->crColor[COLOR_BTNHIGHLIGHT]);
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
}
SetTextColor(dc, theme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
/* draw selected symbol */
TextOut(dc, myr.left, myr.top, &Symbol, 1);
/* restore previous settings */
@ -283,7 +283,7 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
/******************************************************************************/
static BOOL
MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
{
LOGFONT lf;
HFONT hFont, hOldFont;
@ -310,7 +310,7 @@ MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
Symbol = '4';
break;
}
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, theme);
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme);
ZeroMemory(&lf, sizeof(LOGFONT));
MyMakeSquareRect(r, &myr);
myr.left += 1;
@ -334,10 +334,10 @@ MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
if(uFlags & DFCS_INACTIVE)
{
/* draw shadow */
SetTextColor(dc, theme->crColor[COLOR_BTNHIGHLIGHT]);
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
}
SetTextColor(dc, theme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
SetTextColor(dc, scheme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
/* draw selected symbol */
TextOut(dc, myr.left, myr.top, &Symbol, 1);
/* restore previous settings */
@ -349,28 +349,28 @@ MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
}
BOOL
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, THEME *theme)
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
{
switch(uType)
{
case DFC_BUTTON:
return MyDrawFrameButton(hDC, rc, uState, theme);
return MyDrawFrameButton(hDC, rc, uState, scheme);
case DFC_CAPTION:
return MyDrawFrameCaption(hDC, rc, uState, theme);
return MyDrawFrameCaption(hDC, rc, uState, scheme);
case DFC_SCROLL:
return MyDrawFrameScroll(hDC, rc, uState, theme);
return MyDrawFrameScroll(hDC, rc, uState, scheme);
}
return FALSE;
}
BOOL
MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, THEME *theme)
MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, COLOR_SCHEME *scheme)
{
return MyIntDrawRectEdge(hDC, rc, edge, flags, theme);
return MyIntDrawRectEdge(hDC, rc, edge, flags, scheme);
}
VOID
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, THEME *theme)
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme)
{
RECT rc3;
RECT rc4;
@ -381,7 +381,7 @@ MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, THEME *theme)
rc3.right = lpRect->right - 2;
rc3.bottom = lpRect->bottom - 2;
MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, theme);
MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, scheme);
if (bMinMax)
{
@ -390,19 +390,19 @@ MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, THEME *theme)
rc4.right = rc3.right - x - 2;
rc4.bottom = rc3.bottom;
MyDrawFrameControl(hdc, &rc4, DFC_CAPTION, DFCS_CAPTIONMAX, theme);
MyDrawFrameControl(hdc, &rc4, DFC_CAPTION, DFCS_CAPTIONMAX, scheme);
rc5.left = rc4.left - x;
rc5.top = rc4.top;
rc5.right = rc4.right - x;
rc5.bottom = rc4.bottom;
MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, theme);
MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, scheme);
}
}
VOID
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, THEME *theme)
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme)
{
RECT rcTop;
RECT rcBottom;
@ -426,8 +426,8 @@ MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, THEME *theme)
rcBottom.top = rc->bottom - width;
rcBottom.bottom = rc->bottom;
MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, theme);
MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, theme);
MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, scheme);
MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, scheme);
FillRect(hdc, &rcMiddle, hbrScrollbar);
}
@ -435,21 +435,30 @@ MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, THEME *theme)
/******************************************************************************/
BOOL
MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, THEME *theme)
MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, COLOR_SCHEME *scheme)
{
ULONG Height;
UINT VCenter, Padding;
LONG ButtonWidth;
HBRUSH hbr;
HGDIOBJ hFontOld;
RECT rc;
Height = scheme->Size[SIZE_CAPTION_Y] - 1;
VCenter = (rect->bottom - rect->top) / 2;
Padding = VCenter - (Height / 2);
ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2;
if (uFlags & DC_GRADIENT)
{
GRADIENT_RECT gcap = {0, 1};
TRIVERTEX vert[2];
COLORREF Colors[2];
Colors[0] = theme->crColor[((uFlags & DC_ACTIVE) ?
Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ?
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)];
Colors[1] = theme->crColor[((uFlags & DC_ACTIVE) ?
Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ?
COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)];
vert[0].x = rect->left;
@ -466,14 +475,14 @@ MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon
vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
vert[1].Alpha = 0;
GradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
}
else
{
if (uFlags & DC_ACTIVE)
hbr = CreateSolidBrush(theme->crColor[COLOR_ACTIVECAPTION]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVECAPTION]);
else
hbr = CreateSolidBrush(theme->crColor[COLOR_INACTIVECAPTION]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_INACTIVECAPTION]);
FillRect(hdc, rect, hbr);
DeleteObject(hbr);
}
@ -481,9 +490,9 @@ MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon
hFontOld = SelectObject(hdc, hFont);
SetBkMode(hdc, TRANSPARENT);
if (uFlags & DC_ACTIVE)
SetTextColor(hdc, theme->crColor[COLOR_CAPTIONTEXT]);
SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]);
else
SetTextColor(hdc, theme->crColor[COLOR_INACTIVECAPTIONTEXT]);
SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]);
rc.left = rect->left + 2;
rc.top = rect->top;
rc.right = rect->right;
@ -496,7 +505,7 @@ MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon
/******************************************************************************/
DWORD
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, THEME *theme)
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme)
{
HBRUSH hbr;
HPEN hPen;
@ -507,16 +516,16 @@ MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, THEME *
WCHAR Text[128];
UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
flat_menu = theme->bFlatMenus;
flat_menu = scheme->bFlatMenus;
if (flat_menu)
hbr = CreateSolidBrush(theme->crColor[COLOR_MENUBAR]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]);
else
hbr = CreateSolidBrush(theme->crColor[COLOR_MENU]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]);
FillRect(DC, Rect, hbr);
DeleteObject(hbr);
hPen = CreatePen(PS_SOLID, 0, theme->crColor[COLOR_3DFACE]);
hPen = CreatePen(PS_SOLID, 0, scheme->crColor[COLOR_3DFACE]);
hPenOld = SelectObject(DC, hPen);
MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL);
LineTo(DC, Rect->right, Rect->bottom - 1);
@ -542,35 +551,35 @@ MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, THEME *
{
if (flat_menu)
{
SetTextColor(DC, theme->crColor[COLOR_HIGHLIGHTTEXT]);
SetBkColor(DC, theme->crColor[COLOR_HIGHLIGHT]);
SetTextColor(DC, scheme->crColor[COLOR_HIGHLIGHTTEXT]);
SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]);
InflateRect (&rect, -1, -1);
hbr = CreateSolidBrush(theme->crColor[COLOR_MENUHILIGHT]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]);
FillRect(DC, &rect, hbr);
DeleteObject(hbr);
InflateRect (&rect, 1, 1);
hbr = CreateSolidBrush(theme->crColor[COLOR_HIGHLIGHT]);
hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]);
FrameRect(DC, &rect, hbr);
DeleteObject(hbr);
}
else
{
SetTextColor(DC, theme->crColor[COLOR_MENUTEXT]);
SetBkColor(DC, theme->crColor[COLOR_MENU]);
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
SetBkColor(DC, scheme->crColor[COLOR_MENU]);
DrawEdge(DC, &rect, BDR_SUNKENOUTER, BF_RECT);
}
}
else
{
if (i == 1)
SetTextColor(DC, theme->crColor[COLOR_GRAYTEXT]);
SetTextColor(DC, scheme->crColor[COLOR_GRAYTEXT]);
else
SetTextColor(DC, theme->crColor[COLOR_MENUTEXT]);
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
SetBkColor(DC, theme->crColor[bkgnd]);
hbr = CreateSolidBrush(theme->crColor[bkgnd]);
SetBkColor(DC, scheme->crColor[bkgnd]);
hbr = CreateSolidBrush(scheme->crColor[bkgnd]);
FillRect(DC, &rect, hbr);
DeleteObject(hbr);
}

View file

@ -1,12 +1,12 @@
BOOL
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, THEME *theme);
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme);
BOOL
MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, THEME *theme);
MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, COLOR_SCHEME *scheme);
VOID
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, THEME *theme);
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme);
VOID
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, THEME *theme);
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme);
BOOL
MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, THEME *theme);
MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, COLOR_SCHEME *scheme);
DWORD
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, THEME *theme);
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme);

View file

@ -16,17 +16,17 @@ UpdateControls(HWND hwndDlg, GLOBALS *g)
{
WPARAM state;
state = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATION, BM_GETCHECK, 0, 0);
g->ThemeAdv.Effects.bMenuAnimation = (state == BST_CHECKED) ? TRUE : FALSE;
EnableWindow(GetDlgItem(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE), g->ThemeAdv.Effects.bMenuAnimation);
g->SchemeAdv.Effects.bMenuAnimation = (state == BST_CHECKED) ? TRUE : FALSE;
EnableWindow(GetDlgItem(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE), g->SchemeAdv.Effects.bMenuAnimation);
//A boolean as an index for a 2-value list:
SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_SETCURSEL, (WPARAM)g->ThemeAdv.Effects.bMenuFade, 0);
SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_SETCURSEL, (WPARAM)g->SchemeAdv.Effects.bMenuFade, 0);
state = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_KEYBOARDCUES, BM_GETCHECK, 0, 0);
g->ThemeAdv.Effects.bKeyboardCues = (state == BST_CHECKED) ? TRUE : FALSE;
g->SchemeAdv.Effects.bKeyboardCues = (state == BST_CHECKED) ? TRUE : FALSE;
state = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_DRAGFULLWINDOWS, BM_GETCHECK, 0, 0);
g->ThemeAdv.Effects.bDragFullWindows = (state == BST_CHECKED) ? TRUE : FALSE;
g->bHasChanged = TRUE;
g->SchemeAdv.Effects.bDragFullWindows = (state == BST_CHECKED) ? TRUE : FALSE;
g->bSchemeChanged = TRUE;
}
@ -56,17 +56,17 @@ EffAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
WPARAM state;
/* Copy the current theme values */
g->ThemeAdv = g->Theme;
g->SchemeAdv = g->Scheme;
AddToCombo(hwndDlg, IDS_SLIDEEFFECT, IDS_FADEEFFECT, IDC_EFFAPPEARANCE_ANIMATIONTYPE);
state = g->ThemeAdv.Effects.bMenuAnimation ? BST_CHECKED : BST_UNCHECKED;
state = g->SchemeAdv.Effects.bMenuAnimation ? BST_CHECKED : BST_UNCHECKED;
SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATION, BM_SETCHECK, state, 0);
state = g->ThemeAdv.Effects.bKeyboardCues ? BST_CHECKED : BST_UNCHECKED;
state = g->SchemeAdv.Effects.bKeyboardCues ? BST_CHECKED : BST_UNCHECKED;
SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_KEYBOARDCUES, BM_SETCHECK, state, 0);
state = g->ThemeAdv.Effects.bDragFullWindows ? BST_CHECKED : BST_UNCHECKED;
state = g->SchemeAdv.Effects.bDragFullWindows ? BST_CHECKED : BST_UNCHECKED;
SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_DRAGFULLWINDOWS, BM_SETCHECK, state, 0);
/* Update the controls */
@ -107,7 +107,7 @@ EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case IDCANCEL:
g->ThemeAdv = g->Theme;
g->SchemeAdv = g->Scheme;
EndDialog(hwndDlg, IDCANCEL);
break;
@ -124,7 +124,7 @@ EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (HIWORD(wParam) == CBN_SELCHANGE)
{
SaveCurrentValues(hwndDlg, g);
g->ThemeAdv.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);
}
break;

View file

@ -51,8 +51,10 @@ FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass",
WS_VISIBLE | WS_BORDER, 7, 7, 232, 120
LTEXT "Colorscheme", IDC_STATIC, 7, 140, 64, 7
COMBOBOX IDC_APPEARANCE_COLORSCHEME, 7, 150, 134, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Visual Style", IDC_STATIC, 7, 130, 64, 7
COMBOBOX IDC_APPEARANCE_VISUAL_STYLE, 7, 140, 134, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Colorscheme", IDC_STATIC, 7, 160, 64, 7
COMBOBOX IDC_APPEARANCE_COLORSCHEME, 7, 170, 134, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Effects...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15
PUSHBUTTON "Ad&vanced...", IDC_APPEARANCE_ADVANCED, 182, 170, 56, 15
END

View file

@ -684,6 +684,7 @@ MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
SIZE rcsize;
LOGFONT lf;
HFONT hPrevFont, hFont;
INT len;
hFont = infoPtr->Monitors[Index].hFont;
if (hFont == NULL &&
@ -697,6 +698,8 @@ MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
(2 * infoPtr->SelectionFrame.cy) - 2;
rcsize.cy = (rcsize.cy * 60) / 100;
len = _tcslen(infoPtr->Monitors[Index].szCaption);
hPrevFont = SelectObject(hDC,
infoPtr->hFont);

View file

@ -14,7 +14,7 @@ typedef struct _PREVIEW_DATA
{
HWND hwndParent;
THEME Theme;
COLOR_SCHEME Scheme;
HBRUSH hbrScrollbar;
HBRUSH hbrDesktop;
@ -67,49 +67,49 @@ typedef struct _PREVIEW_DATA
} PREVIEW_DATA, *PPREVIEW_DATA;
static VOID UpdatePreviewTheme(HWND hwnd, PPREVIEW_DATA pPreviewData, THEME *theme)
static VOID UpdatePreviewTheme(HWND hwnd, PPREVIEW_DATA pPreviewData, COLOR_SCHEME *scheme)
{
if (pPreviewData->hbrScrollbar != NULL)
DeleteObject(pPreviewData->hbrScrollbar);
pPreviewData->hbrScrollbar = CreateSolidBrush(theme->crColor[COLOR_SCROLLBAR]);
pPreviewData->hbrScrollbar = CreateSolidBrush(scheme->crColor[COLOR_SCROLLBAR]);
if (pPreviewData->hbrDesktop != NULL)
DeleteObject(pPreviewData->hbrDesktop);
pPreviewData->hbrDesktop = CreateSolidBrush(theme->crColor[COLOR_DESKTOP]);
pPreviewData->hbrDesktop = CreateSolidBrush(scheme->crColor[COLOR_DESKTOP]);
if (pPreviewData->hbrWindow != NULL)
DeleteObject(pPreviewData->hbrWindow);
pPreviewData->hbrWindow = CreateSolidBrush(theme->crColor[COLOR_WINDOW]);
pPreviewData->hbrWindow = CreateSolidBrush(scheme->crColor[COLOR_WINDOW]);
pPreviewData->cxEdge = theme->Size[SIZE_EDGE_X] - 2; /* SM_CXEDGE */
pPreviewData->cyEdge = theme->Size[SIZE_EDGE_Y] - 2; /* SM_CYEDGE */
pPreviewData->cxEdge = scheme->Size[SIZE_EDGE_X] - 2; /* SM_CXEDGE */
pPreviewData->cyEdge = scheme->Size[SIZE_EDGE_Y] - 2; /* SM_CYEDGE */
pPreviewData->cySizeFrame = theme->Size[SIZE_FRAME_Y] - 1; /* SM_CYSIZEFRAME */
pPreviewData->cySizeFrame = scheme->Size[SIZE_FRAME_Y] - 1; /* SM_CYSIZEFRAME */
pPreviewData->cyCaption = theme->Size[SIZE_CAPTION_Y]; /* SM_CYCAPTION */
pPreviewData->cyMenu = theme->Size[SIZE_MENU_Y]; /* SM_CYMENU */
pPreviewData->cxScrollbar = theme->Size[SIZE_SCROLL_X]; /* SM_CXVSCROLL */
pPreviewData->cyBorder = theme->Size[SIZE_BORDER_Y]; /* SM_CYBORDER */
pPreviewData->cyCaption = scheme->Size[SIZE_CAPTION_Y]; /* SM_CYCAPTION */
pPreviewData->cyMenu = scheme->Size[SIZE_MENU_Y]; /* SM_CYMENU */
pPreviewData->cxScrollbar = scheme->Size[SIZE_SCROLL_X]; /* SM_CXVSCROLL */
pPreviewData->cyBorder = scheme->Size[SIZE_BORDER_Y]; /* SM_CYBORDER */
if (pPreviewData->hCaptionFont != NULL)
DeleteObject(pPreviewData->hCaptionFont);
pPreviewData->hCaptionFont = CreateFontIndirect(&theme->lfFont[FONT_CAPTION]);
pPreviewData->hCaptionFont = CreateFontIndirect(&scheme->lfFont[FONT_CAPTION]);
if (pPreviewData->hMenuFont != NULL)
DeleteObject(pPreviewData->hMenuFont);
pPreviewData->hMenuFont = CreateFontIndirect(&theme->lfFont[FONT_MENU]);
pPreviewData->hMenuFont = CreateFontIndirect(&scheme->lfFont[FONT_MENU]);
if (pPreviewData->hMessageFont != NULL)
DeleteObject(pPreviewData->hMessageFont);
pPreviewData->hMessageFont = CreateFontIndirect(&theme->lfFont[FONT_DIALOG]);
pPreviewData->hMessageFont = CreateFontIndirect(&scheme->lfFont[FONT_DIALOG]);
pPreviewData->Theme = *theme;
pPreviewData->Scheme = *scheme;
InvalidateRect(hwnd, NULL, FALSE);
}
static VOID
OnCreate(HWND hwnd, PPREVIEW_DATA pPreviewData)
{
THEME *theme;
COLOR_SCHEME *scheme;
pPreviewData->hClientFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
@ -130,10 +130,10 @@ OnCreate(HWND hwnd, PPREVIEW_DATA pPreviewData)
AllocAndLoadString(&pPreviewData->lpMessText, hApplet, IDS_MESSTEXT);
AllocAndLoadString(&pPreviewData->lpButText, hApplet, IDS_BUTTEXT);
theme = &pPreviewData->Theme;
LoadCurrentTheme(theme);
scheme = &pPreviewData->Scheme;
LoadCurrentScheme(scheme);
UpdatePreviewTheme(hwnd, pPreviewData, theme);
UpdatePreviewTheme(hwnd, pPreviewData, scheme);
}
@ -252,9 +252,9 @@ OnPaint(HWND hwnd, PPREVIEW_DATA pPreviewData)
HFONT hOldFont;
HDC hdc;
RECT rc;
THEME *theme;
COLOR_SCHEME *scheme;
theme = &pPreviewData->Theme;
scheme = &pPreviewData->Scheme;
hdc = BeginPaint(hwnd, &ps);
@ -262,61 +262,61 @@ OnPaint(HWND hwnd, PPREVIEW_DATA pPreviewData)
FillRect(hdc, &pPreviewData->rcDesktop, pPreviewData->hbrDesktop);
/* Inactive Window */
MyDrawEdge(hdc, &pPreviewData->rcInactiveFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, theme);
SetTextColor(hdc, theme->crColor[COLOR_INACTIVECAPTIONTEXT]);
MyDrawEdge(hdc, &pPreviewData->rcInactiveFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, scheme);
SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]);
MyDrawCaptionTemp(NULL, hdc, &pPreviewData->rcInactiveCaption, pPreviewData->hCaptionFont,
NULL, pPreviewData->lpInAct, DC_GRADIENT | DC_ICON | DC_TEXT, theme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcInactiveCaption, TRUE, pPreviewData->cyCaption - 2, theme);
NULL, pPreviewData->lpInAct, DC_GRADIENT | DC_ICON | DC_TEXT, scheme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcInactiveCaption, TRUE, pPreviewData->cyCaption - 2, scheme);
/* Active Window */
MyDrawEdge(hdc, &pPreviewData->rcActiveFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, theme);
SetTextColor(hdc, theme->crColor[COLOR_CAPTIONTEXT]);
MyDrawEdge(hdc, &pPreviewData->rcActiveFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, scheme);
SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]);
MyDrawCaptionTemp(NULL, hdc, &pPreviewData->rcActiveCaption, pPreviewData->hCaptionFont,
NULL, pPreviewData->lpAct, DC_ACTIVE | DC_GRADIENT | DC_ICON | DC_TEXT, theme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcActiveCaption, TRUE, pPreviewData->cyCaption - 2, theme);
NULL, pPreviewData->lpAct, DC_ACTIVE | DC_GRADIENT | DC_ICON | DC_TEXT, scheme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcActiveCaption, TRUE, pPreviewData->cyCaption - 2, scheme);
/* Draw the menu bar */
MyDrawMenuBarTemp(hwnd, hdc, &pPreviewData->rcActiveMenuBar,
pPreviewData->hMenu,
pPreviewData->hMenuFont, theme);
pPreviewData->hMenuFont, scheme);
/* Draw the client area */
CopyRect(&rc, &pPreviewData->rcActiveClient);
MyDrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_ADJUST, theme);
MyDrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_ADJUST, scheme);
FillRect(hdc, &rc, pPreviewData->hbrWindow);
/* Draw the client text */
CopyRect(&rc, &pPreviewData->rcActiveClient);
rc.left += 4;
rc.top += 2;
SetTextColor(hdc, theme->crColor[COLOR_WINDOWTEXT]);
SetTextColor(hdc, scheme->crColor[COLOR_WINDOWTEXT]);
hOldFont = SelectObject(hdc, pPreviewData->hClientFont);
DrawText(hdc, pPreviewData->lpWinTxt, -1, &rc, DT_LEFT);
SelectObject(hdc, hOldFont);
/* Draw the scroll bar */
MyDrawScrollbar(hdc, &pPreviewData->rcActiveScroll, pPreviewData->hbrScrollbar, theme);
MyDrawScrollbar(hdc, &pPreviewData->rcActiveScroll, pPreviewData->hbrScrollbar, scheme);
/* Dialog Window */
MyDrawEdge(hdc, &pPreviewData->rcDialogFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, theme);
SetTextColor(hdc, theme->crColor[COLOR_WINDOW]);
MyDrawEdge(hdc, &pPreviewData->rcDialogFrame, EDGE_RAISED, BF_RECT | BF_MIDDLE, scheme);
SetTextColor(hdc, scheme->crColor[COLOR_WINDOW]);
MyDrawCaptionTemp(NULL, hdc, &pPreviewData->rcDialogCaption, pPreviewData->hCaptionFont,
NULL, pPreviewData->lpMessBox, DC_ACTIVE | DC_GRADIENT | DC_ICON | DC_TEXT, theme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcDialogCaption, FALSE, pPreviewData->cyCaption - 2, theme);
NULL, pPreviewData->lpMessBox, DC_ACTIVE | DC_GRADIENT | DC_ICON | DC_TEXT, scheme);
MyDrawCaptionButtons(hdc, &pPreviewData->rcDialogCaption, FALSE, pPreviewData->cyCaption - 2, scheme);
/* Draw the dialog text */
CopyRect(&rc, &pPreviewData->rcDialogClient);
rc.left += 4;
rc.top += 2;
SetTextColor(hdc, theme->crColor[COLOR_BTNTEXT]);
SetTextColor(hdc, scheme->crColor[COLOR_BTNTEXT]);
hOldFont = SelectObject(hdc, pPreviewData->hMessageFont);
DrawText(hdc, pPreviewData->lpMessText, -1, &rc, DT_LEFT);
SelectObject(hdc, hOldFont);
/* Draw Button */
MyDrawFrameControl(hdc, &pPreviewData->rcDialogButton, DFC_BUTTON, DFCS_BUTTONPUSH, theme);
MyDrawFrameControl(hdc, &pPreviewData->rcDialogButton, DFC_BUTTON, DFCS_BUTTONPUSH, scheme);
CopyRect(&rc, &pPreviewData->rcDialogButton);
SetTextColor(hdc, theme->crColor[COLOR_BTNTEXT]);
SetTextColor(hdc, scheme->crColor[COLOR_BTNTEXT]);
hOldFont = SelectObject(hdc, pPreviewData->hMessageFont);
DrawText(hdc, pPreviewData->lpButText, -1, &rc, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
SelectObject(hdc, hOldFont);
@ -494,7 +494,7 @@ PreviewWndProc(HWND hwnd,
break;
case PVM_UPDATETHEME:
UpdatePreviewTheme(hwnd, pPreviewData, (THEME *)lParam);
UpdatePreviewTheme(hwnd, pPreviewData, (COLOR_SCHEME *)lParam);
break;
default:

View file

@ -96,6 +96,7 @@
#define IDC_APPEARANCE_FONTSIZE 1502
#define IDC_APPEARANCE_EFFECTS 1503
#define IDC_APPEARANCE_ADVANCED 1504
#define IDC_APPEARANCE_VISUAL_STYLE 1505
#define IDS_INACTWIN 1510
#define IDS_ACTWIN 1511

View file

@ -10,7 +10,7 @@
#include "desk.h"
static BOOL g_PresetLoaded = FALSE;
static INT g_TemplateCount = 0;
INT g_TemplateCount = 0;
static INT g_ColorList[NUM_COLORS];
@ -20,7 +20,7 @@ static const TCHAR g_SelectedStyle[] = TEXT("SelectedStyle");
/******************************************************************************/
THEME_PRESET g_ThemeTemplates[MAX_TEMPLATES];
SCHEME_PRESET g_ColorSchemes[MAX_TEMPLATES];
/* This is the list of names for the colors stored in the registry */
static const TCHAR *g_RegColorNames[NUM_COLORS] =
@ -84,7 +84,7 @@ static const int g_SizeMetric[NUM_SIZES] =
/******************************************************************************/
VOID LoadCurrentTheme(THEME* theme)
VOID LoadCurrentScheme(COLOR_SCHEME* scheme)
{
INT i;
NONCLIENTMETRICS NonClientMetrics;
@ -93,43 +93,43 @@ VOID LoadCurrentTheme(THEME* theme)
for (i = 0; i < NUM_COLORS; i++)
{
g_ColorList[i] = i;
theme->crColor[i] = (COLORREF)GetSysColor(i);
scheme->crColor[i] = (COLORREF)GetSysColor(i);
}
/* Load sizes */
for (i = 0; i < NUM_SIZES; i++)
{
theme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
}
/* Load fonts */
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
theme->lfFont[FONT_CAPTION] = NonClientMetrics.lfCaptionFont;
theme->lfFont[FONT_SMCAPTION] = NonClientMetrics.lfSmCaptionFont;
theme->lfFont[FONT_MENU] = NonClientMetrics.lfMenuFont;
theme->lfFont[FONT_INFO] = NonClientMetrics.lfStatusFont;
theme->lfFont[FONT_DIALOG] = NonClientMetrics.lfMessageFont;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &theme->lfFont[FONT_ICON], 0);
scheme->lfFont[FONT_CAPTION] = NonClientMetrics.lfCaptionFont;
scheme->lfFont[FONT_SMCAPTION] = NonClientMetrics.lfSmCaptionFont;
scheme->lfFont[FONT_MENU] = NonClientMetrics.lfMenuFont;
scheme->lfFont[FONT_INFO] = NonClientMetrics.lfStatusFont;
scheme->lfFont[FONT_DIALOG] = NonClientMetrics.lfMessageFont;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &scheme->lfFont[FONT_ICON], 0);
/* Effects */
/* "Use the following transition effect for menus and tooltips" */
SystemParametersInfo(SPI_GETMENUANIMATION, sizeof(BOOL), &theme->Effects.bMenuAnimation, 0);
SystemParametersInfo(SPI_GETMENUFADE, sizeof(BOOL), &theme->Effects.bMenuFade, 0);
SystemParametersInfo(SPI_GETMENUANIMATION, sizeof(BOOL), &scheme->Effects.bMenuAnimation, 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
* Just keep them in sync for now:
*/
theme->Effects.bTooltipAnimation = theme->Effects.bMenuAnimation;
theme->Effects.bTooltipFade = theme->Effects.bMenuFade;
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
/* show content of windows during dragging */
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &theme->Effects.bDragFullWindows, 0);
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &scheme->Effects.bDragFullWindows, 0);
/* "Hide underlined letters for keyboard navigation until I press the Alt key" */
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &theme->Effects.bKeyboardCues, 0);
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &scheme->Effects.bKeyboardCues, 0);
}
BOOL LoadThemeFromReg(THEME* theme, INT ThemeId)
BOOL LoadSchemeFromReg(COLOR_SCHEME* scheme, INT SchemeId)
{
INT i;
TCHAR strSelectedStyle[4];
@ -141,37 +141,37 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId)
BOOL Ret = FALSE;
if (!g_PresetLoaded)
LoadThemePresetEntries(strSelectedStyle);
LoadSchemePresetEntries(strSelectedStyle);
if (ThemeId == -1)
if (SchemeId == -1)
return FALSE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_READ, &hkNewSchemes) == ERROR_SUCCESS)
{
if (RegOpenKeyEx(hkNewSchemes, g_ThemeTemplates[ThemeId].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS)
if (RegOpenKeyEx(hkNewSchemes, g_ColorSchemes[SchemeId].strKeyName, 0, KEY_READ, &hkScheme) == ERROR_SUCCESS)
{
lstrcpyn(&strSizeName[6], g_ThemeTemplates[ThemeId].strSizeName, 3);
lstrcpyn(&strSizeName[6], g_ColorSchemes[SchemeId].strSizeName, 3);
if (RegOpenKeyEx(hkScheme, strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
{
Ret = TRUE;
dwLength = sizeof(DWORD);
if (RegQueryValueEx(hkSize, TEXT("FlatMenus"), NULL, &dwType, (LPBYTE)&theme->bFlatMenus, &dwLength) != ERROR_SUCCESS ||
if (RegQueryValueEx(hkSize, TEXT("FlatMenus"), NULL, &dwType, (LPBYTE)&scheme->bFlatMenus, &dwLength) != ERROR_SUCCESS ||
dwType != REG_DWORD)
{
/* Failed to read registry value */
theme->bFlatMenus = FALSE;
scheme->bFlatMenus = FALSE;
}
for (i = 0; i < NUM_COLORS; i++)
{
wsprintf(strValueName, TEXT("Color #%d"), i);
dwLength = sizeof(COLORREF);
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&theme->crColor[i], &dwLength) != ERROR_SUCCESS ||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->crColor[i], &dwLength) != ERROR_SUCCESS ||
dwType != REG_DWORD)
{
/* Failed to read registry value, initialize with current setting for now */
theme->crColor[i] = GetSysColor(i);
scheme->crColor[i] = GetSysColor(i);
}
}
@ -179,7 +179,7 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId)
{
wsprintf(strValueName, TEXT("Font #%d"), i);
dwLength = sizeof(LOGFONT);
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&theme->lfFont[i], &dwLength) != ERROR_SUCCESS ||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->lfFont[i], &dwLength) != ERROR_SUCCESS ||
dwType != REG_BINARY || dwLength != sizeof(LOGFONT))
{
/* Failed to read registry value */
@ -195,12 +195,12 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId)
dwType != REG_QWORD || dwLength != sizeof(UINT64))
{
/* Failed to read registry value, initialize with current setting for now */
theme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
}
else
theme->Size[i] = (INT)iSize;
scheme->Size[i] = (INT)iSize;
}
RegCloseKey(hkScheme);
RegCloseKey(hkSize);
}
RegCloseKey(hkScheme);
}
@ -210,7 +210,7 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId)
return Ret;
}
VOID ApplyTheme(THEME* theme, INT ThemeId)
VOID ApplyScheme(COLOR_SCHEME* scheme, INT SchemeId)
{
INT i, Result;
HKEY hKey;
@ -219,7 +219,7 @@ VOID ApplyTheme(THEME* theme, INT ThemeId)
ICONMETRICS IconMetrics;
/* Apply Colors from global variable */
SetSysColors(NUM_COLORS, g_ColorList, theme->crColor);
SetSysColors(NUM_COLORS, g_ColorList, scheme->crColor);
/* Save colors to registry */
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
@ -227,9 +227,9 @@ VOID ApplyTheme(THEME* theme, INT ThemeId)
{
for (i = 0; i < NUM_COLORS; i++)
{
DWORD red = GetRValue(theme->crColor[i]);
DWORD green = GetGValue(theme->crColor[i]);
DWORD blue = GetBValue(theme->crColor[i]);
DWORD red = GetRValue(scheme->crColor[i]);
DWORD green = GetGValue(scheme->crColor[i]);
DWORD blue = GetBValue(scheme->crColor[i]);
wsprintf(clText, TEXT("%d %d %d"), red, green, blue);
RegSetValueEx(hKey, g_RegColorNames[i], 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
}
@ -239,20 +239,20 @@ VOID ApplyTheme(THEME* theme, INT ThemeId)
/* Apply non client metrics */
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
NonClientMetrics.lfCaptionFont = theme->lfFont[FONT_CAPTION];
NonClientMetrics.lfSmCaptionFont = theme->lfFont[FONT_SMCAPTION];
NonClientMetrics.lfMenuFont = theme->lfFont[FONT_MENU];
NonClientMetrics.lfStatusFont = theme->lfFont[FONT_INFO];
NonClientMetrics.lfMessageFont = theme->lfFont[FONT_DIALOG];
NonClientMetrics.iBorderWidth = theme->Size[SIZE_BORDER_X];
NonClientMetrics.iScrollWidth = theme->Size[SIZE_SCROLL_X];
NonClientMetrics.iScrollHeight = theme->Size[SIZE_SCROLL_Y];
NonClientMetrics.iCaptionWidth = theme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iCaptionHeight = theme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iSmCaptionWidth = theme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iSmCaptionHeight = theme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iMenuWidth = theme->Size[SIZE_MENU_SIZE_X];
NonClientMetrics.iMenuHeight = theme->Size[SIZE_MENU_Y];
NonClientMetrics.lfCaptionFont = scheme->lfFont[FONT_CAPTION];
NonClientMetrics.lfSmCaptionFont = scheme->lfFont[FONT_SMCAPTION];
NonClientMetrics.lfMenuFont = scheme->lfFont[FONT_MENU];
NonClientMetrics.lfStatusFont = scheme->lfFont[FONT_INFO];
NonClientMetrics.lfMessageFont = scheme->lfFont[FONT_DIALOG];
NonClientMetrics.iBorderWidth = scheme->Size[SIZE_BORDER_X];
NonClientMetrics.iScrollWidth = scheme->Size[SIZE_SCROLL_X];
NonClientMetrics.iScrollHeight = scheme->Size[SIZE_SCROLL_Y];
NonClientMetrics.iCaptionWidth = scheme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iCaptionHeight = scheme->Size[SIZE_CAPTION_Y];
NonClientMetrics.iSmCaptionWidth = scheme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iSmCaptionHeight = scheme->Size[SIZE_SMCAPTION_Y];
NonClientMetrics.iMenuWidth = scheme->Size[SIZE_MENU_SIZE_X];
NonClientMetrics.iMenuHeight = scheme->Size[SIZE_MENU_Y];
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS),
&NonClientMetrics,
@ -261,9 +261,9 @@ VOID ApplyTheme(THEME* theme, INT ThemeId)
/* Apply icon metrics */
IconMetrics.cbSize = sizeof(ICONMETRICS);
SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &IconMetrics, 0);
IconMetrics.iHorzSpacing = theme->Size[SIZE_ICON_SPC_X];
IconMetrics.iVertSpacing = theme->Size[SIZE_ICON_SPC_Y];
IconMetrics.lfFont = theme->lfFont[FONT_ICON];
IconMetrics.iHorzSpacing = scheme->Size[SIZE_ICON_SPC_X];
IconMetrics.iVertSpacing = scheme->Size[SIZE_ICON_SPC_Y];
IconMetrics.lfFont = scheme->lfFont[FONT_ICON];
SystemParametersInfo(SPI_SETICONMETRICS,
sizeof(ICONMETRICS),
&IconMetrics,
@ -273,44 +273,44 @@ VOID ApplyTheme(THEME* theme, INT ThemeId)
/* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
* Just keep them in sync for now.
*/
theme->Effects.bTooltipAnimation = theme->Effects.bMenuAnimation;
theme->Effects.bTooltipFade = theme->Effects.bMenuFade;
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, theme->Effects.bDragFullWindows, (PVOID)&theme->Effects.bDragFullWindows, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, IntToPtr(theme->Effects.bKeyboardCues), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
//SystemParametersInfo(SPI_SETACTIVEWINDOWTRACKING, 0, (PVOID)&theme->Effects.bActiveWindowTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)&theme->Effects.bMenuAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETCOMBOBOXANIMATION, 0, (PVOID)&theme->Effects.bComboBoxAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&theme->Effects.bListBoxSmoothScrolling, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETGRADIENTCAPTIONS, 0, (PVOID)&theme->Effects.bGradientCaptions, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETACTIVEWNDTRKZORDER, 0, (PVOID)&theme->Effects.bActiveWndTrkZorder, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETHOTTRACKING, 0, (PVOID)&theme->Effects.bHotTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETMENUFADE, 0, (PVOID)&theme->Effects.bMenuFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETSELECTIONFADE, 0, (PVOID)&theme->Effects.bSelectionFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETTOOLTIPANIMATION, 0, (PVOID)&theme->Effects.bTooltipAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETTOOLTIPFADE, 0, (PVOID)&theme->Effects.bTooltipFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)&theme->Effects.bCursorShadow, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
//SystemParametersInfo(SPI_SETUIEFFECTS, 0, (PVOID)&theme->Effects.bUiEffects, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
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_SETACTIVEWINDOWTRACKING, 0, (PVOID)&scheme->Effects.bActiveWindowTracking, 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_SETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&scheme->Effects.bListBoxSmoothScrolling, 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_SETHOTTRACKING, 0, (PVOID)&scheme->Effects.bHotTracking, 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_SETTOOLTIPANIMATION, 0, (PVOID)&scheme->Effects.bTooltipAnimation, 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_SETUIEFFECTS, 0, (PVOID)&scheme->Effects.bUiEffects, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
/* Save ThemeId */
/* Save SchemeId */
Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey);
if (Result == ERROR_SUCCESS)
{
if (ThemeId == -1)
if (SchemeId == -1)
clText[0] = TEXT('\0');
else
lstrcpy(clText, g_ThemeTemplates[ThemeId].strKeyName);
lstrcpy(clText, g_ColorSchemes[SchemeId].strKeyName);
RegSetValueEx(hKey, g_SelectedStyle, 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
RegCloseKey(hKey);
}
}
BOOL SaveTheme(THEME* theme, LPCTSTR strLegacyName)
BOOL SaveScheme(COLOR_SCHEME* scheme, LPCTSTR strLegacyName)
{
/* FIXME: implement */
return FALSE;
}
INT LoadThemePresetEntries(LPTSTR pszSelectedStyle)
INT LoadSchemePresetEntries(LPTSTR pszSelectedStyle)
{
HKEY hkNewSchemes, hkScheme, hkSizes, hkSize;
FILETIME ftLastWriteTime;
@ -338,27 +338,27 @@ INT LoadThemePresetEntries(LPTSTR pszSelectedStyle)
iStyle = 0;
dwLength = MAX_TEMPLATENAMELENTGH;
while((RegEnumKeyEx(hkNewSchemes, iStyle, g_ThemeTemplates[iTemplateIndex].strKeyName, &dwLength,
while((RegEnumKeyEx(hkNewSchemes, iStyle, g_ColorSchemes[iTemplateIndex].strKeyName, &dwLength,
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iTemplateIndex < MAX_TEMPLATES))
{
/* is it really a template or one of the other entries */
if (dwLength <= 4)
{
if (RegOpenKeyEx(hkNewSchemes, g_ThemeTemplates[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)
{
iSize = 0;
dwLength = 3;
while((RegEnumKeyEx(hkSizes, iSize, g_ThemeTemplates[iTemplateIndex].strSizeName, &dwLength,
while((RegEnumKeyEx(hkSizes, iSize, g_ColorSchemes[iTemplateIndex].strSizeName, &dwLength,
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iSize <= 4))
{
if(RegOpenKeyEx(hkSizes, g_ThemeTemplates[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
if(RegOpenKeyEx(hkSizes, g_ColorSchemes[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
{
dwLength = MAX_TEMPLATENAMELENTGH;
RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ThemeTemplates[iTemplateIndex].strDisplayName, &dwLength);
RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strDisplayName, &dwLength);
dwLength = MAX_TEMPLATENAMELENTGH;
RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ThemeTemplates[iTemplateIndex].strLegacyName, &dwLength);
RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strLegacyName, &dwLength);
RegCloseKey(hkSize);
}
iSize++;
@ -379,3 +379,160 @@ INT LoadThemePresetEntries(LPTSTR pszSelectedStyle)
}
return iTemplateIndex;
}
typedef HRESULT (WINAPI * ENUMTHEMESTYLE) (LPCWSTR, LPWSTR, DWORD, PTHEMENAMES);
BOOL AddThemeStyles(LPCWSTR pszThemeFileName, HDSA* Styles, int* count, ENUMTHEMESTYLE enumTheme)
{
DWORD index = 0;
THEMENAMES names;
THEME_STYLE StyleName;
*Styles = DSA_Create(sizeof(THEMENAMES),1);
*count = 0;
while (SUCCEEDED (enumTheme (pszThemeFileName, NULL, index++, &names)))
{
StyleName.StlyeName = _wcsdup(names.szName);
StyleName.DisplayName = _wcsdup(names.szDisplayName);
(*count)++;
DSA_InsertItem(*Styles, *count, &StyleName);
}
return TRUE;
}
BOOL CALLBACK EnumThemeProc(LPVOID lpReserved,
LPCWSTR pszThemeFileName,
LPCWSTR pszThemeName,
LPCWSTR pszToolTip, LPVOID lpReserved2,
LPVOID lpData)
{
THEME theme;
GLOBALS *g = (GLOBALS *) lpData;
theme.themeFileName = _wcsdup(pszThemeFileName);
theme.displayName = _wcsdup(pszThemeName);
AddThemeStyles( pszThemeFileName, &theme.Sizes, &theme.SizesCount, (ENUMTHEMESTYLE)EnumThemeSizes);
AddThemeStyles( pszThemeFileName, &theme.Colors, &theme.ColorsCount, (ENUMTHEMESTYLE)EnumThemeColors);
DSA_InsertItem(g->Themes, DSA_APPEND , &theme);
g->ThemesCount++;
return TRUE;
}
void LoadThemes(GLOBALS *g)
{
WCHAR themesPath[MAX_PATH];
HRESULT hret;
THEME ClassicTheme;
WCHAR szThemeFileName[MAX_PATH];
WCHAR szColorBuff[MAX_PATH];
WCHAR szSizeBuff[MAX_PATH];
/* Initialize themes dsa */
g->Themes = DSA_Create(sizeof(THEME),5);
/* Insert the classic theme */
memset(&ClassicTheme, 0, sizeof(THEME));
ClassicTheme.displayName = _wcsdup(L"Classic Theme");
DSA_InsertItem(g->Themes, 0, &ClassicTheme);
g->ThemesCount = 1;
/* Retrieve the name of the current theme */
hret = GetCurrentThemeName(szThemeFileName,
MAX_PATH,
szColorBuff,
MAX_PATH,
szSizeBuff,
MAX_PATH);
if (FAILED (hret))
{
g->pszThemeFileName = NULL;
g->pszColorName = NULL;
g->pszSizeName = NULL;
}
else
{
/* Cache the name of the active theme */
g->pszThemeFileName = _wcsdup(szThemeFileName);
g->pszColorName = _wcsdup(szColorBuff);
g->pszSizeName = _wcsdup(szSizeBuff);
}
/* Get path to themes folder */
hret = SHGetFolderPathW (NULL, CSIDL_RESOURCES, NULL, SHGFP_TYPE_CURRENT, themesPath);
if (FAILED (hret))
return;
lstrcatW (themesPath, L"\\Themes");
/* Enumerate themes */
hret = EnumThemes(themesPath, EnumThemeProc, g);
}
HRESULT ActivateTheme(PTHEME pTheme, int iColor, int iSize)
{
PTHEME_STYLE pThemeColor;
PTHEME_STYLE pThemeSize;
HTHEMEFILE hThemeFile = 0;
HRESULT hret;
if(pTheme->themeFileName)
{
pThemeColor = (PTHEME_STYLE)DSA_GetItemPtr(pTheme->Colors, iColor);
pThemeSize = (PTHEME_STYLE)DSA_GetItemPtr(pTheme->Sizes, iSize);
hret = OpenThemeFile(pTheme->themeFileName,
pThemeColor->StlyeName,
pThemeSize->StlyeName,
&hThemeFile,
0);
if(!SUCCEEDED(hret))
{
return hret;
}
}
hret = ApplyTheme(hThemeFile, "", 0);
if(pTheme->themeFileName)
{
hret = CloseThemeFile(hThemeFile);
}
return hret;
}
int CALLBACK CleanUpThemeStlyeCallback(void *p, void *pData)
{
PTHEME_STYLE pStyle = (PTHEME_STYLE)p;
free(pStyle->DisplayName);
free(pStyle->StlyeName);
return TRUE;
}
int CALLBACK CleanUpThemeCallback(void *p, void *pData)
{
PTHEME pTheme = (PTHEME)p;
free(pTheme->displayName);
free(pTheme->themeFileName);
DSA_DestroyCallback(pTheme->Colors, CleanUpThemeStlyeCallback, NULL);
DSA_DestroyCallback(pTheme->Sizes, CleanUpThemeStlyeCallback, NULL);
return TRUE;
}
void CleanupThemes(GLOBALS *g)
{
free(g->pszThemeFileName);
free(g->pszColorName);
free(g->pszSizeName);
DSA_DestroyCallback(g->Themes, CleanUpThemeCallback, NULL);
}

View file

@ -1,86 +0,0 @@
/* Some definitions for theme */
#define SIZE_BORDER_X 0
#define SIZE_BORDER_Y 1
#define SIZE_CAPTION_Y 2
#define SIZE_ICON_X 3
#define SIZE_ICON_Y 4
#define SIZE_ICON_SPC_X 5
#define SIZE_ICON_SPC_Y 6
#define SIZE_MENU_SIZE_X 7
#define SIZE_MENU_Y 8
#define SIZE_SCROLL_X 9
#define SIZE_SCROLL_Y 10
#define SIZE_SMCAPTION_Y 11
#define SIZE_EDGE_X 12
#define SIZE_EDGE_Y 13
#define SIZE_FRAME_Y 14
#define SIZE_MENU_CHECK_X 15
#define SIZE_MENU_CHECK_Y 16
#define SIZE_MENU_SIZE_Y 17
#define SIZE_SIZE_X 18
#define SIZE_SIZE_Y 19
#define FONT_CAPTION 0
#define FONT_SMCAPTION 1
#define FONT_HILIGHT 2
#define FONT_MENU 2
#define FONT_ICON 3
#define FONT_INFO 4
#define FONT_DIALOG 5
#define NUM_ELEMENTS 22
#define NUM_FONTS 6
#define NUM_SIZES 20
#define NUM_COLORS 31
#define MAX_TEMPLATES 50
#define MAX_TEMPLATENAMELENTGH 80
/* Some typedefs for theme */
/* Most (but not all) fields below correspond to HKCU\Control Panel\Desktop\UserPreferencesMask */
typedef struct
{
BOOL bActiveWindowTracking;
BOOL bMenuAnimation;
BOOL bComboBoxAnimation;
BOOL bListBoxSmoothScrolling;
BOOL bGradientCaptions;
BOOL bKeyboardCues;
BOOL bActiveWndTrkZorder;
BOOL bHotTracking;
BOOL bMenuFade;
BOOL bSelectionFade;
BOOL bTooltipAnimation;
BOOL bTooltipFade;
BOOL bCursorShadow;
BOOL bUiEffects;
BOOL bFontSmoothing;
BOOL bDragFullWindows;
UINT uiFontSmoothingType;
} EFFECTS;
typedef struct
{
COLORREF crColor[NUM_COLORS];
LOGFONT lfFont[NUM_FONTS];
INT Size[NUM_SIZES];
BOOL bFlatMenus;
EFFECTS Effects;
} THEME;
typedef struct
{
TCHAR strKeyName[4];
TCHAR strSizeName[4];
TCHAR strDisplayName[MAX_TEMPLATENAMELENTGH];
TCHAR strLegacyName[MAX_TEMPLATENAMELENTGH];
} THEME_PRESET;
extern THEME_PRESET g_ThemeTemplates[MAX_TEMPLATES];
/* prototypes for theme.c */
VOID LoadCurrentTheme(THEME* theme);
BOOL LoadThemeFromReg(THEME* theme, INT ThemeId);
VOID ApplyTheme(THEME* theme, INT ThemeId);
BOOL SaveTheme(THEME* theme, LPCTSTR strLegacyName);
INT LoadThemePresetEntries(LPTSTR pszSelectedStyle);