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

📄 c02idedoc.cpp

📁 类似vc的集成开发环境
💻 CPP
字号:
// C02IDEDoc.cpp : implementation of the CC02IDEDoc class
//

#include "stdafx.h"
#include "C02IDE.h"
#include "MainFrm.h"
#include "C02IDEDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CC02IDEDoc

IMPLEMENT_DYNCREATE(CC02IDEDoc, CDocument)

BEGIN_MESSAGE_MAP(CC02IDEDoc, CDocument)
	//{{AFX_MSG_MAP(CC02IDEDoc)
	ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
	ON_COMMAND(ID_READ_ONLY, OnReadOnly)
	ON_UPDATE_COMMAND_UI(ID_READ_ONLY, OnUpdateReadOnly)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CC02IDEDoc construction/destruction

#pragma warning(disable:4355)
CC02IDEDoc::CC02IDEDoc() : m_xTextBuffer(this)
{
	// TODO: add one-time construction code here

	//	Initialize LOGFONT structure
	memset(&m_lf, 0, sizeof(m_lf));
	m_lf.lfWeight = FW_NORMAL;
	m_lf.lfHeight = 0xfffffff2;
	m_lf.lfCharSet = GB2312_CHARSET;
//	m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
//	m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
//	m_lf.lfQuality = DEFAULT_QUALITY;
//	m_lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
	strcpy(m_lf.lfFaceName, _T("Fixedsys"));
}

CC02IDEDoc::~CC02IDEDoc()
{
}

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

	m_xTextBuffer.InitNew();
	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CC02IDEDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CC02IDEDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CC02IDEDoc commands

void CC02IDEDoc::DeleteContents() 
{
	CDocument::DeleteContents();

	m_xTextBuffer.FreeAll();
}

BOOL CC02IDEDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	return m_xTextBuffer.LoadFromFile(lpszPathName);
}

BOOL CC02IDEDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	m_xTextBuffer.SaveToFile(lpszPathName);
	return TRUE;	//	Note - we didn't call inherited member!
}

void CC02IDEDoc::OnReadOnly() 
{
	if (! m_xTextBuffer.GetReadOnly())
	{
		m_xTextBuffer.SetReadOnly(TRUE);
		AfxMessageBox("Document now read-only!");
	}
	else
		m_xTextBuffer.SetReadOnly(FALSE);
}

void CC02IDEDoc::OnUpdateReadOnly(CCmdUI* pCmdUI) 
{
	pCmdUI->SetCheck(m_xTextBuffer.GetReadOnly());
}


void CC02IDEDoc::OnFileClose() 
{
	// TODO: Add your command handler code here
//	n_fileclose=1;
	//主窗口指针
    CMDIFrameWnd *nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	//活动子窗口指针
	CMDIChildWnd *nowchild = nowframe->MDIGetActive();
	//获得当前项目信息指针
	struct ProjectList * curpro=NULL;
    curpro=new ProjectList;
    curpro=(ProjectList *)projectinfo.GetAt(0);
	CString proname=_T("");
	proname=curpro->str_projectname;		
		
	//项目中的文件数目
	int nfile=curpro->proinfstru.GetSize();
	//文件节点结构变量
	struct fileitem m_pcurnode;
     for (int j=0;j<=nfile-1;j++)
	{
		//取第j个节点
		 m_pcurnode=fileitemarray[j];
		 //如果节点的窗口指针等于当前活动指针,推出循环
		 if(m_pcurnode.m_pchildf==nowchild)
			 break; 
	}

	 //删除目录树里的文件节点
	for(int jj=j;jj<=nfile-2;jj++)
		 fileitemarray[jj]= fileitemarray[jj+1];

	 //获得当前项目信息中的文件信息指针
	struct FileList * m_pcurfile=NULL;
	m_pcurfile=new FileList;           
		      
	m_pcurfile=(FileList *)curpro->proinfstru.GetAt(j);
	//删除索引为j 的文件
	curpro->proinfstru.RemoveAt(j);

	//主窗口指针
	CMainFrame *nowmainframe=(CMainFrame *) nowframe;
	//删除主窗口快速查看文件函数工具条中的文件下拉框中的对应文件
	nowmainframe->delcomfile();

	//关闭文档	
     CDocument::OnFileClose() ;
	 //更新文件函数树
	m_pDocFile->UpdateAllFNode();
	//更新断点树
	m_pDocClass->ExpandAllBreak();
	
//	CDocument::OnCloseDocument();

}

⌨️ 快捷键说明

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