示例#1
0
		/*=============================================================================
		-- Updates the ScrollBar.
		=============================================================================*/
		void ScrollBar::_Update()
		{
			double oldScrollPosition = GetScrollPosition();

			//update the scroll position
			int knobLength = (mSpanDirection == SpanDirection::HORIZONTAL) ? mKnobButton.lock()->GetWidth() : mKnobButton.lock()->GetHeight();
			int knobMin = SCROLL_BAR_BUTTON_SIZE;
			int knobMax = ((mSpanDirection == SpanDirection::HORIZONTAL) ? GetWidth() : GetHeight()) - SCROLL_BAR_BUTTON_SIZE - knobLength;
			int innerRange = knobMax - knobMin;

			Vector2D<int> knobRelPos = mKnobButton.lock()->GetRelPos();
			int knobOffset = ((mSpanDirection == SpanDirection::HORIZONTAL) ? knobRelPos.x : knobRelPos.y) - SCROLL_BAR_BUTTON_SIZE;

			mScrollPosition = DivideD((double)knobOffset,(double)innerRange);

			//check if either increase/decrease button were pressed
			if (mAdjustTimer.GetTimeAndEnd() > SCROLL_BAR_ADJUST_DELAY)
			{
				if (mButtonDecrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() + 0.01);
				else if (mButtonIncrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() - 0.01);

				mAdjustTimer.Start();
			}

			if (GetScrollPosition() != oldScrollPosition)
				_SendElementMessageToListeners(ElementEvent::VALUE_CHANGED);
		}
示例#2
0
void CMapView::OnLButtonDown(UINT nFlags, CPoint point)
{
    if (m_HandDown)
    {
        m_Tracking = true;
        SetCapture();
        m_LastPoint = point;
    }
    else
    {
        CPoint pt = point + GetScrollPosition();

        int x  = pt.x / 40;
        int y  = pt.y / 40;
        int xe = (pt.x % 40) / 10;
        int ye = (pt.y % 40) / 10;

        CMapDoc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        int w = pDoc->GetWidth();
        int h = pDoc->GetHeight();

        if (w > 0 && h > 0 && x >= 0 && y >= 0 && x < w && y < h && xe >= 0 && xe < 4 && ye >= 0 && ye < 4)
        {
            int r = y*w + x;
            int e = ye*4 + xe;

            if (m_ViewMode == VIEW_MODE_ELEVATION)
            {
                pDoc->SetTileElevation(r, g_Elevation);
                CString str;
                str.Format("Change %d to %dm", r, g_Elevation);
                g_App.PrintStatus(str);

                CRect rect(CPoint(x*40, y*40), CSize(40,40));
                rect.OffsetRect(-GetScrollPosition());
                InvalidateRect(rect, FALSE);
            }
            else
            {
                pDoc->SetTile(r,e, g_Tile);
                CString str;
                str.Format("Change %d [%d] to %s", r,e, g_App.m_Elements[g_Tile].Name);
                g_App.PrintStatus(str);

                CRect rect(CPoint(x*40 + xe*10, y*40 + ye*10), CSize(10,10));
                rect.OffsetRect(-GetScrollPosition());
                InvalidateRect(rect, FALSE);
            }

            m_Tracking = true;
            SetCapture();
        }
    }

    Inherited::OnLButtonDown(nFlags, point);
}
示例#3
0
void DisplayView::OnLButtonUp(UINT nFlags, CPoint point)
{
    point += GetScrollPosition();

    // check for an overlay icon
    if (drag_mode == DisplayView::DRAG_OVERLAY_ICON) {
        Filter	*current = graph.FindFilterByPos(point);
        if (current && current == overlay_filter) {
            int icon = current->CheckIcons(point);
            if (icon >= 0) {
                OnOverlayIconClick(current->overlay_icons[icon], point);
            }
        }
    }

    if (drag_mode == DisplayView::DRAG_CONNECTION) {
        Pin *p1 = graph.FindPinByPos(new_connection_start);
        Pin *p2 = graph.FindPinByPos(new_connection_end);

        int ret = graph.ConnectPins(p1, p2);
        if (ret < 0) {
            // TODO: error message
        }
    }
    new_connection_start = CPoint(-100,-100);
    new_connection_end = CPoint(-101, -101);
    drag_mode = DisplayView::DRAG_GROUP;
    ReleaseCapture();
    graph.Dirty();
    Invalidate();
}
示例#4
0
BOOL CSpermView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
{
	// TODO: Add your message handler code here and/or call default

	CSize sz1=GetTotalSize();
	CRect rect;
	GetClientRect(rect);
	CSize sz2(rect.Width(),rect.Height());
	if(sz1.cy<sz2.cy)
		return CScrollView::OnMouseWheel(nFlags, zDelta, pt);;
	SCROLLINFO si;
	zDelta =  -zDelta;
	GetScrollInfo(SB_VERT,&si);
	si.nPos += zDelta/12;
	SetScrollInfo(SB_VERT,&si);


	CPoint sp=GetScrollPosition();
	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);
	DrawMemDCImage(pDC,rc);
	ReleaseDC(pDC);
	return CScrollView::OnMouseWheel(nFlags, zDelta, pt);
}
示例#5
0
void CResizableFormView::GetTotalClientRect(LPRECT lpRect)
{
	GetClientRect(lpRect);

	// get dialog template's size
	// (this is set in CFormView::Create)
	CSize size = GetTotalSize();

	// before initialization use dialog's size
	if (!m_bInitDone)
	{
		lpRect->right = lpRect->left + size.cx;
		lpRect->bottom = lpRect->top + size.cy;
		return;
	}

	// otherwise, give the correct size if scrollbars active

	if (m_nMapMode < 0)	// scrollbars disabled
		return;

	// enlarge reported client area when needed
	CRect rect(lpRect);
	if (rect.Width() < size.cx)
		rect.right = rect.left + size.cx;
	if (rect.Height() < size.cy)
		rect.bottom = rect.top + size.cy;

	rect.OffsetRect(-GetScrollPosition());
	*lpRect = rect;
}
示例#6
0
void CMapView::OnRButtonDown(UINT, CPoint point)
{
    CPoint pt = point + GetScrollPosition();

    int x  = pt.x / 40;
    int y  = pt.y / 40;
    int xe = (pt.x % 40) / 10;
    int ye = (pt.y % 40) / 10;

    CMapDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    int w = pDoc->GetWidth();
    int h = pDoc->GetHeight();

    if (w > 0 && h > 0 && x >= 0 && y >= 0 && x < w && y < h && xe >= 0 && xe < 4 && ye >= 0 && ye < 4)
    {
        int r = y*w + x;
        int e = ye*4 + xe;

        CTile Tile = pDoc->GetTile(r);
        g_Tile = Tile.E[e];
        g_Elevation = Tile.Elevation;

        CString str;
        str.Format("Select %s (%dm) from %d [%d]", g_App.m_Elements[g_Tile].Name, g_Elevation, r,e);
        g_App.PrintStatus(str);
    }
}
示例#7
0
void CUIDesignerView::OnDraw(CDC* pDrawDC)
{
	CUIDesignerDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	CMemDC memDC(*pDrawDC, this);
	CDC* pDC = &memDC.GetDC();

	CRect rectClient;
	GetClientRect(rectClient);
	CPoint point=GetScrollPosition();
	rectClient.OffsetRect(point);
	pDC->FillSolidRect(rectClient,RGB(255, 255, 255));

	CSize szFormSize=m_LayoutManager.GetForm()->GetInitSize();
	CSize szFormOffset(FORM_OFFSET_X,FORM_OFFSET_Y);
	CDC hCloneDC;
	HBITMAP hNewBitmap;
	hCloneDC.CreateCompatibleDC(pDC);
	hNewBitmap=::CreateCompatibleBitmap(pDC->GetSafeHdc(),szFormSize.cx,szFormSize.cy);
	HBITMAP hOldBitmap=(HBITMAP)hCloneDC.SelectObject(hNewBitmap);
	m_LayoutManager.Draw(&hCloneDC);
	pDC->BitBlt(szFormOffset.cx,szFormOffset.cy,szFormSize.cx,szFormSize.cy,&hCloneDC,0,0,SRCCOPY);
	hCloneDC.SelectObject(hOldBitmap);
	::DeleteDC(hCloneDC);
	::DeleteObject(hNewBitmap);

	m_MultiTracker.Draw(pDC,&szFormOffset);
}
示例#8
0
void CWFView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	CBTEditDoc* pDoc = GetDocument();
	CHeightMap *HeightMap = pDoc->GetHeightMap();
	RECT WindowRect;

	CPoint SPos = GetScrollPosition();

	// Make click point relative to window top left.
	GetWindowRect(&WindowRect);
	int ObjID = HeightMap->FindObjectHit2D(SPos.x,SPos.y,
											point.x-WindowRect.left,
											point.y-WindowRect.top);

	// If found an object then
   	if(ObjID >= 0) {
		// Select it
		HeightMap->DeSelectAll3DObjects();
   		HeightMap->Select3DObject(ObjID);
   		pDoc->Invalidate3D();
		UpdateAndValidate();

		// And bring up it's context menu.
   		CMenu Menu;
   		Menu.LoadMenu(IDR_2DPOPUP);
   		Menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
   							point.x,point.y,this);
   		m_CurrentObjectID = ObjID;
   	}
}
示例#9
0
// Position any selected objects.
//
void CWFView::PositionSelectedObjects(CPoint &point)
{
	CBTEditDoc* pDoc = GetDocument();
	CHeightMap* HeightMap = pDoc->GetHeightMap();

	SLONG	wx = (SLONG)point.x;
	SLONG	wz = (SLONG)point.y;
	CPoint ScrollPos = GetScrollPosition();

// Convert 2d view cursor position into world coordinate.
	ScrollPos.x -= pDoc->GetTextureWidth()*OVERSCAN;
	ScrollPos.y -= pDoc->GetTextureHeight()*OVERSCAN;
	pDoc->ConvertCoord2d3d(wx,wz,(SLONG)ScrollPos.x,(SLONG)ScrollPos.y);

	D3DVECTOR Position = {0.0F, 0.0F, 0.0F};
	Position.x = (float)wx;
	Position.y = 0.0F;
	Position.z = (float)-wz;

	HeightMap->Set3DObjectPosition(m_ObjectID,Position);
	HeightMap->SnapObject(m_ObjectID);

  	UpdateAndValidate();
  	pDoc->Invalidate3D();
}
示例#10
0
void CPrime95View::OnDraw(CDC* pDC)
{
	RECT	r;
	CPoint	scroll_offset;
	int	ypos;
	int	first_line, skip_lines, i, j;

	pDC->SetBkMode (TRANSPARENT);
	pDC->SetTextColor (GetSysColor (COLOR_WINDOWTEXT));

	GetClientRect (&r);
	scroll_offset = GetScrollPosition ();

/* If Lines[0] is empty, then output lines NumLines to 1 */
/* If Lines[0] has text, then output lines NumLines-1 to 0 */

	gwmutex_lock (&VIEW_LINES_MUTEX);
	first_line = Lines[0][0] ? NumLines - 1 : NumLines;
	skip_lines = (r.top + scroll_offset.y) / charHeight;
	if (skip_lines < NumLines) {
		i = first_line - skip_lines;
		j = NumLines - skip_lines;
		ypos = skip_lines * charHeight;
		for ( ; j; i--, j--) {
			pDC->TextOut (0, ypos, Lines[i], (int) strlen (Lines[i]));
			ypos += charHeight;
			if (ypos > r.bottom + scroll_offset.y) break;
		}
	}
	gwmutex_unlock (&VIEW_LINES_MUTEX);
}
void wxJigsawEditorCanvas::OnIdle( wxIdleEvent& event )
{	
	do
	{
		if(!HasCapture()) break;

		// get mouse in client coordinates
		wxPoint currentPos = ScreenToClient(wxGetMousePosition());

		//Update the offset to the next mouse down event
		if(m_View->GetSelectedObject())
		{
			wxPoint diagramPoint = PointToViewPoint(currentPos);
			wxPoint groupPosition = m_View->GetRealGroupPosition(m_View->GetSelectedObject());
			m_SelectedObjectOffset = wxSize(
				diagramPoint.x - groupPosition.x,
				diagramPoint.y - groupPosition.y);
		}

		// get scroll position
		wxPoint scrollPos = GetScrollPosition();
		

		// auto scroll
		// check current drag position and update scroll regularly
		if(AutoScroll(currentPos, scrollPos))
		{
			event.RequestMore();
		}
		FixViewOffset();
	}
	while(false);
}
示例#12
0
void CPrime95View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	CFrameWnd *parent;
	CSize	sz;
	CPoint	pos;
	int	new_scroll_height, new_scroll_width;

	parent = GetParentFrame();

	if (parent != NULL) {

		if (charHeight == 0) getCharSize ();

		sz = GetTotalSize ();

		new_scroll_height = NumLines * charHeight;
		new_scroll_width = MaxLineSize * charWidth;

		pos = GetScrollPosition ();
		pos.y += (new_scroll_height - sz.cy);
		if (pos.y < 0) pos.y = 0;
		sz.cx = new_scroll_width;
		sz.cy = new_scroll_height;
		SetScrollSizes (MM_TEXT, sz);
		ScrollToPosition (pos);
		parent->RecalcLayout ();
	}

	CScrollView::OnUpdate (pSender, lHint, pHint);
}
示例#13
0
文件: LeftView.cpp 项目: Jester68k/DP
void CLeftView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
	CVEDoc* pDoc = GetDocument();
	POSITION lpos;
	CClass* pCls;
	CModule* pMdl;
	
	pos = GetScrollPosition();
	pCls=(CClass*)pDoc->cls.GetAt(pDoc->cls.FindIndex(pDoc->ac));
	lpos=pCls->mdl.GetHeadPosition();
	while(lpos) {
		pMdl=(CModule*)pCls->mdl.GetNext(lpos);
		rt.m_rect = pMdl->rect;
		rt.m_rect.left -= pos.x;
		rt.m_rect.top -= pos.y;
		rt.m_rect.right -= pos.x;
		rt.m_rect.bottom -= pos.y;
		if (rt.HitTest(point)>=0) {
			OnProperties();
			pDoc->am=i;
//			InvalidateRect(NULL);
			return;
		}
	}
	pDoc->am=before_am;
	client_point=point;
	OnInsert();

	CScrollView::OnLButtonDblClk(nFlags, point);
}
示例#14
0
void CSpermView::OnButtonRightarrow() 
{
	CMainFrame* pMainFrm=(CMainFrame*)AfxGetMainWnd();
	CView3* pView3= (CView3*)pMainFrm->GetView3();
	CMorphaDetectDLG*& pMorphaDlg=pView3->m_pwndMorphaDetDlg;

	list<int>& m_lsOperateIndex=pView3->m_pwndMorphaDetDlg->m_lsOperateIndex;
	list<int>::iterator& m_itListIndex=pView3->m_pwndMorphaDetDlg->m_itListIndex;
	pMorphaDlg->DeleteSperm(*m_itListIndex);
	++m_itListIndex;
	pMorphaDlg->FormResultImage();

	CString str;
	str.Format("目前一共检测了%d个视野,%d个精子,其中%d个正常,%d个异常.",
		pMorphaDlg->m_nVideoFiled,pMorphaDlg->m_MhNum.AbnormalSpermNum+pMorphaDlg->m_MhNum.NormalSpermNum,
		pMorphaDlg->m_MhNum.NormalSpermNum,pMorphaDlg->m_MhNum.AbnormalSpermNum);
	pMorphaDlg->GetDlgItem(IDC_DETECT_INFO)->SetWindowText(str);

	CPoint sp=GetScrollPosition();
	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);
	DrawMemDCImage(pDC,rc);
	ReleaseDC(pDC);
}
示例#15
0
afx_msg void
MFCSequenceEditor::OnRButtonUp(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
}
示例#16
0
    void PreviousItem()
    {
        if (GetSelItemIdx() != 0) {
			SetSelItemByIdx(GetSelItemIdx()-1);
			if (GetScrollPosition() > GetSelItemIdx())
				ScrollPageUp();
		}
    }
示例#17
0
afx_msg void
MFCArrangeView::OnMButtonUp(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
}
示例#18
0
	//Imago #133 7/10
    void NextItem()
    {
        if (GetSelItemIdx() < m_vItems.GetCount() - 1) {
			SetSelItemByIdx(GetSelItemIdx()+1);
			if ((GetScrollPosition() + m_cVisibleItems) <= GetSelItemIdx())
				ScrollPageDown();
		}
    }
示例#19
0
void CImconView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CImconDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

  if (m_bScaleToWindow)
    return;

  m_ptScrollOffset       = GetScrollPosition();

  if (m_bSelection)
    DrawSelectionRect(&m_rectSelection);  // Delete old selection

	m_bSelection           = FALSE;
  m_ptStartPosition.x    = point.x;
  m_ptStartPosition.y    = point.y;
  m_rectSelection.left   = m_ptStartPosition.x;
  m_rectSelection.top    = m_ptStartPosition.y;
  m_rectSelection.right  = point.x;
  m_rectSelection.bottom = point.y;
  m_rectSelection       += m_ptScrollOffset;
  if (m_rectSelection.left >= (int) pDoc->m_uWidth)
    {
     m_rectSelection.left  = 0;
     m_rectSelection.right = 0;
     m_ptStartPosition.x   = pDoc->m_uWidth - 1;
    }
  if (m_rectSelection.top >= (int) pDoc->m_uHeight)
    {
     m_rectSelection.top    = 0;
     m_rectSelection.bottom = 0;
     m_ptStartPosition.y   = pDoc->m_uHeight - 1;
    }
  m_rectSelection.NormalizeRect();

        CString strSelectionText;
		CPoint pixel;
		BYTE cGray;
		pixel.x = point.x + m_ptScrollOffset.x;
		pixel.y = ((int) pDoc->m_uHeight - 1) - (point.y + m_ptScrollOffset.y);
		if ((pixel.x >= (int) pDoc->m_uWidth) || ( (pixel.y >= (int) pDoc->m_uHeight) && (pixel.y >= 0) ) )
		{
			strSelectionText.Format("");
		}
		else
		{

			cGray   = pDoc->m_Dib.GetPixelValue(pixel);

			strSelectionText.Format("Pixel (x,y): %d,%d mit Wert %d", pixel.x, pixel.y, cGray);
		}

  ((CMainFrame *) AfxGetMainWnd())->SetSelectionText((LPCSTR) strSelectionText);
  m_bSelectionStarted = TRUE;

	CScrollView::OnLButtonDown(nFlags, point);
}
void wxJigsawEditorCanvas::FixViewOffset()
{
	if(m_View)
	{
		wxPoint pt = GetScrollPosition();
		wxSize offset(-pt.x, -pt.y);
		m_View->SetViewOffset(offset);
	}
}
示例#21
0
void CSpermView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default	

	CMainFrame* pMainFrm=(CMainFrame*)AfxGetMainWnd();
	CView3* pView=(CView3*)pMainFrm->GetView3();
	CMorphaDetectDLG* pWnd=(CMorphaDetectDLG*)pView->m_pwndMorphaDetDlg;
	if(pWnd==NULL || pWnd->m_hWnd == NULL) return;

	vector<SpermImage>& m_vRSpermImage = pWnd->m_vRSpermImage;
	vector<SpermImage>& m_vOSpermImage = pWnd->m_vOSpermImage;
	vector<SperMopyParameter>&m_vSperMopyParameter = pWnd->m_vSperMopyParameter;
	vector<SpermRegion>&m_vSpermRegion =  pWnd->m_vSpermRegion ;
	vector<IsSperNormal>&m_vbIsNormal = pWnd->m_vbIsNormal;
    int i, iPos = -1, n;
	n = m_vRSpermImage.size();
	
	CPoint sp = GetScrollPosition(); // 得到视图滚动了多少(以象素为单位)
	point += sp;

	double d, min = 1<<20;
	CPoint p;
	for(i=0; i<n; i++)
	{
		if( m_vSpermRegion[i].isDeleted == TRUE ) continue;
        p = CPoint(m_vSpermRegion[i].SpermCenterPos.y, m_vSpermRegion[i].SpermCenterPos.x);
		if( IsInRect(point, pWnd->m_nR, p) )
		{
			d = dist(point, p);
			if(d<min)
			{
				min = d;
				iPos = i;
			}
		}
	}

	pWnd->m_nSelNO = iPos;
	m_nPos = iPos;
	
	if(m_nPos == -1 ) return;

	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);

	DrawMemDCImage(pDC,rc);

	ReleaseDC(pDC);
	pWnd->UpdateData(FALSE);
	pWnd->Invalidate();
	
	CScrollView::OnLButtonDown(nFlags, point);
}
示例#22
0
afx_msg void
MFCSequenceEditor::OnLButtonDown(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
	last_mouse_point = mouse_click = point;

	short	at_channel;
//	at_channel = Pix2Channel(point.y);
	Time	at_time;
	Pix2Time(point.x, at_time);

//	int		bar, barbeat, beattick;
//	at_time.GetBBQValue(bar, barbeat, beattick);
//	fprintf(stderr, "left button down: on point %d %d, channel %d, ticks %d t %d:%d.%d\n", point.x, point.y, at_channel, at_time.ticks, bar, barbeat, beattick);

	switch (currentTool) {
		case ID_ARTOOL_POINT: {
			DeselectAll();
//			mouse_instance = InstanceViewAtPoint(mouse_click);
//			if (mouse_instance) {
//				mouse_action = QUA_MOUSE_ACTION_MOVE_INSTANCE;
//				mouse_move_inst_offset.x = mouse_click.x - mouse_instance->bounds.left;
//				mouse_move_inst_offset.y = mouse_click.y;
//				mouse_instance->Select(true);
//			}
			break;
		}
		case ID_ARTOOL_SLICE: {
			break;
		}
		case ID_ARTOOL_RGSELECT: {
			fprintf(stderr, "region select\n");
			mouse_action = QUA_MOUSE_ACTION_REGION_SELECT;
			BRect	r(min(mouse_click.x,point.x),min(mouse_click.y,point.y),max(mouse_click.x,point.x),max(mouse_click.y,point.y));
			ChangeSelection(r);
			break;
		}
		case ID_ARTOOL_DRAW: {
//			mouse_instance = InstanceViewAtPoint(mouse_click);
//			if (mouse_instance) {
//				mouse_action = QUA_MOUSE_ACTION_SIZE_INSTANCE;
//				mouse_move_inst_offset.x = mouse_instance->bounds.left;
//				mouse_move_inst_offset.y = mouse_click.y;
//				Instance	*inst = mouse_instance->instance;
//				if (inst) {
//					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
//					quaLink->MoveInstance(inst->sym, -1, NULL, &at_time);
//				}
//			}
			break;
		}
	}
}
示例#23
0
afx_msg void
MFCSequenceEditor::OnLButtonUp(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
//	mouse_instance = NULL;
	mouse_action = QUA_MOUSE_ACTION_NONE;
}
void wxJigsawEditorCanvas::MotionUpdate(wxPoint currentPos)
{		
	// get scroll position
	wxPoint scrollPos = GetScrollPosition();
	wxPoint viewPos = PointToViewPoint(currentPos);
	AutoScroll(currentPos, scrollPos);
	FixViewOffset();
	FixActiveHotSpot(viewPos);
	RefreshBuffer();
}
示例#25
0
afx_msg void
MFCArrangeView::OnLButtonUp(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
	mouse_instance = NULL;
	mouse_action = QUA_MOUSE_ACTION_NONE;
}
void wxJigsawEditorCanvas::OnLeftDown( wxMouseEvent& event )
{
	SetFocus();
	wxRect displayRect = GetDisplayRect(GetScrollPosition());
	m_MouseDownPos = event.GetPosition();
	
	do
	{
		if(!m_View) break;
		
		wxPoint diagramPoint = PointToViewPoint(m_MouseDownPos);		
		wxJigsawShape * shape(NULL);		
		wxJigsawEditorCanvasHitTest hitTest = HitTest(m_MouseDownPos, infoSelectedShape, NULL);

		static wxJigsawShapeList m_PaletteShapeList;
		static wxJigsawShapeList *pPaletteShapeList = NULL;
		if(infoSelectedShape.GetResult() == wxJigsawShape::wxJigsawShapeHitTest::wxJS_HITTEST_SLOT)
		{
			//Must save the current selected category or save the current search			
			if(!pPaletteShapeList) pPaletteShapeList = wxJigsawEditorMainFrame::Get()->GetPalette()->GetShapes();
			wxJigsawEditorMainFrame::Get()->SearchStyle(infoSelectedShape.GetInputParameterStyle());
		}
		else if(pPaletteShapeList)
		{
			//Restore the search or selected category
			if(wxJigsawEditorMainFrame::Get()->IsSearchStyleSelected())
			{
				wxJigsawEditorMainFrame::Get()->GetPalette()->SetShapes(pPaletteShapeList);
				wxJigsawEditorMainFrame::Get()->GetPalette()->Refresh();
				wxJigsawEditorMainFrame::Get()->GetPalette()->AdjustScrollBars();
			}
			pPaletteShapeList = NULL;			
		}

		switch(hitTest)
		{
		case wxJSEC_HITTEST_SHAPE:
			shape = m_View->GetShapeFromPoint(m_DoubleBufferDC, diagramPoint, infoSelectedShape, NULL);			
			if(shape)
			{				
				SetSelectedShape(shape);
				CaptureMouse();							
			}
			break;
		case wxJSEC_HITTEST_NONE:
			SetSelectedObject(NULL);
		default:
			break;
		}
	}
	while(false);

	RefreshBuffer();
}
示例#27
0
void CWFView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	CBTEditDoc* pDoc = GetDocument();
	int	MinPos,MaxPos;
	SCROLLINFO ScrollInfo;

	CPoint ScrollPos = GetScrollPosition();
	m_ScrollX = ScrollPos.x;
	m_ScrollY = ScrollPos.y;
//	pDoc->GetScrollPosition((SLONG*)&m_ScrollX,(SLONG*)&m_ScrollY);

	GetScrollInfo( SB_HORZ, &ScrollInfo, SIF_ALL );
	MinPos = ScrollInfo.nMin;
	MaxPos = ScrollInfo.nMax-ScrollInfo.nPage;

	switch(nSBCode) {
		case	SB_THUMBPOSITION:
		case	SB_THUMBTRACK:
			m_ScrollX = nPos;
			break;
		case	SB_LINELEFT:
			m_ScrollX -= pDoc->GetTextureWidth();
			if(m_ScrollX < MinPos) m_ScrollX = MinPos;
			break;
		case	SB_LINERIGHT:
			m_ScrollX += pDoc->GetTextureWidth();
			if(m_ScrollX > MaxPos) m_ScrollX = MaxPos;
			break;
		case	SB_PAGELEFT:
			m_ScrollX -= ScrollInfo.nPage;
			if(m_ScrollX < MinPos) m_ScrollX = MinPos;
			break;
		case	SB_PAGERIGHT:
			m_ScrollX += ScrollInfo.nPage;
			if(m_ScrollX > MaxPos) m_ScrollX = MaxPos;
			break;
	}

	m_ScrollX /= pDoc->GetTextureWidth();
	m_ScrollX *= pDoc->GetTextureWidth();

	pDoc->RegisterScrollPosition(m_ScrollX-pDoc->GetTextureWidth()*OVERSCAN,m_ScrollY-pDoc->GetTextureHeight()*OVERSCAN);
  	UpdateAndValidate();

	if(pDoc->Get2DMode() == M2D_WORLD) {
		if(pDoc->GetAutoSync()) {
			pDoc->Set3DViewPos();	// Bind views.
  			pDoc->Invalidate3D();
		}
	}


	SetScrollPos( SB_HORZ, m_ScrollX, TRUE );
}
示例#28
0
void CSpermView::UserShowSperm()
{
	CPoint sp=GetScrollPosition();
	CRect rc;
	GetClientRect(rc);
	CDC* pDC=GetDC();
	rc.bottom+=sp.y;
	rc.right+=sp.x;
	pDC->SetViewportOrg(-sp);
	DrawMemDCImage(pDC,rc);
	ReleaseDC(pDC);
}
示例#29
0
void CQueueView::OnDraw(CDC* pDC)
{
	CRect	cb;
	pDC->GetClipBox(cb);
	CPoint	sp = GetScrollPosition();
	if (m_PrevScrollPos != sp) {
		UpdateView(FALSE);	// don't invalidate
		m_PrevScrollPos = sp;
	}
	pDC->BitBlt(cb.left, cb.top, cb.Width(), cb.Height(), 
		&m_DC, cb.left - sp.x, cb.top - sp.y, SRCCOPY);
}
示例#30
0
void DisplayView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
    point += GetScrollPosition();

    // find out if there is any filter being selected
    current_filter = graph.FindFilterByPos(point);
    if (!current_filter) return ;

    // check for a pin - will have different menu
    current_pin = current_filter->FindPinByPos(point, false);
    OnPropertyPage();
}