// MDI ProjectView.cpp : implementation of the CMDIProjectView class
//

#include "stdafx.h"
#include "MDI Project.h"

#include "MDI ProjectDoc.h"
#include "CntrItem.h"
#include "MDI ProjectView.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMDIProjectView 
 extern  CMainFrame * m_gcf;
IMPLEMENT_DYNCREATE(CMDIProjectView, CRichEditView)

BEGIN_MESSAGE_MAP(CMDIProjectView, CRichEditView)
	//{{AFX_MSG_MAP(CMDIProjectView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview) 
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMDIProjectView construction/destruction

CMDIProjectView::CMDIProjectView()
{
	// TODO: add construction code here


}

CMDIProjectView::~CMDIProjectView()
{
}

BOOL CMDIProjectView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	return CRichEditView::PreCreateWindow(cs);
}

void CMDIProjectView::OnInitialUpdate()
{
	CRichEditView::OnInitialUpdate();
	// Set the printing margins (720 twips = 1/2 inch).
	int y=add(1,2);
}

/////////////////////////////////////////////////////////////////////////////
// CMDIProjectView printing

BOOL CMDIProjectView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}


void CMDIProjectView::OnDestroy()
{
	// Deactivate the item on destruction; this is important
	// when a splitter view is being used.
   CRichEditView::OnDestroy();
   COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
   if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
   {
      pActiveItem->Deactivate();
      ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
   }
}


/////////////////////////////////////////////////////////////////////////////
// CMDIProjectView diagnostics

#ifdef _DEBUG
void CMDIProjectView::AssertValid() const
{
	CRichEditView::AssertValid();
}

void CMDIProjectView::Dump(CDumpContext& dc) const
{
	CRichEditView::Dump(dc);
}

CMDIProjectDoc* CMDIProjectView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMDIProjectDoc)));
	return (CMDIProjectDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMDIProjectView message handlers
int CMDIProjectView::add(int x,int y)
{
   return x+y;
}


