Ejemplo n.º 1
0
DWORD CWinRect::CombineOverlapping(LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold, DWORD max, LPDWORD pdwFree)
{_STT();
	// Combine overlapping rects
	BOOL dwCombined = 0;
	for ( DWORD i = 0; i < dwRectListSize; i++ )
		for ( DWORD c = i + 1; c < dwRectListSize; c++ )
		{	RECT dst;
			if ( 	( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 ) &&
					( RW( pRectList[ c ] ) != 0 && RH( pRectList[ c ] ) != 0 ) &&
					IsAdjacentRect( &pRectList[ i ], &pRectList[ c ] ) )
				if ( UnionRect( &dst, &pRectList[ i ], &pRectList[ c ] ) )
				{	dwCombined++;
					
					// Copy the new rect
					CopyRect( &pRectList[ i ], &dst ); 
					
					// Lose the old rect
					ZeroMemory( &pRectList[ c ], sizeof( pRectList[ c ] ) ); 

					// Save pointer to blank if needed
					if ( dwCombined == 1 && pdwFree != NULL ) *pdwFree = c;					

					// Punt if user doesn't want any more
					if ( !max ) return dwCombined;

					i = 0; c = 1; max--;

				} // end if
		} // end for

	return dwCombined;
}
Ejemplo n.º 2
0
void CDlgImgView::SizeDlg()
{
	// Ensure window
	if ( !::IsWindow( GetSafeHwnd() ) ) return;
	if ( RW( m_rect ) <= 32 || RH( m_rect ) <= 32 ) return;

	RECT win;
	GetWindowRect( &win );
	win.right = win.left + RW( m_rect ) + 16;
	win.bottom = win.top + RH( m_rect ) + 48;
	MoveWindow( &win, TRUE );

	Size();
}
Ejemplo n.º 3
0
BOOL CPubImgView::Regen( DWORD i )
{
	RECT rect;
	GetClientRect( &rect );

	// Punt if no image list
	if ( m_pImgList == NULL || m_pImgList->Size() == 0 )
	{	m_video.Destroy(); return TRUE; }

	long w = RW( rect );
	long h = RH( rect );

	// Just allocate what we need
	if ( w > h ) rect.right = rect.left + ( h * m_pImgList->Size() );
	else rect.bottom = rect.top + ( w + m_pImgList->Size() );

	// Create offscreen buffer
	if ( !m_video.Create( NULL, &rect ) ) return FALSE;

	// Fill in the background
	CGrDC::FillSolidRect( m_video, &rect, GetSysColor( COLOR_3DFACE ) );
	
	// Draw the images
	if ( !Draw( m_video, &rect ) ) return FALSE;

	// Show the changes
	Update();

	return TRUE;
}
Ejemplo n.º 4
0
// used for transformation from vertex position in GS window.coords (I hope)
// to view coordinates (in range 0, 1).
float4 CRenderTarget::DefaultBitBltPos()
{
	float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
	v *= 1.0f / 32767.0f;
	ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_sBitBltPos");
	return v;
}
Ejemplo n.º 5
0
BOOL CWinRect::AddRectToList(LPRECT pRect, LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold )
{_STT();
	// Add if possible
	RECT dst;
	DWORD i = 0, blank = MAXDWORD;
	for ( i = 0; i < dwRectListSize; i++ )
	{
		// If valid area
		if ( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 )
		{	if ( IsAdjacentRect( &pRectList[ i ], pRect, xThreshold, yThreshold ) )
				if ( UnionRect( &dst, &pRectList[ i ], pRect ) )
				{	CopyRect( &pRectList[ i ], &dst ); return TRUE; }
		} // end if

		// Save blank location
		else if ( blank == MAXDWORD ) 
			blank = i;

	} // end for

	// Any more blank slots?
	if ( blank == MAXDWORD ) 
	{
		// Attempt to create an empty slot
		if ( !CombineOverlapping( pRectList, dwRectListSize, xThreshold, yThreshold, 1, &blank ) )
			return FALSE;

	} // end if

	// Add to slot
	CopyRect( &pRectList[ blank ], pRect );

	return TRUE;
}
Ejemplo n.º 6
0
void C3DList::OnLButtonDown(UINT nFlags, CPoint point) 
{
	SetCapture();

	RECT rect, hs, vs;
	GetClientRect( &rect );

	m_scrollbar.GetClientRect( &vs );
	rect.right -= RW( vs );

	// If horizontal scroll bar
	if ( !GetListCtrl().GetHeader().IsAutosizing() )
	{
		m_hscroll.GetClientRect( &hs );
		rect.bottom -= RH( hs );
	} // end if

	// Let list handle button press
	if ( m_list.OnLButtonDown( nFlags, &point, &rect ) )
	{
		RECT rect;
		GetClientRect( &rect );
		rect.right -= GetSystemMetrics( SM_CXVSCROLL );			
		rect.bottom -= GetSystemMetrics( SM_CYHSCROLL );
		RedrawWindow( &rect );
		UpdateVScrollBar();
	} // end if
	
	CStatic::OnLButtonDown(nFlags, point);
}
Ejemplo n.º 7
0
Archivo: DHT11.C Proyecto: hnulong/C51
void main()
{
	uchar len,i;
	uchar xdata Tvalue[6],Hvalue[6];
	SerialInit();
	LCDInit();
	while(1)
	{ 
	    RH();
		SerialPutString(buff);
		sprintf(Tvalue,"%2.2f",temperature);
		sprintf(Hvalue,"%2.2f%%",humidity);
		LCDWriteCom(0x01);//ÇåÆÁ
		LCDWriteCom(0x80);
		len=strlen(info1);
		//дÊý¾Ýµ½LCD1602
		for(i=0;i<len;i++)
			LCDWriteData(info1[i]);
		len=strlen(Tvalue);
		for(i=0;i<len;i++)
			LCDWriteData(Tvalue[i]);
		LCDWriteData((uchar)223);
		LCDWriteData('C');
		LCDWriteCom(0x80+0x43);
		len=strlen(info2);
		for(i=0;i<len;i++)
			LCDWriteData(info2[i]);
		len=strlen(Hvalue);
		for(i=0;i<len;i++)
			LCDWriteData(Hvalue[i]);
	   //
	   Delay(10000);
	}

}
Ejemplo n.º 8
0
// Used to transform texture coordinates from GS (when 0,0 is upper left) to
// OpenGL (0,0 - lower left).
float4 CRenderTarget::DefaultBitBltTex()
{
	// I really sure that -0.5 is correct, because OpenGL have no half-offset
	// issue, DirectX known for.
	float4 v = float4(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh));
	ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_sBitBltTex");
	return v;
}
Ejemplo n.º 9
0
void wenshi(uchar shujv[])
{	 
		uint i=0;
		RH(); 
		shujv[0]=U8RH_data_H/10+48;	
		shujv[1]=U8RH_data_H%10+48;
		shujv[2]=U8T_data_H/10+48;
		shujv[3]=U8T_data_H%10+48;
		for(i=0;i<3000;i++);
}
Ejemplo n.º 10
0
void CDlgInform::Size()
{
    // Ensure we have a valid window
    if ( !::IsWindow( GetSafeHwnd() ) ) return;

    RECT rect;
    m_text.GetTextSize( &rect );

    // Add a little room
//	InflateRect( &rect, 40, 20 );
    rect.right += 60;
    rect.bottom += 40;

    // correct size
    rect.bottom += GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYBORDER ) + 32;
    if ( RW( rect ) < 280 ) rect.right = rect.left + 280;

    // Set window position
    SetWindowPos( NULL, 0, 0,
                  rect.right - rect.left,
                  rect.bottom - rect.top,
                  SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE );
    CenterWindow();

    GetClientRect( &rect );

    // Set the text control position
    if ( ::IsWindow( m_text.GetSafeHwnd() ) )

        m_text.SetWindowPos( NULL,	rect.left, rect.top,
                             RW( rect ), RH( rect ) - 24,
                             SWP_NOZORDER | SWP_NOACTIVATE );

    rect.top = rect.bottom - 24;

    // Set the text control position
    if ( ::IsWindow( m_status.GetSafeHwnd() ) )

        m_status.SetWindowPos( NULL,	rect.left, rect.top,
                               RW( rect ), RH( rect ),
                               SWP_NOZORDER | SWP_NOACTIVATE );
}
Ejemplo n.º 11
0
void CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int context)
{
	FUNCLOG
	int dy = 0;

	if (fbplocal != fbp)
	{
		float4 v;

		// will be rendering to a subregion
		u32 bpp = PSMT_ISHALF(psm) ? 2 : 4;
		assert(((256 / bpp)*(fbplocal - fbp)) % fbw == 0);
		assert(fbplocal >= fbp);

		dy = ((256 / bpp) * (fbplocal - fbp)) / fbw;

		v.x = vposxy.x;
		v.y = vposxy.y;
		v.z = vposxy.z;
		v.w = vposxy.w - dy * 2.0f / (float)fbh;
		ZZshSetParameter4fv(g_vparamPosXY[context], v, "g_fPosXY");
	}
	else
	{
		ZZshSetParameter4fv(g_vparamPosXY[context], vposxy, "g_fPosXY");
	}

	// set render states
	// Bleh. I *really* need to fix this. << 3 when setting the scissors, then >> 3 when using them... --Arcum42
	scissorrect.x = scissor.x0 >> 3;
	scissorrect.y = (scissor.y0 >> 3) + dy;
	scissorrect.w = (scissor.x1 >> 3) + 1;
	scissorrect.h = (scissor.y1 >> 3) + 1 + dy;

	scissorrect.w = min(scissorrect.w, fbw) - scissorrect.x;
	scissorrect.h = min(scissorrect.h, fbh) - scissorrect.y;

	scissorrect.x = RW(scissorrect.x);
	scissorrect.y = RH(scissorrect.y);
	scissorrect.w = RW(scissorrect.w);
	scissorrect.h = RH(scissorrect.h);
}
Ejemplo n.º 12
0
BOOL CPubThread::GetThumbnail(LPPUBINFO ppi, CWinImg *pImg, long iw, long ih)
{
	RECT rect;
	SetRect( &rect, 0, 0, iw, ih );

	// Get thumbnail size
	if ( !GetThumbnailRect( ppi, &rect ) ) return FALSE;

	// Get the image
	return IMGLIST().GetImage( ppi->img, pImg, RW( rect ), RH( rect ) );
}
Ejemplo n.º 13
0
BOOL CPubImgView::OnEraseBkgnd(CDC* pDC) 
{	
	if ( pDC == NULL ) return FALSE;

	RECT rect;
	GetClientRect( &rect );

	HDC hDC = pDC->GetSafeHdc();

	// Create offscreen DC
	if ( m_offscreen.Create( hDC, &rect ) )
		hDC = m_offscreen;

	// Fill rect
	CGrDC::FillSolidRect( hDC, &rect, GetSysColor( COLOR_3DFACE ) );

	// Regen video if needed
	if ( m_video.GetSafeHdc() == NULL ) Regen();

	// Draw to screen
	m_video.Draw( hDC, &rect, FALSE );

	DWORD sel = m_pImgList->GetCurSel();

	if ( sel < m_pImgList->Size() )
	{
		RECT selbox;
		CopyRect( &selbox, &rect );

		long w = RW( rect );
		long h = RH( rect );

		// Where will the selection box be?
		if ( w > h ) { selbox.left += sel * h; selbox.right = selbox.left + h; }
		else { selbox.top += sel * w; selbox.bottom = selbox.top + w; }

		InflateRect( &selbox, -4, -4 );

		// Draw the selection box
		CGrDC::Box3d(	hDC, &selbox, 3,
						GetSysColor( COLOR_HIGHLIGHT ), 
						GetSysColor( COLOR_HIGHLIGHT ), TRUE );	
	} // end if

	// Update the screen
	m_offscreen.Draw( pDC->GetSafeHdc(), &rect );

	return TRUE;
//	return CWnd::OnEraseBkgnd(pDC);
}
Ejemplo n.º 14
0
BOOL CMovableObj::Move(LPPOINT pPt)
{_STT();
	POINT pt = { pPt->x + m_lXOff, pPt->y + m_lYOff };

	DWORD dwCursor = m_dwClickFlags;

	if ( dwCursor & MOCUR_LEFT && dwCursor & MOCUR_TOP )
	{	m_rect.left = pt.x;
		m_rect.top = pt.y;
	} // end if

	else if ( dwCursor & MOCUR_RIGHT && dwCursor & MOCUR_TOP )
	{	m_rect.right = pt.x;
		m_rect.top = pt.y;
	} // end if

	else if ( dwCursor & MOCUR_LEFT && dwCursor & MOCUR_BOTTOM )
	{	m_rect.left = pt.x;
		m_rect.bottom = pt.y;
	} // end if

	else if ( dwCursor & MOCUR_RIGHT && dwCursor & MOCUR_BOTTOM )
	{	m_rect.right = pt.x;
		m_rect.bottom = pt.y;
	} // end if

	else if ( dwCursor & MOCUR_LEFT )
		m_rect.left = pt.x;

	else if ( dwCursor & MOCUR_RIGHT )
		m_rect.right = pt.x;

	else if ( dwCursor & MOCUR_TOP )
		m_rect.top = pt.y;
		
	else if ( dwCursor & MOCUR_BOTTOM )
		m_rect.bottom = pt.y;

	else if ( dwCursor & MOCUR_MOVE ) 
	{	long w = RW( m_rect );
		long h = RH( m_rect );
		m_rect.left = pt.x - ( w >> 1 );
		m_rect.top = pt.y - ( h >> 1 );
		m_rect.right = m_rect.left + w;
		m_rect.bottom = m_rect.top + h;
	} // end if
Ejemplo n.º 15
0
bool Enemy::IsCollision( Character *player )
{
    Rect pl, en;
    pl.x = player->RX();
    pl.y = player->RY();
    pl.w = player->RW();
    pl.h = player->RH();

    en.x = RX();
    en.y = RY();
    en.w = RW();
    en.h= RH();

    return (    pl.x            <       en.x+en.w &&
                pl.x+pl.w       >       en.x &&
                pl.y            <       en.y+en.h &&
                pl.y+pl.h       >       en.y );
}
Ejemplo n.º 16
0
int dht_run(const int DHT)
{
	int temp;
	RH();
	delay_ms(10);
	switch(DHT)
	{
		case 'm':
			temp = U8T_data_H + 100 * U8RH_data_H;break;
		case 't':
			temp = U8T_data_H;break;
		case 'h':
			temp = U8RH_data_H;break;
		default:
			temp = U8T_data_H + 100 * U8RH_data_H;break;
	}
	return temp;
	//U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L
}
Ejemplo n.º 17
0
bool CRenderTarget::Create(const frameInfo& frame)
{
	FUNCLOG
	Resolve();
	Destroy();
	created = 123;

	lastused = timeGetTime();
	fbp = frame.fbp;
	fbw = frame.fbw;
	fbh = frame.fbh;
	psm = (u8)frame.psm;
	fbm = frame.fbm;

	vposxy.x = 2.0f * (1.0f / 8.0f) / (float)fbw;
	vposxy.y = 2.0f * (1.0f / 8.0f) / (float)fbh;
	vposxy.z = -1.0f - 0.5f / (float)fbw;
	vposxy.w = -1.0f + 0.5f / (float)fbh;
	status = 0;

	if (fbw > 0 && fbh > 0)
	{
		GetRectMemAddressZero(start, end, psm, fbw, fbh, fbp, fbw);
		psys = _aligned_malloc(Tex_Memory_Size(fbw, fbh), 16);

		GL_REPORT_ERRORD();

		if (!InitialiseDefaultTexture(&ptex, RW(fbw), RH(fbh)))
		{
			Destroy();
			return false;
		}

		status = TS_NeedUpdate;
	}
	else
	{
		start = end = 0;
	}

	return true;
}
Ejemplo n.º 18
0
void CWinMenu::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	RECT rect;
	HDC hDC = dc.GetSafeHdc();
	GetClientRect( &rect );

	// Where will we draw?
	HDC hDraw = hDC;
	if ( m_offscreen.Create( hDC, &rect ) ) 
		hDraw = m_offscreen.GetSafeHdc();

	// Fill in menu window
	COLORREF rgbBck = m_rgbMenu;
	if ( m_bSystemColors ) rgbBck = GetSysColor( COLOR_MENU );
	
	COLORREF	rgbBckLt = ScaleColor( rgbBck, 40 );
	COLORREF	rgbBckDk = ScaleColor( rgbBck, -40 );

//	CGrDC::GradientFill( hDraw, &rect,	RGB( 255, 0, 0 ), RGB( 0, 255, 0 ),
//										RGB( 255, 0, 255 ), RGB( 0, 255, 255 ) );

	if (	m_bck.GetSafeHdc() == NULL || 
			RW( rect ) != m_bck.GetWidth() ||
			RH( rect ) != m_bck.GetHeight() )
	{
		// Create the background
		m_bck.Create( NULL, &rect );

		if ( m_dwShading == 0 )
			CGrDC::FillSolidRect( hDraw, &rect, rgbBck );
		else if ( m_dwShading == 1 )
			CGrDC::VertGradientFill( hDraw, &rect,	rgbBckLt, rgbBckDk );
		else if ( m_dwShading == 3 )
		{
			CGrDC::VertGradientFill(	m_bck, m_bck, 
										CGrDC::ScaleColor( GetSysColor( COLOR_3DFACE ), 50 ),
										CGrDC::ScaleColor( GetSysColor( COLOR_3DFACE ), -50 ) );
			m_bck.Aluminize( 2 );

		} // end else if
		else if ( m_dwShading == 4 )
		{
			CGrDC::VertGradientFill(	m_bck, m_bck, 
										CGrDC::ScaleColor( GetSysColor( COLOR_3DFACE ), 50 ),
										CGrDC::ScaleColor( GetSysColor( COLOR_3DFACE ), -50 ) );
			m_bck.Texturize( 5 );

		} // end else if
		else
		{	// Gradient fill
			COLORREF rgbCorner = m_rgbSel;
			if ( m_bSystemColors ) rgbCorner = GetSysColor( COLOR_ACTIVECAPTION );
			CGrDC::GradientFill( m_bck, &rect,	rgbBckLt, rgbBckDk, 
												rgbBckLt, rgbCorner );
		} // end else

		RECT brect;
		CopyRect( &brect, m_bck );

		HPEN whitepen = CreatePen( PS_SOLID, 3, ScaleColor( rgbBck, 120 ) );
		HPEN dkgraypen = CreatePen( PS_SOLID, 3, ScaleColor( rgbBck, -120 ) );
		HPEN oldpen = (HPEN)SelectObject( m_bck, whitepen );

		// Draw white line
		MoveToEx( m_bck, brect.right, brect.top, NULL );
		LineTo( m_bck, brect.left, brect.top );
		LineTo( m_bck, brect.left, brect.bottom );

		// Draw dark gray line
		SelectObject( m_bck, dkgraypen );
		MoveToEx( m_bck, brect.left, brect.bottom, NULL );
		LineTo( m_bck, brect.right, brect.bottom );
		LineTo( m_bck, brect.right, brect.top );

		SelectObject( m_bck, oldpen );
		DeleteObject( whitepen );
		DeleteObject( dkgraypen );

	} // end if

	// Draw background
	m_bck.Draw( hDraw, &rect );

	// Draw the menu items
	DrawMenuItems( hDraw, &rect );

	// Copy from offscreen
	if ( m_offscreen.GetSafeHdc() ) m_offscreen.Draw( hDC, &rect );
}
Ejemplo n.º 19
0
BOOL CItemList::Draw(HDC hDC, LPRECT pRect, HWND hWnd )
{
	// Reset default colors if needed
	if ( m_bAutoDefaultColors ) DefaultColors();

	// Check for no draw
	if ( m_dwNoDraw ) { m_dwNoDraw--; return TRUE; }

	RECT draw;
	CopyRect( &draw, pRect );

	// Fill in the back ground
	CGrDC::VertGradientFill( hDC, &draw, m_rgbBckTop, m_rgbBckBottom );

	// Draw side bar
	if ( m_bGroups )
	{	draw.right = draw.left + GROUPOFFSET;
		CGrDC::VertGradientFill( hDC, &draw, m_rgbBarTop, m_rgbBarBottom );
		CopyRect( &draw, pRect );
	} // end if

	// Draw the header
	m_header.Draw( hDC, &draw, m_lHScroll, m_bGroups ? GROUPOFFSET : 0 );

	// Draw line under header
	CGrDC::Line(	hDC, m_rgbHorzLines, 1,
					draw.left, draw.top + m_header.GetHeight(), 
					draw.right, draw.top + m_header.GetHeight() );


	// Offset header for groups if needed
	if ( m_bGroups ) draw.left += GROUPOFFSET;

	// Offset the rect below the header
	draw.top += m_header.GetHeight();
	if ( draw.top >= draw.bottom ) return TRUE;

	// Item rect
	RECT ir;				
	ir.left = draw.left;
	ir.top = draw.top;
	ir.right = draw.right;
	ir.bottom = draw.top;

	BOOL bCollapsed = FALSE;

	DWORD i = 0;

	if ( !m_bGroups ) i = m_dwLine;
	else while ( i < m_dwLine && i < m_dwPtr )
	{	
		if ( m_pIndex[ i ] != NULL ) 
		{	
			if ( ( m_pIndex[ i ]->flags & LIF_GROUP ) != 0 )
			{	if ( ( m_pIndex[ i ]->flags & LIF_COLLAPSED ) != 0 ) bCollapsed = TRUE;
				else bCollapsed = FALSE;
			} // end if
		} // end if
		i++;
	} // end while

	while ( i < m_dwPtr && ir.bottom < pRect->bottom )
	{
		LPLISTITEMINFO	plii = m_pIndex[ i ];

		// Skip collapsed items
		if ( bCollapsed ) 
			while ( plii != NULL && ( plii->flags & LIF_GROUP ) == 0 )
				if ( ++i < m_dwPtr ) plii = m_pIndex[ i ]; else plii = NULL;

		if ( plii != NULL )
		{
			// Calculate list item height
			ir.bottom = ir.top + plii->height;

			if ( m_bGroups && ( plii->flags & LIF_GROUP ) == 0 )
			{
				CGrDC::FillSolidRect( hDC, &ir, GetSysColor( COLOR_WINDOW ) );

			} // end if			

//			if ( ir.bottom < pRect->bottom )
			{
				// Draw tab
				if ( m_bGroups && ( plii->flags & LIF_GROUP ) != 0 )
				{
					RECT tab;
					CopyRect( &tab, &ir );
					tab.left = pRect->left; 
					tab.right = ir.left - 1;
					tab.bottom = tab.top + RW( tab );
					InflateRect( &tab, -2, -2 );

					CGrDC::Center( &tab, &ir, FALSE, TRUE ); 

					// Are we using XP themes?
//					if ( FALSE )
					if ( CXpTheme::IsWindowThemed( hWnd ) )
					{
						CXpTheme xpthm( hWnd, "TREEVIEW" );
						if ( ( plii->flags & LIF_COLLAPSED ) != 0 )
							xpthm.DrawThemeBackground( hDC, TVP_GLYPH, GLPS_CLOSED, &tab, NULL );
						else xpthm.DrawThemeBackground( hDC, TVP_GLYPH, GLPS_OPENED, &tab, NULL );

					} // end if

					else
					{
						CGrDC::FillSolidRect( hDC, &tab, m_rgbBckTop );
						CGrDC::Box3d( hDC, &tab, 1, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );

						long mh = tab.top + ( RH( tab ) / 2 );
						long mw = tab.left + ( RW( tab ) / 2 );

						CGrDC::Line(	hDC, RGB( 0, 0, 0 ), 1,
										tab.left + 2, mh, tab.right - 2, mh );
						if ( ( plii->flags & LIF_COLLAPSED ) != 0 )
							CGrDC::Line(	hDC, RGB( 0, 0, 0 ), 1,
											mw, tab.top + 2, mw, tab.bottom - 2 );

					} // end else

				} // end if

				// Draw this list item
				DrawItem( i, hDC, &ir );

				if ( m_bHorzLines )
				{
					CGrDC::Line(	hDC, m_rgbHorzLines, 1,
									ir.left, ir.top, ir.right, ir.top );

					if ( m_bGroups && ( plii->flags & LIF_GROUP ) != 0 &&
						 ( plii->flags & LIF_COLLAPSED ) != 0 )
					{	
						HPEN hPen = CreatePen( PS_SOLID, 1, m_rgbSelTop );
						HPEN hOldPen = (HPEN)::SelectObject( hDC, hPen );
						COLORREF oldcolor = SetBkColor( hDC, m_rgbBckTop );

						MoveToEx( hDC, ir.left, ir.bottom - 1, NULL );
						LineTo( hDC, ir.right, ir.bottom - 1 );

						::SelectObject( hDC, hOldPen );
						::DeleteObject( hPen );
						hPen = CreatePen( PS_SOLID, 1, RGB( 220, 220, 220 ) );
						hOldPen = (HPEN)::SelectObject( hDC, hPen );
						MoveToEx( hDC, ir.left, ir.bottom - 2, NULL );
						LineTo( hDC, ir.right, ir.bottom - 2 );

						
						// Release drawing objects
						SetBkColor( hDC, oldcolor );
						::SelectObject( hDC, hOldPen );
						::DeleteObject( hPen );

					} // end else


//					CGrDC::Box3d( hDC, &ir, 1, m_rgbHorzLines, m_rgbHorzLines );

				} // end if

				if ( m_bVertLines && ( plii->flags & LIF_GROUP ) == 0 )
				{
					long x = ir.left;

					CGrDC::Line(	hDC, m_rgbHorzLines, 1,
									x, ir.top, x, ir.bottom );

					x--;
					LPHEADERITEMINFO phii = NULL;
					while( ( phii = GetHeader().GetNext( phii ) ) != NULL &&
							GetHeader().GetNext( phii ) != NULL )
					{
						// Add width
						x += phii->width;

						// Draw vertical line
						CGrDC::Line(	hDC, m_rgbHorzLines, 1,
										x, ir.top, x, ir.bottom );

					} // end while

					CGrDC::Line(	hDC, m_rgbHorzLines, 1,
									ir.right - 1, ir.top, 
									ir.right - 1, ir.bottom );


				} // end if

			} // end if

			// Next item position
			ir.top = ir.bottom;

			// Are we collapsing?
			if ( ( plii->flags & LIF_GROUP ) != 0 )
			{	if ( ( plii->flags & LIF_COLLAPSED ) != 0 ) bCollapsed = TRUE;
				else bCollapsed = FALSE;
			} // end if

		} // end if

		// Next item
		i++;

	} // end while

	// Draw last horz line
	if ( m_bHorzLines )
		CGrDC::Line(	hDC, m_rgbHorzLines, 1,
						ir.left, ir.bottom, ir.right, ir.bottom );

/*	if ( m_bVertLines )
	{
		long x = draw.left;

		CGrDC::Line(	hDC, m_rgbHorzLines, 1,
						x, draw.top, x, ir.bottom );

		x--;
		LPHEADERITEMINFO phii = NULL;
		while( ( phii = GetHeader().GetNext( phii ) ) != NULL )
		{
			// Add width
			x += phii->width;

			// Draw vertical line
			CGrDC::Line(	hDC, m_rgbHorzLines, 1,
							x, draw.top, x, ir.bottom );

		} // end while
	} // end if
*/
	
	return TRUE;
}
Ejemplo n.º 20
0
void CRenderTarget::SetViewport()
{
	FUNCLOG
	glViewport(0, 0, RW(fbw), RH(fbh));
}
Ejemplo n.º 21
0
// helper function for save frame in picture.
inline void FrameSavingHelper()
{
	if (g_bSaveFrame)
	{
		if (vb[0].prndr != NULL)
		{
			SaveTexture("frame1.tga", GL_TEXTURE_RECTANGLE_NV, vb[0].prndr->ptex, RW(vb[0].prndr->fbw), RH(vb[0].prndr->fbh));
		}

		if (vb[1].prndr != NULL && vb[0].prndr != vb[1].prndr)
		{
			SaveTexture("frame2.tga", GL_TEXTURE_RECTANGLE_NV, vb[1].prndr->ptex, RW(vb[1].prndr->fbw), RH(vb[1].prndr->fbh));
		}

#ifdef _WIN32
		else 
		{
			DeleteFile(L"frame2.tga");
		}
#endif
	}
}