зеркало из https://github.com/mozilla/gecko-dev.git
Improving drag feedback.
This commit is contained in:
Родитель
668cddb22e
Коммит
6de10dde4d
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче