// Copyright 1995 by Jon Dart.
// arasadoc.cpp : implementation of the CArasanDoc class
//

#include "stdafx.h"
#include "arasan.h"
#include "arasavw.h"
#include "movearr.h"
#include "arasadoc.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif              

/////////////////////////////////////////////////////////////////////////////
// CArasanDoc

IMPLEMENT_DYNCREATE(CArasanDoc, CDocument)

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

/////////////////////////////////////////////////////////////////////////////
// CArasanDoc construction/destruction

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

CArasanDoc::~CArasanDoc()
{                                 
}

CArasanView *CArasanDoc::GetView() const
{
        POSITION pos = GetFirstViewPosition();
	CArasanView *view = (CArasanView*)GetNextView(pos);
        ASSERT(view);
        return view;
}

BOOL CArasanDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
         // We don't use the default MFC method (Serialize).
       return GetView()->open_file(lpszPathName);
}

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

        GetView()->reset(CArasanView::Initial);
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CArasanDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CArasanDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CArasanDoc commands
