1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * COPYRIGHT: See COPYING in the top level directory 3*c2c66affSColin Finck * PROJECT: ReactOS Display Control Panel 4*c2c66affSColin Finck * FILE: dll/cpl/desk/advappdlg.c 5*c2c66affSColin Finck * PURPOSE: Advanced appearance dialog 6*c2c66affSColin Finck * 7*c2c66affSColin Finck * PROGRAMMER: Timo Kreuzer (timo[dot]kreuzer[at]web[dot]de) 8*c2c66affSColin Finck * 9*c2c66affSColin Finck */ 10*c2c66affSColin Finck 11*c2c66affSColin Finck #include "desk.h" 12*c2c66affSColin Finck 13*c2c66affSColin Finck /******************************************************************************/ 14*c2c66affSColin Finck 15*c2c66affSColin Finck typedef struct 16*c2c66affSColin Finck { 17*c2c66affSColin Finck int Size; 18*c2c66affSColin Finck int Size2; 19*c2c66affSColin Finck int Color1; 20*c2c66affSColin Finck int Color2; 21*c2c66affSColin Finck int Font; 22*c2c66affSColin Finck int FontColor; 23*c2c66affSColin Finck } ASSIGNMENT; 24*c2c66affSColin Finck 25*c2c66affSColin Finck /* This const assigns the color and metric numbers to the elements from the elements list */ 26*c2c66affSColin Finck 27*c2c66affSColin Finck /* Size 1 (width) Size 2 (height) Color 1 Color 2 Font Fontcolor */ 28*c2c66affSColin Finck const ASSIGNMENT g_Assignment[NUM_ELEMENTS] = 29*c2c66affSColin Finck { 30*c2c66affSColin Finck {-1, -1, COLOR_DESKTOP, -1, -1, -1}, /* Desktop */ 31*c2c66affSColin Finck {SIZE_CAPTION_HEIGHT, -1, COLOR_INACTIVECAPTION, COLOR_GRADIENTINACTIVECAPTION, FONT_CAPTION, COLOR_INACTIVECAPTIONTEXT},/* inactive window caption */ 32*c2c66affSColin Finck {SIZE_BORDER_WIDTH, -1, COLOR_INACTIVEBORDER, -1, -1, -1}, /* inactive window border */ 33*c2c66affSColin Finck {SIZE_CAPTION_HEIGHT, -1, COLOR_ACTIVECAPTION, COLOR_GRADIENTACTIVECAPTION, FONT_CAPTION, COLOR_CAPTIONTEXT}, /* active window caption */ 34*c2c66affSColin Finck {SIZE_BORDER_WIDTH, -1, COLOR_ACTIVEBORDER, -1, -1, -1}, /* active window border */ 35*c2c66affSColin Finck {SIZE_MENU_HEIGHT, SIZE_MENU_WIDTH, COLOR_MENU, COLOR_MENUHILIGHT, FONT_MENU, COLOR_MENUTEXT}, /* menu */ 36*c2c66affSColin Finck {SIZE_MENU_HEIGHT, SIZE_MENU_WIDTH, COLOR_HIGHLIGHT, -1, -1, COLOR_HIGHLIGHTTEXT},/* marked element */ 37*c2c66affSColin Finck {-1, -1, COLOR_WINDOW, -1 /*COLOR_WINDOWFRAME*/, -1, COLOR_WINDOWTEXT}, /* window */ 38*c2c66affSColin Finck {SIZE_SCROLL_WIDTH, SIZE_SCROLL_HEIGHT, COLOR_SCROLLBAR, -1, -1, -1}, /* scroll bar */ 39*c2c66affSColin Finck {-1, -1, COLOR_3DFACE, -1, -1, COLOR_BTNTEXT}, /* 3d objects */ 40*c2c66affSColin Finck {SIZE_SM_CAPTION_HEIGHT, -1, -1, -1, FONT_SMCAPTION, -1}, /* palette (small) window caption */ 41*c2c66affSColin Finck {SIZE_CAPTION_HEIGHT, -1, -1, -1, -1, -1}, /* caption bar buttons */ 42*c2c66affSColin Finck {-1, -1, -1, -1, FONT_MESSAGE, COLOR_WINDOWTEXT}, /* dialog */ 43*c2c66affSColin Finck {-1, -1, COLOR_APPWORKSPACE, -1, -1, -1}, /* application background */ 44*c2c66affSColin Finck {SIZE_ICON_SPACE_X, -1, -1, -1, -1, -1}, /* icon distance horiz. */ 45*c2c66affSColin Finck {SIZE_ICON_SPACE_Y, -1, -1, -1, -1, -1}, /* icon distance vert. */ 46*c2c66affSColin Finck {-1, -1, COLOR_INFOBK, -1, FONT_STATUS, COLOR_INFOTEXT}, /* quickinfo */ 47*c2c66affSColin Finck {SIZE_ICON, -1, -1, -1, FONT_ICON, -1}, /* icon */ 48*c2c66affSColin Finck // {-1, -1, -1, -1, -1, COLOR_GRAYTEXT}, /* inactive menu item -- FIXME: Access? */ 49*c2c66affSColin Finck }; 50*c2c66affSColin Finck 51*c2c66affSColin Finck /******************************************************************************/ 52*c2c66affSColin Finck 53*c2c66affSColin Finck /* Draw the current color on the color picker buttons */ 54*c2c66affSColin Finck static VOID 55*c2c66affSColin Finck UpdateButtonColor(HWND hwndDlg, GLOBALS* g, INT ID, INT nButton, INT nColor) 56*c2c66affSColin Finck { 57*c2c66affSColin Finck HDC hdcColorButton, hdcCompat; 58*c2c66affSColin Finck RECT rect; 59*c2c66affSColin Finck HBRUSH hbrush; 60*c2c66affSColin Finck HWND hwndColorButton; 61*c2c66affSColin Finck HGDIOBJ hgdiTmp; 62*c2c66affSColin Finck 63*c2c66affSColin Finck if (nColor != -1) 64*c2c66affSColin Finck { 65*c2c66affSColin Finck /* Create a DC to draw on */ 66*c2c66affSColin Finck hwndColorButton = GetDlgItem(hwndDlg, ID); 67*c2c66affSColin Finck hdcColorButton = GetDC(hwndColorButton); 68*c2c66affSColin Finck hdcCompat = CreateCompatibleDC(hdcColorButton); 69*c2c66affSColin Finck ReleaseDC(hwndColorButton, hdcColorButton); 70*c2c66affSColin Finck 71*c2c66affSColin Finck /* Select the button image to it */ 72*c2c66affSColin Finck hgdiTmp = SelectObject(hdcCompat, g->hbmpColor[nButton]); 73*c2c66affSColin Finck 74*c2c66affSColin Finck /* Create a brush and draw the rectangle */ 75*c2c66affSColin Finck rect.left = 2; 76*c2c66affSColin Finck rect.top = 2; 77*c2c66affSColin Finck rect.right = 22; 78*c2c66affSColin Finck rect.bottom = 13; 79*c2c66affSColin Finck hbrush = CreateSolidBrush(g->SchemeAdv.crColor[nColor]); 80*c2c66affSColin Finck FillRect(hdcCompat, &rect, hbrush); 81*c2c66affSColin Finck DeleteObject(hbrush); 82*c2c66affSColin Finck 83*c2c66affSColin Finck /* hdcCompat is not needed anymore */ 84*c2c66affSColin Finck SelectObject(hdcCompat,hgdiTmp); 85*c2c66affSColin Finck DeleteDC(hdcCompat); 86*c2c66affSColin Finck 87*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, ID, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)g->hbmpColor[nButton]); 88*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, ID), TRUE); 89*c2c66affSColin Finck } 90*c2c66affSColin Finck else 91*c2c66affSColin Finck { 92*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, ID, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)NULL); 93*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, ID), FALSE); 94*c2c66affSColin Finck } 95*c2c66affSColin Finck } 96*c2c66affSColin Finck 97*c2c66affSColin Finck 98*c2c66affSColin Finck /* Create the basic bitmaps for the color picker buttons */ 99*c2c66affSColin Finck static VOID 100*c2c66affSColin Finck InitColorButtons(HWND hwndDlg, GLOBALS* g) 101*c2c66affSColin Finck { 102*c2c66affSColin Finck INT i; 103*c2c66affSColin Finck HDC hdcColorButton, hdcCompat; 104*c2c66affSColin Finck RECT rect; 105*c2c66affSColin Finck HBRUSH hbrush; 106*c2c66affSColin Finck HPEN hPen; 107*c2c66affSColin Finck HWND hwndColorButton; 108*c2c66affSColin Finck HGDIOBJ hgdiTemp; 109*c2c66affSColin Finck COLOR_SCHEME *scheme = &g->SchemeAdv; 110*c2c66affSColin Finck 111*c2c66affSColin Finck const POINT Points[3] = {{29,6},{33,6},{31,8}}; 112*c2c66affSColin Finck 113*c2c66affSColin Finck hwndColorButton = GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_B); 114*c2c66affSColin Finck hdcColorButton = GetDC(hwndColorButton); 115*c2c66affSColin Finck for (i = 0; i <= 2; i++) 116*c2c66affSColin Finck { 117*c2c66affSColin Finck /* Create a DC to draw on */ 118*c2c66affSColin Finck hdcCompat = CreateCompatibleDC(hdcColorButton); 119*c2c66affSColin Finck 120*c2c66affSColin Finck /* Create the button image */ 121*c2c66affSColin Finck g->hbmpColor[i] = CreateCompatibleBitmap(hdcColorButton, 36, 15); 122*c2c66affSColin Finck 123*c2c66affSColin Finck /* Select the button image to the DC */ 124*c2c66affSColin Finck hgdiTemp = SelectObject(hdcCompat, g->hbmpColor[i]); 125*c2c66affSColin Finck 126*c2c66affSColin Finck /* Draw the buttons background color */ 127*c2c66affSColin Finck rect.left = 0; 128*c2c66affSColin Finck rect.top = 0; 129*c2c66affSColin Finck rect.right = 36; 130*c2c66affSColin Finck rect.bottom = 15; 131*c2c66affSColin Finck hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]); 132*c2c66affSColin Finck FillRect(hdcCompat, &rect, hbrush); 133*c2c66affSColin Finck DeleteObject(hbrush); 134*c2c66affSColin Finck 135*c2c66affSColin Finck /* Draw the rectangle */ 136*c2c66affSColin Finck rect.left = 1; 137*c2c66affSColin Finck rect.top = 1; 138*c2c66affSColin Finck rect.right = 23; 139*c2c66affSColin Finck rect.bottom = 14; 140*c2c66affSColin Finck hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNTEXT]); 141*c2c66affSColin Finck FillRect(hdcCompat, &rect, hbrush); 142*c2c66affSColin Finck DeleteObject(hbrush); 143*c2c66affSColin Finck 144*c2c66affSColin Finck /* Draw left side of line */ 145*c2c66affSColin Finck hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNSHADOW]); 146*c2c66affSColin Finck SelectObject(hdcCompat, hPen); 147*c2c66affSColin Finck MoveToEx(hdcCompat, 26, 1, NULL); 148*c2c66affSColin Finck LineTo(hdcCompat, 26, 14); 149*c2c66affSColin Finck SelectObject(hdcCompat, GetStockObject(BLACK_PEN)); 150*c2c66affSColin Finck DeleteObject(hPen); 151*c2c66affSColin Finck 152*c2c66affSColin Finck /* Draw right side of line */ 153*c2c66affSColin Finck hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNHIGHLIGHT]); 154*c2c66affSColin Finck SelectObject(hdcCompat,hPen); 155*c2c66affSColin Finck MoveToEx(hdcCompat, 27, 1, NULL); 156*c2c66affSColin Finck LineTo(hdcCompat, 27, 14); 157*c2c66affSColin Finck SelectObject(hdcCompat, GetStockObject(BLACK_PEN)); 158*c2c66affSColin Finck DeleteObject(hPen); 159*c2c66affSColin Finck 160*c2c66affSColin Finck /* Draw triangle */ 161*c2c66affSColin Finck hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNTEXT]); 162*c2c66affSColin Finck hbrush = CreateSolidBrush(scheme->crColor[COLOR_BTNTEXT]); 163*c2c66affSColin Finck SelectObject(hdcCompat, hPen); 164*c2c66affSColin Finck SelectObject(hdcCompat, hbrush); 165*c2c66affSColin Finck SetPolyFillMode(hdcCompat, WINDING); 166*c2c66affSColin Finck 167*c2c66affSColin Finck /* FIXME: HACK, see Points definition */ 168*c2c66affSColin Finck Polygon(hdcCompat, Points, 3); 169*c2c66affSColin Finck 170*c2c66affSColin Finck /* Cleanup */ 171*c2c66affSColin Finck SelectObject(hdcCompat,hgdiTemp); 172*c2c66affSColin Finck DeleteDC(hdcCompat); 173*c2c66affSColin Finck DeleteObject(hPen); 174*c2c66affSColin Finck DeleteObject(hbrush); 175*c2c66affSColin Finck } 176*c2c66affSColin Finck 177*c2c66affSColin Finck ReleaseDC(hwndColorButton, hdcColorButton); 178*c2c66affSColin Finck 179*c2c66affSColin Finck /* Set the images of the buttons */ 180*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_B, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)g->hbmpColor[0]); 181*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_COLOR2_B, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)g->hbmpColor[1]); 182*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTCOLOR_B, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)g->hbmpColor[2]); 183*c2c66affSColin Finck } 184*c2c66affSColin Finck 185*c2c66affSColin Finck 186*c2c66affSColin Finck /* This is the callback function to add the installed fonts to the font combo */ 187*c2c66affSColin Finck static int CALLBACK 188*c2c66affSColin Finck EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD dwFontType, LPARAM lParam) 189*c2c66affSColin Finck { 190*c2c66affSColin Finck /* Don't enumerate more than 100 fonts */ 191*c2c66affSColin Finck if (SendMessage((HWND)lParam, CB_GETCOUNT, 0, 0) >= 100) 192*c2c66affSColin Finck return 0; 193*c2c66affSColin Finck 194*c2c66affSColin Finck /* Only add the string once */ 195*c2c66affSColin Finck if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (WPARAM)&(lpelfe->elfLogFont.lfFaceName)) != CB_ERR) 196*c2c66affSColin Finck return 2; 197*c2c66affSColin Finck 198*c2c66affSColin Finck SendMessage((HWND)lParam, CB_ADDSTRING, 0, (WPARAM)&(lpelfe->elfLogFont.lfFaceName)); 199*c2c66affSColin Finck 200*c2c66affSColin Finck return 1; 201*c2c66affSColin Finck } 202*c2c66affSColin Finck 203*c2c66affSColin Finck 204*c2c66affSColin Finck /* Update all the controls with the current values for the selected screen element */ 205*c2c66affSColin Finck static VOID 206*c2c66affSColin Finck UpdateControls(HWND hwndDlg, GLOBALS *g) 207*c2c66affSColin Finck { 208*c2c66affSColin Finck INT iElement; 209*c2c66affSColin Finck HDC hdcDlg; 210*c2c66affSColin Finck 211*c2c66affSColin Finck iElement = g->CurrentElement; 212*c2c66affSColin Finck 213*c2c66affSColin Finck /* First enable / disable the controls */ 214*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E), (g_Assignment[iElement].Size != -1)); 215*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_SIZE_UD), (g_Assignment[iElement].Size != -1)); 216*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_SIZE_T), (g_Assignment[iElement].Size != -1)); 217*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_T), (g_Assignment[iElement].Color1 != -1)); 218*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR2_T), (g_Assignment[iElement].Color2 != -1)); 219*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONT_T), (g_Assignment[iElement].Font != -1)); 220*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONT_C), (g_Assignment[iElement].Font != -1)); 221*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_T), (g_Assignment[iElement].Font != -1)); 222*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E), (g_Assignment[iElement].Font != -1)); 223*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTCOLOR_T), (g_Assignment[iElement].FontColor != -1)); 224*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD), (g_Assignment[iElement].Font != -1)); 225*c2c66affSColin Finck EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC), (g_Assignment[iElement].Font != -1)); 226*c2c66affSColin Finck 227*c2c66affSColin Finck /* Update the colors of the color buttons */ 228*c2c66affSColin Finck UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_COLOR1_B, 0, g_Assignment[iElement].Color1); 229*c2c66affSColin Finck UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_COLOR2_B, 1, g_Assignment[iElement].Color2); 230*c2c66affSColin Finck UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_FONTCOLOR_B, 2, g_Assignment[iElement].FontColor); 231*c2c66affSColin Finck 232*c2c66affSColin Finck if (g_Assignment[iElement].Size != -1) 233*c2c66affSColin Finck SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, SchemeGetMetric(&g->SchemeAdv, g_Assignment[iElement].Size), FALSE); 234*c2c66affSColin Finck else 235*c2c66affSColin Finck SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, TEXT("")); 236*c2c66affSColin Finck 237*c2c66affSColin Finck hdcDlg = GetDC(hwndDlg); 238*c2c66affSColin Finck if (g_Assignment[iElement].Font != -1) 239*c2c66affSColin Finck { 240*c2c66affSColin Finck PLOGFONTW plfFont = SchemeGetFont(&g->SchemeAdv, g_Assignment[iElement].Font); 241*c2c66affSColin Finck 242*c2c66affSColin Finck SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, plfFont->lfFaceName); 243*c2c66affSColin Finck SetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, -MulDiv(plfFont->lfHeight, 72, GetDeviceCaps(hdcDlg, LOGPIXELSY)), FALSE); 244*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, CB_FINDSTRINGEXACT, -1, (WPARAM)plfFont->lfFaceName); 245*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_SETCHECK, plfFont->lfWeight == FW_BOLD?1:0, 0); 246*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_SETCHECK, plfFont->lfItalic, 0); 247*c2c66affSColin Finck } 248*c2c66affSColin Finck else 249*c2c66affSColin Finck { 250*c2c66affSColin Finck SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, NULL); 251*c2c66affSColin Finck SetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, NULL); 252*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_SETCHECK, 0, 0); 253*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_SETCHECK, 0, 0); 254*c2c66affSColin Finck } 255*c2c66affSColin Finck 256*c2c66affSColin Finck ReleaseDC(hwndDlg, hdcDlg); 257*c2c66affSColin Finck } 258*c2c66affSColin Finck 259*c2c66affSColin Finck 260*c2c66affSColin Finck static VOID 261*c2c66affSColin Finck SaveCurrentValues(HWND hwndDlg, GLOBALS *g) 262*c2c66affSColin Finck { 263*c2c66affSColin Finck BOOL bTranslated; 264*c2c66affSColin Finck HDC hdcDlg = GetDC(hwndDlg); 265*c2c66affSColin Finck 266*c2c66affSColin Finck if (g_Assignment[g->CurrentElement].Size != -1) 267*c2c66affSColin Finck { 268*c2c66affSColin Finck SchemeSetMetric(&g->SchemeAdv, g_Assignment[g->CurrentElement].Size, GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, &bTranslated, FALSE)); 269*c2c66affSColin Finck } 270*c2c66affSColin Finck 271*c2c66affSColin Finck if (g_Assignment[g->CurrentElement].Font != -1) 272*c2c66affSColin Finck { 273*c2c66affSColin Finck PLOGFONTW plfFont = SchemeGetFont(&g->SchemeAdv, g_Assignment[g->CurrentElement].Font); 274*c2c66affSColin Finck plfFont->lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72); 275*c2c66affSColin Finck plfFont->lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL; 276*c2c66affSColin Finck plfFont->lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0); 277*c2c66affSColin Finck GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, plfFont->lfFaceName, LF_FACESIZE); 278*c2c66affSColin Finck } 279*c2c66affSColin Finck 280*c2c66affSColin Finck ReleaseDC(hwndDlg, hdcDlg); 281*c2c66affSColin Finck } 282*c2c66affSColin Finck 283*c2c66affSColin Finck 284*c2c66affSColin Finck /* Select a color using a color picker */ 285*c2c66affSColin Finck static BOOL 286*c2c66affSColin Finck GetColor(HWND hwndDlg, GLOBALS* g, INT nButton) 287*c2c66affSColin Finck { 288*c2c66affSColin Finck CHOOSECOLOR cc; 289*c2c66affSColin Finck COLORREF crCustom[16] = { 0 }; 290*c2c66affSColin Finck COLORREF crColor; 291*c2c66affSColin Finck INT ID = 0; 292*c2c66affSColin Finck INT ColorIndex = 0; 293*c2c66affSColin Finck 294*c2c66affSColin Finck /* Get the color index from the element index and button number */ 295*c2c66affSColin Finck switch (nButton) 296*c2c66affSColin Finck { 297*c2c66affSColin Finck case 0: 298*c2c66affSColin Finck ColorIndex = g_Assignment[g->CurrentElement].Color1; 299*c2c66affSColin Finck ID = IDC_ADVAPPEARANCE_COLOR1_B; 300*c2c66affSColin Finck break; 301*c2c66affSColin Finck 302*c2c66affSColin Finck case 1: 303*c2c66affSColin Finck ColorIndex = g_Assignment[g->CurrentElement].Color2; 304*c2c66affSColin Finck ID = IDC_ADVAPPEARANCE_COLOR2_B; 305*c2c66affSColin Finck break; 306*c2c66affSColin Finck 307*c2c66affSColin Finck case 2: 308*c2c66affSColin Finck ColorIndex = g_Assignment[g->CurrentElement].FontColor; 309*c2c66affSColin Finck ID = IDC_ADVAPPEARANCE_FONTCOLOR_B; 310*c2c66affSColin Finck break; 311*c2c66affSColin Finck } 312*c2c66affSColin Finck 313*c2c66affSColin Finck crColor = g->SchemeAdv.crColor[ColorIndex]; 314*c2c66affSColin Finck 315*c2c66affSColin Finck /* Prepare cc structure */ 316*c2c66affSColin Finck cc.lStructSize = sizeof(CHOOSECOLOR); 317*c2c66affSColin Finck cc.hwndOwner = hwndDlg; 318*c2c66affSColin Finck cc.hInstance = NULL; 319*c2c66affSColin Finck cc.rgbResult = crColor; 320*c2c66affSColin Finck cc.lpCustColors = crCustom; 321*c2c66affSColin Finck cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT; 322*c2c66affSColin Finck cc.lCustData = 0; 323*c2c66affSColin Finck cc.lpfnHook = NULL; 324*c2c66affSColin Finck cc.lpTemplateName = NULL; 325*c2c66affSColin Finck 326*c2c66affSColin Finck /* Create the colorpicker */ 327*c2c66affSColin Finck if (ChooseColor(&cc)) 328*c2c66affSColin Finck { 329*c2c66affSColin Finck g->SchemeAdv.crColor[ColorIndex] = cc.rgbResult; 330*c2c66affSColin Finck if (crColor != cc.rgbResult) 331*c2c66affSColin Finck { 332*c2c66affSColin Finck UpdateButtonColor(hwndDlg, g, ID, nButton, ColorIndex); 333*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv); 334*c2c66affSColin Finck return TRUE; 335*c2c66affSColin Finck } 336*c2c66affSColin Finck } 337*c2c66affSColin Finck 338*c2c66affSColin Finck return FALSE; 339*c2c66affSColin Finck } 340*c2c66affSColin Finck 341*c2c66affSColin Finck 342*c2c66affSColin Finck /* Initialize the advanced appearance dialog */ 343*c2c66affSColin Finck static VOID 344*c2c66affSColin Finck AdvAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g) 345*c2c66affSColin Finck { 346*c2c66affSColin Finck INT i, iElement, iListIndex, iDeskIndex = 0; 347*c2c66affSColin Finck TCHAR tstrText[80]; 348*c2c66affSColin Finck LOGFONT lfFont; 349*c2c66affSColin Finck LOGFONT lfButtonFont; 350*c2c66affSColin Finck HFONT hMyFont; 351*c2c66affSColin Finck HDC hScreenDC; 352*c2c66affSColin Finck TCHAR Size[4]; 353*c2c66affSColin Finck 354*c2c66affSColin Finck /* Copy the current theme values */ 355*c2c66affSColin Finck g->SchemeAdv = g->Scheme; 356*c2c66affSColin Finck 357*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv); 358*c2c66affSColin Finck 359*c2c66affSColin Finck /* Add the elements to the combo */ 360*c2c66affSColin Finck for (iElement = 0; iElement < NUM_ELEMENTS; iElement++) 361*c2c66affSColin Finck { 362*c2c66affSColin Finck LoadString(hApplet, IDS_ELEMENT_0 + iElement, (LPTSTR)&tstrText, 79); 363*c2c66affSColin Finck iListIndex = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_ADDSTRING, 0, (LPARAM)&tstrText); 364*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_SETITEMDATA, (WPARAM)iListIndex, (LPARAM)iElement); 365*c2c66affSColin Finck } 366*c2c66affSColin Finck 367*c2c66affSColin Finck /* Get the list index of the desktop element */ 368*c2c66affSColin Finck for (iListIndex = 0; iListIndex < NUM_ELEMENTS; iListIndex++) 369*c2c66affSColin Finck { 370*c2c66affSColin Finck iElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, (WPARAM)iListIndex, 0); 371*c2c66affSColin Finck if (iElement == 0) 372*c2c66affSColin Finck { 373*c2c66affSColin Finck iDeskIndex = iListIndex; 374*c2c66affSColin Finck break; 375*c2c66affSColin Finck } 376*c2c66affSColin Finck } 377*c2c66affSColin Finck 378*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_SETCURSEL, iDeskIndex, 0); 379*c2c66affSColin Finck 380*c2c66affSColin Finck /* Create font for bold button */ 381*c2c66affSColin Finck lfButtonFont = g->Scheme.ncMetrics.lfMessageFont; 382*c2c66affSColin Finck lfButtonFont.lfWeight = FW_BOLD; 383*c2c66affSColin Finck lfButtonFont.lfItalic = FALSE; 384*c2c66affSColin Finck hMyFont = CreateFontIndirect(&lfButtonFont); 385*c2c66affSColin Finck if (hMyFont) 386*c2c66affSColin Finck { 387*c2c66affSColin Finck if (g->hBoldFont) 388*c2c66affSColin Finck DeleteObject(g->hBoldFont); 389*c2c66affSColin Finck 390*c2c66affSColin Finck g->hBoldFont = hMyFont; 391*c2c66affSColin Finck } 392*c2c66affSColin Finck 393*c2c66affSColin Finck /* Create font for italic button */ 394*c2c66affSColin Finck lfButtonFont.lfWeight = FW_REGULAR; 395*c2c66affSColin Finck lfButtonFont.lfItalic = TRUE; 396*c2c66affSColin Finck hMyFont = CreateFontIndirect(&lfButtonFont); 397*c2c66affSColin Finck if (hMyFont) 398*c2c66affSColin Finck { 399*c2c66affSColin Finck if (g->hItalicFont) 400*c2c66affSColin Finck DeleteObject(g->hItalicFont); 401*c2c66affSColin Finck 402*c2c66affSColin Finck g->hItalicFont = hMyFont; 403*c2c66affSColin Finck } 404*c2c66affSColin Finck 405*c2c66affSColin Finck /* Set the fonts for the font style buttons */ 406*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, WM_SETFONT, (WPARAM)g->hBoldFont, (LPARAM)TRUE); 407*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, WM_SETFONT, (WPARAM)g->hItalicFont, (LPARAM)TRUE); 408*c2c66affSColin Finck 409*c2c66affSColin Finck /* Draw Bitmaps for the colorbuttons */ 410*c2c66affSColin Finck InitColorButtons(hwndDlg, g); 411*c2c66affSColin Finck 412*c2c66affSColin Finck /* Make the UpDown control count correctly */ 413*c2c66affSColin Finck SendMessage(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_SIZE_UD), UDM_SETRANGE, 0L, MAKELONG (200, 1)); 414*c2c66affSColin Finck 415*c2c66affSColin Finck /* Fill font selection combo */ 416*c2c66affSColin Finck lfFont.lfCharSet = DEFAULT_CHARSET; 417*c2c66affSColin Finck lfFont.lfFaceName[0] = (TCHAR)0; 418*c2c66affSColin Finck lfFont.lfPitchAndFamily = 0; 419*c2c66affSColin Finck hScreenDC = GetDC(0); 420*c2c66affSColin Finck EnumFontFamiliesEx(hScreenDC, &lfFont, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONT_C), 0); 421*c2c66affSColin Finck ReleaseDC(0, hScreenDC); 422*c2c66affSColin Finck 423*c2c66affSColin Finck /* Fill font size combo */ 424*c2c66affSColin Finck for (i = 6; i <= 24; i++) 425*c2c66affSColin Finck { 426*c2c66affSColin Finck StringCbPrintf(Size, sizeof(Size), TEXT("%d"), i); 427*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, CB_ADDSTRING, 0, (LPARAM)&Size); 428*c2c66affSColin Finck } 429*c2c66affSColin Finck 430*c2c66affSColin Finck /* Update the controls */ 431*c2c66affSColin Finck iListIndex = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETCURSEL, 0, 0); 432*c2c66affSColin Finck g->CurrentElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, (WPARAM)iListIndex, 0); 433*c2c66affSColin Finck UpdateControls(hwndDlg, g); 434*c2c66affSColin Finck } 435*c2c66affSColin Finck 436*c2c66affSColin Finck 437*c2c66affSColin Finck static VOID 438*c2c66affSColin Finck AdvAppearanceDlg_CleanUp(HWND hwndDlg, GLOBALS* g) 439*c2c66affSColin Finck { 440*c2c66affSColin Finck DeleteObject(g->hBoldFont); 441*c2c66affSColin Finck DeleteObject(g->hItalicFont); 442*c2c66affSColin Finck } 443*c2c66affSColin Finck 444*c2c66affSColin Finck 445*c2c66affSColin Finck static VOID 446*c2c66affSColin Finck SelectComboByElement(HWND hwnd, INT id, LPARAM lParam) 447*c2c66affSColin Finck { 448*c2c66affSColin Finck INT nCount; 449*c2c66affSColin Finck INT i; 450*c2c66affSColin Finck 451*c2c66affSColin Finck nCount = SendDlgItemMessage(hwnd, id, CB_GETCOUNT, 0, 0); 452*c2c66affSColin Finck if (nCount == CB_ERR) 453*c2c66affSColin Finck return; 454*c2c66affSColin Finck 455*c2c66affSColin Finck for (i = 0; i < nCount; i++) 456*c2c66affSColin Finck { 457*c2c66affSColin Finck if (SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, (WPARAM)i, 0) == lParam) 458*c2c66affSColin Finck { 459*c2c66affSColin Finck SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)i, 0); 460*c2c66affSColin Finck break; 461*c2c66affSColin Finck } 462*c2c66affSColin Finck } 463*c2c66affSColin Finck } 464*c2c66affSColin Finck 465*c2c66affSColin Finck 466*c2c66affSColin Finck static VOID 467*c2c66affSColin Finck GetSelectedComboText(HWND hwnd, INT id, LPWSTR lpStr) 468*c2c66affSColin Finck { 469*c2c66affSColin Finck INT nCount; 470*c2c66affSColin Finck 471*c2c66affSColin Finck nCount = SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0); 472*c2c66affSColin Finck if (nCount == CB_ERR) 473*c2c66affSColin Finck { 474*c2c66affSColin Finck *lpStr = 0; 475*c2c66affSColin Finck return; 476*c2c66affSColin Finck } 477*c2c66affSColin Finck 478*c2c66affSColin Finck nCount = SendDlgItemMessage(hwnd, id, CB_GETLBTEXT, (WPARAM)nCount, (LPARAM)lpStr); 479*c2c66affSColin Finck if (nCount == CB_ERR) 480*c2c66affSColin Finck { 481*c2c66affSColin Finck *lpStr = 0; 482*c2c66affSColin Finck } 483*c2c66affSColin Finck } 484*c2c66affSColin Finck 485*c2c66affSColin Finck 486*c2c66affSColin Finck static INT 487*c2c66affSColin Finck GetSelectedComboInt(HWND hwnd, INT id) 488*c2c66affSColin Finck { 489*c2c66affSColin Finck TCHAR szBuffer[80]; 490*c2c66affSColin Finck INT nCount; 491*c2c66affSColin Finck 492*c2c66affSColin Finck nCount = SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0); 493*c2c66affSColin Finck if (nCount == CB_ERR) 494*c2c66affSColin Finck return 0; 495*c2c66affSColin Finck 496*c2c66affSColin Finck nCount = SendDlgItemMessage(hwnd, id, CB_GETLBTEXT, (WPARAM)nCount, (LPARAM)szBuffer); 497*c2c66affSColin Finck if (nCount == CB_ERR) 498*c2c66affSColin Finck return 0; 499*c2c66affSColin Finck 500*c2c66affSColin Finck return _ttoi(szBuffer); 501*c2c66affSColin Finck } 502*c2c66affSColin Finck 503*c2c66affSColin Finck INT_PTR CALLBACK 504*c2c66affSColin Finck AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 505*c2c66affSColin Finck { 506*c2c66affSColin Finck INT iSelection, iProperty; 507*c2c66affSColin Finck GLOBALS* g; 508*c2c66affSColin Finck PLOGFONTW plfFont; 509*c2c66affSColin Finck 510*c2c66affSColin Finck g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER); 511*c2c66affSColin Finck 512*c2c66affSColin Finck switch (uMsg) 513*c2c66affSColin Finck { 514*c2c66affSColin Finck case WM_INITDIALOG: 515*c2c66affSColin Finck g = (GLOBALS*)lParam; 516*c2c66affSColin Finck SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)g); 517*c2c66affSColin Finck AdvAppearanceDlg_Init(hwndDlg, g); 518*c2c66affSColin Finck break; 519*c2c66affSColin Finck 520*c2c66affSColin Finck case WM_DESTROY: 521*c2c66affSColin Finck AdvAppearanceDlg_CleanUp(hwndDlg, g); 522*c2c66affSColin Finck break; 523*c2c66affSColin Finck 524*c2c66affSColin Finck case WM_COMMAND: 525*c2c66affSColin Finck if (g == NULL) 526*c2c66affSColin Finck return TRUE; 527*c2c66affSColin Finck 528*c2c66affSColin Finck switch(LOWORD(wParam)) 529*c2c66affSColin Finck { 530*c2c66affSColin Finck case IDOK: 531*c2c66affSColin Finck SaveCurrentValues(hwndDlg, g); 532*c2c66affSColin Finck EndDialog(hwndDlg, IDOK); 533*c2c66affSColin Finck break; 534*c2c66affSColin Finck 535*c2c66affSColin Finck case IDCANCEL: 536*c2c66affSColin Finck g->SchemeAdv = g->Scheme; 537*c2c66affSColin Finck EndDialog(hwndDlg, IDCANCEL); 538*c2c66affSColin Finck break; 539*c2c66affSColin Finck 540*c2c66affSColin Finck case IDC_APPEARANCE_PREVIEW: 541*c2c66affSColin Finck SaveCurrentValues(hwndDlg, g); 542*c2c66affSColin Finck SelectComboByElement(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, lParam); 543*c2c66affSColin Finck g->CurrentElement = (INT)lParam; 544*c2c66affSColin Finck UpdateControls(hwndDlg, g); 545*c2c66affSColin Finck break; 546*c2c66affSColin Finck 547*c2c66affSColin Finck case IDC_ADVAPPEARANCE_ELEMENT: 548*c2c66affSColin Finck if (HIWORD(wParam) == CBN_SELCHANGE) 549*c2c66affSColin Finck { 550*c2c66affSColin Finck SaveCurrentValues(hwndDlg, g); 551*c2c66affSColin Finck iSelection = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETCURSEL, 0, 0); 552*c2c66affSColin Finck g->CurrentElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, iSelection, 0); 553*c2c66affSColin Finck UpdateControls(hwndDlg, g); 554*c2c66affSColin Finck } 555*c2c66affSColin Finck break; 556*c2c66affSColin Finck 557*c2c66affSColin Finck case IDC_ADVAPPEARANCE_SIZE_E: 558*c2c66affSColin Finck if (HIWORD(wParam) == EN_CHANGE) 559*c2c66affSColin Finck { 560*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Size; 561*c2c66affSColin Finck if (iProperty == -1) 562*c2c66affSColin Finck return TRUE; 563*c2c66affSColin Finck 564*c2c66affSColin Finck iSelection = LOWORD(SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_SIZE_UD, UDM_GETPOS,0,0L)); 565*c2c66affSColin Finck SchemeSetMetric(&g->SchemeAdv, iProperty, iSelection); 566*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETSIZE, iProperty, iSelection); 567*c2c66affSColin Finck 568*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Size2; 569*c2c66affSColin Finck if (iProperty != -1) 570*c2c66affSColin Finck SchemeSetMetric(&g->SchemeAdv, iProperty, iSelection); 571*c2c66affSColin Finck } 572*c2c66affSColin Finck break; 573*c2c66affSColin Finck 574*c2c66affSColin Finck case IDC_ADVAPPEARANCE_FONT_C: 575*c2c66affSColin Finck if (HIWORD(wParam) == CBN_SELCHANGE) 576*c2c66affSColin Finck { 577*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Font; 578*c2c66affSColin Finck if (iProperty == -1) 579*c2c66affSColin Finck return TRUE; 580*c2c66affSColin Finck 581*c2c66affSColin Finck plfFont = SchemeGetFont(&g->SchemeAdv, iProperty); 582*c2c66affSColin Finck GetSelectedComboText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, plfFont->lfFaceName); 583*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont); 584*c2c66affSColin Finck } 585*c2c66affSColin Finck break; 586*c2c66affSColin Finck 587*c2c66affSColin Finck case IDC_ADVAPPEARANCE_FONTSIZE_E: 588*c2c66affSColin Finck if ((HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)) 589*c2c66affSColin Finck { 590*c2c66affSColin Finck HDC hdcDlg; 591*c2c66affSColin Finck 592*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Font; 593*c2c66affSColin Finck if (iProperty == -1) 594*c2c66affSColin Finck return TRUE; 595*c2c66affSColin Finck 596*c2c66affSColin Finck hdcDlg = GetDC(hwndDlg); 597*c2c66affSColin Finck 598*c2c66affSColin Finck plfFont = SchemeGetFont(&g->SchemeAdv, iProperty); 599*c2c66affSColin Finck iSelection = GetSelectedComboInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E); 600*c2c66affSColin Finck plfFont->lfHeight = -MulDiv(iSelection , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72); 601*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->SchemeAdv); 602*c2c66affSColin Finck 603*c2c66affSColin Finck ReleaseDC(hwndDlg, hdcDlg); 604*c2c66affSColin Finck } 605*c2c66affSColin Finck break; 606*c2c66affSColin Finck 607*c2c66affSColin Finck case IDC_ADVAPPEARANCE_FONTBOLD: 608*c2c66affSColin Finck if (HIWORD(wParam) == BN_CLICKED) 609*c2c66affSColin Finck { 610*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Font; 611*c2c66affSColin Finck if (iProperty == -1) 612*c2c66affSColin Finck return TRUE; 613*c2c66affSColin Finck 614*c2c66affSColin Finck plfFont = SchemeGetFont(&g->SchemeAdv, iProperty); 615*c2c66affSColin Finck iSelection = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0); 616*c2c66affSColin Finck plfFont->lfWeight = (iSelection == BST_CHECKED) ? FW_BOLD : FW_NORMAL; 617*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont); 618*c2c66affSColin Finck } 619*c2c66affSColin Finck break; 620*c2c66affSColin Finck 621*c2c66affSColin Finck case IDC_ADVAPPEARANCE_FONTITALIC: 622*c2c66affSColin Finck if (HIWORD(wParam) == BN_CLICKED) 623*c2c66affSColin Finck { 624*c2c66affSColin Finck iProperty = g_Assignment[g->CurrentElement].Font; 625*c2c66affSColin Finck if (iProperty == -1) 626*c2c66affSColin Finck return TRUE; 627*c2c66affSColin Finck 628*c2c66affSColin Finck plfFont = SchemeGetFont(&g->SchemeAdv, iProperty); 629*c2c66affSColin Finck iSelection = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0); 630*c2c66affSColin Finck plfFont->lfItalic = (iSelection == BST_CHECKED) ? TRUE : FALSE; 631*c2c66affSColin Finck SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont); 632*c2c66affSColin Finck } 633*c2c66affSColin Finck break; 634*c2c66affSColin Finck 635*c2c66affSColin Finck case IDC_ADVAPPEARANCE_COLOR1_B: 636*c2c66affSColin Finck GetColor(hwndDlg, g, 0); 637*c2c66affSColin Finck break; 638*c2c66affSColin Finck 639*c2c66affSColin Finck case IDC_ADVAPPEARANCE_COLOR2_B: 640*c2c66affSColin Finck GetColor(hwndDlg, g, 1); 641*c2c66affSColin Finck break; 642*c2c66affSColin Finck 643*c2c66affSColin Finck case IDC_ADVAPPEARANCE_FONTCOLOR_B: 644*c2c66affSColin Finck GetColor(hwndDlg, g, 2); 645*c2c66affSColin Finck break; 646*c2c66affSColin Finck 647*c2c66affSColin Finck default: 648*c2c66affSColin Finck return FALSE; 649*c2c66affSColin Finck } 650*c2c66affSColin Finck break; 651*c2c66affSColin Finck 652*c2c66affSColin Finck default: 653*c2c66affSColin Finck return FALSE; 654*c2c66affSColin Finck } 655*c2c66affSColin Finck 656*c2c66affSColin Finck return TRUE; 657*c2c66affSColin Finck } 658