Nikolay Sivov : comctl32/monthcal: Clean day painting function.
Alexandre Julliard
julliard at winehq.org
Mon Mar 28 14:22:01 CDT 2011
Module: wine
Branch: master
Commit: 3796f127102093c1af1e9e10973fc9d0ea284855
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3796f127102093c1af1e9e10973fc9d0ea284855
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat Mar 26 22:11:54 2011 +0300
comctl32/monthcal: Clean day painting function.
---
dlls/comctl32/monthcal.c | 31 +++++++++++++------------------
1 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 0e1a65c..58afc97 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -666,20 +666,18 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, const SYSTEM
static const WCHAR fmtW[] = { '%','d',0 };
WCHAR buf[10];
RECT r, r_temp;
- static BOOL bold_selected;
- BOOL selected_day = FALSE;
COLORREF oldCol = 0;
COLORREF oldBk = 0;
+ INT old_bkmode, selection;
-/* No need to check styles: when selection is not valid, it is set to zero.
- * 1<day<31, so everything is OK.
- */
-
+ /* no need to check styles: when selection is not valid, it is set to zero.
+ 1 < day < 31, so everything is OK */
MONTHCAL_CalcPosFromDay(infoPtr, st, &r);
if(!IntersectRect(&r_temp, &(ps->rcPaint), &r)) return;
if ((MONTHCAL_CompareDate(st, &infoPtr->minSel) >= 0) &&
- (MONTHCAL_CompareDate(st, &infoPtr->maxSel) <= 0)) {
+ (MONTHCAL_CompareDate(st, &infoPtr->maxSel) <= 0))
+ {
TRACE("%d %d %d\n", st->wDay, infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
TRACE("%s\n", wine_dbgstr_rect(&r));
@@ -687,23 +685,20 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, const SYSTEM
oldBk = SetBkColor(hdc, infoPtr->colors[MCSC_TRAILINGTEXT]);
FillRect(hdc, &r, infoPtr->brushes[MCSC_TITLEBK]);
- selected_day = TRUE;
+ selection = 1;
}
+ else
+ selection = 0;
- if(bold && !bold_selected) {
- SelectObject(hdc, infoPtr->hBoldFont);
- bold_selected = TRUE;
- }
- if(!bold && bold_selected) {
- SelectObject(hdc, infoPtr->hFont);
- bold_selected = FALSE;
- }
+ SelectObject(hdc, bold ? infoPtr->hBoldFont : infoPtr->hFont);
- SetBkMode(hdc,TRANSPARENT);
+ old_bkmode = SetBkMode(hdc, TRANSPARENT);
wsprintfW(buf, fmtW, st->wDay);
DrawTextW(hdc, buf, -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
+ SetBkMode(hdc, old_bkmode);
- if(selected_day) {
+ if (selection)
+ {
SetTextColor(hdc, oldCol);
SetBkColor(hdc, oldBk);
}
More information about the wine-cvs
mailing list