1 ////////////////////////////////////////////////////////////////////////////
2 // File: ccrystaleditview.h
4 // Created: 29-Dec-1998
6 // Author: Stcherbatchenko Andrei
7 // E-mail: windfall@gmx.de
9 // Interface of the CCrystalEditView class, a part of Crystal Edit - syntax
10 // coloring text editor.
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 ////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////
21 // + FEATURE: see cpps ...
23 // ... it's being edited very rapidly so sorry for non-commented
24 // and maybe "ugly" code ...
25 ////////////////////////////////////////////////////////////////////////////
29 #include "ccrystaltextview.h"
30 #include "ccrystaltextbuffer.h"
33 /////////////////////////////////////////////////////////////////////////////
34 // Forward class declarations
36 class CEditDropTargetImpl;
37 class CEditReplaceDlg;
39 /////////////////////////////////////////////////////////////////////////////
40 // CCrystalEditView view
42 class EDITPADC_CLASS CCrystalEditView : public CCrystalTextView
44 DECLARE_DYNCREATE (CCrystalEditView)
47 int m_nLastReplaceLen;
48 CMap<CString, LPCTSTR, CString, LPCTSTR> *m_mapExpand;
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);
62 DWORD m_dwLastReplaceFlags;
63 CEditReplaceDlg *m_pEditReplaceDlg;
66 bool m_bDropPosVisible;
67 CPoint m_ptSavedCaretPos;
68 bool m_bSelectionPushed;
69 CPoint m_ptSavedSelStart, m_ptSavedSelEnd;
76 bool m_bDisableBSAtSOL; // Disable BS At Start Of Line
80 virtual void ResetView () override;
86 CEditDropTargetImpl * m_pDropTarget;
87 virtual DROPEFFECT GetDropEffect () override;
88 virtual void OnDropSource (DROPEFFECT de) override;
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);
98 bool GetAutoIndent () const;
99 void SetAutoIndent (bool bAutoIndent);
100 bool GetInsertTabs () const;
101 void SetInsertTabs (bool bInsertTabs);
104 void SetDisableBSAtSOL (bool bDisableBSAtSOL);
105 bool GetDisableBSAtSOL () const;
110 ~CCrystalEditView ();
112 bool GetOverwriteMode () const;
113 void SetOverwriteMode (bool bOvrMode = true);
115 void ShowDropIndicator (const CPoint & point);
116 void HideDropIndicator ();
118 void SetAlternateDropTarget (IDropTarget *pDropTarget);
120 bool DoDropText (COleDataObject * pDataObject, const CPoint & ptClient);
121 void DoDragScroll (const CPoint & point);
123 virtual bool QueryEditable ();
124 virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1) override;
126 void SaveLastSearch(LastSearchInfos *lastSearch);
127 bool ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags, bool bGroupWithPrevious = false);
129 virtual void OnEditOperation (int nAction, LPCTSTR pszText, size_t cchText) override;
131 virtual bool DoSetTextType (CrystalLineParser::TextDefinition *def) override;
134 // ClassWizard generated virtual function overrides
135 //{{AFX_VIRTUAL(CCrystalEditView)
141 // Generated message map functions
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);
179 afx_msg void OnUpdateIndicatorCol (CCmdUI * pCmdUI);
180 afx_msg void OnUpdateIndicatorOvr (CCmdUI * pCmdUI);
181 afx_msg void OnUpdateIndicatorRead (CCmdUI * pCmdUI);
183 afx_msg void OnUpdateEditGotoLastChange(CCmdUI* pCmdUI);
184 afx_msg void OnEditGotoLastChange();
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 ();
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);
221 DECLARE_MESSAGE_MAP ()
224 /////////////////////////////////////////////////////////////////////////////
226 inline bool CCrystalEditView::
233 inline void CCrystalEditView::SetOverwriteMode (bool bOvrMode /*= true*/ )
235 m_bOvrMode = bOvrMode;
238 inline bool CCrystalEditView::
242 return m_bDisableBSAtSOL;
245 inline bool CCrystalEditView::GetAutoIndent ()
248 return m_bAutoIndent;
251 inline void CCrystalEditView::SetAutoIndent (bool bAutoIndent)
253 m_bAutoIndent = bAutoIndent;
256 inline bool CCrystalEditView::GetInsertTabs ()
259 return m_pTextBuffer->GetInsertTabs();
262 inline void CCrystalEditView::SetInsertTabs (bool bInsertTabs)
264 m_pTextBuffer->SetInsertTabs(bInsertTabs);