⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customtooldoc.cpp

📁 在编写图形程序
💻 CPP
字号:
// CustomToolDoc.cpp : implementation of the CCustomToolDoc class
//

#include "stdafx.h"
#include "CustomTool.h"

#include "CustomToolDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCustomToolDoc

IMPLEMENT_DYNCREATE(CCustomToolDoc, CDocument)

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

/////////////////////////////////////////////////////////////////////////////
// CCustomToolDoc construction/destruction

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

	//Form++ Library add lines.
	m_pDataModel = new CMyExtDataModel;


}

CCustomToolDoc::~CCustomToolDoc()
{
	//Form++ Library add lines.
	if(m_pDataModel != NULL)
	{
		delete m_pDataModel;
	}

}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CCustomToolDoc serialization

void CCustomToolDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		//Form++ Library add lines.	
		m_pDataModel->Serialize(ar);
	}
	else
	{
		// TODO: add loading code here
		//Form++ Library add lines.	
		m_pDataModel->Serialize(ar);
	}
}


//Form++ Library add lines.
void CCustomToolDoc::SetTitle(LPCTSTR lpszTitle)
{
	m_pDataModel->SetDocTitle(lpszTitle);
	CDocument::SetTitle(lpszTitle);
}

void CCustomToolDoc::DeleteContents() 
{
	// TODO: Add your specialized code here and/or call the base class
	m_pDataModel->ResetContent();
	CDocument::DeleteContents();
}

//added override
BOOL CCustomToolDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnSaveDocument(lpszPathName))
	{
		return FALSE;
	}
	m_pDataModel->SetClean();		// Tells the command history that the document is "clean" at this point
	SetModifiedFlag(FALSE);
	return TRUE;
}

//added override (optional as long as you never call this member)
void CCustomToolDoc::SetModifiedFlag(BOOL b)
{
	// Do nothing
	m_pDataModel->SetModifiedFlag(b);
}

//added override
BOOL CCustomToolDoc::IsModified()
{
	return m_pDataModel->IsModified();
}

BOOL CCustomToolDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if(!CDocument::OnOpenDocument(lpszPathName))
	{
		return FALSE;
	}
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CCustomToolDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CCustomToolDoc commands

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -