mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
[desk.cpl]
- Formatting: Convert tabs to spaces - No code changes svn path=/trunk/; revision=58797
This commit is contained in:
parent
d2577f2eff
commit
78cb9a84f2
File diff suppressed because it is too large
Load diff
|
@ -15,245 +15,245 @@
|
|||
static void
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
INT i, /*TemplateCount,*/ iListIndex;
|
||||
HWND hwndColor, hwndTheme;
|
||||
GLOBALS *g;
|
||||
INT i, /*TemplateCount,*/ iListIndex;
|
||||
HWND hwndColor, hwndTheme;
|
||||
GLOBALS *g;
|
||||
|
||||
g = (GLOBALS*)LocalAlloc(LPTR, sizeof(GLOBALS));
|
||||
if (g == NULL)
|
||||
return FALSE;
|
||||
g = (GLOBALS*)LocalAlloc(LPTR, sizeof(GLOBALS));
|
||||
if (g == NULL)
|
||||
return FALSE;
|
||||
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
LoadThemes(g);
|
||||
LoadThemes(g);
|
||||
|
||||
/*TemplateCount = */ LoadSchemePresetEntries(g->strSelectedStyle);
|
||||
/*TemplateCount = */ LoadSchemePresetEntries(g->strSelectedStyle);
|
||||
|
||||
hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
g->SchemeId = -1;
|
||||
g->bInitializing = TRUE;
|
||||
hwndColor = GetDlgItem(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
g->SchemeId = -1;
|
||||
g->bInitializing = TRUE;
|
||||
|
||||
hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
|
||||
for(i = 0; i < g->ThemesCount; i++)
|
||||
{
|
||||
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;
|
||||
g->bThemeActive = (pTheme->themeFileName != NULL);
|
||||
SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0);
|
||||
AppearancePage_ShowColorScemes(g, hwndColor, i);
|
||||
}
|
||||
hwndTheme = GetDlgItem(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
|
||||
for(i = 0; i < g->ThemesCount; i++)
|
||||
{
|
||||
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;
|
||||
g->bThemeActive = (pTheme->themeFileName != NULL);
|
||||
SendMessage(hwndTheme, CB_SETCURSEL, (WPARAM)iListIndex, 0);
|
||||
AppearancePage_ShowColorScemes(g, hwndColor, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
g->bInitializing = FALSE;
|
||||
g->bInitializing = FALSE;
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static VOID
|
||||
AppearancePage_OnDestroy(HWND hwndDlg, GLOBALS *g)
|
||||
{
|
||||
LocalFree(g);
|
||||
LocalFree(g);
|
||||
}
|
||||
|
||||
static INT
|
||||
GetSelectedId(HWND hwndDlg, int nIDDlgItem)
|
||||
{
|
||||
HWND hwndCombo;
|
||||
INT sel;
|
||||
HWND hwndCombo;
|
||||
INT sel;
|
||||
|
||||
hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem);
|
||||
sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
|
||||
if (sel == CB_ERR)
|
||||
return -1;
|
||||
return (INT)SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM)sel, 0);
|
||||
hwndCombo = GetDlgItem(hwndDlg, nIDDlgItem);
|
||||
sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
|
||||
if (sel == CB_ERR)
|
||||
return -1;
|
||||
return (INT)SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM)sel, 0);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
GLOBALS *g;
|
||||
LPNMHDR lpnm;
|
||||
GLOBALS *g;
|
||||
LPNMHDR lpnm;
|
||||
|
||||
g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return AppearancePage_OnInit(hwndDlg);
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return AppearancePage_OnInit(hwndDlg);
|
||||
|
||||
case WM_DESTROY:
|
||||
AppearancePage_OnDestroy(hwndDlg, g);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
AppearancePage_OnDestroy(hwndDlg, g);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_APPEARANCE_EFFECTS:
|
||||
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_EFFAPPEARANCE),
|
||||
hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
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->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->Scheme);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_APPEARANCE_EFFECTS:
|
||||
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_EFFAPPEARANCE),
|
||||
hwndDlg, EffAppearanceDlgProc, (LPARAM)g) == IDOK)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
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->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->Scheme);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_APPEARANCE_ADVANCED:
|
||||
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_ADVAPPEARANCE),
|
||||
hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
g->bSchemeChanged = TRUE;
|
||||
g->Scheme = g->SchemeAdv;
|
||||
g->SchemeId = -1; /* Customized */
|
||||
g_GlobalData.desktop_color = g->Scheme.crColor[COLOR_DESKTOP];
|
||||
case IDC_APPEARANCE_ADVANCED:
|
||||
if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_ADVAPPEARANCE),
|
||||
hwndDlg, AdvAppearanceDlgProc, (LPARAM)g) == IDOK)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
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_COLORSCHEME, CB_SETCURSEL, (WPARAM)-1, 0);
|
||||
SetDlgItemText(hwndDlg, IDC_APPEARANCE_COLORSCHEME, TEXT(""));
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
|
||||
}
|
||||
break;
|
||||
SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->Scheme);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_APPEARANCE_COLORSCHEME:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
|
||||
{
|
||||
INT SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
case IDC_APPEARANCE_COLORSCHEME:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE && !g->bInitializing)
|
||||
{
|
||||
INT SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
||||
if(g->bThemeActive == FALSE)
|
||||
{
|
||||
COLOR_SCHEME Scheme;
|
||||
if(g->bThemeActive == FALSE)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
||||
g->bThemeActive = (ThemeId!=0);
|
||||
g->bThemeChanged = TRUE;
|
||||
AppearancePage_ShowColorScemes(g, hwndColor, ThemeId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
g->bThemeActive = (ThemeId!=0);
|
||||
g->bThemeChanged = TRUE;
|
||||
AppearancePage_ShowColorScemes(g, hwndColor, ThemeId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
lpnm = (LPNMHDR)lParam;
|
||||
switch (lpnm->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
case WM_NOTIFY:
|
||||
lpnm = (LPNMHDR)lParam;
|
||||
switch (lpnm->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
|
||||
g->ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
|
||||
g->SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
g->ThemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_VISUAL_STYLE);
|
||||
g->SchemeId = GetSelectedId(hwndDlg, IDC_APPEARANCE_COLORSCHEME);
|
||||
|
||||
if(g->bSchemeChanged)
|
||||
{
|
||||
ApplyScheme(&g->Scheme, g->SchemeId);
|
||||
}
|
||||
if(g->bSchemeChanged)
|
||||
{
|
||||
ApplyScheme(&g->Scheme, g->SchemeId);
|
||||
}
|
||||
|
||||
if(g->bThemeChanged)
|
||||
{
|
||||
PTHEME pTheme = (PTHEME)DSA_GetItemPtr(g->Themes, g->ThemeId);
|
||||
ActivateTheme(pTheme, g->SchemeId, 0);
|
||||
}
|
||||
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;
|
||||
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;
|
||||
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)FALSE);
|
||||
return TRUE;
|
||||
case PSN_KILLACTIVE:
|
||||
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)FALSE);
|
||||
return TRUE;
|
||||
|
||||
case PSN_SETACTIVE:
|
||||
if (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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PSN_SETACTIVE:
|
||||
if (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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -40,57 +40,57 @@
|
|||
/* 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;
|
||||
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;
|
||||
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];
|
||||
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;
|
||||
WCHAR* StlyeName;
|
||||
WCHAR* DisplayName;
|
||||
} THEME_STYLE, *PTHEME_STYLE;
|
||||
|
||||
typedef struct _THEME
|
||||
{
|
||||
WCHAR* themeFileName;
|
||||
WCHAR* displayName;
|
||||
HDSA Colors;
|
||||
int ColorsCount;
|
||||
HDSA Sizes;
|
||||
int SizesCount;
|
||||
WCHAR* themeFileName;
|
||||
WCHAR* displayName;
|
||||
HDSA Colors;
|
||||
int ColorsCount;
|
||||
HDSA Sizes;
|
||||
int SizesCount;
|
||||
|
||||
} THEME, *PTHEME;
|
||||
|
||||
|
@ -99,27 +99,27 @@ typedef struct _THEME
|
|||
or by passing hwnd and getting the pointer by GetWindowLongPtr */
|
||||
typedef struct tagGLOBALS
|
||||
{
|
||||
HDSA Themes;
|
||||
int ThemesCount;
|
||||
BOOL bThemeActive;
|
||||
HDSA Themes;
|
||||
int ThemesCount;
|
||||
BOOL bThemeActive;
|
||||
|
||||
INT ThemeId;
|
||||
INT SchemeId; /* Theme is customized if SchemeId == -1 */
|
||||
INT SizeID;
|
||||
TCHAR strSelectedStyle[4];
|
||||
INT ThemeId;
|
||||
INT SchemeId; /* Theme is customized if SchemeId == -1 */
|
||||
INT SizeID;
|
||||
TCHAR strSelectedStyle[4];
|
||||
|
||||
LPWSTR pszThemeFileName;
|
||||
LPWSTR pszColorName;
|
||||
LPWSTR pszSizeName;
|
||||
LPWSTR pszThemeFileName;
|
||||
LPWSTR pszColorName;
|
||||
LPWSTR pszSizeName;
|
||||
|
||||
COLOR_SCHEME Scheme;
|
||||
COLOR_SCHEME SchemeAdv;
|
||||
BOOL bThemeChanged;
|
||||
BOOL bSchemeChanged;
|
||||
HBITMAP hbmpColor[3];
|
||||
INT CurrentElement;
|
||||
HFONT hBoldFont;
|
||||
HFONT hItalicFont;
|
||||
COLOR_SCHEME Scheme;
|
||||
COLOR_SCHEME SchemeAdv;
|
||||
BOOL bThemeChanged;
|
||||
BOOL bSchemeChanged;
|
||||
HBITMAP hbmpColor[3];
|
||||
INT CurrentElement;
|
||||
HFONT hBoldFont;
|
||||
HFONT hItalicFont;
|
||||
BOOL bInitializing;
|
||||
} GLOBALS;
|
||||
|
||||
|
|
|
@ -14,218 +14,218 @@
|
|||
|
||||
DWORD WINAPI
|
||||
DisplayClassInstaller(
|
||||
IN DI_FUNCTION InstallFunction,
|
||||
IN HDEVINFO DeviceInfoSet,
|
||||
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
|
||||
IN DI_FUNCTION InstallFunction,
|
||||
IN HDEVINFO DeviceInfoSet,
|
||||
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
|
||||
{
|
||||
SP_DEVINSTALL_PARAMS InstallParams;
|
||||
SP_DRVINFO_DATA DriverInfoData;
|
||||
HINF hInf = INVALID_HANDLE_VALUE;
|
||||
TCHAR SectionName[MAX_PATH];
|
||||
TCHAR ServiceName[MAX_SERVICE_NAME_LEN];
|
||||
SP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
|
||||
HKEY hDriverKey = INVALID_HANDLE_VALUE; /* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
|
||||
HKEY hSettingsKey = NULL;
|
||||
HKEY hServicesKey = NULL;
|
||||
HKEY hServiceKey = NULL;
|
||||
HKEY hDeviceSubKey = NULL;
|
||||
DWORD disposition;
|
||||
BOOL result;
|
||||
LONG rc;
|
||||
SP_DEVINSTALL_PARAMS InstallParams;
|
||||
SP_DRVINFO_DATA DriverInfoData;
|
||||
HINF hInf = INVALID_HANDLE_VALUE;
|
||||
TCHAR SectionName[MAX_PATH];
|
||||
TCHAR ServiceName[MAX_SERVICE_NAME_LEN];
|
||||
SP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
|
||||
HKEY hDriverKey = INVALID_HANDLE_VALUE; /* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
|
||||
HKEY hSettingsKey = NULL;
|
||||
HKEY hServicesKey = NULL;
|
||||
HKEY hServiceKey = NULL;
|
||||
HKEY hDeviceSubKey = NULL;
|
||||
DWORD disposition;
|
||||
BOOL result;
|
||||
LONG rc;
|
||||
|
||||
if (InstallFunction != DIF_INSTALLDEVICE)
|
||||
return ERROR_DI_DO_DEFAULT;
|
||||
if (InstallFunction != DIF_INSTALLDEVICE)
|
||||
return ERROR_DI_DO_DEFAULT;
|
||||
|
||||
/* Set DI_DONOTCALLCONFIGMG flag */
|
||||
InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
|
||||
result = SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Set DI_DONOTCALLCONFIGMG flag */
|
||||
InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
|
||||
result = SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
InstallParams.Flags |= DI_DONOTCALLCONFIGMG;
|
||||
InstallParams.Flags |= DI_DONOTCALLCONFIGMG;
|
||||
|
||||
result = SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
result = SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Do normal install */
|
||||
result = SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiInstallDevice() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Do normal install */
|
||||
result = SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiInstallDevice() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Get .inf file name and section name */
|
||||
DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
|
||||
result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, &DriverInfoData);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetSelectedDriver() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Get .inf file name and section name */
|
||||
DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
|
||||
result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, &DriverInfoData);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetSelectedDriver() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
|
||||
result = SetupDiGetDriverInfoDetail(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
&DriverInfoData, &DriverInfoDetailData,
|
||||
sizeof(SP_DRVINFO_DETAIL_DATA), NULL);
|
||||
if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
|
||||
result = SetupDiGetDriverInfoDetail(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
&DriverInfoData, &DriverInfoDetailData,
|
||||
sizeof(SP_DRVINFO_DETAIL_DATA), NULL);
|
||||
if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL);
|
||||
if (hInf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupOpenInfFile() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL);
|
||||
if (hInf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupOpenInfFile() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = SetupDiGetActualSectionToInstall(
|
||||
hInf, DriverInfoDetailData.SectionName,
|
||||
SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetActualSectionToInstall() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
_tcscat(SectionName, _T(".SoftwareSettings"));
|
||||
result = SetupDiGetActualSectionToInstall(
|
||||
hInf, DriverInfoDetailData.SectionName,
|
||||
SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetActualSectionToInstall() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
_tcscat(SectionName, _T(".SoftwareSettings"));
|
||||
|
||||
/* Open driver registry key and create Settings subkey */
|
||||
hDriverKey = SetupDiOpenDevRegKey(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
DICS_FLAG_GLOBAL, 0, DIREG_DRV,
|
||||
KEY_CREATE_SUB_KEY);
|
||||
if (hDriverKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiOpenDevRegKey() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = RegCreateKeyEx(
|
||||
hDriverKey, L"Settings",
|
||||
0, NULL, REG_OPTION_NON_VOLATILE,
|
||||
/* Open driver registry key and create Settings subkey */
|
||||
hDriverKey = SetupDiOpenDevRegKey(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
DICS_FLAG_GLOBAL, 0, DIREG_DRV,
|
||||
KEY_CREATE_SUB_KEY);
|
||||
if (hDriverKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiOpenDevRegKey() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = RegCreateKeyEx(
|
||||
hDriverKey, L"Settings",
|
||||
0, NULL, REG_OPTION_NON_VOLATILE,
|
||||
#if _WIN32_WINNT >= 0x502
|
||||
KEY_READ | KEY_WRITE,
|
||||
KEY_READ | KEY_WRITE,
|
||||
#else
|
||||
KEY_ALL_ACCESS,
|
||||
KEY_ALL_ACCESS,
|
||||
#endif
|
||||
NULL, &hSettingsKey, &disposition);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
NULL, &hSettingsKey, &disposition);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Install .SoftwareSettings to Settings subkey */
|
||||
result = SetupInstallFromInfSection(
|
||||
InstallParams.hwndParent, hInf, SectionName,
|
||||
SPINST_REGISTRY, hSettingsKey,
|
||||
NULL, 0, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Install .SoftwareSettings to Settings subkey */
|
||||
result = SetupInstallFromInfSection(
|
||||
InstallParams.hwndParent, hInf, SectionName,
|
||||
SPINST_REGISTRY, hSettingsKey,
|
||||
NULL, 0, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Get service name and open service registry key */
|
||||
result = SetupDiGetDeviceRegistryProperty(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
SPDRP_SERVICE, NULL,
|
||||
(PBYTE)ServiceName, MAX_SERVICE_NAME_LEN * sizeof(TCHAR), NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDeviceRegistryProperty() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Get service name and open service registry key */
|
||||
result = SetupDiGetDeviceRegistryProperty(
|
||||
DeviceInfoSet, DeviceInfoData,
|
||||
SPDRP_SERVICE, NULL,
|
||||
(PBYTE)ServiceName, MAX_SERVICE_NAME_LEN * sizeof(TCHAR), NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupDiGetDeviceRegistryProperty() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = RegOpenKeyEx(
|
||||
HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services"),
|
||||
0, KEY_ENUMERATE_SUB_KEYS, &hServicesKey);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = RegOpenKeyEx(
|
||||
hServicesKey, ServiceName,
|
||||
0, KEY_CREATE_SUB_KEY, &hServiceKey);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = RegOpenKeyEx(
|
||||
HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services"),
|
||||
0, KEY_ENUMERATE_SUB_KEYS, &hServicesKey);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
rc = RegOpenKeyEx(
|
||||
hServicesKey, ServiceName,
|
||||
0, KEY_CREATE_SUB_KEY, &hServiceKey);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Create a Device0 subkey (FIXME: do a loop to find a free number?) */
|
||||
rc = RegCreateKeyEx(
|
||||
hServiceKey, _T("Device0"), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
|
||||
&hDeviceSubKey, &disposition);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
if (disposition != REG_CREATED_NEW_KEY)
|
||||
{
|
||||
rc = ERROR_GEN_FAILURE;
|
||||
DPRINT("RegCreateKeyEx() failed\n");
|
||||
goto cleanup;
|
||||
}
|
||||
/* Create a Device0 subkey (FIXME: do a loop to find a free number?) */
|
||||
rc = RegCreateKeyEx(
|
||||
hServiceKey, _T("Device0"), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
|
||||
&hDeviceSubKey, &disposition);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("RegCreateKeyEx() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
if (disposition != REG_CREATED_NEW_KEY)
|
||||
{
|
||||
rc = ERROR_GEN_FAILURE;
|
||||
DPRINT("RegCreateKeyEx() failed\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Install SoftwareSettings section */
|
||||
/* Yes, we're installing this section for the second time.
|
||||
* We don't want to create a link to Settings subkey */
|
||||
result = SetupInstallFromInfSection(
|
||||
InstallParams.hwndParent, hInf, SectionName,
|
||||
SPINST_REGISTRY, hDeviceSubKey,
|
||||
NULL, 0, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
/* Install SoftwareSettings section */
|
||||
/* Yes, we're installing this section for the second time.
|
||||
* We don't want to create a link to Settings subkey */
|
||||
result = SetupInstallFromInfSection(
|
||||
InstallParams.hwndParent, hInf, SectionName,
|
||||
SPINST_REGISTRY, hDeviceSubKey,
|
||||
NULL, 0, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!result)
|
||||
{
|
||||
rc = GetLastError();
|
||||
DPRINT("SetupInstallFromInfSection() failed with error 0x%lx\n", rc);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* FIXME: install OpenGLSoftwareSettings section */
|
||||
/* FIXME: install OpenGLSoftwareSettings section */
|
||||
|
||||
rc = ERROR_SUCCESS;
|
||||
rc = ERROR_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
if (hInf != INVALID_HANDLE_VALUE)
|
||||
SetupCloseInfFile(hInf);
|
||||
if (hDriverKey != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
|
||||
RegCloseKey(hDriverKey);
|
||||
}
|
||||
if (hSettingsKey != NULL)
|
||||
RegCloseKey(hSettingsKey);
|
||||
if (hServicesKey != NULL)
|
||||
RegCloseKey(hServicesKey);
|
||||
if (hServiceKey != NULL)
|
||||
RegCloseKey(hServiceKey);
|
||||
if (hDeviceSubKey != NULL)
|
||||
RegCloseKey(hDeviceSubKey);
|
||||
if (hInf != INVALID_HANDLE_VALUE)
|
||||
SetupCloseInfFile(hInf);
|
||||
if (hDriverKey != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/* SetupDiOpenDevRegKey returns INVALID_HANDLE_VALUE in case of error! */
|
||||
RegCloseKey(hDriverKey);
|
||||
}
|
||||
if (hSettingsKey != NULL)
|
||||
RegCloseKey(hSettingsKey);
|
||||
if (hServicesKey != NULL)
|
||||
RegCloseKey(hServicesKey);
|
||||
if (hServiceKey != NULL)
|
||||
RegCloseKey(hServiceKey);
|
||||
if (hDeviceSubKey != NULL)
|
||||
RegCloseKey(hDeviceSubKey);
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "desk.h"
|
||||
|
||||
#define NUM_APPLETS (1)
|
||||
#define NUM_APPLETS (1)
|
||||
|
||||
static LONG APIENTRY DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
|
|
@ -69,39 +69,39 @@ ULONG __cdecl DbgPrint(PCCH Format,...);
|
|||
*/
|
||||
typedef struct _RESOLUTION_INFO
|
||||
{
|
||||
DWORD dmPelsWidth;
|
||||
DWORD dmPelsHeight;
|
||||
DWORD dmPelsWidth;
|
||||
DWORD dmPelsHeight;
|
||||
} RESOLUTION_INFO, *PRESOLUTION_INFO;
|
||||
|
||||
typedef struct _SETTINGS_ENTRY
|
||||
{
|
||||
struct _SETTINGS_ENTRY *Blink;
|
||||
struct _SETTINGS_ENTRY *Flink;
|
||||
DWORD dmBitsPerPel;
|
||||
DWORD dmPelsWidth;
|
||||
DWORD dmPelsHeight;
|
||||
DWORD dmDisplayFrequency;
|
||||
struct _SETTINGS_ENTRY *Blink;
|
||||
struct _SETTINGS_ENTRY *Flink;
|
||||
DWORD dmBitsPerPel;
|
||||
DWORD dmPelsWidth;
|
||||
DWORD dmPelsHeight;
|
||||
DWORD dmDisplayFrequency;
|
||||
} SETTINGS_ENTRY, *PSETTINGS_ENTRY;
|
||||
|
||||
typedef struct _DISPLAY_DEVICE_ENTRY
|
||||
{
|
||||
struct _DISPLAY_DEVICE_ENTRY *Flink;
|
||||
LPTSTR DeviceDescription;
|
||||
LPTSTR DeviceName;
|
||||
LPTSTR DeviceKey;
|
||||
LPTSTR DeviceID;
|
||||
DWORD DeviceStateFlags;
|
||||
PSETTINGS_ENTRY Settings; /* Sorted by increasing dmPelsHeight, BPP */
|
||||
DWORD SettingsCount;
|
||||
PRESOLUTION_INFO Resolutions;
|
||||
DWORD ResolutionsCount;
|
||||
PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */
|
||||
SETTINGS_ENTRY InitialSettings;
|
||||
struct _DISPLAY_DEVICE_ENTRY *Flink;
|
||||
LPTSTR DeviceDescription;
|
||||
LPTSTR DeviceName;
|
||||
LPTSTR DeviceKey;
|
||||
LPTSTR DeviceID;
|
||||
DWORD DeviceStateFlags;
|
||||
PSETTINGS_ENTRY Settings; /* Sorted by increasing dmPelsHeight, BPP */
|
||||
DWORD SettingsCount;
|
||||
PRESOLUTION_INFO Resolutions;
|
||||
DWORD ResolutionsCount;
|
||||
PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */
|
||||
SETTINGS_ENTRY InitialSettings;
|
||||
} DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY;
|
||||
|
||||
typedef struct _GLOBAL_DATA
|
||||
{
|
||||
COLORREF desktop_color;
|
||||
COLORREF desktop_color;
|
||||
} GLOBAL_DATA, *PGLOBAL_DATA;
|
||||
|
||||
extern GLOBAL_DATA g_GlobalData;
|
||||
|
|
|
@ -58,226 +58,226 @@ static const signed char LTRBInnerMono[] = {
|
|||
static BOOL
|
||||
MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, COLOR_SCHEME *scheme)
|
||||
{
|
||||
signed char LTInnerI, LTOuterI;
|
||||
signed char RBInnerI, RBOuterI;
|
||||
HPEN LTInnerPen, LTOuterPen;
|
||||
HPEN RBInnerPen, RBOuterPen;
|
||||
RECT InnerRect = *rc;
|
||||
POINT SavePoint;
|
||||
HPEN SavePen;
|
||||
int LBpenplus = 0;
|
||||
int LTpenplus = 0;
|
||||
int RTpenplus = 0;
|
||||
int RBpenplus = 0;
|
||||
/* Init some vars */
|
||||
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
|
||||
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
|
||||
signed char LTInnerI, LTOuterI;
|
||||
signed char RBInnerI, RBOuterI;
|
||||
HPEN LTInnerPen, LTOuterPen;
|
||||
HPEN RBInnerPen, RBOuterPen;
|
||||
RECT InnerRect = *rc;
|
||||
POINT SavePoint;
|
||||
HPEN SavePen;
|
||||
int LBpenplus = 0;
|
||||
int LTpenplus = 0;
|
||||
int RTpenplus = 0;
|
||||
int RBpenplus = 0;
|
||||
/* Init some vars */
|
||||
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
|
||||
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
|
||||
|
||||
/* Determine the colors of the edges */
|
||||
LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
/* Determine the colors of the edges */
|
||||
LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||
|
||||
if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
|
||||
LBpenplus = 1;
|
||||
if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
|
||||
RTpenplus = 1;
|
||||
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
|
||||
RBpenplus = 1;
|
||||
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
|
||||
LTpenplus = 1;
|
||||
if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
|
||||
LBpenplus = 1;
|
||||
if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
|
||||
RTpenplus = 1;
|
||||
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
|
||||
RBpenplus = 1;
|
||||
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
|
||||
LTpenplus = 1;
|
||||
|
||||
if(LTInnerI != -1)
|
||||
LTInnerPen = GetStockObject(DC_PEN);
|
||||
if(LTOuterI != -1)
|
||||
LTOuterPen = GetStockObject(DC_PEN);
|
||||
if(RBInnerI != -1)
|
||||
RBInnerPen = GetStockObject(DC_PEN);
|
||||
if(RBOuterI != -1)
|
||||
RBOuterPen = GetStockObject(DC_PEN);
|
||||
{
|
||||
HBRUSH hbr;
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
|
||||
FillRect(hdc, &InnerRect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
MoveToEx(hdc, 0, 0, &SavePoint);
|
||||
if(LTInnerI != -1)
|
||||
LTInnerPen = GetStockObject(DC_PEN);
|
||||
if(LTOuterI != -1)
|
||||
LTOuterPen = GetStockObject(DC_PEN);
|
||||
if(RBInnerI != -1)
|
||||
RBInnerPen = GetStockObject(DC_PEN);
|
||||
if(RBOuterI != -1)
|
||||
RBOuterPen = GetStockObject(DC_PEN);
|
||||
{
|
||||
HBRUSH hbr;
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
|
||||
FillRect(hdc, &InnerRect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
MoveToEx(hdc, 0, 0, &SavePoint);
|
||||
|
||||
/* Draw the outer edge */
|
||||
SelectObject(hdc, LTOuterPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
|
||||
if(uFlags & BF_TOP)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.right, InnerRect.top);
|
||||
}
|
||||
if(uFlags & BF_LEFT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.left, InnerRect.bottom);
|
||||
}
|
||||
SelectObject(hdc, RBOuterPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
|
||||
if(uFlags & BF_BOTTOM)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
|
||||
LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
|
||||
}
|
||||
if(uFlags & BF_RIGHT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
|
||||
}
|
||||
/* Draw the outer edge */
|
||||
SelectObject(hdc, LTOuterPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
|
||||
if(uFlags & BF_TOP)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.right, InnerRect.top);
|
||||
}
|
||||
if(uFlags & BF_LEFT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.left, InnerRect.bottom);
|
||||
}
|
||||
SelectObject(hdc, RBOuterPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
|
||||
if(uFlags & BF_BOTTOM)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
|
||||
LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
|
||||
}
|
||||
if(uFlags & BF_RIGHT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
|
||||
LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
|
||||
}
|
||||
|
||||
/* Draw the inner edge */
|
||||
SelectObject(hdc, LTInnerPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
|
||||
if(uFlags & BF_TOP)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
|
||||
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
|
||||
}
|
||||
if(uFlags & BF_LEFT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
|
||||
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
|
||||
}
|
||||
SelectObject(hdc, RBInnerPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
|
||||
if(uFlags & BF_BOTTOM)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
|
||||
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
|
||||
}
|
||||
if(uFlags & BF_RIGHT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
|
||||
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
|
||||
}
|
||||
/* Draw the inner edge */
|
||||
SelectObject(hdc, LTInnerPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
|
||||
if(uFlags & BF_TOP)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
|
||||
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
|
||||
}
|
||||
if(uFlags & BF_LEFT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
|
||||
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
|
||||
}
|
||||
SelectObject(hdc, RBInnerPen);
|
||||
SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
|
||||
if(uFlags & BF_BOTTOM)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
|
||||
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
|
||||
}
|
||||
if(uFlags & BF_RIGHT)
|
||||
{
|
||||
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
|
||||
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
|
||||
}
|
||||
|
||||
if (uFlags & BF_ADJUST)
|
||||
{
|
||||
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
|
||||
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
|
||||
if (uFlags & BF_ADJUST)
|
||||
{
|
||||
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
|
||||
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
|
||||
|
||||
if(uFlags & BF_LEFT)
|
||||
InnerRect.left += add;
|
||||
if(uFlags & BF_RIGHT)
|
||||
InnerRect.right -= add;
|
||||
if(uFlags & BF_TOP)
|
||||
InnerRect.top += add;
|
||||
if(uFlags & BF_BOTTOM)
|
||||
InnerRect.bottom -= add;
|
||||
if(uFlags & BF_LEFT)
|
||||
InnerRect.left += add;
|
||||
if(uFlags & BF_RIGHT)
|
||||
InnerRect.right -= add;
|
||||
if(uFlags & BF_TOP)
|
||||
InnerRect.top += add;
|
||||
if(uFlags & BF_BOTTOM)
|
||||
InnerRect.bottom -= add;
|
||||
|
||||
if(uFlags & BF_ADJUST)
|
||||
*rc = InnerRect;
|
||||
}
|
||||
if(uFlags & BF_ADJUST)
|
||||
*rc = InnerRect;
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
SelectObject(hdc, SavePen);
|
||||
MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
|
||||
return TRUE;
|
||||
/* Cleanup */
|
||||
SelectObject(hdc, SavePen);
|
||||
MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
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, 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, scheme);
|
||||
}
|
||||
|
||||
static int
|
||||
MyMakeSquareRect(LPRECT src, LPRECT dst)
|
||||
{
|
||||
int Width = src->right - src->left;
|
||||
int Height = src->bottom - src->top;
|
||||
int SmallDiam = Width > Height ? Height : Width;
|
||||
int Width = src->right - src->left;
|
||||
int Height = src->bottom - src->top;
|
||||
int SmallDiam = Width > Height ? Height : Width;
|
||||
|
||||
*dst = *src;
|
||||
*dst = *src;
|
||||
|
||||
/* Make it a square box */
|
||||
if (Width < Height) /* SmallDiam == Width */
|
||||
{
|
||||
dst->top += (Height-Width)/2;
|
||||
dst->bottom = dst->top + SmallDiam;
|
||||
}
|
||||
else if(Width > Height) /* SmallDiam == Height */
|
||||
{
|
||||
dst->left += (Width-Height)/2;
|
||||
dst->right = dst->left + SmallDiam;
|
||||
}
|
||||
/* Make it a square box */
|
||||
if (Width < Height) /* SmallDiam == Width */
|
||||
{
|
||||
dst->top += (Height-Width)/2;
|
||||
dst->bottom = dst->top + SmallDiam;
|
||||
}
|
||||
else if(Width > Height) /* SmallDiam == Height */
|
||||
{
|
||||
dst->left += (Width-Height)/2;
|
||||
dst->right = dst->left + SmallDiam;
|
||||
}
|
||||
|
||||
return SmallDiam;
|
||||
return SmallDiam;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
|
||||
{
|
||||
LOGFONT lf;
|
||||
HFONT hFont, hOldFont;
|
||||
COLORREF clrsave;
|
||||
RECT myr;
|
||||
INT bkmode;
|
||||
TCHAR Symbol;
|
||||
switch(uFlags & 0xff)
|
||||
{
|
||||
case DFCS_CAPTIONCLOSE:
|
||||
Symbol = 'r';
|
||||
break;
|
||||
case DFCS_CAPTIONHELP:
|
||||
Symbol = 's';
|
||||
break;
|
||||
case DFCS_CAPTIONMIN:
|
||||
Symbol = '0';
|
||||
break;
|
||||
case DFCS_CAPTIONMAX:
|
||||
Symbol = '1';
|
||||
break;
|
||||
case DFCS_CAPTIONRESTORE:
|
||||
Symbol = '2';
|
||||
break;
|
||||
}
|
||||
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;
|
||||
myr.top += 1;
|
||||
myr.right -= 1;
|
||||
myr.bottom -= 1;
|
||||
if(uFlags & DFCS_PUSHED)
|
||||
OffsetRect(&myr,1,1);
|
||||
lf.lfHeight = myr.bottom - myr.top;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
|
||||
hFont = CreateFontIndirect(&lf);
|
||||
/* Save font and text color */
|
||||
hOldFont = SelectObject(dc, hFont);
|
||||
clrsave = GetTextColor(dc);
|
||||
bkmode = GetBkMode(dc);
|
||||
/* Set color and drawing mode */
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
if(uFlags & DFCS_INACTIVE)
|
||||
{
|
||||
/* Draw shadow */
|
||||
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
|
||||
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||
}
|
||||
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 */
|
||||
SetTextColor(dc, clrsave);
|
||||
SelectObject(dc, hOldFont);
|
||||
SetBkMode(dc, bkmode);
|
||||
DeleteObject(hFont);
|
||||
return TRUE;
|
||||
LOGFONT lf;
|
||||
HFONT hFont, hOldFont;
|
||||
COLORREF clrsave;
|
||||
RECT myr;
|
||||
INT bkmode;
|
||||
TCHAR Symbol;
|
||||
switch(uFlags & 0xff)
|
||||
{
|
||||
case DFCS_CAPTIONCLOSE:
|
||||
Symbol = 'r';
|
||||
break;
|
||||
case DFCS_CAPTIONHELP:
|
||||
Symbol = 's';
|
||||
break;
|
||||
case DFCS_CAPTIONMIN:
|
||||
Symbol = '0';
|
||||
break;
|
||||
case DFCS_CAPTIONMAX:
|
||||
Symbol = '1';
|
||||
break;
|
||||
case DFCS_CAPTIONRESTORE:
|
||||
Symbol = '2';
|
||||
break;
|
||||
}
|
||||
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;
|
||||
myr.top += 1;
|
||||
myr.right -= 1;
|
||||
myr.bottom -= 1;
|
||||
if(uFlags & DFCS_PUSHED)
|
||||
OffsetRect(&myr,1,1);
|
||||
lf.lfHeight = myr.bottom - myr.top;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
|
||||
hFont = CreateFontIndirect(&lf);
|
||||
/* Save font and text color */
|
||||
hOldFont = SelectObject(dc, hFont);
|
||||
clrsave = GetTextColor(dc);
|
||||
bkmode = GetBkMode(dc);
|
||||
/* Set color and drawing mode */
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
if(uFlags & DFCS_INACTIVE)
|
||||
{
|
||||
/* Draw shadow */
|
||||
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
|
||||
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||
}
|
||||
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 */
|
||||
SetTextColor(dc, clrsave);
|
||||
SelectObject(dc, hOldFont);
|
||||
SetBkMode(dc, bkmode);
|
||||
DeleteObject(hFont);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -285,151 +285,151 @@ MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
|
|||
static BOOL
|
||||
MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, COLOR_SCHEME *scheme)
|
||||
{
|
||||
LOGFONT lf;
|
||||
HFONT hFont, hOldFont;
|
||||
COLORREF clrsave;
|
||||
RECT myr;
|
||||
INT bkmode;
|
||||
TCHAR Symbol;
|
||||
switch(uFlags & 0xff)
|
||||
{
|
||||
case DFCS_SCROLLCOMBOBOX:
|
||||
case DFCS_SCROLLDOWN:
|
||||
Symbol = '6';
|
||||
break;
|
||||
LOGFONT lf;
|
||||
HFONT hFont, hOldFont;
|
||||
COLORREF clrsave;
|
||||
RECT myr;
|
||||
INT bkmode;
|
||||
TCHAR Symbol;
|
||||
switch(uFlags & 0xff)
|
||||
{
|
||||
case DFCS_SCROLLCOMBOBOX:
|
||||
case DFCS_SCROLLDOWN:
|
||||
Symbol = '6';
|
||||
break;
|
||||
|
||||
case DFCS_SCROLLUP:
|
||||
Symbol = '5';
|
||||
break;
|
||||
case DFCS_SCROLLUP:
|
||||
Symbol = '5';
|
||||
break;
|
||||
|
||||
case DFCS_SCROLLLEFT:
|
||||
Symbol = '3';
|
||||
break;
|
||||
case DFCS_SCROLLLEFT:
|
||||
Symbol = '3';
|
||||
break;
|
||||
|
||||
case DFCS_SCROLLRIGHT:
|
||||
Symbol = '4';
|
||||
break;
|
||||
}
|
||||
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;
|
||||
myr.top += 1;
|
||||
myr.right -= 1;
|
||||
myr.bottom -= 1;
|
||||
if(uFlags & DFCS_PUSHED)
|
||||
OffsetRect(&myr,1,1);
|
||||
lf.lfHeight = myr.bottom - myr.top;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
|
||||
hFont = CreateFontIndirect(&lf);
|
||||
/* Save font and text color */
|
||||
hOldFont = SelectObject(dc, hFont);
|
||||
clrsave = GetTextColor(dc);
|
||||
bkmode = GetBkMode(dc);
|
||||
/* Set color and drawing mode */
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
if(uFlags & DFCS_INACTIVE)
|
||||
{
|
||||
/* Draw shadow */
|
||||
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
|
||||
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||
}
|
||||
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 */
|
||||
SetTextColor(dc, clrsave);
|
||||
SelectObject(dc, hOldFont);
|
||||
SetBkMode(dc, bkmode);
|
||||
DeleteObject(hFont);
|
||||
return TRUE;
|
||||
case DFCS_SCROLLRIGHT:
|
||||
Symbol = '4';
|
||||
break;
|
||||
}
|
||||
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;
|
||||
myr.top += 1;
|
||||
myr.right -= 1;
|
||||
myr.bottom -= 1;
|
||||
if(uFlags & DFCS_PUSHED)
|
||||
OffsetRect(&myr,1,1);
|
||||
lf.lfHeight = myr.bottom - myr.top;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
|
||||
hFont = CreateFontIndirect(&lf);
|
||||
/* Save font and text color */
|
||||
hOldFont = SelectObject(dc, hFont);
|
||||
clrsave = GetTextColor(dc);
|
||||
bkmode = GetBkMode(dc);
|
||||
/* Set color and drawing mode */
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
if(uFlags & DFCS_INACTIVE)
|
||||
{
|
||||
/* Draw shadow */
|
||||
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
|
||||
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||
}
|
||||
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 */
|
||||
SetTextColor(dc, clrsave);
|
||||
SelectObject(dc, hOldFont);
|
||||
SetBkMode(dc, bkmode);
|
||||
DeleteObject(hFont);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, COLOR_SCHEME *scheme)
|
||||
{
|
||||
switch(uType)
|
||||
{
|
||||
case DFC_BUTTON:
|
||||
return MyDrawFrameButton(hDC, rc, uState, scheme);
|
||||
case DFC_CAPTION:
|
||||
return MyDrawFrameCaption(hDC, rc, uState, scheme);
|
||||
case DFC_SCROLL:
|
||||
return MyDrawFrameScroll(hDC, rc, uState, scheme);
|
||||
}
|
||||
return FALSE;
|
||||
switch(uType)
|
||||
{
|
||||
case DFC_BUTTON:
|
||||
return MyDrawFrameButton(hDC, rc, uState, scheme);
|
||||
case DFC_CAPTION:
|
||||
return MyDrawFrameCaption(hDC, rc, uState, scheme);
|
||||
case DFC_SCROLL:
|
||||
return MyDrawFrameScroll(hDC, rc, uState, scheme);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
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
|
||||
MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, COLOR_SCHEME *scheme)
|
||||
{
|
||||
RECT rc3;
|
||||
RECT rc4;
|
||||
RECT rc5;
|
||||
RECT rc3;
|
||||
RECT rc4;
|
||||
RECT rc5;
|
||||
|
||||
rc3.left = lpRect->right - 2 - x;
|
||||
rc3.top = lpRect->top + 2;
|
||||
rc3.right = lpRect->right - 2;
|
||||
rc3.bottom = lpRect->bottom - 2;
|
||||
rc3.left = lpRect->right - 2 - x;
|
||||
rc3.top = lpRect->top + 2;
|
||||
rc3.right = lpRect->right - 2;
|
||||
rc3.bottom = lpRect->bottom - 2;
|
||||
|
||||
MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, scheme);
|
||||
MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, scheme);
|
||||
|
||||
if (bMinMax)
|
||||
{
|
||||
rc4.left = rc3.left - x - 2;
|
||||
rc4.top = rc3.top;
|
||||
rc4.right = rc3.right - x - 2;
|
||||
rc4.bottom = rc3.bottom;
|
||||
if (bMinMax)
|
||||
{
|
||||
rc4.left = rc3.left - x - 2;
|
||||
rc4.top = rc3.top;
|
||||
rc4.right = rc3.right - x - 2;
|
||||
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.top = rc4.top;
|
||||
rc5.right = rc4.right - x;
|
||||
rc5.bottom = rc4.bottom;
|
||||
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, scheme);
|
||||
}
|
||||
MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, scheme);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, COLOR_SCHEME *scheme)
|
||||
{
|
||||
RECT rcTop;
|
||||
RECT rcBottom;
|
||||
RECT rcMiddle;
|
||||
int width;
|
||||
RECT rcTop;
|
||||
RECT rcBottom;
|
||||
RECT rcMiddle;
|
||||
int width;
|
||||
|
||||
width = rc->right - rc->left;
|
||||
width = rc->right - rc->left;
|
||||
|
||||
rcTop.left = rc->left;
|
||||
rcTop.right = rc->right;
|
||||
rcTop.top = rc->top;
|
||||
rcTop.bottom = rc->top + width;
|
||||
rcTop.left = rc->left;
|
||||
rcTop.right = rc->right;
|
||||
rcTop.top = rc->top;
|
||||
rcTop.bottom = rc->top + width;
|
||||
|
||||
rcMiddle.left = rc->left;
|
||||
rcMiddle.right = rc->right;
|
||||
rcMiddle.top = rc->top + width;
|
||||
rcMiddle.bottom = rc->bottom - width;
|
||||
rcMiddle.left = rc->left;
|
||||
rcMiddle.right = rc->right;
|
||||
rcMiddle.top = rc->top + width;
|
||||
rcMiddle.bottom = rc->bottom - width;
|
||||
|
||||
rcBottom.left = rc->left;
|
||||
rcBottom.right = rc->right;
|
||||
rcBottom.top = rc->bottom - width;
|
||||
rcBottom.bottom = rc->bottom;
|
||||
rcBottom.left = rc->left;
|
||||
rcBottom.right = rc->right;
|
||||
rcBottom.top = rc->bottom - width;
|
||||
rcBottom.bottom = rc->bottom;
|
||||
|
||||
MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, scheme);
|
||||
MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, scheme);
|
||||
MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, 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
|
||||
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;
|
||||
//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);
|
||||
//Height = scheme->Size[SIZE_CAPTION_Y] - 1;
|
||||
//VCenter = (rect->bottom - rect->top) / 2;
|
||||
//Padding = VCenter - (Height / 2);
|
||||
|
||||
//ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2;
|
||||
//ButtonWidth = scheme->Size[SIZE_SIZE_X] - 2;
|
||||
|
||||
if (uFlags & DC_GRADIENT)
|
||||
{
|
||||
GRADIENT_RECT gcap = {0, 1};
|
||||
TRIVERTEX vert[2];
|
||||
COLORREF Colors[2];
|
||||
if (uFlags & DC_GRADIENT)
|
||||
{
|
||||
GRADIENT_RECT gcap = {0, 1};
|
||||
TRIVERTEX vert[2];
|
||||
COLORREF Colors[2];
|
||||
|
||||
Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ?
|
||||
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)];
|
||||
Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ?
|
||||
COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)];
|
||||
Colors[0] = scheme->crColor[((uFlags & DC_ACTIVE) ?
|
||||
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)];
|
||||
Colors[1] = scheme->crColor[((uFlags & DC_ACTIVE) ?
|
||||
COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)];
|
||||
|
||||
vert[0].x = rect->left;
|
||||
vert[0].y = rect->top;
|
||||
vert[0].Red = (WORD)Colors[0]<<8;
|
||||
vert[0].Green = (WORD)Colors[0] & 0xFF00;
|
||||
vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
|
||||
vert[0].Alpha = 0;
|
||||
vert[0].x = rect->left;
|
||||
vert[0].y = rect->top;
|
||||
vert[0].Red = (WORD)Colors[0]<<8;
|
||||
vert[0].Green = (WORD)Colors[0] & 0xFF00;
|
||||
vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
|
||||
vert[0].Alpha = 0;
|
||||
|
||||
vert[1].x = rect->right;
|
||||
vert[1].y = rect->bottom;
|
||||
vert[1].Red = (WORD)Colors[1]<<8;
|
||||
vert[1].Green = (WORD)Colors[1] & 0xFF00;
|
||||
vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
|
||||
vert[1].Alpha = 0;
|
||||
vert[1].x = rect->right;
|
||||
vert[1].y = rect->bottom;
|
||||
vert[1].Red = (WORD)Colors[1]<<8;
|
||||
vert[1].Green = (WORD)Colors[1] & 0xFF00;
|
||||
vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
|
||||
vert[1].Alpha = 0;
|
||||
|
||||
GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uFlags & DC_ACTIVE)
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVECAPTION]);
|
||||
else
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_INACTIVECAPTION]);
|
||||
FillRect(hdc, rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
GdiGradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uFlags & DC_ACTIVE)
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVECAPTION]);
|
||||
else
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_INACTIVECAPTION]);
|
||||
FillRect(hdc, rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
|
||||
hFontOld = SelectObject(hdc, hFont);
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
if (uFlags & DC_ACTIVE)
|
||||
SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]);
|
||||
else
|
||||
SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]);
|
||||
rc.left = rect->left + 2;
|
||||
rc.top = rect->top;
|
||||
rc.right = rect->right;
|
||||
rc.bottom = rect->bottom;
|
||||
DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER);
|
||||
SelectObject(hdc, hFontOld);
|
||||
return TRUE;
|
||||
hFontOld = SelectObject(hdc, hFont);
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
if (uFlags & DC_ACTIVE)
|
||||
SetTextColor(hdc, scheme->crColor[COLOR_CAPTIONTEXT]);
|
||||
else
|
||||
SetTextColor(hdc, scheme->crColor[COLOR_INACTIVECAPTIONTEXT]);
|
||||
rc.left = rect->left + 2;
|
||||
rc.top = rect->top;
|
||||
rc.right = rect->right;
|
||||
rc.bottom = rect->bottom;
|
||||
DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER);
|
||||
SelectObject(hdc, hFontOld);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -507,99 +507,99 @@ MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon
|
|||
DWORD
|
||||
MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, COLOR_SCHEME *scheme)
|
||||
{
|
||||
HBRUSH hbr;
|
||||
HPEN hPen;
|
||||
HGDIOBJ hPenOld, hFontOld;
|
||||
BOOL flat_menu;
|
||||
INT i, bkgnd, x;
|
||||
RECT rect;
|
||||
WCHAR Text[128];
|
||||
UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
|
||||
HBRUSH hbr;
|
||||
HPEN hPen;
|
||||
HGDIOBJ hPenOld, hFontOld;
|
||||
BOOL flat_menu;
|
||||
INT i, bkgnd, x;
|
||||
RECT rect;
|
||||
WCHAR Text[128];
|
||||
UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
|
||||
|
||||
flat_menu = scheme->bFlatMenus;
|
||||
flat_menu = scheme->bFlatMenus;
|
||||
|
||||
if (flat_menu)
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]);
|
||||
else
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]);
|
||||
FillRect(DC, Rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
if (flat_menu)
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUBAR]);
|
||||
else
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENU]);
|
||||
FillRect(DC, Rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
|
||||
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);
|
||||
SelectObject(DC, hPenOld);
|
||||
DeleteObject(hPen);
|
||||
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);
|
||||
SelectObject(DC, hPenOld);
|
||||
DeleteObject(hPen);
|
||||
|
||||
bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU);
|
||||
x = Rect->left;
|
||||
hFontOld = SelectObject(DC, Font);
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
|
||||
x = Rect->left;
|
||||
hFontOld = SelectObject(DC, Font);
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
|
||||
|
||||
rect.left = rect.right = x;
|
||||
rect.top = Rect->top;
|
||||
rect.bottom = Rect->bottom;
|
||||
DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
|
||||
rect.bottom = Rect->bottom;
|
||||
rect.right += MENU_BAR_ITEMS_SPACE;
|
||||
x += rect.right - rect.left;
|
||||
rect.left = rect.right = x;
|
||||
rect.top = Rect->top;
|
||||
rect.bottom = Rect->bottom;
|
||||
DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
|
||||
rect.bottom = Rect->bottom;
|
||||
rect.right += MENU_BAR_ITEMS_SPACE;
|
||||
x += rect.right - rect.left;
|
||||
|
||||
if (i == 2)
|
||||
{
|
||||
if (flat_menu)
|
||||
{
|
||||
SetTextColor(DC, scheme->crColor[COLOR_HIGHLIGHTTEXT]);
|
||||
SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]);
|
||||
if (i == 2)
|
||||
{
|
||||
if (flat_menu)
|
||||
{
|
||||
SetTextColor(DC, scheme->crColor[COLOR_HIGHLIGHTTEXT]);
|
||||
SetBkColor(DC, scheme->crColor[COLOR_HIGHLIGHT]);
|
||||
|
||||
InflateRect (&rect, -1, -1);
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]);
|
||||
FillRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
InflateRect (&rect, -1, -1);
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_MENUHILIGHT]);
|
||||
FillRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
|
||||
InflateRect (&rect, 1, 1);
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]);
|
||||
FrameRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
else
|
||||
{
|
||||
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, scheme->crColor[COLOR_GRAYTEXT]);
|
||||
else
|
||||
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
|
||||
InflateRect (&rect, 1, 1);
|
||||
hbr = CreateSolidBrush(scheme->crColor[COLOR_HIGHLIGHT]);
|
||||
FrameRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
else
|
||||
{
|
||||
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, scheme->crColor[COLOR_GRAYTEXT]);
|
||||
else
|
||||
SetTextColor(DC, scheme->crColor[COLOR_MENUTEXT]);
|
||||
|
||||
SetBkColor(DC, scheme->crColor[bkgnd]);
|
||||
hbr = CreateSolidBrush(scheme->crColor[bkgnd]);
|
||||
FillRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
SetBkColor(DC, scheme->crColor[bkgnd]);
|
||||
hbr = CreateSolidBrush(scheme->crColor[bkgnd]);
|
||||
FillRect(DC, &rect, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
|
||||
SetBkMode(DC, TRANSPARENT);
|
||||
SetBkMode(DC, TRANSPARENT);
|
||||
|
||||
rect.left += MENU_BAR_ITEMS_SPACE / 2;
|
||||
rect.right -= MENU_BAR_ITEMS_SPACE / 2;
|
||||
rect.left += MENU_BAR_ITEMS_SPACE / 2;
|
||||
rect.right -= MENU_BAR_ITEMS_SPACE / 2;
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
|
||||
SetTextColor(DC, RGB(0xff, 0xff, 0xff));
|
||||
DrawTextW(DC, Text, -1, &rect, uFormat);
|
||||
--rect.left; --rect.top; --rect.right; --rect.bottom;
|
||||
SetTextColor(DC, RGB(0x80, 0x80, 0x80));
|
||||
}
|
||||
DrawTextW(DC, Text, -1, &rect, uFormat);
|
||||
}
|
||||
SelectObject(DC, hFontOld);
|
||||
if (i == 1)
|
||||
{
|
||||
++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
|
||||
SetTextColor(DC, RGB(0xff, 0xff, 0xff));
|
||||
DrawTextW(DC, Text, -1, &rect, uFormat);
|
||||
--rect.left; --rect.top; --rect.right; --rect.bottom;
|
||||
SetTextColor(DC, RGB(0x80, 0x80, 0x80));
|
||||
}
|
||||
DrawTextW(DC, Text, -1, &rect, uFormat);
|
||||
}
|
||||
SelectObject(DC, hFontOld);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -82,61 +82,61 @@ EffAppearanceDlg_CleanUp(HWND hwndDlg, GLOBALS* g)
|
|||
INT_PTR CALLBACK
|
||||
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)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
g = (GLOBALS*)lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
|
||||
EffAppearanceDlg_Init(hwndDlg, g);
|
||||
break;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
g = (GLOBALS*)lParam;
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g);
|
||||
EffAppearanceDlg_Init(hwndDlg, g);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
EffAppearanceDlg_CleanUp(hwndDlg, g);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
EffAppearanceDlg_CleanUp(hwndDlg, g);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
SaveCurrentValues(hwndDlg, g);
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
SaveCurrentValues(hwndDlg, g);
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
g->SchemeAdv = g->Scheme;
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
break;
|
||||
case IDCANCEL:
|
||||
g->SchemeAdv = g->Scheme;
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
break;
|
||||
|
||||
case IDC_EFFAPPEARANCE_ANIMATION:
|
||||
case IDC_EFFAPPEARANCE_KEYBOARDCUES:
|
||||
case IDC_EFFAPPEARANCE_DRAGFULLWINDOWS:
|
||||
case IDC_EFFAPPEARANCE_ANIMATION:
|
||||
case IDC_EFFAPPEARANCE_KEYBOARDCUES:
|
||||
case IDC_EFFAPPEARANCE_DRAGFULLWINDOWS:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
{
|
||||
UpdateControls(hwndDlg, g);
|
||||
UpdateControls(hwndDlg, g);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDC_EFFAPPEARANCE_ANIMATIONTYPE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
SaveCurrentValues(hwndDlg, g);
|
||||
g->SchemeAdv.Effects.bMenuFade = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_GETCURSEL, 0, 0);
|
||||
UpdateControls(hwndDlg, g);
|
||||
}
|
||||
break;
|
||||
case IDC_EFFAPPEARANCE_ANIMATIONTYPE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
SaveCurrentValues(hwndDlg, g);
|
||||
g->SchemeAdv.Effects.bMenuFade = SendDlgItemMessage(hwndDlg, IDC_EFFAPPEARANCE_ANIMATIONTYPE, CB_GETCURSEL, 0, 0);
|
||||
UpdateControls(hwndDlg, g);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -123,21 +123,21 @@ AdvGeneralPageProc(HWND hwndDlg,
|
|||
Ret = TRUE;
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_FONTSIZE_COMBO:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
case IDC_RESTART_RB:
|
||||
case IDC_WITHOUTREBOOT_RB:
|
||||
case IDC_ASKME_RB:
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_FONTSIZE_COMBO:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
case IDC_RESTART_RB:
|
||||
case IDC_WITHOUTREBOOT_RB:
|
||||
case IDC_ASKME_RB:
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
|
|
|
@ -157,9 +157,9 @@
|
|||
#define IDS_UNKNOWNMONITOR 3301
|
||||
#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
|
||||
|
||||
/* Effects Appearance Dialog */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,360 +24,360 @@ 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] =
|
||||
{TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */
|
||||
TEXT("Background"), /* 01 = COLOR_DESKTOP */
|
||||
TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */
|
||||
TEXT("InactiveTitle"), /* 03 = COLOR_INACTIVECAPTION */
|
||||
TEXT("Menu"), /* 04 = COLOR_MENU */
|
||||
TEXT("Window"), /* 05 = COLOR_WINDOW */
|
||||
TEXT("WindowFrame"), /* 06 = COLOR_WINDOWFRAME */
|
||||
TEXT("MenuText"), /* 07 = COLOR_MENUTEXT */
|
||||
TEXT("WindowText"), /* 08 = COLOR_WINDOWTEXT */
|
||||
TEXT("TitleText"), /* 09 = COLOR_CAPTIONTEXT */
|
||||
TEXT("ActiveBorder"), /* 10 = COLOR_ACTIVEBORDER */
|
||||
TEXT("InactiveBorder"), /* 11 = COLOR_INACTIVEBORDER */
|
||||
TEXT("AppWorkSpace"), /* 12 = COLOR_APPWORKSPACE */
|
||||
TEXT("Hilight"), /* 13 = COLOR_HIGHLIGHT */
|
||||
TEXT("HilightText"), /* 14 = COLOR_HIGHLIGHTTEXT */
|
||||
TEXT("ButtonFace"), /* 15 = COLOR_BTNFACE */
|
||||
TEXT("ButtonShadow"), /* 16 = COLOR_BTNSHADOW */
|
||||
TEXT("GrayText"), /* 17 = COLOR_GRAYTEXT */
|
||||
TEXT("ButtonText"), /* 18 = COLOR_BTNTEXT */
|
||||
TEXT("InactiveTitleText"), /* 19 = COLOR_INACTIVECAPTIONTEXT */
|
||||
TEXT("ButtonHilight"), /* 20 = COLOR_BTNHIGHLIGHT */
|
||||
TEXT("ButtonDkShadow"), /* 21 = COLOR_3DDKSHADOW */
|
||||
TEXT("ButtonLight"), /* 22 = COLOR_3DLIGHT */
|
||||
TEXT("InfoText"), /* 23 = COLOR_INFOTEXT */
|
||||
TEXT("InfoWindow"), /* 24 = COLOR_INFOBK */
|
||||
TEXT("ButtonAlternateFace"), /* 25 = COLOR_ALTERNATEBTNFACE */
|
||||
TEXT("HotTrackingColor"), /* 26 = COLOR_HOTLIGHT */
|
||||
TEXT("GradientActiveTitle"), /* 27 = COLOR_GRADIENTACTIVECAPTION */
|
||||
TEXT("GradientInactiveTitle"), /* 28 = COLOR_GRADIENTINACTIVECAPTION */
|
||||
TEXT("MenuHilight"), /* 29 = COLOR_MENUHILIGHT */
|
||||
TEXT("MenuBar"), /* 30 = COLOR_MENUBAR */
|
||||
{TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */
|
||||
TEXT("Background"), /* 01 = COLOR_DESKTOP */
|
||||
TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */
|
||||
TEXT("InactiveTitle"), /* 03 = COLOR_INACTIVECAPTION */
|
||||
TEXT("Menu"), /* 04 = COLOR_MENU */
|
||||
TEXT("Window"), /* 05 = COLOR_WINDOW */
|
||||
TEXT("WindowFrame"), /* 06 = COLOR_WINDOWFRAME */
|
||||
TEXT("MenuText"), /* 07 = COLOR_MENUTEXT */
|
||||
TEXT("WindowText"), /* 08 = COLOR_WINDOWTEXT */
|
||||
TEXT("TitleText"), /* 09 = COLOR_CAPTIONTEXT */
|
||||
TEXT("ActiveBorder"), /* 10 = COLOR_ACTIVEBORDER */
|
||||
TEXT("InactiveBorder"), /* 11 = COLOR_INACTIVEBORDER */
|
||||
TEXT("AppWorkSpace"), /* 12 = COLOR_APPWORKSPACE */
|
||||
TEXT("Hilight"), /* 13 = COLOR_HIGHLIGHT */
|
||||
TEXT("HilightText"), /* 14 = COLOR_HIGHLIGHTTEXT */
|
||||
TEXT("ButtonFace"), /* 15 = COLOR_BTNFACE */
|
||||
TEXT("ButtonShadow"), /* 16 = COLOR_BTNSHADOW */
|
||||
TEXT("GrayText"), /* 17 = COLOR_GRAYTEXT */
|
||||
TEXT("ButtonText"), /* 18 = COLOR_BTNTEXT */
|
||||
TEXT("InactiveTitleText"), /* 19 = COLOR_INACTIVECAPTIONTEXT */
|
||||
TEXT("ButtonHilight"), /* 20 = COLOR_BTNHIGHLIGHT */
|
||||
TEXT("ButtonDkShadow"), /* 21 = COLOR_3DDKSHADOW */
|
||||
TEXT("ButtonLight"), /* 22 = COLOR_3DLIGHT */
|
||||
TEXT("InfoText"), /* 23 = COLOR_INFOTEXT */
|
||||
TEXT("InfoWindow"), /* 24 = COLOR_INFOBK */
|
||||
TEXT("ButtonAlternateFace"), /* 25 = COLOR_ALTERNATEBTNFACE */
|
||||
TEXT("HotTrackingColor"), /* 26 = COLOR_HOTLIGHT */
|
||||
TEXT("GradientActiveTitle"), /* 27 = COLOR_GRADIENTACTIVECAPTION */
|
||||
TEXT("GradientInactiveTitle"), /* 28 = COLOR_GRADIENTINACTIVECAPTION */
|
||||
TEXT("MenuHilight"), /* 29 = COLOR_MENUHILIGHT */
|
||||
TEXT("MenuBar"), /* 30 = COLOR_MENUBAR */
|
||||
};
|
||||
|
||||
/* This is the list of used metrics and their numbers */
|
||||
static const int g_SizeMetric[NUM_SIZES] =
|
||||
{
|
||||
SM_CXBORDER, /* 00: SIZE_BORDER_X */
|
||||
SM_CYBORDER, /* 01: SIZE_BORDER_Y */
|
||||
SM_CYSIZE, /* 02: SIZE_CAPTION_Y */
|
||||
SM_CXICON, /* 03: SIZE_ICON_X */
|
||||
SM_CYICON, /* 04: SIZE_ICON_Y */
|
||||
SM_CXICONSPACING, /* 05: SIZE_ICON_SPC_X */
|
||||
SM_CYICONSPACING, /* 06: SIZE_ICON_SPC_Y */
|
||||
SM_CXMENUSIZE, /* 07: SIZE_MENU_SIZE_X */
|
||||
SM_CYMENU, /* 08: SIZE_MENU_Y */
|
||||
SM_CXVSCROLL, /* 09: SIZE_SCROLL_X */
|
||||
SM_CYHSCROLL, /* 10: SIZE_SCROLL_Y */
|
||||
SM_CYSMSIZE, /* 11: SIZE_SMCAPTION_Y */
|
||||
SM_CXEDGE, /* 12: SIZE_EDGE_X */
|
||||
SM_CYEDGE, /* 13: SIZE_EDGE_Y */
|
||||
SM_CYSIZEFRAME, /* 14: SIZE_FRAME_Y */
|
||||
SM_CXMENUCHECK, /* 15: SIZE_MENU_CHECK_X */
|
||||
SM_CYMENUCHECK, /* 16: SIZE_MENU_CHECK_Y */
|
||||
SM_CYMENUSIZE, /* 17: SIZE_MENU_SIZE_Y */
|
||||
SM_CXSIZE, /* 18: SIZE_SIZE_X */
|
||||
SM_CYSIZE /* 19: SIZE_SIZE_Y */
|
||||
SM_CXBORDER, /* 00: SIZE_BORDER_X */
|
||||
SM_CYBORDER, /* 01: SIZE_BORDER_Y */
|
||||
SM_CYSIZE, /* 02: SIZE_CAPTION_Y */
|
||||
SM_CXICON, /* 03: SIZE_ICON_X */
|
||||
SM_CYICON, /* 04: SIZE_ICON_Y */
|
||||
SM_CXICONSPACING, /* 05: SIZE_ICON_SPC_X */
|
||||
SM_CYICONSPACING, /* 06: SIZE_ICON_SPC_Y */
|
||||
SM_CXMENUSIZE, /* 07: SIZE_MENU_SIZE_X */
|
||||
SM_CYMENU, /* 08: SIZE_MENU_Y */
|
||||
SM_CXVSCROLL, /* 09: SIZE_SCROLL_X */
|
||||
SM_CYHSCROLL, /* 10: SIZE_SCROLL_Y */
|
||||
SM_CYSMSIZE, /* 11: SIZE_SMCAPTION_Y */
|
||||
SM_CXEDGE, /* 12: SIZE_EDGE_X */
|
||||
SM_CYEDGE, /* 13: SIZE_EDGE_Y */
|
||||
SM_CYSIZEFRAME, /* 14: SIZE_FRAME_Y */
|
||||
SM_CXMENUCHECK, /* 15: SIZE_MENU_CHECK_X */
|
||||
SM_CYMENUCHECK, /* 16: SIZE_MENU_CHECK_Y */
|
||||
SM_CYMENUSIZE, /* 17: SIZE_MENU_SIZE_Y */
|
||||
SM_CXSIZE, /* 18: SIZE_SIZE_X */
|
||||
SM_CYSIZE /* 19: SIZE_SIZE_Y */
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VOID LoadCurrentScheme(COLOR_SCHEME* scheme)
|
||||
{
|
||||
INT i;
|
||||
NONCLIENTMETRICS NonClientMetrics;
|
||||
INT i;
|
||||
NONCLIENTMETRICS NonClientMetrics;
|
||||
|
||||
/* Load colors */
|
||||
for (i = 0; i < NUM_COLORS; i++)
|
||||
{
|
||||
g_ColorList[i] = i;
|
||||
scheme->crColor[i] = (COLORREF)GetSysColor(i);
|
||||
}
|
||||
/* Load colors */
|
||||
for (i = 0; i < NUM_COLORS; i++)
|
||||
{
|
||||
g_ColorList[i] = i;
|
||||
scheme->crColor[i] = (COLORREF)GetSysColor(i);
|
||||
}
|
||||
|
||||
/* Load sizes */
|
||||
for (i = 0; i < NUM_SIZES; i++)
|
||||
{
|
||||
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
|
||||
}
|
||||
/* Load sizes */
|
||||
for (i = 0; i < NUM_SIZES; i++)
|
||||
{
|
||||
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
|
||||
}
|
||||
|
||||
/* Load fonts */
|
||||
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 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);
|
||||
/* Load fonts */
|
||||
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 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), &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:
|
||||
*/
|
||||
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
|
||||
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
|
||||
/* Effects */
|
||||
/* "Use the following transition effect for menus and tooltips" */
|
||||
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:
|
||||
*/
|
||||
scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
|
||||
scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
|
||||
|
||||
/* Show content of windows during dragging */
|
||||
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &scheme->Effects.bDragFullWindows, 0);
|
||||
/* Show content of windows during dragging */
|
||||
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &scheme->Effects.bDragFullWindows, 0);
|
||||
|
||||
/* "Hide underlined letters for keyboard navigation until I press the Alt key" */
|
||||
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &scheme->Effects.bKeyboardCues, 0);
|
||||
/* "Hide underlined letters for keyboard navigation until I press the Alt key" */
|
||||
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &scheme->Effects.bKeyboardCues, 0);
|
||||
}
|
||||
|
||||
BOOL LoadSchemeFromReg(COLOR_SCHEME* scheme, INT SchemeId)
|
||||
{
|
||||
INT i;
|
||||
TCHAR strSelectedStyle[4];
|
||||
TCHAR strSizeName[20] = TEXT("Sizes\\0");
|
||||
TCHAR strValueName[10];
|
||||
HKEY hkNewSchemes, hkScheme, hkSize;
|
||||
DWORD dwType, dwLength;
|
||||
UINT64 iSize;
|
||||
BOOL Ret = FALSE;
|
||||
INT i;
|
||||
TCHAR strSelectedStyle[4];
|
||||
TCHAR strSizeName[20] = TEXT("Sizes\\0");
|
||||
TCHAR strValueName[10];
|
||||
HKEY hkNewSchemes, hkScheme, hkSize;
|
||||
DWORD dwType, dwLength;
|
||||
UINT64 iSize;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
if (!g_PresetLoaded)
|
||||
LoadSchemePresetEntries(strSelectedStyle);
|
||||
if (!g_PresetLoaded)
|
||||
LoadSchemePresetEntries(strSelectedStyle);
|
||||
|
||||
if (SchemeId == -1)
|
||||
return FALSE;
|
||||
if (SchemeId == -1)
|
||||
return FALSE;
|
||||
|
||||
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)
|
||||
{
|
||||
lstrcpyn(&strSizeName[6], g_ColorSchemes[SchemeId].strSizeName, 3);
|
||||
if (RegOpenKeyEx(hkScheme, strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
|
||||
{
|
||||
Ret = TRUE;
|
||||
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)
|
||||
{
|
||||
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)&scheme->bFlatMenus, &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_DWORD)
|
||||
{
|
||||
/* Failed to read registry value */
|
||||
scheme->bFlatMenus = FALSE;
|
||||
}
|
||||
dwLength = sizeof(DWORD);
|
||||
if (RegQueryValueEx(hkSize, TEXT("FlatMenus"), NULL, &dwType, (LPBYTE)&scheme->bFlatMenus, &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_DWORD)
|
||||
{
|
||||
/* Failed to read registry value */
|
||||
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)&scheme->crColor[i], &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_DWORD)
|
||||
{
|
||||
/* Failed to read registry value, initialize with current setting for now */
|
||||
scheme->crColor[i] = GetSysColor(i);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NUM_COLORS; i++)
|
||||
{
|
||||
wsprintf(strValueName, TEXT("Color #%d"), i);
|
||||
dwLength = sizeof(COLORREF);
|
||||
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 */
|
||||
scheme->crColor[i] = GetSysColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_FONTS; i++)
|
||||
{
|
||||
wsprintf(strValueName, TEXT("Font #%d"), i);
|
||||
dwLength = sizeof(LOGFONT);
|
||||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->lfFont[i], &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_BINARY || dwLength != sizeof(LOGFONT))
|
||||
{
|
||||
/* Failed to read registry value */
|
||||
Ret = FALSE;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NUM_FONTS; i++)
|
||||
{
|
||||
wsprintf(strValueName, TEXT("Font #%d"), i);
|
||||
dwLength = sizeof(LOGFONT);
|
||||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&scheme->lfFont[i], &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_BINARY || dwLength != sizeof(LOGFONT))
|
||||
{
|
||||
/* Failed to read registry value */
|
||||
Ret = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_SIZES; i++)
|
||||
{
|
||||
wsprintf(strValueName, TEXT("Size #%d"), i);
|
||||
dwLength = sizeof(UINT64);
|
||||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&iSize, &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_QWORD || dwLength != sizeof(UINT64))
|
||||
{
|
||||
/* Failed to read registry value, initialize with current setting for now */
|
||||
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
|
||||
}
|
||||
else
|
||||
scheme->Size[i] = (INT)iSize;
|
||||
}
|
||||
RegCloseKey(hkSize);
|
||||
}
|
||||
RegCloseKey(hkScheme);
|
||||
}
|
||||
RegCloseKey(hkNewSchemes);
|
||||
}
|
||||
for (i = 0; i < NUM_SIZES; i++)
|
||||
{
|
||||
wsprintf(strValueName, TEXT("Size #%d"), i);
|
||||
dwLength = sizeof(UINT64);
|
||||
if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&iSize, &dwLength) != ERROR_SUCCESS ||
|
||||
dwType != REG_QWORD || dwLength != sizeof(UINT64))
|
||||
{
|
||||
/* Failed to read registry value, initialize with current setting for now */
|
||||
scheme->Size[i] = GetSystemMetrics(g_SizeMetric[i]);
|
||||
}
|
||||
else
|
||||
scheme->Size[i] = (INT)iSize;
|
||||
}
|
||||
RegCloseKey(hkSize);
|
||||
}
|
||||
RegCloseKey(hkScheme);
|
||||
}
|
||||
RegCloseKey(hkNewSchemes);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
return Ret;
|
||||
}
|
||||
|
||||
VOID ApplyScheme(COLOR_SCHEME* scheme, INT SchemeId)
|
||||
{
|
||||
INT i, Result;
|
||||
HKEY hKey;
|
||||
TCHAR clText[16];
|
||||
NONCLIENTMETRICS NonClientMetrics;
|
||||
ICONMETRICS IconMetrics;
|
||||
INT i, Result;
|
||||
HKEY hKey;
|
||||
TCHAR clText[16];
|
||||
NONCLIENTMETRICS NonClientMetrics;
|
||||
ICONMETRICS IconMetrics;
|
||||
|
||||
/* Apply Colors from global variable */
|
||||
SetSysColors(NUM_COLORS, g_ColorList, scheme->crColor);
|
||||
/* Apply Colors from global variable */
|
||||
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);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
for (i = 0; i < NUM_COLORS; 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));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
/* Save colors to registry */
|
||||
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
for (i = 0; i < NUM_COLORS; 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));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
/* Apply non client metrics */
|
||||
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
|
||||
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,
|
||||
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
/* Apply non client metrics */
|
||||
NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
|
||||
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,
|
||||
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
|
||||
/* Apply icon metrics */
|
||||
IconMetrics.cbSize = sizeof(ICONMETRICS);
|
||||
SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &IconMetrics, 0);
|
||||
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,
|
||||
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
/* Apply icon metrics */
|
||||
IconMetrics.cbSize = sizeof(ICONMETRICS);
|
||||
SystemParametersInfo(SPI_GETICONMETRICS, sizeof(ICONMETRICS), &IconMetrics, 0);
|
||||
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,
|
||||
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
|
||||
/* Effects, save only when needed: */
|
||||
/* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
|
||||
* Just keep them in sync for now.
|
||||
*/
|
||||
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);
|
||||
/* Effects, save only when needed: */
|
||||
/* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
|
||||
* Just keep them in sync for now.
|
||||
*/
|
||||
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 SchemeId */
|
||||
Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
if (SchemeId == -1)
|
||||
clText[0] = TEXT('\0');
|
||||
else
|
||||
lstrcpy(clText, g_ColorSchemes[SchemeId].strKeyName);
|
||||
RegSetValueEx(hKey, g_SelectedStyle, 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
/* Save SchemeId */
|
||||
Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
if (SchemeId == -1)
|
||||
clText[0] = TEXT('\0');
|
||||
else
|
||||
lstrcpy(clText, g_ColorSchemes[SchemeId].strKeyName);
|
||||
RegSetValueEx(hKey, g_SelectedStyle, 0, REG_SZ, (BYTE *)clText, (lstrlen(clText) + 1) * sizeof(TCHAR));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL SaveScheme(COLOR_SCHEME* scheme, LPCTSTR strLegacyName)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
return FALSE;
|
||||
/* FIXME: Implement */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
INT LoadSchemePresetEntries(LPTSTR pszSelectedStyle)
|
||||
{
|
||||
HKEY hkNewSchemes, hkScheme, hkSizes, hkSize;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD dwLength, dwType;
|
||||
DWORD dwDisposition;
|
||||
INT iStyle, iSize, iTemplateIndex;
|
||||
INT Result;
|
||||
HKEY hkNewSchemes, hkScheme, hkSizes, hkSize;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD dwLength, dwType;
|
||||
DWORD dwDisposition;
|
||||
INT iStyle, iSize, iTemplateIndex;
|
||||
INT Result;
|
||||
|
||||
lstrcpy(pszSelectedStyle, TEXT(""));
|
||||
lstrcpy(pszSelectedStyle, TEXT(""));
|
||||
|
||||
iTemplateIndex = 0;
|
||||
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkNewSchemes, &dwDisposition);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
/* First find out the currently selected template */
|
||||
dwLength = 4 * sizeof(TCHAR);
|
||||
RegQueryValueEx(hkNewSchemes, g_SelectedStyle, NULL, &dwType, (LPBYTE)pszSelectedStyle, &dwLength);
|
||||
iTemplateIndex = 0;
|
||||
Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkNewSchemes, &dwDisposition);
|
||||
if (Result == ERROR_SUCCESS)
|
||||
{
|
||||
/* First find out the currently selected template */
|
||||
dwLength = 4 * sizeof(TCHAR);
|
||||
RegQueryValueEx(hkNewSchemes, g_SelectedStyle, NULL, &dwType, (LPBYTE)pszSelectedStyle, &dwLength);
|
||||
|
||||
/* Check if already loaded */
|
||||
if (g_PresetLoaded)
|
||||
{
|
||||
RegCloseKey(hkNewSchemes);
|
||||
return g_TemplateCount;
|
||||
}
|
||||
/* Check if already loaded */
|
||||
if (g_PresetLoaded)
|
||||
{
|
||||
RegCloseKey(hkNewSchemes);
|
||||
return g_TemplateCount;
|
||||
}
|
||||
|
||||
iStyle = 0;
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
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_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_ColorSchemes[iTemplateIndex].strSizeName, &dwLength,
|
||||
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iSize <= 4))
|
||||
{
|
||||
if(RegOpenKeyEx(hkSizes, g_ColorSchemes[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
|
||||
{
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strDisplayName, &dwLength);
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strLegacyName, &dwLength);
|
||||
RegCloseKey(hkSize);
|
||||
}
|
||||
iSize++;
|
||||
iTemplateIndex++;
|
||||
dwLength = 3;
|
||||
}
|
||||
RegCloseKey(hkSizes);
|
||||
}
|
||||
RegCloseKey(hkScheme);
|
||||
}
|
||||
}
|
||||
iStyle++;
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
}
|
||||
RegCloseKey(hkNewSchemes);
|
||||
g_PresetLoaded = TRUE;
|
||||
g_TemplateCount = iTemplateIndex;
|
||||
}
|
||||
return iTemplateIndex;
|
||||
iStyle = 0;
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
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_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_ColorSchemes[iTemplateIndex].strSizeName, &dwLength,
|
||||
NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) && (iSize <= 4))
|
||||
{
|
||||
if(RegOpenKeyEx(hkSizes, g_ColorSchemes[iTemplateIndex].strSizeName, 0, KEY_READ, &hkSize) == ERROR_SUCCESS)
|
||||
{
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
RegQueryValueEx(hkSize, TEXT("DisplayName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strDisplayName, &dwLength);
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
RegQueryValueEx(hkSize, TEXT("LegacyName"), NULL, &dwType, (LPBYTE)&g_ColorSchemes[iTemplateIndex].strLegacyName, &dwLength);
|
||||
RegCloseKey(hkSize);
|
||||
}
|
||||
iSize++;
|
||||
iTemplateIndex++;
|
||||
dwLength = 3;
|
||||
}
|
||||
RegCloseKey(hkSizes);
|
||||
}
|
||||
RegCloseKey(hkScheme);
|
||||
}
|
||||
}
|
||||
iStyle++;
|
||||
dwLength = MAX_TEMPLATENAMELENTGH;
|
||||
}
|
||||
RegCloseKey(hkNewSchemes);
|
||||
g_PresetLoaded = TRUE;
|
||||
g_TemplateCount = iTemplateIndex;
|
||||
}
|
||||
return iTemplateIndex;
|
||||
}
|
||||
|
||||
typedef HRESULT (WINAPI * ENUMTHEMESTYLE) (LPCWSTR, LPWSTR, DWORD, PTHEMENAMES);
|
||||
|
|
Loading…
Reference in a new issue