From b45ea1fce52d93615470bab8b671cba5907fb01e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 21 Feb 2017 14:27:59 -0500 Subject: Convert CFWL messages to use CFX_PointF This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fwl/cfwl_notedriver.cpp | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'xfa/fwl/cfwl_notedriver.cpp') diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index 6904759e59..8feb0fb4e5 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp @@ -341,12 +341,8 @@ bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage, pMsg->m_dwCmd == FWL_MouseCommand::Enter) { return !!pMsg->m_pDstTarget; } - if (pMsg->m_pDstTarget != pMessageForm) { - CFX_PointF point = pMsg->m_pDstTarget->TransformTo( - pMessageForm, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); - pMsg->m_fx = point.x; - pMsg->m_fy = point.y; - } + if (pMsg->m_pDstTarget != pMessageForm) + pMsg->m_pos = pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_pos); if (!DoMouseEx(pMsg, pMessageForm)) pMsg->m_pDstTarget = pMessageForm; return true; @@ -359,15 +355,11 @@ bool CFWL_NoteDriver::DoWheel(CFWL_Message* pMessage, return false; CFWL_MessageMouseWheel* pMsg = static_cast(pMessage); - CFWL_Widget* pDst = - pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); + CFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos); if (!pDst) return false; - CFX_PointF point = - pMessageForm->TransformTo(pDst, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); - pMsg->m_fx = point.x; - pMsg->m_fy = point.y; + pMsg->m_pos = pMessageForm->TransformTo(pDst, pMsg->m_pos); pMsg->m_pDstTarget = pDst; return true; } @@ -382,20 +374,12 @@ bool CFWL_NoteDriver::DoMouseEx(CFWL_Message* pMessage, pTarget = m_pGrab; CFWL_MessageMouse* pMsg = static_cast(pMessage); - if (!pTarget) { - pTarget = - pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); - } - if (pTarget) { - if (pMessageForm != pTarget) { - CFX_PointF point = pMessageForm->TransformTo( - pTarget, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); - pMsg->m_fx = point.x; - pMsg->m_fy = point.y; - } - } + if (!pTarget) + pTarget = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_pos); if (!pTarget) return false; + if (pTarget && pMessageForm != pTarget) + pMsg->m_pos = pMessageForm->TransformTo(pTarget, pMsg->m_pos); pMsg->m_pDstTarget = pTarget; return true; @@ -409,10 +393,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) { CFWL_MessageMouse* pMsg = static_cast(pMessage); if (m_pHover) { CFWL_MessageMouse msLeave(nullptr, m_pHover); - CFX_PointF point = - pTarget->TransformTo(m_pHover, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); - msLeave.m_fx = point.x; - msLeave.m_fy = point.y; + msLeave.m_pos = pTarget->TransformTo(m_pHover, pMsg->m_pos); msLeave.m_dwFlags = 0; msLeave.m_dwCmd = FWL_MouseCommand::Leave; DispatchMessage(&msLeave, nullptr); @@ -424,8 +405,7 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) { m_pHover = pTarget; CFWL_MessageMouse msHover(nullptr, pTarget); - msHover.m_fx = pMsg->m_fx; - msHover.m_fy = pMsg->m_fy; + msHover.m_pos = pMsg->m_pos; msHover.m_dwFlags = 0; msHover.m_dwCmd = FWL_MouseCommand::Hover; DispatchMessage(&msHover, nullptr); -- cgit v1.2.3