📄 filedlgview.cpp
字号:
// FileDlgView.cpp : implementation of the CFileDlgView class
//
#include "stdafx.h"
#include "FileDlg.h"
#include "FileDlgDoc.h"
#include "FileDlgView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView
IMPLEMENT_DYNCREATE(CFileDlgView, CEditView)
BEGIN_MESSAGE_MAP(CFileDlgView, CEditView)
//{{AFX_MSG_MAP(CFileDlgView)
ON_COMMAND(ID_GRAMMA_ANALYSIS, OnGrammaAnalysis)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView construction/destruction
CFileDlgView::CFileDlgView()
{
// TODO: add construction code here
}
CFileDlgView::~CFileDlgView()
{
}
BOOL CFileDlgView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
return bPreCreated;
}
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView drawing
void CFileDlgView::OnDraw(CDC* pDC)
{
CFileDlgDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView printing
BOOL CFileDlgView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default CEditView preparation
return CEditView::OnPreparePrinting(pInfo);
}
void CFileDlgView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView begin printing.
CEditView::OnBeginPrinting(pDC, pInfo);
}
void CFileDlgView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView end printing
CEditView::OnEndPrinting(pDC, pInfo);
}
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView diagnostics
#ifdef _DEBUG
void CFileDlgView::AssertValid() const
{
CEditView::AssertValid();
}
void CFileDlgView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
CFileDlgDoc* CFileDlgView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFileDlgDoc)));
return (CFileDlgDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFileDlgView message handlers
void CFileDlgView::OnGrammaAnalysis()
{
// TODO: Add your command handler code here
Grammacheck dlg;
ErrorDialog err_dlg;
int tmp;
g_count=0;
if(dlg.DoModal()==IDOK)
{
sprintf(buf,"%s",dlg.m_express);
}
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
tmp=E();
if(tmp)
{
if(err_dlg.DoModal()==IDOK)
OnGrammaAnalysis() ;
}
else
{
RetryDialog retry_dlg;
if(retry_dlg.DoModal()==IDOK)
OnGrammaAnalysis() ;
}
}
int CFileDlgView::E()
{
if(T())
return 1;
if(E1())
return 1;
return 0;
}
int CFileDlgView::T()
{
if(F())
return 1;
if(T1())
return 1;
return 0;
}
int CFileDlgView::E1()
{
if(g_value=='+')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
if(T())
return 1;
if(E1())
return 1;
}
else if(g_value=='-')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
if(T())
return 1;
if(E1())
return 1;
}
return 0;
}
int CFileDlgView::F()
{
int tmp;
tmp=V();
if(!tmp)
;
else
if(g_value=='(')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
if(E())
return 1;
if(g_value==')')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
}
else
{
return 1;
}
}
else
return 1;
return 0;
}
int CFileDlgView::T1()
{
if(g_value=='*')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
if(F())
return 1;
if(T1())
return 1;
}
else if(g_value=='/')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
if(F())
return 1;
if(T1())
return 1;
}
return 0;
}
int CFileDlgView::V()
{
if(P())
return 1;
return 0;
}
int CFileDlgView::P()
{
if(g_value>='A'&&g_value<='Z')
{
g_count++;
g_value=buf[g_count];
while(g_value==' ')
{
g_count++;
g_value=buf[g_count];
}
return 0;
}
else
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -