// Serial0View.cpp : implementation of the CSerial0View class
//

#include "stdafx.h"
#include "Serial0.h"

#include "Serial0Doc.h"
#include "Serial0View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSerial0View

IMPLEMENT_DYNCREATE(CSerial0View, CView)

BEGIN_MESSAGE_MAP(CSerial0View, CView)
        //{{AFX_MSG_MAP(CSerial0View)
        ON_WM_LBUTTONDOWN()
        //}}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()

/////////////////////////////////////////////////////////////////////////////
// CSerial0View construction/destruction

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

}

CSerial0View::~CSerial0View()
{
}

BOOL CSerial0View::PreCreateWindow(CREATESTRUCT& cs)
{
        // TODO: Modify the Window class or styles here by modifying
        //  the CREATESTRUCT cs

        return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CSerial0View drawing

void CSerial0View::OnDraw(CDC* pDC)
{
        CSerial0Doc* pDoc = GetDocument();
        ASSERT_VALID(pDoc);
        // TODO: add draw code for native data here
        pDC->TextOut(pDoc->m_pt.x, pDoc->m_pt.y, pDoc->m_str);

}

/////////////////////////////////////////////////////////////////////////////
// CSerial0View printing

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

void CSerial0View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
        // TODO: add extra initialization before printing
}

void CSerial0View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
        // TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CSerial0View diagnostics

#ifdef _DEBUG
void CSerial0View::AssertValid() const
{
        CView::AssertValid();
}

void CSerial0View::Dump(CDumpContext& dc) const
{
        CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CSerial0View message handlers

void CSerial0View::OnLButtonDown(UINT nFlags, CPoint point) 
{
        // TODO: Add your message handler code here and/or call default
        GetDocument()->m_pt=point;
        Invalidate();
        
        CView::OnLButtonDown(nFlags, point);
}