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

