Files
firestorm/Gameleap/code/mw4/Tools/ERF Deluxe/MainFrm.cpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

234 lines
5.3 KiB
C++

// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include <ElementRenderer\ElementRendererHeaders.hpp>
#include "MFC Gos.h"
#include "MainFrm.h"
extern ElementRenderer::StateChange *Camera_State;
extern CMFCGosApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_CLOSE()
ON_WM_DROPFILES()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
{
TRACE0("Failed to create dialogbar\n");
return -1; // fail to create
}
if (!m_wndReBar.Create(this) ||
!m_wndReBar.AddBar(&m_wndToolBar) ||
!m_wndReBar.AddBar(&m_wndDlgBar))
{
TRACE0("Failed to create rebar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
return CFrameWnd::WindowProc(message, wParam, lParam);
}
BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// CG: The following block was added by the Splitter Bar component.
{
/*
if (!m_wndSplitter.Create(this,
1, 2, // TODO: adjust the number of rows, columns
CSize(10, 10), // TODO: adjust the minimum pane size
pContext))
{
TRACE0("Failed to create splitter bar ");
return FALSE; // failed to create
}
*/
if (!m_wndSplitter.CreateStatic(this,1,2))
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
CRect rct;
GetClientRect(&rct);
m_wndSplitter.CreateView(0,0, RUNTIME_CLASS(CMFCGosView),
CSize((rct.Width()*2)/3,(rct.Height())),pContext);
m_wndSplitter.CreateView(0,1, RUNTIME_CLASS(CErfElemInfoView),
CSize((rct.Width())/3,(rct.Height())),pContext);
InitialUpdateFrame(NULL,TRUE);
/*
CMFCGosView *view;
view=(CMFCGosView *)m_wndSplitter.GetPane(0,0);
view->View=VIEW_TREE;
view=(CMFCGosView *)m_wndSplitter.GetPane(0,1);
view->View=VIEW_INFO;
*/
return TRUE;
}
}
void CMainFrame::BalanceFrames()
{
int rx1,min;
int rx2;
m_wndSplitter.GetColumnInfo(0,rx1,min);
m_wndSplitter.GetColumnInfo(1,rx2,min);
rx1=((rx2-rx1)*2)/3;
m_wndSplitter.SetColumnInfo(0,rx1,10);
m_wndSplitter.RecalcLayout();
//GetClientRect(&OldRect);
}
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
Camera_State=NULL;
// theApp.GosShutDown();
CFrameWnd::OnClose();
}
void CMainFrame::OnDropFiles(HDROP hDropInfo)
{
char szTempStorage[64*1024+1] = "";
char * tmp = szTempStorage;
SetActiveWindow(); // activate us first !
UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
if (nFiles >= 64)
{
MessageBox("Too many files. Files > 64.", "Error", MB_OK);
return;
}
CMFCGosApp* pApp = (CMFCGosApp *)AfxGetApp();
ASSERT(pApp != NULL);
for (UINT iFile = 0; iFile < nFiles; iFile++)
{
TCHAR szFileName[_MAX_PATH];
int nLen = ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
lstrcpy(tmp, szFileName);
tmp += nLen;
*(tmp++) = '/'; // put in the separator and null terminate it.
*tmp = 0;
}
CMFCGosDoc * pDoc = GetActiveErfDocument();
if (!pDoc)
return;
pApp->OnFileNewExternal();
pDoc->OnOpenDocument(szTempStorage);
::DragFinish(hDropInfo);
}