📄 deletefunc.cpp
字号:
// DeleteFunc.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "MainFrm.h"
#include "DeleteFunc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DeleteFunc dialog
DeleteFunc::DeleteFunc(CWnd* pParent /*=NULL*/)
:CPropertyPage(DeleteFunc::IDD)
{
//{{AFX_DATA_INIT(DeleteFunc)
m_deletefuncname = _T("");
m_delfilefrom = _T("");
n_delfileno=-1;
n_selfuncno=-1;
//}}AFX_DATA_INIT
}
void DeleteFunc::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DeleteFunc)
DDX_Control(pDX, IDC_COMBO2, m_comdelfile);
DDX_Control(pDX, IDC_COMBO1, m_comdelete);
DDX_CBString(pDX, IDC_COMBO1, m_deletefuncname);
DDX_CBString(pDX, IDC_COMBO2, m_delfilefrom);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DeleteFunc, CPropertyPage)
//{{AFX_MSG_MAP(DeleteFunc)
ON_CBN_SELENDOK(IDC_COMBO1, OnSelendokCombo1)
ON_CBN_SELENDOK(IDC_COMBO2, OnSelendokCombo2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DeleteFunc message handlers
void DeleteFunc::OnSelendokCombo1()
{
// TODO: Add your control notification handler code here
// UpdateData();
//获得函数列表框的当前选择索引
n_selfuncno=m_comdelete.GetCurSel();
// UpdateData(FALSE);
}
BOOL DeleteFunc::OnInitDialog()
{
//默认的初始化
CPropertyPage::OnInitDialog();
//主窗口指针
CMainFrame* mdif=(CMainFrame*)(AfxGetApp()->m_pMainWnd);
//更新所有文件的函数信息
mdif->ExpandAllFile();
//清空文件下拉列表框
m_comdelfile.ResetContent();
//获得当前项目指针
struct ProjectList * curaddpro=NULL;
curaddpro=new ProjectList;
curaddpro=(ProjectList *)projectinfo.GetAt(0);
// int n_addfile=0;
//项目重的文件数目
int n_filenum=curaddpro->proinfstru.GetSize();
// CMDIChildWnd * m_ptestwnd=NULL;
// m_ptestwnd=new CMDIChildWnd ;
//申明文件信息指针
FileList * m_paddfile=NULL;
m_paddfile=new FileList;
//文件名字符串
CString str_comfile;
//依次访问每个文件
for(int j=0;j<=n_filenum-1;j++)
{
//取项目中的第j个文件
m_paddfile=(FileList *)curaddpro->proinfstru.GetAt(j);
//获得文件名字符串
str_comfile=m_paddfile->str_filename;
//将字符串加入下拉框列表中
m_comdelfile.InsertString(j,str_comfile);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DeleteFunc::OnOK()
{
// TODO: Add extra validation here
//获得选择的文件索引
n_delfileno=m_comdelfile.GetCurSel();
//获得选择的函数索引
n_selfuncno=m_comdelete.GetCurSel();
//从当前视图中删除函数
myview->DeleteFunction(n_delfileno,n_selfuncno);
//默认处理
CPropertyPage::OnOK();
}
//处理用户选择了文件后的工作
void DeleteFunc::OnSelendokCombo2()
{
// TODO: Add your control notification handler code here
//获得文件选择索引
n_delfileno=m_comdelfile.GetCurSel();
//清空函数下拉列表框的内容
m_comdelete.ResetContent();
//获得当前项目指针
struct ProjectList * com_curpro=NULL;
com_curpro=new ProjectList;
com_curpro=(ProjectList *)projectinfo.GetAt(0);
//项目中的文件数
int nfile=com_curpro->proinfstru.GetSize();
//文件信息结构变量指针
struct FileList * m_pcurfile=NULL;
m_pcurfile=new FileList;
//当前选择文件信息指针
m_pcurfile=(FileList *)com_curpro->proinfstru.GetAt(n_delfileno);
//文件中的函数数目
int nfunc=m_pcurfile->funcinfstru.GetSize();
//函数结构指针变量
struct FuncStruct * m_pcurfunc;
m_pcurfunc=new FuncStruct;
//函数名字符串
CString str_curfunc=_T("");
//访问每一个函数
for(int k=0;k<=nfunc-1;k++)
{
//取文件的第k个函数
m_pcurfunc=(FuncStruct *)m_pcurfile->funcinfstru.GetAt(k);
//获得函数名
str_curfunc=m_pcurfunc->str_funcname;
//向函数下拉列表框中加入函数名
m_comdelete.InsertString(k,str_curfunc);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -