forked from SublimeCodeIntel/SublimeCodeIntel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwin32.patch
More file actions
428 lines (379 loc) · 11.6 KB
/
win32.patch
File metadata and controls
428 lines (379 loc) · 11.6 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
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
diff -u -r1.156 win32/ScintillaWin.cxx
--- win32/ScintillaWin.cxx 12 May 2007 00:30:55 -0000 1.156
+++ win32/ScintillaWin.cxx 23 May 2007 21:27:33 -0000
@@ -99,7 +99,9 @@
extern void Platform_Finalise();
typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT);
+#define DISABLE_DRAG_DROP // KOMODO
+
// GCC has trouble with the standard COM ABI so do it the old C way with explicit vtables.
const TCHAR scintillaClassName[] = TEXT("Scintilla");
@@ -122,6 +124,7 @@
FormatEnumerator(int pos_, CLIPFORMAT formats_[], int formatsLen_);
};
+#ifndef DISABLE_DRAG_DROP
/**
*/
class DropSource {
@@ -148,6 +151,7 @@
ScintillaWin *sci;
DropTarget();
};
+#endif
/**
*/
@@ -169,10 +173,11 @@
CLIPFORMAT cfLineSelect;
HRESULT hrOle;
+#ifndef DISABLE_DRAG_DROP
DropSource ds;
DataObject dob;
DropTarget dt;
-
+#endif
static HINSTANCE hInstance;
ScintillaWin(HWND hwnd);
@@ -248,6 +253,7 @@
// Public for benefit of Scintilla_DirectFunction
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+#ifndef DISABLE_DRAG_DROP
/// Implement IUnknown
STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
STDMETHODIMP_(ULONG)AddRef();
@@ -263,17 +269,17 @@
/// Implement important part of IDataObject
STDMETHODIMP GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM);
-
+#endif
static bool Register(HINSTANCE hInstance_);
static bool Unregister();
-
+#ifndef DISABLE_DRAG_DROP
friend class DropSource;
friend class DataObject;
friend class DropTarget;
bool DragIsRectangularOK(CLIPFORMAT fmt) {
return drag.rectangular && (fmt == cfColumnSelect);
}
-
+#endif
private:
// For use in creating a system caret
bool HasCaretSizeChanged();
@@ -289,6 +295,11 @@
int sysCaretWidth;
int sysCaretHeight;
bool keysAlwaysUnicode;
+
+ // XXX ActiveState drag scroll support
+ int scrollSpeed;
+ int scrollTicks;
+ void DragScroll();
};
HINSTANCE ScintillaWin::hInstance = 0;
@@ -317,11 +328,11 @@
hrOle = E_FAIL;
wMain = hwnd;
-
+#ifndef DISABLE_DRAG_DROP
dob.sci = this;
ds.sci = this;
dt.sci = this;
-
+#endif
sysCaretBitmap = 0;
sysCaretWidth = 0;
sysCaretHeight = 0;
@@ -362,6 +373,7 @@
}
void ScintillaWin::StartDrag() {
+#ifndef DISABLE_DRAG_DROP
inDragDrop = ddDragging;
DWORD dwEffect = 0;
dropWentOutside = true;
@@ -381,6 +393,7 @@
}
inDragDrop = ddNone;
SetDragPosition(SelectionPosition(invalidPosition));
+#endif
}
// Avoid warnings everywhere for old style casts by concentrating them here
@@ -598,7 +611,9 @@
ctrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(wMain.GetID()));
// Get Intellimouse scroll line parameters
GetIntelliMouseParameters();
+#ifndef DISABLE_DRAG_DROP
::RegisterDragDrop(MainHWND(), reinterpret_cast<IDropTarget *>(&dt));
+#endif
break;
case WM_COMMAND:
@@ -675,6 +690,7 @@
case WM_TIMER:
if (wParam == standardTimerID && timer.ticking) {
Tick();
+ DragScroll();
} else if (wParam == idleTimerID && idler.state) {
SendMessage(MainHWND(), SC_WIN_IDLE, 0, 1);
} else {
@@ -726,7 +742,11 @@
// Platform::IsKeyDown(VK_SHIFT),
// Platform::IsKeyDown(VK_CONTROL),
// Platform::IsKeyDown(VK_MENU));
+#if 0
+/* when embeding in mozilla, this causes a focus on the main mozilla window
+ this is generaly bad because we do a lot of stuff there, see komodo.xul onfocus */
::SetFocus(MainHWND());
+#endif
ButtonDown(Point::FromLong(lParam), ::GetMessageTime(),
(wParam & MK_SHIFT) != 0,
(wParam & MK_CONTROL) != 0,
@@ -1125,6 +1145,41 @@
return contains;
}
+void ScintillaWin::DragScroll() {
+#define RESET_SCROLL_TIMER(lines) \
+ scrollSpeed = (lines); \
+ scrollTicks = 2000;
+
+ if (!posDrag.IsValid()) {
+ RESET_SCROLL_TIMER(1);
+ return;
+ }
+ int posDragPosition = posDrag.Position();
+ Point dragMouse = LocationFromPosition(posDragPosition);
+ int line = pdoc->LineFromPosition(posDragPosition);
+ int currentVisibleLine = cs.DisplayFromDoc(line);
+ int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen() - 1, pdoc->LinesTotal() - 1);
+
+ if (currentVisibleLine <= topLine && topLine > 0) {
+ ScrollTo( topLine - scrollSpeed );
+ } else if (currentVisibleLine >= lastVisibleLine) {
+ ScrollTo( topLine + scrollSpeed );
+ } else {
+ RESET_SCROLL_TIMER(1);
+ return;
+ }
+ if (scrollSpeed == 1) {
+ scrollTicks -= timer.tickSize;
+ if (scrollTicks <= 0) {
+ RESET_SCROLL_TIMER(5);
+ }
+ }
+
+ SetDragPosition(SelectionPosition(PositionFromLocation(dragMouse)));
+
+#undef RESET_SCROLL_TIMER
+}
+
void ScintillaWin::ScrollText(int linesToMove) {
//Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove);
::ScrollWindow(MainHWND(), 0,
@@ -1326,7 +1381,7 @@
void ScintillaWin::InsertPasteText(const char *text, int len, SelectionPosition selStart, bool isRectangular, bool isLine) {
if (isRectangular) {
- PasteRectangular(selStart, text, len);
+ PasteRectangular(selStart.Position(), text, len);
} else {
char *convertedText = 0;
if (convertPastes) {
@@ -1345,8 +1400,16 @@
}
if (sel.MainCaret() == insertPos) {
SetEmptySelection(sel.MainCaret() + len);
+ // XXX ActiveState bug 33804
+ if (ac.Active()) {
+ AutoCompleteMoveToCurrentWord();
+ }
}
} else {
InsertPaste(selStart, text, len);
+ // XXX ActiveState bug 33804
+ if (ac.Active()) {
+ AutoCompleteMoveToCurrentWord();
+ }
}
delete []convertedText;
@@ -1498,6 +1561,7 @@
// Windows does not have a primary selection
}
+#ifndef DISABLE_DRAG_DROP
/// Implement IUnknown
STDMETHODIMP_(ULONG)FormatEnumerator_AddRef(FormatEnumerator *fe);
@@ -1805,6 +1869,7 @@
vtbl = vtDropTarget;
sci = 0;
}
+#endif
/**
* DBCS: support Input Method Editor (IME).
@@ -2003,6 +2068,15 @@
break;
case SB_LINEDOWN: // May move past the logical end
xPos += 20;
+ // ACTIVESTATE
+ if (xPos > scrollWidth - rcText.Width()) {
+ // we are at the end according to the scroll bar. We'll
+ // go faster since this is not really a 'scroll left by a bit'
+ // request but more a 'grow my scrollbar' request
+ xPos += 20;
+ scrollWidth = xPos + rcText.Width();
+ SetScrollBars();
+ }
break;
case SB_PAGEUP:
xPos -= pageWidth;
@@ -2105,6 +2179,7 @@
return dwEffect;
}
+#ifndef DISABLE_DRAG_DROP
/// Implement IUnknown
STDMETHODIMP ScintillaWin::QueryInterface(REFIID riid, PVOID *ppv) {
*ppv = NULL;
@@ -2299,12 +2374,13 @@
pSTM->pUnkForRelease = 0;
return S_OK;
}
+#endif
bool ScintillaWin::Register(HINSTANCE hInstance_) {
hInstance = hInstance_;
bool result;
-
+#if 0
// Register the Scintilla class
if (IsNT()) {
@@ -2324,7 +2400,7 @@
wndclass.hIconSm = 0;
result = ::RegisterClassExW(&wndclass) != 0;
} else {
-
+#endif
// Register Scintilla as a normal character window
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof(wndclass);
@@ -2340,7 +2416,7 @@
wndclass.lpszClassName = scintillaClassName;
wndclass.hIconSm = 0;
result = ::RegisterClassEx(&wndclass) != 0;
- }
+ //}
if (result) {
// Register the CallTip class
diff -r -du win32/scintilla.mak win32/scintilla.mak
--- win32/scintilla.mak 2005-05-27 04:29:46.000000000 -0700
+++ win32/scintilla.mak 2007-05-01 17:00:17.000000000 -0700
@@ -31,9 +31,9 @@
LEXCOMPONENT=$(DIR_BIN)\SciLexer.dll
LEXLIB=Lexers.lib
-CC=cl
+CC=cl /nologo
RC=rc
-LD=link
+LD=link /nologo
CXXFLAGS=-Zi -TP -W4 -EHsc -Zc:forScope -Zc:wchar_t -D_CRT_SECURE_NO_DEPRECATE=1
# For something scary:-Wp64
@@ -176,15 +176,18 @@
$(DIR_O)\LexSpice.obj \
$(DIR_O)\LexSQL.obj \
$(DIR_O)\LexTACL.obj \
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTAL.obj \
- $(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexTxt2tags.obj \
$(DIR_O)\LexVB.obj \
$(DIR_O)\LexVerilog.obj \
$(DIR_O)\LexVHDL.obj \
$(DIR_O)\LexYAML.obj \
+ $(DIR_O)\LexTcl.obj \
+ $(DIR_O)\LexUDL.obj \
+ $(DIR_O)\LexXSLT.obj \
+ $(DIR_O)\LexCoffeeScript.obj \
#--Autogenerated -- end of automatically generated section
@@ -253,6 +255,14 @@
$(DIR_O)\ScintillaWinS.obj: ScintillaWin.cxx
$(CC) $(CXXFLAGS) -DSTATIC_BUILD -c $(NAME)$@ ScintillaWin.cxx
+# Generate header files from Scintilla.iface
+..\include\Scintilla_gen.h: ..\include\HFacer.py ..\include\Face.py ..\include\Scintilla.iface
+ cd ..\include && python HFacer.py
+..\include\SciLexer_gen.h: ..\include\HFacer.py ..\include\Face.py ..\include\Scintilla.iface
+ cd ..\include && python HFacer.py
+..\include\Scintilla.h: ..\include\Scintilla_gen.h
+..\include\SciLexer.h: ..\include\SciLexer_gen.h
+
# Dependencies
# All lexers depend on this set of headers
@@ -431,8 +441,6 @@
$(DIR_O)\LexTAL.obj: ..\lexers\LexTAL.cxx $(LEX_HEADERS)
-$(DIR_O)\LexTCL.obj: ..\lexers\LexTCL.cxx $(LEX_HEADERS)
-
$(DIR_O)\LexTeX.obj: ..\lexers\LexTeX.cxx $(LEX_HEADERS)
$(DIR_O)\LexTxt2tags.obj: ..\lexers\LexTxt2tags.cxx $(LEX_HEADERS)
@@ -443,6 +451,15 @@
$(DIR_O)\LexYAML.obj: ..\lexers\LexYAML.cxx $(LEX_HEADERS)
+$(DIR_O)\LexTcl.obj: ..\lexers\LexTcl.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexUDL.obj: ..\lexers\LexUDL.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexXSLT.obj: ..\lexers\LexXSLT.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexCoffeeScript.obj: ..\lexers\LexCoffeeScript.cxx $(LEX_HEADERS)
+
+
#--Autogenerated -- end of automatically generated section
diff -r -du win32/scintilla_vc6.mak win32/scintilla_vc6.mak
--- win32/scintilla_vc6.mak 2005-05-27 04:29:46.000000000 -0700
+++ win32/scintilla_vc6.mak 2007-05-01 17:00:17.000000000 -0700
@@ -44,7 +44,7 @@
# If you have problems with lexers being linked, try removing -OPT:REF and replacing with -OPT:NOREF
LDFLAGS=-OPT:NOWIN98 -OPT:REF
LDDEBUG=
-LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB
+LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB libpcre.lib
NOLOGO=-nologo
!IFDEF QUIET
@@ -189,13 +189,16 @@
$(DIR_O)\LexTACL.obj \
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTAL.obj \
- $(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexTxt2tags.obj \
$(DIR_O)\LexVB.obj \
$(DIR_O)\LexVerilog.obj \
$(DIR_O)\LexVHDL.obj \
$(DIR_O)\LexYAML.obj \
+ $(DIR_O)\LexTcl.obj \
+ $(DIR_O)\LexUDL.obj \
+ $(DIR_O)\LexXSLT.obj \
+ $(DIR_O)\LexCoffeeScript.obj \
#--Autogenerated -- end of automatically generated section
@@ -268,6 +270,14 @@
$(DIR_O)\ScintillaWinS.obj: ScintillaWin.cxx
$(CC) $(CXXFLAGS) -DSTATIC_BUILD -c $(NAME)$@ ScintillaWin.cxx
+# Generate header files from Scintilla.iface
+..\include\Scintilla_gen.h: ..\include\HFacer.py ..\include\Face.py ..\include\Scintilla.iface
+ cd ..\include && python HFacer.py
+..\include\SciLexer_gen.h: ..\include\HFacer.py ..\include\Face.py ..\include\Scintilla.iface
+ cd ..\include && python HFacer.py
+..\include\Scintilla.h: ..\include\Scintilla_gen.h
+..\include\SciLexer.h: ..\include\SciLexer_gen.h
+
# Dependencies
# All lexers depend on this set of headers
@@ -464,8 +474,6 @@
$(DIR_O)\LexTAL.obj: ..\lexers\LexTAL.cxx $(LEX_HEADERS)
-$(DIR_O)\LexTCL.obj: ..\lexers\LexTCL.cxx $(LEX_HEADERS)
-
$(DIR_O)\LexTeX.obj: ..\lexers\LexTeX.cxx $(LEX_HEADERS)
$(DIR_O)\LexTxt2tags.obj: ..\lexers\LexTxt2tags.cxx $(LEX_HEADERS)
@@ -475,6 +483,14 @@
$(DIR_O)\LexYAML.obj: ..\lexers\LexYAML.cxx $(LEX_HEADERS)
+$(DIR_O)\LexTcl.obj: ..\lexers\LexTcl.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexUDL.obj: ..\lexers\LexUDL.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexXSLT.obj: ..\lexers\LexXSLT.cxx $(LEX_HEADERS)
+
+$(DIR_O)\LexCoffeeScript.obj: ..\lexers\LexCoffeeScript.cxx $(LEX_HEADERS)
+
#--Autogenerated -- end of automatically generated section