// MotsFlechesView.cpp : implementation of the CMotsFlechesView class
//

#include "stdafx.h"
#include "MotsFleches.h"

#include "MotsFlechesDoc.h"
#include "MotsFlechesView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView

IMPLEMENT_DYNCREATE(CMotsFlechesView, CView)

BEGIN_MESSAGE_MAP(CMotsFlechesView, CView)
	//{{AFX_MSG_MAP(CMotsFlechesView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView construction/destruction

CMotsFlechesView::CMotsFlechesView()
{
	// TODO: add construction code here

}

CMotsFlechesView::~CMotsFlechesView()
{
}

BOOL CMotsFlechesView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView drawing
#define NumLines 48
#define WidthLine 128

extern char line[NumLines][WidthLine];
int charHeight = 0;

void CMotsFlechesView::OnDraw(CDC* pDC)
{
	CMotsFlechesDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	RECT	r;
	int	ypos;
	int	i;

	if (charHeight == 0) {
		CDC *dc = GetDC();
		CSize size;
		size = dc->GetTextExtent ("A", 1);
		charHeight = size.cy;
	}
	GetClientRect (&r);
	for (ypos = r.bottom, i = 1;
	     ypos > 0 && i < NumLines;
	     i++) {
		ypos -= charHeight;
		pDC->TextOut (0, ypos, line[i], strlen(line[i]));
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView printing

BOOL CMotsFlechesView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMotsFlechesView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMotsFlechesView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView diagnostics

#ifdef _DEBUG
void CMotsFlechesView::AssertValid() const
{
	CView::AssertValid();
}

void CMotsFlechesView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMotsFlechesDoc* CMotsFlechesView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMotsFlechesDoc)));
	return (CMotsFlechesDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMotsFlechesView message handlers
