Example #1
0
LONG CSkinTab::TabItemHitTest(POINT pt)
{
    CRect skinRect = GetSkinRect();
    CPoint point = pt;
    point.Offset(-skinRect.left, -skinRect.top);

    if (m_bHasButton && m_rcButton.PtInRect(point))
        return -2;

    vector<SkinTabItemInfo>::size_type vecSize = m_vecTabItems.size();
    if (m_nTabItemSelected >= 0 && m_nTabItemSelected < (LONG)vecSize) {
        if (m_vecTabItems[m_nTabItemSelected].rcRect.PtInRect(point))
            return m_nTabItemSelected;
    }

    for (vector<SkinTabItemInfo>::size_type i=0; i<vecSize; i++) {

        if (m_vecTabItems[i].rcRect.PtInRect(point))
		{		
			CRect rcButton = m_rcButton;
			CRect itemRect = m_vecTabItems[i].rcRect;
			if ((m_bHasButton&&itemRect.right > rcButton.left)
				||itemRect.right >skinRect.right
				)
			{
				return -1;//绘制的按钮超出范围,终止
			}
			else
                return (LONG)i;
		}
    }

    return -1;
}
Example #2
0
bool KMLReader::characters(const QString &ch)
{
    if (is_point&&is_LineString)
    {
        QStringList list1, list2;
        list1 = ch.split(QRegExp("[ ]"), QString::SkipEmptyParts);
        QStringListIterator iterator1(list1);
        while (iterator1.hasNext())
        {
            CPoint f;
            list2 = iterator1.next().split(QRegExp("[,]"), QString::SkipEmptyParts);
            QStringListIterator iterator2(list2);
            bool ok;
            double y = iterator2.next().toDouble(&ok);
            if (!ok||y<-180||y>180) return true;
            double x = iterator2.next().toDouble(&ok);
            if (!ok||x<-90||x>90) return true;
            if (iterator2.hasNext())
            {
                double z = iterator2.next().toDouble(&ok);
                if (!ok) return true;
                f.setData(x,y,z);
                has_ele=true;
            }
            else
            {
                f.setData(x,y);
                if (has_ele==true) has_ele=false;
            }
            points.insert(points.size(),f);
        }
    }
    return true;
}
Example #3
0
void Draw_PointsOnProjections(list<CPoint> points, char* name = NULL)
{
	//int iSlices = The3DImage->m_iSlices;
	//int iRows = The3DImage->m_iRows;
	int iCols = The3DImage->m_iCols;
  /* come up with a better way to handle this case that doesn't violate
     char* = const char*
	if (name == NULL)
		name = "";
  */

	string output_path = gConfig.GetOutputPath();
	string image_name = gConfig.GetImageName();
	string file_name;
	CImage* XY = NULL;
	CPoint pPoint;

	XY = new CImage(*CanvasXY);
	XY->RemovePixels(5);

	list<CPoint>::iterator i;
	for (i = points.begin(); i != points.end(); i++)
	{
		pPoint = *i;
		if(pPoint.m_iX > iCols)
			pPoint.Print();
		else
			XY->MarkCrosshairXY(&pPoint, 2);
	}

	file_name = output_path + image_name + name + "PointsXY.tif";
	XY->WriteTIFF(file_name);
}
Example #4
0
void CView2::OnReportItemRClick(NMHDR* pNotifyStruct, LRESULT *)
{
	XTP_NM_REPORTRECORDITEM* pNMGV = (XTP_NM_REPORTRECORDITEM*)(pNotifyStruct);

	CPoint point;
	GetCursorPos(&point);

	if (point.x == -1 && point.y == -1)
	{
		//keystroke invocation
		CRect rect;
		GetClientRect(rect);
		ClientToScreen(rect);

		point = rect.TopLeft();
		point.Offset(5, 5);
	}

	CMenu menu;
	VERIFY(menu.CreatePopupMenu());

	menu.AppendMenu(MF_STRING, 0x14, _T("±£´æ¶©µ¥"));

	int nCmd = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
		, point.x, point.y, this);
	switch (nCmd)
	{
	case 0x14:
		SaveOrder();
		break;
	}

}
Example #5
0
// This function checks for shift-F10 to pop-up the right-click menu in the
// toolbar.
BOOL CDkToolBar::PreTranslateMessage(MSG* pMsg)
{
		BOOL		 handled;		// indicates if message was handled

	// if user hit shift-F10 or if he hit the context menu key on his keyboard
	if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) &&
		(pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||
		(pMsg->message == WM_CONTEXTMENU))
	{
		CRect rect;
		GetClientRect(rect);
		ClientToScreen(rect);

		CPoint point = rect.TopLeft();
		point.Offset(5, 5);
		OnContextMenu(NULL, point);

		handled = TRUE;
	}

	// else let the base class handle this one
	else
	{
		handled = CToolBar::PreTranslateMessage(pMsg);
	}
	return handled;
}
Example #6
0
//-----------------------------------------------------------------------------
void D2DDrawContext::drawEllipse (const CRect &_rect, const CDrawStyle drawStyle)
{
	if (renderTarget == 0)
		return;
	D2DApplyClip ac (this);
	if (ac.isEmpty ())
		return;
	CRect rect (_rect);
	if (currentState.drawMode.integralMode ())
		pixelAllign (rect);
	CPoint center (rect.getTopLeft ());
	center.offset (rect.getWidth () / 2., rect.getHeight () / 2.);
	D2D1_ELLIPSE ellipse;
	ellipse.point = makeD2DPoint (center);
	ellipse.radiusX = (FLOAT)(rect.getWidth () / 2.);
	ellipse.radiusY = (FLOAT)(rect.getHeight () / 2.);
	if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
	{
		renderTarget->FillEllipse (ellipse, fillBrush);
	}
	if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
	{
		renderTarget->DrawEllipse (ellipse, strokeBrush, (FLOAT)currentState.frameWidth, strokeStyle);
	}
}
Example #7
0
void LTPenMarking::OnMouseMove( CDC* pdcAct, CPoint pt, CPoint ptOffset )
{
	CPoint ptStart = lst_Points.back();
	CPoint ptEnd = pt;
	lst_Points.push_back(pt);

	// Prepare invalidation area on client rect
	CRect rInv;
	rInv.SetRect(ptStart, ptEnd);
	rInv.NormalizeRect();
	rInv.InflateRect(i_Width, i_Width);

	// Paint on buffer
	ptStart.Offset(ptOffset);
	ptEnd.Offset(ptOffset);

	CDC* pDC = p_Screenshot->GetDC();
	int i = pDC->SaveDC();

	//GDI+ draw
	Gdiplus::Graphics graphics(pDC->m_hDC);
	Gdiplus::Pen      pen(Gdiplus::Color(255, RGB_PARAMS(cr_Line)), (Gdiplus::REAL)i_Width);
	//graphics.SetCompositingMode(Gdiplus::CompositingMode::CompositingModeSourceOver);
	graphics.SetSmoothingMode(Gdiplus::SmoothingMode::SmoothingModeHighQuality);
	graphics.DrawLine(&pen, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);


	pDC->RestoreDC(i);
	// Copy from buffer to client rect		
	pdcAct->BitBlt(rInv.left, rInv.top, rInv.Width(), rInv.Height(), pDC, 
		ptOffset.x + rInv.left, ptOffset.y + rInv.top, SRCCOPY);
}
Example #8
0
// assignment operator
CPoint CPoint::operator=(const CPoint& p)
{
    m_XPos = p.XPos();
    m_YPos = p.YPos();

    return *this;
}
Example #9
0
CRGBColor CPainter::ReadPoint(const CPoint& Point)
{
	CPoint RealPoint = (m_pWindow != 0) ? Point + m_pWindow->GetClientRect().TopLeft() : Point;
	Uint32 PixelColor = 0;
	if (CRect(0, 0, m_pSurface->w, m_pSurface->h).HitTest(RealPoint) == CRect::RELPOS_INSIDE)
	{
		Uint8* PixelOffset = static_cast<Uint8*>(m_pSurface->pixels) +
			m_pSurface->format->BytesPerPixel * RealPoint.XPos() + m_pSurface->pitch * RealPoint.YPos();
		switch (m_pSurface->format->BytesPerPixel)
		{
		case 1: // 8 bpp
			PixelColor = *reinterpret_cast<Uint8*>(PixelOffset);
			break;
		case 2: // 16 bpp
			PixelColor = *reinterpret_cast<Uint16*>(PixelOffset);
			break;
		case 3: // 24 bpp
		{
			Uint8* pPixelDest = reinterpret_cast<Uint8*>(&PixelColor);
			Uint8* pPixelSource = reinterpret_cast<Uint8*>(PixelOffset);
			*pPixelDest = *pPixelSource;
			*(++pPixelDest) = *(++pPixelSource);
			*(++pPixelDest) = *(++pPixelSource);
			break;
		}
		case 4: // 32 bpp
			PixelColor = *reinterpret_cast<Uint32*>(PixelOffset);
			break;
		default:
			throw(Wg_Ex_SDL("CPainter::DrawPoint : Unrecognized BytesPerPixel."));
			break;
		}
	}
	return CRGBColor(&PixelColor, m_pSurface->format);
}
void CXTPSkinObjectTab::DrawTabIcon(CDC* pDC, CRect& rcItem, int iItem)
{
	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	TC_ITEM tci;
	tci.mask = TCIF_IMAGE;

	BOOL bResult = pTabCtrl->GetItem(iItem, &tci);

#ifdef _UNICODE
	if (!bResult)
	{
		TC_ITEMA tcia;
		::ZeroMemory(&tcia, sizeof(TC_ITEMA));

		tcia.mask = TCIF_IMAGE;

		bResult = (BOOL)::SendMessage(pTabCtrl->m_hWnd, TCM_GETITEMA, iItem, (LPARAM)&tcia);
		tci.iImage = tcia.iImage;
	}
#endif
	if (!bResult)
		return;

	CImageList* pImageList = pTabCtrl->GetImageList();
	if (!pImageList || tci.iImage < 0)
		return;

	CPoint point = rcItem.TopLeft();

	DWORD dwStyle = GetStyle();

	if (IsHorz(dwStyle))
	{
		point.Offset(GetMetrics()->m_cxEdge * 2, IsTop(dwStyle) ? GetMetrics()->m_cyEdge : 1);
	}
	else
	{
		point.Offset(IsLeft(dwStyle) ? GetMetrics()->m_cxEdge : 1, GetMetrics()->m_cyEdge * 2);
	}

	// Draw any associated icons.
	pImageList->Draw(pDC, tci.iImage, point, ILD_TRANSPARENT);

	IMAGEINFO info;
	::ZeroMemory(&info, sizeof(info));

	pImageList->GetImageInfo(tci.iImage, &info);
	CRect rcImage(info.rcImage);

	if (IsHorz(dwStyle))
	{
		rcItem.left += rcImage.Width() + GetMetrics()->m_cxEdge;
	}
	else
	{
		rcItem.top += rcImage.Height() + GetMetrics()->m_cyEdge;
	}
}
Example #11
0
void CBezierBinder::Draw(HDC dc, HWND hwndOwner, POINT ptOffset)
{
	//	ATLASSERT(dc);
	Graphics graphics(dc);
	Pen greenPen(Color::Green, 3);
	Pen redPen(Color::Red, 3);
	Pen bluePen(Color::Blue, 3);
	PointF curvePoints[64];
	SolidBrush redBrush(Color::Red);

	CRelationshipBinder::Draw(dc, hwndOwner, CPoint(0, 0));

	CPoint source(m_source);
	CPoint dest(m_dest);
	source.Offset(-ptOffset.x, -ptOffset.y);
	dest.Offset(-ptOffset.x, -ptOffset.y);

	CPoint bezOff;
	bezOff.x = -rcSource.Width() / 2;
	bezOff.y = -rcSource.Height() / 2;
	bezOff.Offset(ptOffset);

	CPoint ptFrom((rcSource.Width()/2) + rcSource.left, (rcSource.Height()/2) + rcSource.top);
	CPoint ptTo((rcTarget.Width()/2) + rcTarget.left, (rcTarget.Height()/2) + rcTarget.top);

	if (m_source.x == 0 && m_source.y == 0 && m_dest.x == 0 && m_dest.y ==0)
	{
		m_source = ptFrom;
		m_dest = ptTo;
	}

	HPEN oldPen = (HPEN)::SelectObject(dc, (LPVOID)::GetStockObject(BLACK_PEN));
	CPoint rcOld;

	if (ptFrom == source && ptTo == dest)
	{
		unsigned i = 0;
		for(std::list<CPoint>::iterator itr = m_points.begin(); itr != m_points.end(); ++itr, ++i)
		{
			if (itr != m_points.begin())
//				::LineTo(dc, itr->x - bezOff.x, itr->y - bezOff.y);
			::MoveToEx(dc, itr->x - bezOff.x, itr->y - bezOff.y, &rcOld);
			curvePoints[i] = PointF(itr->x - bezOff.x, itr->y - bezOff.y);
		}
		graphics.DrawBeziers(&greenPen, curvePoints, i);
//		for(int j = 0; j < i; ++j)
		{
//			graphics.FillEllipse(&redBrush, Rect(curvePoints[j].X - 5, curvePoints[j].Y - 5, 10, 10));
		}
	}
	else
	{
		::MoveToEx(dc, ptFrom.x, ptFrom.y, &rcOld);
//		::LineTo(dc, ptTo.x, ptTo.y);
		graphics.DrawLine(&greenPen, PointF(ptFrom.x, ptFrom.y), PointF(ptTo.x, ptTo.y));
	}

	SelectObject(dc, (LPVOID)oldPen);
}
Example #12
0
void CIconButton::DrawBitmap(CDC* pDC,CRect& rect)
{
	CPoint ptCenter = rect.CenterPoint();
	UINT nFlags = DSS_NORMAL | DST_BITMAP;
	ptCenter.Offset(- m_nImageWidth / 2,- m_nImageHeight / 2);
	CPoint ptLT = ptCenter;
	pDC->DrawState(ptLT, CSize(m_nImageWidth, m_nImageHeight), &m_bitmap, nFlags, (CBrush *)NULL);
}
Example #13
0
// subtract the points
CPoint CPoint::operator-(const CPoint& p) const
{
    CPoint result;
    result.SetX(m_XPos - p.XPos());
    result.SetY(m_YPos - p.YPos());

    return result;
}
Example #14
0
//-----------------------------------------------------------------------------
void CGDrawContext::drawBitmap (CBitmap* bitmap, const CRect& inRect, const CPoint& inOffset, float alpha)
{
	if (bitmap == 0 || alpha == 0.f)
		return;
	CGBitmap* cgBitmap = bitmap->getPlatformBitmap () ? dynamic_cast<CGBitmap*> (bitmap->getPlatformBitmap ()) : 0;
	CGImageRef image = cgBitmap ? cgBitmap->getCGImage () : 0;
	if (image)
	{
		CGContextRef context = beginCGContext (false, true);
		if (context)
		{
			CRect rect (inRect);
			rect.makeIntegral ();
			CPoint offset (inOffset);
			offset.makeIntegral ();

			CGContextSetAlpha (context, (CGFloat)alpha*currentState.globalAlpha);

			CGRect dest;
			dest.origin.x = rect.left - offset.h;
			dest.origin.y = -(rect.top) - (bitmap->getHeight () - offset.v);
			dest.size.width = cgBitmap->getSize ().x;
			dest.size.height = cgBitmap->getSize ().y;
			
			CGRect clipRect2;
			clipRect2.origin.x = rect.left;
			clipRect2.origin.y = -(rect.top) - rect.height ();
			clipRect2.size.width = rect.width (); 
			clipRect2.size.height = rect.height ();
		
			CGContextClipToRect (context, clipRect2);

			CGLayerRef layer = cgBitmap->getCGLayer ();
			if (layer == 0)
			{
				BitmapDrawCountMap::iterator it = bitmapDrawCount.find (cgBitmap);
				if (it == bitmapDrawCount.end ())
				{
					bitmapDrawCount.insert (std::pair<CGBitmap*, int32_t> (cgBitmap, 1));
					CGContextDrawImage (context, dest, image);
				}
				else
				{
					it->second++;
					layer = cgBitmap->createCGLayer (context);
				}
			}
			if (layer)
			{
				CGContextDrawLayerInRect (context, dest, layer);
			}

			releaseCGContext (context);
		}
	}
}
Example #15
0
// 打开弹出对话框
void CControlBase::OpenDlgPopup(CDlgPopup *pWndPopup, CRect rc, UINT uMessageID)
{
	ASSERT(pWndPopup);
	CloseDlgPopup();
	CPoint point;
	point.SetPoint(rc.left, rc.top);
	::ClientToScreen(GetHWND(), &point);
	rc.OffsetRect(point.x-rc.left, point.y-rc.top);
	m_pWndPopup = pWndPopup;
	m_pWndPopup->Create(CWnd::FromHandle(GetHWND()), rc, uMessageID);
	m_pWndPopup->ShowWindow(SW_SHOW);
}
Example #16
0
void CSignatureWnd::OnPaint() 
{
	CRect rect;
	GetClientRect(&rect);
	CPoint pt = rect.CenterPoint();
	
	CPaintDC dc(this); // device context for painting

	CPen* p = dc.SelectObject(&m_Pen);

	int nMargin = rect.Width() / 20;

	int nWidth = 12;
	int nHeight = nWidth * 1.5;
	CRect rectX(0, 0, nWidth, nHeight);

	pt.x = nMargin;
	rectX.OffsetRect(pt.x, pt.y - (nHeight / 1));
	pt = rectX.TopLeft();
	dc.MoveTo(pt);
	pt = rectX.BottomRight();
	dc.LineTo(pt);
	pt.x -= rectX.Width();
	dc.MoveTo(pt);
	pt = rectX.TopLeft();
	pt.x += rectX.Width();
	dc.LineTo(pt);
	pt = rectX.BottomRight();
	pt.Offset(3, 3);
	dc.MoveTo(pt);
	pt.x = rect.Width() - nMargin;
	dc.LineTo(pt);

	if (!m_nPoint)
		return;

	int i = 0;
	CPoint pZero(0,0);
	while (i < m_nPoint)
	{
		int k = 0, m = i;
		while (m_SaveLine[i] != pZero && i < m_nPoint)
		{
			i++;
			k++;
		}
		i++;
		dc.Polyline(&(m_SaveLine[m]), k);
	}

	dc.SelectObject(p);
}
Example #17
0
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) {
	if((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) &&
	   (pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||
	   (pMsg->message == WM_CONTEXTMENU)) {
		CRect rect;
		GetClientRect(rect);
		ClientToScreen(rect);
		CPoint point = rect.TopLeft();
		point.Offset(5, 5);
		OnContextMenu(NULL, point);
		return TRUE;
	}
	return CFrameWnd::PreTranslateMessage(pMsg);
}
Example #18
0
void StreamTool::CreateElement(CPoint pos, Element *&e){
	string str = "Stream";
	CString s;
	CPoint p;
	s = str.c_str();
	e = new Stream(4, pos, s);
	if (e->isStream()){
		p.SetPoint(pos.x - 60, pos.y - 40);
		Stream *tempse = (Stream*)e;
		currentd->SetStartElementforStream(tempse, p);
		p.SetPoint(pos.x + 60, pos.y + 40);
		currentd->SetEndElementforStream(tempse, p);
	}
}
Example #19
0
BOOL CUIDesignerView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	CPoint point;
	GetCursorPos(&point);
	this->ScreenToClient(&point);
	point-=m_ptDPtoLP;
	point.Offset(-FORM_OFFSET_X,-FORM_OFFSET_Y);

	if (pWnd==this&&m_MultiTracker.SetCursor(point,nHitTest))
		return TRUE;

	return __super::OnSetCursor(pWnd, nHitTest, message);
}
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);
	}
}
Example #21
0
void CFoosballDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
	if (m_ColorTool.ToolMode == TOOL_FIELD) m_ColorTool.SelectDC->Rectangle(&m_ColorTool.OldAOI);		// clear field selection display
	point.Offset(-ImageRect.left - 2, -ImageRect.top - 2);
	m_ColorTool.ToolLButtonDown(point);
	__super::OnLButtonDown(nFlags, point);
}
void CMyView::OnContextMenu(CWnd*, CPoint point)
{

    // CG: This block was added by the Pop-up Menu component
    {
        if (point.x == -1 && point.y == -1) {
            //keystroke invocation
            CRect rect;
            GetClientRect(rect);
            ClientToScreen(rect);

            point = rect.TopLeft();
            point.Offset(5, 5);
        }

        CMenu menu;
        VERIFY(menu.LoadMenu(CG_IDR_POPUP_MY_VIEW));

        CMenu* pPopup = menu.GetSubMenu(0);
        ASSERT(pPopup != NULL);
        CWnd* pWndPopupOwner = this;

        while (pWndPopupOwner->GetStyle() & WS_CHILD)
            pWndPopupOwner = pWndPopupOwner->GetParent();

        pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
                               pWndPopupOwner);
    }

}
BOOL CXTPFlowGraphPaintManager::HitTestConnectionArea(const CXTPFlowGraphConnectionPoint* pPoint, CPoint point)
{
	CXTPFlowGraphNode* pNode = pPoint->GetNode();
	if (!pNode)
		return FALSE;

	CXTPFlowGraphPage* pPage = pNode->GetPage();
	point = pPage->ScreenToPage(point);
	point.Offset(-pNode->GetLocation());


	CRect rc = pPoint->m_rcPoint;

	if (pPoint->GetType() & xtpFlowGraphPointInput)
	{
		CRect rc(rc.left - m_nEllipseSize / 2, rc.top, rc.left + m_nEllipseSize / 2, rc.bottom);

		if (rc.PtInRect(point))
			return TRUE;
	}

	if (pPoint->GetType() & xtpFlowGraphPointOutput)
	{
		CRect rc(rc.right - m_nEllipseSize / 2, rc.top, rc.right + m_nEllipseSize / 2, rc.bottom);
		if (rc.PtInRect(point))
			return TRUE;
	}
	return FALSE;
}
Example #24
0
void Caret::show()
{
    if( frame_ ) 
    {
        CDrawContext* context = frame_->createDrawContext();
        context->setFrameColor( kBlackCColor );
        context->setLineWidth( 1 );

        CPoint p = position_;
        context->moveTo( p );
        p.offset( 0, height_ );
        context->lineTo( p );

        context->forget();
    }
}
Example #25
0
void CVarView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	// TODO: この位置にメッセージ ハンドラ用のコードを追加してください
	CPoint client_point;

	client_point = point;
	ScreenToClient(&client_point);	// スクリーン座標からクライアント座標へ変換する
	// CG: このブロックはポップアップ メニュー コンポーネントによって追加されました
	{
		if (point.x == -1 && point.y == -1){
			//キーストロークの発動
			CRect rect;
			GetClientRect(rect);
			ClientToScreen(rect);

			point = rect.TopLeft();
			point.Offset(5, 5);
		}

		CMenu menu;
		VERIFY(menu.LoadMenu(CG_IDR_POPUP_VARVIEW));

		CMenu* pPopup = menu.GetSubMenu(0);
		ASSERT(pPopup != NULL);
		CWnd* pWndPopupOwner = this;

		while (pWndPopupOwner->GetStyle() & WS_CHILD)
			pWndPopupOwner = pWndPopupOwner->GetParent();

		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
			pWndPopupOwner);
	}
}
Example #26
0
void CPainter::DrawVLine(int yStart, int yEnd, int x, const CRGBColor& LineColor)
{
	if (m_pWindow)
	{
		CPoint Offset = m_pWindow->GetClientRect().TopLeft();
		yStart += Offset.YPos();
		yEnd += Offset.YPos();
		x += Offset.XPos();
	}
	SDL_Rect Rect;
	Rect.x = stdex::safe_static_cast<short int>(x);
	Rect.y = stdex::safe_static_cast<short int>(std::min(yStart, yEnd));
	Rect.w = 1;
	Rect.h = stdex::safe_static_cast<short int>(std::max(yEnd - yStart + 1, yStart - yEnd + 1));
	SDL_FillRect(m_pSurface, &Rect, LineColor.SDLColor(m_pSurface->format));
}
Example #27
0
void CPainter::DrawHLine(int xStart, int xEnd, int y, const CRGBColor& LineColor)
{
	if (m_pWindow)
	{
		CPoint Offset = m_pWindow->GetClientRect().TopLeft();
		xStart += Offset.XPos();
		xEnd += Offset.XPos();
		y += Offset.YPos();
	}
	SDL_Rect Rect;
	Rect.x = stdex::safe_static_cast<short int>(std::min(xStart, xEnd));
	Rect.y = stdex::safe_static_cast<short int>(y);
	Rect.w = stdex::safe_static_cast<short int>(std::max(xEnd - xStart + 1, xStart - xEnd + 1));
	Rect.h = 1;
	SDL_FillRect(m_pSurface, &Rect, LineColor.SDLColor(m_pSurface->format));
}
Example #28
0
// 鼠标坐标变换
BOOL CDuiPanel::OnMousePointChange(CPoint& point)
{
	if(m_pDuiPluginObject)
	{
		return m_pDuiPluginObject->OnMousePointChange(point);
	}

	if(m_bEnableScroll && ((m_nVirtualHeight > m_rc.Height()) || (m_nVirtualWidth > m_rc.Width())))
	{
		// 计算显示位置
		CDuiScrollVertical* pScrollV = (CDuiScrollVertical*)m_pControScrollV;
		int nCurPosV = pScrollV->GetScrollCurrentPos();	// 当前top位置
		int nMaxRangeV = pScrollV->GetScrollMaxRange();
		int nVirtualTop = (nMaxRangeV > 0) ? nCurPosV*(m_nVirtualHeight-m_rc.Height())/nMaxRangeV : 0;	// 当前显示的是虚拟图片中什么位置开始的图片

		CDuiScrollHorizontal* pScrollH = (CDuiScrollHorizontal*)m_pControScrollH;
		int nCurPosH = pScrollH->GetScrollCurrentPos();	// 当前top位置
		int nMaxRangeH = pScrollH->GetScrollMaxRange();
		int nVirtualLeft = (nMaxRangeH > 0) ? nCurPosH*(m_nVirtualWidth-m_rc.Width())/nMaxRangeH : 0;	// 当前显示的是虚拟图片中什么位置开始的图片

		point.Offset(nVirtualLeft, nVirtualTop);

		return TRUE;
	}

	return FALSE;
}
Example #29
0
/**
 * @brief Offer a context menu
 */
void CMergeDiffDetailView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	// Create the menu and populate it with the available functions
	BCMenu menu;
	VERIFY(menu.LoadMenu(IDR_POPUP_MERGEDETAILVIEW));
	VERIFY(menu.LoadToolbar(IDR_MAINFRAME));
	theApp.TranslateMenu(menu.m_hMenu);

	BCMenu *pSub = (BCMenu *)menu.GetSubMenu(0);
	ASSERT(pSub != NULL);

	// Context menu opened using keyboard has no coordinates
	if (point.x == -1 && point.y == -1)
	{
		CRect rect;
		GetClientRect(rect);
		ClientToScreen(rect);

		point = rect.TopLeft();
		point.Offset(5, 5);
	}

	pSub->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
		point.x, point.y, AfxGetMainWnd());
}
Example #30
0
void CADDigitView::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	// TODO: Add your message handler code here
	if (point.x == -1 && point.y == -1)
	{
		//keystroke invocation
		CRect rect;
		GetClientRect(rect);
		ClientToScreen(rect);
		
		point = rect.TopLeft();
		point.Offset(5, 5);
	}
	
	CMenu menu;
	VERIFY(menu.LoadMenu(IDR_ShowMode));
	
	CMenu* pPopup = menu.GetSubMenu(0);
	ASSERT(pPopup != NULL);
	CWnd* pWndPopupOwner = this;
	
	while (pWndPopupOwner->GetStyle() & WS_CHILD)
		pWndPopupOwner = pWndPopupOwner->GetParent();
	
	pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner);
}