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

📄 ccrystaleditview.h

📁 一个完整的编辑器的代码(很值得参考
💻 H
字号:
////////////////////////////////////////////////////////////////////////////
//  File:       ccrystaleditview.h
//  Version:    1.0.0.0
//  Created:    29-Dec-1998
//
//  Author:     Stcherbatchenko Andrei
//  E-mail:     windfall@gmx.de
//
//  Interface of the CCrystalEditView class, a part of Crystal Edit - syntax
//  coloring text editor.
//
//  You are free to use or modify this code to the following restrictions:
//  - Acknowledge me somewhere in your about box, simple "Parts of code by.."
//  will be enough. If you can't (or don't want to), contact me personally.
//  - LEAVE THIS HEADER INTACT
////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//  19-Jul-99
//      Ferdinand Prantl:
//  +   FEATURE: see cpps ...
//
//  ... it's being edited very rapidly so sorry for non-commented
//        and maybe "ugly" code ...
////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CCRYSTALEDITVIEW_H__8F3F8B63_6F66_11D2_8C34_0080ADB86836__INCLUDED_)
#define AFX_CCRYSTALEDITVIEW_H__8F3F8B63_6F66_11D2_8C34_0080ADB86836__INCLUDED_

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

#include "ccrystaltextview.h"
#include "wispelld.h"

/////////////////////////////////////////////////////////////////////////////
//  Forward class declarations

class CEditDropTargetImpl;

/////////////////////////////////////////////////////////////////////////////
//  CCrystalEditView view

class EDITPADC_CLASS CCrystalEditView : public CCrystalTextView
  {
    DECLARE_DYNCREATE (CCrystalEditView)

public :
    int m_nLastReplaceLen;
    CMap<CString, LPCTSTR, CString, LPCTSTR> *m_mapExpand;

    static HMODULE hSpellDll;
    static TCHAR szWIspellPath[_MAX_PATH];
    static SpellData spellData;
    static int (*SpellInit) (SpellData*);
    static int (*SpellCheck) (SpellData*);
    static int (*SpellConfig) (SpellData*);
    static BOOL LoadSpellDll (BOOL bAlert = TRUE);
    static int SpellGetLine (struct SpellData_t *pdata);
    static int SpellNotify (int nEvent, struct SpellData_t *pdata);

protected:
    BOOL m_bLastReplace;
    DWORD m_dwLastReplaceFlags;

private :
    BOOL m_bOvrMode;
    BOOL m_bDropPosVisible;
    CPoint m_ptSavedCaretPos;
    CPoint m_ptDropPos;
    BOOL m_bSelectionPushed;
    CPoint m_ptSavedSelStart, m_ptSavedSelEnd;
    BOOL m_bAutoIndent;
    BOOL m_bInsertTabs;

    //  [JRT]
    BOOL m_bDisableBSAtSOL;       // Disable BS At Start Of Line

    BOOL DeleteCurrentSelection ();

public :
    virtual void ResetView ();
protected :
    CEditDropTargetImpl * m_pDropTarget;
    virtual DROPEFFECT GetDropEffect ();
    virtual void OnDropSource (DROPEFFECT de);
    void Paste ();
    void Cut ();

    // Attributes
public :
    BOOL GetAutoIndent () const;
    void SetAutoIndent (BOOL bAutoIndent);
    BOOL GetInsertTabs () const;
    void SetInsertTabs (BOOL bInsertTabs);

    //  [JRT]
    void SetDisableBSAtSOL (BOOL bDisableBSAtSOL);
    BOOL GetDisableBSAtSOL () const;

    // Operations
public :
    CCrystalEditView ();
    ~CCrystalEditView ();

    BOOL GetOverwriteMode () const;
    void SetOverwriteMode (BOOL bOvrMode = TRUE);

    void ShowDropIndicator (const CPoint & point);
    void HideDropIndicator ();

    BOOL DoDropText (COleDataObject * pDataObject, const CPoint & ptClient);
    void DoDragScroll (const CPoint & point);

    virtual BOOL QueryEditable ();
    virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1);

    BOOL ReplaceSelection (LPCTSTR pszNewText, DWORD dwFlags);

    virtual void OnEditOperation (int nAction, LPCTSTR pszText);

    virtual bool DoSetTextType (TextDefinition *def);

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CCrystalEditView)
    //}}AFX_VIRTUAL

    // Implementation
protected :

    // Generated message map functions
protected :
    //{{AFX_MSG(CCrystalEditView)
    afx_msg void OnEditPaste ();
    afx_msg void OnUpdateEditCut (CCmdUI * pCmdUI);
    afx_msg void OnEditCut ();
    afx_msg void OnUpdateEditPaste (CCmdUI * pCmdUI);
    afx_msg void OnEditDelete ();
    afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags);
    afx_msg void OnEditDeleteBack ();
    afx_msg void OnEditUntab ();
    afx_msg void OnEditTab ();
    afx_msg void OnEditSwitchOvrmode ();
    afx_msg void OnUpdateEditSwitchOvrmode (CCmdUI * pCmdUI);
    afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnDestroy ();
    afx_msg void OnEditReplace ();
    afx_msg void OnUpdateEditUndo (CCmdUI * pCmdUI);
    afx_msg void OnEditUndo ();
    afx_msg void OnUpdateEditRedo (CCmdUI * pCmdUI);
    afx_msg void OnEditRedo ();
    afx_msg void OnUpdateEditAutoComplete (CCmdUI * pCmdUI);
    afx_msg void OnEditAutoComplete ();
    afx_msg void OnUpdateEditAutoExpand (CCmdUI * pCmdUI);
    afx_msg void OnEditAutoExpand ();
    afx_msg void OnUpdateEditLowerCase (CCmdUI * pCmdUI);
    afx_msg void OnEditLowerCase ();
    afx_msg void OnUpdateEditUpperCase (CCmdUI * pCmdUI);
    afx_msg void OnEditUpperCase ();
    afx_msg void OnUpdateEditSwapCase (CCmdUI * pCmdUI);
    afx_msg void OnEditSwapCase ();
    afx_msg void OnUpdateEditCapitalize (CCmdUI * pCmdUI);
    afx_msg void OnEditCapitalize ();
    afx_msg void OnUpdateEditSentence (CCmdUI * pCmdUI);
    afx_msg void OnEditSentence ();
    //}}AFX_MSG
    afx_msg void OnUpdateIndicatorCol (CCmdUI * pCmdUI);
    afx_msg void OnUpdateIndicatorOvr (CCmdUI * pCmdUI);
    afx_msg void OnUpdateIndicatorRead (CCmdUI * pCmdUI);
	//BEGIN SW
	afx_msg void OnUpdateEditGotoLastChange(CCmdUI* pCmdUI);
	afx_msg void OnEditGotoLastChange();
	//END SW
	afx_msg void OnUpdateToolsSpelling (CCmdUI * pCmdUI);
	afx_msg void OnToolsSpelling ();
	afx_msg void OnUpdateToolsCharCoding (CCmdUI * pCmdUI);
	afx_msg void OnToolsCharCoding ();
	afx_msg void OnEditDeleteWord ();
	afx_msg void OnEditDeleteWordBack ();
    DECLARE_MESSAGE_MAP ()
  };

/////////////////////////////////////////////////////////////////////////////

#if ! (defined(CE_FROM_DLL) || defined(CE_DLL_BUILD))
#include "ccrystaleditview.inl"
#endif

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CCRYSTALEDITVIEW_H__8F3F8B63_6F66_11D2_8C34_0080ADB86836__INCLUDED_)

⌨️ 快捷键说明

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