Пример #1
0
// Vista: Can not be used to workaround the problems with owner drawn tab control
BOOL CClosableTabCtrl::OnEraseBkgnd(CDC* pDC)
{
	// ==> Visual Studio 2010 Compatibility [Stulle/Avi-3k/ied] - Stulle
#if _MSC_VER<1600
	// ==> Design Settings [eWombat/Stulle] - Max
	/*
	return CTabCtrl::OnEraseBkgnd(pDC);
#else
	if(thePrefs.GetWindowsVersion() >= _WINVER_VISTA_)
		return CTabCtrl::OnEraseBkgnd(pDC);

	// Set brush to desired background color
	CBrush backBrush(GetSysColor(COLOR_BTNFACE));
	*/
	// Set brush to desired background color
	CBrush backBrush((m_clrBack != CLR_DEFAULT)?m_clrBack:GetSysColor(COLOR_BTNFACE));

	// Save old brush
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);

	CRect rect;
	pDC->GetClipBox(&rect);     // Erase the area needed

	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
        PATCOPY);
	pDC->SelectObject(pOldBrush);
	return TRUE;
#else
	if(thePrefs.GetWindowsVersion() >= _WINVER_VISTA_ && m_clrBack == CLR_DEFAULT)
		return CTabCtrl::OnEraseBkgnd(pDC);

	// Set brush to desired background color
	CBrush backBrush((m_clrBack != CLR_DEFAULT)?m_clrBack:GetSysColor(COLOR_BTNFACE));
	// <== Design Settings [eWombat/Stulle] - Max

	// Save old brush
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);

	// So it seems this finally got broken on VS2010 for XP... so when we erase background now we just set it ourself now...
	CRect rect;
	pDC->GetClipBox(&rect);     // Erase the area needed

	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
        PATCOPY);
	pDC->SelectObject(pOldBrush);
	return TRUE;
#endif
	// <== Visual Studio 2010 Compatibility [Stulle/Avi-3k/ied] - Stulle
}
Пример #2
0
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void tContextPanelCommon::DrawGradientFill( QPainter* pPainter ) const
{    
    if ( (/* m_PanelType == ePanel_Maintenance ||*/ m_PanelType == ePanel_Warning ) == false )
    {
        return;
    }

    QColor lightColour;
    QColor darkColour;
    switch ( m_PanelType )
    {
    case ePanel_Maintenance:
        lightColour = QColor( 20, 95, 179 );
        darkColour = QColor( 23, 68, 144 );
        break;
    case ePanel_Warning:
        lightColour = QColor( 237, 27, 36 );
        darkColour = QColor( 136, 7, 11 );
        break;
    default:
        Assert( false );
        break;
    }

    QLinearGradient grad( boundingRect().center().rx(), boundingRect().top(), boundingRect().center().rx(), boundingRect().bottom() );
    grad.setColorAt( 0, lightColour );
    grad.setColorAt( 1, darkColour );

    QBrush backBrush( grad );
    pPainter->setBrush( backBrush );
    pPainter->setPen( Qt::NoPen );
    pPainter->drawRoundedRect( boundingRect(), 5.0, 6.0, Qt::RelativeSize );
}
Пример #3
0
// Vista: Can not be used to workaround the problems with owner drawn tab control
BOOL CClosableTabCtrl::OnEraseBkgnd(CDC* pDC)
{
	//MORPH START - Changed by Stulle, Visual Studio 2010 Compatibility
#if _MSC_VER<1600
	return CTabCtrl::OnEraseBkgnd(pDC);
#else
	if(thePrefs.GetWindowsVersion() >= _WINVER_VISTA_)
		return CTabCtrl::OnEraseBkgnd(pDC);

	// Set brush to desired background color
	CBrush backBrush(GetSysColor(COLOR_BTNFACE));

	// Save old brush
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);

	// So it seems this finally got broken on VS2010 for XP... so when we erase background now we just set it ourself now...
	CRect rect;
	pDC->GetClipBox(&rect);     // Erase the area needed

	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
        PATCOPY);
	pDC->SelectObject(pOldBrush);
	return TRUE;
#endif
	//MORPH END   - Changed by Stulle, Visual Studio 2010 Compatibility
}
Пример #4
0
BOOL CDlgDeviceLedger::OnEraseBkgnd(CDC* pDC)
{
	//设置对话框背景色
	CBrush backBrush(RGB(218,255,251));
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);
	CRect rect;
	pDC->GetClipBox(&rect);

	//画需要的区域
	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
	pDC->SelectObject(pOldBrush);

	// TODO: 在此添加消息处理程序代码和/或调用默认值
	//CDC srcDC;
	//srcDC.CreateCompatibleDC(pDC);
	//CBitmap* pOldBmp;
	////pOldBmp = srcDC.SelectObject(m_pTitleBmp);
	//BITMAP bmp;
	////m_pTitleBmp->GetBitmap(&bmp);
	////pDC->SetStretchBltMode(COLORONCOLOR);
	////pDC->StretchBlt(0,MAIN_TITLE_HEIGHT + 1,m_WndRect.Width(),MAIN_BUTTON_HIGHT,&srcDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
	////srcDC.SelectObject(pOldBmp);
	//CRect winrc;

	//GetClientRect(&winrc);

	//pOldBmp = srcDC.SelectObject(m_pBackBmp);
	//m_pBackBmp->GetBitmap(&bmp);
	//pDC->StretchBlt(0,0,winrc.Width(),winrc.Height(),
	//	&srcDC,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
	//srcDC.SelectObject(pOldBmp);
	return TRUE;

	return CDialog::OnEraseBkgnd(pDC);
}
Пример #5
0
void CtestImageXView::OnDraw(CDC* pDC)
{
	CtestImageXDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	if (pDoc->m_bIsReady)
	{
		CSize sizeTotal;
		sizeTotal.cx = pDoc->m_nWidth;
		sizeTotal.cy = pDoc->m_nHeight;
		SetScrollSizes(MM_TEXT, sizeTotal);
		LONG LineBytes;
		LineBytes = (pDoc->m_nWidth+3)/4*4;
		BITMAPINFO* m_pBitmapInfo = (BITMAPINFO*)new char[sizeof(BITMAPINFO)];
		m_pBitmapInfo->bmiHeader.biClrUsed = 0;
		m_pBitmapInfo->bmiHeader.biBitCount = 8;
		m_pBitmapInfo->bmiHeader.biClrImportant = 0;
		m_pBitmapInfo->bmiHeader.biCompression = 0;
		m_pBitmapInfo->bmiHeader.biWidth = pDoc->m_nWidth;
		m_pBitmapInfo->bmiHeader.biHeight = pDoc->m_nHeight;
		m_pBitmapInfo->bmiHeader.biPlanes = 1;
		m_pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
		m_pBitmapInfo->bmiHeader.biSizeImage = pDoc->m_nHeight*LineBytes;
		m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;	
		m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;

		for (int i = 0; i < 256; ++i)
		{
			m_pBitmapInfo->bmiColors[i].rgbBlue = i;
			m_pBitmapInfo->bmiColors[i].rgbGreen = i;
			m_pBitmapInfo->bmiColors[i].rgbRed = i;
			m_pBitmapInfo->bmiColors[i].rgbReserved = 0;
		}
		
		StretchDIBits(pDC->GetSafeHdc(), 0, 0, m_pBitmapInfo->bmiHeader.biWidth,
			m_pBitmapInfo->bmiHeader.biHeight, 0, 0, m_pBitmapInfo->bmiHeader.biWidth,
			m_pBitmapInfo->bmiHeader.biHeight, pDoc->m_pBuf, m_pBitmapInfo, 
			DIB_RGB_COLORS, SRCCOPY);
	}
	else
	{
		CBrush backBrush(RGB(100, 100, 100));

		//保存旧的brush 
		CBrush* pOldBrush = pDC->SelectObject(&backBrush); 
		CRect rect; 
		pDC->GetClipBox(&rect);

		//画需要的区域
		pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY); 
		pDC->SelectObject(pOldBrush); 
	}
}
Пример #6
0
BOOL CWebDlg::OnEraseBkgnd(CDC* pDC) 
{
    CBrush	backBrush(RGB(0, 16, 0));
    CBrush*	pOldBrush	= pDC->SelectObject(&backBrush);
    CRect r;

	pDC->GetClipBox(&r);     // Erase the area needed.
    pDC->PatBlt(r.left, r.top, r.Width(), r.Height(), PATCOPY);
    pDC->SelectObject(pOldBrush);
    return TRUE;
}
BOOL CProgressWnd::OnEraseBkgnd(CDC* pDC) 
{
    // Fill background with Catchment background colour
    CBrush backBrush(GetSysColor(COLOR_BTNFACE));
    CBrush* pOldBrush = pDC->SelectObject(&backBrush);
    CRect rect;
    pDC->GetClipBox(&rect);     // Erase the area needed
    pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
    pDC->SelectObject(pOldBrush);

    return TRUE;
}
Пример #8
0
BOOL CPreviewView::OnEraseBkgnd(CDC* pDC)
{
	ASSERT_VALID(pDC);

	// Fill background with APPWORKSPACE
	CBrush backBrush(GetSysColor(COLOR_APPWORKSPACE));
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);
	CRect rect;
	pDC->GetClipBox(&rect);     // Erase the area needed

	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
	pDC->SelectObject(pOldBrush);
	return TRUE;
}
Пример #9
0
//-----------------------------------------------------------------------------
// Purpose: Makes our background color mesh with the splash screen for maximum effect.
//-----------------------------------------------------------------------------
BOOL CMDIClientWnd::OnEraseBkgnd(CDC *pDC)
{
	// Set brush to desired background color
	CBrush backBrush(RGB(141, 136, 130)); // This color blends with the splash image!

	// Save old brush
	CBrush *pOldBrush = pDC->SelectObject(&backBrush);

	CRect rect;
	pDC->GetClipBox(&rect);     // Erase the area needed

	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);

	pDC->SelectObject(pOldBrush);
	return TRUE;
} 
void CHSBControlColor::Paint(Gdiplus::Graphics *pGraphics)
{
	SolidBrush backBrush(ColorDefined[m_index]);
	pGraphics->FillRectangle(&backBrush, m_Left + 1, m_Top + 1, 24, 18);
	if (m_Fouced)
	{
		Pen BorderPen1(0xFFF29436);
		Pen BorderPen2(0xFFFFE294);
		pGraphics->DrawRectangle(&BorderPen1, m_Left, m_Top, 24 + 1, 18 + 1);
		pGraphics->DrawRectangle(&BorderPen2, m_Left + 1, m_Top + 1, 24 - 1, 18 - 1);
	}
	else
	{
		Pen BorderPen(0xFF828790, 1);	
		pGraphics->DrawRectangle(&BorderPen, m_Left, m_Top, 24 + 1, 18 + 1);
	}
}
Пример #11
0
// 绘制
void Railing::draw(Graphics* pGraphics)
{
    if (m_state == DOWN)
    {
        pGraphics->DrawImage(s_pImg, 0, 0, 9, 100);
    }
    else if (m_state == RAISING ||
             m_state == FALLING)
    {
        Rect destRect(0, 0, 9, 50);
        pGraphics->DrawImage(s_pImg, destRect, 0, 0, 9, 100, Gdiplus::UnitPixel);
    }
    else
    {
        SolidBrush backBrush(Color(60, 60, 60));
        pGraphics->FillEllipse(&backBrush, 0, 0, 10, 10);
    }
}
BOOL CEditModeSelectView::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
	CBrush backBrush(RGB(195, 195, 195));               // 파랑색. 원하는 컬러를 넣어주면 된다...

	CBrush* pOldBrush = pDC->SelectObject(&backBrush); 
	CRect rect; pDC->GetClipBox(&rect); 
	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
	pDC->SelectObject(pOldBrush); 

	return TRUE;                // TRUE 로 해주어야 한다. 기존것(return CView::OnEraseBkgnd(pDC);)


	//	평소때 컬러를 안바꾸더라도 WM_ERASEBKGND 를 정의하여 return TURE 로 해두면
	//	더블 버퍼링을 쓸때 화면의 바탕을 다시 그리는 일이 없게 해서 조금이나마 화면의 깜박임을 더 줄일수 있다.
	//return CScrollView::OnEraseBkgnd(pDC);
	//return CView::OnEraseBkgnd(pDC);
}
Пример #13
0
void DisplayView::RepaintBackbuffer()
{
    CSize	size = graph.GetGraphSize();

    if (size.cx != back_width || size.cy != back_height) {

        CDC		*dc = GetDC();

        // we initialize a new backbuffer with the size of the graph
        if (memDC.GetSafeHdc()) {
            memDC.DeleteDC();
            backbuffer.DeleteObject();
        }

        memDC.CreateCompatibleDC(dc);
        backbuffer.CreateCompatibleBitmap(dc, size.cx, size.cy);
        memDC.SelectObject(&backbuffer);
        back_width = size.cx;
        back_height = size.cy;

        ReleaseDC(dc);

        graph.dirty = true;
    }

    if (graph.dirty) {
        CRect	rect;

        // now we repaint the buffer
        CBrush backBrush(render_params.color_back);

        memDC.SelectObject(&backBrush);
        memDC.GetClipBox(&rect);
        memDC.PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);

        graph.Draw(&memDC);

        // not dirty anymore
        graph.dirty = false;
        UpdateScrolling();
    }
}
Пример #14
0
BOOL CDimWnd::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 在此加入您的訊息處理常式程式碼和 (或) 呼叫預設值
	// Set brush to desired background color
    CBrush backBrush(RGB(200, 200, 200));

    // Save old brush
    CBrush* pOldBrush = pDC->SelectObject(&backBrush);

    CRect rect;
 //   pDC->GetClipBox(&rect);     // Erase the area needed
