Nikolay Sivov : comctl32/monthcal: Fix MCM_SETSELRANGE for multiple calendars case.

Alexandre Julliard julliard at winehq.org
Mon Sep 19 13:48:42 CDT 2011


Module: wine
Branch: master
Commit: ca533fca8c6a513814445b44cbd9b4bdcbc319e2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ca533fca8c6a513814445b44cbd9b4bdcbc319e2

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Sep 19 11:16:43 2011 +0400

comctl32/monthcal: Fix MCM_SETSELRANGE for multiple calendars case.

---

 dlls/comctl32/monthcal.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index d757c31..8fcdf28 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -1564,6 +1564,7 @@ static LRESULT
 MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
 {
   SYSTEMTIME old_range[2];
+  INT diff;
 
   TRACE("%p\n", range);
 
@@ -1590,7 +1591,21 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
     infoPtr->minSel = range[1];
     infoPtr->maxSel = range[0];
   }
-  infoPtr->calendars[0].month = infoPtr->minSel;
+
+  diff = MONTHCAL_MonthDiff(&infoPtr->calendars[MONTHCAL_GetCalCount(infoPtr)-1].month, &infoPtr->maxSel);
+  if (diff < 0)
+  {
+    diff = MONTHCAL_MonthDiff(&infoPtr->calendars[0].month, &infoPtr->maxSel);
+    if (diff > 0) diff = 0;
+  }
+
+  if (diff != 0)
+  {
+    INT i;
+
+    for (i = 0; i < MONTHCAL_GetCalCount(infoPtr); i++)
+      MONTHCAL_GetMonth(&infoPtr->calendars[i].month, diff);
+  }
 
   /* update day of week */
   MONTHCAL_CalculateDayOfWeek(&infoPtr->minSel, TRUE);




More information about the wine-cvs mailing list