⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 advrichedit.h

📁 一个PLX教学编译器IDE
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////////////////////////
//                             Author : tuwei                                                  //
//                               ECNU.CS.03                                                    //
//                             2006.9 ~ 2006.11                                                //
//                           Copyright (C) reserved                                            //
//                                                                                             //
//                                                                                             //
//   Function:                                                                                 //                          
//           Syntax edit control. This control can identify special words in the window.       //
//                                                                                             //
//   Credit:                                                                                   // 
//           If you use this control in your application please keep the file header in        //
//           your source or put author's name in your product.                                 //
//                                                                                             //
//                                                                                             //
/////////////////////////////////////////////////////////////////////////////////////////////////


#if !defined(AFX_ADVRICHEDIT_H__82F5E419_1C74_11D1_87FA_00403395B157__INCLUDED_)
#define AFX_ADVRICHEDIT_H__82F5E419_1C74_11D1_87FA_00403395B157__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#define WM_EDITCTRLHSCROLL WM_USER+200

class CAdvRichEdit : public CRichEditCtrl
{
public:
	CAdvRichEdit();
	virtual ~CAdvRichEdit();

public:
	bool LoadFile(LPCTSTR filePath);
	bool SaveFile(LPCTSTR filePath);
	
	bool LoadKeyword(LPCTSTR filePath);
	void Initialize();
	int  GetCurrentLine();
	
	void AddKeywords(LPCTSTR lpszKwd);
	void AddConstants(LPCTSTR lpszKwd);
	void ClearKeywords();
	void ClearConstants();

	void SetKeywordColor(COLORREF clr, BOOL bBold);
	void SetCommentColor(COLORREF clr, BOOL bBold);
	void SetNumberColor(COLORREF  clr, BOOL bBold);
public:
	void SetLineSel(int index);
	void Search(LPCTSTR keyword);
	void DoPasteSerial();
	int  DoUndo();
	void DoCopy();
	void DoPaste();
	void DoCut();
	//{{AFX_VIRTUAL(CAdvRichEdit)
	//}}AFX_VIRTUAL

	CString m_strKeywords;
protected:
	void FormatTextLines(int nLineStart, int nLineEnd);
	void FormatAll();

	int  IsKeyword(LPCTSTR lpszSymbol);
	int  IsConstant(LPCTSTR lpszSymbol);

	void SetFormatRange(int nStart, int nEnd, BOOL bBold, COLORREF clr);
	void FormatTextRange(int nStart, int nEnd);

	struct SymbolColor {
		COLORREF clrColor;
		BOOL bBold;
	};

	enum ChangeType {ctUndo, ctUnknown, ctReplSel, ctDelete, ctBack, ctCut, ctPaste, ctMove};
	
	CString m_strKeywordsLower;

	SymbolColor m_icComment;
	SymbolColor m_icNumber;
	SymbolColor m_icKeyword;

	BOOL       m_bInForcedChange;
	ChangeType m_changeType;
	CHARRANGE  m_crOldSel;

	CFont      m_defaultFont;
	CMenu      m_editMenu;

	//{{AFX_MSG(CAdvRichEdit)
	afx_msg void OnChange();
	afx_msg UINT OnGetDlgCode();
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnEditorUndo();
	afx_msg void OnEditorPaste();
	afx_msg void OnEditorCut();
	afx_msg void OnEditorCopy();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	//}}AFX_MSG
	afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
	afx_msg void OnProtected(NMHDR*, LRESULT* pResult);
	afx_msg void OnSelChange(NMHDR*, LRESULT* pResult);

	DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}

#endif // !defined(AFX_TWSCRIPTEDIT_H__82F5E419_1C74_11D1_87FA_00403395B157__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -