- When processing WM_PAINT messages, the treeview might sometimes use
the wrong hdc. Fixed. - Better checking for TREEVIEW_INFO *infoPtr=NULL. Similar to code in toolbar.c - Other small fixes (subclassed edit control).
This commit is contained in:
parent
0e0a4ab6ae
commit
f1a3f1752d
|
@ -82,7 +82,7 @@ TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_DoSelectItem (HWND hwnd, INT action, HTREEITEM newSelect, INT cause);
|
TREEVIEW_DoSelectItem (HWND hwnd, INT action, HTREEITEM newSelect, INT cause);
|
||||||
static void
|
static void
|
||||||
TREEVIEW_Refresh (HWND hwnd);
|
TREEVIEW_Refresh (HWND hwnd, HDC hdc);
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam,
|
TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
|
@ -126,7 +126,6 @@ static TREEVIEW_ITEM* TREEVIEW_ValidItem(
|
||||||
static TREEVIEW_ITEM *TREEVIEW_GetLastListItem(
|
static TREEVIEW_ITEM *TREEVIEW_GetLastListItem(
|
||||||
TREEVIEW_INFO *infoPtr,
|
TREEVIEW_INFO *infoPtr,
|
||||||
TREEVIEW_ITEM *tvItem)
|
TREEVIEW_ITEM *tvItem)
|
||||||
|
|
||||||
{
|
{
|
||||||
TREEVIEW_ITEM *wineItem = tvItem;
|
TREEVIEW_ITEM *wineItem = tvItem;
|
||||||
|
|
||||||
|
@ -392,7 +391,6 @@ TREEVIEW_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
if (infoPtr==NULL) return 0;
|
|
||||||
|
|
||||||
if ((INT)wParam == TVSIL_NORMAL)
|
if ((INT)wParam == TVSIL_NORMAL)
|
||||||
return (LRESULT) infoPtr->himlNormal;
|
return (LRESULT) infoPtr->himlNormal;
|
||||||
|
@ -501,6 +499,7 @@ static LRESULT
|
||||||
TREEVIEW_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TREEVIEW_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
FIXME("%d %ld\n",wParam,lParam);
|
FIXME("%d %ld\n",wParam,lParam);
|
||||||
if (!TREEVIEW_ValidItem (infoPtr, (HTREEITEM)lParam)) return 0;
|
if (!TREEVIEW_ValidItem (infoPtr, (HTREEITEM)lParam)) return 0;
|
||||||
|
@ -508,7 +507,11 @@ TREEVIEW_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
infoPtr->insertBeforeorAfter=(BOOL) wParam;
|
infoPtr->insertBeforeorAfter=(BOOL) wParam;
|
||||||
infoPtr->insertMarkItem=(HTREEITEM) lParam;
|
infoPtr->insertMarkItem=(HTREEITEM) lParam;
|
||||||
TREEVIEW_Refresh (hwnd);
|
|
||||||
|
hdc = GetDC (hwnd);
|
||||||
|
TREEVIEW_Refresh (hwnd, hdc);
|
||||||
|
ReleaseDC(hwnd,hdc);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,16 +910,21 @@ TREEVIEW_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TREEVIEW_ITEM *wineItem;
|
TREEVIEW_ITEM *wineItem;
|
||||||
HTREEITEM *iItem;
|
HTREEITEM *iItem;
|
||||||
LPRECT lpRect = (LPRECT)lParam;
|
LPRECT lpRect = (LPRECT)lParam;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
/*
|
/*
|
||||||
* validate parameters
|
* validate parameters
|
||||||
*/
|
*/
|
||||||
if ( (infoPtr==NULL) || (lpRect == NULL) )
|
if (lpRect == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (infoPtr->Timer & TV_REFRESH_TIMER_SET)
|
if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
|
||||||
TREEVIEW_Refresh (hwnd); /* we want a rect for the current view */
|
hdc = GetDC (hwnd);
|
||||||
|
TREEVIEW_Refresh (hwnd, hdc); /* we want a rect for the current view */
|
||||||
|
ReleaseDC(hwnd,hdc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* retrieve the item ptr
|
* retrieve the item ptr
|
||||||
|
@ -1040,23 +1048,19 @@ TREEVIEW_GetItemState (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
TREEVIEW_Refresh (HWND hwnd)
|
TREEVIEW_Refresh (HWND hwnd, HDC hdc)
|
||||||
|
|
||||||
{
|
{
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
TEXTMETRICA tm;
|
TEXTMETRICA tm;
|
||||||
HBRUSH hbrBk;
|
HBRUSH hbrBk;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
HDC hdc;
|
|
||||||
INT iItem, indent, x, y, cx, height, itemHeight;
|
INT iItem, indent, x, y, cx, height, itemHeight;
|
||||||
INT viewtop,viewbottom,viewleft,viewright;
|
INT viewtop,viewbottom,viewleft,viewright;
|
||||||
TREEVIEW_ITEM *wineItem, *prevItem;
|
TREEVIEW_ITEM *wineItem, *prevItem;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
hdc=GetDC (hwnd);
|
|
||||||
|
|
||||||
if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
|
if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
|
||||||
KillTimer (hwnd, TV_REFRESH_TIMER);
|
KillTimer (hwnd, TV_REFRESH_TIMER);
|
||||||
|
@ -1070,10 +1074,7 @@ TREEVIEW_Refresh (HWND hwnd)
|
||||||
infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
|
infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
|
||||||
(hwnd, CDDS_PREPAINT, hdc, rect);
|
(hwnd, CDDS_PREPAINT, hdc, rect);
|
||||||
|
|
||||||
if (infoPtr->cdmode==CDRF_SKIPDEFAULT) {
|
if (infoPtr->cdmode==CDRF_SKIPDEFAULT) return;
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
infoPtr->uVisibleHeight= rect.bottom-rect.top;
|
infoPtr->uVisibleHeight= rect.bottom-rect.top;
|
||||||
infoPtr->uVisibleWidth= rect.right-rect.left;
|
infoPtr->uVisibleWidth= rect.right-rect.left;
|
||||||
|
@ -1191,7 +1192,6 @@ TREEVIEW_Refresh (HWND hwnd)
|
||||||
infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
|
infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
|
||||||
(hwnd, CDDS_POSTPAINT, hdc, rect);
|
(hwnd, CDDS_POSTPAINT, hdc, rect);
|
||||||
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
TRACE("done\n");
|
TRACE("done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,7 +1202,6 @@ TREEVIEW_HandleTimer (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
|
||||||
TRACE(" %d\n",wParam);
|
TRACE(" %d\n",wParam);
|
||||||
if (!infoPtr) return FALSE;
|
|
||||||
|
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case TV_REFRESH_TIMER:
|
case TV_REFRESH_TIMER:
|
||||||
|
@ -1311,9 +1310,8 @@ TREEVIEW_GetNextItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
TREEVIEW_ITEM *wineItem, *returnItem;
|
TREEVIEW_ITEM *wineItem, *returnItem;
|
||||||
INT iItem, retval, flag;
|
INT iItem, retval, flag;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
|
|
||||||
if (!infoPtr) return FALSE;
|
|
||||||
flag = (INT) wParam;
|
flag = (INT) wParam;
|
||||||
iItem = (INT) lParam;
|
iItem = (INT) lParam;
|
||||||
retval=0;
|
retval=0;
|
||||||
|
@ -1322,9 +1320,10 @@ TREEVIEW_GetNextItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case TVGN_CARET:retval=(INT)infoPtr->selectedItem;
|
case TVGN_CARET:retval=(INT)infoPtr->selectedItem;
|
||||||
break;
|
break;
|
||||||
case TVGN_FIRSTVISIBLE:
|
case TVGN_FIRSTVISIBLE: /* FIXME:we should only recalculate, not redraw */
|
||||||
TREEVIEW_Refresh (hwnd);
|
hdc = GetDC (hwnd);
|
||||||
/* FIXME:we should only recalculate, not redraw */
|
TREEVIEW_Refresh (hwnd, hdc);
|
||||||
|
ReleaseDC(hwnd,hdc);
|
||||||
retval=(INT)infoPtr->firstVisible;
|
retval=(INT)infoPtr->firstVisible;
|
||||||
break;
|
break;
|
||||||
case TVGN_DROPHILITE:
|
case TVGN_DROPHILITE:
|
||||||
|
@ -1969,7 +1968,6 @@ TREEVIEW_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
wineItem->stateMask=tvItem->stateMask;
|
wineItem->stateMask=tvItem->stateMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TREEVIEW_QueueRefresh (hwnd);
|
TREEVIEW_QueueRefresh (hwnd);
|
||||||
|
|
||||||
return (LRESULT) iItem;
|
return (LRESULT) iItem;
|
||||||
|
@ -2035,7 +2033,6 @@ TREEVIEW_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TREEVIEW_ITEM *wineItem;
|
TREEVIEW_ITEM *wineItem;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
if (!infoPtr) return FALSE;
|
|
||||||
|
|
||||||
if (lParam == (INT)TVI_ROOT) {
|
if (lParam == (INT)TVI_ROOT) {
|
||||||
TREEVIEW_RemoveTree (hwnd);
|
TREEVIEW_RemoveTree (hwnd);
|
||||||
|
@ -2139,7 +2136,11 @@ TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(GetParent(hwnd));
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(GetParent(hwnd));
|
||||||
|
if (infoPtr!=NULL)
|
||||||
return CallWindowProcA (infoPtr->wpEditOrig, hwnd, uMsg, wParam, lParam);
|
return CallWindowProcA (infoPtr->wpEditOrig, hwnd, uMsg, wParam, lParam);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2228,9 +2229,12 @@ TREEVIEW_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_StyleChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TREEVIEW_StyleChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACE("(%x %lx)\n",wParam,lParam);
|
HDC hdc;
|
||||||
|
|
||||||
TREEVIEW_Refresh (hwnd);
|
TRACE("(%x %lx)\n",wParam,lParam);
|
||||||
|
hdc = GetDC (hwnd);
|
||||||
|
TREEVIEW_Refresh (hwnd, hdc);
|
||||||
|
ReleaseDC(hwnd,hdc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2289,6 +2293,7 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->insertBeforeorAfter=0;
|
infoPtr->insertBeforeorAfter=0;
|
||||||
infoPtr->pCallBackSort=NULL;
|
infoPtr->pCallBackSort=NULL;
|
||||||
infoPtr->uScrollTime = 300; /* milliseconds */
|
infoPtr->uScrollTime = 300; /* milliseconds */
|
||||||
|
infoPtr->wpEditOrig = NULL; /* we haven't subclassed anything yet */
|
||||||
|
|
||||||
infoPtr->hwndToolTip=0;
|
infoPtr->hwndToolTip=0;
|
||||||
if (!(dwStyle & TVS_NOTOOLTIPS)) { /* Create tooltip control */
|
if (!(dwStyle & TVS_NOTOOLTIPS)) { /* Create tooltip control */
|
||||||
|
@ -2366,6 +2371,8 @@ TREEVIEW_Destroy (HWND hwnd)
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
TREEVIEW_RemoveTree (hwnd);
|
TREEVIEW_RemoveTree (hwnd);
|
||||||
|
SetWindowLongA (hwnd, 0, (DWORD)NULL);
|
||||||
|
|
||||||
if (infoPtr->Timer & TV_REFRESH_TIMER_SET)
|
if (infoPtr->Timer & TV_REFRESH_TIMER_SET)
|
||||||
KillTimer (hwnd, TV_REFRESH_TIMER);
|
KillTimer (hwnd, TV_REFRESH_TIMER);
|
||||||
if (infoPtr->hwndToolTip)
|
if (infoPtr->hwndToolTip)
|
||||||
|
@ -2384,9 +2391,9 @@ TREEVIEW_Paint (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
|
hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
|
||||||
TREEVIEW_Refresh (hwnd);
|
TREEVIEW_Refresh (hwnd, hdc);
|
||||||
if(!wParam)
|
ReleaseDC(hwnd,hdc);
|
||||||
EndPaint (hwnd, &ps);
|
if(!wParam) EndPaint (hwnd, &ps);
|
||||||
TRACE("done\n");
|
TRACE("done\n");
|
||||||
|
|
||||||
return DefWindowProcA (hwnd, WM_PAINT, wParam, lParam);
|
return DefWindowProcA (hwnd, WM_PAINT, wParam, lParam);
|
||||||
|
@ -3666,7 +3673,14 @@ TREEVIEW_SetScrollTime (HWND hwnd, UINT uScrollTime)
|
||||||
static LRESULT WINAPI
|
static LRESULT WINAPI
|
||||||
TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
if (uMsg==WM_DESTROY)
|
||||||
|
return TREEVIEW_Destroy (hwnd);
|
||||||
|
|
||||||
|
if (!TREEVIEW_GetInfoPtr(hwnd))
|
||||||
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
|
||||||
case TVM_INSERTITEMA:
|
case TVM_INSERTITEMA:
|
||||||
return TREEVIEW_InsertItemA (hwnd, wParam, lParam);
|
return TREEVIEW_InsertItemA (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
@ -3820,9 +3834,6 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
return TREEVIEW_Create (hwnd, wParam, lParam);
|
return TREEVIEW_Create (hwnd, wParam, lParam);
|
||||||
|
|
||||||
case WM_DESTROY:
|
|
||||||
return TREEVIEW_Destroy (hwnd);
|
|
||||||
|
|
||||||
/* case WM_ENABLE: */
|
/* case WM_ENABLE: */
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
|
|
Loading…
Reference in New Issue