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
|
/******************************************************************************
*
*
* Notepad2
*
* SciCall.h
* Inline wrappers for Scintilla API calls, arranged in the order and grouping
* in which they appear in the Scintilla documentation.
*
* The use of these inline wrapper functions with declared types will ensure
* that we get the benefit of the compiler's type checking.
*
*
******************************************************************************/
//=============================================================================
//
// g_hScintilla
//
//
extern HANDLE g_hScintilla;
__forceinline void InitScintillaHandle(HWND hwnd) {
g_hScintilla = (HANDLE)SendMessage(hwnd, SCI_GETDIRECTPOINTER, 0, 0);
}
//=============================================================================
//
// SciCall()
//
//
LRESULT WINAPI Scintilla_DirectFunction(HANDLE, UINT, WPARAM, LPARAM);
#define SciCall(m, w, l) Scintilla_DirectFunction(g_hScintilla, m, w, l)
//=============================================================================
//
// DeclareSciCall[RV][0-2] Macros
//
// R: With an explicit return type
// V: No return type defined ("void"); defaults to SendMessage's LRESULT
// 0-2: Number of parameters to define
//
//
#define DeclareSciCallR0(fn, msg, ret) \
__forceinline ret SciCall_##fn() { \
return((ret)SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallR1(fn, msg, ret, type1, var1) \
__forceinline ret SciCall_##fn(type1 var1) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallR2(fn, msg, ret, type1, var1, type2, var2) \
__forceinline ret SciCall_##fn(type1 var1, type2 var2) { \
return((ret)SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
#define DeclareSciCallV0(fn, msg) \
__forceinline LRESULT SciCall_##fn() { \
return(SciCall(SCI_##msg, 0, 0)); \
}
#define DeclareSciCallV1(fn, msg, type1, var1) \
__forceinline LRESULT SciCall_##fn(type1 var1) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), 0)); \
}
#define DeclareSciCallV2(fn, msg, type1, var1, type2, var2) \
__forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \
return(SciCall(SCI_##msg, (WPARAM)(var1), (LPARAM)(var2))); \
}
//=============================================================================
//
// Selection and information
//
//
DeclareSciCallR0(GetLineCount, GETLINECOUNT, int);
DeclareSciCallV2(SetSel, SETSEL, int, anchorPos, int, currentPos);
DeclareSciCallV1(GotoPos, GOTOPOS, int, position);
DeclareSciCallV1(GotoLine, GOTOLINE, int, line);
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, int);
DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, int, int, position);
//=============================================================================
//
// Scrolling and automatic scrolling
//
//
DeclareSciCallV0(ScrollCaret, SCROLLCARET);
DeclareSciCallV2(SetXCaretPolicy, SETXCARETPOLICY, int, caretPolicy, int, caretSlop);
DeclareSciCallV2(SetYCaretPolicy, SETYCARETPOLICY, int, caretPolicy, int, caretSlop);
//=============================================================================
//
// Style definition
//
//
DeclareSciCallR1(StyleGetFore, STYLEGETFORE, COLORREF, int, styleNumber);
DeclareSciCallR1(StyleGetBack, STYLEGETBACK, COLORREF, int, styleNumber);
//=============================================================================
//
// Margins
//
//
DeclareSciCallV2(SetMarginType, SETMARGINTYPEN, int, margin, int, type);
DeclareSciCallV2(SetMarginWidth, SETMARGINWIDTHN, int, margin, int, pixelWidth);
DeclareSciCallV2(SetMarginMask, SETMARGINMASKN, int, margin, int, mask);
DeclareSciCallV2(SetMarginSensitive, SETMARGINSENSITIVEN, int, margin, BOOL, sensitive);
DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, BOOL, useSetting, COLORREF, colour);
DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, BOOL, useSetting, COLORREF, colour);
//=============================================================================
//
// Markers
//
//
DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols);
DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour);
DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour);
//=============================================================================
//
// Folding
//
//
DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, BOOL, int, line);
DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, int, line);
DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags);
DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, int, line);
DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, int, line);
DeclareSciCallV1(ToggleFold, TOGGLEFOLD, int, line);
DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, int, line);
//=============================================================================
//
// Lexer
//
//
DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value);
|