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

📄 outputctrl.cpp

📁 类似vc的集成开发环境
💻 CPP
字号:
// OutputCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "c02ide.h"
#include "OutputCtrl.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// COutputCtrl

COutputCtrl::COutputCtrl()
{
}

COutputCtrl::~COutputCtrl()
{
}


BEGIN_MESSAGE_MAP(COutputCtrl, CRichEditCtrl)
	//{{AFX_MSG_MAP(COutputCtrl)
	ON_WM_LBUTTONDBLCLK()
	ON_WM_COPYDATA()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COutputCtrl message handlers

void COutputCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CRichEditCtrl::OnLButtonDblClk(nFlags, point);
		//列表框中没有内容,返回
	if(GetLineCount()==0)
		return;
	//主窗口指针
    CMainFrame *m_pCMainFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd);
    //获得输出区当前选择页面索引
	int n_seltab=m_pCMainFrame->m_wndOutput.GetSelTab();
    //定义搜索结果结构指针
	
	CHARRANGE cr;
	//如果双击的是第3个页面
	if(n_seltab==2)
	{
		//获得双击行的索引
		int n_selline=0;		
	CMDIFrameWnd * nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	//活动子窗口指针
	CMDIChildWnd *nowchild = nowframe->MDIGetActive();
   	CCrystalTextView *m_pchildview = (CCrystalTextView *)nowchild->GetActiveView();

	CCrystalEditView *m_pchildeditview = (CCrystalEditView *)nowchild->GetActiveView();
//	CPoint ptCursorPos =this->GetSel()


//	cr=new CHARRANGE;
//	int i_x,i_y;

	GetSel(cr);
//SSERT_VALIDTEXTPOS(ptCursorPos);
	//当前光标位置的行索引
    int n_selstart = cr.cpMin;
    //将整数转换为字符串
//    CString string;
//    string.Format (_T ("Line %d"), nLine);

	int n_cal=a_searchinfo.GetSize();
	if(n_cal<=1)
		return;
	int i=0;
//	int j=0;
//	while ((i<=n_cal)&&(LineIndex(i)<n_selstart)) 
	while (LineIndex(i)<n_selstart) 
	{
//		j=this->LineLength(i);
//		n_selstart=n_selstart-j;
		i++;
		//双击的最后一行,退出
		if(i>n_cal&&LineIndex(i)<n_selstart)
		return;     

	}
//	i--;	
	n_selline=i-1;
		//获得搜索结果的总条数		
		//双击的是第一行,退出
		if(n_selline==0)
			return;   
		struct SearchInf * inf_search=NULL;
    	inf_search=new SearchInf;
		//获得双击行对应的搜索结果指针
		inf_search=(SearchInf * )a_searchinfo.GetAt(n_selline-1);
		//获得双击行对应的子窗口指针
		CMDIChildWnd *m_pgotochildf=NULL;
		m_pgotochildf=inf_search->m_pchildf;


		//获得子窗口活动视图
		CCrystalTextView* m_pexpandview=NULL; 
		m_pexpandview=(CCrystalTextView*)m_pgotochildf->GetActiveView();
	   CC02IDEView* m_peditview=(CC02IDEView*)m_pgotochildf->GetActiveView();
	   //如果子窗口存在
		if(m_pgotochildf!=NULL)
		{
			//子窗口激活
			m_pgotochildf->MDIActivate(); 
	        //子窗口设置为最前
		    m_pgotochildf->BringWindowToTop();
			//子窗口设置为焦点
			m_pgotochildf->SetFocus();
//	        //编辑控件的第一可见行
//			int nFirst = myeditctrl.GetFirstVisibleLine ();
			//查找结果所在行
			int gotoline=inf_search->n_lineno;
            //查找结果所在列
			int gotorow=inf_search->n_rowno;
			m_pexpandview->ScrollToLine(gotoline);
			//设置当前选择
			CPoint pselstart,pselend;
			pselstart.y=gotoline;
			pselstart.x=gotorow;
			pselend.y=gotoline;
			pselend.x=gotorow+findstring.GetLength();
			m_pexpandview->SetSelection(pselstart,pselend);
			m_pexpandview->SetCursorPos(pselend);
			m_pexpandview->EnsureVisible(pselend);
	        //子窗口激活
			m_pgotochildf->MDIActivate(); 
	        //子窗口设置为最前
		    m_pgotochildf->BringWindowToTop();
			//子窗口设置为焦点
			m_pgotochildf->SetFocus();
		}
	}

		if(n_seltab==0)//第一个页
	{
		//获得双击行的索引
		int n_selline=0;		
/*	CMDIFrameWnd * nowframe = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	//活动子窗口指针
	CMDIChildWnd *nowchild = nowframe->MDIGetActive();
   	CCrystalTextView *m_pchildview = (CCrystalTextView *)nowchild->GetActiveView();

	CCrystalEditView *m_pchildeditview = (CCrystalEditView *)nowchild->GetActiveView();
*/
	//	CPoint ptCursorPos =this->GetSel()


//	cr=new CHARRANGE;
//	int i_x,i_y;

		GetSel(cr);
//SSERT_VALIDTEXTPOS(ptCursorPos);
	//当前光标位置的行索引
		int n_selstart = cr.cpMin;
    //将整数转换为字符串
//    CString string;
//    string.Format (_T ("Line %d"), nLine);



/*
		struct ProjectList * curgotopro=NULL;         
	curgotopro=new ProjectList;
	curgotopro=(ProjectList *)projectinfo.GetAt(0);	
	//项目不存在
	if(curgotopro==NULL||projectinfo.GetSize()==0||curgotopro->proinfstru.GetSize()==0)
		return;

	FileList * a_filelist=NULL;
	a_filelist=new FileList;

		//断点所在文件的索引
	int n_gotofile=0;
	//项目中的文件数目
	int n_filenum=curgotopro->proinfstru.GetSize();
	//子窗口指针
	CMDIChildWnd *m_pgotochildf=NULL;
	CMDIChildWnd *m_ptestwnd=NULL;
    //访问每个文件信息
	for(int j=0;j<=n_filenum-1;j++)
	{

		a_filelist=(FileList *)(curgotopro->proinfstru.GetAt(j));
		 m_ptestwnd=(CMDIChildWnd *)a_filelist->m_pChildWnd;
		//如果fti是当前选择节点的父节点
	    if(nowchild==m_ptestwnd)
		{		
		m_pgotochildf=m_ptestwnd;
			//断点所在子窗口指针 
//			m_pgotochildf=fileitemarray[j].m_pchildf;
		    //所在文件的索引
			n_gotofile=j;
		    break;
		 }
		//取下一个子节点  
//		fti=m_pTreeCtrlcompile->GetNextSiblingItem(fti);
		
	}
	if(j>=n_filenum)
		return;

	//文件信息结构指针

    //获得断点所在文件对应的文件信息指针
	a_filelist=(FileList * )curgotopro->proinfstru.GetAt(n_gotofile);
	//获得断点所在文件对应的子窗口指针
//	m_pgotochildf=fileitemarray[n_gotofile].m_pchildf;
	//断点信息结构的指针变量
	*/



		int n_cal=oa_error.GetSize();
		if(n_cal<=1)
			return;
		int i=0;
//	int j=0;
//	while ((i<=n_cal)&&(LineIndex(i)<n_selstart)) 
		while (LineIndex(i)<n_selstart) 
		{
//		j=this->LineLength(i);
//		n_selstart=n_selstart-j;
		i++;
		//双击的最后一行,退出
		if(i>n_cal&&LineIndex(i)<n_selstart)
		return;     

		}
//	i--;	
		n_selline=i-1;
	//获得搜索结果的总条数		
	//双击的是第一行,退出
		if(n_selline<=0)
			return;  	

		struct ErrStruct * m_perr;
		m_perr=new	ErrStruct;
		m_perr=(ErrStruct *)oa_error.GetAt(n_selline-1);
		int gotoline=m_perr->i_errline+1;
		CMDIChildWnd *m_pgotochildf=NULL;
		m_pgotochildf=m_perr->m_pChildWnd;


		//获得双击行对应的搜索结果指针
//		inf_search=(SearchInf * )a_searchinfo.GetAt(n_selline-1);
		//获得双击行对应的子窗口指针
//	
		//获得子窗口活动视图
		CCrystalTextView* m_pexpandview=NULL; 
		m_pexpandview=(CCrystalTextView*)m_pgotochildf->GetActiveView();
		CC02IDEView* m_peditview=(CC02IDEView*)m_pgotochildf->GetActiveView();
	   //如果子窗口存在
		if(m_pgotochildf!=NULL)
		{
			//子窗口激活
			m_pgotochildf->MDIActivate(); 
	        //子窗口设置为最前
		    m_pgotochildf->BringWindowToTop();
			//子窗口设置为焦点
			m_pgotochildf->SetFocus();
//	        //编辑控件的第一可见行
//			int nFirst = myeditctrl.GetFirstVisibleLine ();
			//查找结果所在行
//			int gotoline=inf_search->n_lineno;
            //查找结果所在列
			int gotorow=0;
			m_pexpandview->ScrollToLine(gotoline);
			//设置当前选择
			CPoint pselstart,pselend;
			pselstart.y=gotoline;
			pselstart.x=gotorow;
			pselend.y=gotoline;
			pselend.x=gotorow;//+findstring.GetLength();
			m_pexpandview->SetSelection(pselstart,pselend);
			m_pexpandview->SetCursorPos(pselend);
			m_pexpandview->EnsureVisible(pselend);
	        //子窗口激活
			m_pgotochildf->MDIActivate(); 
	        //子窗口设置为最前
		    m_pgotochildf->BringWindowToTop();
			//子窗口设置为焦点
			m_pgotochildf->SetFocus();
		}
	}

	


}

BOOL COutputCtrl::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) 
{
	// TODO: Add your message handler code here and/or call default
	
	return CRichEditCtrl::OnCopyData(pWnd, pCopyDataStruct);
}

⌨️ 快捷键说明

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