// sktchDoc.cpp : implementation of the CSktchDoc class
//
#include "stdafx.h"
#include "sktch.h"
#include "sktchDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSktchDoc
IMPLEMENT_DYNCREATE(CSktchDoc, CDocument)
BEGIN_MESSAGE_MAP(CSktchDoc, CDocument)
//{{AFX_MSG_MAP(CSktchDoc)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSktchDoc construction/destruction
CSktchDoc::CSktchDoc()
{
// TODO: add one-time construction code here
}
CSktchDoc::~CSktchDoc()
{
}
BOOL CSktchDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSktchDoc serialization
void CSktchDoc::Serialize(CArchive& ar)
{
m_oaLines.Serialize(ar);
}
/////////////////////////////////////////////////////////////////////////////
// CSktchDoc diagnostics
#ifdef _DEBUG
void CSktchDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CSktchDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSktchDoc commands
CLine* CSktchDoc::GetLine(int nI)
{
return (CLine*)m_oaLines[nI];
}
int CSktchDoc::GetLineCount()
{
return m_oaLines.GetSize();
}
CLine* CSktchDoc::AddLine(CPoint ptFrom, CPoint ptTo)
{
CLine *pLine = new CLine(ptFrom,ptTo);
m_oaLines.Add(pLine);
return pLine;
}