Author: gadamopoulos
Date: Thu Jan 26 16:48:52 2017
New Revision: 73599
URL:
http://svn.reactos.org/svn/reactos?rev=73599&view=rev
Log:
[SHELL32] -CDefView: Implement moving icons around. Note that the positions are never
stored so a refresh returns them to their initial position.
Modified:
trunk/reactos/dll/win32/shell32/CDefView.cpp
Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefView…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] Thu Jan 26 16:48:52 2017
@@ -96,6 +96,7 @@
LONG m_iDragOverItem; /* Dragged over item's index,
iff m_pCurDropTarget != NULL */
UINT m_cScrollDelay; /* Send a WM_*SCROLL msg every
250 ms during drag-scroll */
POINT m_ptLastMousePos; /* Mouse position at last
DragOver call */
+ POINT m_ptFirstMousePos; /* Mouse position when the drag
operation started */
//
CComPtr<IContextMenu> m_pCM;
@@ -1756,6 +1757,8 @@
DWORD dwEffect2;
m_pSourceDataObject = pda;
+ m_ptFirstMousePos = ((LPNMLISTVIEW)lParam)->ptAction;
+ ClientToScreen(&m_ptFirstMousePos);
DoDragDrop(pda, this, dwEffect, &dwEffect2);
@@ -2902,7 +2905,6 @@
{
/* Get a hold on the data object for later calls to DragEnter on the sub-folders */
m_pCurDataObject = pDataObject;
- pDataObject->AddRef();
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
}
@@ -2936,11 +2938,22 @@
if ((m_iDragOverItem == -1) &&
(*pdwEffect & DROPEFFECT_MOVE) &&
- (GetKeyState(VK_LBUTTON) != 0) &&
+ /*(GetKeyState(VK_LBUTTON) != 0) &&*/
(m_pSourceDataObject.p) &&
(SHIsSameObject(pDataObject, m_pSourceDataObject)))
{
- ERR("Should implement moving items here!\n");
+ /* Reposition the items */
+ int lvIndex = -1;
+ while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
+ {
+ POINT ptItem;
+ if (m_ListView.GetItemPosition(lvIndex, &ptItem))
+ {
+ ptItem.x += pt.x - m_ptFirstMousePos.x;
+ ptItem.y += pt.y - m_ptFirstMousePos.y;
+ m_ListView.SetItemPosition(lvIndex, &ptItem);
+ }
+ }
if (m_pCurDropTarget)
{