forked from bruderstein/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScintillaWrapperGenerated.cpp
More file actions
6940 lines (6125 loc) · 212 KB
/
ScintillaWrapperGenerated.cpp
File metadata and controls
6940 lines (6125 loc) · 212 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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "stdafx.h"
#include "ScintillaWrapper.h"
#include "Scintilla.h"
#include "GILManager.h"
namespace NppPythonScript
{
// Helper class
class PythonCompatibleStrBuffer
{
public:
inline explicit PythonCompatibleStrBuffer(size_t length) :
m_bufferLen(length + 1),
m_bufferPtr(new char[m_bufferLen])
{
if (m_bufferPtr && m_bufferLen > 0) m_bufferPtr[m_bufferLen-1] = '\0';
}
inline explicit PythonCompatibleStrBuffer(int length) :
m_bufferLen(length >= 0 ? (size_t)(length+1) : 0),
m_bufferPtr(new char[m_bufferLen])
{
if (m_bufferPtr && m_bufferLen > 0) m_bufferPtr[m_bufferLen-1] = '\0';
}
inline explicit PythonCompatibleStrBuffer(LRESULT length) :
m_bufferLen(length >= 0 ? (size_t)(length+1) : 0),
m_bufferPtr(new char[m_bufferLen])
{
if (m_bufferPtr && m_bufferLen > 0) m_bufferPtr[m_bufferLen-1] = '\0';
}
inline ~PythonCompatibleStrBuffer() { delete [] m_bufferPtr; }
inline char* operator*() { return m_bufferPtr; }
inline const char* c_str() const { return m_bufferPtr; }
inline size_t size() const { return m_bufferLen; }
private:
PythonCompatibleStrBuffer() = delete; // default constructor disabled
PythonCompatibleStrBuffer(const PythonCompatibleStrBuffer&) = delete; // copy constructor disabled
PythonCompatibleStrBuffer& operator = (const PythonCompatibleStrBuffer&) = delete; // Disable assignment operator disabled
size_t m_bufferLen;
char* m_bufferPtr;
};
/** Add text to the document at current position.
*/
intptr_t ScintillaWrapper::AddText(boost::python::object text)
{
DEBUG_TRACE(L"ScintillaWrapper::AddText\n");
std::string s = getStringFromObject(text);
return callScintilla(SCI_ADDTEXT, s.size(), reinterpret_cast<LPARAM>(s.c_str()));
}
/** Add array of cells to document.
*/
intptr_t ScintillaWrapper::AddStyledText(ScintillaCells c)
{
DEBUG_TRACE(L"ScintillaWrapper::AddStyledText\n");
return callScintilla(SCI_ADDSTYLEDTEXT, c.length(), reinterpret_cast<LPARAM>(c.cells()));
}
/** Insert string at a position.
*/
void ScintillaWrapper::InsertText(Sci_Position pos, boost::python::object text)
{
DEBUG_TRACE(L"ScintillaWrapper::InsertText\n");
std::string stringtext = getStringFromObject(text);
callScintilla(SCI_INSERTTEXT, pos, reinterpret_cast<LPARAM>(stringtext.c_str()));
}
/** Change the text that is being inserted in response to SC_MOD_INSERTCHECK
*/
intptr_t ScintillaWrapper::ChangeInsertion(boost::python::object text)
{
DEBUG_TRACE(L"ScintillaWrapper::ChangeInsertion\n");
std::string s = getStringFromObject(text);
return callScintilla(SCI_CHANGEINSERTION, s.size(), reinterpret_cast<LPARAM>(s.c_str()));
}
/** Delete all text in the document.
*/
void ScintillaWrapper::ClearAll()
{
DEBUG_TRACE(L"ScintillaWrapper::ClearAll\n");
callScintilla(SCI_CLEARALL);
}
/** Delete a range of text in the document.
*/
void ScintillaWrapper::DeleteRange(Sci_Position start, Sci_Position lengthDelete)
{
DEBUG_TRACE(L"ScintillaWrapper::DeleteRange\n");
callScintilla(SCI_DELETERANGE, start, lengthDelete);
}
/** Set all style bytes to 0, remove all folding information.
*/
void ScintillaWrapper::ClearDocumentStyle()
{
DEBUG_TRACE(L"ScintillaWrapper::ClearDocumentStyle\n");
callScintilla(SCI_CLEARDOCUMENTSTYLE);
}
/** Returns the number of bytes in the document.
*/
intptr_t ScintillaWrapper::GetLength()
{
DEBUG_TRACE(L"ScintillaWrapper::GetLength\n");
return callScintilla(SCI_GETLENGTH);
}
/** Returns the character byte at the position.
*/
intptr_t ScintillaWrapper::GetCharAt(Sci_Position pos)
{
DEBUG_TRACE(L"ScintillaWrapper::GetCharAt\n");
return callScintilla(SCI_GETCHARAT, pos);
}
/** Returns the position of the caret.
*/
intptr_t ScintillaWrapper::GetCurrentPos()
{
DEBUG_TRACE(L"ScintillaWrapper::GetCurrentPos\n");
return callScintilla(SCI_GETCURRENTPOS);
}
/** Returns the position of the opposite end of the selection to the caret.
*/
intptr_t ScintillaWrapper::GetAnchor()
{
DEBUG_TRACE(L"ScintillaWrapper::GetAnchor\n");
return callScintilla(SCI_GETANCHOR);
}
/** Returns the style byte at the position.
*/
intptr_t ScintillaWrapper::GetStyleAt(Sci_Position pos)
{
DEBUG_TRACE(L"ScintillaWrapper::GetStyleAt\n");
return callScintilla(SCI_GETSTYLEAT, pos);
}
/** Returns the unsigned style byte at the position.
*/
intptr_t ScintillaWrapper::GetStyleIndexAt(Sci_Position pos)
{
DEBUG_TRACE(L"ScintillaWrapper::GetStyleIndexAt\n");
return callScintilla(SCI_GETSTYLEINDEXAT, pos);
}
/** Redoes the next action on the undo history.
*/
void ScintillaWrapper::Redo()
{
DEBUG_TRACE(L"ScintillaWrapper::Redo\n");
callScintilla(SCI_REDO);
}
/** Choose between collecting actions into the undo
* history and discarding them.
*/
void ScintillaWrapper::SetUndoCollection(bool collectUndo)
{
DEBUG_TRACE(L"ScintillaWrapper::SetUndoCollection\n");
callScintilla(SCI_SETUNDOCOLLECTION, collectUndo);
}
/** Select all the text in the document.
*/
void ScintillaWrapper::SelectAll()
{
DEBUG_TRACE(L"ScintillaWrapper::SelectAll\n");
callScintilla(SCI_SELECTALL);
}
/** Remember the current position in the undo history as the position
* at which the document was saved.
*/
void ScintillaWrapper::SetSavePoint()
{
DEBUG_TRACE(L"ScintillaWrapper::SetSavePoint\n");
callScintilla(SCI_SETSAVEPOINT);
}
/** Retrieve a buffer of cells that can be past 2GB.
* Returns the number of bytes in the buffer not including terminating NULs.
*/
boost::python::tuple ScintillaWrapper::GetStyledTextFull(Sci_Position start, Sci_Position end)
{
DEBUG_TRACE(L"ScintillaWrapper::GetStyledTextFull\n");
Sci_TextRangeFull src{};
if (end < start)
{
Sci_Position temp = start;
start = end;
end = temp;
}
src.chrg.cpMin = start;
src.chrg.cpMax = end;
src.lpstrText = new char[size_t(((end-start) * 2) + 2)];
callScintilla(SCI_GETSTYLEDTEXTFULL, 0, reinterpret_cast<LPARAM>(&src));
boost::python::list styles;
PythonCompatibleStrBuffer result(end-start);
for(idx_t pos = 0; pos < result.size() - 1; pos++)
{
(*result)[pos] = src.lpstrText[pos * 2];
styles.append((int)(src.lpstrText[(pos * 2) + 1]));
}
boost::python::str resultStr(result.c_str());
delete [] src.lpstrText;
return boost::python::make_tuple(resultStr, styles);
}
/** Are there any redoable actions in the undo history?
*/
bool ScintillaWrapper::CanRedo()
{
DEBUG_TRACE(L"ScintillaWrapper::CanRedo\n");
return 0 != (callScintilla(SCI_CANREDO));
}
/** Retrieve the line number at which a particular marker is located.
*/
intptr_t ScintillaWrapper::MarkerLineFromHandle(int markerHandle)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerLineFromHandle\n");
return callScintilla(SCI_MARKERLINEFROMHANDLE, markerHandle);
}
/** Delete a marker.
*/
void ScintillaWrapper::MarkerDeleteHandle(int markerHandle)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerDeleteHandle\n");
callScintilla(SCI_MARKERDELETEHANDLE, markerHandle);
}
/** Retrieve marker handles of a line
*/
intptr_t ScintillaWrapper::MarkerHandleFromLine(intptr_t line, int which)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerHandleFromLine\n");
return callScintilla(SCI_MARKERHANDLEFROMLINE, line, which);
}
/** Retrieve marker number of a marker handle
*/
intptr_t ScintillaWrapper::MarkerNumberFromLine(intptr_t line, int which)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerNumberFromLine\n");
return callScintilla(SCI_MARKERNUMBERFROMLINE, line, which);
}
/** Is undo history being collected?
*/
bool ScintillaWrapper::GetUndoCollection()
{
DEBUG_TRACE(L"ScintillaWrapper::GetUndoCollection\n");
return 0 != (callScintilla(SCI_GETUNDOCOLLECTION));
}
/** Are white space characters currently visible?
* Returns one of SCWS_* constants.
*/
int ScintillaWrapper::GetViewWS()
{
DEBUG_TRACE(L"ScintillaWrapper::GetViewWS\n");
return callScintilla(SCI_GETVIEWWS);
}
/** Make white space characters invisible, always visible or visible outside indentation.
*/
void ScintillaWrapper::SetViewWS(int viewWS)
{
DEBUG_TRACE(L"ScintillaWrapper::SetViewWS\n");
callScintilla(SCI_SETVIEWWS, viewWS);
}
/** Retrieve the current tab draw mode.
* Returns one of SCTD_* constants.
*/
int ScintillaWrapper::GetTabDrawMode()
{
DEBUG_TRACE(L"ScintillaWrapper::GetTabDrawMode\n");
return callScintilla(SCI_GETTABDRAWMODE);
}
/** Set how tabs are drawn when visible.
*/
void ScintillaWrapper::SetTabDrawMode(int tabDrawMode)
{
DEBUG_TRACE(L"ScintillaWrapper::SetTabDrawMode\n");
callScintilla(SCI_SETTABDRAWMODE, tabDrawMode);
}
/** Find the position from a point within the window.
*/
intptr_t ScintillaWrapper::PositionFromPoint(int x, int y)
{
DEBUG_TRACE(L"ScintillaWrapper::PositionFromPoint\n");
return callScintilla(SCI_POSITIONFROMPOINT, x, y);
}
/** Find the position from a point within the window but return
* INVALID_POSITION if not close to text.
*/
intptr_t ScintillaWrapper::PositionFromPointClose(int x, int y)
{
DEBUG_TRACE(L"ScintillaWrapper::PositionFromPointClose\n");
return callScintilla(SCI_POSITIONFROMPOINTCLOSE, x, y);
}
/** Set caret to start of a line and ensure it is visible.
*/
void ScintillaWrapper::GotoLine(intptr_t line)
{
DEBUG_TRACE(L"ScintillaWrapper::GotoLine\n");
callScintilla(SCI_GOTOLINE, line);
}
/** Set caret to a position and ensure it is visible.
*/
void ScintillaWrapper::GotoPos(Sci_Position caret)
{
DEBUG_TRACE(L"ScintillaWrapper::GotoPos\n");
callScintilla(SCI_GOTOPOS, caret);
}
/** Set the selection anchor to a position. The anchor is the opposite
* end of the selection from the caret.
*/
void ScintillaWrapper::SetAnchor(Sci_Position anchor)
{
DEBUG_TRACE(L"ScintillaWrapper::SetAnchor\n");
callScintilla(SCI_SETANCHOR, anchor);
}
/** Retrieve the text of the line containing the caret.
* Returns the index of the caret on the line.
* Result is NUL-terminated.
*/
boost::python::str ScintillaWrapper::GetCurLine()
{
DEBUG_TRACE(L"ScintillaWrapper::GetCurLine\n");
PythonCompatibleStrBuffer result(callScintilla(SCI_GETCURLINE) + 1);
// result.size() does not depend on the order of evaluation here
//lint -e{864}
callScintilla(SCI_GETCURLINE, result.size(), reinterpret_cast<LPARAM>(*result));
return boost::python::str(result.c_str());
}
/** Retrieve the position of the last correctly styled character.
*/
intptr_t ScintillaWrapper::GetEndStyled()
{
DEBUG_TRACE(L"ScintillaWrapper::GetEndStyled\n");
return callScintilla(SCI_GETENDSTYLED);
}
/** Convert all line endings in the document to one mode.
*/
void ScintillaWrapper::ConvertEOLs(int eolMode)
{
DEBUG_TRACE(L"ScintillaWrapper::ConvertEOLs\n");
callScintilla(SCI_CONVERTEOLS, eolMode);
}
/** Retrieve the current end of line mode - one of CRLF, CR, or LF.
*/
int ScintillaWrapper::GetEOLMode()
{
DEBUG_TRACE(L"ScintillaWrapper::GetEOLMode\n");
return callScintilla(SCI_GETEOLMODE);
}
/** Set the current end of line mode.
*/
void ScintillaWrapper::SetEOLMode(int eolMode)
{
DEBUG_TRACE(L"ScintillaWrapper::SetEOLMode\n");
callScintilla(SCI_SETEOLMODE, eolMode);
}
/** Set the current styling position to start.
* The unused parameter is no longer used and should be set to 0.
*/
void ScintillaWrapper::StartStyling(Sci_Position start, int unused)
{
DEBUG_TRACE(L"ScintillaWrapper::StartStyling\n");
callScintilla(SCI_STARTSTYLING, start, unused);
}
/** Change style from current styling position for length characters to a style
* and move the current styling position to after this newly styled segment.
*/
void ScintillaWrapper::SetStyling(Sci_Position length, int style)
{
DEBUG_TRACE(L"ScintillaWrapper::SetStyling\n");
callScintilla(SCI_SETSTYLING, length, style);
}
/** Is drawing done first into a buffer or direct to the screen?
*/
bool ScintillaWrapper::GetBufferedDraw()
{
DEBUG_TRACE(L"ScintillaWrapper::GetBufferedDraw\n");
return 0 != (callScintilla(SCI_GETBUFFEREDDRAW));
}
/** If drawing is buffered then each line of text is drawn into a bitmap buffer
* before drawing it to the screen to avoid flicker.
*/
void ScintillaWrapper::SetBufferedDraw(bool buffered)
{
DEBUG_TRACE(L"ScintillaWrapper::SetBufferedDraw\n");
callScintilla(SCI_SETBUFFEREDDRAW, buffered);
}
/** Change the visible size of a tab to be a multiple of the width of a space character.
*/
void ScintillaWrapper::SetTabWidth(int tabWidth)
{
DEBUG_TRACE(L"ScintillaWrapper::SetTabWidth\n");
callScintilla(SCI_SETTABWIDTH, tabWidth);
}
/** Retrieve the visible size of a tab.
*/
intptr_t ScintillaWrapper::GetTabWidth()
{
DEBUG_TRACE(L"ScintillaWrapper::GetTabWidth\n");
return callScintilla(SCI_GETTABWIDTH);
}
/** Set the minimum visual width of a tab.
*/
void ScintillaWrapper::SetTabMinimumWidth(int pixels)
{
DEBUG_TRACE(L"ScintillaWrapper::SetTabMinimumWidth\n");
callScintilla(SCI_SETTABMINIMUMWIDTH, pixels);
}
/** Get the minimum visual width of a tab.
*/
intptr_t ScintillaWrapper::GetTabMinimumWidth()
{
DEBUG_TRACE(L"ScintillaWrapper::GetTabMinimumWidth\n");
return callScintilla(SCI_GETTABMINIMUMWIDTH);
}
/** Clear explicit tabstops on a line.
*/
void ScintillaWrapper::ClearTabStops(intptr_t line)
{
DEBUG_TRACE(L"ScintillaWrapper::ClearTabStops\n");
callScintilla(SCI_CLEARTABSTOPS, line);
}
/** Add an explicit tab stop for a line.
*/
void ScintillaWrapper::AddTabStop(intptr_t line, int x)
{
DEBUG_TRACE(L"ScintillaWrapper::AddTabStop\n");
callScintilla(SCI_ADDTABSTOP, line, x);
}
/** Find the next explicit tab stop position on a line after a position.
*/
intptr_t ScintillaWrapper::GetNextTabStop(intptr_t line, int x)
{
DEBUG_TRACE(L"ScintillaWrapper::GetNextTabStop\n");
return callScintilla(SCI_GETNEXTTABSTOP, line, x);
}
/** Set the code page used to interpret the bytes of the document as characters.
* The SC_CP_UTF8 value can be used to enter Unicode mode.
*/
void ScintillaWrapper::SetCodePage(int codePage)
{
DEBUG_TRACE(L"ScintillaWrapper::SetCodePage\n");
callScintilla(SCI_SETCODEPAGE, codePage);
}
/** Set the locale for displaying text.
*/
void ScintillaWrapper::SetFontLocale(boost::python::object localeName)
{
DEBUG_TRACE(L"ScintillaWrapper::SetFontLocale\n");
std::string stringlocaleName = getStringFromObject(localeName);
callScintilla(SCI_SETFONTLOCALE, 0, reinterpret_cast<LPARAM>(stringlocaleName.c_str()));
}
/** Get the locale for displaying text.
*/
boost::python::str ScintillaWrapper::GetFontLocale()
{
DEBUG_TRACE(L"ScintillaWrapper::GetFontLocale\n");
PythonCompatibleStrBuffer result(callScintilla(SCI_GETFONTLOCALE));
callScintilla(SCI_GETFONTLOCALE, 0, reinterpret_cast<LPARAM>(*result));
return boost::python::str(result.c_str());
}
/** Is the IME displayed in a window or inline?
*/
int ScintillaWrapper::GetIMEInteraction()
{
DEBUG_TRACE(L"ScintillaWrapper::GetIMEInteraction\n");
return callScintilla(SCI_GETIMEINTERACTION);
}
/** Choose to display the IME in a window or inline.
*/
void ScintillaWrapper::SetIMEInteraction(int imeInteraction)
{
DEBUG_TRACE(L"ScintillaWrapper::SetIMEInteraction\n");
callScintilla(SCI_SETIMEINTERACTION, imeInteraction);
}
/** Set the symbol used for a particular marker number.
*/
void ScintillaWrapper::MarkerDefine(int markerNumber, int markerSymbol)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerDefine\n");
callScintilla(SCI_MARKERDEFINE, markerNumber, markerSymbol);
}
/** Set the foreground colour used for a particular marker number.
*/
void ScintillaWrapper::MarkerSetFore(int markerNumber, boost::python::tuple fore)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetFore\n");
COLORREF rgbfore = MAKECOLOUR(fore);
callScintilla(SCI_MARKERSETFORE, markerNumber, static_cast<LPARAM>(rgbfore));
}
/** Set the background colour used for a particular marker number.
*/
void ScintillaWrapper::MarkerSetBack(int markerNumber, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetBack\n");
COLORREF rgbback = MAKECOLOUR(back);
callScintilla(SCI_MARKERSETBACK, markerNumber, static_cast<LPARAM>(rgbback));
}
/** Set the background colour used for a particular marker number when its folding block is selected.
*/
void ScintillaWrapper::MarkerSetBackSelected(int markerNumber, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetBackSelected\n");
COLORREF rgbback = MAKECOLOUR(back);
callScintilla(SCI_MARKERSETBACKSELECTED, markerNumber, static_cast<LPARAM>(rgbback));
}
/** Set the foreground colour used for a particular marker number.
*/
void ScintillaWrapper::MarkerSetForeTranslucent(int markerNumber, boost::python::tuple fore)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetForeTranslucent\n");
COLORREF rgbafore = MAKEALPHACOLOUR(fore);
callScintilla(SCI_MARKERSETFORETRANSLUCENT, markerNumber, static_cast<LPARAM>(rgbafore));
}
/** Set the background colour used for a particular marker number.
*/
void ScintillaWrapper::MarkerSetBackTranslucent(int markerNumber, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetBackTranslucent\n");
COLORREF rgbaback = MAKEALPHACOLOUR(back);
callScintilla(SCI_MARKERSETBACKTRANSLUCENT, markerNumber, static_cast<LPARAM>(rgbaback));
}
/** Set the background colour used for a particular marker number when its folding block is selected.
*/
void ScintillaWrapper::MarkerSetBackSelectedTranslucent(int markerNumber, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetBackSelectedTranslucent\n");
COLORREF rgbaback = MAKEALPHACOLOUR(back);
callScintilla(SCI_MARKERSETBACKSELECTEDTRANSLUCENT, markerNumber, static_cast<LPARAM>(rgbaback));
}
/** Set the width of strokes used in .01 pixels so 50 = 1/2 pixel width.
*/
void ScintillaWrapper::MarkerSetStrokeWidth(int markerNumber, int hundredths)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetStrokeWidth\n");
callScintilla(SCI_MARKERSETSTROKEWIDTH, markerNumber, hundredths);
}
/** Enable/disable highlight for current folding block (smallest one that contains the caret)
*/
void ScintillaWrapper::MarkerEnableHighlight(bool enabled)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerEnableHighlight\n");
callScintilla(SCI_MARKERENABLEHIGHLIGHT, enabled);
}
/** Add a marker to a line, returning an ID which can be used to find or delete the marker.
*/
intptr_t ScintillaWrapper::MarkerAdd(intptr_t line, int markerNumber)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerAdd\n");
return callScintilla(SCI_MARKERADD, line, markerNumber);
}
/** Delete a marker from a line.
*/
void ScintillaWrapper::MarkerDelete(intptr_t line, int markerNumber)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerDelete\n");
callScintilla(SCI_MARKERDELETE, line, markerNumber);
}
/** Delete all markers with a particular number from all lines.
*/
void ScintillaWrapper::MarkerDeleteAll(int markerNumber)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerDeleteAll\n");
callScintilla(SCI_MARKERDELETEALL, markerNumber);
}
/** Get a bit mask of all the markers set on a line.
*/
intptr_t ScintillaWrapper::MarkerGet(intptr_t line)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerGet\n");
return callScintilla(SCI_MARKERGET, line);
}
/** Find the next line at or after lineStart that includes a marker in mask.
* Return -1 when no more lines.
*/
intptr_t ScintillaWrapper::MarkerNext(intptr_t lineStart, int markerMask)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerNext\n");
return callScintilla(SCI_MARKERNEXT, lineStart, markerMask);
}
/** Find the previous line before lineStart that includes a marker in mask.
*/
intptr_t ScintillaWrapper::MarkerPrevious(intptr_t lineStart, int markerMask)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerPrevious\n");
return callScintilla(SCI_MARKERPREVIOUS, lineStart, markerMask);
}
/** Define a marker from a pixmap.
*/
void ScintillaWrapper::MarkerDefinePixmap(int markerNumber, boost::python::object pixmap)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerDefinePixmap\n");
std::string stringpixmap = getStringFromObject(pixmap);
callScintilla(SCI_MARKERDEFINEPIXMAP, markerNumber, reinterpret_cast<LPARAM>(stringpixmap.c_str()));
}
/** Add a set of markers to a line.
*/
void ScintillaWrapper::MarkerAddSet(intptr_t line, int markerSet)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerAddSet\n");
callScintilla(SCI_MARKERADDSET, line, markerSet);
}
/** Set the alpha used for a marker that is drawn in the text area, not the margin.
*/
void ScintillaWrapper::MarkerSetAlpha(int markerNumber, int alpha)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetAlpha\n");
callScintilla(SCI_MARKERSETALPHA, markerNumber, alpha);
}
/** Get the layer used for a marker that is drawn in the text area, not the margin.
*/
int ScintillaWrapper::MarkerGetLayer(int markerNumber)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerGetLayer\n");
return callScintilla(SCI_MARKERGETLAYER, markerNumber);
}
/** Set the layer used for a marker that is drawn in the text area, not the margin.
*/
void ScintillaWrapper::MarkerSetLayer(int markerNumber, int layer)
{
DEBUG_TRACE(L"ScintillaWrapper::MarkerSetLayer\n");
callScintilla(SCI_MARKERSETLAYER, markerNumber, layer);
}
/** Set a margin to be either numeric or symbolic.
*/
void ScintillaWrapper::SetMarginTypeN(int margin, int marginType)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginTypeN\n");
callScintilla(SCI_SETMARGINTYPEN, margin, marginType);
}
/** Retrieve the type of a margin.
*/
int ScintillaWrapper::GetMarginTypeN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginTypeN\n");
return callScintilla(SCI_GETMARGINTYPEN, margin);
}
/** Set the width of a margin to a width expressed in pixels.
*/
void ScintillaWrapper::SetMarginWidthN(int margin, int pixelWidth)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginWidthN\n");
callScintilla(SCI_SETMARGINWIDTHN, margin, pixelWidth);
}
/** Retrieve the width of a margin in pixels.
*/
intptr_t ScintillaWrapper::GetMarginWidthN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginWidthN\n");
return callScintilla(SCI_GETMARGINWIDTHN, margin);
}
/** Set a mask that determines which markers are displayed in a margin.
*/
void ScintillaWrapper::SetMarginMaskN(int margin, int mask)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginMaskN\n");
callScintilla(SCI_SETMARGINMASKN, margin, mask);
}
/** Retrieve the marker mask of a margin.
*/
intptr_t ScintillaWrapper::GetMarginMaskN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginMaskN\n");
return callScintilla(SCI_GETMARGINMASKN, margin);
}
/** Make a margin sensitive or insensitive to mouse clicks.
*/
void ScintillaWrapper::SetMarginSensitiveN(int margin, bool sensitive)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginSensitiveN\n");
callScintilla(SCI_SETMARGINSENSITIVEN, margin, sensitive);
}
/** Retrieve the mouse click sensitivity of a margin.
*/
bool ScintillaWrapper::GetMarginSensitiveN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginSensitiveN\n");
return 0 != (callScintilla(SCI_GETMARGINSENSITIVEN, margin));
}
/** Set the cursor shown when the mouse is inside a margin.
*/
void ScintillaWrapper::SetMarginCursorN(int margin, int cursor)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginCursorN\n");
callScintilla(SCI_SETMARGINCURSORN, margin, cursor);
}
/** Retrieve the cursor shown in a margin.
*/
int ScintillaWrapper::GetMarginCursorN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginCursorN\n");
return callScintilla(SCI_GETMARGINCURSORN, margin);
}
/** Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR.
*/
void ScintillaWrapper::SetMarginBackN(int margin, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMarginBackN\n");
COLORREF rgbback = MAKECOLOUR(back);
callScintilla(SCI_SETMARGINBACKN, margin, static_cast<LPARAM>(rgbback));
}
/** Retrieve the background colour of a margin
*/
boost::python::tuple ScintillaWrapper::GetMarginBackN(int margin)
{
DEBUG_TRACE(L"ScintillaWrapper::GetMarginBackN\n");
int retVal = (int)callScintilla(SCI_GETMARGINBACKN, margin);
return boost::python::make_tuple(COLOUR_RED(retVal), COLOUR_GREEN(retVal), COLOUR_BLUE(retVal));
}
/** Allocate a non-standard number of margins.
*/
void ScintillaWrapper::SetMargins(int margins)
{
DEBUG_TRACE(L"ScintillaWrapper::SetMargins\n");
callScintilla(SCI_SETMARGINS, margins);
}
/** How many margins are there?.
*/
intptr_t ScintillaWrapper::GetMargins()
{
DEBUG_TRACE(L"ScintillaWrapper::GetMargins\n");
return callScintilla(SCI_GETMARGINS);
}
/** Clear all the styles and make equivalent to the global default style.
*/
void ScintillaWrapper::StyleClearAll()
{
DEBUG_TRACE(L"ScintillaWrapper::StyleClearAll\n");
callScintilla(SCI_STYLECLEARALL);
}
/** Set the foreground colour of a style.
*/
void ScintillaWrapper::StyleSetFore(int style, boost::python::tuple fore)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetFore\n");
COLORREF rgbfore = MAKECOLOUR(fore);
callScintilla(SCI_STYLESETFORE, style, static_cast<LPARAM>(rgbfore));
}
/** Set the background colour of a style.
*/
void ScintillaWrapper::StyleSetBack(int style, boost::python::tuple back)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetBack\n");
COLORREF rgbback = MAKECOLOUR(back);
callScintilla(SCI_STYLESETBACK, style, static_cast<LPARAM>(rgbback));
}
/** Set a style to be bold or not.
*/
void ScintillaWrapper::StyleSetBold(int style, bool bold)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetBold\n");
callScintilla(SCI_STYLESETBOLD, style, bold);
}
/** Set a style to be italic or not.
*/
void ScintillaWrapper::StyleSetItalic(int style, bool italic)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetItalic\n");
callScintilla(SCI_STYLESETITALIC, style, italic);
}
/** Set the size of characters of a style.
*/
void ScintillaWrapper::StyleSetSize(int style, int sizePoints)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetSize\n");
callScintilla(SCI_STYLESETSIZE, style, sizePoints);
}
/** Set the font of a style.
*/
void ScintillaWrapper::StyleSetFont(int style, boost::python::object fontName)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetFont\n");
std::string stringfontName = getStringFromObject(fontName);
callScintilla(SCI_STYLESETFONT, style, reinterpret_cast<LPARAM>(stringfontName.c_str()));
}
/** Set a style to have its end of line filled or not.
*/
void ScintillaWrapper::StyleSetEOLFilled(int style, bool eolFilled)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetEOLFilled\n");
callScintilla(SCI_STYLESETEOLFILLED, style, eolFilled);
}
/** Reset the default style to its state at startup
*/
void ScintillaWrapper::StyleResetDefault()
{
DEBUG_TRACE(L"ScintillaWrapper::StyleResetDefault\n");
callScintilla(SCI_STYLERESETDEFAULT);
}
/** Set a style to be underlined or not.
*/
void ScintillaWrapper::StyleSetUnderline(int style, bool underline)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetUnderline\n");
callScintilla(SCI_STYLESETUNDERLINE, style, underline);
}
/** Get the foreground colour of a style.
*/
boost::python::tuple ScintillaWrapper::StyleGetFore(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetFore\n");
int retVal = (int)callScintilla(SCI_STYLEGETFORE, style);
return boost::python::make_tuple(COLOUR_RED(retVal), COLOUR_GREEN(retVal), COLOUR_BLUE(retVal));
}
/** Get the background colour of a style.
*/
boost::python::tuple ScintillaWrapper::StyleGetBack(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetBack\n");
int retVal = (int)callScintilla(SCI_STYLEGETBACK, style);
return boost::python::make_tuple(COLOUR_RED(retVal), COLOUR_GREEN(retVal), COLOUR_BLUE(retVal));
}
/** Get is a style bold or not.
*/
bool ScintillaWrapper::StyleGetBold(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetBold\n");
return 0 != (callScintilla(SCI_STYLEGETBOLD, style));
}
/** Get is a style italic or not.
*/
bool ScintillaWrapper::StyleGetItalic(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetItalic\n");
return 0 != (callScintilla(SCI_STYLEGETITALIC, style));
}
/** Get the size of characters of a style.
*/
intptr_t ScintillaWrapper::StyleGetSize(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetSize\n");
return callScintilla(SCI_STYLEGETSIZE, style);
}
/** Get the font of a style.
* Returns the length of the fontName
* Result is NUL-terminated.
*/
boost::python::str ScintillaWrapper::StyleGetFont(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetFont\n");
PythonCompatibleStrBuffer result(callScintilla(SCI_STYLEGETFONT, style));
callScintilla(SCI_STYLEGETFONT, style, reinterpret_cast<LPARAM>(*result));
return boost::python::str(result.c_str());
}
/** Get is a style to have its end of line filled or not.
*/
bool ScintillaWrapper::StyleGetEOLFilled(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetEOLFilled\n");
return 0 != (callScintilla(SCI_STYLEGETEOLFILLED, style));
}
/** Get is a style underlined or not.
*/
bool ScintillaWrapper::StyleGetUnderline(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetUnderline\n");
return 0 != (callScintilla(SCI_STYLEGETUNDERLINE, style));
}
/** Get is a style mixed case, or to force upper or lower case.
*/
int ScintillaWrapper::StyleGetCase(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetCase\n");
return callScintilla(SCI_STYLEGETCASE, style);
}
/** Get the character get of the font in a style.
*/
int ScintillaWrapper::StyleGetCharacterSet(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetCharacterSet\n");
return callScintilla(SCI_STYLEGETCHARACTERSET, style);
}
/** Get is a style visible or not.
*/
bool ScintillaWrapper::StyleGetVisible(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetVisible\n");
return 0 != (callScintilla(SCI_STYLEGETVISIBLE, style));
}
/** Get is a style changeable or not (read only).
* Experimental feature, currently buggy.
*/
bool ScintillaWrapper::StyleGetChangeable(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetChangeable\n");
return 0 != (callScintilla(SCI_STYLEGETCHANGEABLE, style));
}
/** Get is a style a hotspot or not.
*/
bool ScintillaWrapper::StyleGetHotSpot(int style)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleGetHotSpot\n");
return 0 != (callScintilla(SCI_STYLEGETHOTSPOT, style));
}
/** Set a style to be mixed case, or to force upper or lower case.
*/
void ScintillaWrapper::StyleSetCase(int style, int caseVisible)
{
DEBUG_TRACE(L"ScintillaWrapper::StyleSetCase\n");
callScintilla(SCI_STYLESETCASE, style, caseVisible);
}