//	GetWindowRect(rect);
	GetClientRect(rect);

    pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
    pDC->SelectObject(pOldBrush);   
    return TRUE;

	return CFrameWnd::OnEraseBkgnd(pDC);
}
Пример #15
0
void DisplayView::OnDraw(CDC *pDC)
{
    CRect	r;
    CRect	rect;
    GetClientRect(&r);

    // Set brush to desired background color
    RepaintBackbuffer();
    pDC->BitBlt(0, 0, back_width, back_height, &memDC, 0, 0, SRCCOPY);

    // paint the rest of client area with background brush
    CBrush backBrush(render_params.color_back);
    CBrush *prev_brush = pDC->SelectObject(&backBrush);
    pDC->PatBlt(back_width, 0, r.Width(), r.Height(), PATCOPY);
    pDC->PatBlt(0, back_height, back_width, r.Height(), PATCOPY);

    pDC->SelectObject(prev_brush);

    // draw arrow
    if (drag_mode == DisplayView::DRAG_CONNECTION) {
        graph.DrawArrow(pDC, new_connection_start, new_connection_end);
    } else if (drag_mode == DisplayView::DRAG_SELECTION) {

        // select a null (hollow) brush
        CBrush	*pOldBrush = (CBrush*)pDC->SelectStockObject(NULL_BRUSH);
        CPen	pen(PS_DOT, 1, RGB(0,0,0));
        CPen	*pOldPen = pDC->SelectObject(&pen);

        // set pen pixels as the inverse of the screen color.
        int nOldROP2 = pDC->SetROP2(R2_XORPEN);

        // draw new or erase old selection rectangle
        pDC->Rectangle(start_drag_point.x, start_drag_point.y,
                       end_drag_point.x, end_drag_point.y);

        pDC->SetROP2(nOldROP2);
        pDC->SelectObject(pOldBrush);
        pDC->SelectObject(pOldPen);
    }
}
void CHSBWindow::OnPaint(HDC hdc)
{
	Graphics g(hdc);
	SolidBrush backBrush(0xFFFFFFFF);
	g.FillRectangle(&backBrush, 0, 0, SELECT_WIDTH, SELECT_HEIGHT);
	for(int i = 0; i < m_ControlCount; i++)
	{
		m_Controls[i]->Paint(&g);
	}

	Gdiplus::Pen grayPen1(0xFFB0B0B0, 1);
	Gdiplus::Pen grayPen2(0xFFE7EAEA, 1);
	g.DrawLine(&grayPen1, 2, 27 * 5 + 8, 102, 27 * 5 + 8);
	g.DrawLine(&grayPen2, 3, 27 * 5 + 9, 102, 27 * 5 + 9);

	SolidBrush solidBrush(0xFF000000); 
	StringFormat stringFormat;
	stringFormat.SetAlignment(StringAlignmentCenter);
	g.DrawString(L"Recent", -1, g_pFont, RectF(2, 27 * 5 + 2, 100, 24), &stringFormat, &solidBrush);

	g.DrawLine(&grayPen1, 105, 2, 105, SELECT_HEIGHT - 5);
	g.DrawLine(&grayPen2, 106, 3, 106, SELECT_HEIGHT - 4);
}
Пример #17
0
// Show 		 - Show the titletip if needed
// rectTitle	 - The rectangle within which the original 
//				    title is constrained - in client coordinates
// lpszTitleText - The text to be displayed
// xoffset		 - Number of pixel that the text is offset from
//				   left border of the cell
void CTitleTip::Show(CRect rectTitle, LPCTSTR lpszTitleText, int xoffset /*=0*/,
                     LPRECT lpHoverRect /*=NULL*/,
                     const LOGFONT* lpLogFont /*=NULL*/,
                     COLORREF crTextClr /* CLR_DEFAULT */,
                     COLORREF crBackClr /* CLR_DEFAULT */)
{
    if (!IsWindow(m_hWnd))
        Create(m_pParentWnd);

	ASSERT( ::IsWindow( GetSafeHwnd() ) );

    if (rectTitle.IsRectEmpty())
        return;

	// If titletip is already displayed, don't do anything.
	if( IsWindowVisible() ) 
		return;

    m_rectHover = (lpHoverRect != NULL)? lpHoverRect : rectTitle;
    m_rectHover.right++; m_rectHover.bottom++;

	m_pParentWnd->ClientToScreen( m_rectHover );
    ScreenToClient( m_rectHover );

	// Do not display the titletip is app does not have focus
	if( GetFocus() == NULL )
		return;

	// Define the rectangle outside which the titletip will be hidden.
	// We add a buffer of one pixel around the rectangle
	m_rectTitle.top    = -1;
	m_rectTitle.left   = -xoffset-1;
	m_rectTitle.right  = rectTitle.Width()-xoffset;
	m_rectTitle.bottom = rectTitle.Height()+1;

	// Determine the width of the text
	m_pParentWnd->ClientToScreen( rectTitle );

	CClientDC dc(this);
	CString strTitle = _T("");
    strTitle += _T(" ");
    strTitle += lpszTitleText; 
    strTitle += _T(" ");

	CFont font, *pOldFont = NULL;
    if (lpLogFont)
    {
        font.CreateFontIndirect(lpLogFont);
	    pOldFont = dc.SelectObject( &font );
    }
    else
    {
        // use same font as ctrl
	    pOldFont = dc.SelectObject( m_pParentWnd->GetFont() );
    }

	CSize size = dc.GetTextExtent( strTitle );

    TEXTMETRIC tm;
    dc.GetTextMetrics(&tm);
    size.cx += tm.tmOverhang;

	CRect rectDisplay = rectTitle;
	rectDisplay.left += xoffset;
	rectDisplay.right = rectDisplay.left + size.cx + xoffset;
    
    // Do not display if the text fits within available space
    if ( rectDisplay.right > rectTitle.right-xoffset )
    {
		// Show the titletip
        SetWindowPos( &wndTop, rectDisplay.left, rectDisplay.top, 
            rectDisplay.Width(), rectDisplay.Height(), 
            SWP_SHOWWINDOW|SWP_NOACTIVATE );
        
        // FNA - handle colors correctly
        if (crBackClr != CLR_DEFAULT)
        {
		    CBrush backBrush(crBackClr);
		    CBrush* pOldBrush = dc.SelectObject(&backBrush);
		    CRect rect;
		    dc.GetClipBox(&rect);     // Erase the area needed 

		    dc.PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),  PATCOPY);
		    dc.SelectObject(pOldBrush);
	    }
        // Set color
        if (crTextClr != CLR_DEFAULT)//FNA
            dc.SetTextColor(crTextClr);//FA

        dc.SetBkMode( TRANSPARENT );
        dc.TextOut( 0, 0, strTitle );
        SetCapture();
    }
    
    dc.SelectObject( pOldFont );
}
Пример #18
0
void COpenHoldemView::UpdateDisplay(const bool update_all) {
	bool		update_it = false;
	CDC			*pDC = GetDC();

	CString sym_handnumber = p_handreset_detector->GetHandNumber();
	double  sym_bblind = p_symbol_engine_tablelimits->bblind();
	double  sym_sblind = p_symbol_engine_tablelimits->sblind();
	double  sym_ante = p_symbol_engine_tablelimits->ante();
	int     sym_lim = p_symbol_engine_gametype->gametype();
	bool    sym_istournament = p_symbol_engine_istournament->istournament();
	double  sym_pot = p_symbol_engine_chip_amounts->pot();

	// Get size of current client window
	GetClientRect(&_client_rect);

	// Set background color (light gray)
	if (update_all) 
	{
		CBrush backBrush(COLOR_GRAY);
		CBrush* pOldBrush = pDC->SelectObject(&backBrush);
		pDC->PatBlt(_client_rect.left, _client_rect.top, _client_rect.right-_client_rect.left, _client_rect.bottom-_client_rect.top, PATCOPY);
		pDC->SelectObject(pOldBrush);
	}

	// Draw center info box
	update_it = false;
	if (_handnumber_last != sym_handnumber) 
	{
		_handnumber_last = sym_handnumber;
		update_it = true;
	}
	if (_sblind_last != sym_sblind) 
	{
		_sblind_last = sym_sblind;
		update_it = true;
	}
	if (_bblind_last != sym_bblind) 
	{
		_bblind_last = sym_bblind;
		update_it = true;
	}
	if (_lim_last != sym_lim) 
	{
		_lim_last = sym_lim;
		update_it = true;
	}
	if (_istournament_last != sym_istournament) 
	{
		_istournament_last = sym_istournament;
		update_it = true;
	}
	if (_ante_last != sym_ante != 0) 
	{
		_ante_last = sym_ante;
		update_it = true;
	}
	if (_pot_last != sym_pot) 
	{
		_pot_last = sym_pot;
		update_it = true;
	}

  if ((p_symbol_engine_autoplayer->ismyturn()) || update_it || update_all) 
	{
		assert(p_white_info_box != NULL);
    p_white_info_box->Draw(_client_rect, _logfont, pDC,
      &_black_pen, &_white_brush);
    ReleaseDC(pDC);
	}

	// Draw button state indicators
	DrawButtonIndicators();

	// Draw common cards
	for (int i=0; i<kNumberOfCommunityCards; i++) 
	{
    Card *p_card = &p_table_state->_common_cards[i];
    int card_value = p_table_state->_common_cards[i].GetValue();
		if (_card_common_last[i] != card_value || update_all) 
		{
			_card_common_last[i] = card_value;
			write_log(preferences.debug_gui(), "[GUI] COpenHoldemView::UpdateDisplay() Drawing common card %i: [%s]\n",
        i, p_card->ToString());
			DrawCard(p_card,
					  _client_rect.right/2 + cc[i][0], _client_rect.bottom/2 + cc[i][1],
					  _client_rect.right/2 + cc[i][0] + CARDSIZEX, _client_rect.bottom/2 + cc[i][1] + CARDSIZEY,
					  false);
		}
	}
  // Draw collection of player info
	for (int i=0; i<p_tablemap->nchairs(); i++) 	{
		write_log(preferences.debug_gui(), "[GUI] COpenHoldemView::UpdateDisplay() checking changes for chair %i\n", i);
		// Figure out if we need to redraw this seat
		update_it = false;
		if (_seated_last[i] != p_table_state->_players[i]._seated 
        || _active_last[i] != p_table_state->_players[i]._active) 	{
			_seated_last[i] = p_table_state->_players[i]._seated;
			_active_last[i] = p_table_state->_players[i]._active;
			update_it = true;
		}
    if (_card_player_last[i][0] != p_table_state->_players[i]._hole_cards[0].GetValue()
        || _card_player_last[i][1] != p_table_state->_players[i]._hole_cards[1].GetValue()) 		{
			_card_player_last[i][0] = p_table_state->_players[i]._hole_cards[0].GetValue();
			_card_player_last[i][1] = p_table_state->_players[i]._hole_cards[1].GetValue();
			update_it = true;
		}
		if (_dealer_last[i] != p_table_state->_players[i]._dealer) {
			_dealer_last[i] = p_table_state->_players[i]._dealer;
			update_it = true;
		}
		if (_playername_last[i] != p_table_state->_players[i]._name) {
			_playername_last[i] = p_table_state->_players[i]._name;
			update_it = true;
		}
		if (_playerbalance_last[i] != p_table_state->_players[i]._balance) {
			_playerbalance_last[i] = p_table_state->_players[i]._balance;
			update_it = true;
		}
		if (_playerbet_last[i] != p_table_state->_players[i]._bet) 
		{
			_playerbet_last[i] = p_table_state->_players[i]._bet;
			update_it = true;
		}

		if (update_it || update_all) {
			write_log(preferences.debug_gui(), "[GUI] COpenHoldemView::UpdateDisplay() updating chair %i\n", i);
			// Draw active circle
			if (p_table_state->_players[i]._seated) 	{
				DrawSeatedActiveCircle(i);
				// Draw cards first, because we want the name 
				// to occlude the cards and not the other way.
				DrawPlayerCards(i);
				DrawNameBox(i);
				DrawBalanceBox(i);
        DrawColourCodes(i);
			}
			// Drawing a bet, even if no player seated.
			// The player might have left the table, 
			// but depending on casinos potmethod a bet might still be there.
			DrawPlayerBet(i);
		}
		// Draw dealer button
		// At some casinos the dealer can be at an empty seat.
		// Therefore we draw the dealer-button anyway, inependent of "seated" and "active".
		// Draw it at the very last, as we want to have it at the top of the cards.
		if (p_table_state->_players[i]._dealer) {
			DrawDealerButton(i);
		}
	}
	write_log(preferences.debug_gui(), "[GUI] COpenHoldemView::UpdateDisplay() Update finished\n");
	ReleaseDC(pDC);
	write_log(preferences.debug_gui(), "[GUI] COpenHoldemView::UpdateDisplay() DC released\n");
}
Пример #19
0
void IsoLine::drawGLIsoLineLabels(GRIBOverlayFactory *pof, wxColour text_color, wxColour back_color,
                                PlugIn_ViewPort *vp, int density, int first, double coef)
{
    std::list<Segment *>::iterator it;
    int nb = first;
    wxString label;

    label.Printf(_T("%d"), (int)(value*coef+0.5));

    int w, h;

    wxPen penText(text_color);
    wxBrush backBrush(back_color);

    int label_offset = 10;

      if(!m_imageLabel.IsOk())
      {
            wxBitmap bm(100,100);          // big enough
            wxMemoryDC mdc(bm);
            mdc.Clear();

            mdc.GetTextExtent(label, &w, &h);

            mdc.SetPen(penText);
            mdc.SetBrush(backBrush);
            mdc.SetTextForeground(text_color);
            mdc.SetTextBackground(back_color);

            int xd = 0;
            int yd = 0;
//            mdc.DrawRoundedRectangle(xd, yd, w+(label_offset * 2), h, -.25);
            mdc.DrawRectangle(xd, yd, w+(label_offset * 2), h+2);
            mdc.DrawText(label, label_offset/2 + xd, yd-1);
            
            mdc.SelectObject(wxNullBitmap);

            wxBitmap sub_BMLabel = bm.GetSubBitmap(wxRect(0,0,w+(label_offset * 2), h+2));
            m_imageLabel = sub_BMLabel.ConvertToImage();
      }

    //---------------------------------------------------------
    // Ecrit les labels
    //---------------------------------------------------------
    for (it=trace.begin(); it!=trace.end(); it++,nb++)
    {
        if (nb % density == 0)
		{
            Segment *seg = *it;

//            if(vp->vpBBox.PointInBox((seg->px1 + seg->px2)/2., (seg->py1 + seg->py2)/2., 0.))
            {
                  int w = m_imageLabel.GetWidth();
                  int h = m_imageLabel.GetHeight();
                  wxPoint ab;
                  GetCanvasPixLL(vp, &ab, seg->py1, seg->px1);
                  wxPoint cd;
                  GetCanvasPixLL(vp, &cd, seg->py1, seg->px1);

                  int xd = (ab.x + cd.x-(w+label_offset * 2))/2;
                  int yd = (ab.y + cd.y - h)/2;

                  glRasterPos2i(xd, yd);
                  glPixelZoom(1, -1); /* draw data from top to bottom */
                  glDrawPixels(w, h, GL_RGB, GL_UNSIGNED_BYTE, m_imageLabel.GetData());
                  glPixelZoom(1, 1);
            }
        }
    }
}
Пример #20
0
void COpenHoldemView::UpdateDisplay(const bool update_all) 
{
	int			i = 0;

	bool		update_it = false;
	RECT		cr = {0};
	CDC			*pDC = GetDC();

	CString		sym_handnumber = p_handreset_detector->GetHandNumber();
	double		sym_bblind = p_tablelimits->bblind();
	double		sym_sblind = p_tablelimits->sblind();
	double		sym_ante = p_tablelimits->ante();
	int			sym_lim = p_tablelimits->gametype();
	bool		sym_istournament = p_tablelimits->istournament();
	double		sym_pot = p_symbol_engine_chip_amounts->pot();

	// Get size of current client window
	GetClientRect(&cr);

	// Set background color (light gray)
	if (update_all) 
	{
		CBrush backBrush(COLOR_GRAY);
		CBrush* pOldBrush = pDC->SelectObject(&backBrush);
		pDC->PatBlt(cr.left, cr.top, cr.right-cr.left, cr.bottom-cr.top, PATCOPY);
		pDC->SelectObject(pOldBrush);
	}

	// Draw center info box
	update_it = false;
	if (_handnumber_last != sym_handnumber) 
	{
		_handnumber_last = sym_handnumber;
		update_it = true;
	}
	if (_sblind_last != sym_sblind) 
	{
		_sblind_last = sym_sblind;
		update_it = true;
	}
	if (_bblind_last != sym_bblind) 
	{
		_bblind_last = sym_bblind;
		update_it = true;
	}
	if (_lim_last != sym_lim) 
	{
		_lim_last = sym_lim;
		update_it = true;
	}
	if (_istournament_last != sym_istournament) 
	{
		_istournament_last = sym_istournament;
		update_it = true;
	}
	if (_ante_last != sym_ante != 0) 
	{
		_ante_last = sym_ante;
		update_it = true;
	}
	if (_pot_last != sym_pot) 
	{
		_pot_last = sym_pot;
		update_it = true;
	}

	if (prefs.log_symbol_enabled() || update_it || update_all) 
	{
		DrawCenterInfoBox();
	}

	// Draw button state indicators
	DrawButtonIndicators();

	// Draw common cards
	for (i=0; i<5; i++) 
	{
		if (_card_common_last[i] != p_scraper->card_common(i) || update_all) 
		{
			_card_common_last[i] = p_scraper->card_common(i);

			DrawCard(p_scraper->card_common(i),
					  cr.right/2 + cc[i][0], cr.bottom/2 + cc[i][1],
					  cr.right/2 + cc[i][0] + CARDSIZEX, cr.bottom/2 + cc[i][1] + CARDSIZEY,
					  false);
		}
	}

	// Draw collection of player info
	for (i=0; i<p_tablemap->nchairs(); i++) 
	{

		// Figure out if we need to redraw this seat
		update_it = false;
		if (_seated_last[i] != p_scraper->seated(i) ||
			_active_last[i] != p_scraper->active(i)) 
		{
			_seated_last[i] = p_scraper->seated(i);
			_active_last[i] = p_scraper->active(i);
			update_it = true;
		}
		if (_card_player_last[i][0] != p_scraper->card_player(i, 0) ||
			_card_player_last[i][1] != p_scraper->card_player(i, 1)) 
		{
			_card_player_last[i][0] = p_scraper->card_player(i, 0);
			_card_player_last[i][1] = p_scraper->card_player(i, 1);
			update_it = true;
		}
		if (_dealer_last[i] != p_scraper->dealer(i)) 
		{
			_dealer_last[i] = p_scraper->dealer(i);
			update_it = true;
		}
		if (_playername_last[i] != p_scraper->player_name(i)) 
		{
			_playername_last[i] = p_scraper->player_name(i);
			update_it = true;
		}
		if (_playerbalance_last[i] != p_scraper->player_balance(i)) 
		{
			_playerbalance_last[i] = p_scraper->player_balance(i);
			update_it = true;
		}
		if (_playerbet_last[i] != p_scraper->player_bet(i)) 
		{
			_playerbet_last[i] = p_scraper->player_bet(i);
			update_it = true;
		}

		if (update_it || update_all) 
		{
			// Draw active circle
			if (p_string_match->IsStringSeated(p_scraper->seated(i))) 
				DrawSeatedActiveCircle(i);

			// Draw player cards
			DrawCard(p_scraper->card_player(i, 0),
					  cr.right * pc[p_tablemap->nchairs()][i][0] - CARDSIZEX - 2,
					  cr.bottom * pc[p_tablemap->nchairs()][i][1] - CARDSIZEY/2,
					  cr.right * pc[p_tablemap->nchairs()][i][0] - 2,
					  cr.bottom * pc[p_tablemap->nchairs()][i][1] + CARDSIZEY/2 - 1,
					  true);
			DrawCard(p_scraper->card_player(i, 1),
					  cr.right * pc[p_tablemap->nchairs()][i][0] + 1,
					  cr.bottom * pc[p_tablemap->nchairs()][i][1] - CARDSIZEY/2,
					  cr.right * pc[p_tablemap->nchairs()][i][0] + CARDSIZEX + 1,
					  cr.bottom * pc[p_tablemap->nchairs()][i][1] + CARDSIZEY/2 - 1,
					  true);

			// Draw dealer button
			if (p_scraper->dealer(i))
				DrawDealerButton(i);

			// Draw name and balance boxes
			DrawNameBox(i);
			DrawBalanceBox(i);

			// Draw player bet
			DrawPlayerBet(i);
		}
	}

	ReleaseDC(pDC);
}
Пример #21
0
void PipelineFlowChart::paintEvent(QPaintEvent *e)
{
  if(m_StageNames.empty())
    return;

  QPainter p(this);

  p.fillRect(rect(), Qt::transparent);

  p.setRenderHint(QPainter::Antialiasing, true);

  const QRectF totalRect = totalAreaRect();
  const QRectF box0Rect = boxRect(0);

  const qreal radius = qMin(MaxBoxCornerRadius, box0Rect.height() * BoxCornerRadiusFraction);

  const qreal arrowY = totalRect.y() + totalRect.height() / 2;

  QColor base = palette().color(QPalette::Base);
  QColor baseText = palette().color(QPalette::Text);
  QColor inactiveWin = palette().color(QPalette::Inactive, QPalette::Dark);
  QColor inactiveWinText = palette().color(QPalette::Inactive, QPalette::WindowText);
  QColor tooltip = palette().color(QPalette::ToolTipBase);
  QColor tooltipText = palette().color(QPalette::ToolTipText);

  QPen pen(baseText);
  QPen selectedPen(Qt::red);

  int num = numGaps();
  for(int i = 0; i < num; i++)
  {
    if(!m_StageFlows[i] || !m_StageFlows[i + 1])
      continue;

    float right = totalRect.x() + (i + 1) * (box0Rect.width() + boxMargin());
    float left = right - boxMargin();

    p.setBrush(baseText);
    drawArrow(p, pen, ArrowHeadSize, arrowY, left, right);
  }

  num = numItems();
  for(int i = 0; i < num; i++)
  {
    QRectF boxrect = boxRect(i);

    QBrush backBrush(base);
    QPen textPen(baseText);
    QPen outlinePen = pen;

    if(!stageEnabled(i))
    {
      backBrush.setColor(inactiveWin);
      textPen.setColor(inactiveWinText);
    }

    if(i == m_HoverStage)
    {
      backBrush.setColor(tooltip);
      textPen.setColor(tooltipText);
    }

    if(i == m_SelectedStage)
    {
      outlinePen = selectedPen;
    }

    outlinePen.setWidthF(BoxBorderWidth);

    p.setPen(outlinePen);
    p.setBrush(backBrush);
    p.drawRoundedRect(boxrect, radius, radius);

    QTextOption opts(Qt::AlignCenter);
    opts.setWrapMode(QTextOption::NoWrap);

    QString s = m_StageNames[i];

    QRectF reqBox = p.boundingRect(QRectF(0, 0, 1, 1), m_StageNames[i], opts);

    if(reqBox.width() + BoxLabelMargin > (float)boxrect.width())
      s = m_StageAbbrevs[i];

    p.setPen(textPen);
    p.drawText(boxrect, s, opts);
  }
}