Mercurial > dwindows
comparison win/dw.c @ 648:2b260f4309bb
Put in a fix for a Visual Studio 2008 crash with a time of 0.
Also changed DEBUG to be DWDEBUG so the popup boxes don't fill the screen when making a simple debug build.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 19 Feb 2011 00:02:12 +0000 |
parents | 9ab89d89e6b4 |
children | c60a4f6cfae8 |
comparison
equal
deleted
inserted
replaced
647:f09977bc9b5c | 648:2b260f4309bb |
---|---|
1549 is_checked = (is_checked) ? 0 : 1; | 1549 is_checked = (is_checked) ? 0 : 1; |
1550 dw_menu_item_set_check( window, id, is_checked ); | 1550 dw_menu_item_set_check( window, id, is_checked ); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 | 1553 |
1554 #ifdef DEBUG | 1554 #ifdef DWDEBUG |
1555 long ProcessCustomDraw (LPARAM lParam) | 1555 long ProcessCustomDraw (LPARAM lParam) |
1556 { | 1556 { |
1557 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; | 1557 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; |
1558 | 1558 |
1559 switch(lplvcd->nmcd.dwDrawStage) | 1559 switch(lplvcd->nmcd.dwDrawStage) |
1963 treeselectfunc(tmp->window, 0, (char *)lvi.lParam, tmp->data, 0); | 1963 treeselectfunc(tmp->window, 0, (char *)lvi.lParam, tmp->data, 0); |
1964 tmp = NULL; | 1964 tmp = NULL; |
1965 } | 1965 } |
1966 } | 1966 } |
1967 } | 1967 } |
1968 #ifdef DEBUG | 1968 #ifdef DWDEBUG |
1969 else if ( lem->hdr.code == NM_CUSTOMDRAW ) | 1969 else if ( lem->hdr.code == NM_CUSTOMDRAW ) |
1970 { | 1970 { |
1971 dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW from _wndproc (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "Hello"); | 1971 dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW from _wndproc (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "Hello"); |
1972 SetWindowLong( hWnd, DWL_MSGRESULT, (LONG)ProcessCustomDraw(mp2) ); | 1972 SetWindowLong( hWnd, DWL_MSGRESULT, (LONG)ProcessCustomDraw(mp2) ); |
1973 return TRUE; | 1973 return TRUE; |
2186 if(num > -1 && array && array[num]) | 2186 if(num > -1 && array && array[num]) |
2187 SetParent(array[num]->hwnd, tem->hwndFrom); | 2187 SetParent(array[num]->hwnd, tem->hwndFrom); |
2188 | 2188 |
2189 _resize_notebook_page(tem->hwndFrom, num); | 2189 _resize_notebook_page(tem->hwndFrom, num); |
2190 } | 2190 } |
2191 #ifdef DEBUG | 2191 #ifdef DWDEBUG |
2192 else | 2192 else |
2193 { | 2193 { |
2194 /* | 2194 /* |
2195 * Check if we have a click_default for this window | 2195 * Check if we have a click_default for this window |
2196 */ | 2196 */ |
7661 else if(flags[column] & DW_CFA_DATE) | 7661 else if(flags[column] & DW_CFA_DATE) |
7662 { | 7662 { |
7663 struct tm curtm; | 7663 struct tm curtm; |
7664 CDATE cdate = *((CDATE *)data); | 7664 CDATE cdate = *((CDATE *)data); |
7665 | 7665 |
7666 curtm.tm_mday = cdate.day; | 7666 |
7667 curtm.tm_mon = cdate.month - 1; | 7667 /* Safety check... zero dates are crashing |
7668 curtm.tm_year = cdate.year - 1900; | 7668 * Visual Studio 2008. -Brian |
7669 | 7669 */ |
7670 strftime(textbuffer, 100, "%x", &curtm); | 7670 if(cdate.year > 1900) |
7671 { | |
7672 curtm.tm_mday = cdate.day; | |
7673 curtm.tm_mon = cdate.month > 0 ? cdate.month - 1 : 0; | |
7674 curtm.tm_year = cdate.year - 1900; | |
7675 | |
7676 strftime(textbuffer, 100, "%x", &curtm); | |
7677 } | |
7678 else | |
7679 { | |
7680 textbuffer[0] = 0; | |
7681 } | |
7671 | 7682 |
7672 lvi.pszText = textbuffer; | 7683 lvi.pszText = textbuffer; |
7673 lvi.cchTextMax = strlen(textbuffer); | 7684 lvi.cchTextMax = strlen(textbuffer); |
7674 } | 7685 } |
7675 else if(flags[column] & DW_CFA_TIME) | 7686 else if(flags[column] & DW_CFA_TIME) |