-
Notifications
You must be signed in to change notification settings - Fork 22
/
raedit.h
310 lines (287 loc) · 13.4 KB
/
raedit.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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
#pragma once
#include <windows.h>
#include <richedit.h>
#pragma pack(push, 1)
// Default colors
#define BCKCLR 0x00C0F0F0
#define TXTCLR 0x00000000
#define SELBCKCLR 0x00800000
#define SELTXTCLR 0x00FFFFFF
#define CMNTCLR 0x02008000
#define STRCLR 0x00A00000
#define OPRCLR 0x000000A0
#define HILITE1 0x00F0C0C0
#define HILITE2 0x00C0F0C0
#define HILITE3 0x00C0C0F0
#define SELBARCLR 0x00C0C0C0
#define SELBARPEN 0x00808080
#define LNRCLR 0x00800000
#define NUMCLR 0x00808080
#define CMNTBCK 0x00C0F0F0
#define STRBCK 0x00C0F0F0
#define NUMBCK 0x00C0F0F0
#define OPRBCK 0x00C0F0F0
#define CHANGEDCLR 0x0000F0F0
#define CHANGESAVEDCLR 0x0000F000
// Window styles
#define STYLE_NOSPLITT 0x0001 // No splitt button
#define STYLE_NOLINENUMBER 0x0002 // No linenumber button
#define STYLE_NOCOLLAPSE 0x0004 // No expand/collapse buttons
#define STYLE_NOHSCROLL 0x0008 // No horizontal scrollbar
#define STYLE_NOVSCROLL 0x0010 // No vertical scrollbar
#define STYLE_NOHILITE 0x0020 // No color hiliting
#define STYLE_NOSIZEGRIP 0x0040 // No size grip
#define STYLE_NODBLCLICK 0x0080 // No action on double clicks
#define STYLE_READONLY 0x0100 // Text is locked
#define STYLE_NODIVIDERLINE 0x0200 // Blocks are not divided by line
#define STYLE_NOBACKBUFFER 0x0400 // Drawing directly to screen DC
#define STYLE_NOSTATE 0x0800 // No state indicator
#define STYLE_DRAGDROP 0x1000 // Drag & Drop support, app must load ole
#define STYLE_SCROLLTIP 0x2000 // Scrollbar tooltip
#define STYLE_HILITECOMMENT 0x4000 // Comments are hilited
#define STYLE_AUTOSIZELINENUM 0x8000 // Line number column autosizes
// Styles used with REM_SETSTYLEEX message
#define STYLEEX_LOCK 0x0001 // Show lock button
#define STYLEEX_BLOCKGUIDE 0x0002 // Show block guiders
#define STILEEX_LINECHANGED 0x0004 // Show line changed state
#define STILEEX_STRINGMODEFB 0x0008 // FreeBasic
#define STILEEX_STRINGMODEC 0x0010 // C/C++
// Edit modes
#define MODE_NORMAL 0 // Normal
#define MODE_BLOCK 1 // Block select
#define MODE_OVERWRITE 2 // Overwrite
// REM_COMMAND commands
#define CMD_LEFT 1
#define CMD_RIGHT 2
#define CMD_LINE_UP 3
#define CMD_LINE_DOWN 4
#define CMD_PAGE_UP 5
#define CMD_PAGE_DOWN 6
#define CMD_HOME 7
#define CMD_END 8
#define CMD_INSERT 9
#define CMD_DELETE 10
#define CMD_BACKSPACE 11
// REM_COMMAND modifyers
#define CMD_ALT 256
#define CMD_CTRL 512
#define CMD_SHIFT 1024
// Private edit messages
#define REM_RAINIT (WM_USER+9999) // wParam=0, lParam=pointer to controls DIALOG struct
#define REM_BASE (WM_USER+1000)
#define REM_SETHILITEWORDS (REM_BASE+0) // wParam=Color, lParam=lpszWords
#define REM_SETFONT (REM_BASE+1) // wParam=nLineSpacing, lParam=lpRAFONT
#define REM_GETFONT (REM_BASE+2) // wParam=0, lParam=lpRAFONT
#define REM_SETCOLOR (REM_BASE+3) // wParam=0, lParam=lpRACOLOR
#define REM_GETCOLOR (REM_BASE+4) // wParam=0, lParam=lpRACOLOR
#define REM_SETHILITELINE (REM_BASE+5) // wParam=Line, lParam=Color
#define REM_GETHILITELINE (REM_BASE+6) // wParam=Line, lParam=0
#define REM_SETBOOKMARK (REM_BASE+7) // wParam=Line, lParam=Type
#define REM_GETBOOKMARK (REM_BASE+8) // wParam=Line, lParam=0
#define REM_CLRBOOKMARKS (REM_BASE+9) // wParam=0, lParam=Type
#define REM_NXTBOOKMARK (REM_BASE+10) // wParam=Line, lParam=Type
#define REM_PRVBOOKMARK (REM_BASE+11) // wParam=Line, lParam=Type
#define REM_FINDBOOKMARK (REM_BASE+12) // wParam=BmID, lParam=0
#define REM_SETBLOCKS (REM_BASE+13) // wParam=[lpLINERANGE], lParam=0
#define REM_ISLINE (REM_BASE+14) // wParam=Line, lParam=lpszDef
#define REM_GETWORD (REM_BASE+15) // wParam=BuffSize, lParam=lpBuff
#define REM_COLLAPSE (REM_BASE+16) // wParam=Line, lParam=0
#define REM_COLLAPSEALL (REM_BASE+17) // wParam=0, lParam=0
#define REM_EXPAND (REM_BASE+18) // wParam=Line, lParam=0
#define REM_EXPANDALL (REM_BASE+19) // wParam=0, lParam=0
#define REM_LOCKLINE (REM_BASE+20) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINELOCKED (REM_BASE+21) // wParam=Line, lParam=0
#define REM_HIDELINE (REM_BASE+22) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINEHIDDEN (REM_BASE+23) // wParam=Line, lParam=0
#define REM_AUTOINDENT (REM_BASE+24) // wParam=0, lParam=TRUE/FALSE
#define REM_TABWIDTH (REM_BASE+25) // wParam=nChars, lParam=TRUE/FALSE (Expand tabs)
#define REM_SELBARWIDTH (REM_BASE+26) // wParam=nWidth, lParam=0
#define REM_LINENUMBERWIDTH (REM_BASE+27) // wParam=nWidth, lParam=0
#define REM_MOUSEWHEEL (REM_BASE+28) // wParam=nLines, lParam=0
#define REM_SUBCLASS (REM_BASE+29) // wParam=0, lParam=lpWndProc
#define REM_SETSPLIT (REM_BASE+30) // wParam=nSplit, lParam=0
#define REM_GETSPLIT (REM_BASE+31) // wParam=0, lParam=0
#define REM_VCENTER (REM_BASE+32) // wParam=0, lParam=0
#define REM_REPAINT (REM_BASE+33) // wParam=0, lParam=TRUE/FALSE (Paint Now)
#define REM_BMCALLBACK (REM_BASE+34) // wParam=0, lParam=lpBmProc
#define REM_READONLY (REM_BASE+35) // wParam=0, lParam=TRUE/FALSE
#define REM_INVALIDATELINE (REM_BASE+36) // wParam=Line, lParam=0
#define REM_SETPAGESIZE (REM_BASE+37) // wParam=nLines, lParam=0
#define REM_GETPAGESIZE (REM_BASE+38) // wParam=0, lParam=0
#define REM_GETCHARTAB (REM_BASE+39) // wParam=nChar, lParam=0
#define REM_SETCHARTAB (REM_BASE+40) // wParam=nChar, lParam=nValue
#define REM_SETCOMMENTBLOCKS (REM_BASE+41) // wParam=lpStart, lParam=lpEnd
#define REM_SETWORDGROUP (REM_BASE+42) // wParam=0, lParam=nGroup (0-15)
#define REM_GETWORDGROUP (REM_BASE+43) // wParam=0, lParam=0
#define REM_SETBMID (REM_BASE+44) // wParam=nLine, lParam=nBmID
#define REM_GETBMID (REM_BASE+45) // wParam=nLine, lParam=0
#define REM_ISCHARPOS (REM_BASE+46) // wParam=CP, lParam=0, returns 1 if comment block, 2 if comment, 3 if string
#define REM_HIDELINES (REM_BASE+47) // wParam=nLine, lParam=nLines
#define REM_SETDIVIDERLINE (REM_BASE+48) // wParam=nLine, lParam=TRUE/FALSE
#define REM_ISINBLOCK (REM_BASE+49) // wParam=nLine, lParam=lpRABLOCKDEF
#define REM_TRIMSPACE (REM_BASE+50) // wParam=nLine, lParam=fLeft
#define REM_SAVESEL (REM_BASE+51) // wParam=0, lParam=0
#define REM_RESTORESEL (REM_BASE+52) // wParam=0, lParam=0
#define REM_GETCURSORWORD (REM_BASE+53) // wParam=BuffSize, lParam=lpBuff, Returns line number
#define REM_SETSEGMENTBLOCK (REM_BASE+54) // wParam=nLine, lParam=TRUE/FALSE
#define REM_GETMODE (REM_BASE+55) // wParam=0, lParam=0
#define REM_SETMODE (REM_BASE+56) // wParam=nMode, lParam=0
#define REM_GETBLOCK (REM_BASE+57) // wParam=0, lParam=lpBLOCKRANGE
#define REM_SETBLOCK (REM_BASE+58) // wParam=0, lParam=lpBLOCKRANGE
#define REM_BLOCKINSERT (REM_BASE+59) // wParam=0, lParam=lpText
#define REM_LOCKUNDOID (REM_BASE+60) // wParam=TRUE/FALSE, lParam=0
#define REM_ADDBLOCKDEF (REM_BASE+61) // wParam=0, lParam=lpRABLOCKDEF
#define REM_CONVERT (REM_BASE+62) // wParam=nType, lParam=0
#define REM_BRACKETMATCH (REM_BASE+63) // wParam=0, lParam=lpDef {[(,}]),_
#define REM_COMMAND (REM_BASE+64) // wParam=nCommand, lParam=0
#define REM_CASEWORD (REM_BASE+65) // wParam=cp, lParam=lpWord
#define REM_GETBLOCKEND (REM_BASE+66) // wParam=Line, lParam=0
#define REM_SETLOCK (REM_BASE+67) // wParam=TRUE/FALSE, lParam=0
#define REM_GETLOCK (REM_BASE+68) // wParam=0, lParam=0
#define REM_GETWORDFROMPOS (REM_BASE+69) // wParam=cp, lParam=lpBuff
#define REM_SETNOBLOCKLINE (REM_BASE+70) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINENOBLOCK (REM_BASE+71) // wParam=Line, lParam=0
#define REM_SETALTHILITELINE (REM_BASE+72) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINEALTHILITE (REM_BASE+73) // wParam=Line, lParam=0
#define REM_SETCURSORWORDTYPE (REM_BASE+74) // wParam=nType, lParam=0
#define REM_SETBREAKPOINT (REM_BASE+75) // wParam=nLine, lParam=TRUE/FALSE
#define REM_NEXTBREAKPOINT (REM_BASE+76) // wParam=nLine, lParam=0
#define REM_GETLINESTATE (REM_BASE+77) // wParam=nLine, lParam=0
#define REM_SETERROR (REM_BASE+78) // wParam=nLine, lParam=nErrID
#define REM_GETERROR (REM_BASE+79) // wParam=nLine, lParam=0
#define REM_NEXTERROR (REM_BASE+80) // wParam=nLine, lParam=0
#define REM_CHARTABINIT (REM_BASE+81) // wParam=0, lParam=0
#define REM_LINEREDTEXT (REM_BASE+82) // wParam=nLine, lParam=TRUE/FALSE
#define REM_SETSTYLEEX (REM_BASE+83) // wParam=nStyleEx, lParam=0
#define REM_GETUNICODE (REM_BASE+84) // wParam=0, lParam=0
#define REM_SETUNICODE (REM_BASE+85) // wParam=TRUE/FALSE, lParam=0
#define REM_SETCHANGEDSTATE (REM_BASE+86) // wParam=TRUE/FALSE, lParam=0
#define REM_SETTOOLTIP (REM_BASE+87) // wParam=n (1-6), lParam=lpText
#define REM_HILITEACTIVELINE (REM_BASE+88) // wParam=0, lParam=nColor
#define REM_GETUNDO (REM_BASE+89) // wParam=nSize, lParam=lpMem
#define REM_SETUNDO (REM_BASE+90) // wParam=nSize, lParam=lpMem
#define REM_GETLINEBEGIN (REM_BASE+91) // wParam=nLine, lParam=0
// Convert types
#define CONVERT_TABTOSPACE 0
#define CONVERT_SPACETOTAB 1
#define CONVERT_UPPERCASE 2
#define CONVERT_LOWERCASE 3
// Line hiliting
#define STATE_HILITEOFF 0
#define STATE_HILITE1 1
#define STATE_HILITE2 2
#define STATE_HILITE3 3
#define STATE_HILITEMASK 3
// Bookmarks
#define STATE_BMOFF 0x00
#define STATE_BM1 0x10
#define STATE_BM2 0x20
#define STATE_BM3 0x30
#define STATE_BM4 0x40
#define STATE_BM5 0x50
#define STATE_BM6 0x60
#define STATE_BM7 0x70
#define STATE_BM8 0x80
#define STATE_BMMASK 0x0F0
// Line states
#define STATE_LOCKED 0x00000100
#define STATE_HIDDEN 0x00000200
#define STATE_COMMENT 0x00000400
#define STATE_DIVIDERLINE 0x00000800
#define STATE_SEGMENTBLOCK 0x00001000
#define STATE_NOBLOCK 0x00002000
#define STATE_ALTHILITE 0x00004000
#define STATE_BREAKPOINT 0x00008000
#define STATE_BLOCKSTART 0x00010000
#define STATE_BLOCK 0x00020000
#define STATE_BLOCKEND 0x00040000
#define STATE_REDTEXT 0x00080000
#define STATE_COMMENTNEST 0x00100000
#define STATE_CHANGED 0x00200000
#define STATE_CHANGESAVED 0x00400000
#define STATE_GARBAGE 0x80000000
// Character table types
#define CT_NONE 0
#define CT_CHAR 1
#define CT_OPER 2
#define CT_HICHAR 3
#define CT_CMNTCHAR 4
#define CT_STRING 5
#define CT_CMNTDBLCHAR 6
#define CT_CMNTINITCHAR 7
// Find
#define FR_IGNOREWHITESPACE 0x8000000
struct tagRAFONT {
HFONT hFont; // Code edit normal
HFONT hIFont; // Code edit italics
HFONT hLnrFont; // Line numbers
};
typedef struct tagRAFONT RAFONT;
struct tagRACOLOR {
COLORREF bckcol; // Back color
COLORREF txtcol; // Text color
COLORREF selbckcol; // Sel back color
COLORREF seltxtcol; // Sel text color
COLORREF cmntcol; // Comment color
COLORREF strcol; // String color
COLORREF oprcol; // Operator color
COLORREF hicol1; // Line hilite 1
COLORREF hicol2; // Line hilite 2
COLORREF hicol3; // Line hilite 3
COLORREF selbarbck; // Selection bar
COLORREF selbarpen; // Selection bar pen
COLORREF lnrcol; // Line numbers color
COLORREF numcol; // Numbers & hex color
COLORREF cmntback; // Comment back color
COLORREF strback; // String back color
COLORREF numback; // Numbers & hex back color
COLORREF oprback; // Operator back color
COLORREF changed; // Line changed indicator
COLORREF changesaved; // Line saved chane indicator
};
typedef struct tagRACOLOR RACOLOR;
struct tagRASELCHANGE {
NMHDR nmhdr;
CHARRANGE chrg; // Current selection
WORD seltyp; // SEL_TEXT or SEL_OBJECT
DWORD line; // Line number
DWORD cpLine; // Character position of first character
HANDLE lpLine; // Pointer to line
DWORD nlines; // Total number of lines
DWORD nhidden; // Total number of hidden lines
BOOL fchanged; // TRUE if changed since last
DWORD npage; // Page number
DWORD nWordGroup; // Hilite word group(0-15)
};
typedef struct tagRASELCHANGE RASELCHANGE;
#define BD_NONESTING 0x01 // Set to true for non nested blocks
#define BD_DIVIDERLINE 0x02 // Draws a divider line
#define BD_INCLUDELAST 0x04 // lpszEnd line is also collapsed
#define BD_LOOKAHEAD 0x08 // Look 500 lines ahead for the ending
#define BD_SEGMENTBLOCK 0x10 // Segment block, collapse till next segmentblock
#define BD_COMMENTBLOCK 0x20 // Comment block
#define BD_NOBLOCK 0x40 //
#define BD_ALTHILITE 0x80 // Adds 1 to the current word group for syntax coloring.
struct tagRABLOCKDEF {
LPTSTR lpszStart; // Block start
LPTSTR lpszEnd; // Block end
LPTSTR lpszNot1; // Dont hide line containing this or set to NULL
LPTSTR lpszNot2; // Dont hide line containing this or set to NULL
DWORD flag; // High word is WordGroup(0-15)
};
typedef struct tagRABLOCKDEF RABLOCKDEF;
struct tagLINERANGE {
DWORD lnMin; // Starting line
DWORD lnMax; // Ending line
};
typedef struct tagLINERANGE LINERANGE;
struct tagBLOCKRANGE {
DWORD lnMin; // Starting line
DWORD clMin; // Starting column
DWORD lnMax; // Ending line
DWORD clMax; // Ending column
};
typedef struct tagBLOCKRANGE BLOCKRANGE;
void WINAPI InstallRAEdit(HINSTANCE hInst, BOOL fGlobal);
void WINAPI UnInstallRAEdit(void);
#pragma pack(pop)