*
* @brief Declaration of CGhostTextBuffer (subclasses CCrystalTextBuffer to handle ghost lines)
*/
-// ID line follows -- this is updated by SVN
-// $Id: GhostTextBuffer.h 5762 2008-08-08 05:32:15Z kimmov $
-
-#ifndef __GHOSTTEXTBUFFER_H__
-#define __GHOSTTEXTBUFFER_H__
+#pragma once
#include <vector>
#include "ccrystaltextbuffer.h"
-#include "GhostUndoRecord.h"
/////////////////////////////////////////////////////////////////////////////
*/
enum GHOST_LINEFLAGS
{
- LF_GHOST = 0x00400000L, /**< Ghost line. */
+ LF_GHOST = 0x00400000UL, /**< Ghost line. */
};
/////////////////////////////////////////////////////////////////////////////
public:
DECLARE_DYNCREATE (CGhostTextBuffer)
-protected :
-#pragma pack(push, 1)
- // Nested class declarations
- enum
- {
- UNDO_INSERT = 0x0001,
- UNDO_BEGINGROUP = 0x0100
- };
-
-
-
-#pragma pack(pop)
-
-protected:
- /**
- We need another array with our richer structure.
-
- We share the positions with the CCrystalTextBuffer object.
- We share m_bUndoGroup, its utility is to check we opened the UndoBeginGroup.
- We share m_nUndoBufSize which is the max buffer size.
- */
- std::vector<GhostUndoRecord> m_aUndoBuf;
- /**
- This one must be duplicated because the flag UNDO_BEGINGROUP needs to be set in both
- CGhostTextBuffer::m_aUndoBuf and CCrystalTextBuffer::m_aUndoBuf CArrays
- */
- bool m_bUndoBeginGroup;
-
- // [JRT] Support For Descriptions On Undo/Redo Actions
- virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
- LPCTSTR pszText, int cchText, int nRealLinesChanged, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisonNumbers = NULL);
-
private:
/**
* @brief A struct mapping real lines and apparent (screen) lines.
// Operations
private:
+#if 0
bool InternalInsertGhostLine (CCrystalTextView * pSource, int nLine);
+#endif
bool InternalDeleteGhostLine (CCrystalTextView * pSource, int nLine, int nCount);
public :
// Construction/destruction code
CGhostTextBuffer ();
- virtual bool InitNew (CRLFSTYLE nCrlfStyle = CRLF_STYLE_DOS);
/**
This should work in base code as ghost lines are real empty lines
*/
virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
int nEndLine, int nEndChar, CString &text,
- CRLFSTYLE nCrlfStyle =CRLF_STYLE_AUTOMATIC,
- bool bExcludeInvisibleLines = true);
+ CRLFSTYLE nCrlfStyle =CRLFSTYLE::AUTOMATIC,
+ bool bExcludeInvisibleLines = true) const override;
+ virtual bool IsIndentableLine(int nLine) const override { return (GetLineFlags(nLine) & LF_GHOST) == 0; }
// Text modification functions
virtual bool InsertText (CCrystalTextView * pSource, int nLine, int nPos,
- LPCTSTR pszText, int cchText, int &nEndLine, int &nEndChar,
- int nAction = CE_ACTION_UNKNOWN, bool bHistory =true);
- virtual bool DeleteText (CCrystalTextView * pSource, int nStartLine,
- int nStartPos, int nEndLine, int nEndPos,
- int nAction = CE_ACTION_UNKNOWN, bool bHistory =true, bool bExcludeInvisibleLines = true);
+ LPCTSTR pszText, size_t cchText, int &nEndLine, int &nEndChar,
+ int nAction = CE_ACTION_UNKNOWN, bool bHistory =true) override;
virtual bool DeleteText2 (CCrystalTextView * pSource, int nStartLine,
int nStartPos, int nEndLine, int nEndPos,
- int nAction = CE_ACTION_UNKNOWN, bool bHistory =true);
+ int nAction = CE_ACTION_UNKNOWN, bool bHistory =true) override;
+#if 0
bool InsertGhostLine (CCrystalTextView * pSource, int nLine);
+#endif
- // Undo/Redo
- virtual bool Undo (CCrystalTextView * pSource, CPoint & ptCursorPos);
- virtual bool Redo (CCrystalTextView * pSource, CPoint & ptCursorPos);
+ virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
+ LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = nullptr) override;
+ virtual UndoRecord GetUndoRecord(int nUndoPos) const override;
+ virtual bool UndoInsert(CCrystalTextView * pSource, CPoint & ptCursorPos,
+ const CPoint apparent_ptStartPos, CPoint const apparent_ptEndPos, const UndoRecord & ur) override;
- // Undo grouping
- virtual void BeginUndoGroup (bool bMergeWithPrevious = false);
- virtual void FlushUndoGroup (CCrystalTextView * pSource);
+ virtual CDWordArray *CopyRevisionNumbers(int nStartLine, int nEndLine) const override;
+ virtual void RestoreRevisionNumbers(int nStartLine, CDWordArray *paSavedRevisionNumbers) override;
public:
//@{
private:
void RecomputeRealityMapping();
- /**
- Code to set EOL, if the status ghost/real of the line changes
-
- We should call a CCrystalTextBuffer function to add the correct EOL
- (if CCrystalTextBuffer keeps the default EOL for the file)
- */
- void RecomputeEOL(CCrystalTextView * pSource, int nStartLine, int nEndLine);
+ void CountEolAndLastLineLength(const CPoint& ptStartPos, LPCTSTR pszText, size_t cchText, int& nLastLineLength, int& nEol);
/** For debugging purpose */
- void checkFlagsFromReality(bool bFlag) const;
+ void checkFlagsFromReality() const;
protected:
virtual void OnNotifyLineHasBeenEdited(int nLine);
DECLARE_MESSAGE_MAP ()
};
-
-/////////////////////////////////////////////////////////////////////////////
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
-
-
-#endif //__GHOSTTEXTBUFFER_H__