void CuListCtrlLoggedEvent::OnButtonUp(CPoint point) { try { UINT flags = 0; UINT nFlags = 0; CPoint p = point; ClientToScreen (&p); if (!m_bDragging) return; m_bDragging = FALSE; ASSERT(m_pImageListDrag != NULL); m_pImageListDrag->DragLeave(GetParentFrame()); m_pImageListDrag->EndDrag(); delete m_pImageListDrag; m_pImageListDrag = NULL; if (m_iItemDrag == -1) return; // // Determine the pane under the mouse pointer: CRect rFrame, rLeftTree, rRightTree, rBottomList; m_pEventSettingFrame->GetWindowRect (rFrame); CvEventSettingLeft* pLeftView = m_pEventSettingFrame->GetLeftView(); CvEventSettingRight* pRightView = m_pEventSettingFrame->GetRightView(); CvEventSettingBottom* pBottomView= m_pEventSettingFrame->GetBottomView(); if (!(pLeftView && pRightView && pBottomView)) return; CTreeCtrl* pTreeLeft = pLeftView->GetTreeCtrl(); CTreeCtrl* pTreeRight = pRightView->GetTreeCtrl(); CListCtrl* pListBottom= pBottomView->GetListCtrl(); if (!(pTreeLeft && pTreeRight && pListBottom)) return; pTreeLeft->GetWindowRect (rLeftTree); pTreeRight->GetWindowRect (rRightTree); pListBottom->GetWindowRect(rBottomList); CWnd* pWndTarget = NULL; CPoint cursorPos; GetCursorPos (&cursorPos); int nPane = 0; if (rFrame.PtInRect (cursorPos)) { if (rLeftTree.PtInRect (cursorPos)) { pWndTarget = pTreeLeft; nPane = 1; } else if (rRightTree.PtInRect (cursorPos)) { pWndTarget = pTreeRight; nPane = 2; } else if (rBottomList.PtInRect (cursorPos)) { pWndTarget = pListBottom; nPane = 3; } } if (nPane == 1 || nPane == 2) { CTreeCtrl* pTree = NULL; CListCtrl* pListCtrl = pListBottom; if (nPane == 1) pTree = pTreeLeft; else pTree = pTreeRight; UINT flags, nAction = 0; HTREEITEM hTreeItemTarget = NULL; CaMessageNode* pNodeTarget = NULL; CPoint pt = point; pt.y += 8; ClientToScreen (&pt); pTree->ScreenToClient(&pt); hTreeItemTarget = pTree->HitTest (pt, &flags); if (hTreeItemTarget && (flags&TVHT_ONITEM)) { pTree->SelectItem (hTreeItemTarget); pNodeTarget = (CaMessageNode*)pTree->GetItemData (hTreeItemTarget); nAction = GetCompatibleSourceTarget(pTree, pNodeTarget->GetNodeInformation()); NewUserMessage (nPane, nAction, pTree, pNodeTarget, pListCtrl); } } } catch (...) { TRACE0 ("Internal error(1): CuListCtrlLoggedEvent::OnButtonUp \n"); } ::ReleaseCapture(); }
void CuListCtrlLoggedEvent::OnMouseMove(UINT nFlags, CPoint point) { CPoint p = point; ClientToScreen (&p); CPoint pDragMove = p; if (!m_pEventSettingFrame) m_pEventSettingFrame = (CfEventSetting*)GetParentFrame(); ASSERT (m_pEventSettingFrame); if (!m_pEventSettingFrame) { CuListCtrlVScrollEvent::OnMouseMove(nFlags, point); return; } m_pEventSettingFrame->ScreenToClient(&pDragMove); if (!m_bDragging) { CuListCtrlVScrollEvent::OnMouseMove(nFlags, point); return; } ASSERT(m_pImageListDrag != NULL); m_pImageListDrag->DragMove(pDragMove); // move the image m_pImageListDrag->DragLeave(/*this*/GetParentFrame()); // // Determine the pane under the mouse pointer: CRect rFrame, rLeftTree, rRightTree, rBottomList; m_pEventSettingFrame->GetWindowRect (rFrame); CvEventSettingLeft* pLeftView = m_pEventSettingFrame->GetLeftView(); CvEventSettingRight* pRightView = m_pEventSettingFrame->GetRightView(); CvEventSettingBottom* pBottomView= m_pEventSettingFrame->GetBottomView(); if (!(pLeftView && pRightView && pBottomView)) { CuListCtrlVScrollEvent::OnMouseMove(nFlags, point); return; } CTreeCtrl* pTreeLeft = pLeftView->GetTreeCtrl(); CTreeCtrl* pTreeRight = pRightView->GetTreeCtrl(); CListCtrl* pListBottom= pBottomView->GetListCtrl(); if (!(pTreeLeft && pTreeRight && pListBottom)) { CuListCtrlVScrollEvent::OnMouseMove(nFlags, point); return; } pTreeLeft->GetWindowRect (rLeftTree); pTreeRight->GetWindowRect (rRightTree); pListBottom->GetWindowRect(rBottomList); CWnd* pWndTarget = NULL; CPoint cursorPos; GetCursorPos (&cursorPos); int nPane = 0; if (rFrame.PtInRect (cursorPos)) { if (rLeftTree.PtInRect (cursorPos)) { pWndTarget = pTreeLeft; nPane = 1; } else if (rRightTree.PtInRect (cursorPos)) { pWndTarget = pTreeRight; nPane = 2; } else if (rBottomList.PtInRect (cursorPos)) { pWndTarget = pListBottom; nPane = 3; } } if (nPane == 1 || nPane == 2) { CTreeCtrl* pTree = NULL; if (nPane == 1) pTree = pTreeLeft; else pTree = pTreeRight; UINT flags, nAction = 0; HTREEITEM hTreeItemTarget = NULL; CaMessageNode* pNodeTarget = NULL; CPoint pt = point; pt.y += 8; ClientToScreen (&pt); pTree->ScreenToClient(&pt); hTreeItemTarget = pTree->HitTest (pt, &flags); if (hTreeItemTarget && (flags&TVHT_ONITEM)) { pTree->SelectItem (hTreeItemTarget); pNodeTarget = (CaMessageNode*)pTree->GetItemData (hTreeItemTarget); nAction = GetCompatibleSourceTarget(pTree,pNodeTarget->GetNodeInformation()); } TRACE1 ("DD Action = %x\n", nAction); if (nAction != 0) ::SetCursor (theApp.m_hCursorDropCategory); else ::SetCursor (theApp.m_hCursorNoDropCategory); } else { ::SetCursor (theApp.m_hCursorNoDropCategory); } m_pImageListDrag->DragEnter(GetParentFrame(), pDragMove); // lock updates and show drag image CuListCtrlVScrollEvent::OnMouseMove(nFlags, point); }