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

📄 addfuncok.cpp

📁 类似vc6的集成开发环境的源代码
💻 CPP
字号:
// AddFuncOk.cpp : implementation file
//

#include "stdafx.h"
#include "c02ide.h"
#include "AddFuncOk.h"
#include "TestPage1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// AddFuncOk dialog


AddFuncOk::AddFuncOk(CWnd* pParent /*=NULL*/)
	: CDialog(AddFuncOk::IDD, pParent)
{
	//{{AFX_DATA_INIT(AddFuncOk)
	m_functext = _T("");
	//}}AFX_DATA_INIT
}


void AddFuncOk::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(AddFuncOk)
	DDX_Text(pDX, IDC_STATICFUNC, m_functext);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(AddFuncOk, CDialog)
	//{{AFX_MSG_MAP(AddFuncOk)
	ON_BN_CLICKED(ID_FUNCINPUT_OK, OnFuncinputOk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// AddFuncOk message handlers
 void  AddFuncOk::Inittext()
{ 
	//更新数据开始
	UpdateData();
	
	//计算定义行字符串
	//返回值类型
    m_functext=functionadd->str_functype+"  ";
	//+空格+函数名称+左括号
	m_functext=m_functext+functionadd->str_funcname+"(";
	//此函数的参数个数
	int ncanshu=functionadd->canshuinfo.GetSize();
//	int j=addcanshutype.GetSize();
//	if(ncanshu>j) ncanshu=j;

	//声明一个参数信息结构的指针变量
	 CanShu * funcinformation;
     funcinformation=new CanShu;

	 //访问各个参数信息
    if (ncanshu>1)
	{
        for(int i=0;i<=ncanshu-2;i++)
		{   
			//获得第i个参数的信息
			funcinformation=(struct CanShu*)(functionadd->canshuinfo.GetAt(i));
	     	//行字符串+参数类型+空格+参数名称+逗号
			m_functext=m_functext+funcinformation->str_canshutype+
		       ' '+ funcinformation->str_canshuname+",";
		}
		//最后一个参数信息
	    funcinformation=(struct CanShu*)functionadd->canshuinfo.GetAt(i);
		//行字符串+参数类型+空格+参数名称
	    m_functext=m_functext+funcinformation->str_canshutype+
			' '+funcinformation->str_canshuname;
	} 
	//参数个数为一
	if(ncanshu==1)  
	{   funcinformation=(struct CanShu*)functionadd->canshuinfo.GetAt(0);
	
	    m_functext=m_functext+funcinformation->str_canshutype+
			' '+funcinformation->str_canshuname;
	}
	//行字符串+右括号
  	m_functext=m_functext+")";

	//更新数据结束
    UpdateData(FALSE);



}



void AddFuncOk::OnFuncinputOk() 
{
	// TODO: Add your control notification handler code here
	//销毁对话框
	DestroyWindow ();
 
	//获得当前活动视图
    CMDIFrameWnd* mdif=(CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd);
	CMDIChildWnd*childf=mdif->MDIGetActive();
    CC02IDEView *myeditview= (CC02IDEView*)childf->GetActiveView();

	//向视图中添加函数
	myeditview->InsertFunc(m_functext);
}

void AddFuncOk::PostNcDestroy() 
{
	// TODO: Add your specialized code here and/or call the base class
	

	CDialog::PostNcDestroy();
}

⌨️ 快捷键说明

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