📄 ccrystaltextview.h
字号:
void SetDisableDragAndDrop (BOOL bDDAD);
//BEGIN SW
BOOL GetWordWrapping() const;
void SetWordWrapping( BOOL bWordWrap );
/**
Sets the Parser to use to parse the file.
@param pParser Pointer to parser to use. Set to NULL to use no parser.
@return Pointer to parser used before or NULL, if no parser has been used before.
*/
CCrystalParser *SetParser( CCrystalParser *pParser );
//END SW
// Default handle to resources
static HINSTANCE s_hResourceInst;
int m_nLastFindWhatLen;
RxNode *m_rxnode;
RxMatchRes m_rxmatch;
LPTSTR m_pszMatched;
static LOGFONT m_LogFont;
typedef enum
{
SRC_PLAIN,
SRC_ASP,
SRC_BASIC,
SRC_BATCH,
SRC_C,
SRC_DCL,
SRC_FORTRAN,
SRC_HTML,
SRC_INSTALLSHIELD,
SRC_JAVA,
SRC_LISP,
SRC_PASCAL,
SRC_PERL,
SRC_PHP,
SRC_PYTHON,
SRC_REXX,
SRC_RSRC,
SRC_SGML,
SRC_SH,
SRC_SIOD,
SRC_SQL,
SRC_TCL,
SRC_TEX
}
TextType;
struct TextDefinition
{
TextType type;
TCHAR name[256];
TCHAR exts[256];
DWORD (CCrystalTextView:: * ParseLineX) (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
DWORD flags;
DWORD tabsize;
TCHAR opencomment[8];
TCHAR closecomment[8];
TCHAR commentline[8];
DWORD encoding;
};
#define SRCOPT_INSERTTABS 1
#define SRCOPT_SHOWTABS 2
#define SRCOPT_BSATBOL 4
#define SRCOPT_SELMARGIN 8
#define SRCOPT_AUTOINDENT 16
#define SRCOPT_BRACEANSI 32
#define SRCOPT_BRACEGNU 64
#define SRCOPT_EOLNDOS 128
#define SRCOPT_EOLNUNIX 256
#define SRCOPT_EOLNMAC 512
#define SRCOPT_FNBRACE 1024
#define SRCOPT_WORDWRAP 2048
// Source type
TextDefinition *m_CurSourceDef;
static TextDefinition m_SourceDefs[];
bool m_bRememberLastPos;
virtual bool DoSetTextType (TextDefinition *def);
static TextDefinition *GetTextType (LPCTSTR pszExt);
virtual bool SetTextType (LPCTSTR pszExt);
virtual bool SetTextType (CCrystalTextView::TextType enuType);
virtual bool SetTextType (CCrystalTextView::TextDefinition *def);
static void LoadSettings ();
static void SaveSettings ();
enum
{
// Base colors
COLORINDEX_WHITESPACE,
COLORINDEX_BKGND,
COLORINDEX_NORMALTEXT,
COLORINDEX_SELMARGIN,
COLORINDEX_SELBKGND,
COLORINDEX_SELTEXT,
// Syntax colors
COLORINDEX_KEYWORD,
COLORINDEX_FUNCNAME,
COLORINDEX_COMMENT,
COLORINDEX_NUMBER,
COLORINDEX_OPERATOR, // [JRT]:
COLORINDEX_STRING,
COLORINDEX_PREPROCESSOR,
COLORINDEX_USER1,
COLORINDEX_USER2,
// Compiler/debugger colors
COLORINDEX_ERRORBKGND,
COLORINDEX_ERRORTEXT,
COLORINDEX_EXECUTIONBKGND,
COLORINDEX_EXECUTIONTEXT,
COLORINDEX_BREAKPOINTBKGND,
COLORINDEX_BREAKPOINTTEXT
// ...
// Expandable: custom elements are allowed.
};
// Operations
public :
void AttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
void DetachFromBuffer ();
// Buffer-view interaction, multiple views
virtual CCrystalTextBuffer *LocateTextBuffer ();
virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1);
// Attributes
CPoint GetCursorPos ();
void SetCursorPos (const CPoint & ptCursorPos);
void ShowCursor ();
void HideCursor ();
void PopCursor ();
void PushCursor ();
// Operations
void EnsureVisible (CPoint pt);
// Text search helpers
BOOL FindText (LPCTSTR pszText, const CPoint & ptStartPos, DWORD dwFlags, BOOL bWrapSearch, CPoint * pptFoundPos);
BOOL FindTextInBlock (LPCTSTR pszText, const CPoint & ptStartPos, const CPoint & ptBlockBegin, const CPoint & ptBlockEnd,
DWORD dwFlags, BOOL bWrapSearch, CPoint * pptFoundPos);
BOOL HighlightText (const CPoint & ptStartPos, int nLength, BOOL bReverse = FALSE);
// Overridable: an opportunity for Auto-Indent, Smart-Indent etc.
virtual void OnEditOperation (int nAction, LPCTSTR pszText);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCrystalTextView)
public :
virtual void OnDraw (CDC * pDC); // overridden to draw this view
virtual BOOL PreCreateWindow (CREATESTRUCT & cs);
virtual BOOL PreTranslateMessage (MSG * pMsg);
virtual void OnPrepareDC (CDC * pDC, CPrintInfo * pInfo = NULL);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
protected :
virtual void OnInitialUpdate (); // called first time after construct
virtual BOOL OnPreparePrinting (CPrintInfo * pInfo);
virtual void OnBeginPrinting (CDC * pDC, CPrintInfo * pInfo);
virtual void OnEndPrinting (CDC * pDC, CPrintInfo * pInfo);
virtual void OnPrint (CDC * pDC, CPrintInfo * pInfo);
//}}AFX_VIRTUAL
// Implementation
public :
CCrystalTextView ();
~CCrystalTextView ();
protected :
// Generated message map functions
protected :
#ifdef _DEBUG
void AssertValidTextPos (const CPoint & pt);
#endif
//{{AFX_MSG(CCrystalTextView)
afx_msg void OnDestroy ();
afx_msg BOOL OnEraseBkgnd (CDC * pDC);
afx_msg void OnSize (UINT nType, int cx, int cy);
afx_msg void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar);
afx_msg BOOL OnSetCursor (CWnd * pWnd, UINT nHitTest, UINT message);
afx_msg void OnLButtonDown (UINT nFlags, CPoint point);
afx_msg void OnSetFocus (CWnd * pOldWnd);
afx_msg void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar);
afx_msg void OnLButtonUp (UINT nFlags, CPoint point);
afx_msg void OnMouseMove (UINT nFlags, CPoint point);
afx_msg void OnTimer (UINT nIDEvent);
afx_msg void OnKillFocus (CWnd * pNewWnd);
afx_msg void OnLButtonDblClk (UINT nFlags, CPoint point);
afx_msg void OnEditCopy ();
afx_msg void OnUpdateEditCopy (CCmdUI * pCmdUI);
afx_msg void OnEditSelectAll ();
afx_msg void OnUpdateEditSelectAll (CCmdUI * pCmdUI);
afx_msg void OnRButtonDown (UINT nFlags, CPoint point);
afx_msg void OnSysColorChange ();
afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct);
afx_msg void OnEditFind ();
afx_msg void OnEditRepeat ();
afx_msg void OnUpdateEditRepeat (CCmdUI * pCmdUI);
afx_msg void OnEditFindPrevious (); // More search
afx_msg void OnEditDeleteBack();
afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
afx_msg void OnUpdateEditFindPrevious (CCmdUI * pCmdUI);
afx_msg BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt);
//}}AFX_MSG
afx_msg void OnFilePageSetup ();
afx_msg void OnCharLeft ();
afx_msg void OnExtCharLeft ();
afx_msg void OnCharRight ();
afx_msg void OnExtCharRight ();
afx_msg void OnWordLeft ();
afx_msg void OnExtWordLeft ();
afx_msg void OnWordRight ();
afx_msg void OnExtWordRight ();
afx_msg void OnLineUp ();
afx_msg void OnExtLineUp ();
afx_msg void OnLineDown ();
afx_msg void OnExtLineDown ();
afx_msg void OnPageUp ();
afx_msg void OnExtPageUp ();
afx_msg void OnPageDown ();
afx_msg void OnExtPageDown ();
afx_msg void OnLineEnd ();
afx_msg void OnExtLineEnd ();
afx_msg void OnHome ();
afx_msg void OnExtHome ();
afx_msg void OnTextBegin ();
afx_msg void OnExtTextBegin ();
afx_msg void OnTextEnd ();
afx_msg void OnExtTextEnd ();
afx_msg void OnUpdateIndicatorCRLF (CCmdUI * pCmdUI);
afx_msg void OnUpdateIndicatorPosition (CCmdUI * pCmdUI);
afx_msg void OnToggleBookmark (UINT nCmdID);
afx_msg void OnGoBookmark (UINT nCmdID);
afx_msg void OnClearBookmarks ();
afx_msg void OnToggleBookmark (); // More bookmarks
afx_msg void OnClearAllBookmarks ();
afx_msg void OnNextBookmark ();
afx_msg void OnPrevBookmark ();
afx_msg void OnUpdateClearAllBookmarks (CCmdUI * pCmdUI);
afx_msg void OnUpdateNextBookmark (CCmdUI * pCmdUI);
afx_msg void OnUpdatePrevBookmark (CCmdUI * pCmdUI);
afx_msg void ScrollUp ();
afx_msg void ScrollDown ();
afx_msg void ScrollLeft ();
afx_msg void ScrollRight ();
afx_msg void OnSourceType (UINT nId);
afx_msg void OnUpdateSourceType (CCmdUI * pCmdUI);
afx_msg void OnMatchBrace ();
afx_msg void OnUpdateMatchBrace (CCmdUI * pCmdUI);
afx_msg void OnEditGoTo ();
afx_msg void OnUpdateToggleSourceHeader (CCmdUI * pCmdUI);
afx_msg void OnToggleSourceHeader ();
afx_msg void OnUpdateSelMargin (CCmdUI * pCmdUI);
afx_msg void OnSelMargin ();
afx_msg void OnUpdateWordWrap (CCmdUI * pCmdUI);
afx_msg void OnWordWrap ();
afx_msg void OnForceRedraw ();
//BEGIN SW
// incremental search
afx_msg void OnEditFindIncrementalForward();
afx_msg void OnEditFindIncrementalBackward();
afx_msg void OnUpdateEditFindIncrementalForward(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditFindIncrementalBackward(CCmdUI* pCmdUI);
//END SW
DECLARE_MESSAGE_MAP ()
};
#ifdef _DEBUG
#define ASSERT_VALIDTEXTPOS(pt) AssertValidTextPos(pt);
#else
#define ASSERT_VALIDTEXTPOS(pt)
#endif
#if ! (defined(CE_FROM_DLL) || defined(CE_DLL_BUILD))
#include "ccrystaltextview.inl"
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CCRYSTALTEXTVIEW_H__AD7F2F41_6CB3_11D2_8C32_0080ADB86836__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -