SynEditView.h
资源名称:ceditor.rar [点击查看]
上传用户:hgtech
上传日期:2022-06-07
资源大小:4455k
文件大小:4k
源码类别:
词法分析
开发平台:
Visual C++
- #if !defined(AFX_SYNEDITVIEW_H__A9D39C50_1DC1_40DB_80F7_ACCD8988A157__INCLUDED_)
- #define AFX_SYNEDITVIEW_H__A9D39C50_1DC1_40DB_80F7_ACCD8988A157__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- //颜色索引
- enum {
- COLORINDEX_COMMENT,
- COLORINDEX_SYNTAX,
- COLORINDEX_NORMAL,
- COLORINDEX_NUMBER,
- COLORINDEX_STRING,
- COLORINDEX_CHAR,
- COLORINDEX_BK,
- };
- class CSynEditView : public CRichEditView
- {
- struct COLORINFO {
- int Pos;
- int Color;
- };
- protected: // create from serialization only
- CSynEditView();
- DECLARE_DYNCREATE(CSynEditView)
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CSynEditView)
- public:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- protected:
- virtual void OnInitialUpdate(); // called first time after construct
- virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
- virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- void LoadFile(CString strFile);
- void SetWrapMode(int nWrapMode);
- virtual ~CSynEditView();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- // Generated message map functions
- protected:
- //{{AFX_MSG(CSynEditView)
- afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
- afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- static DWORD CALLBACK EditStreamCallbackReadFromFile(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
- void SetSynEditViewMargin(int nLeftMargin, int nTopMargin);
- BOOL IsNumber(CString &strReadyToTest);
- BOOL IsSynWord(CString &strReadyToTest);
- void LoadSynWord();
- DWORD ParseLine(DWORD dwCookie, CString &strLine, COLORINFO *ColorInfo, int &nActualItems);
- void SetParseCookieZeroFromGivenLine(int nParseArraySize);
- void SetSynEditViewTabSize(int nSize);
- void SetSynEditViewFont(LOGFONT lf);
- BOOL GetLineString(int nLine, CString &strLine);
- COLORREF GetColor(int nColorIndex);
- BOOL IsSelectionInStr(int nFromHere, int nStrWidth, int nTop);
- void DrawSynEditView();
- void CalcHorzScrollPos();
- void JudgeInSeletioAndDrawText(CDC *cacheDC, CRect &rcLine, CString &str, COLORREF clrBkColor, COLORREF clrText);
- BOOL IsStrInSelection(int ptLeft, int ptTop);
- void CalcSelection();
- void ResetParseCookie();
- DWORD GetParseCookie(int nLineIndex);
- int GetCurrentLine();
- void DrawSingleLineColorText(CDC *cacheDC, int nLine, CRect rcLine);
- void SetSynCtrlTabSize(int nSize);
- void SetSynCtrlFont();
- void CalcEditorInfo();
- int GetLinesTop(int nline);
- CStringArray m_strArrayKeyWords; //关键字数组
- int m_nLineCount; //正在编辑的文本总行数
- BOOL m_bTracking; //水平滚动是否正在被拖动
- CPoint m_ptSelEnd; //选择区域尾位置
- CPoint m_ptSelStart; //选择区域首位置
- int m_nCharTabWidth; //Tab宽度,以Point表示
- int m_nCharSpaceWidth; //空格宽度,以Point表示
- BOOL m_bRealReturn; //指示一行是否为硬回车
- BOOL m_bAllowDraw; //指示是否允许重画视,为加快拖动速度而设的参数
- int m_nCurrentLine; //取当前光标所在行
- int m_nParseArraySize; //已解析的行数
- int m_nHorzPos; //水平滚动条位置
- DWORD *m_pdwParseCookies; //装入每行的解析结果
- CBitmap *m_pCacheBitmap; //内存缓冲画布
- CFont m_font; //RichEditCtrl字体
- LOGFONT m_lf; //语法编辑视字体
- int m_nCharNumberWidth; //数字宽度
- int m_nLineHeight; //行高
- int m_nTabSize; //Tab宽度,以空格数表示
- int m_nLeftMargin; //客户区左边距
- int m_nTopMargin; //客户区顶边距
- CRect m_rcClient; //SynEditView的客户区
- //颜色值
- COLORREF m_clrBkColor; //背景色
- COLORREF m_clrCommentColor; //注释色
- COLORREF m_clrSyntaxColor; //语法色
- COLORREF m_clrNormalColor; //正常色
- COLORREF m_clrStringColor; //字符串色
- COLORREF m_clrCharColor; //字符常量色
- COLORREF m_clrNumberColor; //数字色
- COLORREF m_clrBKSelText; //选择区域背景色
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_SYNEDITVIEW_H__A9D39C50_1DC1_40DB_80F7_ACCD8988A157__INCLUDED_)