From dd360466a517259013e9874b32b2a0bfc7affb57 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 19 Mar 2003 01:01:14 +0000 Subject: [PATCH] Applied a modification of Patch #704995 which changes how the lines are drawn such that only the visible portions are drawn. This is because (I think) if the length of the line is > 32k then on at least Win9x and GTK 1.2 the line will wrap around to the other end of the tree ctrl... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index caad650e51..3c45e0461d 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2385,7 +2385,23 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level // draw line down to last child oldY += GetLineHeight(children[n-1])>>1; if (HasButtons()) y_mid += 5; - dc.DrawLine(x, y_mid, x, oldY); + + // Only draw the portion of the line that is visible, in case it is huge + wxCoord xOrigin=0, yOrigin=0, width, height; + dc.GetDeviceOrigin(&xOrigin, &yOrigin); + yOrigin = abs(yOrigin); + GetClientSize(&width, &height); + + // Move end points to the begining/end of the view? + if (y_mid < yOrigin) + y_mid = yOrigin; + if (oldY > yOrigin + height) + oldY = yOrigin + height; + + // after the adjustments if y_mid is larger than oldY then the line + // isn't visible at all so don't draw anything + if (y_mid < oldY) + dc.DrawLine(x, y_mid, x, oldY); } } }