#include "StdAfx.h" #include ".\itemviewWellPole.h" #include "SigmaDoc.h" #include "SigmaView.h" #include "WellPoleDoc.h" #include "WellPoleView.h" namespace NDrawView { CItemViewWellPole::CItemViewWellPole(CSigmaDoc * ppDoc) :CItemView(ppDoc) { } CItemViewWellPole::CItemViewWellPole(void) : CItemView(NULL) { } CItemViewWellPole::~CItemViewWellPole(void) { } void CItemViewWellPole::OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk) { switch (GetType()) { case ID_VIEW_WINDOW: m_rect.left = GetDC()->GetRX(TransfromX(point.x)); m_rect.top = GetDC()->GetRY(TransfromY(point.y)); m_rect.right = m_rect.left; m_rect.bottom = m_rect.top; case ID_VIEW_PAN: case ID_VIEW_PAN_WELL: m_ptLeft = point; m_rect.left = GetDC()->GetRX(TransfromX(point.x)); m_rect.top = GetDC()->GetRY(TransfromY(point.y)); m_rect.right = m_rect.left; m_rect.bottom = m_rect.top; bCaptureCursor = TRUE; if (GetType() == ID_VIEW_PAN) LButtonDownPan(point); break; } } void CItemViewWellPole::OnLButtonUp(CDC *pDC, UINT nFlags, CPoint point, int vk) { CItemView::OnLButtonUp(pDC, nFlags, point, vk); } int CItemViewWellPole::OnMouseMove(CDC *pDC, UINT nFlags, CPoint point) { if (GetType() == ID_VIEW_PAN_WELL) { MouseMovePanWell(point); CWellPoleView* pView = (CWellPoleView*)GetActiveView(); pView->m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0); } else CItemView::OnMouseMove(pDC, nFlags, point); return 1; } void CItemViewWellPole::MouseMovePanWell(CPoint point) { CXyDC *pXyDC = GetDC(); CWellPoleView* pView = (CWellPoleView*)GetActiveView(); CPoint pt = pXyDC->GetScreen(m_rect.BottomRight()); pView->MouseWheel(0, point.y - pt.y, point); pView->MouseWheel(1, point.x - pt.x, point); // TRACE("p1.x=%d y=%d, pt2.x=%d y=%d \r\n", pt.x, pt.y, point.x, point.y); m_rect.right = pXyDC->GetRX(point.x); m_rect.bottom = pXyDC->GetRY(point.y); } }//namespace