// mymfc30aDoc.cpp : implementation of the CMymfc30aDoc class
//

#include "stdafx.h"
#include "mymfc30a.h"

#include "cdib.h"

#include "mymfc30aDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMymfc30aDoc

IMPLEMENT_DYNCREATE(CMymfc30aDoc, CDocument)

BEGIN_MESSAGE_MAP(CMymfc30aDoc, CDocument)
	//{{AFX_MSG_MAP(CMymfc30aDoc)
	ON_COMMAND(ID_EDIT_CLEAR_ALL, OnEditClearAll)
	ON_UPDATE_COMMAND_UI(ID_EDIT_CLEAR_ALL, OnUpdateEditClearAll)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMymfc30aDoc construction/destruction

CMymfc30aDoc::CMymfc30aDoc()
{
	// TODO: add one-time construction code here

}

CMymfc30aDoc::~CMymfc30aDoc()
{
}

BOOL CMymfc30aDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc30aDoc serialization

void CMymfc30aDoc::Serialize(CArchive& ar)
{
	m_dib.Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc30aDoc diagnostics

#ifdef _DEBUG
void CMymfc30aDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CMymfc30aDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMymfc30aDoc commands

void CMymfc30aDoc::DeleteContents() 
{
	// TODO: Add your specialized code here and/or call the base class
	m_dib.Empty();
}

void CMymfc30aDoc::OnEditClearAll() 
{
	// TODO: Add your command handler code here
	DeleteContents();
    UpdateAllViews(NULL);
    SetModifiedFlag();
}

void CMymfc30aDoc::OnUpdateEditClearAll(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(m_dib.GetSizeImage() > 0); 
}

