📄 replaceproject.cpp
字号:
// ReplaceProject.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "ReplaceProject.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReplaceProject dialog
CReplaceProject::CReplaceProject(CWnd* pParent /*=NULL*/)
: CDialog(CReplaceProject::IDD, pParent)
{
//{{AFX_DATA_INIT(CReplaceProject)
m_strrep = _T("");
m_strwith = _T("");
//}}AFX_DATA_INIT
}
void CReplaceProject::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReplaceProject)
DDX_Text(pDX, IDC_EDIT_REP, m_strrep);
DDX_Text(pDX, IDC_EDIT_WITH, m_strwith);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReplaceProject, CDialog)
//{{AFX_MSG_MAP(CReplaceProject)
ON_EN_CHANGE(IDC_EDIT_REP, OnChangeEditRep)
ON_EN_CHANGE(IDC_EDIT_WITH, OnChangeEditWith)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReplaceProject message handlers
void CReplaceProject::OnChangeEditRep()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateData();
findstring=m_strrep;
UpdateData(FALSE);
// TODO: Add your control notification handler code here
}
void CReplaceProject::OnChangeEditWith()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
UpdateData();
str_with=m_strwith;
UpdateData(FALSE);
// TODO: Add your control notification handler code here
}
void CReplaceProject::OnOK()
{
// TODO: Add extra validation here
//从编辑框中获得查找字符串
findstring=m_strrep;
str_with=m_strwith;
//初始化查找初始行
findstringcurhang=0;
//初始化查找初始列
findstringcurlie=0;
//子窗口指针
CMDIChildWnd*childf=NULL;//mdif->MDIGetActive();
//获得当前项目信息指针
struct ProjectList * curpro=NULL;
curpro=new ProjectList;
curpro=(ProjectList *)projectinfo.GetAt(0);
//文件数目
int n_file=curpro->proinfstru.GetSize();
//搜索每一个文件
for(int i=0;i<=n_file-1;i++)
{
// findstring=m_find;
//初始化查找初始行
findstringcurhang=0;
//初始化查找初始列
findstringcurlie=0;
// CString str_filefind="";
//获得第i个窗口指针
childf=fileitemarray[i].m_pchildf;
//激活窗口
childf->MDIActivate();
//将窗口设为最前
childf->BringWindowToTop();
//将窗口设为焦点
childf->SetFocus();
//获得窗口活动视图
CC02IDEView *childview = (CC02IDEView *)childf->GetActiveView();
CCrystalEditView* m_pexpandview=NULL;
m_pexpandview=( CCrystalEditView*)childf->GetActiveView();
//指示能否查找到的标志
int n_canfind=0;
//主窗口指针
CMainFrame *m_pmainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
//文本总行数
int linenum=m_pexpandview->GetLineCount();
do
{
//查找
n_canfind= childview->OnFindNext(0,findstring);
m_pexpandview->ReplaceSelection(str_with);
//当能够查找到
}while(n_canfind=1&&findstringcurhang<=linenum-1);
}
CMainFrame *m_pmainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
//在输出区显示
// m_pmainFrame->m_wndOutput.UpDateSearch1();
DestroyWindow ();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -