OSDN Git Service

70e00e7c8fb55fb3d0d1c10bd656c5749217ec60
[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     CPoint m_ptDropPos;
72     bool m_bAutoIndent;
73
74     //  [JRT]
75     bool m_bDisableBSAtSOL;       // Disable BS At Start Of Line
76
77
78 public :
79     virtual void ResetView () override;
80 protected :
81
82
83
84
85     CEditDropTargetImpl * m_pDropTarget;
86     virtual DROPEFFECT GetDropEffect () override;
87     virtual void OnDropSource (DROPEFFECT de) override;
88     void Paste ();
89     void Cut ();
90     bool DeleteCurrentSelection ();
91     bool DeleteCurrentColumnSelection (int nAction, bool bFlushUndoGroup = true, bool bUpdateCursorPosition = true);
92     bool DeleteCurrentColumnSelection2 (int nStartLine, int nEndLine, int nAction);
93     bool InsertColumnText (int nLine, int nPos, LPCTSTR pszText, int cchText, int nAction, bool bFlushUndoGroup = true);
94
95     // Attributes
96 public :
97     bool GetAutoIndent () const;
98     void SetAutoIndent (bool bAutoIndent);
99     bool GetInsertTabs () const;
100     void SetInsertTabs (bool bInsertTabs);
101
102     //  [JRT]
103     void SetDisableBSAtSOL (bool bDisableBSAtSOL);
104     bool GetDisableBSAtSOL () const;
105
106     // Operations
107 public :
108     CCrystalEditView ();
109     ~CCrystalEditView ();
110
111     bool GetOverwriteMode () const;
112     void SetOverwriteMode (bool bOvrMode = true);
113
114     void ShowDropIndicator (const CPoint & point);
115     void HideDropIndicator ();
116
117     void SetAlternateDropTarget (IDropTarget *pDropTarget);
118
119     bool DoDropText (COleDataObject * pDataObject, const CPoint & ptClient);
120     void DoDragScroll (const CPoint & point);
121
122     virtual bool QueryEditable ();
123     virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1) override;
124
125     void SaveLastSearch(LastSearchInfos *lastSearch);
126     bool ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags, bool bGroupWithPrevious = false);
127
128     virtual void OnEditOperation (int nAction, LPCTSTR pszText, size_t cchText) override;
129
130     virtual bool DoSetTextType (CrystalLineParser::TextDefinition *def) override;
131
132     // Overrides
133     // ClassWizard generated virtual function overrides
134     //{{AFX_VIRTUAL(CCrystalEditView)
135     //}}AFX_VIRTUAL
136
137     // Implementation
138 protected :
139
140     // Generated message map functions
141 protected :
142     bool m_bMergeUndo;
143     //{{AFX_MSG(CCrystalEditView)
144     afx_msg void OnEditPaste ();
145     afx_msg void OnUpdateEditCut (CCmdUI * pCmdUI);
146     afx_msg void OnEditCut ();
147     afx_msg void OnUpdateEditPaste (CCmdUI * pCmdUI);
148     afx_msg void OnEditDelete ();
149     afx_msg void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags);
150     afx_msg void OnEditDeleteBack ();
151     afx_msg void OnEditUntab ();
152     afx_msg void OnEditTab ();
153     afx_msg void OnEditSwitchOvrmode ();
154     afx_msg void OnUpdateEditSwitchOvrmode (CCmdUI * pCmdUI);
155     afx_msg int OnCreate (LPCREATESTRUCT lpCreateStruct);
156     afx_msg void OnDestroy ();
157     afx_msg void OnEditReplace ();
158     afx_msg void OnUpdateEditUndo (CCmdUI * pCmdUI);
159     afx_msg void OnEditUndo ();
160     afx_msg void OnUpdateEditRedo (CCmdUI * pCmdUI);
161     afx_msg void OnEditRedo ();
162     afx_msg void OnUpdateEditAutoComplete (CCmdUI * pCmdUI);
163     afx_msg void OnEditAutoComplete ();
164     afx_msg void OnUpdateEditAutoExpand (CCmdUI * pCmdUI);
165     afx_msg void OnEditAutoExpand ();
166     afx_msg void OnUpdateEditLowerCase (CCmdUI * pCmdUI);
167     afx_msg void OnEditLowerCase ();
168     afx_msg void OnUpdateEditUpperCase (CCmdUI * pCmdUI);
169     afx_msg void OnEditUpperCase ();
170     afx_msg void OnUpdateEditSwapCase (CCmdUI * pCmdUI);
171     afx_msg void OnEditSwapCase ();
172     afx_msg void OnUpdateEditCapitalize (CCmdUI * pCmdUI);
173     afx_msg void OnEditCapitalize ();
174     afx_msg void OnUpdateEditSentence (CCmdUI * pCmdUI);
175     afx_msg void OnEditSentence ();
176     afx_msg void OnKillFocus (CWnd * pNewWnd);
177     //}}AFX_MSG
178     afx_msg void OnUpdateIndicatorCol (CCmdUI * pCmdUI);
179     afx_msg void OnUpdateIndicatorOvr (CCmdUI * pCmdUI);
180     afx_msg void OnUpdateIndicatorRead (CCmdUI * pCmdUI);
181     //BEGIN SW
182     afx_msg void OnUpdateEditGotoLastChange(CCmdUI* pCmdUI);
183     afx_msg void OnEditGotoLastChange();
184     //END SW
185     afx_msg void OnUpdateToolsSpelling (CCmdUI * pCmdUI);
186     afx_msg void OnToolsSpelling ();
187     afx_msg void OnUpdateToolsCharCoding (CCmdUI * pCmdUI);
188     afx_msg void OnToolsCharCoding ();
189     afx_msg void OnEditDeleteWord ();
190     afx_msg void OnEditDeleteWordBack ();
191     // cursor movement
192     afx_msg void OnCharLeft();
193     afx_msg void OnExtCharLeft();
194     afx_msg void OnCharRight();
195     afx_msg void OnExtCharRight();
196     afx_msg void OnWordLeft();
197     afx_msg void OnExtWordLeft();
198     afx_msg void OnWordRight();
199     afx_msg void OnExtWordRight();
200     afx_msg void OnLineUp();
201     afx_msg void OnExtLineUp();
202     afx_msg void OnLineDown();
203     afx_msg void OnExtLineDown();
204     afx_msg void OnPageUp();
205     afx_msg void OnExtPageUp();
206     afx_msg void OnPageDown();
207     afx_msg void OnExtPageDown();
208     afx_msg void OnLineEnd();
209     afx_msg void OnExtLineEnd();
210     afx_msg void OnHome();
211     afx_msg void OnExtHome();
212     afx_msg void OnTextBegin();
213     afx_msg void OnExtTextBegin();
214     afx_msg void OnTextEnd();
215     afx_msg void OnExtTextEnd();
216     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
217     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
218     bool DoEditUndo();
219     bool DoEditRedo();
220     DECLARE_MESSAGE_MAP ()
221   };
222
223 /////////////////////////////////////////////////////////////////////////////
224
225 inline bool CCrystalEditView::
226 GetOverwriteMode ()
227 const
228 {
229   return m_bOvrMode;
230 }
231
232 inline void CCrystalEditView::SetOverwriteMode (bool bOvrMode /*= true*/ )
233 {
234   m_bOvrMode = bOvrMode;
235 }
236
237 inline bool CCrystalEditView::
238 GetDisableBSAtSOL ()
239 const
240 {
241   return m_bDisableBSAtSOL;
242 }
243
244 inline bool CCrystalEditView::GetAutoIndent ()
245 const
246 {
247   return m_bAutoIndent;
248 }
249
250 inline void CCrystalEditView::SetAutoIndent (bool bAutoIndent)
251 {
252   m_bAutoIndent = bAutoIndent;
253 }
254
255 inline bool CCrystalEditView::GetInsertTabs ()
256 const
257 {
258   return m_pTextBuffer->GetInsertTabs();
259 }
260
261 inline void CCrystalEditView::SetInsertTabs (bool bInsertTabs)
262 {
263   m_pTextBuffer->SetInsertTabs(bInsertTabs);
264 }