diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-12 21:28:06 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-12 21:28:06 +0000 |
commit | a4f715971c8c0f5be8f8fcc8678c7dd57cab0f8e (patch) | |
tree | 4bca82393f90685c3c9b3a0420745cf24bd84e28 /src/modules/clist/contacts.cpp | |
parent | b3742e87f4003a80c13ece74264397b6c137096b (diff) |
- CCtrlData::OnChange moved to CCtrlBase, because almost all controls can send change notifications;
- checkbox manager for CCtrlTreeView moved into the core, to remove Windows-dependent code from plugins;
- MTREE_CHECKBOX & MTREE_DND flags introduced to turn on predefined behaviors of a tree control
- typo fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@13564 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist/contacts.cpp')
-rw-r--r-- | src/modules/clist/contacts.cpp | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index d370239c84..204dc3221c 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -433,66 +433,68 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
+ TVHITTESTINFO hti;
+
switch (msg) {
case WM_MOUSEMOVE:
- if (dragging) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(lParam);
- hti.pt.y = (short)HIWORD(lParam);
- ClientToScreen(m_hwnd, &hti.pt);
- ScreenToClient(m_nameOrder.GetHwnd(), &hti.pt);
+ if (!dragging)
+ break;
+
+ hti.pt.x = (short)LOWORD(lParam);
+ hti.pt.y = (short)HIWORD(lParam);
+ ClientToScreen(m_hwnd, &hti.pt);
+ ScreenToClient(m_nameOrder.GetHwnd(), &hti.pt);
+ m_nameOrder.HitTest(&hti);
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
+ hti.pt.y -= m_nameOrder.GetItemHeight() / 2;
m_nameOrder.HitTest(&hti);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
- hti.pt.y -= m_nameOrder.GetItemHeight() / 2;
- m_nameOrder.HitTest(&hti);
- m_nameOrder.SetInsertMark(hti.hItem, 1);
- }
- else {
- if (hti.flags & TVHT_ABOVE) m_nameOrder.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
- if (hti.flags & TVHT_BELOW) m_nameOrder.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
- m_nameOrder.SetInsertMark(NULL, 0);
- }
+ m_nameOrder.SetInsertMark(hti.hItem, 1);
+ }
+ else {
+ if (hti.flags & TVHT_ABOVE) m_nameOrder.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
+ if (hti.flags & TVHT_BELOW) m_nameOrder.SendMsg(WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0);
+ m_nameOrder.SetInsertMark(NULL, 0);
}
break;
case WM_LBUTTONUP:
- if (dragging) {
- m_nameOrder.SetInsertMark(NULL, 0);
- dragging = 0;
- ReleaseCapture();
-
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(lParam);
- hti.pt.y = (short)HIWORD(lParam);
- ClientToScreen(m_hwnd, &hti.pt);
- ScreenToClient(m_nameOrder.GetHwnd(), &hti.pt);
- hti.pt.y -= m_nameOrder.GetItemHeight() / 2;
- m_nameOrder.HitTest(&hti);
- if (hDragItem == hti.hItem)
- break;
-
- TVITEMEX tvi;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti.hItem;
- m_nameOrder.GetItem(&tvi);
- if (tvi.lParam == SIZEOF(nameOrderDescr) - 1)
- break;
-
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
- TCHAR name[128];
- TVINSERTSTRUCT tvis = { 0 };
- tvis.itemex.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_PARAM;
- tvis.itemex.stateMask = 0xFFFFFFFF;
- tvis.itemex.pszText = name;
- tvis.itemex.cchTextMax = SIZEOF(name);
- tvis.itemex.hItem = hDragItem;
- m_nameOrder.GetItem(&tvis.itemex);
- m_nameOrder.DeleteItem(hDragItem);
- tvis.hParent = NULL;
- tvis.hInsertAfter = hti.hItem;
- m_nameOrder.SelectItem(m_nameOrder.InsertItem(&tvis));
- NotifyChange();
- }
+ if (!dragging)
+ break;
+
+ m_nameOrder.SetInsertMark(NULL, 0);
+ dragging = 0;
+ ReleaseCapture();
+
+ hti.pt.x = (short)LOWORD(lParam);
+ hti.pt.y = (short)HIWORD(lParam);
+ ClientToScreen(m_hwnd, &hti.pt);
+ ScreenToClient(m_nameOrder.GetHwnd(), &hti.pt);
+ hti.pt.y -= m_nameOrder.GetItemHeight() / 2;
+ m_nameOrder.HitTest(&hti);
+ if (hDragItem == hti.hItem)
+ break;
+
+ TVITEMEX tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM;
+ tvi.hItem = hti.hItem;
+ m_nameOrder.GetItem(&tvi);
+ if (tvi.lParam == SIZEOF(nameOrderDescr) - 1)
+ break;
+
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
+ TCHAR name[128];
+ TVINSERTSTRUCT tvis = { 0 };
+ tvis.itemex.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_PARAM;
+ tvis.itemex.stateMask = 0xFFFFFFFF;
+ tvis.itemex.pszText = name;
+ tvis.itemex.cchTextMax = SIZEOF(name);
+ tvis.itemex.hItem = hDragItem;
+ m_nameOrder.GetItem(&tvis.itemex);
+ m_nameOrder.DeleteItem(hDragItem);
+ tvis.hParent = NULL;
+ tvis.hInsertAfter = hti.hItem;
+ m_nameOrder.SelectItem(m_nameOrder.InsertItem(&tvis));
+ NotifyChange();
}
break;
}
|