Author: ekohl
Date: Sun Mar 11 00:25:03 2007
New Revision: 26060
URL:
http://svn.reactos.org/svn/reactos?rev=26060&view=rev
Log:
Show custom colors in the preview window.
Modified:
trunk/reactos/dll/cpl/desk/advappdlg.c
trunk/reactos/dll/cpl/desk/preview.c
trunk/reactos/dll/cpl/desk/preview.h
Modified: trunk/reactos/dll/cpl/desk/advappdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/advappdlg.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/desk/advappdlg.c (original)
+++ trunk/reactos/dll/cpl/desk/advappdlg.c Sun Mar 11 00:25:03 2007
@@ -29,7 +29,7 @@
if (nColor != -1)
{
/* Create a DC to draw on */
- hwndColorButton = GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_B);
+ hwndColorButton = GetDlgItem(hwndDlg, ID);
hdcColorButton = GetDC(hwndColorButton);
hdcCompat = CreateCompatibleDC(hdcColorButton);
ReleaseDC(hwndColorButton, hdcColorButton);
@@ -294,6 +294,7 @@
if (crColor != cc.rgbResult)
{
UpdateButtonColor(hwndDlg, g, ID, nButton, ColorIndex);
+ SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETCOLOR, ColorIndex,
cc.rgbResult);
return TRUE;
}
}
Modified: trunk/reactos/dll/cpl/desk/preview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/preview.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/desk/preview.c (original)
+++ trunk/reactos/dll/cpl/desk/preview.c Sun Mar 11 00:25:03 2007
@@ -3,7 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/cpl/desk/preview.c
* PURPOSE: Draws the preview control
- * COPYRIGHT: Copyright 2006, 2007 Eric Kohl (email?)
+ * COPYRIGHT: Copyright 2006, 2007 Eric Kohl
*/
#include "desk.h"
@@ -15,19 +15,11 @@
{
HWND hwndParent;
- DWORD clrDesktop;
+ DWORD clrSysColor[COLOR_MENUBAR];
+
+ HBRUSH hbrScrollbar;
HBRUSH hbrDesktop;
-
- DWORD clrWindow;
HBRUSH hbrWindow;
-
- DWORD clrScrollbar;
- HBRUSH hbrScrollbar;
-
- DWORD clrActiveCaptionText;
- DWORD clrInactiveCaptionText;
- DWORD clrWindowText;
- DWORD clrButtonText;
INT cxEdge;
INT cyEdge;
@@ -148,19 +140,16 @@
OnCreate(HWND hwnd, PPREVIEW_DATA pPreviewData)
{
NONCLIENTMETRICS NonClientMetrics;
-
- pPreviewData->clrScrollbar = GetSysColor(COLOR_SCROLLBAR);
- pPreviewData->hbrScrollbar = CreateSolidBrush(pPreviewData->clrScrollbar);
-
- pPreviewData->clrDesktop = GetSysColor(COLOR_DESKTOP);
- pPreviewData->hbrDesktop = CreateSolidBrush(pPreviewData->clrDesktop);
- pPreviewData->clrWindow = GetSysColor(COLOR_WINDOW);
- pPreviewData->hbrWindow = CreateSolidBrush(pPreviewData->clrWindow);
-
- pPreviewData->clrActiveCaptionText = GetSysColor(COLOR_CAPTIONTEXT);
- pPreviewData->clrInactiveCaptionText = GetSysColor(COLOR_INACTIVECAPTIONTEXT);
- pPreviewData->clrWindowText = GetSysColor(COLOR_WINDOWTEXT);
- pPreviewData->clrButtonText = GetSysColor(COLOR_BTNTEXT);
+ INT i;
+
+ for (i = 0; i < COLOR_MENUBAR + 1; i++)
+ {
+ pPreviewData->clrSysColor[i] = GetSysColor(i);
+ }
+
+ pPreviewData->hbrScrollbar =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_SCROLLBAR]);
+ pPreviewData->hbrDesktop =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_DESKTOP]);
+ pPreviewData->hbrWindow =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_WINDOW]);
pPreviewData->cxEdge = GetSystemMetrics(SM_CXEDGE) - 2;
pPreviewData->cyEdge = GetSystemMetrics(SM_CXEDGE) - 2;
@@ -354,14 +343,14 @@
/* Inactive Window */
DrawEdge(hdc, &pPreviewData->rcInactiveFrame, EDGE_RAISED, BF_RECT |
BF_MIDDLE);
- SetTextColor(hdc, pPreviewData->clrInactiveCaptionText);
+ SetTextColor(hdc, pPreviewData->clrSysColor[COLOR_INACTIVECAPTIONTEXT]);
DrawCaptionTemp(NULL, hdc, &pPreviewData->rcInactiveCaption,
pPreviewData->hCaptionFont,
NULL, pPreviewData->lpInAct, DC_GRADIENT | DC_ICON | DC_TEXT);
DrawCaptionButtons(hdc, &pPreviewData->rcInactiveCaption, TRUE,
pPreviewData->cyCaption - 2);
/* Active Window */
DrawEdge(hdc, &pPreviewData->rcActiveFrame, EDGE_RAISED, BF_RECT |
BF_MIDDLE);
- SetTextColor(hdc, pPreviewData->clrActiveCaptionText);
+ SetTextColor(hdc, pPreviewData->clrSysColor[COLOR_CAPTIONTEXT]);
DrawCaptionTemp(NULL, hdc, &pPreviewData->rcActiveCaption,
pPreviewData->hCaptionFont,
NULL, pPreviewData->lpAct, DC_ACTIVE | DC_GRADIENT | DC_ICON |
DC_TEXT);
DrawCaptionButtons(hdc, &pPreviewData->rcActiveCaption, TRUE,
pPreviewData->cyCaption - 2);
@@ -380,7 +369,7 @@
CopyRect(&rc, &pPreviewData->rcActiveClient);
rc.left += 4;
rc.top += 2;
- SetTextColor(hdc, pPreviewData->clrWindowText);
+ SetTextColor(hdc, pPreviewData->clrSysColor[COLOR_WINDOWTEXT]);
hOldFont = SelectObject(hdc, pPreviewData->hCaptionFont);
DrawText(hdc, pPreviewData->lpWinTxt, lstrlen(pPreviewData->lpWinTxt), &rc,
DT_LEFT);
SelectObject(hdc, hOldFont);
@@ -390,7 +379,7 @@
/* Dialog Window */
DrawEdge(hdc, &pPreviewData->rcDialogFrame, EDGE_RAISED, BF_RECT |
BF_MIDDLE);
- SetTextColor(hdc, pPreviewData->clrActiveCaptionText);
+ SetTextColor(hdc, pPreviewData->clrSysColor[COLOR_WINDOW]);
DrawCaptionTemp(NULL, hdc, &pPreviewData->rcDialogCaption,
pPreviewData->hCaptionFont,
NULL, pPreviewData->lpMessBox, DC_ACTIVE | DC_GRADIENT | DC_ICON |
DC_TEXT);
DrawCaptionButtons(hdc, &pPreviewData->rcDialogCaption, FALSE,
pPreviewData->cyCaption - 2);
@@ -407,7 +396,7 @@
/* Draw Button */
DrawFrameControl(hdc, &pPreviewData->rcDialogButton, DFC_BUTTON,
DFCS_BUTTONPUSH);
CopyRect(&rc, &pPreviewData->rcDialogButton);
- SetTextColor(hdc, pPreviewData->clrButtonText);
+ SetTextColor(hdc, pPreviewData->clrSysColor[COLOR_BTNTEXT]);
hOldFont = SelectObject(hdc, pPreviewData->hMessageFont);
DrawText(hdc, pPreviewData->lpButText, lstrlen(pPreviewData->lpButText),
&rc, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
SelectObject(hdc, hOldFont);
@@ -608,6 +597,28 @@
InvalidateRect(hwnd, NULL, FALSE);
break;
+ case PVM_SETCOLOR:
+ pPreviewData->clrSysColor[(INT)wParam] = (DWORD)lParam;
+ switch((INT)wParam)
+ {
+ case COLOR_SCROLLBAR:
+ DeleteObject(pPreviewData->hbrScrollbar);
+ pPreviewData->hbrScrollbar =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_SCROLLBAR]);
+ break;
+
+ case COLOR_DESKTOP:
+ DeleteObject(pPreviewData->hbrDesktop);
+ pPreviewData->hbrDesktop =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_DESKTOP]);
+ break;
+
+ case COLOR_WINDOW:
+ DeleteObject(pPreviewData->hbrWindow);
+ pPreviewData->hbrWindow =
CreateSolidBrush(pPreviewData->clrSysColor[COLOR_WINDOW]);
+ break;
+ }
+ InvalidateRect(hwnd, NULL, FALSE);
+ break;
+
default:
DefWindowProc(hwnd,
uMsg,
Modified: trunk/reactos/dll/cpl/desk/preview.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/preview.h?rev…
==============================================================================
--- trunk/reactos/dll/cpl/desk/preview.h (original)
+++ trunk/reactos/dll/cpl/desk/preview.h Sun Mar 11 00:25:03 2007
@@ -39,5 +39,7 @@
#define PVM_SETMENUFONT (WM_USER+10)
#define PVM_SETDIALOGFONT (WM_USER+11)
+#define PVM_SETCOLOR (WM_USER+12)
+
BOOL RegisterPreviewControl(IN HINSTANCE hInstance);
VOID UnregisterPreviewControl(IN HINSTANCE hInstance);