www.pudn.com > assigment1.zip > myGraphicsDoc.cpp
// myGraphicsDoc.cpp : implementation of the CMyGraphicsDoc class
//
#include "stdafx.h"
#include "myGraphics.h"
#include "myGraphicsDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyGraphicsDoc
IMPLEMENT_DYNCREATE(CMyGraphicsDoc, CDocument)
BEGIN_MESSAGE_MAP(CMyGraphicsDoc, CDocument)
//{{AFX_MSG_MAP(CMyGraphicsDoc)
ON_COMMAND(ID_DRAW_POLYGON, OnDrawPolygon)
ON_COMMAND(ID_EDIT_CLEARALL, OnEditClearall)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyGraphicsDoc construction/destruction
CMyGraphicsDoc::CMyGraphicsDoc()
{
mCurrent = 0;
mFlag = FALSE;
}
CMyGraphicsDoc::~CMyGraphicsDoc()
{
}
BOOL CMyGraphicsDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMyGraphicsDoc serialization
void CMyGraphicsDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CMyGraphicsDoc diagnostics
#ifdef _DEBUG
void CMyGraphicsDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMyGraphicsDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyGraphicsDoc commands
void CMyGraphicsDoc::OnDrawPolygon()
{
mCurrent = ID_DRAW_POLYGON;
mFlag = TRUE;
}
void CMyGraphicsDoc::OnEditClearall()
{
DeleteContents();
SetModifiedFlag();
UpdateAllViews(NULL);
}