📄 xrview.cpp
字号:
// XRView.cpp : implementation file
//
#include "stdafx.h"
#include "bxt.h"
#include "XRView.h"
#include "xxinput.h"
#include "xselinput.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// XRView
XRView::XRView()
{
}
XRView::~XRView()
{
}
BEGIN_MESSAGE_MAP(XRView, CRichEditCtrl)
//{{AFX_MSG_MAP(XRView)
ON_WM_LBUTTONDBLCLK()
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
ON_WM_CHAR()
ON_WM_FONTCHANGE()
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// XRView message handlers
void XRView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//AfxMessageBox("You Double Click!");
CRichEditCtrl::OnLButtonDblClk(nFlags, point);
}
void XRView::OnChange()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CRichEditCtrl::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
//AfxMessageBox("Change");
}
void XRView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
//AfxMessageBox("Key Char!");
static long start=0,ee;
if (nChar==13)
{
nChar=0;
FINDTEXTEX ff;
if(start!=0)
{
GetSel(start,ee);
}
// start=m_report.();
ff.chrg.cpMin=start;
ff.chrg.cpMax=GetTextLength();
char ft[2];
strcpy(ft,"[");
ff.lpstrText=ft;
long s=FindText(FR_MATCHCASE,&ff);
if(s==-1 && start!=0)
{
ff.chrg.cpMin=0;
ff.chrg.cpMax=GetTextLength();
s=FindText(FR_MATCHCASE,&ff);
}
ff.chrg.cpMin=s;
strcpy(ft,"]");
ff.lpstrText=ft;
long e=FindText(FR_MATCHCASE,&ff);
if(s!=-1 && e!=-1)
{
start = e+1;
SetSel(s,e+1);
CPoint pp=GetCharPos(s+1);
ClientToScreen(&pp);
//AfxMessageBox("Please Input");
CString xtemp=GetSelText();
xtemp = xtemp.Left(xtemp.GetLength()-1);
xtemp = xtemp.Right(xtemp.GetLength()-1);
//xtemp = (xtemp);
if(atoi(xtemp)>0)
{
//XSelInput *tti=new XSelInput(parentx,e-s-1,pp.x,pp.y,atoi(xtemp));
//tti->Create(IDD_SELINPUT);
//tti->DoModal();
XSelInput tti(parentx,e-s-1,pp.x,pp.y,atoi(xtemp));
tti.DoModal();
}
else
{
//XXInput *ti=new XXInput(parentx,e-s,pp.x,pp.y);
//ti->Create(IDD_DIALOG3,this);
//ti->ShowWindow(SW_SHOW);
//ti->SetWindowPos(&wndTopMost,pp.x,pp.y,0,0,SWP_NOSIZE);
//ti->DestroyWindow();
//ti->Create(IDD_DIALOG3);
//ti->DoModal();
//delete ti;
XXInput ti(parentx,e-s,pp.x,pp.y);
ti.DoModal();
}
}
}
else
CRichEditCtrl::OnChar(nChar, nRepCnt, nFlags);
//else if( (nFlags & 255) == 82)
//{
// AfxMessageBox("Ins");
//}
//char tmp[10];
//sprintf(tmp,"%u-%u",nChar,nFlags);
//AfxMessageBox(tmp);
}
void XRView::OnFontChange()
{
CRichEditCtrl::OnFontChange();
// TODO: Add your message handler code here
AfxMessageBox("The Font is Changed!!");
}
void XRView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar==45)
{
long s,e;
GetSel(s,e);
CPoint pp=GetCharPos(s+1);
ClientToScreen(&pp);
//XSelInput *tti=new XSelInput(parentx,0,pp.x,pp.y,-1);
//tti->DoModal();
XSelInput tti(parentx,0,pp.x,pp.y,-1);
tti.DoModal();
}
else
CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -