Changeset 5416 for trunk/src/comctl32/monthcal.c
- Timestamp:
- Mar 31, 2001, 3:25:59 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/monthcal.c
r4627 r5416 5 5 * Copyright 1999 Alex Priem (alexp@sci.kun.nl) 6 6 * Copyright 1999 Chris Morgan <cmorgan@wpi.edu> and 7 * 7 * James Abbatiello <abbeyj@wpi.edu> 8 8 * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 9 9 * … … 13 13 * 14 14 * FIXME: handle resources better (doesn't work now); also take care 15 of internationalization. 15 of internationalization. 16 16 * FIXME: keyboard handling. 17 17 */ … … 26 26 #include <stdio.h> 27 27 #include <stdlib.h> 28 #include <string.h> 28 29 29 30 #include "winbase.h" … … 31 32 #include "wingdi.h" 32 33 #include "winuser.h" 33 #include "win.h"34 34 #include "winnls.h" 35 35 #include "commctrl.h" … … 37 37 #include "debugtools.h" 38 38 39 #ifdef __WIN32OS2__ 40 #include "ccbase.h" 41 #endif 42 39 43 DEFAULT_DEBUG_CHANNEL(monthcal); 40 44 41 #define MC_SEL_LBUTUP 1/* Left button released */42 #define MC_SEL_LBUTDOWN 2/* Left button pressed in calendar */45 #define MC_SEL_LBUTUP 1 /* Left button released */ 46 #define MC_SEL_LBUTDOWN 2 /* Left button pressed in calendar */ 43 47 #define MC_PREVPRESSED 4 /* Prev month button pressed */ 44 48 #define MC_NEXTPRESSED 8 /* Next month button pressed */ 45 #define MC_NEXTMONTHDELAY 350 46 47 48 #define MC_NEXTMONTHTIMER 1 49 #define MC_PREVMONTHTIMER 2 49 #define MC_NEXTMONTHDELAY 350 /* when continuously pressing `next */ 50 /* month', wait 500 ms before going */ 51 /* to the next month */ 52 #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ 53 #define MC_PREVMONTHTIMER 2 50 54 51 55 typedef struct 52 56 { 53 COLORREF bk; 54 COLORREF txt; 55 COLORREF titlebk; 56 COLORREF titletxt; 57 COLORREF monthbk; 58 COLORREF trailingtxt; 59 HFONT hFont; 60 HFONT hBoldFont; 61 int textHeight; 62 int textWidth; 63 int height_increment; 64 int width_increment; 65 int left_offset; 66 int top_offset; 67 int firstDayplace; /* place of the first day of the current month */ 68 int delta; /* scroll rate; # of months that the */ 57 #ifdef __WIN32OS2__ 58 COMCTL32_HEADER header; 59 #endif 60 COLORREF bk; 61 COLORREF txt; 62 COLORREF titlebk; 63 COLORREF titletxt; 64 COLORREF monthbk; 65 COLORREF trailingtxt; 66 HFONT hFont; 67 HFONT hBoldFont; 68 int textHeight; 69 int textWidth; 70 int height_increment; 71 int width_increment; 72 int left_offset; 73 int top_offset; 74 int firstDayplace; /* place of the first day of the current month */ 75 int delta; /* scroll rate; # of months that the */ 69 76 /* control moves when user clicks a scroll button */ 70 int visible;/* # of months visible */71 int firstDay;/* Start month calendar with firstDay's day */72 int 77 int visible; /* # of months visible */ 78 int firstDay; /* Start month calendar with firstDay's day */ 79 int monthRange; 73 80 MONTHDAYSTATE *monthdayState; 74 SYSTEMTIME 75 DWORD 76 DWORD 77 int status;/* See MC_SEL flags */78 int curSelDay;/* current selected day */79 int firstSelDay;/* first selected day */80 int 81 SYSTEMTIME 82 SYSTEMTIME 83 DWORD 84 SYSTEMTIME 85 SYSTEMTIME 86 87 RECT rcClient; 88 RECT rcDraw; 89 RECT title; 90 RECT titlebtnnext; 91 RECT titlebtnprev; /* the `prev month' button in the header */ 92 RECT titlemonth; 93 RECT titleyear; 94 RECT wdays; 95 RECT days; 96 RECT weeknums; 97 RECT todayrect; 81 SYSTEMTIME todaysDate; 82 DWORD currentMonth; 83 DWORD currentYear; 84 int status; /* See MC_SEL flags */ 85 int curSelDay; /* current selected day */ 86 int firstSelDay; /* first selected day */ 87 int maxSelCount; 88 SYSTEMTIME minSel; 89 SYSTEMTIME maxSel; 90 DWORD rangeValid; 91 SYSTEMTIME minDate; 92 SYSTEMTIME maxDate; 93 94 RECT rcClient; /* rect for whole client area */ 95 RECT rcDraw; /* rect for drawable portion of client area */ 96 RECT title; /* rect for the header above the calendar */ 97 RECT titlebtnnext; /* the `next month' button in the header */ 98 RECT titlebtnprev; /* the `prev month' button in the header */ 99 RECT titlemonth; /* the `month name' txt in the header */ 100 RECT titleyear; /* the `year number' txt in the header */ 101 RECT wdays; /* week days at top */ 102 RECT days; /* calendar area */ 103 RECT weeknums; /* week numbers at left side */ 104 RECT todayrect; /* `today: xx/xx/xx' text rect */ 98 105 HWND hWndYearEdit; /* Window Handle of edit box to handle years */ 99 106 HWND hWndYearUpDown;/* Window Handle of updown box to handle years */ … … 134 141 135 142 /* make sure that time is valid */ 136 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 143 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 137 144 { 138 145 if(time.wMonth > 12) return FALSE; 139 146 if(time.wDayOfWeek > 6) return FALSE; 140 147 if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear)) 141 148 return FALSE; 142 149 if(time.wHour > 23) return FALSE; 143 150 if(time.wMinute > 59) return FALSE; … … 149 156 150 157 151 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 158 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 152 159 { 153 160 to->wYear = from->wYear; … … 162 169 163 170 164 /* Note:Depending on DST, this may be offset by a day. 171 /* Note:Depending on DST, this may be offset by a day. 165 172 Need to find out if we're on a DST place & adjust the clock accordingly. 166 173 Above function assumes we have a valid data. … … 175 182 year-=(month < 3); 176 183 177 return((year + year/4 - year/100 + year/400 + 184 return((year + year/4 - year/100 + year/400 + 178 185 DayOfWeekTable[month-1] + day - 1 ) % 7); 179 186 } … … 182 189 and day in the calendar. day== 0 mean the last day of tha last month 183 190 */ 184 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 185 int *daypos,int *weekpos) 191 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 192 int *daypos,int *weekpos) 186 193 { 187 194 int retval, firstDay; … … 195 202 *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; 196 203 *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; 197 204 198 205 firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; 199 206 retval = *daypos + (7 * *weekpos) - firstDay; … … 204 211 /* sets x and y to be the position of the day */ 205 212 /* x == day, y == week where(0,0) == firstDay, 1st week */ 206 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 213 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 207 214 int *x, int *y) 208 215 { … … 220 227 if(prevMonth==0) 221 228 prevMonth = 12; 222 229 223 230 *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; 224 231 *y = 0; … … 233 240 234 241 /* x: column(day), y: row(week) */ 235 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 242 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 236 243 { 237 244 r->left = infoPtr->days.left + x * infoPtr->width_increment; … … 245 252 /* day is the day value of the month(1 == 1st), month is the month */ 246 253 /* value(january == 1, december == 12) */ 247 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 254 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 248 255 int day, int month, RECT *r) 249 256 { … … 271 278 x = day_rect.left; 272 279 y = day_rect.top; 273 280 274 281 points[0].x = x; 275 282 points[0].y = y - 1; … … 280 287 points[3].x = x + infoPtr->width_increment; 281 288 points[3].y = y + 0.5 * infoPtr->height_increment; 282 289 283 290 points[4].x = x + infoPtr->width_increment; 284 291 points[4].y = y + 0.9 * infoPtr->height_increment; … … 287 294 points[6].x = x + 0.5 * infoPtr->width_increment; 288 295 points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just 289 290 296 a hair to fit inside the day rectangle */ 297 291 298 points[7].x = x + 0.2 * infoPtr->width_increment; 292 299 points[7].y = y + 0.8 * infoPtr->height_increment; … … 302 309 points[12].x = x + 0.4 * infoPtr->width_increment; 303 310 points[12].y = y + 0.2 * infoPtr->height_increment; 304 311 305 312 PolyBezier(hdc, points, 13); 306 313 DeleteObject(hRedPen); … … 322 329 sprintf(buf, "%d", day); 323 330 324 /* No need to check styles: when selection is not valid, it is set to zero. 331 /* No need to check styles: when selection is not valid, it is set to zero. 325 332 * 1<day<31, so evertyhing's OK. 326 333 */ … … 342 349 343 350 /* FIXME: this may need to be changed now b/c of the other 344 351 drawing changes 11/3/99 CMM */ 345 352 r2.left = r.left - 0.25 * infoPtr->textWidth; 346 353 r2.top = r.top; … … 383 390 384 391 /* CHECKME: For `todays date', do we need to check the locale?*/ 385 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 392 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 386 393 { 387 394 MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd); … … 418 425 hbr = CreateSolidBrush (infoPtr->bk); 419 426 FillRect(hdc, rcClient, hbr); 420 DeleteObject(hbr); 427 DeleteObject(hbr); 421 428 422 429 /* draw header */ … … 427 434 DeleteObject(hbr); 428 435 } 429 436 430 437 /* if the previous button is pressed draw it depressed */ 431 438 if(IntersectRect(&rcTemp, &(ps->rcPaint), prev)) 432 { 439 { 433 440 if((infoPtr->status & MC_PREVPRESSED)) 434 441 DrawFrameControl(hdc, prev, DFC_SCROLL, 435 442 DFCS_SCROLLLEFT | DFCS_PUSHED | 436 443 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 437 444 else /* if the previous button is pressed draw it depressed */ 438 445 DrawFrameControl(hdc, prev, DFC_SCROLL, 439 440 } 441 442 /* if next button is depressed draw it depressed */ 446 DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 447 } 448 449 /* if next button is depressed draw it depressed */ 443 450 if(IntersectRect(&rcTemp, &(ps->rcPaint), next)) 444 451 { 445 452 if((infoPtr->status & MC_NEXTPRESSED)) 446 453 DrawFrameControl(hdc, next, DFC_SCROLL, 447 454 DFCS_SCROLLRIGHT | DFCS_PUSHED | 448 455 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 449 456 else /* if the next button is pressed draw it depressed */ … … 459 466 titlemonth->left = title->left; 460 467 titlemonth->right = title->right; 461 468 462 469 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, 463 470 buf1,sizeof(buf1)); 464 471 sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); 465 472 466 473 if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) 467 474 { 468 DrawTextA(hdc, buf, strlen(buf), titlemonth, 475 DrawTextA(hdc, buf, strlen(buf), titlemonth, 469 476 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 470 477 } … … 474 481 /* titlemonth left/right contained rect for whole titletxt('June 1999') 475 482 * MCM_HitTestInfo wants month & year rects, so prepare these now. 476 *(no, we can't draw them separately; the whole text is centered) 483 *(no, we can't draw them separately; the whole text is centered) 477 484 */ 478 485 GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); … … 482 489 titlemonth->right = titlemonth->left + size.cx; 483 490 titleyear->left = titlemonth->right; 484 491 485 492 /* draw month area */ 486 493 rcTemp.top=infoPtr->wdays.top; … … 494 501 DeleteObject(hbr); 495 502 } 496 503 497 504 /* draw line under day abbreviatons */ 498 505 499 506 MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); 500 507 501 508 LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1); 502 509 503 510 prevMonth = infoPtr->currentMonth - 1; 504 511 if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ … … 522 529 for(j=0; j<7; j++) { 523 530 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7, 524 531 buf,sizeof(buf)); 525 532 DrawTextA(hdc, buf, strlen(buf), days, 526 533 DT_CENTER | DT_VCENTER | DT_SINGLELINE ); … … 530 537 531 538 /* draw day numbers; first, the previous month */ 532 539 533 540 firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); 534 535 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 541 542 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 536 543 (infoPtr->firstDay + 7 - firstDay)%7 + 1; 537 544 if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) … … 546 553 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 547 554 { 548 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 555 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 549 556 infoPtr->monthdayState[m] & mask); 550 557 } … … 570 577 { 571 578 572 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 573 579 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 580 infoPtr->monthdayState[m] & mask); 574 581 575 582 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 576 583 (day==infoPtr->todaysDate.wDay) && 577 584 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) { 578 585 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 579 586 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 580 587 } 581 588 } … … 588 595 j = 1; /* move to the 2nd week of the current month */ 589 596 i = 0; /* move back to sunday */ 590 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 597 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 591 598 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 592 599 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) … … 597 604 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 598 605 (day==infoPtr->todaysDate.wDay) && 599 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 600 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 601 606 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 607 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 608 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 602 609 } 603 610 mask<<=1; … … 620 627 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 621 628 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 622 { 629 { 623 630 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j, 624 631 infoPtr->monthdayState[m] & mask); 625 632 } 626 633 627 634 mask<<=1; 628 635 day++; 629 i++; 636 i++; 630 637 if(i==7) { /* past saturday, go to next week's sunday */ 631 638 i = 0; … … 643 650 if(!(dwStyle & MCS_NOTODAYCIRCLE)) { 644 651 /*day is the number of days from nextmonth we put on the calendar */ 645 MONTHCAL_CircleDay(hdc, infoPtr, 646 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 647 652 MONTHCAL_CircleDay(hdc, infoPtr, 653 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 654 infoPtr->currentMonth); 648 655 offset+=textWidth; 649 656 } 650 657 if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1))) 651 658 { 652 653 659 WARN("Can't load resource\n"); 660 strcpy(buf1,"Today:"); 654 661 } 655 662 MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); … … 667 674 } 668 675 669 /*eventually draw week numbers*/ 676 /*eventually draw week numbers*/ 670 677 if(dwStyle & MCS_WEEKNUMBERS) { 671 678 /* display weeknumbers*/ … … 675 682 LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?): 676 683 The week containing Jan 1 is the first week of year 677 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 684 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 678 685 First week of year must contain 4 days of the new year 679 686 LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) … … 681 688 */ 682 689 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, 683 690 buf, sizeof(buf)); 684 691 sscanf(buf, "%d", &weeknum); 685 692 switch (weeknum) 686 693 { 687 694 case 1: mindays = 6; 688 695 break; 689 696 case 2: mindays = 3; 690 697 break; 691 698 case 0: 692 699 default: 693 700 mindays = 0; 694 701 } 695 702 if (infoPtr->currentMonth < 2) 696 703 { 697 698 699 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 700 701 702 703 704 for(i=0; i<11; i++) 705 706 707 708 709 710 711 704 /* calculate all those exceptions for january */ 705 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 706 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 707 weeknum =1; 708 else 709 { 710 weeknum = 0; 711 for(i=0; i<11; i++) 712 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); 713 weeknum +=startofprescal+ 7; 714 weeknum /=7; 715 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1); 716 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 717 weeknum++; 718 } 712 719 } 713 720 else 714 721 { 715 716 for(i=0; i<prevMonth-1; i++) 717 718 719 720 721 722 722 weeknum = 0; 723 for(i=0; i<prevMonth-1; i++) 724 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear); 725 weeknum +=startofprescal+ 7; 726 weeknum /=7; 727 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 728 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 729 weeknum++; 723 730 } 724 731 days->left = infoPtr->weeknums.left; … … 728 735 for(i=0; i<6; i++) { 729 736 if((i==0)&&(weeknum>50)) 730 731 732 733 737 { 738 sprintf(buf, "%d", weeknum); 739 weeknum=0; 740 } 734 741 else if((i==5)&&(weeknum>47)) 735 736 737 742 { 743 sprintf(buf, "%d", 1); 744 } 738 745 else 739 746 sprintf(buf, "%d", weeknum + i); 740 747 DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); 741 748 days->top+=infoPtr->height_increment; 742 749 days->bottom+=infoPtr->height_increment; 743 750 } 744 751 745 752 MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL); 746 753 LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom ); 747 754 748 755 } 749 756 /* currentFont was font at entering Refresh */ 750 757 751 758 SetBkColor(hdc, oldBkColor); 752 SelectObject(hdc, currentFont); 759 SelectObject(hdc, currentFont); 753 760 SetTextColor(hdc, oldTextColor); 754 761 } 755 762 756 763 757 static LRESULT 764 static LRESULT 758 765 MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 759 766 { … … 761 768 LPRECT lpRect = (LPRECT) lParam; 762 769 TRACE("%x %lx\n", wParam, lParam); 763 770 764 771 /* validate parameters */ 765 772 … … 774 781 775 782 776 static LRESULT 783 static LRESULT 777 784 MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 778 785 { … … 800 807 801 808 802 static LRESULT 809 static LRESULT 803 810 MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 804 811 { … … 840 847 841 848 842 static LRESULT 849 static LRESULT 843 850 MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 844 851 { … … 846 853 847 854 TRACE("%x %lx\n", wParam, lParam); 848 855 849 856 if(infoPtr->delta) 850 857 return infoPtr->delta; … … 854 861 855 862 856 static LRESULT 863 static LRESULT 857 864 MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 858 865 { … … 861 868 862 869 TRACE("%x %lx\n", wParam, lParam); 863 870 864 871 infoPtr->delta = (int)wParam; 865 872 return prev; … … 867 874 868 875 869 static LRESULT 876 static LRESULT 870 877 MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 871 878 { 872 879 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); 873 880 874 881 return infoPtr->firstDay; 875 882 } … … 880 887 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ 881 888 /* FIXME: we need more error checking here */ 882 static LRESULT 889 static LRESULT 883 890 MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 884 891 { … … 896 903 { 897 904 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, 898 905 buf, sizeof(buf)); 899 906 TRACE("%s %d\n", buf, strlen(buf)); 900 907 if(sscanf(buf, "%d", &day) == 1) 901 908 infoPtr->firstDay = day; 902 909 else 903 910 infoPtr->firstDay = 0; 904 911 } 905 912 return prev; … … 909 916 /* FIXME: fill this in */ 910 917 static LRESULT 911 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 918 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 912 919 { 913 920 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); … … 930 937 931 938 /* FIXME: are validated times taken from current date/time or simply 932 * copied? 939 * copied? 933 940 * FIXME: check whether MCM_GETMONTHRANGE shows correct result after 934 941 * adjusting range with MCM_SETRANGE … … 943 950 944 951 TRACE("%x %lx\n", wParam, lParam); 945 952 946 953 if(wParam & GDTR_MAX) { 947 954 if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){ … … 966 973 infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth; 967 974 968 if(infoPtr->monthRange!=prev) { 969 COMCTL32_ReAlloc(infoPtr->monthdayState, 970 975 if(infoPtr->monthRange!=prev) { 976 COMCTL32_ReAlloc(infoPtr->monthdayState, 977 infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 971 978 } 972 979 … … 976 983 977 984 /* CHECKME: At the moment, we copy ranges anyway,regardless of 978 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 985 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 979 986 * SetRange. Is this the right behavior? 980 987 */ … … 1008 1015 if(iMonths!=infoPtr->monthRange) return 0; 1009 1016 1010 for(i=0; i<iMonths; i++) 1017 for(i=0; i<iMonths; i++) 1011 1018 infoPtr->monthdayState[i] = dayStates[i]; 1012 1019 return 1; 1013 1020 } 1014 1021 1015 static LRESULT 1022 static LRESULT 1016 1023 MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1017 1024 { … … 1029 1036 /* FIXME: if the specified date is not visible, make it visible */ 1030 1037 /* FIXME: redraw? */ 1031 static LRESULT 1038 static LRESULT 1032 1039 MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1033 1040 { … … 1050 1057 1051 1058 1052 static LRESULT 1059 static LRESULT 1053 1060 MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1054 1061 { … … 1060 1067 1061 1068 1062 static LRESULT 1069 static LRESULT 1063 1070 MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1064 1071 { … … 1074 1081 1075 1082 1076 static LRESULT 1083 static LRESULT 1077 1084 MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1078 1085 { … … 1093 1100 return TRUE; 1094 1101 } 1095 1102 1096 1103 return FALSE; 1097 1104 } 1098 1105 1099 1106 1100 static LRESULT 1107 static LRESULT 1101 1108 MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1102 1109 { … … 1117 1124 return TRUE; 1118 1125 } 1119 1126 1120 1127 return FALSE; 1121 1128 } 1122 1129 1123 1130 1124 static LRESULT 1131 static LRESULT 1125 1132 MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1126 1133 { … … 1138 1145 1139 1146 1140 static LRESULT 1147 static LRESULT 1141 1148 MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1142 1149 { … … 1163 1170 DWORD retval; 1164 1171 int day,wday,wnum; 1165 1166 1172 1173 1167 1174 x = lpht->pt.x; 1168 1175 y = lpht->pt.y; 1169 1176 retval = MCHT_NOWHERE; 1170 1171 1172 /* Comment in for debugging... 1173 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1174 1175 1176 1177 1178 1179 1180 1181 1177 1178 1179 /* Comment in for debugging... 1180 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1181 infoPtr->wdays.left, infoPtr->wdays.right, 1182 infoPtr->wdays.top, infoPtr->wdays.bottom, 1183 infoPtr->days.left, infoPtr->days.right, 1184 infoPtr->days.top, infoPtr->days.bottom, 1185 infoPtr->todayrect.left, infoPtr->todayrect.right, 1186 infoPtr->todayrect.top, infoPtr->todayrect.bottom, 1187 infoPtr->weeknums.left, infoPtr->weeknums.right, 1188 infoPtr->weeknums.top, infoPtr->weeknums.bottom); 1182 1189 */ 1183 1190 1184 1191 /* are we in the header? */ 1185 1192 1186 1193 if(PtInRect(&infoPtr->title, lpht->pt)) { 1187 1194 if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) { … … 1201 1208 goto done; 1202 1209 } 1203 1210 1204 1211 retval = MCHT_TITLE; 1205 1212 goto done; 1206 1213 } 1207 1214 1208 1215 day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); 1209 1216 if(PtInRect(&infoPtr->wdays, lpht->pt)) { … … 1211 1218 lpht->st.wYear = infoPtr->currentYear; 1212 1219 lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; 1213 lpht->st.wDay = (day < 1)? 1220 lpht->st.wDay = (day < 1)? 1214 1221 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; 1215 1222 goto done; 1216 1223 } 1217 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1218 retval = MCHT_CALENDARWEEKNUM; 1224 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1225 retval = MCHT_CALENDARWEEKNUM; 1219 1226 lpht->st.wYear = infoPtr->currentYear; 1220 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1221 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1227 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1228 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1222 1229 infoPtr->currentMonth +1 :infoPtr->currentMonth; 1223 lpht->st.wDay = (day < 1 ) ? 1224 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1225 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1230 lpht->st.wDay = (day < 1 ) ? 1231 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1232 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1226 1233 day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day; 1227 goto done; 1228 } 1229 if(PtInRect(&infoPtr->days, lpht->pt)) 1234 goto done; 1235 } 1236 if(PtInRect(&infoPtr->days, lpht->pt)) 1230 1237 { 1231 1238 lpht->st.wYear = infoPtr->currentYear; 1232 if ( day < 1) 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1239 if ( day < 1) 1240 { 1241 retval = MCHT_CALENDARDATEPREV; 1242 lpht->st.wMonth = infoPtr->currentMonth - 1; 1243 if (lpht->st.wMonth <1) 1244 { 1245 lpht->st.wMonth = 12; 1246 lpht->st.wYear--; 1247 } 1248 lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day; 1249 } 1243 1250 else if (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1251 { 1252 retval = MCHT_CALENDARDATENEXT; 1253 lpht->st.wMonth = infoPtr->currentMonth + 1; 1254 if (lpht->st.wMonth <12) 1255 { 1256 lpht->st.wMonth = 1; 1257 lpht->st.wYear++; 1258 } 1259 lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ; 1260 } 1254 1261 else { 1255 1256 1257 1262 retval = MCHT_CALENDARDATE; 1263 lpht->st.wMonth = infoPtr->currentMonth; 1264 lpht->st.wDay = day; 1258 1265 } 1259 1266 goto done; 1260 1267 } 1261 1268 if(PtInRect(&infoPtr->todayrect, lpht->pt)) { 1262 retval = MCHT_TODAYLINK; 1269 retval = MCHT_TODAYLINK; 1263 1270 goto done; 1264 1271 } 1265 1266 1272 1273 1267 1274 /* Hit nothing special? What's left must be background :-) */ 1268 1269 retval = MCHT_CALENDARBK; 1270 done: 1275 1276 retval = MCHT_CALENDARBK; 1277 done: 1271 1278 lpht->uHit = retval; 1272 1279 return retval; … … 1293 1300 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1294 1301 nmds.nmhdr.code = MCN_GETDAYSTATE; 1295 nmds.cDayState 1296 nmds.prgDayState 1302 nmds.cDayState = infoPtr->monthRange; 1303 nmds.prgDayState = COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1297 1304 1298 1305 SendMessageA(GetParent(hwnd), WM_NOTIFY, … … 1323 1330 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1324 1331 nmds.nmhdr.code = MCN_GETDAYSTATE; 1325 nmds.cDayState 1326 nmds.prgDayState = COMCTL32_Alloc1332 nmds.cDayState = infoPtr->monthRange; 1333 nmds.prgDayState = COMCTL32_Alloc 1327 1334 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1328 1335 … … 1341 1348 POINT menupoint; 1342 1349 char buf[32]; 1343 1350 1344 1351 hMenu = CreatePopupMenu(); 1345 1352 if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) … … 1353 1360 ClientToScreen(hwnd, &menupoint); 1354 1361 if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD, 1355 1362 menupoint.x,menupoint.y,0,hwnd,NULL)) 1356 1363 { 1357 1364 infoPtr->currentMonth=infoPtr->todaysDate.wMonth; 1358 1365 infoPtr->currentYear=infoPtr->todaysDate.wYear; 1359 1366 InvalidateRect(hwnd, NULL, FALSE); 1360 } 1367 } 1361 1368 return 0; 1362 1369 } … … 1374 1381 POINT menupoint; 1375 1382 TRACE("%x %lx\n", wParam, lParam); 1376 1383 1377 1384 if (infoPtr->hWndYearUpDown) 1378 1385 { 1379 1386 infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); 1380 1387 if(!DestroyWindow(infoPtr->hWndYearUpDown)) 1381 1382 1383 1388 { 1389 FIXME("Can't destroy Updown Control\n"); 1390 } 1384 1391 else 1385 1392 infoPtr->hWndYearUpDown=0; 1386 1393 if(!DestroyWindow(infoPtr->hWndYearEdit)) 1387 1388 1389 1394 { 1395 FIXME("Can't destroy Updown Control\n"); 1396 } 1390 1397 else 1391 1398 infoPtr->hWndYearEdit=0; 1392 1399 InvalidateRect(hwnd, NULL, FALSE); 1393 1400 } 1394 1401 1395 1402 ht.pt.x = (INT)LOWORD(lParam); 1396 1403 ht.pt.y = (INT)HIWORD(lParam); … … 1407 1414 return TRUE; 1408 1415 } 1409 if(hit == MCHT_TITLEBTNPREV){ 1416 if(hit == MCHT_TITLEBTNPREV){ 1410 1417 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1411 1418 infoPtr->status = MC_PREVPRESSED; … … 1417 1424 if(hit == MCHT_TITLEMONTH) { 1418 1425 hMenu = CreatePopupMenu(); 1419 1426 1420 1427 for (i=0; i<12;i++) 1421 1428 { 1422 1423 1424 1429 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, 1430 buf,sizeof(buf)); 1431 AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf); 1425 1432 } 1426 1433 menupoint.x=infoPtr->titlemonth.right; … … 1428 1435 ClientToScreen(hwnd, &menupoint); 1429 1436 i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, 1430 1437 menupoint.x,menupoint.y,0,hwnd,NULL); 1431 1438 if ((i>0) && (i<13)) 1432 1439 { 1433 1434 1440 infoPtr->currentMonth=i; 1441 InvalidateRect(hwnd, NULL, FALSE); 1435 1442 } 1436 1443 } 1437 1444 if(hit == MCHT_TITLEYEAR) { 1438 1445 infoPtr->hWndYearEdit=CreateWindowExA(0, 1439 1440 1441 1442 1443 1444 1445 1446 (HMENU)NULL, 1447 (HINSTANCE)NULL, 1448 1446 "EDIT", 1447 0, 1448 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, 1449 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, 1450 infoPtr->titleyear.right-infoPtr->titleyear.left, 1451 infoPtr->textHeight, 1452 hwnd, 1453 (HMENU)NULL, 1454 (HINSTANCE)NULL, 1455 NULL); 1449 1456 infoPtr->hWndYearUpDown=CreateWindowExA(0, 1450 1451 1452 1453 1454 1455 1456 1457 (HMENU)NULL, 1458 (HINSTANCE)NULL, 1459 1457 UPDOWN_CLASSA, 1458 0, 1459 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, 1460 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top, 1461 20, 1462 infoPtr->textHeight, 1463 hwnd, 1464 (HMENU)NULL, 1465 (HINSTANCE)NULL, 1466 NULL); 1460 1467 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); 1461 1468 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); 1462 1469 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); 1463 1470 return TRUE; 1464 1471 1465 1472 } 1466 1473 if(hit == MCHT_TODAYLINK) { … … 1480 1487 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1481 1488 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1482 1489 1483 1490 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1484 1491 (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); … … 1486 1493 MONTHCAL_CopyTime(&ht.st, &selArray[0]); 1487 1494 MONTHCAL_CopyTime(&ht.st, &selArray[1]); 1488 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1495 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1489 1496 1490 1497 /* redraw both old and new days if the selected day changed */ … … 1539 1546 return TRUE; 1540 1547 } 1541 if(hit == MCHT_CALENDARDATEPREV){ 1548 if(hit == MCHT_CALENDARDATEPREV){ 1542 1549 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1543 1550 InvalidateRect(hwnd, NULL, FALSE); … … 1557 1564 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1558 1565 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1559 1566 1560 1567 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1561 1568 (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); 1562 1569 1563 1570 /* redraw if necessary */ 1564 1571 if(redraw) 1565 1572 InvalidateRect(hwnd, NULL, FALSE); 1566 1573 1567 1574 return 0; 1568 1575 } … … 1579 1586 1580 1587 switch(wParam) { 1581 case MC_NEXTMONTHTIMER: 1588 case MC_NEXTMONTHTIMER: 1582 1589 redraw = TRUE; 1583 1590 MONTHCAL_GoToNextMonth(hwnd, infoPtr); … … 1611 1618 ht.pt.x = LOWORD(lParam); 1612 1619 ht.pt.y = HIWORD(lParam); 1613 1620 1614 1621 hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); 1615 1622 1616 1623 /* not on the calendar date numbers? bail out */ 1617 1624 TRACE("hit:%x\n",hit); … … 1631 1638 if(infoPtr->firstSelDay==selArray[0].wDay) i=1; 1632 1639 TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1633 if(infoPtr->firstSelDay==selArray[1].wDay) { 1640 if(infoPtr->firstSelDay==selArray[1].wDay) { 1634 1641 /* 1st time we get here: selArray[0]=selArray[1]) */ 1635 1642 /* if we're still at the first selected date, return */ … … 1637 1644 if(selday<infoPtr->firstSelDay) i = 0; 1638 1645 } 1639 1646 1640 1647 if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { 1641 1648 if(selday>infoPtr->firstSelDay) … … 1644 1651 selday = infoPtr->firstSelDay - infoPtr->maxSelCount; 1645 1652 } 1646 1653 1647 1654 if(selArray[i].wDay!=selday) { 1648 1655 TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1649 1656 1650 1657 selArray[i].wDay = selday; 1651 1658 … … 1705 1712 { 1706 1713 TRACE("\n"); 1707 1714 1708 1715 InvalidateRect(hwnd, NULL, FALSE); 1709 1716 … … 1762 1769 1763 1770 /* recalculate the height and width increments and offsets */ 1764 /* FIXME: We use up all available width. This will inhibit having multiple 1765 calendars in a row, like win doesn 1771 /* FIXME: We use up all available width. This will inhibit having multiple 1772 calendars in a row, like win doesn 1766 1773 */ 1767 1774 if(dwStyle & MCS_WEEKNUMBERS) … … 1769 1776 else 1770 1777 xdiv=7.0; 1771 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1772 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1778 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1779 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1773 1780 infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv); 1774 1781 infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0); … … 1783 1790 rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5; 1784 1791 }*/ 1785 1792 1786 1793 /* calculate title area */ 1787 1794 title->top = rcClient->top; … … 1798 1805 next->right = title->right - 6; 1799 1806 next->left = next->right - (title->bottom - title->top); 1800 1807 1801 1808 /* titlemonth->left and right change based upon the current month */ 1802 1809 /* and are recalculated in refresh as the current month may change */ … … 1804 1811 titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2; 1805 1812 titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2; 1806 1813 1807 1814 /* setup the dimensions of the rectangle we draw the names of the */ 1808 1815 /* days of the week in */ 1809 1816 weeknumrect->left =infoPtr->left_offset; 1810 if(dwStyle & MCS_WEEKNUMBERS) 1817 if(dwStyle & MCS_WEEKNUMBERS) 1811 1818 weeknumrect->right=prev->right; 1812 1819 else … … 1816 1823 wdays->top = title->bottom ; 1817 1824 wdays->bottom = wdays->top + infoPtr->height_increment; 1818 1825 1819 1826 days->top = weeknumrect->top = wdays->bottom ; 1820 1827 days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; 1821 1828 1822 1829 todayrect->left = rcClient->left; 1823 1830 todayrect->right = rcClient->right; … … 1825 1832 todayrect->bottom = days->bottom + infoPtr->height_increment; 1826 1833 1827 /* uncomment for excessive debugging 1834 /* uncomment for excessive debugging 1828 1835 TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n", 1829 1830 1831 1832 1833 1834 1836 infoPtr->width_increment,infoPtr->height_increment, 1837 rcClient->left, rcClient->right, rcClient->top, rcClient->bottom, 1838 title->left, title->right, title->top, title->bottom, 1839 wdays->left, wdays->right, wdays->top, wdays->bottom, 1840 days->left, days->right, days->top, days->bottom, 1841 todayrect->left,todayrect->right,todayrect->top,todayrect->bottom); 1835 1842 */ 1836 1843 1837 1844 /* restore the originally selected font */ 1838 SelectObject(hdc, currentFont); 1845 SelectObject(hdc, currentFont); 1839 1846 1840 1847 ReleaseDC(hwnd, hdc); … … 1858 1865 { 1859 1866 MONTHCAL_INFO *infoPtr; 1860 LOGFONTA 1867 LOGFONTA logFont; 1861 1868 1862 1869 /* allocate memory for info structure */ 1870 #ifdef __WIN32OS2__ 1871 infoPtr =(MONTHCAL_INFO*)initControl(hwnd,sizeof(MONTHCAL_INFO)); 1872 #else 1863 1873 infoPtr =(MONTHCAL_INFO*)COMCTL32_Alloc(sizeof(MONTHCAL_INFO)); 1874 #endif 1864 1875 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 1865 1876 … … 1889 1900 infoPtr->maxSelCount = 7; 1890 1901 infoPtr->monthRange = 3; 1891 infoPtr->monthdayState = COMCTL32_Alloc 1902 infoPtr->monthdayState = COMCTL32_Alloc 1892 1903 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1893 1904 infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION); … … 1896 1907 infoPtr->trailingtxt = GetSysColor(COLOR_GRAYTEXT); 1897 1908 infoPtr->bk = GetSysColor(COLOR_WINDOW); 1898 infoPtr->txt 1909 infoPtr->txt = GetSysColor(COLOR_WINDOWTEXT); 1899 1910 1900 1911 /* call MONTHCAL_UpdateSize to set all of the dimensions */ … … 2051 2062 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2052 2063 wndClass.lpszClassName = MONTHCAL_CLASSA; 2053 2064 2054 2065 RegisterClassA(&wndClass); 2055 2066 }
Note:
See TracChangeset
for help on using the changeset viewer.