From f6cc0086feab23e355e4895119a220732df8e259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Sun, 26 Aug 2007 18:37:08 +0200 Subject: [PATCH] wordpad: Allow changing font effects in the choose font dialog. --- programs/wordpad/wordpad.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 968f8d531c5..55485ec2ef4 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -800,7 +800,7 @@ static void dialog_choose_font(void) cf.lStructSize = sizeof(cf); cf.hwndOwner = hMainWnd; cf.lpLogFont = &lf; - cf.Flags = CF_SCREENFONTS | CF_NOSCRIPTSEL | CF_INITTOLOGFONTSTRUCT; + cf.Flags = CF_SCREENFONTS | CF_NOSCRIPTSEL | CF_INITTOLOGFONTSTRUCT | CF_EFFECTS; ZeroMemory(&fmt, sizeof(fmt)); fmt.cbSize = sizeof(fmt); @@ -809,19 +809,28 @@ static void dialog_choose_font(void) lstrcpyW(cf.lpLogFont->lfFaceName, fmt.szFaceName); cf.lpLogFont->lfItalic = (fmt.dwEffects & CFE_ITALIC) ? TRUE : FALSE; cf.lpLogFont->lfWeight = (fmt.dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL; + cf.lpLogFont->lfUnderline = (fmt.dwEffects & CFE_UNDERLINE) ? TRUE : FALSE; + cf.lpLogFont->lfStrikeOut = (fmt.dwEffects & CFE_STRIKEOUT) ? TRUE : FALSE; cf.lpLogFont->lfHeight = -MulDiv(fmt.yHeight / 20, GetDeviceCaps(hDC, LOGPIXELSY), 72); + cf.rgbColors = fmt.crTextColor; if(ChooseFontW(&cf)) { ZeroMemory(&fmt, sizeof(fmt)); fmt.cbSize = sizeof(fmt); - fmt.dwMask = CFM_BOLD | CFM_ITALIC | CFM_SIZE; + fmt.dwMask = CFM_BOLD | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; fmt.yHeight = cf.iPointSize * 2; if(cf.nFontType & BOLD_FONTTYPE) fmt.dwEffects |= CFE_BOLD; if(cf.nFontType & ITALIC_FONTTYPE) fmt.dwEffects |= CFE_ITALIC; + if(cf.lpLogFont->lfUnderline == TRUE) + fmt.dwEffects |= CFE_UNDERLINE; + if(cf.lpLogFont->lfStrikeOut == TRUE) + fmt.dwEffects |= CFE_STRIKEOUT; + + fmt.crTextColor = cf.rgbColors; SendMessageW(hEditorWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt); set_font(cf.lpLogFont->lfFaceName);