//----------------------------------------------------------------------------- // Purpose: // Input : nChar - // nRepCnt - // nFlags - //----------------------------------------------------------------------------- bool Clipper3D::OnKeyDown2D(CMapView2D *pView, UINT nChar, UINT nRepCnt, UINT nFlags) { switch (nChar) { case 'O': { // // Toggle the rendering of measurements. // ToggleMeasurements(); CMapDoc *pDoc = pView->GetDocument(); pDoc->ToolUpdateViews(CMapView2D::updTool); return true; } case VK_RETURN: { // // Do the clip. // if (!IsEmpty() ) { SaveClipResults(); } return true; } case VK_ESCAPE: { OnEscape(); return true; } } return false; }
//----------------------------------------------------------------------------- // Purpose: Handles mouse move events in the 2D view. // Input : Per CWnd::OnMouseMove. // Output : Returns true if the message was handled, false if not. //----------------------------------------------------------------------------- bool Clipper3D::OnMouseMove2D(CMapView2D *pView, UINT nFlags, CPoint point) { CMapDoc *pDoc = pView->GetDocument(); if (!pDoc) { return false; } bool bCursorSet = false; BOOL bDisableSnap = (GetAsyncKeyState(VK_MENU) & 0x8000) ? TRUE : FALSE; // // Make sure the point is visible. // if (m_bLButtonDown) { pView->ToolScrollToPoint(point); } // // Convert to some odd coordinate space that the base tools code uses. // CPoint ptScreen = point; ptScreen.x += pView->GetScrollPos(SB_HORZ); ptScreen.y += pView->GetScrollPos(SB_VERT); // // Convert to world coords. // Vector vecWorld; pView->ClientToWorld(vecWorld, point); point.x = vecWorld[axHorz]; point.y = vecWorld[axVert]; // // Update status bar position display. // char szBuf[128]; m_pDocument->Snap(vecWorld); sprintf(szBuf, " @%.0f, %.0f ", vecWorld[axHorz], vecWorld[axVert]); SetStatusText(SBI_COORDS, szBuf); if (IsTranslating()) { // cursor is cross here bCursorSet = true; UINT uConstraints = 0; if (bDisableSnap) { uConstraints |= Tool3D::constrainNosnap; } if(nFlags & MK_CONTROL) { uConstraints |= Clipper3D::constrainMoveBoth; } if (UpdateTranslation(point, uConstraints, CSize(0,0))) { pDoc->ToolUpdateViews(CMapView2D::updTool); pDoc->Update3DViews(); } } else if (!IsEmpty()) { // // If the cursor is on a handle, set it to a cross. // if (HitTest(ptScreen, TRUE) != -1) { SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS)); bCursorSet = true; } } if (!bCursorSet) { SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); } return true; }
//----------------------------------------------------------------------------- // Purpose: // Input : pView - // nFlags - // point - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool Marker3D::OnMouseMove2D(CMapView2D *pView, UINT nFlags, CPoint point) { CMapDoc *pDoc = pView->GetDocument(); if (!pDoc) { return false; } bool bCursorSet = false; unsigned int uConstraints = 0; if ((GetAsyncKeyState(VK_MENU) & 0x8000)) { uConstraints |= Tool3D::constrainNosnap; } // // Make sure the point is visible. // if (m_bLButtonDown) { pView->ToolScrollToPoint(point); } // // Convert to some odd coordinate space that the base tools code uses. // CPoint ptHitTest = point; ptHitTest.x += pView->GetScrollPos(SB_HORZ); ptHitTest.y += pView->GetScrollPos(SB_VERT); // // Convert to world coords. // Vector vecWorld; pView->ClientToWorld(vecWorld, point); point.x = vecWorld[axHorz]; point.y = vecWorld[axVert]; // // Update status bar position display. // char szBuf[128]; m_pDocument->Snap(vecWorld); sprintf(szBuf, " @%.0f, %.0f ", vecWorld[axHorz], vecWorld[axVert]); SetStatusText(SBI_COORDS, szBuf); // // If we are currently dragging the marker, update that operation based on // the current cursor position and keyboard state. // if (IsTranslating()) { if (UpdateTranslation(point, uConstraints, CSize(0,0))) { pDoc->ToolUpdateViews(CMapView2D::updTool); pDoc->Update3DViews(); } // Don't change the cursor while dragging - it should remain a cross. bCursorSet = true; SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS)); } else if (!IsEmpty()) { // Don't change the cursor while dragging - it should remain a cross. bCursorSet = true; SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS)); } if (!bCursorSet) { SetCursor(s_hcurEntity); } return true; }