OSDN Git Service

5254ce71773dceba91556fd0977762f291067b98
[winmerge-jp/winmerge-jp.git] / Externals / crystaledit / editlib / ccrystaleditview.h
1 ////////////////////////////////////////////////////////////////////////////
2 //  File:       ccrystaleditview.h
3 //  Version:    1.0.0.0
4 //  Created:    29-Dec-1998
5 //
6 //  Author:     Stcherbatchenko Andrei
7 //  E-mail:     windfall@gmx.de
8 //
9 //  Interface of the CCrystalEditView class, a part of Crystal Edit - syntax
10 //  coloring text editor.
11 //
12 //  You are free to use or modify this code to the following restrictions:
13 //  - Acknowledge me somewhere in your about box, simple "Parts of code by.."
14 //  will be enough. If you can't (or don't want to), contact me personally.
15 //  - LEAVE THIS HEADER INTACT
16 ////////////////////////////////////////////////////////////////////////////
17
18 ////////////////////////////////////////////////////////////////////////////
19 //  19-Jul-99
20 //      Ferdinand Prantl:
21 //  +   FEATURE: see cpps ...
22 //
23 //  ... it's being edited very rapidly so sorry for non-commented
24 //        and maybe "ugly" code ...
25 ////////////////////////////////////////////////////////////////////////////
26
27 #pragma once
28
29 #include "ccrystaltextview.h"
30 #include "ccrystaltextbuffer.h"
31 #include "wispelld.h"
32
33 /////////////////////////////////////////////////////////////////////////////
34 //  Forward class declarations
35
36 class CEditDropTargetImpl;
37 class CEditReplaceDlg;
38
39 /////////////////////////////////////////////////////////////////////////////
40 //  CCrystalEditView view
41
42 class EDITPADC_CLASS CCrystalEditView : public CCrystalTextView
43   {
44     DECLARE_DYNCREATE (CCrystalEditView)
45
46 public :
47     int m_nLastReplaceLen;
48     CMap<CString, LPCTSTR, CString, LPCTSTR> *m_mapExpand;
49
50     static HMODULE hSpellDll;
51     static TCHAR szWIspellPath[_MAX_PATH];
52     static SpellData spellData;
53     static int (*SpellInit) (SpellData*);
54     static int (*SpellCheck) (SpellData*);
55     static int (*SpellConfig) (SpellData*);
56     static bool LoadSpellDll (bool bAlert = true);
57     static int SpellGetLine (struct SpellData_t *pdata);
58     static int SpellNotify (int nEvent, struct SpellData_t *pdata);
59
60 protected:
61     bool m_bLastReplace;
62     DWORD m_dwLastReplaceFlags;
63     CEditReplaceDlg *m_pEditReplaceDlg;
64
65 protected:
66     bool m_bDropPosVisible;
67     CPoint m_ptSavedCaretPos;
68     bool m_bSelectionPushed;
69     CPoint m_ptSavedSelStart, m_ptSavedSelEnd;
70 private :
71     bool m_bOvrMode;
72     CPoint m_ptDropPos;
73     bool m_bAutoIndent;
74
75     //  [JRT]
76     bool m_bDisableBSAtSOL;       // Disable BS At Start Of Line
77
78
79 public :
80     virtual void ResetView () override;
81 protected :
82
83
84
85
86     CEditDropTargetImpl * m_pDropTarget;
87     virtual DROPEFFECT GetDropEffect () override;
88     virtual void OnDropSource (DROPEFFECT de) override;
89     void Paste ();
90     void Cut ();
91     bool DeleteCurrentSelection ();
92     bool DeleteCurrentColumnSelection (int nAction, bool bFlushUndoGroup = true, bool bUpdateCursorPosition = true);
93     bool DeleteCurrentColumnSelection2 (int nStartLine, int nEndLine, int nAction);
94     bool InsertColumnText (int nLine, int nPos, LPCTSTR pszText, int cchText, int nAction, bool bFlushUndoGroup = true);
95
96     // Attributes
97 public :
98     bool GetAutoIndent () const;
99     void SetAutoIndent (bool bAutoIndent);
100     bool GetInsertTabs () const;
101     void SetInsertTabs (bool bInsertTabs);
102
103     //  [JRT]
104     void SetDisableBSAtSOL (bool bDisableBSAtSOL);
105     bool GetDisableBSAtSOL () const;
106
107     // Operations
108 public :
109     CCrystalEditView ();
110     ~CCrystalEditView ();
111
112     bool GetOverwriteMode () const;
113     void SetOverwriteMode (bool bOvrMode = true);
114
115     void ShowDropIndicator (const CPoint & point);
116     void HideDropIndicator ();
117
118     void SetAlternateDropTarget (IDropTarget *pDropTarget);
119
120     bool DoDropText (COleDataObject * pDataObject, const CPoint & ptClient);
121     void DoDragScroll (const CPoint & point);
122
123     virtual bool QueryEditable ();
124     virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1) override;
125
126     void SaveLastSearch(LastSearchInfos *lastSearch);
127     bool ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags, bool bGroupWithPrevious = false);
128
129     virtual void OnEditOperation (int nAction, LPCTSTR pszText, size_t cchText) override;
130
131     virtual bool DoSetTextType (CrystalLineParser::TextDefinition *def) override;
132
133     // Overrides
134     // ClassWizard generated virtual function overrides
135     //{{AFX_VIRTUAL(CCrystalEditView)
136     //}}AFX_VIRTUAL
137
138     // Implementation
139 protected :
140
141     // Generated message map functions
142 protected :
143     bool m_bMergeUndo;
144     //{{AFX_MSG(CCrystalEditView)
145     afx_msg void OnEditPaste ();
146     afx_msg void OnUpdateEditCut (CCmdUI * pCmdUI);
147     afx_msg void OnEditCut ();
148     afx_msg void OnUpdateEditPaste (CCmdUI * pCmdUI);
149     afx_msg void OnEditDelete ();
150     afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags);
151     afx_msg void OnEditDeleteBack ();
152     afx_msg void OnEditUntab ();
153     afx_msg void OnEditTab ();
154     afx_msg void OnEditSwitchOvrmode ();
155     afx_msg void OnUpdateEditSwitchOvrmode (CCmdUI * pCmdUI);
156     afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct);
157     afx_msg void OnDestroy ();
158     afx_msg void OnEditReplace ();
159     afx_msg void OnUpdateEditUndo (CCmdUI * pCmdUI);
160     afx_msg void OnEditUndo ();
161     afx_msg void OnUpdateEditRedo (CCmdUI * pCmdUI);
162     afx_msg void OnEditRedo ();
163     afx_msg void OnUpdateEditAutoComplete (CCmdUI * pCmdUI);
164     afx_msg void OnEditAutoComplete ();
165     afx_msg void OnUpdateEditAutoExpand (CCmdUI * pCmdUI);
166     afx_msg void OnEditAutoExpand ();
167     afx_msg void OnUpdateEditLowerCase (CCmdUI * pCmdUI);
168     afx_msg void OnEditLowerCase ();
169     afx_msg void OnUpdateEditUpperCase (CCmdUI * pCmdUI);
170     afx_msg void OnEditUpperCase ();
171     afx_msg void OnUpdateEditSwapCase (CCmdUI * pCmdUI);
172     afx_msg void OnEditSwapCase ();
173     afx_msg void OnUpdateEditCapitalize (CCmdUI * pCmdUI);
174     afx_msg void OnEditCapitalize ();
175     afx_msg void OnUpdateEditSentence (CCmdUI * pCmdUI);
176     afx_msg void OnEditSentence ();
177     afx_msg void OnKillFocus (CWnd * pNewWnd);
178     //}}AFX_MSG
179     afx_msg void OnUpdateIndicatorCol (CCmdUI * pCmdUI);
180     afx_msg void OnUpdateIndicatorOvr (CCmdUI * pCmdUI);
181     afx_msg void OnUpdateIndicatorRead (CCmdUI * pCmdUI);
182     //BEGIN SW
183     afx_msg void OnUpdateEditGotoLastChange(CCmdUI* pCmdUI);
184     afx_msg void OnEditGotoLastChange();
185     //END SW
186     afx_msg void OnUpdateToolsSpelling (CCmdUI * pCmdUI);
187     afx_msg void OnToolsSpelling ();
188     afx_msg void OnUpdateToolsCharCoding (CCmdUI * pCmdUI);
189     afx_msg void OnToolsCharCoding ();
190     afx_msg void OnEditDeleteWord ();
191     afx_msg void OnEditDeleteWordBack ();
192     // cursor movement
193     afx_msg void OnCharLeft();
194     afx_msg void OnExtCharLeft();
195     afx_msg void OnCharRight();
196     afx_msg void OnExtCharRight();
197     afx_msg void OnWordLeft();
198     afx_msg void OnExtWordLeft();
199     afx_msg void OnWordRight();
200     afx_msg void OnExtWordRight();
201     afx_msg void OnLineUp();
202     afx_msg void OnExtLineUp();
203     afx_msg void OnLineDown();
204     afx_msg void OnExtLineDown();
205     afx_msg void OnPageUp();
206     afx_msg void OnExtPageUp();
207     afx_msg void OnPageDown();
208     afx_msg void OnExtPageDown();
209     afx_msg void OnLineEnd();
210     afx_msg void OnExtLineEnd();
211     afx_msg void OnHome();
212     afx_msg void OnExtHome();
213     afx_msg void OnTextBegin();
214     afx_msg void OnExtTextBegin();
215     afx_msg void OnTextEnd();
216     afx_msg void OnExtTextEnd();
217     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
218     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
219     bool DoEditUndo();
220     bool DoEditRedo();
221     DECLARE_MESSAGE_MAP ()
222   };
223
224 /////////////////////////////////////////////////////////////////////////////
225
226 inline bool CCrystalEditView::
227 GetOverwriteMode ()
228 const
229 {
230   return m_bOvrMode;
231 }
232
233 inline void CCrystalEditView::SetOverwriteMode (bool bOvrMode /*= true*/ )
234 {
235   m_bOvrMode = bOvrMode;
236 }
237
238 inline bool CCrystalEditView::
239 GetDisableBSAtSOL ()
240 const
241 {
242   return m_bDisableBSAtSOL;
243 }
244
245 inline bool CCrystalEditView::GetAutoIndent ()
246 const
247 {
248   return m_bAutoIndent;
249 }
250
251 inline void CCrystalEditView::SetAutoIndent (bool bAutoIndent)
252 {
253   m_bAutoIndent = bAutoIndent;
254 }
255
256 inline bool CCrystalEditView::GetInsertTabs ()
257 const
258 {
259   return m_pTextBuffer->GetInsertTabs();
260 }
261
262 inline void CCrystalEditView::SetInsertTabs (bool bInsertTabs)
263 {
264   m_pTextBuffer->SetInsertTabs(bInsertTabs);
265 }