Module: wine Branch: master Commit: 4178de89ef584d4ddc13605400dea05ac1159219 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4178de89ef584d4ddc13605400...
Author: Huw Davies huw@codeweavers.com Date: Thu Feb 14 14:16:17 2013 +0000
riched20: Move text color determination to a helper function.
---
dlls/riched20/paint.c | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index cd5a427..65c6e9e 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -185,6 +185,22 @@ static int calc_y_offset( const ME_Context *c, ME_Style *style ) return offs; }
+static COLORREF get_text_color( ME_Context *c, ME_Style *style, BOOL highlight ) +{ + COLORREF color; + + if (highlight) + color = ITextHost_TxGetSysColor( c->editor->texthost, COLOR_HIGHLIGHTTEXT ); + else if ((style->fmt.dwMask & CFM_LINK) && (style->fmt.dwEffects & CFE_LINK)) + color = RGB(0,0,255); + else if ((style->fmt.dwMask & CFM_COLOR) && (style->fmt.dwEffects & CFE_AUTOCOLOR)) + color = ITextHost_TxGetSysColor( c->editor->texthost, COLOR_WINDOWTEXT ); + else + color = style->fmt.crTextColor; + + return color; +} + static void get_underline_pen( ME_Style *style, COLORREF color, HPEN *pen ) { *pen = NULL; @@ -284,12 +300,7 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS hOldFont = ME_SelectStyleFont(c, run->style); yOffset = calc_y_offset( c, run->style );
- if ((run->style->fmt.dwMask & CFM_LINK) && (run->style->fmt.dwEffects & CFE_LINK)) - rgb = RGB(0,0,255); - else if ((run->style->fmt.dwMask & CFM_COLOR) && (run->style->fmt.dwEffects & CFE_AUTOCOLOR)) - rgb = ITextHost_TxGetSysColor(c->editor->texthost, COLOR_WINDOWTEXT); - else - rgb = run->style->fmt.crTextColor; + rgb = get_text_color( c, run->style, FALSE );
if (bHighlightedText) { @@ -336,8 +347,7 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS dim.bottom = ymin + cy; dim.left = xSelStart; dim.right = xSelEnd; - SetTextColor(hDC, ITextHost_TxGetSysColor(c->editor->texthost, - COLOR_HIGHLIGHTTEXT)); + SetTextColor( hDC, get_text_color( c, run->style, TRUE ) ); rgbBackOld = SetBkColor(hDC, ITextHost_TxGetSysColor(c->editor->texthost, COLOR_HIGHLIGHT)); ExtTextOutW(hDC, xSelStart, y-yOffset, ETO_OPAQUE, &dim,