-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEditorDataStructure.h
More file actions
245 lines (199 loc) · 5.36 KB
/
Copy pathEditorDataStructure.h
File metadata and controls
245 lines (199 loc) · 5.36 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/*#*******************************************************************************
# COPYRIGHT NOTES
# ---------------
# This is a part of VinaText Project
# Copyright(C) - free open source - vinadevs
# This source code can be used, distributed or modified under MIT license
#*******************************************************************************/
#pragma once
#include "EditorCommonDef.h"
/////////////////////////////////////////////////////////////////////////////
struct FoldingBracketsData
{
long _line;
long _folderLevel;
FoldingBracketsData(long line, long folderLevel)
{
_line = line;
_folderLevel = folderLevel;
}
// for sorting by _folderLevel
bool operator < (const FoldingBracketsData& data) const
{
return this->_folderLevel < data._folderLevel;
}
};
inline bool operator != (const FoldingBracketsData& lhs, const FoldingBracketsData& rhs)
{
return lhs._line == lhs._line && lhs._folderLevel == lhs._folderLevel;
}
typedef std::vector<std::vector<FoldingBracketsData>> BracketsDataGroup;
/////////////////////////////////////////////////////////////////////////////
struct FoldingLineData
{
long _lineNumber;
CString _lineText;
FoldingLineData(long lineNumber, CString lineText)
{
_lineNumber = lineNumber;
_lineText = lineText;
}
};
typedef std::vector<FoldingLineData> FoldingLineDataList;
/////////////////////////////////////////////////////////////////////////////
struct XmlHtmlTagsPosition
{
sptr_t tagOpenStart;
sptr_t tagNameEnd;
sptr_t tagOpenEnd;
sptr_t tagCloseStart;
sptr_t tagCloseEnd;
};
/////////////////////////////////////////////////////////////////////////////
struct SearchResult
{
sptr_t start;
sptr_t end;
bool success;
};
/////////////////////////////////////////////////////////////////////////////
class FoldingLevelStack
{
public:
int levelCount = 0; // 1-based level number
int levelStack[12]{};
void push(int level)
{
while (levelCount != 0 && level <= levelStack[levelCount - 1])
{
--levelCount;
}
if (levelCount > (_countof(levelStack) - 1))
return;
levelStack[levelCount++] = level;
}
};
/////////////////////////////////////////////////////////////////////////////
typedef std::vector<Sci_Position> UndoRedoPositionBuffer;
struct UndoRedoSelection
{
int _ModeUndo = SC_SEL_STREAM;
UndoRedoPositionBuffer _anchorPosUndo;
UndoRedoPositionBuffer _CurPosUndo;
UndoRedoPositionBuffer _anchorVSUndo;
UndoRedoPositionBuffer _curVSUndo;
int _ModeRedo = SC_SEL_STREAM;
UndoRedoPositionBuffer _anchorPosRedo;
UndoRedoPositionBuffer _curPosRedo;
UndoRedoPositionBuffer _anchorVSRedo;
UndoRedoPositionBuffer _curVSRedo;
UndoRedoSelection() : _ModeUndo(SC_SEL_STREAM), _ModeRedo(SC_SEL_STREAM) {}
BOOL IsEmpty()
{
return _ModeRedo == 0 && _ModeUndo == 0;
}
};
typedef std::unordered_map<unsigned int, UndoRedoSelection> MapUndoRedoSelection;
inline Sci_Position GetFront(const UndoRedoPositionBuffer& arr)
{
if (arr.size() > 0)
{
return arr.front();
}
else
{
return 0;
}
}
inline Sci_Position GetAt(const UndoRedoPositionBuffer& arr, unsigned int i)
{
if (arr.size() > 0)
{
return arr[i];
}
else
{
return 0;
}
}
#define UndoRedoBufferSize(arr) static_cast<Sci_PositionU>(arr.size())
#define AddUndoRedoDataToBuffer(arr, i) arr.push_back(i)
/////////////////////////////////////////////////////////////////////////////
struct RecentEditorInfo
{
int _nFirstVisibleLine;
int _nCurrentPosition;
int _nWrapMode;
RecentEditorInfo() : _nFirstVisibleLine(0), _nCurrentPosition(0), _nWrapMode(0) {}
};
/////////////////////////////////////////////////////////////////////////////
struct BOOKMARK_LINE_DATA
{
CString _strTargetFile;
CString _strLine;
int _nLineNumber;
BOOL _bDeleteFromList;
BOOKMARK_LINE_DATA() :
_nLineNumber(0),
_bDeleteFromList(FALSE),
_strTargetFile(_T("")),
_strLine(_T("")) {}
};
typedef std::vector<BOOKMARK_LINE_DATA> BOOKMARK_LINE_DATA_LIST;
/////////////////////////////////////////////////////////////////////////////
struct BREAKPOINT_LINE_DATA
{
CString _strTargetFile;
CString _strLine;
CString _strTargetLanguage;
CString _strProcessName;
BOOL _bDeleteFromList;
int _nLineNumber;
BREAKPOINT_LINE_DATA() :
_nLineNumber(0),
_bDeleteFromList(FALSE),
_strTargetFile(_T("")),
_strTargetLanguage(_T("")),
_strProcessName(_T("")),
_strLine(_T("")) {}
};
typedef std::vector<BREAKPOINT_LINE_DATA> BREAKPOINT_LINE_DATA_LIST;
/////////////////////////////////////////////////////////////////////////////
constexpr int ReadBlockSize = 128 * 1024; //128 kB
constexpr int WriteBlockSize = 128 * 1024; //128 kB
enum class EOLFormat : int
{
Unknown_Format,
Win_Format,
Mac_Format,
Unix_Format
};
enum class TabSpace : int
{
Default,
Tabs,
Spaces
};
enum class ReadDirection : int
{
Disabled,
L2R,
R2L
};
/////////////////////////////////////////////////////////////////////////////
typedef sptr_t(*DirectFunc) (void *, unsigned int, uptr_t, sptr_t);
typedef void * DirectPtr;
/////////////////////////////////////////////////////////////////////////////
struct EditorThemeColorSet
{
COLORREF _lineNumberColor{ 0 };
COLORREF _selectionTextColor{ 0 };
COLORREF _editorTextColor{ 0 };
COLORREF _editorMarginBarColor{ 0 };
COLORREF _editorFolderBackColor{ 0 };
COLORREF _editorFolderForeColor{ 0 };
COLORREF _editorCaretColor{ 0 };
COLORREF _editorIndicatorColor{ 0 };
COLORREF _editorSpellCheckColor{ 0 };
COLORREF _editorTagMatchColor{ 0 };
};