comctl32/monthcal: Copy SYSTEMTIME with a simple assignment.
This commit is contained in:
parent
a126f0caf2
commit
b0d3db5b29
|
@ -232,18 +232,6 @@ extern void UPDOWN_Unregister(void);
|
||||||
|
|
||||||
int MONTHCAL_MonthLength(int month, int year);
|
int MONTHCAL_MonthLength(int month, int year);
|
||||||
|
|
||||||
static inline void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
|
|
||||||
{
|
|
||||||
to->wYear = from->wYear;
|
|
||||||
to->wMonth = from->wMonth;
|
|
||||||
to->wDayOfWeek = from->wDayOfWeek;
|
|
||||||
to->wDay = from->wDay;
|
|
||||||
to->wHour = from->wHour;
|
|
||||||
to->wMinute = from->wMinute;
|
|
||||||
to->wSecond = from->wSecond;
|
|
||||||
to->wMilliseconds = from->wMilliseconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void THEMING_Initialize(void);
|
extern void THEMING_Initialize(void);
|
||||||
extern void THEMING_Uninitialize(void);
|
extern void THEMING_Uninitialize(void);
|
||||||
extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM);
|
extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
|
@ -138,43 +138,43 @@ static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1};
|
||||||
|
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray)
|
DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *systime)
|
||||||
{
|
{
|
||||||
if (!lprgSysTimeArray) return GDT_NONE;
|
if (!systime) return GDT_NONE;
|
||||||
|
|
||||||
if ((infoPtr->dwStyle & DTS_SHOWNONE) &&
|
if ((infoPtr->dwStyle & DTS_SHOWNONE) &&
|
||||||
(SendMessageW (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED))
|
(SendMessageW (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED))
|
||||||
return GDT_NONE;
|
return GDT_NONE;
|
||||||
|
|
||||||
MONTHCAL_CopyTime (&infoPtr->date, lprgSysTimeArray);
|
*systime = infoPtr->date;
|
||||||
|
|
||||||
return GDT_VALID;
|
return GDT_VALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *lprgSysTimeArray)
|
DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime)
|
||||||
{
|
{
|
||||||
if (!lprgSysTimeArray) return 0;
|
if (!systime) return 0;
|
||||||
|
|
||||||
TRACE("%04d/%02d/%02d %02d:%02d:%02d\n",
|
TRACE("%04d/%02d/%02d %02d:%02d:%02d\n",
|
||||||
lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
|
systime->wYear, systime->wMonth, systime->wDay,
|
||||||
lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
|
systime->wHour, systime->wMinute, systime->wSecond);
|
||||||
|
|
||||||
if (flag == GDT_VALID) {
|
if (flag == GDT_VALID) {
|
||||||
if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
|
if (systime->wYear < 1601 || systime->wYear > 30827 ||
|
||||||
lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
|
systime->wMonth < 1 || systime->wMonth > 12 ||
|
||||||
lprgSysTimeArray->wDayOfWeek > 6 ||
|
systime->wDayOfWeek > 6 ||
|
||||||
lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
|
systime->wDay < 1 || systime->wDay > 31 ||
|
||||||
lprgSysTimeArray->wHour > 23 ||
|
systime->wHour > 23 ||
|
||||||
lprgSysTimeArray->wMinute > 59 ||
|
systime->wMinute > 59 ||
|
||||||
lprgSysTimeArray->wSecond > 59 ||
|
systime->wSecond > 59 ||
|
||||||
lprgSysTimeArray->wMilliseconds > 999
|
systime->wMilliseconds > 999
|
||||||
)
|
)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
infoPtr->dateValid = TRUE;
|
infoPtr->dateValid = TRUE;
|
||||||
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
|
infoPtr->date = *systime;
|
||||||
SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
|
SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
|
||||||
SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
|
SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
} else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) {
|
} else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) {
|
||||||
|
@ -1128,7 +1128,7 @@ DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr)
|
||||||
|
|
||||||
dtdtc.dwFlags = (infoPtr->dwStyle & DTS_SHOWNONE) ? GDT_NONE : GDT_VALID;
|
dtdtc.dwFlags = (infoPtr->dwStyle & DTS_SHOWNONE) ? GDT_NONE : GDT_VALID;
|
||||||
|
|
||||||
MONTHCAL_CopyTime (&infoPtr->date, &dtdtc.st);
|
dtdtc.st = infoPtr->date;
|
||||||
return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
|
return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
|
||||||
dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc);
|
dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,7 +639,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT
|
||||||
strcpyW(buf1, todayW);
|
strcpyW(buf1, todayW);
|
||||||
}
|
}
|
||||||
MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6);
|
MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6);
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate,&localtime);
|
localtime = infoPtr->todaysDate;
|
||||||
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2));
|
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2));
|
||||||
wsprintfW(buf, fmt2W, buf1, buf2);
|
wsprintfW(buf, fmt2W, buf1, buf2);
|
||||||
SelectObject(hdc, infoPtr->hBoldFont);
|
SelectObject(hdc, infoPtr->hBoldFont);
|
||||||
|
@ -919,12 +919,12 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range)
|
||||||
|
|
||||||
if (limits & GDTR_MIN)
|
if (limits & GDTR_MIN)
|
||||||
{
|
{
|
||||||
MONTHCAL_CopyTime(&range[0], &infoPtr->minDate);
|
infoPtr->minDate = range[0];
|
||||||
infoPtr->rangeValid |= GDTR_MIN;
|
infoPtr->rangeValid |= GDTR_MIN;
|
||||||
}
|
}
|
||||||
if (limits & GDTR_MAX)
|
if (limits & GDTR_MAX)
|
||||||
{
|
{
|
||||||
MONTHCAL_CopyTime(&range[1], &infoPtr->maxDate);
|
infoPtr->maxDate = range[1];
|
||||||
infoPtr->rangeValid |= GDTR_MAX;
|
infoPtr->rangeValid |= GDTR_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,8 +963,8 @@ MONTHCAL_GetRange(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
|
||||||
|
|
||||||
if(!range) return FALSE;
|
if(!range) return FALSE;
|
||||||
|
|
||||||
MONTHCAL_CopyTime(&infoPtr->maxDate, &range[1]);
|
range[1] = infoPtr->maxDate;
|
||||||
MONTHCAL_CopyTime(&infoPtr->minDate, &range[0]);
|
range[0] = infoPtr->minDate;
|
||||||
|
|
||||||
return infoPtr->rangeValid;
|
return infoPtr->rangeValid;
|
||||||
}
|
}
|
||||||
|
@ -991,7 +991,7 @@ MONTHCAL_GetCurSel(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
|
||||||
if(!curSel) return FALSE;
|
if(!curSel) return FALSE;
|
||||||
if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE;
|
if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE;
|
||||||
|
|
||||||
MONTHCAL_CopyTime(&infoPtr->minSel, curSel);
|
*curSel = infoPtr->minSel;
|
||||||
TRACE("%d/%d/%d\n", curSel->wYear, curSel->wMonth, curSel->wDay);
|
TRACE("%d/%d/%d\n", curSel->wYear, curSel->wMonth, curSel->wDay);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1007,8 +1007,8 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
|
||||||
|
|
||||||
if(!MONTHCAL_ValidateTime(*curSel)) return FALSE;
|
if(!MONTHCAL_ValidateTime(*curSel)) return FALSE;
|
||||||
|
|
||||||
MONTHCAL_CopyTime(curSel, &infoPtr->minSel);
|
infoPtr->minSel = *curSel;
|
||||||
MONTHCAL_CopyTime(curSel, &infoPtr->maxSel);
|
infoPtr->maxSel = *curSel;
|
||||||
|
|
||||||
/* exit earlier if selection equals current */
|
/* exit earlier if selection equals current */
|
||||||
if (infoPtr->currentMonth == curSel->wMonth &&
|
if (infoPtr->currentMonth == curSel->wMonth &&
|
||||||
|
@ -1053,8 +1053,8 @@ MONTHCAL_GetSelRange(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
|
||||||
|
|
||||||
if(infoPtr->dwStyle & MCS_MULTISELECT)
|
if(infoPtr->dwStyle & MCS_MULTISELECT)
|
||||||
{
|
{
|
||||||
MONTHCAL_CopyTime(&infoPtr->maxSel, &range[1]);
|
range[1] = infoPtr->maxSel;
|
||||||
MONTHCAL_CopyTime(&infoPtr->minSel, &range[0]);
|
range[0] = infoPtr->minSel;
|
||||||
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
|
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1072,8 +1072,8 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
|
||||||
|
|
||||||
if(infoPtr->dwStyle & MCS_MULTISELECT)
|
if(infoPtr->dwStyle & MCS_MULTISELECT)
|
||||||
{
|
{
|
||||||
MONTHCAL_CopyTime(&range[1], &infoPtr->maxSel);
|
infoPtr->maxSel = range[1];
|
||||||
MONTHCAL_CopyTime(&range[0], &infoPtr->minSel);
|
infoPtr->minSel = range[0];
|
||||||
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
|
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1088,7 @@ MONTHCAL_GetToday(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *today)
|
||||||
TRACE("%p\n", today);
|
TRACE("%p\n", today);
|
||||||
|
|
||||||
if(!today) return FALSE;
|
if(!today) return FALSE;
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate, today);
|
*today = infoPtr->todaysDate;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,7 +1102,7 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, SYSTEMTIME *today)
|
||||||
|
|
||||||
if(MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate)) return TRUE;
|
if(MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate)) return TRUE;
|
||||||
|
|
||||||
MONTHCAL_CopyTime(today, &infoPtr->todaysDate);
|
infoPtr->todaysDate = *today;
|
||||||
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1424,19 +1424,19 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
|
||||||
if(hit == MCHT_TODAYLINK) {
|
if(hit == MCHT_TODAYLINK) {
|
||||||
NMSELCHANGE nmsc;
|
NMSELCHANGE nmsc;
|
||||||
|
|
||||||
infoPtr->curSelDay = infoPtr->todaysDate.wDay;
|
infoPtr->curSelDay = infoPtr->todaysDate.wDay;
|
||||||
infoPtr->firstSelDay = infoPtr->todaysDate.wDay;
|
infoPtr->firstSelDay = infoPtr->todaysDate.wDay;
|
||||||
infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
|
infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
|
||||||
infoPtr->currentYear=infoPtr->todaysDate.wYear;
|
infoPtr->currentYear = infoPtr->todaysDate.wYear;
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minSel);
|
infoPtr->minSel = infoPtr->todaysDate;
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxSel);
|
infoPtr->maxSel = infoPtr->todaysDate;
|
||||||
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
||||||
|
|
||||||
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
||||||
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
||||||
nmsc.nmhdr.code = MCN_SELCHANGE;
|
nmsc.nmhdr.code = MCN_SELCHANGE;
|
||||||
MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart);
|
nmsc.stSelStart = infoPtr->minSel;
|
||||||
MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd);
|
nmsc.stSelEnd = infoPtr->maxSel;
|
||||||
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
||||||
|
|
||||||
nmsc.nmhdr.code = MCN_SELECT;
|
nmsc.nmhdr.code = MCN_SELECT;
|
||||||
|
@ -1447,16 +1447,16 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
|
||||||
SYSTEMTIME selArray[2];
|
SYSTEMTIME selArray[2];
|
||||||
NMSELCHANGE nmsc;
|
NMSELCHANGE nmsc;
|
||||||
|
|
||||||
MONTHCAL_CopyTime(&ht.st, &selArray[0]);
|
selArray[0] = ht.st;
|
||||||
MONTHCAL_CopyTime(&ht.st, &selArray[1]);
|
selArray[1] = ht.st;
|
||||||
MONTHCAL_SetSelRange(infoPtr, selArray);
|
MONTHCAL_SetSelRange(infoPtr, selArray);
|
||||||
MONTHCAL_SetCurSel(infoPtr, &selArray[0]);
|
MONTHCAL_SetCurSel(infoPtr, &selArray[0]);
|
||||||
TRACE("MCHT_CALENDARDATE\n");
|
TRACE("MCHT_CALENDARDATE\n");
|
||||||
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
||||||
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
||||||
nmsc.nmhdr.code = MCN_SELCHANGE;
|
nmsc.nmhdr.code = MCN_SELCHANGE;
|
||||||
MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart);
|
nmsc.stSelStart = infoPtr->minSel;
|
||||||
MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd);
|
nmsc.stSelEnd = infoPtr->maxSel;
|
||||||
|
|
||||||
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
||||||
|
|
||||||
|
@ -1532,8 +1532,8 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
|
||||||
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf;
|
||||||
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
|
||||||
nmsc.nmhdr.code = MCN_SELECT;
|
nmsc.nmhdr.code = MCN_SELECT;
|
||||||
MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart);
|
nmsc.stSelStart = infoPtr->minSel;
|
||||||
MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd);
|
nmsc.stSelEnd = infoPtr->maxSel;
|
||||||
|
|
||||||
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
|
||||||
|
|
||||||
|
@ -1873,8 +1873,8 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
|
||||||
MONTHCAL_SetFirstDayOfWeek(infoPtr, -1);
|
MONTHCAL_SetFirstDayOfWeek(infoPtr, -1);
|
||||||
infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
|
infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
|
||||||
infoPtr->currentYear = infoPtr->todaysDate.wYear;
|
infoPtr->currentYear = infoPtr->todaysDate.wYear;
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minDate);
|
infoPtr->minDate = infoPtr->todaysDate;
|
||||||
MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate);
|
infoPtr->maxDate = infoPtr->todaysDate;
|
||||||
infoPtr->maxDate.wYear=2050;
|
infoPtr->maxDate.wYear=2050;
|
||||||
infoPtr->minDate.wYear=1950;
|
infoPtr->minDate.wYear=1950;
|
||||||
infoPtr->maxSelCount = 7;
|
infoPtr->maxSelCount = 7;
|
||||||
|
|
Loading…
Reference in New Issue