//
//  part.cpp - part class implementation
//
//  $Id: part.cpp 47 2014-02-07 01:02:55Z brian $ 
//
//  Copyright (c) 1999-2014 by Precision Micro Control Corp. All rights reserved.
//
#include "stdafx.h"

IMPLEMENT_DYNCREATE(CPart, CDocument)

BEGIN_MESSAGE_MAP(CPart, CDocument)
	ON_COMMAND(ID_FILE_LOAD, OnFileLoad)
END_MESSAGE_MAP()

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

void CPart::Serialize(CArchive& ar)
{
	((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
}

void CPart::OnFileLoad()
{
	// Get pointer to CEditView class object for this document
	CEditView* pCEditView = (CEditView*)m_viewList.GetHead();
	
	// Call machine member function to load contents of edit view. File must be in 
	// Fanuc format with program numbers (eg. leader<cr>Odddd ... )
	theApp.GetMachine()->LoadEditView(pCEditView);
}
