-
Notifications
You must be signed in to change notification settings - Fork 71
/
scint5.ahk
2772 lines (2522 loc) · 129 KB
/
scint5.ahk
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
; AHK v2
; ====================================================================
; Example
; ====================================================================
(Scintilla) ; Init class, or simply #INCLUDE the extension-lib at the top.
g := Gui("+Resize +E0x2000000 0x2000000","Scintilla Test")
g.OnEvent("Close",gui_close)
g.OnEvent("Escape",gui_close)
g.OnEvent("Size",gui_size)
a := 1, b := 2
if (1=0)
WinActive("ahk_id " b)
ctl := g.AddScintilla("vMyScintilla w1000 h500 DefaultOpt DefaultTheme")
ctl.CaseSense := false ; turn off case sense (for AHK), do this before setting keywords
kw1 := "Else If Continue Critical Break Goto Return Loop Read Reg Parse Files Switch Try Catch Finally Throw Until While For Exit ExitApp OnError OnExit Reload Suspend Thread"
kw2 := "Abs ASin ACos ATan BlockInput Buffer CallbackCreate CallbackFree CaretGetPos Ceil Chr Click ClipboardAll ClipWait ComCall ComObjActive ComObjArray ComObjConnect ComObject ComObjFlags ComObjFromPtr ComObjGet ComObjQuery ComObjType ComObjValue ComValue ControlAddItem ControlChooseIndex ControlChooseString ControlClick ControlDeleteItem ControlFindItem ControlFocus ControlGetChecked ControlGetChoice ControlGetClassNN ControlGetEnabled ControlGetFocus ControlGetHwnd ControlGetIndex ControlGetItems ControlGetPos ControlGetStyle ControlGetExStyle ControlGetText ControlGetVisible ControlHide ControlHideDropDown ControlMove ControlSend ControlSendText ControlSetChecked ControlSetEnabled ControlSetStyle ControlSetExStyle ControlSetText ControlShow ControlShowDropDown CoordMode Cos DateAdd DateDiff DetectHiddenText DetectHiddenWindows DirCopy DirCreate DirDelete DirExist DirMove DirSelect DllCall Download DriveEject DriveGetCapacity DriveGetFileSystem DriveGetLabel DriveGetList DriveGetSerial DriveGetSpaceFree DriveGetStatus DriveGetStatusCD DriveGetType DriveLock DriveRetract DriveSetLabel DriveUnlock Edit EditGetCurrentCol EditGetCurrentLine EditGetLine EditGetLineCount EditGetSelectedText EditPaste EnvGet EnvSet Exp FileAppend FileCopy FileCreateShortcut FileDelete FileEncoding FileExist FileInstall FileGetAttrib FileGetShortcut FileGetSize FileGetTime FileGetVersion FileMove FileOpen FileRead FileRecycle FileRecycleEmpty FileSelect FileSetAttrib FileSetTime Float Floor Format FormatTime GetKeyName GetKeyVK GetKeySC GetKeyState GetMethod GroupAdd GroupClose GroupDeactivate Gui GuiCtrlFromHwnd GuiFromHwnd HasBase HasMethod HasProp HotIf HotIfWinActive HotIfWinExist HotIfWinNotActive HotIfWinNotExist Hotkey Hotstring IL_Create IL_Add IL_Destroy ImageSearch IniDelete IniRead IniWrite InputBox InputHook InstallKeybdHook InstallMouseHook InStr Integer IsLabel IsObject IsSet IsSetRef KeyHistory KeyWait ListHotkeys ListLines ListVars ListViewGetContent LoadPicture Log Ln Map Max MenuBar Menu MenuFromHandle MenuSelect Min Mod MonitorGet MonitorGetCount MonitorGetName MonitorGetPrimary MonitorGetWorkArea MouseClick MouseClickDrag MouseGetPos MouseMove MsgBox Number NumGet NumPut ObjAddRef ObjRelease ObjBindMethod ObjHasOwnProp ObjOwnProps ObjGetBase ObjGetCapacity ObjOwnPropCount ObjSetBase ObjSetCapacity OnClipboardChange OnMessage Ord OutputDebug Pause Persistent PixelGetColor PixelSearch PostMessage ProcessClose ProcessExist ProcessSetPriority ProcessWait ProcessWaitClose Random RegExMatch RegExReplace RegDelete RegDeleteKey RegRead RegWrite Round Run RunAs RunWait Send SendText SendInput SendPlay SendEvent SendLevel SendMessage SendMode SetCapsLockState SetControlDelay SetDefaultMouseSpeed SetKeyDelay SetMouseDelay SetNumLockState SetScrollLockState SetRegView SetStoreCapsLockMode SetTimer SetTitleMatchMode SetWinDelay SetWorkingDir Shutdown Sin Sleep Sort SoundBeep SoundGetInterface SoundGetMute SoundGetName SoundGetVolume SoundPlay SoundSetMute SoundSetVolume SplitPath Sqrt StatusBarGetText StatusBarWait StrCompare StrGet String StrLen StrLower StrPut StrReplace StrSplit StrUpper SubStr SysGet SysGetIPAddresses Tan ToolTip TraySetIcon TrayTip Trim LTrim RTrim Type VarSetStrCapacity VerCompare WinActivate WinActivateBottom WinActive WinClose WinExist WinGetClass WinGetClientPos WinGetControls WinGetControlsHwnd WinGetCount WinGetID WinGetIDLast WinGetList WinGetMinMax WinGetPID WinGetPos WinGetProcessName WinGetProcessPath WinGetStyle WinGetExStyle WinGetText WinGetTitle WinGetTransColor WinGetTransparent WinHide WinKill WinMaximize WinMinimize WinMinimizeAll WinMinimizeAllUndo WinMove WinMoveBottom WinMoveTop WinRedraw WinRestore WinSetAlwaysOnTop WinSetEnabled WinSetRegion WinSetStyle WinSetExStyle WinSetTitle WinSetTransColor WinSetTransparent WinShow WinWait WinWaitActive WinWaitNotActive WinWaitClose"
kw3 := "Add AddActiveX AddButton AddCheckbox AddComboBox AddCustom AddDateTime AddDropDownList AddEdit AddGroupBox AddHotkey AddLink AddListBox AddListView AddMonthCal AddPicture AddProgress AddRadio AddSlider AddStandard AddStatusBar AddTab AddText AddTreeView AddUpDown Bind Check Choose Clear Clone Close Count DefineMethod DefineProp Delete DeleteCol DeleteMethod DeleteProp Destroy Disable Enable Flash Focus Get GetAddress GetCapacity GetChild GetClientPos GetCount GetNext GetOwnPropDesc GetParent GetPos GetPrev GetSelection GetText Has HasKey HasOwnMethod HasOwnProp Hide Insert InsertAt InsertCol Len Mark Maximize MaxIndex Minimize MinIndex Modify ModifyCol Move Name OnCommand OnEvent OnNotify Opt OwnMethods OwnProps Pop Pos Push RawRead RawWrite Read ReadLine ReadUInt ReadInt ReadInt64 ReadShort ReadUShort ReadChar ReadUChar ReadDouble ReadFloat Redraw RemoveAt Rename Restore Seek Set SetCapacity SetColor SetFont SetIcon SetImageList SetParts SetText Show Submit Tell ToggleCheck ToggleEnable Uncheck UseTab Write WriteLine WriteUInt WriteInt WriteInt64 WriteShort WriteUShort WriteChar WriteUChar WriteDouble WriteFloat"
kw4 := "AtEOF BackColor Base Capacity CaseSense ClassNN ClickCount Count Default Enabled Encoding Focused FocusedCtrl Gui Handle Hwnd Length MarginX MarginY MenuBar Name Pos Position Ptr Size Text Title Value Visible __Handle"
kw5 := "A_Space A_Tab A_Args A_WorkingDir A_InitialWorkingDir A_ScriptDir A_ScriptName A_ScriptFullPath A_ScriptHwnd A_LineNumber A_LineFile A_ThisFunc A_AhkVersion A_AhkPath A_IsCompiled A_YYYY A_MM A_DD A_MMMM A_MMM A_DDDD A_DDD A_WDay A_YDay A_YWeek A_Hour A_Min A_Sec A_MSec A_Now A_NowUTC A_TickCount A_IsSuspended A_IsPaused A_IsCritical A_ListLines A_TitleMatchMode A_TitleMatchModeSpeed A_DetectHiddenWindows A_DetectHiddenText A_FileEncoding A_SendMode A_SendLevel A_StoreCapsLockMode A_KeyDelay A_KeyDuration A_KeyDelayPlay A_KeyDurationPlay A_WinDelay A_ControlDelay A_MouseDelay A_MouseDelayPlay A_DefaultMouseSpeed A_CoordModeToolTip A_CoordModePixel A_CoordModeMouse A_CoordModeCaret A_CoordModeMenu A_RegView A_TrayMenu A_AllowMainWindow A_AllowMainWindow A_IconHidden A_IconTip A_IconFile A_IconNumber A_TimeIdle A_TimeIdlePhysical A_TimeIdleKeyboard A_TimeIdleMouse A_ThisHotkey A_PriorHotkey A_PriorKey A_TimeSinceThisHotkey A_TimeSincePriorHotkey A_EndChar A_EndChar A_MaxHotkeysPerInterval A_HotkeyInterval A_HotkeyModifierTimeout A_ComSpec A_Temp A_OSVersion A_Is64bitOS A_PtrSize A_Language A_ComputerName A_UserName A_WinDir A_ProgramFiles A_AppData A_AppDataCommon A_Desktop A_DesktopCommon A_StartMenu A_StartMenuCommon A_Programs A_ProgramsCommon A_Startup A_StartupCommon A_MyDocuments A_IsAdmin A_ScreenWidth A_ScreenHeight A_ScreenDPI A_Clipboard A_Cursor A_EventInfo A_LastError True False A_Index A_LoopFileName A_LoopRegName A_LoopReadLine A_LoopField this"
kw6 := "#ClipboardTimeout #DllLoad #ErrorStdOut #Hotstring #HotIf #HotIfTimeout #Include #IncludeAgain #InputLevel #MaxThreads #MaxThreadsBuffer #MaxThreadsPerHotkey #NoTrayIcon #Requires #SingleInstance #SuspendExempt #UseHook #Warn #WinActivateForce #If"
kw7 := "Global Local Static"
ctl.setKeywords(kw1, kw2, kw3, kw4, kw5, kw6, kw7)
; ======================================================================
; ctl.UseDirect := true ; the DLL uses the Direct Ptr for now
; ctl.Wrap.LayoutCache := 3 ; speeds up window resize on large docs, but sometimes causes slower load times on large documents
; ======================================================================
; items that should be set by the user
; ======================================================================
ctl.Brace.Chars := "[]{}()" ; modify braces list that will be tracked
ctl.SyntaxEscapeChar := "``" ; set this to "\" to load up CustomLexer.c, or to "``" to load an AHK script.
ctl.SyntaxCommentLine := ";" ; set this to "//" to load up CustomLexer.c, or to ";" to load an AHK script.
; ======================================================================
; Setting DLL punct and word chars:
;
; Below are the defaults for punct and word chars for the DLL. Setting
; punct and word chars for Scintilla has a different purpose and a
; slightly different effect. It's also kinda of squirrely. Since it is
; possible to use a direct pointer to parse Scintilla text I leave the
; Scintilla defaults for punct and word chars alone.
;
; You'll notice that the punct defaults also contain braces, escape
; chars, and of course " and '. The search for punct chars happens
; after searching for those other elements, and thus doesn't affect
; how braces, strings, and escape chars function.
;
; For WordChars, since a variable or function must normally start with
; a letter or underscore, only specify letters and underscore/pound sign
; if desired. Matching for digits in a "word" is done separately assuming
; the first character of the "word" is not a digit.
; ======================================================================
; ctl.SyntaxPunctChars := "!`"$%&'()*+,-./:;<=>?@[\]^``{|}~" ; this is the default
; ctl.SyntaxWordChars := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_#" ; this is the default
; ======================================================================
; Simple to apply vertical colored lines at specified column - uncomment to test
; ======================================================================
; ctl.Edge.Mode := 3 ; vertical lines - handy!
; ctl.Edge.Multi.Add(5,0xFF0000)
; ctl.Edge.Multi.Add(10,0x00FF00)
; ctl.Edge.Multi.Add(15,0x0000FF)
; ctl.Edge.View := 1
; ======================================================================
; To see white space/CRLF/other special non-printing chars
; ======================================================================
; ctl.WhiteSpace.View := 1
; ctl.LineEnding.View := 1
; ======================================================================
ctl.callback := ctl_callback ; this doesn't do anything for now
ctl.CustomSyntaxHighlighting := true ; turns syntax highlighting on
ctl.AutoSizeNumberMargin := true
; ctl.Target.Flags := Scintilla.sc_search.RegXP | Scintilla.sc_search.CXX11RegEx ; CXX11RegEx | POSIX
; ======================================================================
; ctl.Styling.Idle := 3 ; do NOT set this when using my syntax highlighting. My syntax highlighting works differently.
; ======================================================================
; Set this to prevent unnecessary parsing and improve load time. While
; editing the document additional parsing must happen in order to
; properly color the various elements of the document correctly when
; adding/deleting/uncommenting text. This value will automatically be
; set to 0 after loading a document.
; ======================================================================
ctl.loading := 1
; sFile := A_ScriptDir "\CustomLexer.c" ; C source for CustomLexer.dll
sFile := A_ScriptDir "\" A_ScriptName ; this script
; sFile := "test-script.ahk" ; 2.16 MB
size := FileGetSize(sFile)
ptr := ctl.Doc.Create(size+100)
ctl.Doc.ptr := ptr
ctl.Text := FileRead(sFile)
; ======================================================================
; These must usually be set after changing document ptr.
; ======================================================================
ctl.Tab.Use := false ; use spaces instad of tabs
ctl.Tab.Width := 4 ; number of spaces for a tab
; ======================================================================
; show GUI
; ======================================================================
g.Show()
ctl.CurPos := 0 ; move to the beginning of the document
ctl_callback(ctl, scn) { ; callback for wm_notify messages
; do user stuff
}
gui_size(g, minMax, w, h) {
ctl := g["MyScintilla"] ; test
ctl.Move(,,w-(g.MarginX * 2), h-(g.MarginY * 2))
}
gui_close(*) {
ExitApp
}
F2::{
global ctl
msgbox ctl.CurPos " / style: " ctl.GetStyle(ctl.curPos) " / lines on screen: " ctl.LinesOnScreen
}
F3::{
global ctl
ctl.CurPos := 0
; msgbox "curPos: " ctl.curPos " / match: " ctl.Brace.Match(ctl.curPos) " / last style: " ctl.Styling.Last
}
F4::{
ExitApp
}
; ====================================================================
; Scintilla Class
; ====================================================================
class Scintilla extends Gui.Custom {
Static p := A_PtrSize, u := StrLen(Chr(0xFFFF))
Static DirectFunc := 0, DirectStatusFunc := 0
Static wm_notify := {AutoCCancelled:0x7E9
, AutoCCharDeleted:0x7EA
, AutoCCompleted:0x7EE
, AutoCSelection:0x7E6
, AutoCSelectionChange:0x7F0
, CallTipClick:0x7E5
, CharAdded:0x7D1
, DoubleClick:0x7D6
, DwellEnd:0x7E1
, DwellStart:0x7E0
, FocusIn:0x7EC
, FocusOut:0x7ED
, HotSpotClick:0x7E3
, HotSpotDoubleClick:0x7E4
, HotSpotReleaseClick:0x7EB
, IndicatorClick:0x7E7
, IndicatorRelease:0x7E8
, Key:0x7D5
, MacroRecord:0x7D9
, MarginClick:0x7DA
, MarginRightClick:0x7EF
, Modified:0x7D8
, ModifyAtTempTRO:0x7D4
, NeedShown:0x7DB
, Painted:0x7DD
, SavePointLeft:0x7D3
, SavePointReached:0x7D2
, StyleNeeded:0x7D0
, UpdateUI:0x7D7
, UriDropped:0x7DF ; Change:0x300
, UserListSelection:0x7DE ; KillFocus:0x100
, Zoom:0x7E2} ; SetFocus:0x200
Static scn_id := this.p ; NMHDR #2 ; ptr ; SCNotification offsets
, scn_wmmsg := this.p * 2 ; NMHDR #3 ; uint verified: 13/22 members (not counting NMHDR)
, scn_pos := (this.p=4) ? 12 : 24 ; int Sci_Position <-- verified offset
, scn_ch := (this.p=4) ? 16 : 32 ; int <-- verified offset
, scn_mod := (this.p=4) ? 20 : 36 ; int <-- verified offset
, scn_modType := (this.p=4) ? 24 : 40 ; int <-- verified offset
, scn_text := (this.p=4) ? 28 : 48 ; ptr <-- verified offset
, scn_length := (this.p=4) ? 32 : 56 ; int Sci_Position <-- verified offset
, scn_linesAdded := (this.p=4) ? 36 : 64 ; int Sci_Position <-- verified offset
, scn_message := (this.p=4) ? 40 : 72 ; int
, scn_wParam := (this.p=4) ? 44 : 80 ; ptr
, scn_lParam := (this.p=4) ? 48 : 88 ; sptr (signed)
, scn_line := (this.p=4) ? 52 : 96 ; int Sci_Position <-- verified offset
, scn_foldLevelNow := (this.p=4) ? 56 : 104 ; int need folding to verify
, scn_foldLevelPrev := (this.p=4) ? 60 : 108 ; int need folding to verify
, scn_margin := (this.p=4) ? 64 : 112 ; int <-- verified offset
, scn_listType := (this.p=4) ? 68 : 116 ; int need user list or auto-complete to verify
, scn_x := (this.p=4) ? 72 : 120 ; int <-- verified offset
, scn_y := (this.p=4) ? 76 : 124 ; int <-- verified offset
, scn_token := (this.p=4) ? 80 : 128 ; int <-- verified offset
, scn_annotationLinesAdded:=(this.p=4) ? 84 : 136 ; int Sci_Position need to use annotations to verify
, scn_updated := (this.p=4) ? 88 : 144 ; int <-- verified offset
, scn_listCompletionMethod:=(this.p=4) ? 92 : 148 ; int need user list or auto-complete to verify
, scn_characterSource := (this.p=4) ? 96 : 152 ; int need IME input to verify this
Static sc_eol := {Hidden:0
, Standard:0x1
, Boxed:0x2
, Stadium:0x100 ; ( ... )
, FlatCircle:0x101 ; | ... )
, AngleCircle:0x102 ; < ... )
, CircleFlat:0x110 ; ( ... |
, Flats:0x111 ; | ... |
, AngleFlat:0x112 ; < ... |
, CircleAngle:0x120 ; ( ... >
, FlatAngle:0x121 ; | ... >
, Angles:0x122} ; < ... >
Static sc_mod := {Ctrl:2, Alt:4, Shift:1, Meta:16, Super:8}
Static sc_updated := {Content:0x1, Selection:2, VScroll:4, HScroll:8}
Static sc_marker := {Circle:0x0
, RoundRect:0x1
, Arrow:0x2
, SmallRect:0x3
, ShortArrow:0x4
, Empty:0x5
, ArrowDown:0x6
, Minus:0x7
, Plus:0x8
, Vline:0x9
, LCorner:0xA
, TCorner:0xB
, BoxPlus:0xC
, BoxPlusConnected:0xD
, BoxMinus:0xE
, BoxMinusConnected:0xF
, LCornerCurve:0x10
, TCornerCurve:0x11
, CirclePlus:0x12
, CirclePlusconnected:0x13
, CircleMinus:0x14
, CircleMinusconnected:0x15
, Background:0x16
, DotDotDot:0x17
, Arrows:0x18
, Pixmap:0x19
, FullRect:0x1A
, LeftRect:0x1B
, Available:0x1C
, Underline:0x1D
, RgbaImage:0x1E
, Bookmark:0x1F
, VerticalBookmark:0x20
, Character:0x2710}
Static sc_MarkerNum := {FolderEnd:0x19
, FolderOpenMid:0x1A
, FolderMidTail:0x1B
, FolderTail:0x1C
, FolderSub:0x1D
, Folder:0x1E
, FolderOpen:0x1F}
Static sc_modType := {None:0 ; SCN members affected below...
, InsertText:0x1 ; pos, length, text, linesAdded
, DeleteText:0x2 ; pos, length, text, linesAdded
, ChangeStyle:0x4 ; pos, length
, ChangeFold:0x8 ; line, foldLevelNow, foldLevelPrev
, User:0x10 ;
, Undo:0x20 ;
, Redo:0x40 ;
, MultiStepUndoRedo:0x80 ;
, LastStepInUndoRedo:0x100 ;
, ChangeMarker:0x200 ; line
, BeforeInsert:0x400 ; pos, if user, text in bytes, length in bytes
, BeforeDelete:0x800 ; position, length
, ChangeIndicator:0x4000 ; position, length
, ChangeLineState:0x8000 ; line
, ChangeTabStops:0x200000 ; line
, LexerState:0x80000 ; position, length
, ChangeMargin:0x10000 ; line
, ChangeAnnotation:0x20000 ; line
, InsertCheck:0x100000 ; position, length, text
, MultiLineUndoRedo:0x1000 ;
, StartAction:0x2000 ;
, Container:0x40000} ; token
; , EventMaskAll:0x1FFFFF} ;
Static sc_search := {None:0x0 ; Default, case-insensitive match.
, WholeWord:0x2 ; Matches whole word, see Words.WordChars
, MatchCase:0x4
, WordStart:0x100000 ; Matches beginning of word, see Words.WordChars
, RegXP:0x200000 ; Enables a RegEx search.
, POSIX:0x400000 ; Allows () instead of \(\), but referring to tags still requires \1 instead of $1.
; Don't use with CXX11.
, CXX11RegEx:0x800000} ; Need to test to see if this will be simple enough to use in AHK.
; This should be the closest to AHK RegEx. Requires RegXP to also be set.
Static charset := {8859_15:0x3E8,ANSI:0x0,ARABIC:0xB2,BALTIC:0xBA,CHINESEBIG5:0x88,CYRILLIC:0x4E3,DEFAULT:0x1
,EASTEUROPE:0xEE,GB2312:0x86,GREEK:0xA1,HANGUL:0x81,HEBREW:0xB1,JOHAB:0x82,MAC:0x4D,OEM:0xFF
,OEM866:0x362,RUSSIAN:0xCC,SHIFTJIS:0x80,SYMBOL:0x2,THAI:0xDE,TURKISH:0xA2,VIETNAMESE:0xA3}
Static cp := Map("UTF-8",65001, "Japanese Shift_JIS",932, "Simplified Chinese GBK",936 ; CodePages
, "Korean Unified Hangul Code",949, "Traditional Chinese Big5",950
, "Korean Johab",1361)
Static __New() { ; Need to do it this way.
Gui.Prototype.AddScintilla := ObjBindMethod(this,"AddScintilla") ; Multiple gui subclass extensions don't play well together.
scint_path := A_ScriptDir "\Scintilla.dll" ; Set this as needed.
If !(this.hModule := DllCall("LoadLibrary", "Str", scint_path), "UPtr") { ; load dll, make sure it works
MsgBox "Scintilla DLL not found.`n`nModify the path to the appropriate location for your script."
ExitApp
}
custom_lexer := "CustomLexer.dll" ; change this path as needed (if you choose to move the DLL)
If !DllCall("LoadLibrary", "Str", custom_lexer, "UPtr") {
Msgbox "CustomLexer.dll not found."
ExitApp
}
; Scintilla.scint_base.Prototype._sms := Scintilla.scint_base.Prototype.__sms_slow
For prop in Scintilla.scint_base.prototype.OwnProps() ; attach utility methods to prototype
If !(SubStr(prop,1,2) = "__") And (SubStr(prop,1,1) = "_")
this.Prototype.%prop% := Scintilla.scint_base.prototype.%prop%
}
Static AddScintilla(_gui, sOptions) {
DefaultOpt := false
DefaultTheme := false
opt_arr := StrSplit(sOptions," ")
sOptions := ""
For i, str in opt_arr {
If RegExMatch(str, "DefaultOpts?")
DefaultOpt := true
Else If (str = "DefaultTheme")
DefaultTheme := true
Else
sOptions .= (sOptions?" ":"") str
}
ctl := _gui.Add("Custom","ClassScintilla " sOptions)
ctl.base := Scintilla.Prototype ; attach methods (but not static ones)
; ======================================================================
; Init CustomLexer DLL functions for using scint control in AHK script and get Direct Func/Ptr
; ======================================================================
buf := Buffer(8,0)
NumPut("UPtr", ctl.hwnd, buf)
result := DllCall("CustomLexer\Init","UPtr",ctl.hwnd,"UPtr") ; init DLL and get direct func/ptr
; ======================================================================
; Register main SCN notification callback
; ======================================================================
ctl.msg_cb := ObjBindMethod(ctl, "wm_messages") ; Register wm_notify messages
OnMessage(0x4E, ctl.msg_cb)
; ======================================================================
; Init some settings
; ======================================================================
ctl.loading := 0 ; set this to 1 when loading a document
ctl.callback := "" ; setting some main properties
ctl.state := "" ; used to determine input "mode", ie. string, comment, etc.
ctl._StatusD := 0
ctl._UsePopup := true
ctl._UseDirect := false ; set some defaults...
ctl._DirectPtr := 0
ctl.LastCode := 0 ; like LastError, captures the return codes of messages sent, if any
ctl._AutoSizeNumberMargin := false
ctl._AutoBraceMatch := false
ctl._AutoPunctColor := false
ctl._CharIndex := 0 ; 0 = NONE (ie. UTF-8) / 1 = UTF-32 / 2 = UTF-16
ctl.SyntaxCommentLine := ";"
ctl.SyntaxCommentBlockA := "/*"
ctl.SyntaxCommentBlockB := "*/"
ctl.SyntaxStringChar := Chr(34)
ctl.SyntaxEscapeChar := Chr(96)
ctl.SyntaxPunctChars := "!`"$%&'()*+,-./:;<=>?@[\]^``{|}~"
; ctl.SyntaxWordChars := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"
ctl.SyntaxWordChars := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_#"
ctl.SyntaxString1 := Chr(34)
ctl.SyntaxString2 := "'"
ctl.CaseSense := false
; ==============================================
; Custom Syntax Highlighting properties
; ==============================================
ctl.CustomSyntaxHighlighting := false
; =============================================
; attach main objects to Scintilla control
; =============================================
ctl.init_classes()
; ====================================================
; These 2 settings are recommended for modern systems.
; ====================================================
ctl.BufferedDraw := 0 ; disable buffering for Direct2D
ctl.SetTechnology := 2 ; use Direct2D
; ==========================================================================================
; These 2 methods are not required. These only apply the settings that I prefer to use with
; Scintilla. You can modify the code in these methods to your requirements.
; ==========================================================================================
If DefaultOpt
ctl.DefaultOpt()
If DefaultTheme
ctl.DefaultTheme()
return ctl
}
init_classes() {
; =============================================
; attach main objects to Scintilla control
; =============================================
; Annotations
; AutoComplete and "Element Colors"
this.Brace := Scintilla.Brace(this)
; CallTips
this.Caret := Scintilla.Caret(this)
; Character Representations
this.Doc := Scintilla.Doc(this) ; Multiple views
this.Edge := Scintilla.Edge(this) ; Long lines
this.EOLAnn := Scintilla.EOLAnn(this) ; End of Line Annotations
; this.Event := Scintilla.Event(this) ; Custom easy methods for common actions
; Folding + SCI_SETVISIBLEPOLICY
this.HotSpot := Scintilla.Hotspot(this)
; Indicators (underline and such)
; KeyBindings
; Keyboard Commands
this.LineEnding := Scintilla.LineEnding(this)
this.Macro := Scintilla.Macro(this) ; planning to add obj to index all recordable msg numbers
this.Margin := Scintilla.Margin(this)
this.Marker := Scintilla.Marker(this)
; OSX Find Indicator
; Printing
this.Punct := Scintilla.Punct(this)
this.Selection := Scintilla.Selection(this)
this.Style := Scintilla.Style(this)
this.Styling := Scintilla.Styling(this)
this.Tab := Scintilla.Tab(this)
this.Target := Scintilla.Target(this)
; User Lists?
this.WhiteSpace := Scintilla.WhiteSpace(this)
this.Word := Scintilla.Word(this)
this.Wrap := Scintilla.Wrap(this)
this.cust := Scintilla.cust(this)
; ====================================================
; Setup keyword lists
; ====================================================
this.kw1 := "", this.kw1_utf8 := Buffer(1,0), this.kw5 := "", this.kw5_utf8 := Buffer(1,0)
this.kw2 := "", this.kw2_utf8 := Buffer(1,0), this.kw6 := "", this.kw6_utf8 := Buffer(1,0)
this.kw3 := "", this.kw3_utf8 := Buffer(1,0), this.kw7 := "", this.kw7_utf8 := Buffer(1,0)
this.kw4 := "", this.kw4_utf8 := Buffer(1,0), this.kw8 := "", this.kw8_utf8 := Buffer(1,0)
}
Static Lookup(member, in_value) {
For prop, value in this.%member%.OwnProps()
If (value = in_value)
return prop
return ""
}
Static GetFlags(member, in_value, all:=false) {
out_str := ""
For prop, value in Scintilla.%member%.OwnProps()
If (value & in_value)
out_str .= (out_str?" ":"") prop
return out_str
}
Static RGB(R, G, B) {
return Format("0x{:06X}",(R << 16) | (G << 8) | B)
}
wm_messages(wParam, lParam, msg, hwnd) {
Static modType := Scintilla.sc_modType
scn := Scintilla.SCNotification(lParam)
scn.LineBeforeInsert := this.CurLine
scn.LinesBeforeInsert := this.Lines
; _scn := {hwnd:scn.hwnd
; , id:scn.id
; , wmmsg:scn.wmmsg
; , pos:scn.pos ;
; , ch:scn.ch
; , mod:scn.mod
; , modType:scn.modType
; , text:scn.text ;
; , length:scn.length
; , linesAdded:scn.linesAdded ;
; , message:scn.message
; , wParam:scn.wParam
; , lParam:scn.lParam
; , line:scn.line
; , foldLevelNow:scn.foldLevelNow
; , foldLevelPrev:scn.foldLevelPrev
; , margin:scn.margin
; , listType:scn.listType
; , x:scn.x
; , y:scn.y
; , token:scn.token
; , annotationLinesAdded:scn.annotationLinesAdded
; , updated:scn.updated ;
; , listCompletionMethod:scn.listCompletionMethod
; , characterSource:scn.characterSource}
event := scn.wmmsg_txt := Scintilla.Lookup("wm_notify", (msg_num := scn.wmmsg))
; =========================================================================
; Easy events: Comment any of these out if you want to fine-tune function
; or performance in the user callback manually.
; =========================================================================
If (this.AutoSizeNumberMargin)
this.MarginWidth(0, 33, scn) ; number margin 0, with default style 33
If (this.CustomSyntaxHighlighting) {
data := this.scn_data(scn) ; prep data for DLL calls
; wordList := this.makeWordLists()
If (scn.modType & modType.InsertText) ; Captures text editing and scrolling
|| (event = "UpdateUI" && (scn.updated=4 || scn.updated=8)) {
If (event = "Modified") && (scn.length > 1) { ; && (scn.linesAdded) { ; paste or document load operation
ticks := A_TickCount
result := this.ChunkColoring(scn, data, this._wordList)
dbg( "ChunkColoring Seconds: " (A_TickCount - ticks) / 1000 " / result: " result)
}
else if (event = "Modified") && (!scn.linesAdded) {
; else if (event = "CharAdded") {
ticks := A_TickCount
result := this.ChunkColoring(scn, data, this._wordList)
dbg( "Line Styling Seconds: " (A_TickCount - ticks) / 1000 " / result: " result)
}
}
Else If (scn.modType & modType.BeforeDelete)
this.DeleteRoutine(scn, data)
Else if (scn.modType & modType.DeleteText)
this.ChunkColoring(scn, data, this._wordList) ; redo coloring after delete
If (scn.wmmsg_txt = "StyleNeeded") {
; ticks := A_TickCount
this.Pacify() ; pacify the StyleNeeded bit by styling the last char in the doc
; dbg( "StyleNeeded Seconds: " (A_TickCount - ticks) / 1000 " / Last: " this.Styling.Last)
}
}
; =========================================================================
; User callback
; =========================================================================
If (this.callback)
f := this.callback(scn)
}
MarginWidth(margin:=0, style:=33, scn:="") {
Static modType := Scintilla.sc_modType
If !scn || !((scn.wmmsg_txt = "Modified")
&& (scn.modType & modType.DeleteText || scn.modType & modType.InsertText))
return
this.Style.ID := style
this.Margin.ID := margin
min_width := this.Margin.MinWidth
width := this.TextWidth(this.Lines) + this.TextWidth("0")
this.Margin.Width := (width >= min_width) ? width : min_width
}
Pacify() { ; End each notification by styling the last char in the doc to satisfy "StyleNeeded" event.
_lastPos := ctl.Length-1
, _style := this.GetStyle(_lastPos)
, this._sms(0x7F0, (_lastPos), 0) ; // SCI_STARTSTYLING
, this._sms(0x7F1, 1, _style) ; // SCI_SETSTYLING
}
; BraceInit(scn, _type) { ; benchmarking for C code equivalent in AHK -- NEW 1 -- avg 13 secs
; Static q := Chr(34)
; startLine := this._sms(0x876, scn.pos, 0) ; // SCI_LINEFROMPOSITION
; startPos := this._sms(0x877, startLine, 0) ; // SCI_POSITIONFROMLINE
; lineLen := this._sms(0x92E, startLine, 0) ; // SCI_LINELENGTH
; endPos := !scn.linesAdded ? startPos + lineLen : scn.pos + scn.length
; chunkLen := endPos - startPos
; docTextRange := this.GetTextRange(startPos, endPos)
;;;;;;;;;;;;;;;;;;;;;;;; , docTextRange := StrSplit(this.GetTextRange(startPos, endPos))
; , style_st := 0, style_check := 0, curPos := startPos, mPos := 0, charWidth := 0
; , SCINT_NONE := 0
; , SCINT_STRING1 := 1
; , SCINT_STRING2 := 2
; , SCINT_COMMENT1 := 3
; , SCINT_COMMENT2 := 4
; , style_type := "", curChar := "", prevChar := "", curStyle := SCINT_NONE
; , com1 := this.SyntaxCommentLine
; , com2a := this.SyntaxCommentBlockA
; , com2b := this.SyntaxCommentBlockB
; , escChar := this.SyntaxEscapeChar
; Loop Parse docTextRange ; A_LoopField per char
;;;;;;;;;;;;;;;;;;;;;;;; For i, curChar in docTextRange
; {
; curPos += charWidth
; , curChar := A_LoopField
; , charWidth := StrPut(curChar,"UTF-8") - 1
;;;;;;;;;;;;;;;;;;;;;;;;; , i := A_Index
;;;;;;;;;;;;;;;;;;;;;;;;; , ahk_pos := curPos + charWidth
; switch (curStyle) {
; case (SCINT_STRING1):
; if ((curChar != q && curPos != endPos-1) || prevChar == escChar) {
; prevChar := curChar
; continue
; }
; this._sms(0x7F0, (style_st), 0) ; // SCI_STARTSTYLING
; , this._sms(0x7F1, (curPos-style_st+1), this.cust.String1.ID) ; // SCI_SETSTYLING
; , curStyle := SCINT_NONE, style_st := 0
; continue
; case (SCINT_STRING2):
; if ((curChar != "'" && curPos != endPos-1) || prevChar == escChar) {
; prevChar := curChar
; continue
; }
; this._sms(0x7F0, (style_st), 0) ; // SCI_STARTSTYLING
; , this._sms(0x7F1, (curPos-style_st+1), this.cust.String2.ID) ; // SCI_SETSTYLING
; , curStyle := SCINT_NONE, style_st := 0
; continue
; case (SCINT_COMMENT1):
; if (curChar = "`n") || (A_Index = chunkLen) {
;;;;;;;;;;;;;;;;;;;;;;;;; if (curChar = "`n") || (i = chunkLen) {
; this._sms(0x7F0, (style_st), 0) ; // SCI_STARTSTYLING
; , this._sms(0x7F1, (curPos-style_st+1), this.cust.Comment1.ID) ; // SCI_SETSTYLING
; , curStyle := SCINT_NONE, style_st := 0
; }
; case (SCINT_COMMENT2):
; com2b_test := SubStr(docTextRange, A_Index, strLen(com2b))
;;;;;;;;;;;;;;;;;;;;;;;;; com2b_test := this.sub_str(docTextRange, i, strLen(com2b))
; if (com2b = com2b_test) {
; this._sms(0x7F0, (style_st), 0) ; // SCI_STARTSTYLING
; , this._sms(0x7F1, (curPos-style_st+strlen(com2b)), this.cust.Comment2.ID) ; // SCI_SETSTYLING
; , curStyle := SCINT_NONE, style_st := 0
; }
; case (SCINT_NONE):
; com1_test := SubStr(docTextRange, A_Index, strLen(com1))
; , com2a_test := SubStr(docTextRange, A_Index, strLen(com2a))
;;;;;;;;;;;;;;;;;;;;;;;;; com1_test := this.sub_str(docTextRange, i, strLen(com1))
;;;;;;;;;;;;;;;;;;;;;;;;; , com2a_test := this.sub_str(docTextRange, i, strLen(com2a))
; if (curChar = q) {
; curStyle := SCINT_STRING1, style_st := curPos
; } else if (curChar = "'") {
; curStyle := SCINT_STRING2, style_st := curPos
;;;;;;;;;;;;;;;;;;;;;;;;; } else if (InStr(docTextRange, com1,, ahk_pos) = ahk_pos) {
; } else if (com1 = com1_test) {
; curStyle := SCINT_COMMENT1, style_st := curPos
; } else if (com2a = com2a_test) {
; curStyle := SCINT_COMMENT2, style_st := curPos
; } else if (instr(this.Brace.Chars, curChar)) {
; this._sms(0x7F0, (curPos), 0) ; // SCI_STARTSTYLING
; , this._sms(0x7F1, 1, this.cust.Brace.ID) ; // SCI_SETSTYLING
; }
; } ; // switch statement
; }
; }
setKeywords(p*) {
Loop 8 {
str := (p.Has(A_Index)) ? " " (this.CaseSense ? Trim(p[A_Index]) : Trim(StrLower(p[A_Index]))) " " : ""
this.kw%A_Index% := str
this.kw%A_Index%_utf8 := Buffer(StrPut(str,"UTF-8"),0)
StrPut(str,this.kw%A_Index%_utf8,"UTF-8")
}
this._wordList := this.makeWordLists()
}
makeWordLists() {
buf := Buffer(8 + (8 * A_PtrSize), 0)
Loop 8
NumPut("Char", this.cust.kw%A_Index%.ID, buf, A_Index - 1)
Loop 8
NumPut("UPtr", this.kw%A_Index%_utf8.ptr, buf, ((A_Index-1) * 8) + 8)
return buf
}
scn_data(scn) { ; prep scn data for DLL call
buf := (A_PtrSize=8) ? Buffer(96,0) : Buffer(60,0)
NumPut("UInt", scn.pos, "UInt", scn.length, "UInt", scn.linesAdded, buf)
NumPut("UChar", this.cust.String1.ID, buf, 16)
NumPut("UChar", this.cust.String2.ID, buf, 17)
NumPut("UChar", this.cust.Comment1.ID, buf, 18)
NumPut("UChar", this.cust.Comment2.ID, buf, 19)
NumPut("UChar", this.cust.Brace.ID, buf, 20)
NumPut("UChar", this.cust.BraceHBad.ID, buf, 21)
NumPut("UChar", this.cust.Punct.ID, buf, 22)
NumPut("UChar", this.cust.Number.ID, buf, 23)
braceStr := Buffer(StrPut(this.Brace.Chars,"UTF-8"),0)
StrPut(this.Brace.Chars,braceStr,"UTF-8")
NumPut("UPtr", braceStr.ptr, buf, 24)
comment1 := Buffer(StrPut(this.SyntaxCommentLine,"UTF-8"),0)
StrPut(this.SyntaxCommentLine,comment1,"UTF-8")
NumPut("UPtr", comment1.ptr, buf, (A_PtrSize=8)?32:28)
comment2a := Buffer(StrPut(this.SyntaxCommentBlockA,"UTF-8"),0)
StrPut(this.SyntaxCommentBlockA,comment2a,"UTF-8")
NumPut("UPtr", comment2a.ptr, buf, (A_PtrSize=8)?40:32)
comment2b := Buffer(StrPut(this.SyntaxCommentBlockB,"UTF-8"),0)
StrPut(this.SyntaxCommentBlockB,comment2b,"UTF-8")
NumPut("UPtr", comment2b.ptr, buf, (A_PtrSize=8)?48:36)
escapeChar := Buffer(StrPut(this.SyntaxEscapeChar,"UTF-8"),0)
StrPut(this.SyntaxEscapeChar,escapeChar,"UTF-8")
NumPut("UPtr", escapeChar.ptr, buf, (A_PtrSize=8)?56:40)
punctChar := Buffer(StrPut(this.SyntaxPunctChars,"UTF-8"),0)
StrPut(this.SyntaxPunctChars,punctChar,"UTF-8")
NumPut("UPtr", punctChar.ptr, buf, (A_PtrSize=8)?64:44)
str1 := Buffer(StrPut(this.SyntaxString1,"UTF-8"),0)
StrPut(this.SyntaxString1,str1,"UTF-8")
NumPut("UPtr", str1.ptr, buf, (A_PtrSize=8)?72:48)
str2 := Buffer(StrPut(this.SyntaxString2,"UTF-8"),0)
StrPut(this.SyntaxString2,str2,"UTF-8")
NumPut("UPtr", str2.ptr, buf, (A_PtrSize=8)?80:52)
wordChars := Buffer(StrPut(this.SyntaxWordChars,"UTF-8"),0)
StrPut(this.SyntaxWordChars,wordChars,"UTF-8")
NumPut("UPtr", wordChars.ptr, buf, (A_PtrSize=8)?88:56)
return buf
}
ChunkColoring(scn, data, wordList) { ; the DLL -- avg = 0.68 secs
result := DllCall("CustomLexer\ChunkColoring","UPtr",data.ptr,"Int",this.loading,"UPtr", wordList.ptr,"Int",this.CaseSense)
this.loading := 0 ; reset "loading" status
return result
}
DeleteRoutine(scn, data) { ; the DLL -- avg = 0.68 secs
return DllCall("CustomLexer\DeleteRoutine", "UPtr", data.ptr)
}
DefaultOpt() {
; this.UseDirect := true
this.Wrap.Mode := 1
this.EndAtLastLine := false ; allow scrolling past last line
this.Caret.PolicyX(13,50) ; SLOP:=1 | EVEN:=8 | STRICT:=4
this.Caret.LineVisible := true ; allow different active line back color
this.Margin.ID := 0 ; number margin
this.Margin.Style(0,33) ; set style .Style(line, style)
this.Margin.Width := 20 ; 20 px number margin
this.Margin.ID := 1
this.Margin.Sensitive := true
this.Tab.Use := false ; use spaces instad of tabs
this.Tab.Width := 4 ; number of spaces for a tab
this.Selection.Multi := true ; allow multli-select, hold CTRL to add selection on left-click
this.Selection.MultiTyping := true ; type during multi-selection
this.Selection.RectModifier := 4 ; alt + drag for rect selection
this.Selection.RectWithMouse := true ; drag + alt also works for rect selection
}
DefaultTheme() {
this.cust.Caret.LineBack := 0x151515 ; active line (with caret)
this.cust.Editor.Back := 0x080808
this.cust.Editor.Fore := 0xAAAAAA
this.cust.Editor.Font := "Consolas"
this.cust.Editor.Size := 12
this.Style.ClearAll() ; apply style 32
this.cust.Margin.Back := 0x202020
this.cust.Margin.Fore := 0xAAAAAA
this.cust.Caret.Fore := 0x00FF00
this.cust.Selection.Back := 0x550000
this.cust.Brace.Fore := 0x0900ff ; basic brace color
this.cust.BraceH.Fore := 0x00FF00 ; brace color highlight
this.cust.BraceHBad.Fore := 0xFF0000 ; brace color bad light
this.cust.Punct.Fore := 0x9090FF
this.cust.String1.Fore := 0x666666
this.cust.String2.Fore := 0x666666
this.cust.Comment1.Fore := 0x008800 ; keeping comment color same
this.cust.Comment2.Fore := 0x008800 ; keeping comment color same
this.cust.Number.Fore := 0xFFFF00
this.cust.kw1.Fore := 0xc94969 ; flow - red - set keyword list colors, kw1 - kw8
this.cust.kw2.Fore := 0x6b66ff ; funcion - blue
this.cust.kw3.Fore := 0xbde03c ; method - light green
this.cust.kw4.Fore := 0xd6f955 ; prop - green ish
this.cust.kw5.Fore := 0xf9c543 ; vars - blueish
this.cust.kw6.Fore := 0xb5b2ff ; directives - blueish
this.cust.kw7.Fore := 0x127782 ; var decl
}
class cust {
__New(sup) {
this.Number := Scintilla.cust.subItem(sup,45)
this.Comment1 := Scintilla.cust.subItem(sup,44)
this.Comment2 := Scintilla.cust.subItem(sup,47)
this.String1 := Scintilla.cust.subItem(sup,43)
this.String2 := Scintilla.cust.subItem(sup,46)
this.Punct := Scintilla.cust.subItem(sup,42)
this.BraceH := Scintilla.cust.subItem(sup,34)
this.BraceHBad := Scintilla.cust.subItem(sup,41)
this.Brace := Scintilla.cust.subItem(sup,40)
this.Selection := sup.Selection
this.Caret := sup.Caret
this.Margin := Scintilla.cust.subItem(sup,33)
this.Editor := Scintilla.cust.subItem(sup,32)
this.kw1 := Scintilla.cust.subItem(sup,64)
this.kw2 := Scintilla.cust.subItem(sup,65)
this.kw3 := Scintilla.cust.subItem(sup,66)
this.kw4 := Scintilla.cust.subItem(sup,67)
this.kw5 := Scintilla.cust.subItem(sup,68)
this.kw6 := Scintilla.cust.subItem(sup,69)
this.kw7 := Scintilla.cust.subItem(sup,70)
this.kw8 := Scintilla.cust.subItem(sup,71)
}
class subItem {
ID := 0, sup := ""
__New(sup,ID) {
this.sup := sup, this.ID := ID
}
Fore {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Fore
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Fore := value
}
}
Back {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Back
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Back := value
}
}
Font {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Font
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Font := value
}
}
Size {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Size
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Size := value
}
}
Italic {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Italic
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Italic := value
}
}
Underline {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Underline
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Underline := value
}
}
Bold {
get {
this.sup.Style.ID := this.ID
return this.sup.Style.Bold
}
set {
this.sup.Style.ID := this.ID
this.sup.Style.Bold := value
}
}
}
}
; =========================================================================================
; I might not bother with these (for a while, or at all):
; =========================================================================================
; SCI_ADDTEXT -> redundant, AppendText offers more control and makes more sense.
; SCI_ADDSTYLEDTEXT -> i might...
; SCI_CHARPOSITIONFROMPOINT
; SCI_CHARPOSITIONFROMPOINTCLOSE
; SCI_GETLINESELSTARTPOSITION -> using multi-select
; SCI_GETLINESELENDPOSITION -> using multi-select
; SCI_GETSELTEXT -> i'll use text ranges instead from multi-select
; SCI_GETSELECTIONSTART / SCI_GETSELECTIONEND -> using multi-select
; SCI_SETSELECTIONSTART / SCI_SETSELECTIONEND -> using multi-select
; SCI_GETSTYLEDTEXT -> i might...
; SCI_GETANCHOR / SCI_SETANCHOR -> using multi-select
; SCI_HIDESELECTION
; SCI_MOVECARETINSIDEVIEW
; SCI_SETSEL -> using multi-select
; SCI_TEXTHEIGHT
; SCI_POSITIONBEFORE