C_EditorView.cpp
资源名称:ceditor.rar [点击查看]
上传用户:hgtech
上传日期:2022-06-07
资源大小:4455k
文件大小:4k
源码类别:
词法分析
开发平台:
Visual C++
- // C_EditorView.cpp : implementation of the CC_EditorView class
- //
- #include "stdafx.h"
- #include "C_Editor.h"
- #include "C_EditorDoc.h"
- #include "CntrItem.h"
- #include "C_EditorView.h"
- #include "SynEditView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CC_EditorView
- IMPLEMENT_DYNCREATE(CC_EditorView, CSynEditView)
- BEGIN_MESSAGE_MAP(CC_EditorView, CSynEditView)
- //{{AFX_MSG_MAP(CC_EditorView)
- ON_COMMAND(ID_COMPILE_FORMAT_ADJUST, OnCompileFormatAdjust)
- ON_COMMAND(ID_COMPILE_SYNTAX_CHECK, OnCompileSyntaxCheck)
- ON_WM_DESTROY()
- ON_WM_RBUTTONDBLCLK()
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CSynEditView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CSynEditView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CSynEditView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CC_EditorView construction/destruction
- CC_EditorView::CC_EditorView()
- {
- // TODO: add construction code here
- }
- CC_EditorView::~CC_EditorView()
- {
- }
- BOOL CC_EditorView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CSynEditView::PreCreateWindow(cs);
- }
- void CC_EditorView::OnInitialUpdate()
- {
- CSynEditView::OnInitialUpdate();
- Invalidate();
- // Set the printing margins (720 twips = 1/2 inch).
- SetMargins(CRect(720, 720, 720, 720));
- }
- /////////////////////////////////////////////////////////////////////////////
- // CC_EditorView printing
- BOOL CC_EditorView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- /*void CC_EditorView::OnDestroy()
- {
- // Deactivate the item on destruction; this is important
- // when a splitter view is being used.
- /* CSynEditView::OnDestroy();
- COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
- if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
- {
- pActiveItem->Deactivate();
- ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
- }
- }*/
- /////////////////////////////////////////////////////////////////////////////
- // CC_EditorView diagnostics
- #ifdef _DEBUG
- void CC_EditorView::AssertValid() const
- {
- CSynEditView::AssertValid();
- }
- void CC_EditorView::Dump(CDumpContext& dc) const
- {
- CSynEditView::Dump(dc);
- }
- /*CC_EditorDoc* CC_EditorView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CC_EditorDoc)));
- return (CC_EditorDoc*)m_pDocument;
- }*/
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CC_EditorView message handlers
- void CC_EditorView::OnCompileFormatAdjust()
- {
- // TODO: Add your command handler code here
- }
- void CC_EditorView::OnCompileSyntaxCheck()
- {
- // TODO: Add your command handler code here
- /* CC_EditorView * pView = (CC_EditorView*)m_viewList.GetHead();
- ASSERT_VALID( pView );
- ASSERT_KINDOF( CC_EditorView, pView );
- CString strBuf;
- m_TextBuffer.GetText( 0, 0, m_TextBuffer.GetLineCount() - 1,
- m_TextBuffer.GetLineLength(m_TextBuffer.GetLineCount() - 1), strBuf );
- if( strBuf.IsEmpty() ) return;
- OnFileSave();// save the file
- ShowOutput();
- ClearOutput();
- ClearErrFlag();
- SetOutputAttachedView( pView );
- OutputPhaseMsg( "building syntax tree..." );
- CParser* pParser = new CParser( strBuf );
- CString strPathName = GetPathName();
- strPathName = GetTitleFromPathName( strPathName );
- strPathName += ".parse";
- pParser->Trace( strPathName );
- delete pParser;
- if( !bErrFlag ) OpenTextFile( strPathName );*/
- }
- void CC_EditorView::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- // Do not call CSynEditView::OnPaint() for painting messages
- }
- void CC_EditorView::OnDraw(CDC* pDC)
- {
- }