コード例 #1
0
ファイル: QueView.cpp プロジェクト: vSzemkel/Manam
void CQueView::OnMouseMove(const UINT nFlags, CPoint point)
{
    CScrollView::OnMouseMove(nFlags, point);
    ClientToDoc(&point);

    if (moving && selected_add) {
        RepaintRect(&selected_add->m_position);
        CRect screen;
        GetClientRect(&screen);
        ClientToDoc(&screen);
        if (point.x < screen.left || point.x > screen.right ||
            point.y > screen.top || point.y < screen.bottom) { // out of view mouse movement
            ReleaseCapture();
            theApp.unQueing = TRUE;
            moving = false;
            selected_add->m_position = vPos;
            Invalidate(FALSE);
        } else
            selected_add->m_position += CPoint(point.x - vPoint.x, point.y - vPoint.y);
        RepaintRect(&selected_add->m_position);
        vPoint = point;
        return;
    }
    if (theApp.unQueing && selected_add) {
        RepaintRect(&selected_add->m_position);
        theApp.unQueing = FALSE;
    }

    CDrawObj* pObj = GetDocument()->ObjectAtQue(point);
    ((CMainFrame *)AfxGetMainWnd())->SetStatusBarInfo(pObj ? pObj->info : "");
}
コード例 #2
0
ファイル: QueView.cpp プロジェクト: vSzemkel/Manam
void CQueView::OnLButtonDblClk(const UINT nFlags, CPoint point)
{
    ClientToDoc(&point);
    CDrawAdd* pObj = GetDocument()->ObjectAtQue(point);
    if (pObj)
        pObj->OnOpen(nullptr);
    else {
        GetDocument()->ArrangeQue();
        GetDocument()->GetPanelView<CQueView>()->Invalidate(FALSE);
        CScrollView::OnLButtonDblClk(nFlags, point);
    }
}
コード例 #3
0
void CNCaptureView::_UpdateMousePosInfo(const CPoint& point)
{
	if (m_pImage && !m_strMousePosInfo.IsEmpty())
	{
		CPoint ptLogical = point;
		ClientToDoc(&ptLogical);

		CMainFrame* pMainFrame = CNCaptureApplication::Instance()->GetMainFrame();
		FTLASSERT(pMainFrame);
		CString strInfo = TEXT("");

		CPoint ptMousePos(0, 0);
		ptLogical.Offset(m_rcDrawTarget.TopLeft());
		if (m_rcDrawTarget.PtInRect(ptLogical))
		{
			ptMousePos = ptLogical - m_rcDrawTarget.TopLeft();
		}

		//FTLTRACE(TEXT("OnMouseMove,ptMousePos=[%d,%d], rcDrawTarget=[%d,%d]\n"),
		//	ptMousePos.x, ptMousePos.y,
		//	m_rcDrawTarget.TopLeft().x, m_rcDrawTarget.TopLeft().y);
		STATUSBARINFO stStatusBarInfo;
		stStatusBarInfo.rcSelect = _GetSelectRect(ptMousePos);
		stStatusBarInfo.ptMouse = ptMousePos;
		stStatusBarInfo.csImageSize.SetSize(m_pImage->GetWidth(), m_pImage->GetHeight());
		stStatusBarInfo.bEnable = TRUE;
		if (pMainFrame)
		{
			pMainFrame->SetStatusInfo(&stStatusBarInfo);
		}


		//CRect rcSelect = _GetSelectRect(ptMousePos);
		//if (stStatusBarInfo.rcSelect.IsRectEmpty())
		//{
		//	strInfo.Format(_T("%d, %d, %d, %d"),
		//		m_pImage->GetWidth(), m_pImage->GetHeight(),
		//		stStatusBarInfo.ptMouse.x, stStatusBarInfo.ptMouse.y);
		//}
		//else
		//{
		//	strInfo.Format(_T("%d, %d, %d, %d %d"),
		//		m_pImage->GetWidth(), m_pImage->GetHeight(),
		//		rcSelect.left, rcSelect.top, rcSelect.Width(), rcSelect.Height());
		//}
		//tstring str = (LPCTSTR)strInfo;
		//pMainFrame->SetStatusInfo(str);
	}
}
コード例 #4
0
void CNCaptureView::OnCancelMode()// OnCaptureChanged(CWindow wnd)
{
#ifdef _DEBUG
	CPoint MouseClient;
	GetCursorPos(&MouseClient);
	ScreenToClient(&MouseClient);
	CPoint ptMouseLogical = MouseClient;
	ClientToDoc(&ptMouseLogical);

	FTLTRACE(TEXT("OnCancelMode, MouseClient=[%d,%d], MouseDoc=[%d,%d]\n"), 
		MouseClient.x, MouseClient.y, ptMouseLogical.x, ptMouseLogical.y);
#endif 
	CDrawCanvas<CNCaptureView>::OnCancelMode();

	SetMsgHandled(FALSE);
}
コード例 #5
0
void CNCaptureView::OnLButtonDown(UINT nFlags, CPoint point)
{
	if (m_pImage)
	{
		CRect rcDrawTarget = m_rcDrawTarget;
		rcDrawTarget.OffsetRect(-rcDrawTarget.TopLeft());
		CPoint ptLogical = point;
		ClientToDoc(&ptLogical);
		if (rcDrawTarget.PtInRect(ptLogical))
		{
			CDrawCanvas<CNCaptureView>::OnLButtonDown(nFlags, point);
			_SetSelectRectClipInfo(point);
		}
	}
	SetMsgHandled(FALSE);
}
コード例 #6
0
ファイル: QueView.cpp プロジェクト: vSzemkel/Manam
void CQueView::OnLButtonDown(const UINT nFlags, CPoint point)
{
    ClientToDoc(&point);
    CDrawAdd* pObj = GetDocument()->ObjectAtQue(point);
    if (!pObj) {
        if (selected_add) {
            CRect rect = selected_add->m_position;
            selected_add = nullptr;
            RepaintRect(&rect);
        }
        return;
    }

    if (selected_add) vPos = selected_add->m_position;
    selected_add = pObj;
    RepaintRect(&vPos);
    vPoint = point;
    vPos = selected_add->m_position;
    moving = true;
    RepaintRect(&vPos);
    SetCapture();
    CScrollView::OnLButtonDown(nFlags, point);
}
コード例 #7
0
void CNCaptureView::_SetScrollInfo(float newZoomScale, BOOL bUseCenterPoint)
{
	if (m_pImage && !m_pImage->IsNull())
	{
		BOOL bRet = FALSE;
		CRect rcClient;
		API_VERIFY(GetClientRect(&rcClient));

		//save old ptLogical
		CPoint ptMouseDevice(0, 0);
		API_VERIFY(::GetCursorPos(&ptMouseDevice));
		API_VERIFY(ScreenToClient(&ptMouseDevice));

		if (!rcClient.PtInRect(ptMouseDevice) || bUseCenterPoint)
		{
			ptMouseDevice = rcClient.CenterPoint();
		}

		CPoint ptOldLogical = ptMouseDevice;
		ClientToDoc(&ptOldLogical);
		//ptOldPos.Offset(m_rcDrawTarget.TopLeft());

		SetZoomScale(newZoomScale);

		//FTLTRACE(TEXT("Zoom=%f, image=[%d,%d], sizeAll=[%d,%d]\n"),
		//	s_FixedZoomScales[m_iFixedZoomIndex], m_pImage->GetWidth(), m_pImage->GetHeight(),
		//	(int)((float)m_pImage->GetWidth() * s_FixedZoomScales[m_iFixedZoomIndex]),
		//	(int)((float)m_pImage->GetHeight() * s_FixedZoomScales[m_iFixedZoomIndex]));

		SetScrollSize(m_pImage->GetWidth(), m_pImage->GetHeight(), TRUE, true);

		CPoint ptNewClient = ptOldLogical;

		//ptNewPos.Offset(-m_rcDrawTarget.TopLeft());
		DocToClient(&ptNewClient);
		CPoint ptNewOffset = ptNewClient;
		ptNewOffset.Offset(-ptMouseDevice);
		SetScrollOffset(ptNewOffset.x, ptNewOffset.y);

/*
		if (!GetSelection().empty())
		{
			CTextObject* pTextObject = dynamic_cast<CTextObject*>(GetSelection().front());
			if (pTextObject)
			{
				//SIZEL newExtent = {0};
				//newExtent.cy = (double)pTextObject->GetPosition().Height() * 2540 * newZoomScale * 96;
				//newExtent.cx = (double)pTextObject->GetPosition().Width() * 2540 * newZoomScale * 96;

				pTextObject->GetRichEditPanel()->SetZoom(m_sizeAll.cx, m_sizeLogAll.cx);
				//pTextObject->GetRichEditPanel()->SetExtent(&newExtent, TRUE);
			}
		}
*/
		//FTLTRACE(TEXT("ptMouseDevice=[%d,%d], ptOldLogical=[%d,%d], ptNewClient=[%d,%d], ptNewOffset=[%d,%d]\n"),
		//	ptMouseDevice.x, ptMouseDevice.y, ptOldLogical.x, ptOldLogical.y, ptNewClient.x, ptNewClient.y,
		//	ptNewOffset.x, ptNewOffset.y);

		_UpdateMousePosInfo(ptMouseDevice);
		SetCurrentToolType(CalcCurrentToolType());
		//DrawObjectList& SelectObjects = GetSelection();
		//if (SelectObjects.size() == 1 )
		//{
		//	CDrawObject* pDrawObj = SelectObjects.front();
		//	if (dotSelectRect == pDrawObj->GetDrawObjType())
		//	{
		//		CRect rcDevice = pDrawObj->GetPosition();
		//		DocToClient(&rcDevice);
		//		ScrollToView(rcDevice);
		//	}
		//}
	}
	else //make scrollbar disappear
	{
		SetZoomScale(s_FixedZoomScales[s_NormalZoomIndex]);
		SetScrollSize(1, 1, FALSE, FALSE);
	}
}
コード例 #8
0
ファイル: DrawVw.cpp プロジェクト: wanglaichen2/Mfc_Gui
CRect CDrawView::GetInitialPosition()
{
	CRect rect(10, 10, 10, 10);
	ClientToDoc(rect);
	return rect;
}