-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCRorTextBuffer.h
148 lines (110 loc) · 3.21 KB
/
CRorTextBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#if !defined(AFX_CRorTEXTBUFFER__H)
#define AFX_CRorTEXTBUFFER__H
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "CRorTextView.h"
#include "..\exe2c\exe2c.H"
#include "..\exe2c\src\CXmlPrt.h"
#ifndef __AFXTEMPL_H__
#pragma message("Include <afxtempl.h> in your stdafx.h to avoid this message")
#include <afxtempl.h>
#endif
#define UNDO_DESCRIP_BUF 32
enum LINEFLAGS
{
LF_BOOKMARK_FIRST = 0x00000001L,
LF_EXECUTION = 0x00010000L,
LF_BREAKPOINT = 0x00020000L,
LF_COMPILATION_ERROR = 0x00040000L,
LF_BOOKMARKS = 0x00080000L,
LF_INVALID_BREAKPOINT = 0x00100000L
};
#define LF_BOOKMARK(id) (LF_BOOKMARK_FIRST << id)
enum CRLFSTYLE
{
CRLF_STYLE_AUTOMATIC = -1,
CRLF_STYLE_DOS = 0,
CRLF_STYLE_UNIX = 1,
CRLF_STYLE_MAC = 2
};
enum
{
CE_ACTION_UNKNOWN = 0,
CE_ACTION_PASTE = 1,
CE_ACTION_DELSEL = 2,
CE_ACTION_CUT = 3,
CE_ACTION_TYPING = 4,
CE_ACTION_BACKSPACE = 5,
CE_ACTION_INDENT = 6,
CE_ACTION_DRAGDROP = 7,
CE_ACTION_REPLACE = 8,
CE_ACTION_DELETE = 9,
CE_ACTION_AUTOINDENT = 10
// ...
// Expandable: user actions allowed
};
/////////////////////////////////////////////////////////////////////////////
// CUpdateContext class
class CUpdateContext
{
public:
virtual void RecalcPoint(CPoint &ptPoint) = 0;
};
/////////////////////////////////////////////////////////////////////////////
// CRorTextBuffer command target
class CRorTextBuffer : public CCmdTarget
{
DECLARE_DYNCREATE(CRorTextBuffer)
protected:
// Nested class declarations
struct SLineInfo
{
TCHAR *m_pcLine;
int m_nLength, m_nMax;
void* m_hline;
st_LINE_SYNTAX lineSyntax[240];
SLineInfo() { ZeroMemory(this, sizeof(SLineInfo)); };
};
// Lines of text
CArray <SLineInfo, SLineInfo&> m_aLines;
// Connected views
CList <CRorTextView *, CRorTextView *> m_lpViews;
public:
CXmlPrt m_xml;
void Parse(int nLineIndex, TEXTBLOCK *pBuf, int &nActualItems);
bool OnChar(int x, int y, UINT nChar);
bool SetCurWord(int x, int y);
// Construction/destruction code
CRorTextBuffer();
~CRorTextBuffer();
// Basic functions
BOOL InitNew();
BOOL LoadFromFile(LPCTSTR pszFileName);
BOOL SaveToFile(LPCTSTR pszFileName);
void FreeAll();
// Connect/disconnect views
void AddView(CRorTextView *pView);
void RemoveView(CRorTextView *pView);
// Text access functions
int GetLineCount();
int GetLineLength(int nLine);
LPTSTR GetLineChars(int nLine);
CString GetText(int nStartLine, int nStartChar, int nEndLine, int nEndChar);
// Notify all connected views about changes in text
void UpdateViews();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRorTextBuffer)
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CRorTextBuffer)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CRorTEXTBUFFER__H)