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

📄 mcdsdoc.cpp

📁 51单片机学习的源代码
💻 CPP
字号:
// mcdsDoc.cpp : implementation of the CMcdsDoc class
//

#include "stdafx.h"
#include "mcds.h"
#include "mcdsDoc.h"
#include "GlobalVar.h"
#include "TimeLimitDlg.h"
#include "NumLimitDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMcdsDoc

IMPLEMENT_DYNCREATE(CMcdsDoc, CDocument)

BEGIN_MESSAGE_MAP(CMcdsDoc, CDocument)
	//{{AFX_MSG_MAP(CMcdsDoc)
	ON_COMMAND(ID_MENU_LIMITNUMBER, OnMenuLimitnumber)
	ON_UPDATE_COMMAND_UI(ID_MENU_LIMITNUMBER, OnUpdateMenuLimitnumber)
	ON_COMMAND(ID_MENU_LIMITTIME, OnMenuLimittime)
	ON_UPDATE_COMMAND_UI(ID_MENU_LIMITTIME, OnUpdateMenuLimittime)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMcdsDoc construction/destruction

CMcdsDoc::CMcdsDoc()
{
	// TODO: add one-time construction code here
	for(int i=0;i<=255;i++)
	{
		data[i]=0;
	}
	lsSetROILeft=false;
	lsSetROIRight=false;
}

CMcdsDoc::~CMcdsDoc()
{
}

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

	for(int i=0;i<=255;i++)
	{
		data[i]=0;
//		m_data[i]=0;
	}
	lsSetROILeft=false;
	lsSetROIRight=false;
	
	nNumInfo[20]="0";
	nNumInfo[21]="255";
	nNumInfo[22]="256";

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

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMcdsDoc serialization

void CMcdsDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		CString str;
		str="文件头";
		ar<<str;
		
		for(int i=0;i<=255;i++)
		{
			ar<<data[i];        //初始化计数缓冲区
		}
	}
	else
	{
		// TODO: add loading code here
		CString str;
		ar>>str;
		for(int i=0;i<=255;i++)
		{
			ar>>data[i];        //初始化计数缓冲区
		}
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMcdsDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CMcdsDoc commands

void CMcdsDoc::OnMenuLimitnumber() 
{
	// TODO: Add your command handler code here
	CNumLimitDlg NumLimitDlg;
	if(NumLimitDlg.DoModal()==IDOK)
	{
		lsUpdate[9]=true;
	};
	lsUpdate[2]=true;
	UpdateAllViews(NULL);
}

void CMcdsDoc::OnUpdateMenuLimitnumber(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	cs.Lock();
	pCmdUI->SetCheck(nNumInfo[2]=="计数");
	cs.Unlock();
}

void CMcdsDoc::OnMenuLimittime() 
{
	// TODO: Add your command handler code here
	CTimeLimitDlg TimeLimitDlg;
	if(TimeLimitDlg.DoModal()==IDOK)
	{
		lsUpdate[7]=true;
	};
	lsUpdate[2]=true;
	UpdateAllViews(NULL);
}

void CMcdsDoc::OnUpdateMenuLimittime(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	cs.Lock();
	pCmdUI->SetCheck(nNumInfo[2]=="时间");
	cs.Unlock();
}


BOOL CMcdsDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	// TODO: Add your specialized creation code here
	return TRUE;
}

BOOL CMcdsDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	// TODO: Add your specialized code here and/or call the base class
	return CDocument::OnSaveDocument(lpszPathName);
}

⌨️ 快捷键说明

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