⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 childfrm.cpp

📁 3D游戏场景编辑器
💻 CPP
字号:
/****************************************************************************************/
/*  ChildFrm.cpp                                                                        */
/*                                                                                      */
/*  Author:       Jim Mischel, Ken Baird                                                */
/*  Description:  Frame and splitter window code                                        */
/*                                                                                      */
/*  The contents of this file are subject to the Genesis3D Public License               */
/*  Version 1.01 (the "License"); you may not use this file except in                   */
/*  compliance with the License. You may obtain a copy of the License at                */
/*  http://www.genesis3d.com                                                            */
/*                                                                                      */
/*  Software distributed under the License is distributed on an "AS IS"                 */
/*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
/*  the License for the specific language governing rights and limitations              */
/*  under the License.                                                                  */
/*                                                                                      */
/*  The Original Code is Genesis3D, released March 25, 1999.                            */
/*Genesis3D Version 1.1 released November 15, 1999                            */
/*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
/*                                                                                      */
/*  Modified by Tom Morris for GenEdit-Classic ver. 0.5, Dec. 15, 2000					*/
/****************************************************************************************/
#include "stdafx.h"
#include "Globals.h"
#include "ChildFrm.h"
#include "GenEditView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


	BEGIN_MESSAGE_MAP(CFixedSplitterWnd, CSplitterWnd)
#if (_MFC_VER == 0x0421)
		//{{AFX_MSG_MAP(CFixedSplitterWnd)
		//}}AFX_MSG_MAP
#endif
 	END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChildFrame

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CChildFrame)
	ON_WM_SIZE()
	ON_WM_SETFOCUS()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_SETTEXT, OnSetText)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	InitDone=FALSE;
}

CChildFrame::~CChildFrame()
{
}

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	//Create maximized
	cs.style |= WS_MAXIMIZE|WS_VISIBLE;
	return CMDIChildWnd::PreCreateWindow(cs);
}

BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
{
	int x, y;
	RECT r;

	if (!m_wndSplitter.CreateStatic(this, 2, 2))
	{
		TRACE0("Failed to CreateStaticSplitter\n");
		return FALSE;
	}
	GetClientRect(&r);
	x=r.right>>1;
	y=r.bottom>>1;

	if (!m_wndSplitter.CreateView(0, 0,
		RUNTIME_CLASS(CGenEditView), CSize(x, y), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	if (!m_wndSplitter.CreateView(0, 1,
		RUNTIME_CLASS(CGenEditView), CSize(x, y), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	if (!m_wndSplitter.CreateView(1, 0,
		RUNTIME_CLASS(CGenEditView), CSize(x, y), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	if (!m_wndSplitter.CreateView(1, 1,
		RUNTIME_CLASS(CGenEditView), CSize(x, y), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	//set the view types
	((CGenEditView *)m_wndSplitter.GetPane(0,0))->OnViewType(ID_VIEW_TEXTUREVIEW);
	((CGenEditView *)m_wndSplitter.GetPane(0,1))->OnViewType(ID_VIEW_TOPVIEW);
	((CGenEditView *)m_wndSplitter.GetPane(1,0))->OnViewType(ID_VIEW_FRONTVIEW);
	((CGenEditView *)m_wndSplitter.GetPane(1,1))->OnViewType(ID_VIEW_SIDEVIEW);

	// activate the top left view
	SetActiveView((CView*)m_wndSplitter.GetPane(0,1));

	InitDone=TRUE;

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
						
#pragma warning (disable: 4100)
LRESULT CChildFrame::OnSetText(WPARAM wParam, LPARAM lParam)
{
//	const char *Text = (const char *)lParam;
//	if( Text[0] == '-' ) {
		return Default();
//	}
//	return 1;
}
#pragma warning (default: 4100)

void CChildFrame::OnSize(UINT nType, int cx, int cy) 
{
	//center the panes on a size
	if(InitDone &&(m_wndSplitter.GetRowCount()==2 && m_wndSplitter.GetColumnCount()==2))
	{
		m_wndSplitter.SetColumnInfo(0, cx>>1, 0);
		m_wndSplitter.SetColumnInfo(1, cx>>1, 0);
		m_wndSplitter.SetRowInfo(0, cy>>1, 0);
		m_wndSplitter.SetRowInfo(1, cy>>1, 0);
	}
	CMDIChildWnd::OnSize(nType, cx, cy);
}

void CChildFrame::OnSetFocus(CWnd* pOldWnd) 
{
	NMHDR hdr;
	CWnd *pParent;

	CMDIChildWnd::OnSetFocus(pOldWnd);

	// notify main frame window that we've been given the focus
	hdr.hwndFrom = this->m_hWnd;
	hdr.idFrom = 0;
	hdr.code = WM_SETFOCUS;
	pParent = this->GetMDIFrame ();
	if (pParent != NULL)
	{
		pParent->SendMessage (WM_NOTIFY, 0, (LPARAM)&hdr);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -