コード例 #1
0
void CObjectImageArray::PaintImageGrayed (CG16bitImage &Dest, int x, int y, int iTick, int iRotation) const

//	PaintImageGrayed
//
//	Paints the image on the destination

	{
	if (m_pImage)
		{
		CG16bitImage *pSource = m_pImage->GetImage();
		if (pSource == NULL)
			return;

		int xSrc = ComputeSourceX(iTick);

		if (m_pRotationOffset)
			{
			x += m_pRotationOffset[iRotation % m_iRotationCount].x;
			y -= m_pRotationOffset[iRotation % m_iRotationCount].y;
			}

		Dest.BltGray(xSrc,
				m_rcImage.top + (iRotation * RectHeight(m_rcImage)),
				RectWidth(m_rcImage),
				RectHeight(m_rcImage),
				128,
				*pSource,
				x - (RectWidth(m_rcImage) / 2),
				y - (RectHeight(m_rcImage) / 2));
		}
	}
コード例 #2
0
void AlignIcons( HWND hDlg, LPALIGNOBJECTS_PARMS lpAlignParms )
/************************************************************************/
{
RECT		bRect, cRect;
int		xOffset, yOffset, i, wind;
LFIXED	vSpace, hSpace, fx, fy;
HWND		hWnd;

GetClientRect( hWnd = GetDlgItem( hDlg, IDC_ALIGN_GRID ), &bRect );

vSpace = FGET( RectHeight( &bRect ) - ( ALIGN_NUM_OBJECTS * ICON_HEIGHT ),
	ALIGN_NUM_OBJECTS - 1 );
hSpace = FGET( RectWidth( &bRect ) - ( ALIGN_NUM_OBJECTS * ICON_WIDTH ),
	ALIGN_NUM_OBJECTS - 1 );

fx = fy = 0;

for( i = 0, wind = GW_CHILD; i < ALIGN_NUM_OBJECTS; i++, wind = GW_HWNDNEXT )
	{	
	hWnd = GetWindow( hWnd, wind );
	GetClientRect( hWnd, &cRect );
	cRect.right -= 1;
	cRect.bottom -= 1;
	MapWindowPoints( hWnd, GetDlgItem( hDlg, IDC_ALIGN_GRID ),
		( LPPOINT )&cRect, 2 );
	ShowWindow( hWnd, SW_HIDE );
	ObjAlign( &bRect, &cRect, lpAlignParms, vSpace, hSpace,
		&xOffset, &yOffset, &fx, &fy );
	OffsetRect( &cRect, xOffset, yOffset );
	MoveWindow( hWnd, cRect.left, cRect.top, RectWidth( &cRect ),
		RectHeight( &cRect ), TRUE );
	UpdateWindow( GetDlgItem( hDlg, IDC_ALIGN_GRID ) );
	ShowWindow( hWnd, SW_SHOWNA );
	}
}
コード例 #3
0
void CObjectImageArray::CopyImage (CG16bitImage &Dest, int x, int y, int iFrame, int iRotation) const

//	CopyImage
//
//	Copies entire image to the destination

	{
	if (m_pImage)
		{
		CG16bitImage *pSource = m_pImage->GetImage();
		if (pSource == NULL)
			return;

		int xSrc = m_rcImage.left + (iFrame * RectWidth(m_rcImage));
		int ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage));

		Dest.Blt(xSrc,
				ySrc,
				RectWidth(m_rcImage),
				RectHeight(m_rcImage),
				*pSource,
				x,
				y);

		Dest.CopyAlpha(xSrc,
				ySrc,
				RectWidth(m_rcImage),
				RectHeight(m_rcImage),
				*pSource,
				x,
				y);
		}
	}
コード例 #4
0
ファイル: CAniTextInput.cpp プロジェクト: bmer/Alchemy
void CAniTextInput::Create (const RECT &rcRect,
							const CG16bitFont *pFont,
							DWORD dwOptions,
							IAnimatron **retpAni)

//	Create
//
//	Creates text with basic attributes

	{
	//	Create

	CAniTextInput *pText = new CAniTextInput;
	pText->SetPropertyVector(PROP_POSITION, CVector(rcRect.left, rcRect.top));
	pText->SetPropertyFont(PROP_FONT, pFont);

	//	Make sure size is big enough to fit font

	if (pFont)
		{
		int cyMin = pFont->GetHeight() + PADDING_TOP + PADDING_BOTTOM;
		if (cyMin > RectHeight(rcRect))
			pText->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcRect), cyMin));
		else
			pText->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcRect), RectHeight(rcRect)));
		}

	//	Options

	if (dwOptions & OPTION_PASSWORD)
		pText->m_bPassword = true;

	*retpAni = pText;
	}
コード例 #5
0
void CObjectImageArray::PaintSilhoutte (CG16bitImage &Dest,
										int x,
										int y,
										int iTick,
										int iRotation,
										COLORREF wColor) const

//	PaintSilhouette
//
//	Paints a silhouette of the object

	{
	if (m_pImage)
		{
		CG16bitImage &Source(*m_pImage->GetImage());
		int xSrc = ComputeSourceX(iTick);

		if (m_pRotationOffset)
			{
			x += m_pRotationOffset[iRotation % m_iRotationCount].x;
			y -= m_pRotationOffset[iRotation % m_iRotationCount].y;
			}

		Dest.FillMask(xSrc,
				m_rcImage.top + (iRotation * RectHeight(m_rcImage)),
				RectWidth(m_rcImage),
				RectHeight(m_rcImage),
				Source,
				wColor,
				x - (RectWidth(m_rcImage) / 2),
				y - (RectHeight(m_rcImage) / 2));
		}
	}
コード例 #6
0
ファイル: CGTextArea.cpp プロジェクト: bmer/Alchemy
void CGTextArea::Paint (CG32bitImage &Dest, const RECT &rcRect)

//	Paint
//
//	Handle paint

	{
	RECT rcText = CalcTextRect(rcRect);

	//	Paint the background

	if (m_iBorderRadius > 0)
		CGDraw::RoundedRect(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_iBorderRadius, m_rgbBackColor);
	else
		Dest.Fill(rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_rgbBackColor);

	//	Paint the editable box

	if (m_bEditable)
		{
		CG32bitPixel rgbBorderColor = CG32bitPixel::Blend(CG32bitPixel(0, 0, 0), m_rgbColor, (BYTE)128);
		CGDraw::RectOutlineDotted(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), rgbBorderColor);
		}

	//	Paint the content

	if (!m_sText.IsBlank())
		PaintText(Dest, rcText);
	else
		PaintRTF(Dest, rcText);
	}
コード例 #7
0
void CObjectImageArray::PaintImageUL (CG16bitImage &Dest, int x, int y, int iTick, int iRotation, bool srcAlpha) const

//	PaintImageUL
//
//	Paints the image. x,y is the upper-left corner of the destination
//
//	Note: This should not use the rotation offsets

	{
	if (m_pImage)
		{
		CG16bitImage &Source(*m_pImage->GetImage());
		int xSrc = ComputeSourceX(iTick);
		int ySrc;

		if (m_iBlending == blendLighten)
			{
			Dest.BltLighten(xSrc,
					m_rcImage.top + (iRotation * RectHeight(m_rcImage)),
					RectWidth(m_rcImage),
					RectHeight(m_rcImage),
					255,
					Source,
					x,
					y);
			}
		else
			{
			ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage));
			Dest.Blt(x, y, Source, xSrc,
					ySrc, xSrc + RectWidth(m_rcImage), ySrc + RectHeight(m_rcImage), srcAlpha);
			}
		}
	}
コード例 #8
0
ファイル: DockWnd.c プロジェクト: 4aiman/HexEdit
LRESULT DockPanel_GetMinMaxInfo(DOCKPANEL *dpp, MINMAXINFO *pmmi)
{
	if(dpp && (dpp->dwStyle & DWS_FIXED_SIZE))
	{
		RECT rect;

		GetClientRect(dpp->hwndContents, &rect);
		AdjustRectBorders(dpp, &rect, 1);
		CalcFloatingRect(dpp->hwndPanel, &rect);

		if(dpp->dwStyle & DWS_FIXED_HORZ)
		{
			pmmi->ptMaxTrackSize.x = RectWidth(&rect);
			pmmi->ptMinTrackSize.x = RectWidth(&rect);
		}

		if(dpp->dwStyle & DWS_FIXED_VERT)
		{
			pmmi->ptMaxTrackSize.y = RectHeight(&rect);
			pmmi->ptMinTrackSize.y = RectHeight(&rect);
		}
	}

	return 0;
}
コード例 #9
0
void OverlayElementEditor::CreateEditorWindow()
{
	m_Self = CreateDialogParam(GetWindowInstance(m_Parent), MAKEINTRESOURCE(m_ResourceId), m_Parent, 
		s_DialogProc, (LPARAM)this);

	if (m_Self)
	{
		RECT parentRc;
		GetWindowRect(m_Parent, &parentRc);

		RECT rc;
		GetWindowRect(m_Self, &rc);

		//	Position the editor depending on owner window position.
		RECT selfRect;
		selfRect.right = parentRc.right;
		selfRect.top = parentRc.top;
		selfRect.left = selfRect.right - RectWidth(rc);
		selfRect.bottom = selfRect.top + RectHeight(rc);
		MoveWindow(m_Self, selfRect.left, selfRect.top, RectWidth(rc), RectHeight(rc), FALSE);

		//	Make window semi-transparent.
		SetWindowLong(m_Self, GWL_EXSTYLE, GetWindowLong(m_Self, GWL_EXSTYLE) | WS_EX_LAYERED);
		SetLayeredWindowAttributes(m_Self, RGB(0, 0, 0), 220, LWA_ALPHA);
	}
}
コード例 #10
0
ファイル: AddressBar.cpp プロジェクト: GMIS/GMIS
LRESULT CAddressBar::OnPaint(){

	RECT rcViewport; 
	GetClientRect(m_hWnd,&rcViewport);
	
	PAINTSTRUCT ps;				
	HDC hdc = BeginPaint(m_hWnd, &ps);

	if(rcViewport.right==rcViewport.left || rcViewport.top==rcViewport.bottom){
		::EndPaint(m_hWnd, &ps);	
		return 0;
	}

	HDC DCMem = ::CreateCompatibleDC(hdc);
	HBITMAP bmpCanvas=::CreateCompatibleBitmap(hdc, RectWidth(rcViewport),RectHeight(rcViewport));
	assert(bmpCanvas);
	HBITMAP OldBitmap = (HBITMAP)::SelectObject(DCMem, bmpCanvas );

	
	if(m_State & SPACE_SHOWBKG){
		FillRect(DCMem,rcViewport,m_crViewBkg);
	}

	UINT	OldMode	= ::SetBkMode(DCMem,TRANSPARENT );

	HFONT	pOldFont=NULL; 

	if (m_bConnected)
	{
		m_ConnectBnt.m_Name = _T("Break");
		m_ConnectBnt.Draw(DCMem);
	}else{
		m_ConnectBnt.m_Name = _T("Connect");
		m_ConnectBnt.Draw(DCMem);
	}

	COLORREF Oldcr = ::SetTextColor(DCMem,RGB(0,0,0));
	RECT rc = rcViewport;
	rc.left+=4;
	rc.right -= 100;
	if(rc.right<rc.left)rc.right=rc.left;

	::DrawText(DCMem,m_CurAddress.c_str(),m_CurAddress.size(),&rc,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);


	if(pOldFont)::SelectObject(DCMem, pOldFont );
	::SetBkMode(DCMem, OldMode );

	if(m_State & SPACE_SHOWWINBORDER){
		DrawEdge(DCMem,rcViewport,m_crWinBorder);// Border
	}
	
	::BitBlt(hdc, 0, 0, RectWidth(rcViewport), RectHeight(rcViewport), DCMem, 0, 0, SRCCOPY );
	::SelectObject(DCMem, OldBitmap );
	::DeleteObject(bmpCanvas);
	::DeleteDC(DCMem);
	::EndPaint(m_hWnd, &ps);
	return 0;
}
コード例 #11
0
RECT CalculateNonClientArea(HWND hwnd)
{
	RECT window, client, nonclient;
	GetWindowRect(hwnd, &window), GetClientRect(hwnd, &client);
	int nonClientWidth  = RectWidth(window) - RectWidth(client),
		nonClientHeight = RectHeight(window) - RectHeight(client);
		
	nonclient.top = nonclient.left = 0; 
	nonclient.right = nonClientWidth; nonclient.bottom = nonClientHeight;
	return nonclient;
}
コード例 #12
0
void CLoadGameSession::CmdReadComplete (CListSaveFilesTask *pTask)

//	CmdReadComplete
//
//	We've finished loading the list of games

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	RECT rcRect;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcRect);

	//	Done with wait animation

	StopPerformance(ID_CTRL_WAIT);

	//	Check for error

	CString sError;
	if (pTask->GetResult(&sError) != NOERROR)
		{
		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_TITLE, strPatternSubst(ERR_DESC, sError), rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	If we have no entries, then show a message

	IAnimatron *pList = pTask->GetListHandoff();
	if (pList->GetPropertyInteger(PROP_COUNT) == 0)
		{
		delete pList;

		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_NO_ENTRIES, ERR_NO_ENTRIES_DESC, rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	Show the profile

	RECT rcList;
	pList->GetSpacingRect(&rcList);

	pList->SetPropertyVector(PROP_POSITION, CVector(rcRect.left + (RectWidth(rcRect) - RectWidth(rcList)) / 2, rcRect.top));
	pList->SetPropertyVector(PROP_SCALE, CVector(SAVE_ENTRY_WIDTH, RectHeight(rcRect)));
	pList->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)RectHeight(rcRect));
	RegisterPerformanceEvent(pList, EVENT_ON_DOUBLE_CLICK, CMD_OK_SESSION);

	StartPerformance(pList, ID_LIST, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
	}
コード例 #13
0
void CMessageSession::CreateDlgMessage (IAnimatron **retpDlg)

//	CreateDlgMessage
//
//	Creates the message dialog box

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumFont = VI.GetFont(fontMedium);

	//	Figure out where the login dialog box will appear

	RECT rcCenter;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter);

	RECT rcDlg = rcCenter;
	int cyDlg = 10 * VI.GetFont(fontLarge).GetHeight();
	rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
	rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
	rcDlg.right = rcDlg.left + DLG_WIDTH;
	rcDlg.bottom = rcDlg.top + cyDlg;

	//	Create the dialog box and a container for the controls

	IAnimatron *pDlg;
	CAniSequencer *pContainer;
	VI.CreateStdDialog(rcDlg, m_sTitle, &pDlg, &pContainer);

	int y = 0;

	//	Add the message

	IAnimatron *pMessage = new CAniText;
	pMessage->SetPropertyVector(PROP_POSITION, CVector(0, y));
	pMessage->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcDlg), RectHeight(rcDlg)));
	pMessage->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
	pMessage->SetPropertyFont(PROP_FONT, &MediumFont);
	pMessage->SetPropertyString(PROP_TEXT, m_sMessage);

	pContainer->AddTrack(pMessage, 0);

	//	Add close button at the bottom

	IAnimatron *pButton;
	int xButtons = (RectWidth(rcDlg) - DEFAULT_BUTTON_WIDTH) / 2;
	int yButtons = RectHeight(rcDlg) - DEFAULT_BUTTON_HEIGHT;
	VI.CreateButton(pContainer, CMD_CLOSE, xButtons, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, CVisualPalette::OPTION_BUTTON_DEFAULT, CONSTLIT("OK"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CLOSE);

	//	Done

	*retpDlg = pDlg;
	}
コード例 #14
0
ファイル: DockLib.c プロジェクト: 4aiman/HexEdit
HDWP DockWnd_DeferPanelPos(HDWP hdwp, HWND hwndMain, RECT *rect)
{
	DOCKSERVER *dsp = GetDockServer(hwndMain);
	DOCKPANEL *dpp;

	if(dsp == 0)
		return 0;

	CopyRect(&dsp->DockRect, rect);
	CopyRect(&dsp->ClientRect, rect);

	for(dpp = dsp->PanelListHead; dpp; dpp = dpp->flink)
	{
		RECT rc = *rect;
		RECT rc2;
	                 
		if(dpp->fDocked == FALSE || dpp->fVisible == FALSE)
		{
			continue;
		}

		GetPanelClientSize(dpp, &rc2, TRUE);
		
		if(dpp->dwStyle & DWS_DOCKED_LEFT)
		{
			rc.right = rc.left + RectWidth(&rc2);
		}
		else if(dpp->dwStyle & DWS_DOCKED_RIGHT)
		{
			rc.left = rc.right - RectWidth(&rc2);	
		}
		else if(dpp->dwStyle & DWS_DOCKED_TOP)
		{
			rc.bottom = rc.top + RectHeight(&rc2);
		}
		else if(dpp->dwStyle & DWS_DOCKED_BOTTOM)
		{
			rc.top = rc.bottom - RectHeight(&rc2);
		}

		SubtractRect(rect, rect, &rc);

		hdwp = DeferWindowPos(hdwp, dpp->hwndPanel, 0, rc.left, rc.top, rc.right-rc.left,rc.bottom-rc.top,
			SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
	}

    CopyRect(&dsp->ClientRect, rect);

	return hdwp;
}
コード例 #15
0
void CObjectImageArray::GenerateScaledImages (int iRotation, int cxWidth, int cyHeight) const

//	GenerateScaledImages
//
//	Generate scaled images

	{
	ASSERT(iRotation >= 0 && iRotation < m_iRotationCount);

	//	Allocate the array of images (if not already allocated)

	if (m_pScaledImages == NULL)
		m_pScaledImages = new CG16bitImage [m_iRotationCount];

	//	If the image for this rotation has already been initialized, then
	//	we're done

	if (m_pScaledImages[iRotation].HasRGB())
		return;

	//	Otherwise we need to create the scaled image

	m_pScaledImages[iRotation].CreateBlank(cxWidth, cyHeight, false);

	//	Get the extent of the source image

	RECT rcSrc;
	rcSrc.left = ComputeSourceX(0);
	rcSrc.top = m_rcImage.top + (iRotation * RectHeight(m_rcImage));
	rcSrc.right = rcSrc.left + RectWidth(m_rcImage);
	rcSrc.bottom = rcSrc.top + RectHeight(m_rcImage);

	CG16bitImage *pSource = m_pImage->GetImage();
	if (pSource == NULL)
		return;

	//	Scale the image

	m_pScaledImages[iRotation].GaussianScaledBlt(
			rcSrc.left, rcSrc.top,
			RectWidth(rcSrc),
			RectHeight(rcSrc),
			*pSource,
			0, 0,
			cxWidth,
			cyHeight);

	m_pScaledImages[iRotation].SetTransparentColor(0);
	}
コード例 #16
0
Metric CAniVScroller::CalcTotalHeight (void)

//	CalcTotalHeight
//
//	Returns the total height of the content

{
    int i;

    //	Compute

    Metric rTotal = 0.0;
    for (i = 0; i < m_List.GetCount(); i++)
    {
        SLine *pList = &m_List[i];

        RECT rcLine;
        pList->pAni->GetSpacingRect(&rcLine);
        Metric yBottom = pList->pAni->GetPropertyVector(PROP_POSITION).GetY()
                         + (Metric)RectHeight(rcLine);

        if (yBottom > rTotal)
            rTotal = yBottom;
    }

    return rTotal + m_Properties[INDEX_PADDING_BOTTOM].GetMetric();
}
コード例 #17
0
void StatusOfRectangle(
/***********************************************************************/
LPRECT lpRect,
LFIXED fScale)
{
STRING szUnit, szString1, szString2, szString3, szString4;
LPSTR lpUnit;
RECT rFile;
int Resolution;

OrderRect( lpRect, &rFile );
if ( fScale )
	{
	Resolution = 1000;
	ScaleRect( &rFile, fScale );
	}
else
if (lpImage)
	Resolution = FrameResolution( ImgGetBaseEditFrame(lpImage) );
if ( AstralStr( Control.Units-IDC_PREF_UNITINCHES+IDS_INCHES, &lpUnit ) )
	{
	lstrcpy( szUnit, lpUnit );
	MessageStatus( IDS_RECT_STATUS,
		Unit2String( FGET( RectWidth(&rFile), Resolution ), szString1 ),
		Unit2String( FGET( RectHeight(&rFile), Resolution ), szString2),
		(LPSTR)szUnit,
		Unit2String( FGET( rFile.left, Resolution ), szString3 ),
		Unit2String( FGET( rFile.top, Resolution ), szString4 ) );
	}
}
コード例 #18
0
bool CGSelectorArea::LButtonDown (int x, int y)

//	LButtonDown
//
//	Handle mouse button

	{
	int i;

	//	All coordinates are relative to the center of the area.

	const RECT &rcRect = GetRect();
	int xCenter = rcRect.left + (RectWidth(rcRect) / 2);
	int yCenter = rcRect.top + RectHeight(rcRect) / 2;

	//	See if we've clicked on something

	for (i = 0; i < m_Regions.GetCount(); i++)
		{
		const SEntry &Entry = m_Regions[i];

		//	Convert the rect to destination coordinates

		RECT rcRegion;
		CalcRegionRect(Entry, xCenter, yCenter, &rcRegion);

		//	If we clicked in the region, signal an action

		if (x >= rcRegion.left && x < rcRegion.right
				&& y >= rcRegion.top && y < rcRegion.bottom)
			SignalAction(i);
		}

	return false;
	}
コード例 #19
0
static BOOL Video_OnSetCursor(HWND hWindow, HWND hWndCursor, UINT codeHitTest, UINT msg)
/***********************************************************************/
{
	LPVIDEO lpVideo;
	RECT rWindow;
	POINT pt;
	int x, y;

	if ( hWndCursor != hWindow ) // not in our window
		return( FALSE );

	if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) )
		return( FALSE );

	GetCursorPos( &pt );
	ScreenToClient( hWindow, &pt );
	GetClientRect( hWindow, &rWindow );
	x = (pt.x * 10) / RectWidth( &rWindow );
	y = (pt.y * 10) / RectHeight( &rWindow );

	if ( PtInHotspot( lpVideo, x, y, NO ) )
		{
		SetCursor( LoadCursor( GetApp()->GetInstance(), MAKEINTRESOURCE(IDC_HAND_POINT_CURSOR) ) );
		return( TRUE );
		}

	return( FORWARD_WM_SETCURSOR(hWindow, hWndCursor, codeHitTest, msg, DefWindowProc) );
}
コード例 #20
0
static void Video_OnLButtonDown(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags)
/***********************************************************************/
{
	LPVIDEO lpVideo;
	RECT rWindow;

	if ( SHIFT )
		return;
	if ( bTrack )
		return;
	SetCapture( hWindow ); bTrack = TRUE;

	#ifdef _DEBUG
	if ( GetFocus() != hWindow )
		SetFocus( hWindow );
	#endif

	if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) )
		return;

	if ( !lpVideo->lpAllShots ) // if no jump table...
	{
		FORWARD_WM_COMMAND( GetParent(hWindow), GET_WINDOW_ID(hWindow), 0, 0, SendMessage );
		return;
	}

	// Process the proper event based on the "hotspot" that was clicked
	GetClientRect( hWindow, &rWindow );
	x = (x * 10) / RectWidth( &rWindow );
	y = (y * 10) / RectHeight( &rWindow );

	int iEventCode = PtInHotspot( lpVideo, x, y, YES );
	if ( iEventCode )
		Video_ProcessEvent( hWindow, lpVideo, iEventCode );
}
コード例 #21
0
//////////////////
// Move all the windows. Use DeferWindowPos for speed.
//
void
CWinMgr::SetWindowPositions(HWND hWnd)
{
	int nWindows = CountWindows();
	if (m_map && hWnd && nWindows>0) {
		HDWP hdwp = ::BeginDeferWindowPos(nWindows);
		int count=0;
		for (WINRECT* wrc=m_map; !wrc->IsEnd(); ++wrc) {
			if (wrc->IsWindow()) {
				assert(count < nWindows);
				HWND hwndChild = ::GetDlgItem(hWnd, wrc->GetID());
				if (hwndChild) {
					const RECT& rc = wrc->GetRect();
					::DeferWindowPos(hdwp,
						hwndChild,
						NULL,		// HWND insert after
						rc.left,rc.top,RectWidth(rc),RectHeight(rc),
						SWP_NOZORDER);
					InvalidateRect(hwndChild,NULL,TRUE); // repaint
					++count;
				}
			} else {
				// not a window: still need to repaint background
				InvalidateRect(hWnd, &wrc->GetRect(), TRUE);
			}
		}
		::EndDeferWindowPos(hdwp);
	}
}
コード例 #22
0
//////////////////
// Position all the rects so they're as wide/high as the total and follow one
// another; ie, are adjacent. This operation leaves the height (rows) and
// width (columns) unaffected. For rows, set each row's width to rcTotal and
// one below the other; for columns, set each column as tall as rcTotal and
// each to the right of the previous.
//
void
CWinMgr::PositionRects(WINRECT* pGroup, const RECT& rcTotal, BOOL bRow)
{
	LONG xoryPos = bRow ? rcTotal.top : rcTotal.left;

	CWinGroupIterator it;
	for (it=pGroup; it; it.Next()) {
		WINRECT* wrc = it;
		RECT& rc = wrc->GetRect();
		if (bRow) {							 // for ROWS:
			LONG height = RectHeight(rc);		 // height of row = total height
			rc.top    = xoryPos;				 // top = running yPos
			rc.bottom = rc.top + height;	 // ...
			rc.left   = rcTotal.left;		 // ...
			rc.right  = rcTotal.right;		 // ...
			xoryPos += height;				 // increment yPos

		} else {									 // for COLS:
			LONG width = RectWidth(rc);		 // width = total width
			rc.left    = xoryPos;			 // left = running xPos
			rc.right   = rc.left + width;	 // ...
			rc.top     = rcTotal.top;		 // ...
			rc.bottom  = rcTotal.bottom;	 // ...
			xoryPos += width;					 // increment xPos
		}
	}
}
コード例 #23
0
//////////////////
// Adjust the size of a single entry upwards to its desired size.
// Decrement hwRemaining by amount increased.
//
void
CWinMgr::AdjustSize(WINRECT* wrc, BOOL bRow,
	int& hwRemaining, HWND hWnd)
{
	SIZEINFO szi;
	OnGetSizeInfo(szi, wrc, hWnd);
	int hw = bRow ? szi.szDesired.cy : szi.szDesired.cx; // desired ht or wid
	if (wrc->Type() == WRCT_REST) {
		// for REST type, use all remaining space
		RECT& rc = wrc->GetRect();
		hw = hwRemaining + (bRow ? RectHeight(rc) : RectWidth(rc));
	}

	// Now hw is the desired height or width, and the current size of the
	// entry is the min size. So adjust the size upwards, and decrement
	// hwRemaining appropriately. This is a little confusing, but necessary so
	// each entry gets its min size.
	//
	int hwCurrent = wrc->GetHeightOrWidth(bRow); // current size
	int hwExtra = hw - hwCurrent;						// amount extra
	hwExtra = min(max(hwExtra, 0), hwRemaining);	// truncate
	hw = hwCurrent + hwExtra;							// new height-or-width
	wrc->SetHeightOrWidth(hw, bRow);				// set...
	hwRemaining -= hwExtra;								// and adjust remaining
}
コード例 #24
0
void CStatsSession::CreateCopyAnimation (const RECT &rcRect, int iDuration, IAnimatron **retpAni)

//	CreateCopyAnimation
//
//	Flashes a rect to indicate that the information was copied

	{
	const CVisualPalette &VI = m_HI.GetVisuals();

	IAnimatron *pAni;

	CAniRect::Create(CVector(rcRect.left, rcRect.top), 
			CVector(RectWidth(rcRect), RectHeight(rcRect)),
			VI.GetColor(colorTextFade),
			255,
			&pAni);

	//	Fade it

	CLinearFade *pFader = new CLinearFade;
	pFader->SetParams(iDuration, 0, iDuration, 128);
	pAni->AnimateProperty(PROP_OPACITY, pFader, 0);

	//	Done

	*retpAni = pAni;
	}
コード例 #25
0
LONG CTranscendenceWnd::WMSize (int cxWidth, int cyHeight, int iSize)

//	WMSize
//
//	Handle WM_SIZE

	{
	RECT rcClient;

	//	Compute the RECT where we draw the screen (in client coordinate)

	::GetClientRect(m_hWnd, &rcClient);
	m_rcWindowScreen.left = (RectWidth(rcClient) - g_cxScreen) / 2;
	m_rcWindowScreen.right = m_rcWindow.left + g_cxScreen;
	m_rcWindowScreen.top = (RectHeight(rcClient) - g_cyScreen) / 2;
	m_rcWindowScreen.bottom = m_rcWindow.top + g_cyScreen;
	::IntersectRect(&m_rcWindowScreen, &m_rcWindowScreen, &rcClient);

	//	Convert to screen coordinate

	m_rcWindow = m_rcWindowScreen;
	::ClientToScreen(m_hWnd, (LPPOINT)&m_rcWindow);
	::ClientToScreen(m_hWnd, (LPPOINT)&m_rcWindow + 1);

	//	Repaint

	::InvalidateRect(m_hWnd, NULL, TRUE);

	return 0;
	}
コード例 #26
0
void CAniVScroller::AddLine (IAnimatron *pAni)

//	AddLine
//
//	Adds a new line to the bottom (and takes ownership of pAni)

{
    //	Add it

    SLine *pLine = m_List.Insert();
    pLine->pAni = pAni;

    //	Initialize, in case this is being added after the animation has started.

    pAni->GoToStart();

    //	Cache some metrics

    RECT rcRect;
    pAni->GetSpacingRect(&rcRect);
    pLine->cyHeight = RectHeight(rcRect);

    //	Remember the max height of the list

    CVector vPos = pAni->GetPropertyVector(PROP_POSITION);
    Metric yEnd = vPos.GetY() + pLine->cyHeight;
    if (yEnd > m_cyEnd)
        m_cyEnd = yEnd;
}
コード例 #27
0
ALERROR CTextCrawlDisplay::Init (const RECT &rcRect, const CString &sText)

//	Init
//
//	Initialize the display

	{
	m_rcRect = rcRect;
	m_yPos = 0;

	//	Parse the string into multiple lines

	m_EpilogLines.DeleteAll();
	m_pFont->BreakText(sText, RectWidth(rcRect), &m_EpilogLines);

	//	Center the text in the region

	int cyHeight = m_EpilogLines.GetCount() * m_pFont->GetHeight() + 1;
	m_rcText.left = m_rcRect.left;
	m_rcText.right = m_rcRect.right;
	m_rcText.top = m_rcRect.top + (RectHeight(m_rcRect) - cyHeight) / 2;
	m_rcText.bottom = m_rcRect.bottom;

	return NOERROR;
	}
コード例 #28
0
ファイル: ICONS.C プロジェクト: cugxiangzhenwei/MySrcCode
/****************************************************************************
*
*     FUNCTION: DrawXORMask
*
*     PURPOSE:  Using DIB functions, draw XOR mask on hDC in Rect
*
*     PARAMS:   HDC         hDC    - The DC on which to draw
*               RECT        Rect   - Bounding rect for drawing area
*               LPICONIMAGE lpIcon - pointer to icon image data
*
*     RETURNS:  BOOL - TRUE for success, FALSE for failure
*
*     COMMENTS: Does not use any palette information since the
*               OS won't when it draws the icon anyway.
*
* History:
*                July '95 - Created
*
\****************************************************************************/
BOOL DrawXORMask( HDC hDC, RECT Rect, LPICONIMAGE lpIcon )
{
    int            	x, y;

    // Sanity checks
    if( lpIcon == NULL )
        return FALSE;
    if( lpIcon->lpBits == NULL )
        return FALSE;

    // Account for height*2 thing
    lpIcon->lpbi->bmiHeader.biHeight /= 2;

    // Locate it
    x = Rect.left + ((RectWidth(Rect)-lpIcon->lpbi->bmiHeader.biWidth)/2);
    y = Rect.top + ((RectHeight(Rect)-lpIcon->lpbi->bmiHeader.biHeight)/2);

    // Blast it to the screen
    SetDIBitsToDevice( hDC, x, y, lpIcon->lpbi->bmiHeader.biWidth, lpIcon->lpbi->bmiHeader.biHeight, 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight, lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS );

    // UnAccount for height*2 thing
    lpIcon->lpbi->bmiHeader.biHeight *= 2;

    return TRUE;
}
コード例 #29
0
void CTranscendenceWnd::ComputeScreenSize (void)

//	ComputeScreenSize
//
//	Computes g_cxScreen and g_cyScreen

	{
	//	By default we use the current resolution (unless in windowed mode)

	if (m_pTC->GetOptionBoolean(CGameSettings::windowedMode))
		{
		RECT rcClient;
		::GetClientRect(m_hWnd, &rcClient);

		g_cxScreen = RectWidth(rcClient);
		g_cyScreen = RectHeight(rcClient);
		}
	else
		{
		g_cxScreen = ::GetSystemMetrics(SM_CXSCREEN);
		g_cyScreen = ::GetSystemMetrics(SM_CYSCREEN);
		}

	//	Switch to 1024 resolution, if requested

	if (m_pTC->GetOptionBoolean(CGameSettings::force1024Res))
		{
		g_cxScreen = 1024;
		g_cyScreen = 768;
		}
	}
コード例 #30
0
ファイル: CScreenMgr.cpp プロジェクト: Sdw195/Transcendence
void CScreenMgr::OnWMSize (int cxWidth, int cyHeight, int iSize)

//	OnWMSize
//
//	Handle WM_SIZE

	{
	RECT rcClient;

	//	Compute the RECT where we draw the screen (in client coordinate)
	//	(We only care about this in non-DX cases because in DX we stretch
	//	the screen to fit the window).

	if (m_pDD == NULL)
		{
		::GetClientRect(m_hWnd, &rcClient);
		m_rcScreen.left = (RectWidth(rcClient) - m_cxScreen) / 2;
		m_rcScreen.right = m_rcScreen.left + m_cxScreen;
		m_rcScreen.top = (RectHeight(rcClient) - m_cyScreen) / 2;
		m_rcScreen.bottom = m_rcScreen.top + m_cyScreen;
		}

	//	Are we minimized?

	m_bMinimized = (iSize == SIZE_MINIMIZED);
	}