📄 outputlistbox.cpp
字号:
// OutputListbox.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "c02ideview.h"
#include "MainFrm.h"
#include "OutputListbox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COutputListbox
COutputListbox::COutputListbox()
{
}
COutputListbox::~COutputListbox()
{
}
BEGIN_MESSAGE_MAP(COutputListbox, CListBox)
//{{AFX_MSG_MAP(COutputListbox)
ON_WM_LBUTTONDBLCLK()
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COutputListbox message handlers
void COutputListbox::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//列表框中没有内容,返回
if(GetCount()==0)
return;
//主窗口指针
CMainFrame*m_pCMainFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd);
//获得输出区当前选择页面索引
int n_seltab=m_pCMainFrame->m_wndOutput.GetSelTab();
//定义搜索结果结构指针
struct SearchInf * inf_search=NULL;
inf_search=new SearchInf;
//如果双击的是第3个页面
if(n_seltab==2)
{
//获得双击行的索引
int n_selline=0;
n_selline=GetCurSel();
//获得搜索结果的总条数
int n_cal=a_searchinfo.GetSize();
//双击的是第一行或最后一行,退出
if(n_selline==0||n_selline>n_cal)
return;
//获得双击行对应的搜索结果指针
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();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -