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
;
30 /* Create a DC to draw on */
31 hwndColorButton
= GetDlgItem(hwndDlg
, ID
);
32 hdcColorButton
= GetDC(hwndColorButton
);
33 hdcCompat
= CreateCompatibleDC(hdcColorButton
);
34 ReleaseDC(hwndColorButton
, hdcColorButton
);
36 /* Select the button image to it */
37 hgdiTmp
= SelectObject(hdcCompat
, g
->hbmpColor
[nButton
]);
39 /* Create a brush and draw the rectangle */
44 hbrush
= CreateSolidBrush(g
->ThemeAdv
.crColor
[nColor
]);
45 FillRect(hdcCompat
, &rect
, hbrush
);
48 /* hdcCompat is not needed anymore */
49 SelectObject(hdcCompat
,hgdiTmp
);
52 SendDlgItemMessage(hwndDlg
, ID
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[nButton
]);
53 EnableWindow(GetDlgItem(hwndDlg
, ID
), TRUE
);
57 SendDlgItemMessage(hwndDlg
, ID
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)NULL
);
58 EnableWindow(GetDlgItem(hwndDlg
, ID
), FALSE
);
63 /* Create the basic bitmaps for the color picker buttons */
65 InitColorButtons(HWND hwndDlg
, GLOBALS
* g
)
68 HDC hdcColorButton
, hdcCompat
;
75 const POINT Points
[3] = {{29,6},{33,6},{31,8}};
77 hwndColorButton
= GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_B
);
78 hdcColorButton
= GetDC(hwndColorButton
);
79 for (i
= 0; i
<= 2; i
++)
81 /* Create a DC to draw on */
82 hdcCompat
= CreateCompatibleDC(hdcColorButton
);
84 /* Create the button image */
85 g
->hbmpColor
[i
] = CreateCompatibleBitmap(hdcColorButton
, 36, 15);
87 /* Select the button image to the DC */
88 hgdiTemp
= SelectObject(hdcCompat
, g
->hbmpColor
[i
]);
90 /* Draw the buttons background color */
95 hbrush
= CreateSolidBrush(GetSysColor(COLOR_BTNFACE
));
96 FillRect(hdcCompat
, &rect
, hbrush
);
99 /* Draw the rectangle */
104 hbrush
= CreateSolidBrush(GetSysColor(COLOR_BTNTEXT
));
105 FillRect(hdcCompat
, &rect
, hbrush
);
106 DeleteObject(hbrush
);
108 /* Draw left side of line */
109 hPen
= CreatePen(PS_SOLID
, 1, GetSysColor(COLOR_BTNSHADOW
));
110 SelectObject(hdcCompat
, hPen
);
111 MoveToEx(hdcCompat
, 26, 1, NULL
);
112 LineTo(hdcCompat
, 26, 14);
113 SelectObject(hdcCompat
, GetStockObject(BLACK_PEN
));
116 /* Draw right side of line */
117 hPen
= CreatePen(PS_SOLID
, 1, GetSysColor(COLOR_BTNHIGHLIGHT
));
118 SelectObject(hdcCompat
,hPen
);
119 MoveToEx(hdcCompat
, 27, 1, NULL
);
120 LineTo(hdcCompat
, 27, 14);
121 SelectObject(hdcCompat
, GetStockObject(BLACK_PEN
));
125 hPen
= CreatePen(PS_SOLID
, 1, GetSysColor(COLOR_BTNTEXT
));
126 hbrush
= CreateSolidBrush(GetSysColor(COLOR_BTNTEXT
));
127 SelectObject(hdcCompat
, hPen
);
128 SelectObject(hdcCompat
, hbrush
);
129 SetPolyFillMode(hdcCompat
, WINDING
);
131 /* FIXME: HACK, see Points definition */
132 Polygon(hdcCompat
, Points
, 3);
135 SelectObject(hdcCompat
,hgdiTemp
);
138 DeleteObject(hbrush
);
141 ReleaseDC(hwndColorButton
, hdcColorButton
);
143 /* Set the images of the buttons */
144 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[0]);
145 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_COLOR2_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[1]);
146 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTCOLOR_B
, BM_SETIMAGE
, (WPARAM
)IMAGE_BITMAP
, (LPARAM
)g
->hbmpColor
[2]);
150 /* This is the callback function to add the installed fonts to the font combo */
152 EnumFontFamExProc(ENUMLOGFONTEX
*lpelfe
, NEWTEXTMETRICEX
*lpntme
, DWORD dwFontType
, LPARAM lParam
)
154 /* Don't enumerate more than 100 fonts */
155 if (SendMessage((HWND
)lParam
, CB_GETCOUNT
, 0, 0) >= 100)
158 /* Only add the string once */
159 if (SendMessage((HWND
)lParam
, CB_FINDSTRINGEXACT
, -1, (WPARAM
)&(lpelfe
->elfLogFont
.lfFaceName
)) != CB_ERR
)
162 SendMessage((HWND
)lParam
, CB_ADDSTRING
, 0, (WPARAM
)&(lpelfe
->elfLogFont
.lfFaceName
));
168 /* Update all the controls with the current values for the selected screen element */
170 UpdateControls(HWND hwndDlg
, GLOBALS
*g
)
175 iElement
= g
->CurrentElement
;
177 /* First enable / disable the controls */
178 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
), (g_Assignment
[iElement
].Size
!= -1));
179 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_UD
), (g_Assignment
[iElement
].Size
!= -1));
180 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_T
), (g_Assignment
[iElement
].Size
!= -1));
181 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR1_T
), (g_Assignment
[iElement
].Color1
!= -1));
182 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_COLOR2_T
), (g_Assignment
[iElement
].Color2
!= -1));
183 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONT_T
), (g_Assignment
[iElement
].Font
!= -1));
184 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
), (g_Assignment
[iElement
].Font
!= -1));
185 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_T
), (g_Assignment
[iElement
].Font
!= -1));
186 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
), (g_Assignment
[iElement
].Font
!= -1));
187 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTCOLOR_T
), (g_Assignment
[iElement
].FontColor
!= -1));
188 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
), (g_Assignment
[iElement
].Font
!= -1));
189 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
), (g_Assignment
[iElement
].Font
!= -1));
191 /* Update the colors of the color buttons */
192 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_COLOR1_B
, 0, g_Assignment
[iElement
].Color1
);
193 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_COLOR2_B
, 1, g_Assignment
[iElement
].Color2
);
194 UpdateButtonColor(hwndDlg
, g
, IDC_ADVAPPEARANCE_FONTCOLOR_B
, 2, g_Assignment
[iElement
].FontColor
);
196 if (g_Assignment
[iElement
].Size
!= -1)
197 SetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, g
->ThemeAdv
.Size
[g_Assignment
[iElement
].Size
], FALSE
);
199 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, TEXT(""));
201 hdcDlg
= GetDC(hwndDlg
);
202 if (g_Assignment
[iElement
].Font
!= -1)
204 LOGFONT lfFont
= g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
];
206 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, lfFont
.lfFaceName
);
207 SetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, -MulDiv(g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfHeight
, 72, GetDeviceCaps(hdcDlg
, LOGPIXELSY
)),FALSE
);
208 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, CB_FINDSTRINGEXACT
, -1, (WPARAM
)lfFont
.lfFaceName
);
209 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_SETCHECK
, g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfWeight
== FW_BOLD
?1:0, 0);
210 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_SETCHECK
, g
->ThemeAdv
.lfFont
[g_Assignment
[iElement
].Font
].lfItalic
, 0);
214 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, NULL
);
215 SetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, NULL
);
216 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_SETCHECK
, 0, 0);
217 SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_SETCHECK
, 0, 0);
220 ReleaseDC(hwndDlg
, hdcDlg
);
225 SaveCurrentValues(HWND hwndDlg
, GLOBALS
*g
)
228 HDC hdcDlg
= GetDC(hwndDlg
);
230 if (g_Assignment
[g
->CurrentElement
].Size
!= -1)
232 g
->ThemeAdv
.Size
[g_Assignment
[g
->CurrentElement
].Size
] = GetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_E
, &bTranslated
, FALSE
);
235 if (g_Assignment
[g
->CurrentElement
].Font
!= -1)
237 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
= -MulDiv(GetDlgItemInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
, &bTranslated
, FALSE
), GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
238 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfWeight
= (SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_GETCHECK
, 0, 0) == 1)?FW_BOLD
:FW_NORMAL
;
239 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfItalic
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_GETCHECK
, 0, 0);
240 GetDlgItemText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
, g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
, LF_FACESIZE
* sizeof(TCHAR
));
243 ReleaseDC(hwndDlg
, hdcDlg
);
247 /* Select a color using a color picker */
249 GetColor(HWND hwndDlg
, GLOBALS
* g
, INT nButton
)
252 COLORREF crCustom
[16] = { 0 };
257 /* Get the color index from the element index and button number */
261 ColorIndex
= g_Assignment
[g
->CurrentElement
].Color1
;
262 ID
= IDC_ADVAPPEARANCE_COLOR1_B
;
266 ColorIndex
= g_Assignment
[g
->CurrentElement
].Color2
;
267 ID
= IDC_ADVAPPEARANCE_COLOR2_B
;
271 ColorIndex
= g_Assignment
[g
->CurrentElement
].FontColor
;
272 ID
= IDC_ADVAPPEARANCE_FONTCOLOR_B
;
276 crColor
= g
->ThemeAdv
.crColor
[ColorIndex
];
278 /* Prepare cc structure */
279 cc
.lStructSize
= sizeof(CHOOSECOLOR
);
280 cc
.hwndOwner
= hwndDlg
;
282 cc
.rgbResult
= crColor
;
283 cc
.lpCustColors
= crCustom
;
284 cc
.Flags
= CC_ANYCOLOR
| CC_FULLOPEN
| CC_RGBINIT
;
287 cc
.lpTemplateName
= NULL
;
289 /* Create the colorpicker */
290 if (ChooseColor(&cc
))
292 g
->ThemeAdv
.crColor
[ColorIndex
] = cc
.rgbResult
;
293 if (crColor
!= cc
.rgbResult
)
295 UpdateButtonColor(hwndDlg
, g
, ID
, nButton
, ColorIndex
);
296 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCOLOR
, ColorIndex
, cc
.rgbResult
);
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
);
472 GetEditedComboInt(HWND hwnd
, INT id
)
477 nCount
= GetDlgItemInt(hwnd
, id
, &bTranslated
, FALSE
);
478 if (bTranslated
== FALSE
)
487 AdvAppearanceDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
492 g
= (GLOBALS
*)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
497 g
= (GLOBALS
*)lParam
;
498 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)g
);
499 AdvAppearanceDlg_Init(hwndDlg
, g
);
503 AdvAppearanceDlg_CleanUp(hwndDlg
, g
);
507 switch(LOWORD(wParam
))
510 SaveCurrentValues(hwndDlg
, g
);
511 EndDialog(hwndDlg
, 0);
515 g
->ThemeAdv
= g
->Theme
;
516 EndDialog(hwndDlg
, 0);
519 case IDC_APPEARANCE_PREVIEW
:
520 SaveCurrentValues(hwndDlg
, g
);
521 SelectComboByElement(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, lParam
);
522 g
->CurrentElement
= (INT
)lParam
;
523 UpdateControls(hwndDlg
, g
);
526 case IDC_ADVAPPEARANCE_ELEMENT
:
527 if (HIWORD(wParam
) == CBN_SELCHANGE
)
529 SaveCurrentValues(hwndDlg
, g
);
530 iListIndex
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETCURSEL
, 0, 0);
531 g
->CurrentElement
= SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_ELEMENT
, CB_GETITEMDATA
, (WPARAM
)iListIndex
, 0);
532 UpdateControls(hwndDlg
, g
);
536 case IDC_ADVAPPEARANCE_SIZE_E
:
537 if (g
&& HIWORD(wParam
) == EN_CHANGE
)
539 INT i
= (INT
)LOWORD(SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_SIZE_UD
, UDM_GETPOS
,0,0L));
541 switch (g
->CurrentElement
)
543 case IDX_INACTIVE_CAPTION
:
544 case IDX_ACTIVE_CAPTION
:
545 case IDX_CAPTION_BUTTON
:
546 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYCAPTION
, 0, i
);
550 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYMENU
, 0, i
);
554 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCXSCROLLBAR
, 0, i
);
557 case IDX_INACTIVE_BORDER
:
558 case IDX_ACTIVE_BORDER
:
559 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCYSIZEFRAME
, 0, i
);
565 case IDC_ADVAPPEARANCE_FONT_C
:
566 if (g
&& HIWORD(wParam
) == CBN_SELCHANGE
)
568 switch (g
->CurrentElement
)
570 case IDX_INACTIVE_CAPTION
:
571 case IDX_ACTIVE_CAPTION
:
572 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
573 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
574 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
575 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
579 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
580 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
581 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
582 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
586 GetSelectedComboText(hwndDlg
, IDC_ADVAPPEARANCE_FONT_C
,
587 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfFaceName
);
588 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
589 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
595 case IDC_ADVAPPEARANCE_FONTSIZE_E
:
596 if (g
&& HIWORD(wParam
) == CBN_SELCHANGE
)
598 HDC hdcDlg
= GetDC(hwndDlg
);
601 switch (g
->CurrentElement
)
603 case IDX_INACTIVE_CAPTION
:
604 case IDX_ACTIVE_CAPTION
:
605 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
606 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
607 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
608 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
609 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
613 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
614 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
615 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
616 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
617 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
621 i
= GetSelectedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
622 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
623 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
624 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
625 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
629 ReleaseDC(hwndDlg
, hdcDlg
);
631 else if (g
&& HIWORD(wParam
) == CBN_EDITCHANGE
)
633 HDC hdcDlg
= GetDC(hwndDlg
);
636 switch (g
->CurrentElement
)
638 case IDX_INACTIVE_CAPTION
:
639 case IDX_ACTIVE_CAPTION
:
640 i
= GetEditedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
641 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
642 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
643 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
644 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
648 i
= GetEditedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
649 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
650 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
651 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
652 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
656 i
= GetEditedComboInt(hwndDlg
, IDC_ADVAPPEARANCE_FONTSIZE_E
);
657 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfHeight
=
658 -MulDiv(i
, GetDeviceCaps(hdcDlg
, LOGPIXELSY
), 72);
659 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
660 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
664 ReleaseDC(hwndDlg
, hdcDlg
);
668 case IDC_ADVAPPEARANCE_FONTBOLD
:
669 if (g
&& HIWORD(wParam
) == BN_CLICKED
)
673 switch (g
->CurrentElement
)
675 case IDX_INACTIVE_CAPTION
:
676 case IDX_ACTIVE_CAPTION
:
677 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_GETCHECK
, 0, 0);
678 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfWeight
=
679 (i
== BST_CHECKED
) ? FW_BOLD
: FW_NORMAL
;
681 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
682 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
686 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_GETCHECK
, 0, 0);
688 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfWeight
=
689 (i
== BST_CHECKED
) ? FW_BOLD
: FW_NORMAL
;
690 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
691 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
695 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTBOLD
, BM_GETCHECK
, 0, 0);
697 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfWeight
=
698 (i
== BST_CHECKED
) ? FW_BOLD
: FW_NORMAL
;
700 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
701 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
707 case IDC_ADVAPPEARANCE_FONTITALIC
:
708 if (g
&& HIWORD(wParam
) == BN_CLICKED
)
712 switch (g
->CurrentElement
)
714 case IDX_INACTIVE_CAPTION
:
715 case IDX_ACTIVE_CAPTION
:
716 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_GETCHECK
, 0, 0);
718 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfItalic
=
719 (i
== BST_CHECKED
) ? TRUE
: FALSE
;
721 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETCAPTIONFONT
, 0,
722 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
726 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_GETCHECK
, 0, 0);
728 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfItalic
=
729 (i
== BST_CHECKED
) ? TRUE
: FALSE
;
731 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETMENUFONT
, 0,
732 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
736 i
= (INT
)SendDlgItemMessage(hwndDlg
, IDC_ADVAPPEARANCE_FONTITALIC
, BM_GETCHECK
, 0, 0);
738 g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
].lfItalic
=
739 (i
== BST_CHECKED
) ? TRUE
: FALSE
;
741 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_PREVIEW
, PVM_SETDIALOGFONT
, 0,
742 (LPARAM
)&g
->ThemeAdv
.lfFont
[g_Assignment
[g
->CurrentElement
].Font
]);
748 case IDC_ADVAPPEARANCE_COLOR1_B
:
749 GetColor(hwndDlg
, g
, 0);
752 case IDC_ADVAPPEARANCE_COLOR2_B
:
753 GetColor(hwndDlg
, g
, 1);
756 case IDC_ADVAPPEARANCE_FONTCOLOR_B
:
757 GetColor(hwndDlg
, g
, 2);