// FilterViewerDoc.cpp : implementation of the CFilterViewerDoc class
//

#include "stdafx.h"
#include "FilterViewer.h"
#include "..\\..\\src\\CDXSurfaceFilter.h"
#include "FilterViewerDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFilterViewerDoc

IMPLEMENT_DYNCREATE(CFilterViewerDoc, CDocument)

BEGIN_MESSAGE_MAP(CFilterViewerDoc, CDocument)
	//{{AFX_MSG_MAP(CFilterViewerDoc)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CFilterViewerDoc construction/destruction

CFilterViewerDoc::CFilterViewerDoc()
{
	// TODO: add one-time construction code here

}

CFilterViewerDoc::~CFilterViewerDoc()
{
	delete m_pCDXSurfaceFilter;
}

BOOL CFilterViewerDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CFilterViewerDoc serialization

void CFilterViewerDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CFilterViewerDoc diagnostics

#ifdef _DEBUG
void CFilterViewerDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CFilterViewerDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFilterViewerDoc commands

CDXSurface* CFilterViewerDoc::GetCDXFilterSurface()
{
	return &m_CDXFilterSurface;
}

void CFilterViewerDoc::CreateCDXFilterSurface()
{
	const char* file = "Image1.bmp";

	m_CDXFilterSurface.Create(((CFilterViewerApp*)AfxGetApp())->GetCDXScreen(), file);
}

CDXSurfaceFilter* CFilterViewerDoc::GetCDXSurfaceFilter()
{
	return m_pCDXSurfaceFilter;
}

void CFilterViewerDoc::CreateCDXSurfaceFilter()
{
	m_pCDXSurfaceFilter = new CDXSurfaceFilter(&m_CDXFilterSurface);
}
