// NotationDoc.cpp : implementation file
//

#include "stdafx.h"
#include "Multitron.h"
#include "NotationDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNotationDoc

IMPLEMENT_DYNCREATE(CNotationDoc, CDocument)

CNotationDoc::CNotationDoc()
{
	m_pNoteFile = NULL;
	m_pPage = NULL;
	m_pNote = NULL;
}

BOOL CNotationDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;
	return TRUE;
}

CNotationDoc::~CNotationDoc()
{
}


BEGIN_MESSAGE_MAP(CNotationDoc, CDocument)
	//{{AFX_MSG_MAP(CNotationDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNotationDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CNotationDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CNotationDoc commands

BOOL CNotationDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	Stuff::Plug *plug = (Stuff::Plug *)lpszPathName;
	Check_Object(plug);

	m_pNote = dynamic_cast<Stuff::Note *>(plug);
	if (m_pNote)
	{
		m_pPage = m_pNote->GetPage();
	}
	else
	{
		m_pPage = dynamic_cast<Stuff::Page *>(plug);
	}
	if (m_pPage)
		m_pNoteFile = m_pPage->GetNotationFile();
	return TRUE;
}

void CNotationDoc::SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU) 
{
	CString name = m_pNoteFile->GetFileName();
	CDocument::SetPathName(name, false);
}
