From 6de10dde4de37ec6b623d610240acf8f7d7022a6 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Wed, 5 Aug 1998 00:38:41 +0000 Subject: [PATCH] Improving drag feedback. --- cmd/winfe/outliner.cpp | 6 ++++-- cmd/winfe/outliner.h | 3 +++ cmd/winfe/rdfliner.cpp | 40 ++++++++++++++++++++++++++++++++++++---- cmd/winfe/rdfliner.h | 3 +++ 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/cmd/winfe/outliner.cpp b/cmd/winfe/outliner.cpp index 2dfc54971e15..02832f425e59 100644 --- a/cmd/winfe/outliner.cpp +++ b/cmd/winfe/outliner.cpp @@ -2245,13 +2245,15 @@ int COutliner::LineFromPoint (POINT point) // Figure out which portion of the line the point is on. int iDiff = point.y - ((iLine - m_iTopLine) *m_itemHeight); - int iOldLineHalf = m_iDragSelectionLineHalf, iOldLineThird = m_iDragSelectionLineThird; + m_iOldLineHalf = m_iDragSelectionLineHalf; + m_iOldLineThird = m_iDragSelectionLineThird; + m_iDragSelectionLineHalf = (iDiff <= m_itemHeight / 2) ? 1 : 2; m_iDragSelectionLineThird = (iDiff <= m_itemHeight / 3) ? 1 : (iDiff <= 2 * (m_itemHeight/3)) ? 2 : 3; if(m_iTopLine !=0) int i =0; - m_bDragSectionChanged = (iOldLineHalf != m_iDragSelectionLineHalf || iOldLineThird !=m_iDragSelectionLineThird); + m_bDragSectionChanged = (m_iOldLineHalf != m_iDragSelectionLineHalf || m_iOldLineThird !=m_iDragSelectionLineThird); return ( iLine ); } diff --git a/cmd/winfe/outliner.h b/cmd/winfe/outliner.h index 76eda87ebbb0..800740eb947e 100644 --- a/cmd/winfe/outliner.h +++ b/cmd/winfe/outliner.h @@ -140,6 +140,9 @@ protected: int m_iDragSelection; int m_iDragSelectionLineHalf; // Which half of the selection is the drag over int m_iDragSelectionLineThird; // Which third of the selection is the drag over + int m_iOldLineHalf; + int m_iOldLineThird; + BOOL m_bDragSectionChanged; BOOL m_bClearOnRelease; diff --git a/cmd/winfe/rdfliner.cpp b/cmd/winfe/rdfliner.cpp index 94b9e27bc87b..6db284e0b1c0 100644 --- a/cmd/winfe/rdfliner.cpp +++ b/cmd/winfe/rdfliner.cpp @@ -372,6 +372,36 @@ void CRDFOutliner::InvalidateIconForResource(HT_Resource r) } +void CRDFOutliner::InvalidateDragLine ( int iLineNo, BOOL useThirds, int dragFraction) +{ + if (iLineNo == -1) + return; + CRect rect, out; + GetClientRect ( &rect ); + RectFromLine ( iLineNo - m_iTopLine, rect, out ); + + if (dragFraction == 1) + { + CRect topLine(out); + topLine.bottom = out.top; + InvalidateRect(&topLine); + } + + if (dragFraction == 2) + { + if (useThirds) + InvalidateRect(out); + else dragFraction = 3; + } + + if (dragFraction == 3) + { + CRect bottomLine(out); + bottomLine.top = out.bottom-1; + InvalidateRect ( &bottomLine ); + } +} + LPCTSTR CRDFOutliner::GetColumnText ( UINT iColumn, void * pLineData ) { void* nodeData; @@ -3081,7 +3111,7 @@ BOOL CRDFOutliner::HighlightIfDragging(void) void CRDFOutliner::PaintDragLine(HDC hdc, CRect &rectColumn) { - HPEN pen = ::CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW)); + HPEN pen = ::CreatePen(PS_SOLID, 1, m_ForegroundColor); HPEN pOldPen = (HPEN)::SelectObject(hdc, pen); if(m_iDragSelectionLineThird == 1) { @@ -3274,10 +3304,12 @@ DROPEFFECT CRDFOutliner::DropSelect(int iLineNo, COleDataObject *object) return answer; if (m_iDragSelection != -1) - InvalidateLine (m_iDragSelection); - + InvalidateDragLine (m_iDragSelection, HT_IsContainer(r), + HT_IsContainer(r) ? m_iOldLineThird : m_iOldLineHalf); + m_iDragSelection = iLineNo; - InvalidateLine (m_iDragSelection); + InvalidateDragLine (m_iDragSelection, HT_IsContainer(r), + HT_IsContainer(r) ? m_iDragSelectionLineThird : m_iDragSelectionLineHalf); // Start the hover timer for folder springloading diff --git a/cmd/winfe/rdfliner.h b/cmd/winfe/rdfliner.h index cfe40cce1d2c..5416957b23b0 100644 --- a/cmd/winfe/rdfliner.h +++ b/cmd/winfe/rdfliner.h @@ -303,6 +303,9 @@ public: void InvalidateIconForResource(HT_Resource r); // Invalidates only the icon for a given node. The rest of the line is left alone. + void InvalidateDragLine(int iLineNo, BOOL useThirds, int dragFraction); + // Invalidates only the drag areas for a given node. The rest of the line is left alone. + CRect ConstructDragRect(const CPoint& pt1, const CPoint& pt2); // Constructs a new rectangle with the two points specified as opposing corners.