www.pudn.com > 3dsMFCRender.rar > MainFrm.cpp, change:1998-03-21,size:3064b


// MainFrm.cpp : implementation of the CMainFrame class 
// 
 
#include "stdafx.h" 
#include "3ds.h" 
 
#include "MainFrm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame 
 
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) 
 
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) 
	//{{AFX_MSG_MAP(CMainFrame) 
	ON_WM_CREATE() 
	ON_WM_SIZE() 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
	ON_UPDATE_COMMAND_UI(ID_INDICATOR_FRAMENUM, OnUpdateFrameNum) 
END_MESSAGE_MAP() 
 
static UINT indicators[] = 
{ 
	ID_SEPARATOR,           // status line indicator 
	ID_INDICATOR_FRAMENUM, 
	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.Create(this) || 
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) 
	{ 
		TRACE0("Failed to create toolbar\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 | CBRS_SIZE_DYNAMIC); 
 
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); 
	EnableDocking(CBRS_ALIGN_ANY); 
	DockControlBar(&m_wndToolBar); 
 
	m_wndStatusBar.SetPaneInfo( 1, ID_INDICATOR_FRAMENUM, SBPS_NORMAL, 60 ); 
	m_framenum = 0; 
	return 0; 
} 
 
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	return CFrameWnd::PreCreateWindow(cs); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame diagnostics 
 
#ifdef _DEBUG 
void CMainFrame::AssertValid() const 
{ 
	CFrameWnd::AssertValid(); 
} 
 
void CMainFrame::Dump(CDumpContext& dc) const 
{ 
	CFrameWnd::Dump(dc); 
} 
 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame message handlers 
 
void CMainFrame::OnSize(UINT nType, int cx, int cy)  
{ 
	CFrameWnd::OnSize(nType, cx, cy); 
	 
	// TODO: Add your message handler code here 
	 
} 
 
void CMainFrame::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	 
	// TODO: Add your message handler code here 
	 
	// Do not call CFrameWnd::OnPaint() for painting messages 
} 
 
void CMainFrame::OnUpdateFrameNum(CCmdUI *pCmdUI) 
{ 
    //Wasn't nessesary 
	//pCmdUI->Enable(); 
	//CString strPage; 
    //strPage.Format( "Frame %.3d", m_framenum );  
    //pCmdUI->SetText( strPage ); 
} 
 
void CMainFrame::setStatus(long frame) 
{ 
	m_framenum = frame; 
	CString strPage; 
    strPage.Format( "Frame %.3d", m_framenum );  
	m_wndStatusBar.SetPaneText( 1, (LPCTSTR)strPage); 
}