MCPcopy Create free account
hub / github.com/WinMerge/winmerge / OnMouseMove

Method OnMouseMove

Src/LocationView.cpp:584–619  ·  view source on GitHub ↗

* @brief Process drag action on a captured mouse. * * Reposition on every dragged movement. * The Screen update stress will be similar to a mouse wheeling.:-) */

Source from the content-addressed store, hash-verified

582 * The Screen update stress will be similar to a mouse wheeling.:-)
583 */
584void CLocationView::OnMouseMove(UINT nFlags, CPoint point)
585{
586 if (GetCapture() == this)
587 {
588 CMergeDoc *pDoc = GetDocument();
589 int nGroup = pDoc->GetActiveMergeView()->m_nThisGroup;
590
591 // Don't go above bars.
592 point.y = max(point.y, Y_OFFSET);
593
594 // Vertical scroll handlers are range safe, so there is no need to
595 // make sure value is valid and in range.
596 int nSubLine = (int) (m_pixInLines * (point.y - Y_OFFSET));
597 nSubLine -= pDoc->GetView(nGroup, 0)->GetScreenLines() / 2;
598 if (nSubLine < 0)
599 nSubLine = 0;
600
601 // Just a random choose as both view share the same scroll bar.
602 CWnd *pView = pDoc->GetView(nGroup, 0);
603
604 SCROLLINFO si = { sizeof SCROLLINFO };
605 si.fMask = SIF_POS;
606 si.nPos = nSubLine;
607 pView->SetScrollInfo(SB_VERT, &si);
608
609 // The views are child windows of a splitter windows. Splitter window
610 // doesn't accept scroll bar updates not send from scroll bar control.
611 // So we need to update both views.
612 int pane;
613 int nBuffers = pDoc->m_nBuffers;
614 for (pane = 0; pane < nBuffers; pane++)
615 pDoc->GetView(nGroup, pane)->SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, 0), NULL);
616 }
617
618 CView::OnMouseMove(nFlags, point);
619}
620
621int CLocationView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
622{

Callers

nothing calls this directly

Calls 3

maxClass · 0.85
GetActiveMergeViewMethod · 0.45
GetViewMethod · 0.45

Tested by

no test coverage detected