www.pudn.com > c02 vc6.rar > FindAllOpen.cpp


// FindAllOpen.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "c02ide.h" 
#include "C02IDEView.h" 
#include "MainFrm.h" 
#include "FindAllOpen.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CFindAllOpen dialog 
 
 
CFindAllOpen::CFindAllOpen(CWnd* pParent /*=NULL*/) 
	: CDialog(CFindAllOpen::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CFindAllOpen) 
	m_find = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CFindAllOpen::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CFindAllOpen) 
	DDX_Text(pDX, IDC_EDIT_FIND, m_find); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CFindAllOpen, CDialog) 
	//{{AFX_MSG_MAP(CFindAllOpen) 
	ON_EN_CHANGE(IDC_EDIT_FIND, OnChangeEditFind) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CFindAllOpen message handlers 
 
BOOL CFindAllOpen::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	this->GetDlgItem(IDC_EDIT_FIND)->SetFocus(); 
		//EnableToolTip(); 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CFindAllOpen::OnChangeEditFind()  
{ 
	// 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. 
	 
	// TODO: Add your control notification handler code here 
	 
	UpdateData(); 
 
    findstring=m_find; 
 
  
	UpdateData(FALSE);	 
 
 
} 
 
void CFindAllOpen::OnOK()  
{ 
	// TODO: Add extra validation here 
	//从编辑框中获得查找字符串 
	findstring=m_find; 
	//初始化查找初始行 
	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(); 
	CCrystalTextView* m_pexpandview=NULL; 
    m_pexpandview=(CCrystalTextView*)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);	 
	//当能够查找到 
	}while(n_canfind=1&&findstringcurhang<=linenum-1); 
	} 
    CMainFrame *m_pmainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;	 
	//在输出区显示 
	m_pmainFrame->m_wndOutput.UpDateSearch1(); 
	 DestroyWindow (); 
} 
 
BOOL CFindAllOpen::PreTranslateMessage(MSG* pMsg)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
 
	return CDialog::PreTranslateMessage(pMsg); 
}