winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2009
----- 2025 -----
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
866 discussions
Start a n
N
ew thread
Nikolay Sivov : comctl32/monthcal: Add parameter validation to MCM_HITTEST handler.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 69080d6d29a6b14bad3ea3be7e12226e43f7cf5d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=69080d6d29a6b14bad3ea3be7…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 23:26:53 2009 +0400 comctl32/monthcal: Add parameter validation to MCM_HITTEST handler. --- dlls/comctl32/monthcal.c | 4 ++++ dlls/comctl32/tests/monthcal.c | 17 +++++++++++++++-- include/commctrl.h | 7 +++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 1389622..603e3e8 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1141,6 +1141,7 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht) DWORD retval; int day,wday,wnum; + if(!lpht || lpht->cbSize < MCHITTESTINFO_V1_SIZE) return -1; x = lpht->pt.x; y = lpht->pt.y; @@ -1417,6 +1418,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); } + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); TRACE("(%d, %d)\n", ht.pt.x, ht.pt.y); @@ -1550,6 +1552,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) redraw = TRUE; } + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); hit = MONTHCAL_HitTest(infoPtr, &ht); @@ -1628,6 +1631,7 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) if(!(infoPtr->status & MC_SEL_LBUTDOWN)) return 0; + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 109d8a8..8561b8c 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -867,6 +867,19 @@ static void test_monthcal_hittest(void) hwnd = create_monthcal_control(0); + /* test with invalid structure size */ + mchit.cbSize = MCHITTESTINFO_V1_SIZE - 1; + mchit.pt.x = 0; + mchit.pt.y = 0; + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); + expect(0, mchit.pt.x); + expect(0, mchit.pt.y); + expect(-1, res); + expect(0, mchit.uHit); + /* test with invalid pointer */ + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)NULL); + expect(-1, res); + flush_sequences(sequences, NUM_MSG_SEQUENCES); st.wYear = 2007; @@ -882,7 +895,7 @@ static void test_monthcal_hittest(void) expect(1,res); /* (0, 0) is the top left of the control and should not be active */ - mchit.cbSize = sizeof(MCHITTESTINFO); + mchit.cbSize = MCHITTESTINFO_V1_SIZE; mchit.pt.x = 0; mchit.pt.y = 0; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); @@ -1051,7 +1064,7 @@ static void test_monthcal_todaylink(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); /* (70, 370) is in active area - today link */ - mchit.cbSize = sizeof(MCHITTESTINFO); + mchit.cbSize = MCHITTESTINFO_V1_SIZE; mchit.pt.x = 70; mchit.pt.y = 370; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); diff --git a/include/commctrl.h b/include/commctrl.h index ae417c0..6a42e2e 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -4702,8 +4702,15 @@ typedef struct { POINT pt; UINT uHit; SYSTEMTIME st; + /* Vista */ + RECT rc; + INT iOffset; + INT iRow; + INT iCol; } MCHITTESTINFO, *PMCHITTESTINFO; +#define MCHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(MCHITTESTINFO, st) + typedef struct tagNMSELCHANGE { NMHDR nmhdr;
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Fix timestamp storing on MCM_SETRANGE/ MCM_SETSELRANGE.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 1224cc461dc95608dfce31479cc06b503d3f32d2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1224cc461dc95608dfce31479…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 20:06:48 2009 +0400 comctl32/monthcal: Fix timestamp storing on MCM_SETRANGE/MCM_SETSELRANGE. --- dlls/comctl32/monthcal.c | 49 ++++++++++++++++++++++++++++++++------- dlls/comctl32/tests/monthcal.c | 30 +++++++++++++++++++++++- 2 files changed, 69 insertions(+), 10 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 3aa0693..1389622 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -160,17 +160,35 @@ static inline BOOL MONTHCAL_IsDateEqual(const SYSTEMTIME *first, const SYSTEMTIM (first->wDay == second->wDay); } -/* make sure that time is valid */ -static BOOL MONTHCAL_ValidateTime(SYSTEMTIME time) +/* make sure that date fields are valid */ +static BOOL MONTHCAL_ValidateDate(const SYSTEMTIME *time) { - if(time.wMonth < 1 || time.wMonth > 12 ) return FALSE; - if(time.wDayOfWeek > 6) return FALSE; - if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear)) + if(time->wMonth < 1 || time->wMonth > 12 ) return FALSE; + if(time->wDayOfWeek > 6) return FALSE; + if(time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear)) return FALSE; return TRUE; } +/* Used in MCM_SETRANGE/MCM_SETSELRANGE to determine resulting time part. + Milliseconds are intentionaly not validated. */ +static BOOL MONTHCAL_ValidateTime(const SYSTEMTIME *time) +{ + if((time->wHour > 24) || (time->wMinute > 59) || (time->wSecond > 59)) + return FALSE; + else + return TRUE; +} + +/* Copies timestamp part only. Milliseconds are intentionaly not copied + cause it matches required behaviour for current use of this helper */ +static void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) +{ + to->wHour = from->wHour; + to->wMinute = from->wMinute; + to->wSecond = from->wSecond; +} /* Note:Depending on DST, this may be offset by a day. Need to find out if we're on a DST place & adjust the clock accordingly. @@ -908,17 +926,23 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range) TRACE("%x %p\n", limits, range); - if ((limits & GDTR_MIN && !MONTHCAL_ValidateTime(range[0])) || - (limits & GDTR_MAX && !MONTHCAL_ValidateTime(range[1]))) + if ((limits & GDTR_MIN && !MONTHCAL_ValidateDate(&range[0])) || + (limits & GDTR_MAX && !MONTHCAL_ValidateDate(&range[1]))) return FALSE; if (limits & GDTR_MIN) { + if (!MONTHCAL_ValidateTime(&range[0])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[0]); + infoPtr->minDate = range[0]; infoPtr->rangeValid |= GDTR_MIN; } if (limits & GDTR_MAX) { + if (!MONTHCAL_ValidateTime(&range[1])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[1]); + infoPtr->maxDate = range[1]; infoPtr->rangeValid |= GDTR_MAX; } @@ -1003,7 +1027,7 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) if(!curSel) return FALSE; if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE; - if(!MONTHCAL_ValidateTime(*curSel)) return FALSE; + if(!MONTHCAL_ValidateDate(curSel)) return FALSE; infoPtr->minSel = *curSel; infoPtr->maxSel = *curSel; @@ -1067,8 +1091,15 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range) if(infoPtr->dwStyle & MCS_MULTISELECT) { - infoPtr->maxSel = range[1]; + /* adjust timestamps */ + if(!MONTHCAL_ValidateTime(&range[0])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[0]); + if(!MONTHCAL_ValidateTime(&range[1])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[1]); + infoPtr->minSel = range[0]; + infoPtr->maxSel = range[1]; + TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); return TRUE; } diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index e5282ff..109d8a8 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -322,7 +322,7 @@ static const struct message destroy_parent_seq[] = { static void test_monthcal(void) { HWND hwnd; - SYSTEMTIME st[2], st1[2]; + SYSTEMTIME st[2], st1[2], today; int res, month_range; hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, @@ -354,13 +354,41 @@ static void test_monthcal(void) GetSystemTime(&st[0]); st[1] = st[0]; + SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&today); + /* Invalid date/time */ st[0].wYear = 2000; /* Time should not matter */ st[1].wHour = st[1].wMinute = st[1].wSecond = 70; + st[1].wMilliseconds = 1200; ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n"); + /* invalid timestamp is written back with today data and msecs untouched */ + expect(today.wHour, st[1].wHour); + expect(today.wMinute, st[1].wMinute); + expect(today.wSecond, st[1].wSecond); + expect(1200, st[1].wMilliseconds); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n"); ok(st1[0].wYear != 2000, "Lover limit changed\n"); + /* invalid timestamp should be replaced with today data, except msecs */ + expect(today.wHour, st1[1].wHour); + expect(today.wMinute, st1[1].wMinute); + expect(today.wSecond, st1[1].wSecond); + expect(1200, st1[1].wMilliseconds); + + /* Invalid date/time with invalid milliseconds only */ + GetSystemTime(&st[0]); + st[1] = st[0]; + /* Time should not matter */ + st[1].wMilliseconds = 1200; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n"); + /* invalid milliseconds field doesn't lead to invalid timestamp */ + expect(st[0].wHour, st[1].wHour); + expect(st[0].wMinute, st[1].wMinute); + expect(st[0].wSecond, st[1].wSecond); + expect(1200, st[1].wMilliseconds); + + GetSystemTime(&st[0]); st[1].wMonth = 0; ok(!SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Should have failed to set limits\n");
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Prevent configured range exceeding with prev/next buttons.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 211a55b8777ee5f91976d75d4813e1ec0014c365 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=211a55b8777ee5f91976d75d4…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 17:15:17 2009 +0400 comctl32/monthcal: Prevent configured range exceeding with prev/next buttons. --- dlls/comctl32/monthcal.c | 52 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 41 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index cee1f9e..3aa0693 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1248,28 +1248,58 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) { + SYSTEMTIME next = infoPtr->curSel; + TRACE("\n"); - infoPtr->curSel.wMonth++; - if(infoPtr->curSel.wMonth > 12) { - infoPtr->curSel.wYear++; - infoPtr->curSel.wMonth = 1; + next.wMonth++; + if(next.wMonth > 12) { + next.wYear++; + next.wMonth = 1; + } + + /* prevent max range exceeding */ + if(infoPtr->rangeValid & GDTR_MAX) + { + FILETIME ft_next, ft_max; + + SystemTimeToFileTime(&infoPtr->maxDate, &ft_max); + SystemTimeToFileTime(&next, &ft_next); + + if (CompareFileTime(&ft_next, &ft_max) > 0) return; } + infoPtr->curSel = next; + MONTHCAL_NotifyDayState(infoPtr); } static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) { + SYSTEMTIME prev = infoPtr->curSel; + TRACE("\n"); - infoPtr->curSel.wMonth--; - if(infoPtr->curSel.wMonth < 1) { - infoPtr->curSel.wYear--; - infoPtr->curSel.wMonth = 12; + prev.wMonth--; + if(prev.wMonth < 1) { + prev.wYear--; + prev.wMonth = 12; } + /* prevent min range exceeding */ + if(infoPtr->rangeValid & GDTR_MIN) + { + FILETIME ft_prev, ft_min; + + SystemTimeToFileTime(&infoPtr->minDate, &ft_min); + SystemTimeToFileTime(&prev, &ft_prev); + + if (CompareFileTime(&ft_prev, &ft_min) < 0) return; + } + + infoPtr->curSel = prev; + MONTHCAL_NotifyDayState(infoPtr); } @@ -1495,7 +1525,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) infoPtr->status = MC_SEL_LBUTUP; - if(hit ==MCHT_CALENDARDATENEXT) { + if(hit == MCHT_CALENDARDATENEXT) { MONTHCAL_GoToNextMonth(infoPtr); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return TRUE; @@ -1858,8 +1888,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) GetLocalTime(&infoPtr->todaysDate); infoPtr->firstDayHighWord = FALSE; MONTHCAL_SetFirstDayOfWeek(infoPtr, -1); - infoPtr->curSel.wMonth = infoPtr->todaysDate.wMonth; - infoPtr->curSel.wYear = infoPtr->todaysDate.wYear; + infoPtr->maxSelCount = 7; infoPtr->monthRange = 3; infoPtr->monthdayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); @@ -1872,6 +1901,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) infoPtr->minSel = infoPtr->todaysDate; infoPtr->maxSel = infoPtr->todaysDate; + infoPtr->curSel = infoPtr->todaysDate; /* call MONTHCAL_UpdateSize to set all of the dimensions */ /* of the control */
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Move MCN_GETDAYSTATE notification to a helper.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 7030296eceeb8288a578283d9d4dc6b6f7a94cb3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7030296eceeb8288a578283d9…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 16:03:34 2009 +0400 comctl32/monthcal: Move MCN_GETDAYSTATE notification to a helper. --- dlls/comctl32/monthcal.c | 47 +++++++++++++++------------------------------ 1 files changed, 16 insertions(+), 31 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index da45828..cee1f9e 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1220,17 +1220,9 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht) return retval; } - -static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) +/* MCN_GETDAYSTATE notification helper */ +static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) { - TRACE("MONTHCAL_GoToNextMonth\n"); - - infoPtr->curSel.wMonth++; - if(infoPtr->curSel.wMonth > 12) { - infoPtr->curSel.wYear++; - infoPtr->curSel.wMonth = 1; - } - if(infoPtr->dwStyle & MCS_DAYSTATE) { NMDAYSTATE nmds; INT i; @@ -1254,6 +1246,19 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) } } +static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) +{ + TRACE("\n"); + + infoPtr->curSel.wMonth++; + if(infoPtr->curSel.wMonth > 12) { + infoPtr->curSel.wYear++; + infoPtr->curSel.wMonth = 1; + } + + MONTHCAL_NotifyDayState(infoPtr); +} + static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) { @@ -1265,27 +1270,7 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) infoPtr->curSel.wMonth = 12; } - if(infoPtr->dwStyle & MCS_DAYSTATE) { - NMDAYSTATE nmds; - INT i; - - nmds.nmhdr.hwndFrom = infoPtr->hwndSelf; - nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmds.nmhdr.code = MCN_GETDAYSTATE; - nmds.cDayState = infoPtr->monthRange; - nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - - nmds.stStart = infoPtr->todaysDate; - nmds.stStart.wYear = infoPtr->curSel.wYear; - nmds.stStart.wMonth = infoPtr->curSel.wMonth; - nmds.stStart.wDay = 1; - - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); - for(i = 0; i < infoPtr->monthRange; i++) - infoPtr->monthdayState[i] = nmds.prgDayState[i]; - - Free(nmds.prgDayState); - } + MONTHCAL_NotifyDayState(infoPtr); } static LRESULT
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Fix memory leak on MCN_GETDAYSTATE notification.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: e3a7c6c7e7a18afaa9e47c3ddb9115a41e2fda51 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e3a7c6c7e7a18afaa9e47c3dd…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 15:55:27 2009 +0400 comctl32/monthcal: Fix memory leak on MCN_GETDAYSTATE notification. --- dlls/comctl32/monthcal.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 9cee5fc..da45828 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1233,7 +1233,7 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) if(infoPtr->dwStyle & MCS_DAYSTATE) { NMDAYSTATE nmds; - int i; + INT i; nmds.nmhdr.hwndFrom = infoPtr->hwndSelf; nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); @@ -1242,13 +1242,15 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); nmds.stStart = infoPtr->todaysDate; - nmds.stStart.wYear = infoPtr->curSel.wYear; + nmds.stStart.wYear = infoPtr->curSel.wYear; nmds.stStart.wMonth = infoPtr->curSel.wMonth; nmds.stStart.wDay = 1; SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); - for(i=0; i<infoPtr->monthRange; i++) + for(i = 0; i < infoPtr->monthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; + + Free(nmds.prgDayState); } } @@ -1265,23 +1267,24 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) if(infoPtr->dwStyle & MCS_DAYSTATE) { NMDAYSTATE nmds; - int i; + INT i; nmds.nmhdr.hwndFrom = infoPtr->hwndSelf; nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.cDayState = infoPtr->monthRange; - nmds.prgDayState = Alloc - (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); nmds.stStart = infoPtr->todaysDate; - nmds.stStart.wYear = infoPtr->curSel.wYear; + nmds.stStart.wYear = infoPtr->curSel.wYear; nmds.stStart.wMonth = infoPtr->curSel.wMonth; nmds.stStart.wDay = 1; SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); - for(i=0; i<infoPtr->monthRange; i++) + for(i = 0; i < infoPtr->monthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; + + Free(nmds.prgDayState); } }
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Properly handle Goto Today popup menu ( on RButton).
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 818aab58f5b4398f817abedd8c67c85e06b97a47 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=818aab58f5b4398f817abedd8…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 15:33:47 2009 +0400 comctl32/monthcal: Properly handle Goto Today popup menu (on RButton). --- dlls/comctl32/monthcal.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 498c84f..9cee5fc 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1294,22 +1294,24 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) WCHAR buf[32]; hMenu = CreatePopupMenu(); - if (!LoadStringW(COMCTL32_hModule,IDM_GOTODAY,buf,countof(buf))) - { + if (!LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, countof(buf))) + { WARN("Can't load resource\n"); strcpyW(buf, todayW); - } - AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf); - menupoint.x=(short)LOWORD(lParam); - menupoint.y=(short)HIWORD(lParam); + } + AppendMenuW(hMenu, MF_STRING|MF_ENABLED, 1, buf); + menupoint.x = (short)LOWORD(lParam); + menupoint.y = (short)HIWORD(lParam); ClientToScreen(infoPtr->hwndSelf, &menupoint); - if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD, + if( TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL)) - { - infoPtr->curSel.wMonth = infoPtr->todaysDate.wMonth; - infoPtr->curSel.wYear = infoPtr->todaysDate.wYear; + { + infoPtr->curSel = infoPtr->todaysDate; + infoPtr->minSel = infoPtr->todaysDate; + infoPtr->maxSel = infoPtr->todaysDate; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } + return 0; }
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Store full date info to current date on todaylink with LButton.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: a95b63efccf51c4f52d8a0c41d1d6672acdb7477 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a95b63efccf51c4f52d8a0c41…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 15:23:44 2009 +0400 comctl32/monthcal: Store full date info to current date on todaylink with LButton. --- dlls/comctl32/monthcal.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index bb5b6de..498c84f 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1421,10 +1421,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { NMSELCHANGE nmsc; - infoPtr->curSel.wDay = infoPtr->todaysDate.wDay; infoPtr->firstSelDay = infoPtr->todaysDate.wDay; - infoPtr->curSel.wMonth = infoPtr->todaysDate.wMonth; - infoPtr->curSel.wYear = infoPtr->todaysDate.wYear; + infoPtr->curSel = infoPtr->todaysDate; infoPtr->minSel = infoPtr->todaysDate; infoPtr->maxSel = infoPtr->todaysDate; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Gather currently selected year and month into a single structure.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 6a11d779e6f0430409d46891758300334ea8432d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6a11d779e6f0430409d468917…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 15:17:59 2009 +0400 comctl32/monthcal: Gather currently selected year and month into a single structure. --- dlls/comctl32/monthcal.c | 169 ++++++++++++++++++++++------------------------ 1 files changed, 82 insertions(+), 87 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6a11d779e6f0430409d46…
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Make year edit box readonly, cleanup LButton handler to be more readable.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: 962339d4d6dc51907f45388af93e63df77b35b60 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=962339d4d6dc51907f45388af…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 03:50:22 2009 +0400 comctl32/monthcal: Make year edit box readonly, cleanup LButton handler to be more readable. --- dlls/comctl32/monthcal.c | 148 +++++++++++++++++++++++---------------------- 1 files changed, 76 insertions(+), 72 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 77e58b7..e8f16f0 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1318,110 +1318,112 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) return 0; } +/* creates updown control and edit box */ +static void MONTHCAL_EditYear(MONTHCAL_INFO *infoPtr) +{ + static const WCHAR EditW[] = { 'E','D','I','T',0 }; + + infoPtr->hWndYearEdit = + CreateWindowExW(0, EditW, 0, WS_VISIBLE | WS_CHILD | ES_READONLY, + infoPtr->titleyear.left + 3, infoPtr->titlebtnnext.top, + infoPtr->titleyear.right - infoPtr->titleyear.left + 4, + infoPtr->textHeight, infoPtr->hwndSelf, + NULL, NULL, NULL); + + SendMessageW(infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM)infoPtr->hBoldFont, TRUE); + + infoPtr->hWndYearUpDown = + CreateWindowExW(0, UPDOWN_CLASSW, 0, + WS_VISIBLE | WS_CHILD | UDS_SETBUDDYINT | UDS_NOTHOUSANDS | UDS_ARROWKEYS, + infoPtr->titleyear.right + 7, infoPtr->titlebtnnext.top, + 18, infoPtr->textHeight, infoPtr->hwndSelf, + NULL, NULL, NULL); + + /* attach edit box */ + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETRANGE, 0, MAKELONG(9999, 1753)); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM)infoPtr->hWndYearEdit, 0); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, infoPtr->currentYear); +} + static LRESULT MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { - static const WCHAR EditW[] = { 'E','D','I','T',0 }; MCHITTESTINFO ht; DWORD hit; - HMENU hMenu; - RECT rcDay; /* used in determining area to invalidate */ - WCHAR buf[32]; - int i; - POINT menupoint; - - TRACE("%lx\n", lParam); if (infoPtr->hWndYearUpDown) - { - infoPtr->currentYear=SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, 0); + { + infoPtr->currentYear = SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, 0); if(!DestroyWindow(infoPtr->hWndYearUpDown)) - { - FIXME("Can't destroy Updown Control\n"); - } + { + FIXME("Can't destroy Updown Control\n"); + } else - infoPtr->hWndYearUpDown=0; + infoPtr->hWndYearUpDown = 0; + if(!DestroyWindow(infoPtr->hWndYearEdit)) - { - FIXME("Can't destroy Updown Control\n"); - } + { + FIXME("Can't destroy Updown Control\n"); + } else - infoPtr->hWndYearEdit=0; + infoPtr->hWndYearEdit = 0; + InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); + TRACE("(%d, %d)\n", ht.pt.x, ht.pt.y); + hit = MONTHCAL_HitTest(infoPtr, &ht); - /* FIXME: these flags should be checked by */ - /*((hit & MCHT_XXX) == MCHT_XXX) b/c some of the flags are */ - /* multi-bit */ - if(hit ==MCHT_TITLEBTNNEXT) { + switch(hit) + { + case MCHT_TITLEBTNNEXT: MONTHCAL_GoToNextMonth(infoPtr); infoPtr->status = MC_NEXTPRESSED; SetTimer(infoPtr->hwndSelf, MC_NEXTMONTHTIMER, MC_NEXTMONTHDELAY, 0); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; - } - if(hit == MCHT_TITLEBTNPREV){ + + case MCHT_TITLEBTNPREV: MONTHCAL_GoToPrevMonth(infoPtr); infoPtr->status = MC_PREVPRESSED; SetTimer(infoPtr->hwndSelf, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; - } - if(hit == MCHT_TITLEMONTH) { - hMenu = CreatePopupMenu(); + case MCHT_TITLEMONTH: + { + HMENU hMenu = CreatePopupMenu(); + WCHAR buf[32]; + POINT menupoint; + INT i; - for (i=0; i<12;i++) - { - GetLocaleInfoW(LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, buf,countof(buf)); - AppendMenuW(hMenu, MF_STRING|MF_ENABLED,i+1, buf); - } - menupoint.x=infoPtr->titlemonth.right; - menupoint.y=infoPtr->titlemonth.bottom; + for (i = 0; i < 12; i++) + { + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, countof(buf)); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf); + } + menupoint.x = infoPtr->titlemonth.right; + menupoint.y = infoPtr->titlemonth.bottom; ClientToScreen(infoPtr->hwndSelf, &menupoint); - i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, - menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL); - if ((i>0) && (i<13)) - { - infoPtr->currentMonth=i; + i = TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, + menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL); + + if ((i > 0) && (i < 13)) + { + infoPtr->currentMonth = i; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } } - if(hit == MCHT_TITLEYEAR) { - infoPtr->hWndYearEdit=CreateWindowExW(0, - EditW, - 0, - WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, - infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, - infoPtr->titleyear.right-infoPtr->titleyear.left+4, - infoPtr->textHeight, - infoPtr->hwndSelf, - NULL, - NULL, - NULL); - SendMessageW( infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM) infoPtr->hBoldFont, (LPARAM)TRUE); - infoPtr->hWndYearUpDown=CreateWindowExW(0, - UPDOWN_CLASSW, - 0, - WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, - infoPtr->titleyear.right+7,infoPtr->titlebtnnext.top, - 18, - infoPtr->textHeight, - infoPtr->hwndSelf, - NULL, - NULL, - NULL); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETRANGE, 0, MAKELONG (9999, 1753)); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, 0); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, infoPtr->currentYear); + case MCHT_TITLEYEAR: + { + MONTHCAL_EditYear(infoPtr); return 0; - } - if(hit == MCHT_TODAYLINK) { + case MCHT_TODAYLINK: + { NMSELCHANGE nmsc; infoPtr->curSelDay = infoPtr->todaysDate.wDay; @@ -1443,7 +1445,9 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); return 0; } - if(hit == MCHT_CALENDARDATE) { + case MCHT_CALENDARDATE: + { + RECT rcDay; /* used in determining area to invalidate */ SYSTEMTIME selArray[2]; NMSELCHANGE nmsc; @@ -1460,7 +1464,6 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); - /* redraw both old and new days if the selected day changed */ if(infoPtr->curSelDay != ht.st.wDay) { MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay); @@ -1475,6 +1478,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) infoPtr->status = MC_SEL_LBUTDOWN; return 0; } + } return 1; }
1
0
0
0
Nikolay Sivov : comctl32/monthcal: Fix some bugs with date range.
by Alexandre Julliard
28 Sep '09
28 Sep '09
Module: wine Branch: master Commit: a44f03518e9daa04eabcbf4f965204d6171aae4f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a44f03518e9daa04eabcbf4f9…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Sat Sep 26 03:09:06 2009 +0400 comctl32/monthcal: Fix some bugs with date range. --- dlls/comctl32/monthcal.c | 18 ++++------ dlls/comctl32/tests/monthcal.c | 77 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 0d4c96b..77e58b7 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -36,9 +36,6 @@ * -- handle resources better (doesn't work now); * -- take care of internationalization. * -- keyboard handling. - * -- GetRange: At the moment, we copy ranges anyway, regardless of - * infoPtr->rangeValid; an invalid range is simply filled - * with zeros in SetRange. Is this the right behavior? * -- search for FIXME */ @@ -931,11 +928,11 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range) /* Only one limit set - we are done */ if ((infoPtr->rangeValid & (GDTR_MIN | GDTR_MAX)) != (GDTR_MIN | GDTR_MAX)) return TRUE; - + SystemTimeToFileTime(&infoPtr->maxDate, &ft_max); SystemTimeToFileTime(&infoPtr->minDate, &ft_min); - if (CompareFileTime(&ft_min, &ft_max) > 0) + if (CompareFileTime(&ft_min, &ft_max) >= 0) { if ((limits & (GDTR_MIN | GDTR_MAX)) == (GDTR_MIN | GDTR_MAX)) { @@ -946,8 +943,11 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range) } else { - /* Reset the other limit. */ - /* FIXME: native sets date&time to 0. Should we do this too? */ + static const SYSTEMTIME zero; + + /* reset the other limit */ + if (limits & GDTR_MIN) infoPtr->maxDate = zero; + if (limits & GDTR_MAX) infoPtr->minDate = zero; infoPtr->rangeValid &= limits & GDTR_MIN ? ~GDTR_MAX : ~GDTR_MIN ; } } @@ -1873,10 +1873,6 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) MONTHCAL_SetFirstDayOfWeek(infoPtr, -1); infoPtr->currentMonth = infoPtr->todaysDate.wMonth; infoPtr->currentYear = infoPtr->todaysDate.wYear; - infoPtr->minDate = infoPtr->todaysDate; - infoPtr->maxDate = infoPtr->todaysDate; - infoPtr->maxDate.wYear = 2050; - infoPtr->minDate.wYear = 1950; infoPtr->maxSelCount = 7; infoPtr->monthRange = 3; infoPtr->monthdayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 8cd3494..e5282ff 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -328,6 +328,29 @@ static void test_monthcal(void) hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, 0, 300, 300, 0, 0, NULL, NULL); ok(hwnd != NULL, "Failed to create MonthCal\n"); + + /* test range just after creation */ + memset(&st, 0xcc, sizeof(st)); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st) == 0, "No limits should be set\n"); + + expect(0, st[0].wYear); + expect(0, st[0].wMonth); + expect(0, st[0].wDay); + expect(0, st[0].wDayOfWeek); + expect(0, st[0].wHour); + expect(0, st[0].wMinute); + expect(0, st[0].wSecond); + expect(0, st[0].wMilliseconds); + + expect(0, st[1].wYear); + expect(0, st[1].wMonth); + expect(0, st[1].wDay); + expect(0, st[1].wDayOfWeek); + expect(0, st[1].wHour); + expect(0, st[1].wMinute); + expect(0, st[1].wSecond); + expect(0, st[1].wMilliseconds); + GetSystemTime(&st[0]); st[1] = st[0]; @@ -380,6 +403,60 @@ static void test_monthcal(void) ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n"); ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Only MAX limit should be set\n"); + /* set both limits, then set max < min */ + GetSystemTime(&st[0]); + st[1] = st[0]; + st[1].wYear++; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX), "Min limit expected\n"); + st[1].wYear -= 2; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Max limit expected\n"); + + expect(0, st1[0].wYear); + expect(0, st1[0].wMonth); + expect(0, st1[0].wDay); + expect(0, st1[0].wDayOfWeek); + expect(0, st1[0].wHour); + expect(0, st1[0].wMinute); + expect(0, st1[0].wSecond); + expect(0, st1[0].wMilliseconds); + + expect(st[1].wYear, st1[1].wYear); + expect(st[1].wMonth, st1[1].wMonth); + expect(st[1].wDay, st1[1].wDay); + expect(st[1].wDayOfWeek, st1[1].wDayOfWeek); + expect(st[1].wHour, st1[1].wHour); + expect(st[1].wMinute, st1[1].wMinute); + expect(st[1].wSecond, st1[1].wSecond); + expect(st[1].wMilliseconds, st1[1].wMilliseconds); + + st[1] = st[0]; + st[1].wYear++; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX), "Min limit expected\n"); + st[0].wYear++; /* start == end now */ + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MIN, "Min limit expected\n"); + + expect(st[0].wYear, st1[0].wYear); + expect(st[0].wMonth, st1[0].wMonth); + expect(st[0].wDay, st1[0].wDay); + expect(st[0].wDayOfWeek, st1[0].wDayOfWeek); + expect(st[0].wHour, st1[0].wHour); + expect(st[0].wMinute, st1[0].wMinute); + expect(st[0].wSecond, st1[0].wSecond); + expect(st[0].wMilliseconds, st1[0].wMilliseconds); + + expect(0, st1[1].wYear); + expect(0, st1[1].wMonth); + expect(0, st1[1].wDay); + expect(0, st1[1].wDayOfWeek); + expect(0, st1[1].wHour); + expect(0, st1[1].wMinute); + expect(0, st1[1].wSecond); + expect(0, st1[1].wMilliseconds); + DestroyWindow(hwnd); }
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
87
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Results per page:
10
25
50
100
200