コード例 #1
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTDialogueWnd::DrawToSurface
//
//	PURPOSE:	Does the dirty work for drawing a single window to a surface
//
// ----------------------------------------------------------------------- //
BOOL CLTDialogueWnd::DrawToSurface(HSURFACE hSurfDest)
{
	ASSERT(m_bInitialized);

	if(m_hSurf)
	{
        LTRect rcDest;
		rcDest.left = GetWindowLeft();
		rcDest.top = GetWindowTop();
		rcDest.right = rcDest.left + m_nWidth;
		rcDest.bottom = rcDest.top + m_nHeight;
        g_pLTClient->ScaleSurfaceToSurface(hSurfDest,m_hSurf,&rcDest,NULL);
	}

	// Draw the frame
	if(m_bFrame && (m_collFrames.GetSize() == 8))
	{
        g_pLTClient->DrawSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_TOPLEFTFRAME],NULL,m_xPos,m_yPos,g_hColorTransparent);
        g_pLTClient->DrawSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_TOPRIGHTFRAME],NULL,m_xPos+m_nWidth-m_rcTotal.right,m_yPos,g_hColorTransparent);
        g_pLTClient->DrawSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_BOTTOMRIGHTFRAME],NULL,m_xPos+m_nWidth-m_rcTotal.right,m_yPos+m_nHeight-m_rcTotal.bottom,g_hColorTransparent);
        g_pLTClient->DrawSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_BOTTOMLEFTFRAME],NULL,m_xPos,m_yPos+m_nHeight-m_rcTotal.bottom,g_hColorTransparent);

		// Draw the four scaleable sides
        LTRect rcDest;
		rcDest.left = m_xPos;
		rcDest.top = m_yPos+m_rcTotal.top;
		rcDest.right = m_xPos+m_rcFrame.left;
		rcDest.bottom = m_yPos+m_nHeight-m_rcTotal.bottom;
        g_pLTClient->ScaleSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_LEFTFRAME],&rcDest,NULL,g_hColorTransparent);
		rcDest.left = m_xPos + m_nWidth - m_rcFrame.right;
		rcDest.right = m_xPos + m_nWidth;
        g_pLTClient->ScaleSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_RIGHTFRAME],&rcDest,NULL,g_hColorTransparent);
		rcDest.left = m_xPos+m_rcTotal.left;
		rcDest.top = m_yPos;
		rcDest.right = m_xPos+m_nWidth-m_rcTotal.right;
		rcDest.bottom = m_yPos+m_rcFrame.top;
        g_pLTClient->ScaleSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_TOPFRAME],&rcDest,NULL,g_hColorTransparent);
		rcDest.top = m_yPos + m_nHeight - m_rcFrame.bottom;
		rcDest.bottom = m_yPos + m_nHeight;
        g_pLTClient->ScaleSurfaceToSurfaceTransparent(hSurfDest,m_collFrames[DLG_BOTTOMFRAME],&rcDest,NULL,g_hColorTransparent);
	}

	// Draw the font & clip it
	if(!m_bClosing && !m_bOpening)
	{
        LTIntPt ptPos = g_pLayoutMgr->GetDialogueTextOffset();
		int nTop;
		if(m_lfdd.dwFlags & LTF_TIMED_SCROLL)
			nTop = GetWindowTop() + m_nHeight - ptPos.y - m_pFont->GetHeight();
		else
			nTop = GetWindowTop() + ptPos.y;

		g_pLTClient->SetOptimized2DBlend(LTSURFACEBLEND_ADD);
		m_pFont->Draw((char *)(LPCSTR)m_csText,hSurfDest,&m_lfdd,GetWindowLeft() + ptPos.x,nTop,&m_lfsd);
		g_pLTClient->SetOptimized2DBlend(LTSURFACEBLEND_ALPHA);
		return TRUE;
	}
	return TRUE;
}
コード例 #2
0
ファイル: LtWnd.cpp プロジェクト: Arc0re/lithtech
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTWnd::OnMouseMove
//
//	PURPOSE:	This is the actual mouse move handler
//
// ----------------------------------------------------------------------- //
BOOL CLTWnd::OnMouseMove(int xPos, int yPos)
{
	// Update the cursor's position on us
	m_xCursor = xPos - GetWindowLeft();
	m_yCursor = yPos - GetWindowTop();

	// Handle draggage if necessary
	if(s_pWndCapture == this)
	{
		if(IsFlagSet(LTWF_DRAGGABLE))
		{
			OnDrag(xPos,yPos);
		}
		else
		if(IsFlagSet(LTWF_PARENTDRAG))
		{
			// Drag our parent
			// Find our parent
			CLTWnd* pWnd = this;
			CLTWnd* pParent = m_pParentWnd;
			while(pWnd->IsFlagSet(LTWF_FIXEDCHILD) && pParent)
			{
				pWnd = pParent;
				pParent = pWnd->GetParent();
			}
			pWnd->OnDrag(xPos,yPos);
		}
	}

	return(this != s_pMainWnd);
}
コード例 #3
0
ファイル: LtWnd.cpp プロジェクト: Arc0re/lithtech
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTWnd::GetWindowRect
//
//	PURPOSE:	Gets the window rectangle in screen coordinates
//
//	NOTE:		The values don't necessarily have to be on the screen
//				For example, you might have (-5,-5,645,485) for a window
//				that is larger than the 640x480 screen
//
// ----------------------------------------------------------------------- //
void CLTWnd::GetWindowRect(CRect *pRect)
{
	int x = GetWindowLeft();
	int y = GetWindowTop();

	pRect->SetRect(x, y, x + m_nWidth, y + m_nHeight);
}
コード例 #4
0
bool Settings::SaveSettings()
////////////////////////////////////////////////////////////////////////
{
	DataFile settingsfile;
	if (settingsfile.CreateDataFile(GetSettingsFile()))
	{
		settingsfile.WriteText(BString("############################\n"));
		settingsfile.WriteText(BString("# Genesis Commander settings file\n"));
		settingsfile.WriteText(BString("############################\n"));
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# General settings\n"));
		settingsfile.WriteString(BString("LANGUAGE"), GetLanguage());
		settingsfile.WriteBool(BString("ASKONEXIT"), GetAskOnExit());
		settingsfile.WriteInteger(BString("WINDOWLEFT"), GetWindowLeft());
		settingsfile.WriteInteger(BString("WINDOWTOP"), GetWindowTop());
		settingsfile.WriteInteger(BString("WINDOWWIDTH"), GetWindowWidth());
		settingsfile.WriteInteger(BString("WINDOWHEIGHT"), GetWindowHeight());
		settingsfile.WriteString(BString("TERMINALWINDOW"), GetTerminalWindow());
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# Left panel\n"));
		settingsfile.WriteString(BString("LEFTPANELPATH"), GetLeftPanelPath());
		settingsfile.WriteText(BString("\n"));
		settingsfile.WriteText(BString("# Right panel\n"));
		settingsfile.WriteString(BString("RIGHTPANELPATH"), GetRightPanelPath());
	
		return true;
	}
	else
		return false;
}
コード例 #5
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTMaskedWnd::PtInWnd
//
//	PURPOSE:	Determines if a point is in the window
//
// ----------------------------------------------------------------------- //
BOOL CLTMaskedWnd::PtInWnd(int x, int y)
{
	// Make sure that the point is in the window's rectangle
	if(!CLTWnd::PtInWnd(x,y))
		return FALSE;

	// Do the irregular surface test if necessary
	if (m_bSurfaceTest && IsFlagSet(LTWF_TRANSPARENT) && m_hSurf)
	{
        HLTCOLOR hPixelHue;
        LTRESULT dr = g_pLTClient->GetPixel(m_hSurf, x - GetWindowLeft(), y - GetWindowTop(), &hPixelHue);
		if ((dr == LT_OK) && (hPixelHue != GetTransparentColor()))
			return TRUE;

		return FALSE;
	}

	return TRUE;
}
コード例 #6
0
ファイル: LtWnd.cpp プロジェクト: Arc0re/lithtech
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTWnd::GetSurfaceRect
//
//	PURPOSE:	Gets the surface rectangle in screen coordinates
//
// ----------------------------------------------------------------------- //
void CLTWnd::GetSurfaceRect(CRect *pRect)
{
	int x = GetWindowLeft() + m_xSurfPos;
	int y = GetWindowTop() + m_ySurfPos;
	pRect->SetRect(x, y, x + m_nSurfWidth, y + m_nSurfHeight);
}