1 /* $Id: advappdlg.c 24836 2007-02-12 03:12:56Z tkreuzer $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS Display Control Panel
5 * FILE: dll/cpl/desk/advappdlg.c
6 * PURPOSE: Advanced appearance dialog
8 * PROGRAMMER: Timo Kreuzer (timo[dot]kreuzer[at]web[dot]de)
13 #include "appearance.h"
18 /* Draw the current color on the color picker buttons */
20 UpdateButtonColor(HWND hwndDlg
, GLOBALS
* g
, INT ID
, INT nButton
, INT nColor
)
22 HDC hdcColorButton
, hdcCompat
;
26 COLORREF crColor
= g
->ThemeAdv
.crColor
[nColor
];
31 /* Create a DC to draw on */
32 hwndColorButton
= GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_B
);
33 hdcColorButton
= GetDC(hwndColorButton
);
34 hdcCompat
= CreateCompatibleDC(hdcColorButton
);
35 ReleaseDC(hwndColorButton
, hdcColorButton
);
37 /* Select the button image to it */
38 hgdiTmp
= SelectObject(hdcCompat
, g
->hbmpColor
[nButton
]);
40 /* Create a brush and draw the rectangle */
45 hbrush
= CreateSolidBrush(crColor
);
46 FillRect(hdcCompat
, &rect
, hbrush
);
49 /* hdcCompat is not needed anymore */
50 SelectObject(hdcCompat
,hgdiTmp
);
53 SendDlgItemMessage(hwndDlg
, ID
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[nButton
]);
54 EnableWindow(GetDlgItem(hwndDlg
, ID
), TRUE
);
58 SendDlgItemMessage(hwndDlg
, ID
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)NULL
);
59 EnableWindow(GetDlgItem(hwndDlg
, ID
), FALSE
);
64 /* Create the basic bitmaps for the color picker buttons */
66 InitColorButtons(HWND hwndDlg
, GLOBALS
* g
)
69 HDC hdcColorButton
, hdcCompat
;
76 const POINT Points
[3] = {{29,6},{33,6},{31,8}};
78 hwndColorButton
= GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_B
);
79 hdcColorButton
= GetDC(hwndColorButton
);
80 for (i
= 0; i
<= 2; i
++)
82 /* Create a DC to draw on */
83 hdcCompat
= CreateCompatibleDC(hdcColorButton
);
85 /* Create the button image */
86 g
->hbmpColor
[i
] = CreateCompatibleBitmap(hdcColorButton
, 36, 15);
88 /* Select the button image to the DC */
89 hgdiTemp
= SelectObject(hdcCompat
, g
->hbmpColor
[i
]);
91 /* Draw the buttons background color */
96 hbrush
= CreateSolidBrush(g
->crCOLOR_BTNFACE
);
97 FillRect(hdcCompat
, &rect
, hbrush
);
100 /* Draw the rectangle */
105 hbrush
= CreateSolidBrush(g
->crCOLOR_BTNTEXT
);
106 FillRect(hdcCompat
, &rect
, hbrush
);
107 DeleteObject(hbrush
);
109 /* Draw left side of line */
110 hPen
= CreatePen(PS_SOLID
, 1, g
->crCOLOR_BTNSHADOW
);
111 SelectObject(hdcCompat
, hPen
);
112 MoveToEx(hdcCompat
, 26, 1, NULL
);
113 LineTo(hdcCompat
, 26, 14);
114 SelectObject(hdcCompat
, GetStockObject(BLACK_PEN
));
117 /* Draw right side of line */
118 hPen
= CreatePen(PS_SOLID
, 1, g
->crCOLOR_BTNHIGHLIGHT
);
119 SelectObject(hdcCompat
,hPen
);
120 MoveToEx(hdcCompat
, 27, 1, NULL
);
121 LineTo(hdcCompat
, 27, 14);
122 SelectObject(hdcCompat
, GetStockObject(BLACK_PEN
));
126 hPen
= CreatePen(PS_SOLID
, 1, g
->crCOLOR_BTNTEXT
);
127 hbrush
= CreateSolidBrush(g
->crCOLOR_BTNTEXT
);
128 SelectObject(hdcCompat
, hPen
);
129 SelectObject(hdcCompat
, hbrush
);
130 SetPolyFillMode(hdcCompat
, WINDING
);
132 /* FIXME: HACK, see Points definition */
133 Polygon(hdcCompat
, Points
, 3);
136 SelectObject(hdcCompat
,hgdiTemp
);
139 DeleteObject(hbrush
);
142 ReleaseDC(hwndColorButton
, hdcColorButton
);
144 /* Set the images of the buttons */
145 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[0]);
146 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_COLOR2_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[1]);
147 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTCOLOR_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[2]);
151 /* This is the callback function to add the installed fonts to the font combo */
153 EnumFontFamExProc(ENUMLOGFONTEX
*lpelfe
, NEWTEXTMETRICEX
*lpntme
, DWORD dwFontType
, LPARAM lParam
)
155 /* Don't enumerate more than 100 fonts */
156 if (SendMessage((HWND
)lParam
, CB_GETCOUNT
, 0, 0) >= 100)
159 /* Only add the string once */
160 if (SendMessage((HWND
)lParam
, CB_FINDSTRINGEXACT
, -1, (WPARAM
)&(lpelfe
->elfLogFont
.lfFaceName
)) != CB_ERR
)
163 SendMessage((HWND
)lParam
, CB_ADDSTRING
, 0, (WPARAM
)&(lpelfe
->elfLogFont
.lfFaceName
));
169 /* Update all the controls with the current values for the selected screen element */
171 UpdateControls(HWND hwndDlg
, GLOBALS
*g
)
176 iElement
= g
->CurrentElement
;
178 /* First enable / disable the controls */
179 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
), (g_Assignment
[iElement
].Size
!= -1));
180 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_UD
), (g_Assignment
[iElement
].Size
!= -1));
181 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_T
), (g_Assignment
[iElement
].Size
!= -1));
182 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_T
), (g_Assignment
[iElement
].Color1
!= -1));
183 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR2_T
), (g_Assignment
[iElement
].Color2
!= -1));
184 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONT_T
), (g_Assignment
[iElement
].Font
!= -1));
185 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
), (g_Assignment
[iElement
].Font
!= -1));
186 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_T
), (g_Assignment
[iElement
].Font
!= -1));
187 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
), (g_Assignment
[iElement
].Font
!= -1));
188 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTCOLOR_T
), (g_Assignment
[iElement
].FontColor
!= -1));
189 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
), (g_Assignment
[iElement
].Font
!= -1));
190 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
), (g_Assignment
[iElement
].Font
!= -1));
192 /* Update the colors of the color buttons */
193 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_COLOR1_B
, 0, g_Assignment
[iElement
].Color1
);
194 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_COLOR2_B
, 1, g_Assignment
[iElement
].Color2
);
195 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_FONTCOLOR_B
, 2, g_Assignment
[iElement
].FontColor
);
197 if (g_Assignment
[iElement
].Size
!= -1)
198 SetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, g
->ThemeAdv
.Size
[g_Assignment
[iElement
].Size
], FALSE
);
200 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, TEXT(""));
202 hdcDlg
= GetDC(hwndDlg
);
203 if (g_Assignment
[iElement
].Font
!= -1)
205 LOGFONT lfFont
= g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
];
207 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, lfFont
.lfFaceName
);
208 SetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, -MulDiv(g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfHeight
, 72, GetDeviceCaps(hdcDlg
, LOGPIXELSY
)),FALSE
);
209 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, CB_FINDSTRINGEXACT
, -1, (WPARAM
)lfFont
.lfFaceName
);
210 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_SETCHECK
, g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfWeight
== FW_BOLD
?1:0, 0);
211 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_SETCHECK
, g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfItalic
, 0);
215 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, NULL
);
216 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, NULL
);
217 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_SETCHECK
, 0, 0);
218 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_SETCHECK
, 0, 0);
221 ReleaseDC(hwndDlg
, hdcDlg
);
226 SaveCurrentValues(HWND hwndDlg
, GLOBALS
*g
)
229 HDC hdcDlg
= GetDC(hwndDlg
);
231 if (g_Assignment
[g
->CurrentElement
].Size
!= -1)
233 g
->ThemeAdv
.Size
[g_Assignment
[g
->CurrentElement
].Size
] = GetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, &bTranslated
, FALSE
);
236 if (g_Assignment
[g
->CurrentElement
].Font
!= -1)
238 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
= -MulDiv(GetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, &bTranslated
, FALSE
), GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
239 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfWeight
= (SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_GETCHECK
, 0, 0) == 1)?FW_BOLD
:FW_NORMAL
;
240 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfItalic
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_GETCHECK
, 0, 0);
241 GetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
, LF_FACESIZE
* sizeof(TCHAR
));
244 ReleaseDC(hwndDlg
, hdcDlg
);
248 /* Select a color using a color picker */
250 GetColor(HWND hwndDlg
, GLOBALS
* g
, INT nButton
)
253 COLORREF crCustom
[16] = { 0 };
258 /* Get the color index from the element index and button number */
262 ColorIndex
= g_Assignment
[g
->CurrentElement
].Color1
;
263 ID
= IDC_ADVAPPEARANCE_COLOR1_B
;
267 ColorIndex
= g_Assignment
[g
->CurrentElement
].Color2
;
268 ID
= IDC_ADVAPPEARANCE_COLOR2_B
;
272 ColorIndex
= g_Assignment
[g
->CurrentElement
].FontColor
;
273 ID
= IDC_ADVAPPEARANCE_FONTCOLOR_B
;
277 crColor
= g
->ThemeAdv
.crColor
[ColorIndex
];
279 /* Prepare cc structure */
280 cc
.lStructSize
= sizeof(CHOOSECOLOR
);
281 cc
.hwndOwner
= hwndDlg
;
283 cc
.rgbResult
= crColor
;
284 cc
.lpCustColors
= crCustom
;
285 cc
.Flags
= CC_ANYCOLOR
| CC_FULLOPEN
| CC_RGBINIT
;
288 cc
.lpTemplateName
= NULL
;
290 /* Create the colorpicker */
291 if (ChooseColor(&cc
))
293 g
->ThemeAdv
.crColor
[ColorIndex
] = cc
.rgbResult
;
294 if (crColor
!= cc
.rgbResult
)
296 UpdateButtonColor(hwndDlg
, g
, ID
, nButton
, ColorIndex
);
305 /* Initialize the advanced appearance dialog */
307 AdvAppearanceDlg_Init(HWND hwndDlg
, GLOBALS
*g
)
309 INT i
, iElement
, iListIndex
, iDeskIndex
= 0;
312 LOGFONT lfButtonFont
;
317 /* Copy the current theme values */
318 g
->ThemeAdv
= g
->Theme
;
320 /* Add the elements to the combo */
321 for (iElement
= 0; iElement
< NUM_ELEMENTS
; iElement
++)
323 LoadString(hApplet
, IDS_ELEMENT_1
+ iElement
, (LPTSTR
)&tstrText
, 79);
324 iListIndex
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_ADDSTRING
, 0, (LPARAM
)&tstrText
);
325 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_SETITEMDATA
, (WPARAM
)iListIndex
, (LPARAM
)iElement
);
328 /* Get the list index of the desktop element */
329 for (iListIndex
= 0; iListIndex
< NUM_ELEMENTS
; iListIndex
++)
331 iElement
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETITEMDATA
, (WPARAM
)iListIndex
, 0);
334 iDeskIndex
= iListIndex
;
339 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_SETCURSEL
, iDeskIndex
, 0);
341 /* Set colors for the color buttons */
342 g
->crCOLOR_BTNFACE
= g
->Theme
.crColor
[COLOR_BTNFACE
];
343 g
->crCOLOR_BTNTEXT
= g
->Theme
.crColor
[COLOR_BTNTEXT
];
344 g
->crCOLOR_BTNSHADOW
= g
->Theme
.crColor
[COLOR_BTNSHADOW
];
345 g
->crCOLOR_BTNHIGHLIGHT
= g
->Theme
.crColor
[COLOR_BTNHIGHLIGHT
];
347 /* Create font for bold button */
348 lfButtonFont
= g
->Theme
.lfFont
[FONT_DIALOG
];
349 lfButtonFont
.lfWeight
= FW_BOLD
;
350 lfButtonFont
.lfItalic
= FALSE
;
351 hMyFont
= CreateFontIndirect(&lfButtonFont
);
355 DeleteObject(g
->hBoldFont
);
357 g
->hBoldFont
= hMyFont
;
360 /* Create font for italic button */
361 lfButtonFont
.lfWeight
= FW_REGULAR
;
362 lfButtonFont
.lfItalic
= TRUE
;
363 hMyFont
= CreateFontIndirect(&lfButtonFont
);
367 DeleteObject(g
->hItalicFont
);
369 g
->hItalicFont
= hMyFont
;
372 /* Set the fonts for the font style buttons */
373 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, WM_SETFONT
, (WPARAM
)g
->hBoldFont
, (LPARAM
)TRUE
);
374 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, WM_SETFONT
, (WPARAM
)g
->hItalicFont
, (LPARAM
)TRUE
);
376 /* Draw Bitmaps for the colorbuttons */
377 InitColorButtons(hwndDlg
, g
);
379 /* Make the UpDown control count correctly */
380 SendMessage (GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_UD
), UDM_SETRANGE
, 0L, MAKELONG (200, 1));
382 /* Fill font selection combo */
383 lfFont
.lfCharSet
= DEFAULT_CHARSET
;
384 lfFont
.lfFaceName
[0] = (TCHAR
)0;
385 lfFont
.lfPitchAndFamily
= 0;
386 hScreenDC
= GetDC(0);
387 EnumFontFamiliesEx(hScreenDC
, &lfFont
, (FONTENUMPROC
)EnumFontFamExProc
, (LPARAM
)GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
), 0);
388 ReleaseDC(0, hScreenDC
);
390 /* Fill font size combo */
391 for (i
= 6; i
<= 24; i
++)
393 wsprintf(Size
, TEXT("%d"), i
);
394 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, CB_ADDSTRING
, 0, (LPARAM
)&Size
);
397 /* Update the controls */
398 iListIndex
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETCURSEL
, 0, 0);
399 g
->CurrentElement
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETITEMDATA
, (WPARAM
)iListIndex
, 0);
400 UpdateControls(hwndDlg
, g
);
405 AdvAppearanceDlg_CleanUp(HWND hwndDlg
, GLOBALS
* g
)
407 DeleteObject(g
->hBoldFont
);
408 DeleteObject(g
->hItalicFont
);
413 SelectComboByElement(HWND hwnd
, INT id
, LPARAM lParam
)
418 nCount
= SendDlgItemMessage(hwnd
, id
, CB_GETCOUNT
, 0, 0);
419 if (nCount
== CB_ERR
)
422 for (i
= 0; i
< nCount
; i
++)
424 if (SendDlgItemMessage(hwnd
, id
, CB_GETITEMDATA
, (WPARAM
)i
, 0) == lParam
)
426 SendDlgItemMessage(hwnd
, id
, CB_SETCURSEL
, (WPARAM
)i
, 0);
434 GetSelectedComboText(HWND hwnd
, INT id
, LPWSTR lpStr
)
438 nCount
= SendDlgItemMessage(hwnd
, id
, CB_GETCURSEL
, 0, 0);
439 if (nCount
== CB_ERR
)
445 nCount
= SendDlgItemMessage(hwnd
, id
, CB_GETLBTEXT
, (WPARAM
)nCount
, (LPARAM
)lpStr
);
446 if (nCount
== CB_ERR
)
454 GetSelectedComboInt(HWND hwnd
, INT id
)
459 nCount
= SendDlgItemMessage(hwnd
, id
, CB_GETCURSEL
, 0, 0);
460 if (nCount
== CB_ERR
)
463 nCount
= SendDlgItemMessage(hwnd
, id
, CB_GETLBTEXT
, (WPARAM
)nCount
, (LPARAM
)szBuffer
);
464 if (nCount
== CB_ERR
)
467 return _ttoi(szBuffer
);
473 AdvAppearanceDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
478 g
= (GLOBALS
*)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
483 g
= (GLOBALS
*)lParam
;
484 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)g
);
485 AdvAppearanceDlg_Init(hwndDlg
, g
);
489 AdvAppearanceDlg_CleanUp(hwndDlg
, g
);
493 switch(LOWORD(wParam
))
496 SaveCurrentValues(hwndDlg
, g
);
497 EndDialog(hwndDlg
, 0);
501 g
->ThemeAdv
= g
->Theme
;
502 EndDialog(hwndDlg
, 0);
505 case IDC_APPEARANCE_PREVIEW
:
506 SaveCurrentValues(hwndDlg
, g
);
507 SelectComboByElement(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, lParam
);
508 g
->CurrentElement
= (INT
)lParam
;
509 UpdateControls(hwndDlg
, g
);
512 case IDC_ADVAPPEARANCE_ELEMENT
:
513 if (HIWORD(wParam
) == CBN_SELCHANGE
)
515 SaveCurrentValues(hwndDlg
, g
);
516 iListIndex
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETCURSEL
, 0, 0);
517 g
->CurrentElement
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETITEMDATA
, (WPARAM
)iListIndex
, 0);
518 UpdateControls(hwndDlg
, g
);
522 case IDC_ADVAPPEARANCE_SIZE_E
:
523 if (g
&& HIWORD(wParam
) == EN_CHANGE
)
525 int i
= (int)LOWORD(SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_UD
, UDM_GETPOS
,0,0L));
527 switch (g
->CurrentElement
)
529 case IDX_INACTIVE_CAPTION
:
530 case IDX_ACTIVE_CAPTION
:
531 case IDX_CAPTION_BUTTON
:
532 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYCAPTION
, 0, i
);
536 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYMENU
, 0, i
);
540 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCXSCROLLBAR
, 0, i
);
543 case IDX_INACTIVE_BORDER
:
544 case IDX_ACTIVE_BORDER
:
545 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYSIZEFRAME
, 0, i
);
551 case IDC_ADVAPPEARANCE_FONT_C
:
552 if (g
&& HIWORD(wParam
) == CBN_SELCHANGE
)
554 switch (g
->CurrentElement
)
556 case IDX_INACTIVE_CAPTION
:
557 case IDX_ACTIVE_CAPTION
:
558 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
559 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
560 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
561 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
565 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
566 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
567 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
568 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
572 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
573 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
574 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
575 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
581 case IDC_ADVAPPEARANCE_FONTSIZE_E
:
582 if (g
&& HIWORD(wParam
) == CBN_SELCHANGE
)
584 HDC hdcDlg
= GetDC(hwndDlg
);
587 switch (g
->CurrentElement
)
589 case IDX_INACTIVE_CAPTION
:
590 case IDX_ACTIVE_CAPTION
:
591 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
592 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
593 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
594 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
595 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
599 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
600 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
601 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
602 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
603 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
607 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
608 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
609 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
610 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
611 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
615 ReleaseDC(hwndDlg
, hdcDlg
);
619 case IDC_ADVAPPEARANCE_COLOR1_B
:
620 GetColor(hwndDlg
, g
, 0);
623 case IDC_ADVAPPEARANCE_COLOR2_B
:
624 GetColor(hwndDlg
, g
, 1);
627 case IDC_ADVAPPEARANCE_FONTCOLOR_B
:
628 GetColor(hwndDlg
, g
, 2);