Line Filter
Check-in [283cb61474]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Source as released by Merijn
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:283cb6147461f5710ad58de5e24d209745143029
User & Date: tinus 2013-02-21 22:50:19
Context
2013-02-21
22:50
Source as released by Merijn Leaf check-in: 283cb61474 user: tinus tags: trunk
22:23
initial empty check-in check-in: 96906f7016 user: tinus tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added src/AdvancedSearch.dfm.











































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
object FormAdvancedSearch: TFormAdvancedSearch
  Left = 0
  Top = 0
  BorderStyle = bsToolWindow
  Caption = 'advanced search'
  ClientHeight = 546
  ClientWidth = 338
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  FormStyle = fsStayOnTop
  OldCreateOrder = False
  Position = poScreenCenter
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object ButtonOK: TButton
    Left = 260
    Top = 513
    Width = 75
    Height = 25
    Caption = 'OK'
    Default = True
    ModalResult = 1
    TabOrder = 0
  end
  object ButtonCancel: TButton
    Left = 176
    Top = 513
    Width = 75
    Height = 25
    Cancel = True
    Caption = 'Cancel'
    ModalResult = 2
    TabOrder = 1
    OnClick = ButtonCancelClick
  end
  object GroupBoxIncludes: TGroupBox
    AlignWithMargins = True
    Left = 3
    Top = 3
    Width = 332
    Height = 153
    Align = alTop
    Caption = ' lines include '
    TabOrder = 2
    object MemoInclude: TMemo
      AlignWithMargins = True
      Left = 5
      Top = 18
      Width = 322
      Height = 130
      Align = alClient
      BevelInner = bvNone
      BevelOuter = bvNone
      BorderStyle = bsNone
      Color = clWhite
      TabOrder = 0
    end
  end
  object GroupBoxNoInclude: TGroupBox
    AlignWithMargins = True
    Left = 3
    Top = 162
    Width = 332
    Height = 153
    Align = alTop
    Caption = ' lines do not include '
    TabOrder = 3
    object MemoNoInclude: TMemo
      AlignWithMargins = True
      Left = 5
      Top = 18
      Width = 322
      Height = 130
      Align = alClient
      BevelInner = bvNone
      BevelOuter = bvNone
      BorderStyle = bsNone
      Color = clWhite
      TabOrder = 0
    end
  end
  object PanelOutput: TPanel
    Left = 0
    Top = 414
    Width = 338
    Height = 83
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 4
    object Label1: TLabel
      Left = 8
      Top = 13
      Width = 36
      Height = 13
      Caption = 'output:'
    end
    object RadioButtonOutputToCurrent: TRadioButton
      Left = 18
      Top = 33
      Width = 233
      Height = 17
      Caption = 'current file (hide/show lines)'
      Checked = True
      TabOrder = 0
      TabStop = True
    end
    object RadioButtonOutputToNew: TRadioButton
      Left = 18
      Top = 50
      Width = 233
      Height = 17
      Caption = 'new file'
      TabOrder = 1
    end
  end
  object PanelSearch: TPanel
    Left = 0
    Top = 318
    Width = 338
    Height = 96
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 5
    object Label2: TLabel
      Left = 8
      Top = 13
      Width = 36
      Height = 13
      Caption = 'search:'
    end
    object RadioButtonSearchLiteral: TRadioButton
      Left = 18
      Top = 33
      Width = 233
      Height = 17
      Caption = 'literal'
      Checked = True
      TabOrder = 0
      TabStop = True
    end
    object RadioButtonSearchExtended: TRadioButton
      Left = 18
      Top = 50
      Width = 83
      Height = 17
      Caption = 'extended'
      ParentShowHint = False
      ShowHint = False
      TabOrder = 1
    end
    object RadioButtonSearchRegex: TRadioButton
      Left = 18
      Top = 67
      Width = 119
      Height = 17
      Caption = 'regular expression'
      TabOrder = 2
    end
  end
end

Added src/AdvancedSearch.pas.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
unit AdvancedSearch;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ToolTips;

type
  TFormAdvancedSearch = class(TForm)
    ButtonOK: TButton;
    ButtonCancel: TButton;
    GroupBoxIncludes: TGroupBox;
    MemoInclude: TMemo;
    GroupBoxNoInclude: TGroupBox;
    MemoNoInclude: TMemo;
    PanelOutput: TPanel;
    Label1: TLabel;
    RadioButtonOutputToCurrent: TRadioButton;
    RadioButtonOutputToNew: TRadioButton;
    PanelSearch: TPanel;
    Label2: TLabel;
    RadioButtonSearchLiteral: TRadioButton;
    RadioButtonSearchExtended: TRadioButton;
    RadioButtonSearchRegex: TRadioButton;
    procedure ButtonCancelClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
   fExtendedBalloon: TBalloonToolTipControl;
   fExtendedTooltip: TToolTip;
  public
    { Public declarations }
  end;

implementation



{$R *.dfm}

procedure TFormAdvancedSearch.ButtonCancelClick(Sender: TObject);
begin
 Close();
end;

procedure TFormAdvancedSearch.FormCreate(Sender: TObject);
begin
 fExtendedBalloon := TBalloonToolTipControl.Create(Self);
 fExtendedBalloon.Icon := ttiInfo;
 fExtendedBalloon.Title := 'extended search';
 fExtendedBalloon.InitialTime := 10;
 fExtendedBalloon.AutoPopTime := 10000;

 fExtendedTooltip := TToolTip.Create(RadioButtonSearchExtended);

 fExtendedTooltip.Text := #13#10 +
                          'extended search gives extra searching options:' + #13#10 +
                          #13#10 +
                          '  \t  tab character' + #13#10 +
                          '  \\  backslash' + #13#10 +
                          '  \Hxx  any hexidecimal character';

 fExtendedBalloon.Add(fExtendedTooltip);
end;

end.

Added src/NPP Plugin.bdsproj.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
	<PersonalityInfo>
		<Option>
			<Option Name="Personality">Delphi.Personality</Option>
			<Option Name="ProjectType">VCLApplication</Option>
			<Option Name="Version">1.0</Option>
			<Option Name="GUID">{B53DE5B9-8379-4410-9A8C-6DDE6C18A441}</Option>
		</Option>
	</PersonalityInfo>
	<Delphi.Personality>
		<Source>
			<Source Name="MainSource">NPP Plugin.dpr</Source>
		</Source>
		<FileVersion>
			<FileVersion Name="Version">7.0</FileVersion>
		</FileVersion>
		<Compiler>
			<Compiler Name="A">8</Compiler>
			<Compiler Name="B">0</Compiler>
			<Compiler Name="C">0</Compiler>
			<Compiler Name="D">1</Compiler>
			<Compiler Name="E">0</Compiler>
			<Compiler Name="F">0</Compiler>
			<Compiler Name="G">1</Compiler>
			<Compiler Name="H">1</Compiler>
			<Compiler Name="I">1</Compiler>
			<Compiler Name="J">0</Compiler>
			<Compiler Name="K">0</Compiler>
			<Compiler Name="L">1</Compiler>
			<Compiler Name="M">0</Compiler>
			<Compiler Name="N">1</Compiler>
			<Compiler Name="O">0</Compiler>
			<Compiler Name="P">1</Compiler>
			<Compiler Name="Q">0</Compiler>
			<Compiler Name="R">0</Compiler>
			<Compiler Name="S">0</Compiler>
			<Compiler Name="T">0</Compiler>
			<Compiler Name="U">0</Compiler>
			<Compiler Name="V">1</Compiler>
			<Compiler Name="W">0</Compiler>
			<Compiler Name="X">1</Compiler>
			<Compiler Name="Y">2</Compiler>
			<Compiler Name="Z">1</Compiler>
			<Compiler Name="ShowHints">True</Compiler>
			<Compiler Name="ShowWarnings">True</Compiler>
			<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
			<Compiler Name="NamespacePrefix"></Compiler>
			<Compiler Name="GenerateDocumentation">False</Compiler>
			<Compiler Name="DefaultNamespace"></Compiler>
			<Compiler Name="SymbolDeprecated">False</Compiler>
			<Compiler Name="SymbolLibrary">True</Compiler>
			<Compiler Name="SymbolPlatform">True</Compiler>
			<Compiler Name="SymbolExperimental">True</Compiler>
			<Compiler Name="UnitLibrary">True</Compiler>
			<Compiler Name="UnitPlatform">True</Compiler>
			<Compiler Name="UnitDeprecated">True</Compiler>
			<Compiler Name="UnitExperimental">True</Compiler>
			<Compiler Name="HResultCompat">True</Compiler>
			<Compiler Name="HidingMember">True</Compiler>
			<Compiler Name="HiddenVirtual">True</Compiler>
			<Compiler Name="Garbage">True</Compiler>
			<Compiler Name="BoundsError">True</Compiler>
			<Compiler Name="ZeroNilCompat">True</Compiler>
			<Compiler Name="StringConstTruncated">True</Compiler>
			<Compiler Name="ForLoopVarVarPar">True</Compiler>
			<Compiler Name="TypedConstVarPar">True</Compiler>
			<Compiler Name="AsgToTypedConst">True</Compiler>
			<Compiler Name="CaseLabelRange">True</Compiler>
			<Compiler Name="ForVariable">True</Compiler>
			<Compiler Name="ConstructingAbstract">True</Compiler>
			<Compiler Name="ComparisonFalse">True</Compiler>
			<Compiler Name="ComparisonTrue">True</Compiler>
			<Compiler Name="ComparingSignedUnsigned">True</Compiler>
			<Compiler Name="CombiningSignedUnsigned">True</Compiler>
			<Compiler Name="UnsupportedConstruct">True</Compiler>
			<Compiler Name="FileOpen">True</Compiler>
			<Compiler Name="FileOpenUnitSrc">True</Compiler>
			<Compiler Name="BadGlobalSymbol">True</Compiler>
			<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
			<Compiler Name="InvalidDirective">True</Compiler>
			<Compiler Name="PackageNoLink">True</Compiler>
			<Compiler Name="PackageThreadVar">True</Compiler>
			<Compiler Name="ImplicitImport">True</Compiler>
			<Compiler Name="HPPEMITIgnored">True</Compiler>
			<Compiler Name="NoRetVal">True</Compiler>
			<Compiler Name="UseBeforeDef">True</Compiler>
			<Compiler Name="ForLoopVarUndef">True</Compiler>
			<Compiler Name="UnitNameMismatch">True</Compiler>
			<Compiler Name="NoCFGFileFound">True</Compiler>
			<Compiler Name="ImplicitVariants">True</Compiler>
			<Compiler Name="UnicodeToLocale">True</Compiler>
			<Compiler Name="LocaleToUnicode">True</Compiler>
			<Compiler Name="ImagebaseMultiple">True</Compiler>
			<Compiler Name="SuspiciousTypecast">True</Compiler>
			<Compiler Name="PrivatePropAccessor">True</Compiler>
			<Compiler Name="UnsafeType">False</Compiler>
			<Compiler Name="UnsafeCode">False</Compiler>
			<Compiler Name="UnsafeCast">False</Compiler>
			<Compiler Name="OptionTruncated">True</Compiler>
			<Compiler Name="WideCharReduced">True</Compiler>
			<Compiler Name="DuplicatesIgnored">True</Compiler>
			<Compiler Name="UnitInitSeq">True</Compiler>
			<Compiler Name="LocalPInvoke">True</Compiler>
			<Compiler Name="MessageDirective">True</Compiler>
			<Compiler Name="CodePage"></Compiler>
		</Compiler>
		<Linker>
			<Linker Name="MapFile">3</Linker>
			<Linker Name="OutputObjs">0</Linker>
			<Linker Name="GenerateHpps">False</Linker>
			<Linker Name="ConsoleApp">1</Linker>
			<Linker Name="DebugInfo">False</Linker>
			<Linker Name="RemoteSymbols">False</Linker>
			<Linker Name="GenerateDRC">False</Linker>
			<Linker Name="MinStackSize">16384</Linker>
			<Linker Name="MaxStackSize">1048576</Linker>
			<Linker Name="ImageBase">4194304</Linker>
			<Linker Name="ExeDescription"></Linker>
		</Linker>
		<Directories>
			<Directories Name="OutputDir"></Directories>
			<Directories Name="UnitOutputDir"></Directories>
			<Directories Name="PackageDLLOutputDir"></Directories>
			<Directories Name="PackageDCPOutputDir"></Directories>
			<Directories Name="SearchPath">delphisci</Directories>
			<Directories Name="Packages">vclx;vcl;rtl;indy;dsnapcon;dsnap;dbrtl;vcldb;VclSmp;adortl;bdertl;vcldbx;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;dclOfficeXP</Directories>
			<Directories Name="Conditionals">EUREKALOG;EUREKALOG_VER6</Directories>
			<Directories Name="DebugSourceDirs"></Directories>
			<Directories Name="UsePackages">False</Directories>
		</Directories>
		<Parameters>
			<Parameters Name="RunParams"></Parameters>
			<Parameters Name="HostApplication">d:\apps\Notepad++\notepad++.exe</Parameters>
			<Parameters Name="Launcher"></Parameters>
			<Parameters Name="UseLauncher">False</Parameters>
			<Parameters Name="DebugCWD"></Parameters>
			<Parameters Name="Debug Symbols Search Path"></Parameters>
			<Parameters Name="LoadAllSymbols">True</Parameters>
			<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
		</Parameters>
		<Language>
			<Language Name="ActiveLang"></Language>
			<Language Name="ProjectLang">$00000000</Language>
			<Language Name="RootDir"></Language>
		</Language>
		<VersionInfo>
			<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
			<VersionInfo Name="AutoIncBuild">False</VersionInfo>
			<VersionInfo Name="MajorVer">2</VersionInfo>
			<VersionInfo Name="MinorVer">9</VersionInfo>
			<VersionInfo Name="Release">0</VersionInfo>
			<VersionInfo Name="Build">2</VersionInfo>
			<VersionInfo Name="Debug">False</VersionInfo>
			<VersionInfo Name="PreRelease">False</VersionInfo>
			<VersionInfo Name="Special">False</VersionInfo>
			<VersionInfo Name="Private">False</VersionInfo>
			<VersionInfo Name="DLL">False</VersionInfo>
			<VersionInfo Name="Locale">1033</VersionInfo>
			<VersionInfo Name="CodePage">1252</VersionInfo>
		</VersionInfo>
		<VersionInfoKeys>
			<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
			<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
			<VersionInfoKeys Name="FileVersion">2.9.0.2</VersionInfoKeys>
			<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
			<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
			<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
			<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
			<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
			<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
			<VersionInfoKeys Name="Comments"></VersionInfoKeys>
		</VersionInfoKeys>
	</Delphi.Personality>
<!-- EurekaLog First Line
[Exception Log]
EurekaLog Version=6104
Activate=1
Activate Handle=1
Save Log File=1
Foreground Tab=0
Freeze Activate=0
Freeze Timeout=60
SMTP From=eurekalog@email.com
SMTP Host=
SMTP Port=25
SMTP UserID=
SMTP Password=
Append to Log=0
TerminateBtn Operation=1
Errors Number=32
Errors Terminate=3
Email Address=
Email Object=
Email Send Options=0
Output Path=
Encrypt Password=
AutoCloseDialogSecs=0
WebSendMode=0
SupportULR=
HTMLLayout Count=15
HTMLLine0="%3Chtml%3E"
HTMLLine1="  %3Chead%3E"
HTMLLine2="  %3C/head%3E"
HTMLLine3="  %3Cbody TopMargin=10 LeftMargin=10%3E"
HTMLLine4="    %3Ctable width="100%%" border="0"%3E"
HTMLLine5="      %3Ctr%3E"
HTMLLine6="        %3Ctd nowrap%3E"
HTMLLine7="          %3Cfont face="Lucida Console, Courier" size="2"%3E"
HTMLLine8="            %3C%%HTML_TAG%%%3E"
HTMLLine9="          %3C/font%3E"
HTMLLine10="        %3C/td%3E"
HTMLLine11="      %3C/tr%3E"
HTMLLine12="    %3C/table%3E"
HTMLLine13="  %3C/body%3E"
HTMLLine14="%3C/html%3E"
AutoCrashOperation=1
AutoCrashNumber=10
AutoCrashMinutes=1
WebURL=
WebUserID=
WebPassword=
WebPort=0
AttachedFiles=
ProxyURL=
ProxyUser=
ProxyPassword=
ProxyPort=8080
TrakerUser=
TrakerPassword=
TrakerAssignTo=
TrakerProject=
TrakerCategory=
TrakerTrialID=
ZipPassword=
PreBuildEvent=
PostSuccessfulBuildEvent=
PostFailureBuildEvent=
ExceptionDialogType=2
Count=0
EMail Message Line Count=0
loNoDuplicateErrors=0
loAppendReproduceText=0
loDeleteLogAtVersionChange=0
loAddComputerNameInLogFileName=0
loSaveModulesAndProcessesSections=1
loSaveAssemblerAndCPUSections=1
soAppStartDate=1
soAppName=1
soAppVersionNumber=1
soAppParameters=1
soAppCompilationDate=1
soAppUpTime=1
soExcDate=1
soExcAddress=1
soExcModuleName=1
soExcModuleVersion=1
soExcType=1
soExcMessage=1
soExcID=1
soExcCount=1
soExcStatus=1
soExcNote=1
soUserID=1
soUserName=1
soUserEmail=1
soUserPrivileges=1
soUserCompany=1
soActCtlsFormClass=1
soActCtlsFormText=1
soActCtlsControlClass=1
soActCtlsControlText=1
soCmpName=1
soCmpTotalMemory=1
soCmpFreeMemory=1
soCmpTotalDisk=1
soCmpFreeDisk=1
soCmpSysUpTime=1
soCmpProcessor=1
soCmpDisplayMode=1
soCmpDisplayDPI=1
soCmpVideoCard=1
soCmpPrinter=1
soOSType=1
soOSBuildN=1
soOSUpdate=1
soOSLanguage=1
soOSCharset=1
soNetIP=1
soNetSubmask=1
soNetGateway=1
soNetDNS1=1
soNetDNS2=1
soNetDHCP=1
soCustomData=1
sndShowSendDialog=1
sndShowSuccessFailureMsg=0
sndSendEntireLog=0
sndSendXMLLogCopy=0
sndSendScreenshot=0
sndUseOnlyActiveWindow=0
sndSendLastHTMLPage=1
sndSendInSeparatedThread=0
sndAddDateInFileName=0
sndAddComputerNameInFileName=0
edoSendErrorReportChecked=1
edoAttachScreenshotChecked=1
edoShowCopyToClipOption=1
edoShowDetailsButton=1
edoShowInDetailedMode=0
edoShowInTopMostMode=1
edoUseEurekaLogLookAndFeel=1
edoShowSendErrorReportOption=1
edoShowAttachScreenshotOption=1
edoShowCustomButton=0
csoShowDLLs=1
csoShowBPLs=1
csoShowBorlandThreads=1
csoShowWindowsThreads=1
csoDoNotStoreProcNames=0
boPauseBorlandThreads=1
boDoNotPauseMainThread=0
boPauseWindowsThreads=1
boUseMainModuleOptions=1
boCopyLogInCaseOfError=1
boSaveCompressedCopyInCaseOfError=0
boHandleSafeCallExceptions=0
boCallRTLExceptionEvent=0
boCatchHandledExceptions=0
loCatchLeaks=0
loGroupsSonLeaks=1
loHideBorlandLeaks=1
loFreeAllLeaks=1
loCatchLeaksExceptions=1
cfoReduceFileSize=1
cfoCheckFileCorruption=0
Count mtInformationMsgCaption=1
mtInformationMsgCaption0="Information."
Count mtQuestionMsgCaption=1
mtQuestionMsgCaption0="Question."
Count mtErrorMsgCaption=1
mtErrorMsgCaption0="Error."
Count mtDialog_Caption=1
mtDialog_Caption0="Error occurred"
Count mtDialog_ErrorMsgCaption=2
mtDialog_ErrorMsgCaption0="An error has occurred during program execution."
mtDialog_ErrorMsgCaption1="Please read the following information for further details."
Count mtDialog_GeneralCaption=1
mtDialog_GeneralCaption0="General"
Count mtDialog_GeneralHeader=1
mtDialog_GeneralHeader0="General Information"
Count mtDialog_CallStackCaption=1
mtDialog_CallStackCaption0="Call Stack"
Count mtDialog_CallStackHeader=1
mtDialog_CallStackHeader0="Call Stack Information"
Count mtDialog_ModulesCaption=1
mtDialog_ModulesCaption0="Modules"
Count mtDialog_ModulesHeader=1
mtDialog_ModulesHeader0="Modules Information"
Count mtDialog_ProcessesCaption=1
mtDialog_ProcessesCaption0="Processes"
Count mtDialog_ProcessesHeader=1
mtDialog_ProcessesHeader0="Processes Information"
Count mtDialog_AsmCaption=1
mtDialog_AsmCaption0="Assembler"
Count mtDialog_AsmHeader=1
mtDialog_AsmHeader0="Assembler Information"
Count mtDialog_CPUCaption=1
mtDialog_CPUCaption0="CPU"
Count mtDialog_CPUHeader=1
mtDialog_CPUHeader0="CPU Information"
Count mtDialog_OKButtonCaption=1
mtDialog_OKButtonCaption0="%26OK"
Count mtDialog_TerminateButtonCaption=1
mtDialog_TerminateButtonCaption0="%26Terminate"
Count mtDialog_RestartButtonCaption=1
mtDialog_RestartButtonCaption0="%26Restart"
Count mtDialog_DetailsButtonCaption=1
mtDialog_DetailsButtonCaption0="%26Details"
Count mtDialog_CustomButtonCaption=1
mtDialog_CustomButtonCaption0="%26Help"
Count mtDialog_SendMessage=1
mtDialog_SendMessage0="%26Send this error via Internet"
Count mtDialog_ScreenshotMessage=1
mtDialog_ScreenshotMessage0="%26Attach a Screenshot image"
Count mtDialog_CopyMessage=1
mtDialog_CopyMessage0="%26Copy to Clipboard"
Count mtDialog_SupportMessage=1
mtDialog_SupportMessage0="Go to the Support Page"
Count mtMSDialog_ErrorMsgCaption=1
mtMSDialog_ErrorMsgCaption0="The application has encountered a problem. We are sorry for the inconvenience."
Count mtMSDialog_RestartCaption=1
mtMSDialog_RestartCaption0="Restart application."
Count mtMSDialog_TerminateCaption=1
mtMSDialog_TerminateCaption0="Terminate application."
Count mtMSDialog_PleaseCaption=1
mtMSDialog_PleaseCaption0="Please tell us about this problem."
Count mtMSDialog_DescriptionCaption=1
mtMSDialog_DescriptionCaption0="We have created an error report that you can send to us. We will treat this report as confidential and anonymous."
Count mtMSDialog_SeeDetailsCaption=1
mtMSDialog_SeeDetailsCaption0="To see what data the error report contains,"
Count mtMSDialog_SeeClickCaption=1
mtMSDialog_SeeClickCaption0="click here."
Count mtMSDialog_HowToReproduceCaption=1
mtMSDialog_HowToReproduceCaption0="What were you doing when the problem happended (optional)?"
Count mtMSDialog_EmailCaption=1
mtMSDialog_EmailCaption0="Email address (optional):"
Count mtMSDialog_SendButtonCaption=1
mtMSDialog_SendButtonCaption0="%26Send Error Report"
Count mtMSDialog_NoSendButtonCaption=1
mtMSDialog_NoSendButtonCaption0="%26Don't Send"
Count mtLog_AppHeader=1
mtLog_AppHeader0="Application"
Count mtLog_AppStartDate=1
mtLog_AppStartDate0="Start Date"
Count mtLog_AppName=1
mtLog_AppName0="Name/Description"
Count mtLog_AppVersionNumber=1
mtLog_AppVersionNumber0="Version Number"
Count mtLog_AppParameters=1
mtLog_AppParameters0="Parameters"
Count mtLog_AppCompilationDate=1
mtLog_AppCompilationDate0="Compilation Date"
Count mtLog_AppUpTime=1
mtLog_AppUpTime0="Up Time"
Count mtLog_ExcHeader=1
mtLog_ExcHeader0="Exception"
Count mtLog_ExcDate=1
mtLog_ExcDate0="Date"
Count mtLog_ExcAddress=1
mtLog_ExcAddress0="Address"
Count mtLog_ExcModuleName=1
mtLog_ExcModuleName0="Module Name"
Count mtLog_ExcModuleVersion=1
mtLog_ExcModuleVersion0="Module Version"
Count mtLog_ExcType=1
mtLog_ExcType0="Type"
Count mtLog_ExcMessage=1
mtLog_ExcMessage0="Message"
Count mtLog_ExcID=1
mtLog_ExcID0="ID"
Count mtLog_ExcCount=1
mtLog_ExcCount0="Count"
Count mtLog_ExcStatus=1
mtLog_ExcStatus0="Status"
Count mtLog_ExcNote=1
mtLog_ExcNote0="Note"
Count mtLog_UserHeader=1
mtLog_UserHeader0="User"
Count mtLog_UserID=1
mtLog_UserID0="ID"
Count mtLog_UserName=1
mtLog_UserName0="Name"
Count mtLog_UserEmail=1
mtLog_UserEmail0="Email"
Count mtLog_UserCompany=1
mtLog_UserCompany0="Company"
Count mtLog_UserPrivileges=1
mtLog_UserPrivileges0="Privileges"
Count mtLog_ActCtrlsHeader=1
mtLog_ActCtrlsHeader0="Active Controls"
Count mtLog_ActCtrlsFormClass=1
mtLog_ActCtrlsFormClass0="Form Class"
Count mtLog_ActCtrlsFormText=1
mtLog_ActCtrlsFormText0="Form Text"
Count mtLog_ActCtrlsControlClass=1
mtLog_ActCtrlsControlClass0="Control Class"
Count mtLog_ActCtrlsControlText=1
mtLog_ActCtrlsControlText0="Control Text"
Count mtLog_CmpHeader=1
mtLog_CmpHeader0="Computer"
Count mtLog_CmpName=1
mtLog_CmpName0="Name"
Count mtLog_CmpTotalMemory=1
mtLog_CmpTotalMemory0="Total Memory"
Count mtLog_CmpFreeMemory=1
mtLog_CmpFreeMemory0="Free Memory"
Count mtLog_CmpTotalDisk=1
mtLog_CmpTotalDisk0="Total Disk"
Count mtLog_CmpFreeDisk=1
mtLog_CmpFreeDisk0="Free Disk"
Count mtLog_CmpSystemUpTime=1
mtLog_CmpSystemUpTime0="System Up Time"
Count mtLog_CmpProcessor=1
mtLog_CmpProcessor0="Processor"
Count mtLog_CmpDisplayMode=1
mtLog_CmpDisplayMode0="Display Mode"
Count mtLog_CmpDisplayDPI=1
mtLog_CmpDisplayDPI0="Display DPI"
Count mtLog_CmpVideoCard=1
mtLog_CmpVideoCard0="Video Card"
Count mtLog_CmpPrinter=1
mtLog_CmpPrinter0="Printer"
Count mtLog_OSHeader=1
mtLog_OSHeader0="Operating System"
Count mtLog_OSType=1
mtLog_OSType0="Type"
Count mtLog_OSBuildN=1
mtLog_OSBuildN0="Build #"
Count mtLog_OSUpdate=1
mtLog_OSUpdate0="Update"
Count mtLog_OSLanguage=1
mtLog_OSLanguage0="Language"
Count mtLog_OSCharset=1
mtLog_OSCharset0="Charset"
Count mtLog_NetHeader=1
mtLog_NetHeader0="Network"
Count mtLog_NetIP=1
mtLog_NetIP0="IP Address"
Count mtLog_NetSubmask=1
mtLog_NetSubmask0="Submask"
Count mtLog_NetGateway=1
mtLog_NetGateway0="Gateway"
Count mtLog_NetDNS1=1
mtLog_NetDNS10="DNS 1"
Count mtLog_NetDNS2=1
mtLog_NetDNS20="DNS 2"
Count mtLog_NetDHCP=1
mtLog_NetDHCP0="DHCP"
Count mtLog_CustInfoHeader=1
mtLog_CustInfoHeader0="Custom Information"
Count mtCallStack_Address=1
mtCallStack_Address0="Address"
Count mtCallStack_Name=1
mtCallStack_Name0="Module"
Count mtCallStack_Unit=1
mtCallStack_Unit0="Unit"
Count mtCallStack_Class=1
mtCallStack_Class0="Class"
Count mtCallStack_Procedure=1
mtCallStack_Procedure0="Procedure/Method"
Count mtCallStack_Line=1
mtCallStack_Line0="Line"
Count mtCallStack_MainThread=1
mtCallStack_MainThread0="Main"
Count mtCallStack_ExceptionThread=1
mtCallStack_ExceptionThread0="Exception Thread"
Count mtCallStack_RunningThread=1
mtCallStack_RunningThread0="Running Thread"
Count mtCallStack_CallingThread=1
mtCallStack_CallingThread0="Calling Thread"
Count mtCallStack_ThreadID=1
mtCallStack_ThreadID0="ID"
Count mtCallStack_ThreadPriority=1
mtCallStack_ThreadPriority0="Priority"
Count mtCallStack_ThreadClass=1
mtCallStack_ThreadClass0="Class"
Count mtCallStack_LeakCaption=1
mtCallStack_LeakCaption0="Memory Leak"
Count mtCallStack_LeakData=1
mtCallStack_LeakData0="Data"
Count mtCallStack_LeakType=1
mtCallStack_LeakType0="Type"
Count mtCallStack_LeakSize=1
mtCallStack_LeakSize0="Total size"
Count mtCallStack_LeakCount=1
mtCallStack_LeakCount0="Count"
Count mtSendDialog_Caption=1
mtSendDialog_Caption0="Send."
Count mtSendDialog_Message=1
mtSendDialog_Message0="Message"
Count mtSendDialog_Resolving=1
mtSendDialog_Resolving0="Resolving DNS..."
Count mtSendDialog_Login=1
mtSendDialog_Login0="Login..."
Count mtSendDialog_Connecting=1
mtSendDialog_Connecting0="Connecting with server..."
Count mtSendDialog_Connected=1
mtSendDialog_Connected0="Connected with server."
Count mtSendDialog_Sending=1
mtSendDialog_Sending0="Sending message..."
Count mtSendDialog_Sent=1
mtSendDialog_Sent0="Message sent."
Count mtSendDialog_SelectProject=1
mtSendDialog_SelectProject0="Select project..."
Count mtSendDialog_Searching=1
mtSendDialog_Searching0="Searching..."
Count mtSendDialog_Modifying=1
mtSendDialog_Modifying0="Modifying..."
Count mtSendDialog_Disconnecting=1
mtSendDialog_Disconnecting0="Disconnecting..."
Count mtSendDialog_Disconnected=1
mtSendDialog_Disconnected0="Disconnected."
Count mtReproduceDialog_Caption=1
mtReproduceDialog_Caption0="Request"
Count mtReproduceDialog_Request=1
mtReproduceDialog_Request0="Please describe the steps to reproduce the error:"
Count mtReproduceDialog_OKButtonCaption=1
mtReproduceDialog_OKButtonCaption0="%26OK"
Count mtModules_Handle=1
mtModules_Handle0="Handle"
Count mtModules_Name=1
mtModules_Name0="Name"
Count mtModules_Description=1
mtModules_Description0="Description"
Count mtModules_Version=1
mtModules_Version0="Version"
Count mtModules_Size=1
mtModules_Size0="Size"
Count mtModules_LastModified=1
mtModules_LastModified0="Modified"
Count mtModules_Path=1
mtModules_Path0="Path"
Count mtProcesses_ID=1
mtProcesses_ID0="ID"
Count mtProcesses_Name=1
mtProcesses_Name0="Name"
Count mtProcesses_Description=1
mtProcesses_Description0="Description"
Count mtProcesses_Version=1
mtProcesses_Version0="Version"
Count mtProcesses_Memory=1
mtProcesses_Memory0="Memory"
Count mtProcesses_Priority=1
mtProcesses_Priority0="Priority"
Count mtProcesses_Threads=1
mtProcesses_Threads0="Threads"
Count mtProcesses_Path=1
mtProcesses_Path0="Path"
Count mtCPU_Registers=1
mtCPU_Registers0="Registers"
Count mtCPU_Stack=1
mtCPU_Stack0="Stack"
Count mtCPU_MemoryDump=1
mtCPU_MemoryDump0="Memory Dump"
Count mtSend_SuccessMsg=1
mtSend_SuccessMsg0="The message was sent successfully."
Count mtSend_FailureMsg=1
mtSend_FailureMsg0="Sorry, sending the message didn't work."
Count mtSend_BugClosedMsg=2
mtSend_BugClosedMsg0="These BUG is just closed."
mtSend_BugClosedMsg1="Contact the program support to obtain an update."
Count mtSend_UnknownErrorMsg=1
mtSend_UnknownErrorMsg0="Unknown error."
Count mtSend_InvalidLoginMsg=1
mtSend_InvalidLoginMsg0="Invalid login request."
Count mtSend_InvalidSearchMsg=1
mtSend_InvalidSearchMsg0="Invalid search request."
Count mtSend_InvalidSelectionMsg=1
mtSend_InvalidSelectionMsg0="Invalid selection request."
Count mtSend_InvalidInsertMsg=1
mtSend_InvalidInsertMsg0="Invalid insert request."
Count mtSend_InvalidModifyMsg=1
mtSend_InvalidModifyMsg0="Invalid modify request."
Count mtFileCrackedMsg=2
mtFileCrackedMsg0="This file is cracked."
mtFileCrackedMsg1="The application will be closed."
Count mtException_LeakMultiFree=1
mtException_LeakMultiFree0="Multi Free memory leak."
Count mtException_LeakMemoryOverrun=1
mtException_LeakMemoryOverrun0="Memory Overrun leak."
Count mtException_AntiFreeze=1
mtException_AntiFreeze0="The application seems to be frozen."
Count mtInvalidEmailMsg=1
mtInvalidEmailMsg0="Invalid email."
TextsCollection=
cfoUseEL7=0
EurekaLog Last Line -->
</BorlandProject>

Added src/NPP Plugin.cfg.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
-$A8
-$B-
-$C-
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O-
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$Y+
-$Z1
-GD
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"C:\Users\Merijn\Documents\Borland Studio Projects\Bpl"
-LN"C:\Users\Merijn\Documents\Borland Studio Projects\Bpl"
-U"delphisci"
-O"delphisci"
-I"delphisci"
-R"delphisci"
-DEUREKALOG;EUREKALOG_VER6
-w-SYMBOL_DEPRECATED
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

Added src/NPP Plugin.dpr.





































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
library DllEntry;

uses
  ExceptionLog,
  Forms,
  SysUtils,
  Windows,
  Dialogs,
  Controls,
  Classes,
  SCIInterface,
  Messages,
  QStrings,
  NPPInterface in 'NPPInterface.pas',
  Progress in 'Progress.pas' {FormProgress},
  AdvancedSearch in 'AdvancedSearch.pas' {FormAdvancedSearch};

type RNPPData = record
      _nppHandle: HWND;
      _scintillaMainHandle: HWND;
      _scintillaSecondHandle: HWND;
     end;

     TProc = procedure; cdecl;

     RFuncItem = record
      _itemName: array[0..63] of widechar;
      _pFunc: TProc;
      _cmdID: integer;
      _init2Check: integer;
      _PShKey: pointer;
     end;

     TFilterType = (ftKeep, ftRemove);

var NPPData: RNPPData;

    FuncItems: array of RFuncItem;

    fSCIInterface: TSCIInterface;
    fNPPInterface: TNPPInterface;
    fFormSearchParams: TFormAdvancedSearch;


procedure DoFilter(FilterType: TFilterType);
var i: integer;
    LineCount: integer;
    SubStrPos: integer;
    CurLine: string;
    SelText: string;
    FilteredData: string;
    Progress: TFormProgress;
begin
 Progress := nil;

 try
  SelText := fSCIInterface.SelText;

  if SelText <> '' then
  begin
   LineCount := fSCIInterface.LineCount;

   Progress := TFormProgress.Create(nil);
   Progress.Show();
   Progress.ProgressBar.Max := LineCount;

   for i := 0 to LineCount - 1 do
   begin
    CurLine := fSCIInterface.Line[i];

    SubStrPos := Q_PosStr(SelText, CurLine);

    if ((FilterType = ftKeep) and (SubStrPos > 0)) or ((FilterType = ftRemove) and (SubStrPos = 0)) then
     FilteredData := FilteredData + CurLine;

    Progress.Step();

    if Progress.Cancel then
     break;
   end;

   fNPPInterface.NewFile();
   fSCIInterface.AppendText(FilteredData);
  end;
 finally
  Progress.Free();
 end;
end;

function UnwrapExtended(Line: string): string;
// unwraps 'extended' search line to following scheme:
//
// \t    tab character
// \\    backslash
// \Hxx  any hexidecimal character
begin
 result := Line;
end;


type TSearchType = (stNormal, stExtended, stRegEx);
     TSearchOutput = (soCurFile, soNewFile);

{procedure DoAdvancedFilter(HasLines, HasNotLines: TStrings; SearchType: TSearchType; SearchOutput: TSearchOutput);
var i, j: integer;
    LineCount: integer;
    SubStrPos: integer;
    CurLine: string;
    MyHasLines, MyHasNotLines: TStringList;
    SelText: string;
    FilteredData: string;
    Progress: TFormProgress;
begin
 Progress := nil;

 MyHasLines := TStringList.Create();
 MyHasNotLines := TStringList.Create();

 try
  MyHasLines.Assign(HasLines);
  MyHasNotLines.Assign(HasNotLines);

  if SearchType = stExtended then
  begin
   for i := 0 to MyHasLines.Count  - 1 do
    MyHasLines[i] := UnWrapExtended(MyHasLines[i]);

   for i := 0 to MyHasNotLines.Count  - 1 do
    MyHasNotLines[i] := UnWrapExtended(MyHasNotLines[i]);
  end;


  SelText := fSCIInterface.SelText;

  if SelText <> '' then
  begin
   LineCount := fSCIInterface.LineCount;

   Progress := TFormProgress.Create(nil);
   Progress.Show();
   Progress.ProgressBar.Max := LineCount;

   for i := 0 to LineCount - 1 do
   begin
    CurLine := fSCIInterface.Line[i];

    SubStrPos := Q_PosStr(SelText, CurLine);

    if ((FilterType = ftKeep) and (SubStrPos > 0)) or ((FilterType = ftRemove) and (SubStrPos = 0)) then
     FilteredData := FilteredData + CurLine;

    Progress.Step();

    if Progress.Cancel then
     break;
   end;

   fNPPInterface.NewFile();
   fSCIInterface.AppendText(FilteredData);
  end;
 finally
  Progress.Free();
  MyHasLines.Free();
  MyHasNotLines.Free();
 end;
end;}

{procedure ShowFormSearchParams;
var SearchType: TSearchType;
    SearchOutput: TSearchOutput;
begin
 if not assigned(fFormSearchParams) then
 begin
  fFormSearchParams := TFormAdvancedSearch.Create(nil);
//  fFormSearchParams.ParentWindow := fNPPInterface.NPPHandle;
 end;

 if fFormSearchParams.ShowModal() = mrOK then
 begin
  if fFormSearchParams.RadioButtonSearchExtended.Checked then SearchType := stExtended else
  if fFormSearchParams.RadioButtonSearchRegex.Checked then    SearchType := stRegEx else
                                                              SearchType := stNormal;

  if fFormSearchParams.RadioButtonOutputToCurrent.Checked then SearchOutput := soCurFile else
                                                               SearchOutput := soNewFile;

  DoAdvancedFilter(fFormSearchParams.MemoInclude.Lines, fFormSearchParams.MemoNoInclude.Lines, SearchType, SearchOutput);
 end;
end;}

procedure CallbackKeep; cdecl;
begin
 DoFilter(ftKeep);
end;

procedure CallbackRemove; cdecl;
begin
 DoFilter(ftRemove);
end;

//procedure CallbackAdvanced; cdecl;
//begin
// ShowFormSearchParams();
// ShowMessage('not implemented yet');

//end;

procedure CallbackShowAllLines; cdecl;
begin
 fSCIInterface.ShowAllLines();
end;

procedure CreateMenuItems;

 procedure AddMenuItem(Callback: TProc; Name: widestring);
 var i: integer;
 begin
  Name := Copy(Name, 1, 64); // limit the string to 64 characters
  i := Length(FuncItems);
  SetLength(FuncItems, i + 1);

  ZeroMemory(@FuncItems[i], SizeOf(RFuncItem));
  FuncItems[i]._pFunc := Callback;
  CopyMemory(@FuncItems[i]._itemName[0], @Name[1], Length(Name) * SizeOf(WideChar));
  FuncItems[i]._cmdID := i;
 end;

begin
 SetLength(FuncItems, 0);

 AddMenuItem(CallbackKeep, '&Keep lines with selection');
 AddMenuItem(CallbackRemove, '&Remove lines with selection');
// AddMenuitem(callbackkeep, '-');
// AddMenuItem(CallbackAdvanced, '&Advanced');
// AddMenuItem(CallbackShowAllLines, 'Sho&w all lines');
end;

procedure UpdateMenu;
var hm: HMENU;
    i: integer;
begin
 // manipulate menu
 hm := GetMenu(NPPData._nppHandle);

 for i := 0 to Length(FuncItems) - 1 do
  if ansistring(FuncItems[i]._itemName) = '-' then
   ModifyMenu(hm, FuncItems[i]._CmdID, MF_BYCOMMAND or MF_SEPARATOR, 0, nil);
end;

procedure DLLEntryPoint(dwReason: DWord);
begin
 case dwReason of
  DLL_PROCESS_ATTACH:
   begin
    CreateMenuItems();

    fSCIInterface := TSCIInterface.Create();
    fNPPInterface := TNPPInterface.Create();

    fFormSearchParams := nil;
   end;

  DLL_PROCESS_DETACH:
   begin
    fSCIInterface.Free();
    fNPPInterface.Free();

    fFormSearchParams.Free();
   end;
 end;
end;

procedure setInfo(NotePadPlusData: RNPPData); cdecl; // Needs struct nppdata
begin
 NPPData := NotePadPlusData;
 fNPPInterface.NPPHandle := NPPData._nppHandle;
 fSCIInterface.SCIHandle := NPPData._scintillaMainHandle;
end;

function getName: PWChar; cdecl;
begin
 Result := '&Line filter';
end;

function getFuncsArray(var nFuncs: integer): Pointer; cdecl;
begin
 nFuncs := Length(FuncItems);
 result := FuncItems;
end;

procedure beNotified; cdecl;
begin
end;

function messageProc(p1, p2: integer; p3: pointer): integer; cdecl;
begin
 if p1 = WM_CREATE then
  UpdateMenu();

 Result := 0;
end;

function isUnicode: boolean; cdecl;
begin
 result := true;
end;

exports
 isUnicode,
 setInfo,
 getName,
 getFuncsArray,
 beNotified,
 messageProc;
begin
 { First, assign the procedure to the DLLProc variable }
 DllProc := @DLLEntryPoint;

 { Now invoke the procedure to reflect that the DLL is attaching to the process }
 DLLEntryPoint(DLL_PROCESS_ATTACH);
end.

Added src/NPP Plugin.drc.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* VER180
  Generated by the Borland Delphi Pascal Compiler
  because -GD or --drc was supplied to the compiler.

  This file contains compiler-generated resources that
  were bound to the executable.
  If this file is empty, then no compiler-generated
  resources were bound to the produced executable.
*/

#define Consts_SDockedCtlNeedsName 65312
#define Consts_SDockTreeRemoveError 65313
#define Consts_SDockZoneNotFound 65314
#define Consts_SDockZoneHasNoCtl 65315
#define Consts_SDockZoneVersionConflict 65316
#define Consts_SANSIEncoding 65317
#define Consts_SASCIIEncoding 65318
#define Consts_SUnicodeEncoding 65319
#define Consts_SBigEndianEncoding 65320
#define Consts_SUTF8Encoding 65321
#define Consts_SUTF7Encoding 65322
#define ToolTips_S_EId 65323
#define Consts_SmkcPgUp 65328
#define Consts_SmkcPgDn 65329
#define Consts_SmkcEnd 65330
#define Consts_SmkcHome 65331
#define Consts_SmkcLeft 65332
#define Consts_SmkcUp 65333
#define Consts_SmkcRight 65334
#define Consts_SmkcDown 65335
#define Consts_SmkcIns 65336
#define Consts_SmkcDel 65337
#define Consts_SmkcShift 65338
#define Consts_SmkcCtrl 65339
#define Consts_SmkcAlt 65340
#define Consts_SOutOfRange 65341
#define Consts_SIconToClipboard 65342
#define Consts_SDuplicateMenus 65343
#define Consts_SMsgDlgYes 65344
#define Consts_SMsgDlgNo 65345
#define Consts_SMsgDlgOK 65346
#define Consts_SMsgDlgCancel 65347
#define Consts_SMsgDlgHelp 65348
#define Consts_SMsgDlgAbort 65349
#define Consts_SMsgDlgRetry 65350
#define Consts_SMsgDlgIgnore 65351
#define Consts_SMsgDlgAll 65352
#define Consts_SMsgDlgNoToAll 65353
#define Consts_SMsgDlgYesToAll 65354
#define Consts_SmkcBkSp 65355
#define Consts_SmkcTab 65356
#define Consts_SmkcEsc 65357
#define Consts_SmkcEnter 65358
#define Consts_SmkcSpace 65359
#define Consts_SControlParentSetToSelf 65360
#define Consts_SOKButton 65361
#define Consts_SCancelButton 65362
#define Consts_SYesButton 65363
#define Consts_SNoButton 65364
#define Consts_SHelpButton 65365
#define Consts_SCloseButton 65366
#define Consts_SIgnoreButton 65367
#define Consts_SRetryButton 65368
#define Consts_SAbortButton 65369
#define Consts_SAllButton 65370
#define Consts_SCannotDragForm 65371
#define Consts_SMsgDlgWarning 65372
#define Consts_SMsgDlgError 65373
#define Consts_SMsgDlgInformation 65374
#define Consts_SMsgDlgConfirm 65375
#define Consts_SImageReadFail 65376
#define Consts_SImageWriteFail 65377
#define Consts_SWindowDCError 65378
#define Consts_SWindowClass 65379
#define Consts_SCannotFocus 65380
#define Consts_SParentRequired 65381
#define Consts_SMDIChildNotVisible 65382
#define Consts_SVisibleChanged 65383
#define Consts_SCannotShowModal 65384
#define Consts_SPropertyOutOfRange 65385
#define Consts_SMenuIndexError 65386
#define Consts_SMenuReinserted 65387
#define Consts_SMenuNotFound 65388
#define Consts_SNoTimers 65389
#define Consts_SGroupIndexTooLow 65390
#define Consts_SNoMDIForm 65391
#define RTLConsts_SThreadError 65392
#define HelpIntfs_hNoTableOfContents 65393
#define HelpIntfs_hNothingFound 65394
#define HelpIntfs_hNoContext 65395
#define HelpIntfs_hNoContextFound 65396
#define HelpIntfs_hNoTopics 65397
#define Consts_SInvalidBitmap 65398
#define Consts_SInvalidIcon 65399
#define Consts_SChangeIconSize 65400
#define Consts_SUnknownClipboardFormat 65401
#define Consts_SOutOfResources 65402
#define Consts_SNoCanvasHandle 65403
#define Consts_SInvalidImageSize 65404
#define Consts_SInvalidImageList 65405
#define Consts_SReplaceImage 65406
#define Consts_SImageIndexError 65407
#define RTLConsts_SInvalidRegType 65408
#define RTLConsts_SListCapacityError 65409
#define RTLConsts_SListCountError 65410
#define RTLConsts_SListIndexError 65411
#define RTLConsts_SMemoryStreamError 65412
#define RTLConsts_SPropertyException 65413
#define RTLConsts_SReadError 65414
#define RTLConsts_SReadOnlyProperty 65415
#define RTLConsts_SRegGetDataFailed 65416
#define RTLConsts_SResNotFound 65417
#define RTLConsts_SSeekNotImplemented 65418
#define RTLConsts_SSortedListError 65419
#define RTLConsts_SUnknownGroup 65420
#define RTLConsts_SUnknownProperty 65421
#define RTLConsts_SWriteError 65422
#define RTLConsts_SThreadCreateError 65423
#define RTLConsts_SAncestorNotFound 65424
#define RTLConsts_SAssignError 65425
#define RTLConsts_SBitsIndexError 65426
#define RTLConsts_SCantWriteResourceStreamError 65427
#define RTLConsts_SCheckSynchronizeError 65428
#define RTLConsts_SClassNotFound 65429
#define RTLConsts_SDuplicateClass 65430
#define RTLConsts_SDuplicateItem 65431
#define RTLConsts_SDuplicateName 65432
#define RTLConsts_SDuplicateString 65433
#define RTLConsts_SFCreateErrorEx 65434
#define RTLConsts_SFOpenErrorEx 65435
#define RTLConsts_SInvalidImage 65436
#define RTLConsts_SInvalidName 65437
#define RTLConsts_SInvalidPropertyPath 65438
#define RTLConsts_SInvalidPropertyValue 65439
#define SysConst_SLongMonthNameNov 65440
#define SysConst_SLongMonthNameDec 65441
#define SysConst_SShortDayNameSun 65442
#define SysConst_SShortDayNameMon 65443
#define SysConst_SShortDayNameTue 65444
#define SysConst_SShortDayNameWed 65445
#define SysConst_SShortDayNameThu 65446
#define SysConst_SShortDayNameFri 65447
#define SysConst_SShortDayNameSat 65448
#define SysConst_SLongDayNameSun 65449
#define SysConst_SLongDayNameMon 65450
#define SysConst_SLongDayNameTue 65451
#define SysConst_SLongDayNameWed 65452
#define SysConst_SLongDayNameThu 65453
#define SysConst_SLongDayNameFri 65454
#define SysConst_SLongDayNameSat 65455
#define SysConst_SShortMonthNameJul 65456
#define SysConst_SShortMonthNameAug 65457
#define SysConst_SShortMonthNameSep 65458
#define SysConst_SShortMonthNameOct 65459
#define SysConst_SShortMonthNameNov 65460
#define SysConst_SShortMonthNameDec 65461
#define SysConst_SLongMonthNameJan 65462
#define SysConst_SLongMonthNameFeb 65463
#define SysConst_SLongMonthNameMar 65464
#define SysConst_SLongMonthNameApr 65465
#define SysConst_SLongMonthNameMay 65466
#define SysConst_SLongMonthNameJun 65467
#define SysConst_SLongMonthNameJul 65468
#define SysConst_SLongMonthNameAug 65469
#define SysConst_SLongMonthNameSep 65470
#define SysConst_SLongMonthNameOct 65471
#define SysConst_SVarUnexpected 65472
#define SysConst_SExternalException 65473
#define SysConst_SAssertionFailed 65474
#define SysConst_SIntfCastError 65475
#define SysConst_SSafecallException 65476
#define SysConst_SAssertError 65477
#define SysConst_SAbstractError 65478
#define SysConst_SModuleAccessViolation 65479
#define SysConst_SOSError 65480
#define SysConst_SUnkOSError 65481
#define SysConst_SShortMonthNameJan 65482
#define SysConst_SShortMonthNameFeb 65483
#define SysConst_SShortMonthNameMar 65484
#define SysConst_SShortMonthNameApr 65485
#define SysConst_SShortMonthNameMay 65486
#define SysConst_SShortMonthNameJun 65487
#define SysConst_SDispatchError 65488
#define SysConst_SReadAccess 65489
#define SysConst_SWriteAccess 65490
#define SysConst_SFormatTooLong 65491
#define SysConst_SVarArrayCreate 65492
#define SysConst_SVarArrayBounds 65493
#define SysConst_SVarArrayLocked 65494
#define SysConst_SInvalidVarCast 65495
#define SysConst_SInvalidVarOp 65496
#define SysConst_SInvalidVarOpWithHResultWithPrefix 65497
#define SysConst_SVarTypeCouldNotConvert 65498
#define SysConst_SVarTypeConvertOverflow 65499
#define SysConst_SVarOverflow 65500
#define SysConst_SVarInvalid 65501
#define SysConst_SVarBadType 65502
#define SysConst_SVarNotImplemented 65503
#define SysConst_SInvalidOp 65504
#define SysConst_SZeroDivide 65505
#define SysConst_SOverflow 65506
#define SysConst_SUnderflow 65507
#define SysConst_SInvalidPointer 65508
#define SysConst_SInvalidCast 65509
#define SysConst_SAccessViolationArg3 65510
#define SysConst_SAccessViolationNoArg 65511
#define SysConst_SStackOverflow 65512
#define SysConst_SControlC 65513
#define SysConst_SPrivilege 65514
#define SysConst_SOperationAborted 65515
#define SysConst_SException 65516
#define SysConst_SExceptTitle 65517
#define SysConst_SInvalidFormat 65518
#define SysConst_SArgumentMissing 65519
#define SysConst_SInvalidInteger 65520
#define SysConst_SInvalidFloat 65521
#define SysConst_STimeEncodeError 65522
#define SysConst_SDateEncodeError 65523
#define SysConst_SOutOfMemory 65524
#define SysConst_SInOutError 65525
#define SysConst_SFileNotFound 65526
#define SysConst_SInvalidFilename 65527
#define SysConst_STooManyOpenFiles 65528
#define SysConst_SAccessDenied 65529
#define SysConst_SEndOfFile 65530
#define SysConst_SDiskFull 65531
#define SysConst_SInvalidInput 65532
#define SysConst_SDivByZero 65533
#define SysConst_SRangeError 65534
#define SysConst_SIntOverflow 65535
STRINGTABLE
BEGIN
	Consts_SDockedCtlNeedsName,	"Docked control must have a name"
	Consts_SDockTreeRemoveError,	"Error removing control from dock tree"
	Consts_SDockZoneNotFound,	" - Dock zone not found"
	Consts_SDockZoneHasNoCtl,	" - Dock zone has no control"
	Consts_SDockZoneVersionConflict,	"Error loading dock zone from the stream. Expecting version %d, but found %d."
	Consts_SANSIEncoding,	"ANSI"
	Consts_SASCIIEncoding,	"ASCII"
	Consts_SUnicodeEncoding,	"Unicode"
	Consts_SBigEndianEncoding,	"Big Endian Unicode"
	Consts_SUTF8Encoding,	"UTF-8"
	Consts_SUTF7Encoding,	"UTF-7"
	ToolTips_S_EId,	"Invalid tool id %d"
	Consts_SmkcPgUp,	"PgUp"
	Consts_SmkcPgDn,	"PgDn"
	Consts_SmkcEnd,	"End"
	Consts_SmkcHome,	"Home"
	Consts_SmkcLeft,	"Left"
	Consts_SmkcUp,	"Up"
	Consts_SmkcRight,	"Right"
	Consts_SmkcDown,	"Down"
	Consts_SmkcIns,	"Ins"
	Consts_SmkcDel,	"Del"
	Consts_SmkcShift,	"Shift+"
	Consts_SmkcCtrl,	"Ctrl+"
	Consts_SmkcAlt,	"Alt+"
	Consts_SOutOfRange,	"Value must be between %d and %d"
	Consts_SIconToClipboard,	"Clipboard does not support Icons"
	Consts_SDuplicateMenus,	"Menu '%s' is already being used by another form"
	Consts_SMsgDlgYes,	"&Yes"
	Consts_SMsgDlgNo,	"&No"
	Consts_SMsgDlgOK,	"OK"
	Consts_SMsgDlgCancel,	"Cancel"
	Consts_SMsgDlgHelp,	"&Help"
	Consts_SMsgDlgAbort,	"&Abort"
	Consts_SMsgDlgRetry,	"&Retry"
	Consts_SMsgDlgIgnore,	"&Ignore"
	Consts_SMsgDlgAll,	"&All"
	Consts_SMsgDlgNoToAll,	"N&o to All"
	Consts_SMsgDlgYesToAll,	"Yes to &All"
	Consts_SmkcBkSp,	"BkSp"
	Consts_SmkcTab,	"Tab"
	Consts_SmkcEsc,	"Esc"
	Consts_SmkcEnter,	"Enter"
	Consts_SmkcSpace,	"Space"
	Consts_SControlParentSetToSelf,	"A control cannot have itself as its parent"
	Consts_SOKButton,	"OK"
	Consts_SCancelButton,	"Cancel"
	Consts_SYesButton,	"&Yes"
	Consts_SNoButton,	"&No"
	Consts_SHelpButton,	"&Help"
	Consts_SCloseButton,	"&Close"
	Consts_SIgnoreButton,	"&Ignore"
	Consts_SRetryButton,	"&Retry"
	Consts_SAbortButton,	"Abort"
	Consts_SAllButton,	"&All"
	Consts_SCannotDragForm,	"Cannot drag a form"
	Consts_SMsgDlgWarning,	"Warning"
	Consts_SMsgDlgError,	"Error"
	Consts_SMsgDlgInformation,	"Information"
	Consts_SMsgDlgConfirm,	"Confirm"
	Consts_SImageReadFail,	"Failed to read ImageList data from stream"
	Consts_SImageWriteFail,	"Failed to write ImageList data to stream"
	Consts_SWindowDCError,	"Error creating window device context"
	Consts_SWindowClass,	"Error creating window class"
	Consts_SCannotFocus,	"Cannot focus a disabled or invisible window"
	Consts_SParentRequired,	"Control '%s' has no parent window"
	Consts_SMDIChildNotVisible,	"Cannot hide an MDI Child Form"
	Consts_SVisibleChanged,	"Cannot change Visible in OnShow or OnHide"
	Consts_SCannotShowModal,	"Cannot make a visible window modal"
	Consts_SPropertyOutOfRange,	"%s property out of range"
	Consts_SMenuIndexError,	"Menu index out of range"
	Consts_SMenuReinserted,	"Menu inserted twice"
	Consts_SMenuNotFound,	"Sub-menu is not in menu"
	Consts_SNoTimers,	"Not enough timers available"
	Consts_SGroupIndexTooLow,	"GroupIndex cannot be less than a previous menu item's GroupIndex"
	Consts_SNoMDIForm,	"Cannot create form. No MDI forms are currently active"
	RTLConsts_SThreadError,	"Thread Error: %s (%d)"
	HelpIntfs_hNoTableOfContents,	"Unable to find a Table of Contents"
	HelpIntfs_hNothingFound,	"No help found for %s"
	HelpIntfs_hNoContext,	"No context-sensitive help installed"
	HelpIntfs_hNoContextFound,	"No help found for context"
	HelpIntfs_hNoTopics,	"No topic-based help system installed"
	Consts_SInvalidBitmap,	"Bitmap image is not valid"
	Consts_SInvalidIcon,	"Icon image is not valid"
	Consts_SChangeIconSize,	"Cannot change the size of an icon"
	Consts_SUnknownClipboardFormat,	"Unsupported clipboard format"
	Consts_SOutOfResources,	"Out of system resources"
	Consts_SNoCanvasHandle,	"Canvas does not allow drawing"
	Consts_SInvalidImageSize,	"Invalid image size"
	Consts_SInvalidImageList,	"Invalid ImageList"
	Consts_SReplaceImage,	"Unable to Replace Image"
	Consts_SImageIndexError,	"Invalid ImageList Index"
	RTLConsts_SInvalidRegType,	"Invalid data type for '%s'"
	RTLConsts_SListCapacityError,	"List capacity out of bounds (%d)"
	RTLConsts_SListCountError,	"List count out of bounds (%d)"
	RTLConsts_SListIndexError,	"List index out of bounds (%d)"
	RTLConsts_SMemoryStreamError,	"Out of memory while expanding memory stream"
	RTLConsts_SPropertyException,	"Error reading %s%s%s: %s"
	RTLConsts_SReadError,	"Stream read error"
	RTLConsts_SReadOnlyProperty,	"Property is read-only"
	RTLConsts_SRegGetDataFailed,	"Failed to get data for '%s'"
	RTLConsts_SResNotFound,	"Resource %s not found"
	RTLConsts_SSeekNotImplemented,	"%s.Seek not implemented"
	RTLConsts_SSortedListError,	"Operation not allowed on sorted list"
	RTLConsts_SUnknownGroup,	"%s not in a class registration group"
	RTLConsts_SUnknownProperty,	"Property %s does not exist"
	RTLConsts_SWriteError,	"Stream write error"
	RTLConsts_SThreadCreateError,	"Thread creation error: %s"
	RTLConsts_SAncestorNotFound,	"Ancestor for '%s' not found"
	RTLConsts_SAssignError,	"Cannot assign a %s to a %s"
	RTLConsts_SBitsIndexError,	"Bits index out of range"
	RTLConsts_SCantWriteResourceStreamError,	"Can't write to a read-only resource stream"
	RTLConsts_SCheckSynchronizeError,	"CheckSynchronize called from thread $%x, which is NOT the main thread"
	RTLConsts_SClassNotFound,	"Class %s not found"
	RTLConsts_SDuplicateClass,	"A class named %s already exists"
	RTLConsts_SDuplicateItem,	"List does not allow duplicates ($0%x)"
	RTLConsts_SDuplicateName,	"A component named %s already exists"
	RTLConsts_SDuplicateString,	"String list does not allow duplicates"
	RTLConsts_SFCreateErrorEx,	"Cannot create file \"%s\". %s"
	RTLConsts_SFOpenErrorEx,	"Cannot open file \"%s\". %s"
	RTLConsts_SInvalidImage,	"Invalid stream format"
	RTLConsts_SInvalidName,	"''%s'' is not a valid component name"
	RTLConsts_SInvalidPropertyPath,	"Invalid property path"
	RTLConsts_SInvalidPropertyValue,	"Invalid property value"
	SysConst_SLongMonthNameNov,	"November"
	SysConst_SLongMonthNameDec,	"December"
	SysConst_SShortDayNameSun,	"Sun"
	SysConst_SShortDayNameMon,	"Mon"
	SysConst_SShortDayNameTue,	"Tue"
	SysConst_SShortDayNameWed,	"Wed"
	SysConst_SShortDayNameThu,	"Thu"
	SysConst_SShortDayNameFri,	"Fri"
	SysConst_SShortDayNameSat,	"Sat"
	SysConst_SLongDayNameSun,	"Sunday"
	SysConst_SLongDayNameMon,	"Monday"
	SysConst_SLongDayNameTue,	"Tuesday"
	SysConst_SLongDayNameWed,	"Wednesday"
	SysConst_SLongDayNameThu,	"Thursday"
	SysConst_SLongDayNameFri,	"Friday"
	SysConst_SLongDayNameSat,	"Saturday"
	SysConst_SShortMonthNameJul,	"Jul"
	SysConst_SShortMonthNameAug,	"Aug"
	SysConst_SShortMonthNameSep,	"Sep"
	SysConst_SShortMonthNameOct,	"Oct"
	SysConst_SShortMonthNameNov,	"Nov"
	SysConst_SShortMonthNameDec,	"Dec"
	SysConst_SLongMonthNameJan,	"January"
	SysConst_SLongMonthNameFeb,	"February"
	SysConst_SLongMonthNameMar,	"March"
	SysConst_SLongMonthNameApr,	"April"
	SysConst_SLongMonthNameMay,	"May"
	SysConst_SLongMonthNameJun,	"June"
	SysConst_SLongMonthNameJul,	"July"
	SysConst_SLongMonthNameAug,	"August"
	SysConst_SLongMonthNameSep,	"September"
	SysConst_SLongMonthNameOct,	"October"
	SysConst_SVarUnexpected,	"Unexpected variant error"
	SysConst_SExternalException,	"External exception %x"
	SysConst_SAssertionFailed,	"Assertion failed"
	SysConst_SIntfCastError,	"Interface not supported"
	SysConst_SSafecallException,	"Exception in safecall method"
	SysConst_SAssertError,	"%s (%s, line %d)"
	SysConst_SAbstractError,	"Abstract Error"
	SysConst_SModuleAccessViolation,	"Access violation at address %p in module '%s'. %s of address %p"
	SysConst_SOSError,	"System Error.  Code: %d.\r\n%s"
	SysConst_SUnkOSError,	"A call to an OS function failed"
	SysConst_SShortMonthNameJan,	"Jan"
	SysConst_SShortMonthNameFeb,	"Feb"
	SysConst_SShortMonthNameMar,	"Mar"
	SysConst_SShortMonthNameApr,	"Apr"
	SysConst_SShortMonthNameMay,	"May"
	SysConst_SShortMonthNameJun,	"Jun"
	SysConst_SDispatchError,	"Variant method calls not supported"
	SysConst_SReadAccess,	"Read"
	SysConst_SWriteAccess,	"Write"
	SysConst_SFormatTooLong,	"Format string too long"
	SysConst_SVarArrayCreate,	"Error creating variant or safe array"
	SysConst_SVarArrayBounds,	"Variant or safe array index out of bounds"
	SysConst_SVarArrayLocked,	"Variant or safe array is locked"
	SysConst_SInvalidVarCast,	"Invalid variant type conversion"
	SysConst_SInvalidVarOp,	"Invalid variant operation"
	SysConst_SInvalidVarOpWithHResultWithPrefix,	"Invalid variant operation (%s%.8x)\n%s"
	SysConst_SVarTypeCouldNotConvert,	"Could not convert variant of type (%s) into type (%s)"
	SysConst_SVarTypeConvertOverflow,	"Overflow while converting variant of type (%s) into type (%s)"
	SysConst_SVarOverflow,	"Variant overflow"
	SysConst_SVarInvalid,	"Invalid argument"
	SysConst_SVarBadType,	"Invalid variant type"
	SysConst_SVarNotImplemented,	"Operation not supported"
	SysConst_SInvalidOp,	"Invalid floating point operation"
	SysConst_SZeroDivide,	"Floating point division by zero"
	SysConst_SOverflow,	"Floating point overflow"
	SysConst_SUnderflow,	"Floating point underflow"
	SysConst_SInvalidPointer,	"Invalid pointer operation"
	SysConst_SInvalidCast,	"Invalid class typecast"
	SysConst_SAccessViolationArg3,	"Access violation at address %p. %s of address %p"
	SysConst_SAccessViolationNoArg,	"Access violation"
	SysConst_SStackOverflow,	"Stack overflow"
	SysConst_SControlC,	"Control-C hit"
	SysConst_SPrivilege,	"Privileged instruction"
	SysConst_SOperationAborted,	"Operation aborted"
	SysConst_SException,	"Exception %s in module %s at %p.\r\n%s%s\r\n"
	SysConst_SExceptTitle,	"Application Error"
	SysConst_SInvalidFormat,	"Format '%s' invalid or incompatible with argument"
	SysConst_SArgumentMissing,	"No argument for format '%s'"
	SysConst_SInvalidInteger,	"'%s' is not a valid integer value"
	SysConst_SInvalidFloat,	"'%s' is not a valid floating point value"
	SysConst_STimeEncodeError,	"Invalid argument to time encode"
	SysConst_SDateEncodeError,	"Invalid argument to date encode"
	SysConst_SOutOfMemory,	"Out of memory"
	SysConst_SInOutError,	"I/O error %d"
	SysConst_SFileNotFound,	"File not found"
	SysConst_SInvalidFilename,	"Invalid filename"
	SysConst_STooManyOpenFiles,	"Too many open files"
	SysConst_SAccessDenied,	"File access denied"
	SysConst_SEndOfFile,	"Read beyond end of file"
	SysConst_SDiskFull,	"Disk full"
	SysConst_SInvalidInput,	"Invalid numeric input"
	SysConst_SDivByZero,	"Division by zero"
	SysConst_SRangeError,	"Range check error"
	SysConst_SIntOverflow,	"Integer overflow"
END

Added src/NPPConsts.inc.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
const
//Here you can find how to use these messages : http://notepad-plus.sourceforge.net/uk/plugins-HOWTO.php
NPPMSG                                        = (WM_USER + 1000);

NPPM_GETCURRENTSCINTILLA                      = (NPPMSG + 4);
NPPM_GETCURRENTLANGTYPE                       = (NPPMSG + 5);
NPPM_SETCURRENTLANGTYPE                       = (NPPMSG + 6);

NPPM_GETNBOPENFILES                           =	(NPPMSG + 7);
ALL_OPEN_FILES                                =		0;
PRIMARY_VIEW                                  =		1;
SECOND_VIEW                                   =		2;

NPPM_GETOPENFILENAMES                         =	(NPPMSG + 8);


NPPM_MODELESSDIALOG                           = (NPPMSG + 12);
MODELESSDIALOGADD                             =		0;
MODELESSDIALOGREMOV                           = 	1;

NPPM_GETNBSESSIONFILES                        = (NPPMSG + 13);
NPPM_GETSESSIONFILES                          = (NPPMSG + 14);
NPPM_SAVESESSION                              = (NPPMSG + 15);
NPPM_SAVECURRENTSESSION                       = (NPPMSG + 16);

//		struct sessionInfo {
//			char* sessionFilePathName;
//			int nbFile;
//			char** files;
//		};

NPPM_GETOPENFILENAMESPRIMARY                  = (NPPMSG + 17);
NPPM_GETOPENFILENAMESSECOND                   = (NPPMSG + 18);
	
NPPM_CREATESCINTILLAHANDLE                    = (NPPMSG + 20);
NPPM_DESTROYSCINTILLAHANDLE                   = (NPPMSG + 21);
NPPM_GETNBUSERLANG                            = (NPPMSG + 22);

NPPM_GETCURRENTDOCINDEX                       = (NPPMSG + 23);
MAIN_VIEW                                     = 0;
SUB_VIEW                                      = 1;

NPPM_SETSTATUSBAR                             = (NPPMSG + 24);
STATUSBAR_DOC_TYPE                            = 0;
STATUSBAR_DOC_SIZE                            = 1;
STATUSBAR_CUR_POS                             = 2;
STATUSBAR_EOF_FORMAT                          = 3;
STATUSBAR_UNICODE_TYPE                        = 4;
STATUSBAR_TYPING_MODE                         = 5;

PPM_GETMENUHANDLE                             = (NPPMSG + 25);
NPPPLUGINMENU                                 = 0;

PPM_ENCODESCI                                 = (NPPMSG + 26);
	//ascii file to unicode
	//int NPPM_ENCODESCI(MAIN_VIEW/SUB_VIEW, 0)
	//return new unicodeMode
	
PPM_DECODESCI                                 = (NPPMSG + 27);
	//unicode file to ascii
	//int NPPM_DECODESCI(MAIN_VIEW/SUB_VIEW, 0)
	//return old unicodeMode

PPM_ACTIVATEDOC                               = (NPPMSG + 28);
	//void NPPM_ACTIVATEDOC(int index2Activate, int view)

PPM_LAUNCHFINDINFILESDLG                      = (NPPMSG + 29);
	//void NPPM_LAUNCHFINDINFILESDLG(char * dir2Search, char * filtre)

PPM_DMMSHOW                                   = (NPPMSG + 30);
PPM_DMMHIDE                                   =	(NPPMSG + 31);
PPM_DMMUPDATEDISPINFO                         = (NPPMSG + 32);
	//void NPPM_DMMxxx(0, tTbData->hClient)

PPM_DMMREGASDCKDLG                            = (NPPMSG + 33);
	//void NPPM_DMMREGASDCKDLG(0, &tTbData)

PPM_LOADSESSION                               = (NPPMSG + 34);
	//void NPPM_LOADSESSION(0, const char* file name)

PPM_DMMVIEWOTHERTAB                           = (NPPMSG + 35);
	//void WM_DMM_VIEWOTHERTAB(0, tTbData->hClient)

PPM_RELOADFILE                                = (NPPMSG + 36);
	//BOOL NPPM_RELOADFILE(BOOL withAlert, char *filePathName2Reload)

PPM_SWITCHTOFILE                              = (NPPMSG + 37);
	//BOOL NPPM_SWITCHTOFILE(0, char *filePathName2switch)

PPM_SAVECURRENTFILE                           = (NPPMSG + 38);
	//BOOL WM_SWITCHTOFILE(0, 0)

PPM_SAVEALLFILES                              =	(NPPMSG + 39);
	//BOOL NPPM_SAVEALLFILES(0, 0)

PPM_SETMENUITEMCHECK                          =	(NPPMSG + 40);
	//void WM_PIMENU_CHECK(UINT	funcItem[X]._cmdID, TRUE/FALSE)

PPM_ADDTOOLBARICON                            = (NPPMSG + 41);
	//void WM_ADDTOOLBARICON(UINT funcItem[X]._cmdID, toolbarIcons icon)
//		struct toolbarIcons {
//			HBITMAP	hToolbarBmp;
//			HICON	hToolbarIcon;
//		};

PPM_GETWINDOWSVERSION                         = (NPPMSG + 42);
	//winVer NPPM_GETWINDOWSVERSION(0, 0)

PPM_DMMGETPLUGINHWNDBYNAME                    = (NPPMSG + 43);
	//HWND WM_DMM_GETPLUGINHWNDBYNAME(const char *windowName, const char *moduleName)
	// if moduleName is NULL, then return value is NULL
	// if windowName is NULL, then the first found window handle which matches with the moduleName will be returned
	
PPM_MAKECURRENTBUFFERDIRTY                    = (NPPMSG + 44);
	//BOOL NPPM_MAKECURRENTBUFFERDIRTY(0, 0)

PPM_GETENABLETHEMETEXTUREFUNC                 = (NPPMSG + 45);
	//BOOL NPPM_GETENABLETHEMETEXTUREFUNC(0, 0)

PPM_GETPLUGINSCONFIGDIR                       = (NPPMSG + 46);
	//void NPPM_GETPLUGINSCONFIGDIR(int strLen, char *str)

VAR_NOT_RECOGNIZED                            = 0;
FULL_CURRENT_PATH                             = 1;
CURRENT_DIRECTORY                             = 2;
FILE_NAME                                     = 3;
NAME_PART                                     = 4;
EXT_PART                                      = 5;
CURRENT_WORD                                  = 6;
NPP_DIRECTORY                                 = 7;

RUNCOMMAND_USER                                = (WM_USER + 3000);
NPPM_GETFULLCURRENTPATH                        =	(RUNCOMMAND_USER + FULL_CURRENT_PATH);
NPPM_GETCURRENTDIRECTORY                       =	(RUNCOMMAND_USER + CURRENT_DIRECTORY);
NPPM_GETFILENAME                               =	(RUNCOMMAND_USER + FILE_NAME);
NPPM_GETNAMEPART                               =	(RUNCOMMAND_USER + NAME_PART);
NPPM_GETEXTPART                                =	(RUNCOMMAND_USER + EXT_PART);
NPPM_GETCURRENTWORD                            =	(RUNCOMMAND_USER + CURRENT_WORD);
NPPM_GETNPPDIRECTORY                           =	(RUNCOMMAND_USER + NPP_DIRECTORY);

// Notification code
NPPN_FIRST                                    = 1000;
NPPN_READY                                    = (NPPN_FIRST + 1); // To notify plugins that all the procedures of launchment of notepad++ are done.
NPPN_TBMODIFICATION                           = (NPPN_FIRST + 2); // To notify plugins that toolbar icons can be registered
NPPN_FILEBEFORECLOSE                          = (NPPN_FIRST + 3); // To notify plugins that the current file is about to be closed
NPPN_FILEOPENED                               = (NPPN_FIRST + 4); // To notify plugins that the current file is just opened
NPPN_FILECLOSED                               = (NPPN_FIRST + 5); // To notify plugins that the current file is just closed
NPPN_FILEBEFOREOPEN                           = (NPPN_FIRST + 6); // To notify plugins that the current file is about to be opened
NPPN_FILEBEFORESAVE                           = (NPPN_FIRST + 7); // To notify plugins that the current file is about to be saved
NPPN_FILESAVED                                = (NPPN_FIRST + 8); // To notify plugins that the current file is just saved
NPPN_SHUTDOWN                                 = (NPPN_FIRST + 9); // To notify plugins that Notepad++ is about to be shutdowned.

 IDI_M30ICON                                  = 100;
 IDR_MENU1                                    = 101;
 IDR_ACCELERATOR1                             = 102;
 IDR_RT_MANIFEST                              = 103;

 IDI_NEW_OFF_ICON                             = 201;
 IDI_OPEN_OFF_ICON                            = 202;
 IDI_CLOSE_OFF_ICON                           = 203;
 IDI_CLOSEALL_OFF_ICON                        = 204;
 IDI_SAVE_OFF_ICON                            = 205;
 IDI_SAVEALL_OFF_ICON                         = 206;
 IDI_CUT_OFF_ICON                             = 207;   
 IDI_COPY_OFF_ICON                            = 208;   
 IDI_PASTE_OFF_ICON                           = 209;   
 IDI_UNDO_OFF_ICON                            = 210;
 IDI_REDO_OFF_ICON                            = 211;   
 IDI_FIND_OFF_ICON                            = 212;   
 IDI_REPLACE_OFF_ICON                         = 213;
 IDI_ZOOMIN_OFF_ICON                          = 214;
 IDI_ZOOMOUT_OFF_ICON                         = 215;
 IDI_VIEW_UD_DLG_OFF_ICON                     = 216;
 IDI_PRINT_OFF_ICON                           = 217;
 IDI_VIEW_ALL_CHAR_ON_ICON                    = 218;
 IDI_VIEW_INDENT_ON_ICON                      = 219;
 IDI_VIEW_WRAP_ON_ICON                        = 220;

 IDI_STARTRECORD_OFF_ICON                     = 221;
 IDI_STARTRECORD_ON_ICON                      = 222;
 IDI_STARTRECORD_DISABLE_ICON                 = 223;
 IDI_STOPRECORD_OFF_ICON                      = 224;
 IDI_STOPRECORD_ON_ICON                       = 225;
 IDI_STOPRECORD_DISABLE_ICON                  = 226;
 IDI_PLAYRECORD_OFF_ICON                      = 227;
 IDI_PLAYRECORD_ON_ICON                       = 228;
 IDI_PLAYRECORD_DISABLE_ICON                  = 229;
 IDI_SAVERECORD_OFF_ICON                      = 230;
 IDI_SAVERECORD_ON_ICON                       = 231;
 IDI_SAVERECORD_DISABLE_ICON                  = 232;

// multi run macro
 IDI_MMPLAY_DIS_ICON                          = 233;
 IDI_MMPLAY_OFF_ICON                          = 234;
 IDI_MMPLAY_ON_ICON                           = 235;

 IDI_NEW_ON_ICON                              = 301;
 IDI_OPEN_ON_ICON                             = 302;
 IDI_CLOSE_ON_ICON                            = 303;
 IDI_CLOSEALL_ON_ICON                         = 304;
 IDI_SAVE_ON_ICON                             = 305;
 IDI_SAVEALL_ON_ICON                          = 306;
 IDI_CUT_ON_ICON                              = 307;
 IDI_COPY_ON_ICON                             = 308;
 IDI_PASTE_ON_ICON                            = 309;
 IDI_UNDO_ON_ICON                             = 310;
 IDI_REDO_ON_ICON                             = 311;
 IDI_FIND_ON_ICON                             = 312;
 IDI_REPLACE_ON_ICON                          = 313;
 IDI_ZOOMIN_ON_ICON                           = 314;
 IDI_ZOOMOUT_ON_ICON                          = 315;
 IDI_VIEW_UD_DLG_ON_ICON                      = 316;
 IDI_PRINT_ON_ICON                            = 317;
 IDI_VIEW_ALL_CHAR_OFF_ICON                   = 318;
 IDI_VIEW_INDENT_OFF_ICON                     = 319;
 IDI_VIEW_WRAP_OFF_ICON                       = 320;

// IDI_NEW_DISABLE_ICON                       = 401;
// IDI_OPEN_ON_ICON                           = 402;
 IDI_SAVE_DISABLE_ICON                        = 403;
 IDI_SAVEALL_DISABLE_ICON                     = 404;
// IDI_CLOSE_ON_ICON                          = 405;
// IDI_CLOSEALL_ON_ICON                       = 406;
 IDI_CUT_DISABLE_ICON                         = 407;
 IDI_COPY_DISABLE_ICON                        = 408;
 IDI_PASTE_DISABLE_ICON                       = 409;
 IDI_UNDO_DISABLE_ICON                        = 410;
 IDI_REDO_DISABLE_ICON                        = 411;
 IDI_DELETE_ICON                              = 412;

 IDI_SYNCV_OFF_ICON                           = 413;
 IDI_SYNCV_ON_ICON                            = 414;
 IDI_SYNCV_DISABLE_ICON                       = 415;

 IDI_SYNCH_OFF_ICON                           = 416;
 IDI_SYNCH_ON_ICON                            = 417;
 IDI_SYNCH_DISABLE_ICON                       = 418;

 IDI_SAVED_ICON                               = 501;
 IDI_UNSAVED_ICON                             = 502;
 IDI_READONLY_ICON                            = 503;
 IDI_FIND_RESULT_ICON                         = 504;

 IDC_MY_CUR                                   = 1402;
 IDC_UP_ARROW                                 = 1403;
 IDC_DRAG_TAB                                 = 1404;
 IDC_DRAG_INTERDIT_TAB                        = 1405;
 IDC_DRAG_PLUS_TAB                            = 1406;
 IDC_MACRO_RECORDING                          = 1407;

 IDR_SAVEALL                                  = 1500;
 IDR_CLOSEFILE                                = 1501;
 IDR_CLOSEALL                                 = 1502;
 IDR_FIND                                     = 1503;
 IDR_REPLACE                                  = 1504;
 IDR_ZOOMIN                                   = 1505;
 IDR_ZOOMOUT                                  = 1506;
 IDR_WRAP                                     = 1507;
 IDR_INVISIBLECHAR                            = 1508;
 IDR_INDENTGUIDE                              = 1509;
 IDR_SHOWPANNEL                               = 1510;
 IDR_STARTRECORD                              = 1511;
 IDR_STOPRECORD                               = 1512;
 IDR_PLAYRECORD                               = 1513;
 IDR_SAVERECORD                               = 1514;
 IDR_SYNCV                                    = 1515;
 IDR_SYNCH                                    = 1516;
 IDR_FILENEW                                  = 1517;
 IDR_FILEOPEN                                 = 1518;
 IDR_FILESAVE                                 = 1519;
 IDR_PRINT                                    = 1520;
 IDR_CUT                                      = 1521;
 IDR_COPY                                     = 1522;
 IDR_PASTE                                    = 1523;
 IDR_UNDO                                     = 1524;
 IDR_REDO                                     = 1525;
 IDR_M_PLAYRECORD                             = 1526;

 IDR_CLOSETAB                                 = 1530;
 IDR_CLOSETAB_INACT                           = 1531;
 IDR_CLOSETAB_HOVER                           = 1532;
 IDR_CLOSETAB_PUSH                            = 1533;

 ID_MACRO                                     = 20000;
 ID_MACRO_LIMIT                               = 20200;

 ID_USER_CMD                                  = 21000;
 ID_USER_CMD_LIMIT                            = 21200;

 ID_PLUGINS_CMD                               = 22000;
 ID_PLUGINS_CMD_LIMIT                         = 22500;

 IDM                                          = 40000;

IDM_FILE                                      = (IDM + 1000);
IDM_FILE_NEW                                  = (IDM_FILE + 1);
IDM_FILE_OPEN                                 = (IDM_FILE + 2);
IDM_FILE_CLOSE                                = (IDM_FILE + 3);
IDM_FILE_CLOSEALL                             = (IDM_FILE + 4);
IDM_FILE_CLOSEALL_BUT_CURRENT                 = (IDM_FILE + 5);
IDM_FILE_SAVE                                 = (IDM_FILE + 6); 
IDM_FILE_SAVEALL                              = (IDM_FILE + 7); 
IDM_FILE_SAVEAS                               = (IDM_FILE + 8);
IDM_FILE_ASIAN_LANG                           = (IDM_FILE + 9);  
IDM_FILE_PRINT                                = (IDM_FILE + 10);
IDM_FILE_EXIT                                 = (IDM_FILE + 11);
IDM_FILE_LOADSESSION                          = (IDM_FILE + 12);
IDM_FILE_SAVESESSION                          = (IDM_FILE + 13);
IDM_FILE_RELOAD                               = (IDM_FILE + 14);
 
 // A mettre à jour si on ajoute nouveau menu item dans le menu "File"
 IDM_FILEMENU_LASTONE                         = IDM_FILE_RELOAD;
 
IDM_EDIT                                      = (IDM + 2000);
IDM_EDIT_CUT                                  = (IDM_EDIT + 1); 
IDM_EDIT_COPY                                 = (IDM_EDIT + 2);
IDM_EDIT_UNDO                                 = (IDM_EDIT + 3);
IDM_EDIT_REDO                                 = (IDM_EDIT + 4);
IDM_EDIT_PASTE                                = (IDM_EDIT + 5);
IDM_EDIT_DELETE                               = (IDM_EDIT + 6);
IDM_EDIT_SELECTALL                            = (IDM_EDIT + 7);
	
IDM_EDIT_INS_TAB                              = (IDM_EDIT + 8);
IDM_EDIT_RMV_TAB                              = (IDM_EDIT + 9);
IDM_EDIT_DUP_LINE                             = (IDM_EDIT + 10);
IDM_EDIT_TRANSPOSE_LINE                       = (IDM_EDIT + 11);
IDM_EDIT_SPLIT_LINES                          = (IDM_EDIT + 12);
IDM_EDIT_JOIN_LINES                           = (IDM_EDIT + 13);
IDM_EDIT_LINE_UP                              = (IDM_EDIT + 14);
IDM_EDIT_LINE_DOWN                            = (IDM_EDIT + 15);
IDM_EDIT_UPPERCASE                            = (IDM_EDIT + 16);
IDM_EDIT_LOWERCASE                            = (IDM_EDIT + 17);
IDM_EDIT_STARTRECORDINGMACRO                  = (IDM_EDIT + 18);
IDM_EDIT_STOPRECORDINGMACRO                   = (IDM_EDIT + 19);
IDM_EDIT_TOGGLEMACRORECORDING                 = (IDM_EDIT + 20);
IDM_EDIT_PLAYBACKRECORDEDMACRO                = (IDM_EDIT + 21);
IDM_EDIT_BLOCK_COMMENT                        = (IDM_EDIT + 22);
IDM_EDIT_STREAM_COMMENT                       = (IDM_EDIT + 23);
IDM_EDIT_TRIMTRAILING                         = (IDM_EDIT + 24);
IDM_EDIT_SAVECURRENTMACRO                     = (IDM_EDIT + 25);
IDM_EDIT_RTL                                  = (IDM_EDIT+26);
IDM_EDIT_LTR                                  = (IDM_EDIT+27);
IDM_EDIT_SETREADONLY                          = (IDM_EDIT+28);
IDM_EDIT_FULLPATHTOCLIP                       = (IDM_EDIT+29);
IDM_EDIT_FILENAMETOCLIP                       = (IDM_EDIT+30);
IDM_EDIT_CURRENTDIRTOCLIP                     = (IDM_EDIT+31);
IDM_EDIT_RUNMULTIMACRODLG                     = (IDM_EDIT+32);
IDM_EDIT_CLEARREADONLY                        = (IDM_EDIT+33);
IDM_EDIT_COLUMNMODE                           = (IDM_EDIT+34);
	//Belong to MENU FILE
IDM_OPEN_ALL_RECENT_FILE                      = (IDM_EDIT + 40);
	
IDM_SEARCH                                    = (IDM + 3000);

IDM_SEARCH_FIND                               = (IDM_SEARCH + 1);
IDM_SEARCH_FINDNEXT                           = (IDM_SEARCH + 2);
IDM_SEARCH_REPLACE                            = (IDM_SEARCH + 3);
IDM_SEARCH_GOTOLINE                           = (IDM_SEARCH + 4);
IDM_SEARCH_TOGGLE_BOOKMARK                    = (IDM_SEARCH + 5);
IDM_SEARCH_NEXT_BOOKMARK                      = (IDM_SEARCH + 6);
IDM_SEARCH_PREV_BOOKMARK                      = (IDM_SEARCH + 7);
IDM_SEARCH_CLEAR_BOOKMARKS                    = (IDM_SEARCH + 8);
IDM_SEARCH_GOTOMATCHINGBRACE                  = (IDM_SEARCH + 9);
IDM_SEARCH_FINDPREV                           = (IDM_SEARCH + 10);
IDM_SEARCH_FINDINCREMENT                      = (IDM_SEARCH + 11);
IDM_SEARCH_FINDINFILES                        = (IDM_SEARCH + 13);
IDM_SEARCH_VOLATILE_FINDNEXT                  = (IDM_SEARCH + 14);
IDM_SEARCH_VOLATILE_FINDPREV                  = (IDM_SEARCH + 15);
IDM_SEARCH_MARKALL                            = (IDM_SEARCH + 16);
IDM_SEARCH_UNMARKALL                          = (IDM_SEARCH + 17);

IDM_VIEW                                      = (IDM + 4000);
IDM_VIEW_TOOLBAR_HIDE                         = (IDM_VIEW + 1);
IDM_VIEW_TOOLBAR_REDUCE                       = (IDM_VIEW + 2);	
IDM_VIEW_TOOLBAR_ENLARGE                      = (IDM_VIEW + 3);
IDM_VIEW_TOOLBAR_STANDARD                     = (IDM_VIEW + 4);
IDM_VIEW_REDUCETABBAR                         = (IDM_VIEW + 5);
IDM_VIEW_LOCKTABBAR                           = (IDM_VIEW + 6); 
IDM_VIEW_DRAWTABBAR_TOPBAR                    = (IDM_VIEW + 7);
IDM_VIEW_DRAWTABBAR_INACIVETAB                = (IDM_VIEW + 8); 
IDM_VIEW_STATUSBAR                            = (IDM_VIEW + 9);  
IDM_VIEW_TOGGLE_FOLDALL                       = (IDM_VIEW + 10);
IDM_VIEW_USER_DLG                             = (IDM_VIEW + 11);
IDM_VIEW_LINENUMBER                           = (IDM_VIEW + 12);
IDM_VIEW_SYMBOLMARGIN                         = (IDM_VIEW + 13);
IDM_VIEW_FOLDERMAGIN                          = (IDM_VIEW + 14);
IDM_VIEW_FOLDERMAGIN_SIMPLE                   = (IDM_VIEW + 15);
IDM_VIEW_FOLDERMAGIN_ARROW                    = (IDM_VIEW + 16);
IDM_VIEW_FOLDERMAGIN_CIRCLE                   = (IDM_VIEW + 17);
IDM_VIEW_FOLDERMAGIN_BOX                      = (IDM_VIEW + 18);
IDM_VIEW_ALL_CHARACTERS                       = (IDM_VIEW + 19);
IDM_VIEW_INDENT_GUIDE                         = (IDM_VIEW + 20);
IDM_VIEW_CURLINE_HILITING                     = (IDM_VIEW + 21);
IDM_VIEW_WRAP                                 = (IDM_VIEW + 22);
IDM_VIEW_ZOOMIN                               = (IDM_VIEW + 23);
IDM_VIEW_ZOOMOUT                              = (IDM_VIEW + 24);
IDM_VIEW_TAB_SPACE                            = (IDM_VIEW + 25);
IDM_VIEW_EOL                                  = (IDM_VIEW + 26);
IDM_VIEW_EDGELINE                             = (IDM_VIEW + 27);
IDM_VIEW_EDGEBACKGROUND                       = (IDM_VIEW + 28);
IDM_VIEW_TOGGLE_UNFOLDALL                     = (IDM_VIEW + 29);
IDM_VIEW_FOLD_CURRENT                         = (IDM_VIEW + 30);
IDM_VIEW_UNFOLD_CURRENT                       = (IDM_VIEW + 31);
IDM_VIEW_FULLSCREENTOGGLE                     = (IDM_VIEW + 32);
IDM_VIEW_ZOOMRESTORE                          = (IDM_VIEW + 33);
IDM_VIEW_ALWAYSONTOP                          = (IDM_VIEW + 34);
IDM_VIEW_SYNSCROLLV                           = (IDM_VIEW + 35);
IDM_VIEW_SYNSCROLLH                           = (IDM_VIEW + 36);
IDM_VIEW_EDGENONE                             = (IDM_VIEW + 37);
IDM_VIEW_DRAWTABBAR_CLOSEBOTTUN               = (IDM_VIEW + 38);
IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE               = (IDM_VIEW + 39);
IDM_VIEW_REFRESHTABAR                         = (IDM_VIEW + 40);
IDM_VIEW_WRAP_SYMBOL                          = (IDM_VIEW + 41);

IDM_VIEW_FOLD                                 = (IDM_VIEW + 50);
IDM_VIEW_FOLD_1                               =	(IDM_VIEW_FOLD + 1);
IDM_VIEW_FOLD_2                               =	(IDM_VIEW_FOLD + 2);
IDM_VIEW_FOLD_3                               =	(IDM_VIEW_FOLD + 3);
IDM_VIEW_FOLD_4                               =	(IDM_VIEW_FOLD + 4);
IDM_VIEW_FOLD_5                               =	(IDM_VIEW_FOLD + 5);
IDM_VIEW_FOLD_6                               =	(IDM_VIEW_FOLD + 6);
IDM_VIEW_FOLD_7                               = (IDM_VIEW_FOLD + 7);
IDM_VIEW_FOLD_8                               = (IDM_VIEW_FOLD + 8);

IDM_VIEW_UNFOLD                               =	(IDM_VIEW + 60);
IDM_VIEW_UNFOLD_1                             =	(IDM_VIEW_UNFOLD + 1);
IDM_VIEW_UNFOLD_2                             =	(IDM_VIEW_UNFOLD + 2);
IDM_VIEW_UNFOLD_3                             =	(IDM_VIEW_UNFOLD + 3);
IDM_VIEW_UNFOLD_4                             =	(IDM_VIEW_UNFOLD + 4);
IDM_VIEW_UNFOLD_5                             =	(IDM_VIEW_UNFOLD + 5);
IDM_VIEW_UNFOLD_6                             =	(IDM_VIEW_UNFOLD + 6);
IDM_VIEW_UNFOLD_7                             = (IDM_VIEW_UNFOLD + 7);
IDM_VIEW_UNFOLD_8                             = (IDM_VIEW_UNFOLD + 8);

	

IDM_FORMAT                                    = (IDM + 5000);                          
IDM_FORMAT_TODOS                              =	(IDM_FORMAT + 1);
IDM_FORMAT_TOUNIX                             =	(IDM_FORMAT + 2);
IDM_FORMAT_TOMAC                              =	(IDM_FORMAT + 3);
	//NEW
IDM_FORMAT_ANSI                               =	(IDM_FORMAT + 4);
IDM_FORMAT_UTF_8                              =	(IDM_FORMAT + 5);
IDM_FORMAT_UCS_2BE                            =	(IDM_FORMAT + 6);
IDM_FORMAT_UCS_2LE                            = (IDM_FORMAT + 7);
IDM_FORMAT_AS_UTF_8                           =	(IDM_FORMAT + 8);
    //WEN
	
IDM_LANG                                      =	(IDM + 6000);
IDM_LANGSTYLE_CONFIG_DLG                      =	(IDM_LANG + 1);
IDM_LANG_C                                    =	(IDM_LANG + 2);
IDM_LANG_CPP                                  =	(IDM_LANG + 3);
IDM_LANG_JAVA                                 =	(IDM_LANG + 4);
IDM_LANG_HTML                                 =	(IDM_LANG + 5);		
IDM_LANG_XML                                  =	(IDM_LANG + 6);
IDM_LANG_JS                                   =	(IDM_LANG + 7);
IDM_LANG_PHP                                  =	(IDM_LANG + 8); 
IDM_LANG_ASP                                  =	(IDM_LANG + 9);
IDM_LANG_CSS                                  = (IDM_LANG + 10);
IDM_LANG_PASCAL                               =	(IDM_LANG + 11);
IDM_LANG_PYTHON                               =	(IDM_LANG + 12);
IDM_LANG_PERL                                 =	(IDM_LANG + 13);
IDM_LANG_OBJC                                 =	(IDM_LANG + 14); 
IDM_LANG_ASCII                                =	(IDM_LANG + 15);
IDM_LANG_TEXT                                 =	(IDM_LANG + 16);
IDM_LANG_RC                                   =	(IDM_LANG + 17);
IDM_LANG_MAKEFILE                             =	(IDM_LANG + 18);
IDM_LANG_INI                                  =	(IDM_LANG + 19);
IDM_LANG_SQL                                  =	(IDM_LANG + 20);
IDM_LANG_VB                                   =	(IDM_LANG + 21);
IDM_LANG_BATCH                                =	(IDM_LANG + 22);
IDM_LANG_CS                                   = (IDM_LANG + 23);
IDM_LANG_LUA                                  = (IDM_LANG + 24);
IDM_LANG_TEX                                  = (IDM_LANG + 25);
IDM_LANG_FORTRAN                              = (IDM_LANG + 26);
IDM_LANG_SH                                   = (IDM_LANG + 27);
IDM_LANG_FLASH                                = (IDM_LANG + 28);
IDM_LANG_NSIS                                 = (IDM_LANG + 29);
IDM_LANG_TCL                                  = (IDM_LANG + 30);
IDM_LANG_LISP                                 = (IDM_LANG + 31);
IDM_LANG_SCHEME                               = (IDM_LANG + 32);
IDM_LANG_ASM                                  = (IDM_LANG + 33);
IDM_LANG_DIFF                                 = (IDM_LANG + 34);
IDM_LANG_PROPS                                = (IDM_LANG + 35);
IDM_LANG_PS                                   = (IDM_LANG + 36);
IDM_LANG_RUBY                                 = (IDM_LANG + 37);
IDM_LANG_SMALLTALK                            = (IDM_LANG + 38);
IDM_LANG_VHDL                                 = (IDM_LANG + 39);
IDM_LANG_CAML                                 = (IDM_LANG + 40);
IDM_LANG_KIX                                  = (IDM_LANG + 41);
IDM_LANG_ADA                                  = (IDM_LANG + 42);
IDM_LANG_VERILOG                              = (IDM_LANG + 43);
IDM_LANG_AU3                                  = (IDM_LANG + 44);
IDM_LANG_MATLAB                               = (IDM_LANG + 45);
IDM_LANG_HASKELL                              = (IDM_LANG + 46);
IDM_LANG_INNO                                 = (IDM_LANG + 47);
IDM_LANG_CMAKE                                = (IDM_LANG + 48);
	
IDM_LANG_USER                                 =	(IDM_LANG + 50);     //46050
IDM_LANG_USER_LIMIT                           =	(IDM_LANG + 80);  //46080
	
IDM_ABOUT                                     =	(IDM  + 7000);
IDM_HOMESWEETHOME                             =	(IDM_ABOUT  + 1);
IDM_PROJECTPAGE                               =	(IDM_ABOUT  + 2);
IDM_ONLINEHELP                                =	(IDM_ABOUT  + 3);
IDM_FORUM                                     =	(IDM_ABOUT  + 4);
IDM_PLUGINSHOME                               =	(IDM_ABOUT  + 5);
	
IDC_MINIMIZED_TRAY                            = (IDM + 7001);

IDM_SETTING                                   = (IDM + 8000);
IDM_SETTING_TAB_SIZE                          = (IDM_SETTING + 1);
IDM_SETTING_TAB_REPLCESPACE                   = (IDM_SETTING + 2);
IDM_SETTING_HISTORY_SIZE                      = (IDM_SETTING + 3);
IDM_SETTING_EDGE_SIZE                         = (IDM_SETTING + 4);
IDM_SETTING_FILEASSOCIATION_DLG               = (IDM_SETTING + 5);
//IDM_SETTING_FILE_AUTODETECTION              = (IDM_SETTING + 6);
IDM_SETTING_HISTORY_DONT_CHECK                = (IDM_SETTING + 7);
IDM_SETTING_TRAYICON                          = (IDM_SETTING + 8);
IDM_SETTING_SHORTCUT_MAPPER                   = (IDM_SETTING + 9);
IDM_SETTING_REMEMBER_LAST_SESSION             = (IDM_SETTING + 10);
IDM_SETTING_PREFERECE                         = (IDM_SETTING + 11);

IDM_SETTING_FILE_AUTODETECTION_ENABLE         = (IDM_SETTING + 12);
IDM_SETTING_FILE_AUTODETECTION_DISABLE        = (IDM_SETTING + 13);
IDM_SETTING_FILE_AUTODETECTION_ENABLESILENTLY = (IDM_SETTING + 14);
{
IDM_SETTING_SETUTF8SANSBOM                    = (IDM_SETTING + 15);
IDM_SETTING_SETANSI                           = (IDM_SETTING + 16);
}
	
IDM_EXECUTE                                   = (IDM + 9000);      

IDC_DOC_GOTO_ANOTHER_VIEW                     =		10001;
IDC_DOC_CLONE_TO_ANOTHER_VIEW                 = 	10002;

IDCMD                                         = 50000;
IDC_AUTOCOMPLETE                              =	(IDCMD+0);
IDC_AUTOCOMPLETE_CURRENTFILE                  =	(IDCMD+1);
//IDC_SEARCH_FINDPREVSELECTED                 =	(IDCMD+2);
IDC_PREV_DOC                                  =	(IDCMD+3);
IDC_NEXT_DOC                                  =	(IDCMD+4);
IDC_EDIT_TOGGLEMACRORECORDING                 =	(IDCMD+5);
IDC_KEY_HOME                                  =	(IDCMD+6);
IDC_KEY_END                                   =	(IDCMD+7);
IDC_KEY_SELECT_2_HOME                         =	(IDCMD+8);
IDC_KEY_SELECT_2_END                          =	(IDCMD+9);
	
IDCMD_LIMIT                                   =	(IDCMD+20);

IDSCINTILLA                                   = 60000;				
IDSCINTILLA_KEY_HOME                          = (IDSCINTILLA+0);
IDSCINTILLA_KEY_HOME_WRAP                     = (IDSCINTILLA+1);
IDSCINTILLA_KEY_END                           = (IDSCINTILLA+2);
IDSCINTILLA_KEY_END_WRAP                      = (IDSCINTILLA+3);
IDSCINTILLA_KEY_LINE_DUP                      = (IDSCINTILLA+4);
IDSCINTILLA_KEY_LINE_CUT                      = (IDSCINTILLA+5);
IDSCINTILLA_KEY_LINE_DEL                      = (IDSCINTILLA+6);
IDSCINTILLA_KEY_LINE_TRANS                    = (IDSCINTILLA+7);
IDSCINTILLA_KEY_LINE_COPY                     = (IDSCINTILLA+8);
IDSCINTILLA_KEY_CUT                           = (IDSCINTILLA+9);
IDSCINTILLA_KEY_COPY                          = (IDSCINTILLA+10);
IDSCINTILLA_KEY_PASTE                         = (IDSCINTILLA+11);
IDSCINTILLA_KEY_DEL                           = (IDSCINTILLA+12);
IDSCINTILLA_KEY_SELECTALL                     = (IDSCINTILLA+13);
IDSCINTILLA_KEY_OUTDENT                       = (IDSCINTILLA+14);
IDSCINTILLA_KEY_UNDO                          = (IDSCINTILLA+15);
IDSCINTILLA_KEY_REDO                          = (IDSCINTILLA+16);
IDSCINTILLA_LIMIT                             =	(IDSCINTILLA+30);

IDD_FILEVIEW_DIALOG                           =		1000;
IDC_BUTTON_PRINT                              =  1001;

IDD_CREATE_DIRECTORY                          =		1100;
IDC_STATIC_CURRENT_FOLDER                     =  1101;
IDC_EDIT_NEW_FOLDER                           =  1102;

IDD_INSERT_INPUT_TEXT                         =		1200;
IDC_EDIT_INPUT_VALUE                          =		1201;
IDC_STATIC_INPUT_TITLE                        =		1202;
IDC_ICON_INPUT_ICON                           =		1203;

IDR_M30_MENU                                  =		1500;
IDR_NPP_ACCELERATORS                          =		1501;
//IDR_NPP_ACCELERATORS_98                     =		1502;

//IDD_FIND_REPLACE_DLG                        =		1600;

IDD_ABOUTBOX                                  = 1700;
IDC_LICENCE_EDIT                              = 1701;
IDC_HOME_ADDR                                 = 1702;
IDC_EMAIL_ADDR                                = 1703;
IDC_ONLINEHELP_ADDR                           = 1704;
IDC_AUTHOR_NAME                               = 1705;

//IDD_USER_DEFINE_BOX                         =	 1800;

//IDD_RUN_DLG                                 =  1900;

IDD_GOLINE                                    =		2000;
ID_GOLINE_EDIT                                =	(IDD_GOLINE + 1);
ID_CURRLINE                                   =	(IDD_GOLINE + 2);
ID_LASTLINE                                   =	(IDD_GOLINE + 3);
ID_URHERE_STATIC                              = (IDD_GOLINE + 4);
ID_UGO_STATIC                                 = (IDD_GOLINE + 5);
ID_NOMORETHAN_STATIC                          = (IDD_GOLINE + 6);

// voir columnEditor_rc.h
//IDD_COLUMNEDIT                              =  2020;


//IDD_COLOUR_POPUP                            =  2100;

// See WordStyleDlgRes.h
//IDD_STYLER_DLG                              = 2200;
//IDD_GLOBAL_STYLER_DLG                       = 2300;

IDD_VALUE_DLG                                 =  2400;
IDC_VALUE_STATIC                              =  2401;
IDC_VALUE_EDIT                                =  2402;

// see TaskListDlg_rc.h
//IDD_TASKLIST_DLG                            =  2450;
IDD_SETTING_DLG                               =  2500;

//See ShortcutMapper_rc.h
//IDD_SHORTCUTMAPPER_DLG                      =  2600;

// See regExtDlg.h
//IDD_REGEXT                                  = 4000;

// See shortcutRc.h
//IDD_SHORTCUT_DLG                            = 5000;

// See preference.rc
//IDD_PREFERENCE_BOX                          = 6000;

NOTEPADPLUS_USER_INTERNAL                     = (WM_USER + 0000);
NPPM_INTERNAL_USERCMDLIST_MODIFIED            = (NOTEPADPLUS_USER_INTERNAL + 1);
NPPM_INTERNAL_CMDLIST_MODIFIED                = (NOTEPADPLUS_USER_INTERNAL + 2);
NPPM_INTERNAL_MACROLIST_MODIFIED              = (NOTEPADPLUS_USER_INTERNAL + 3);
NPPM_INTERNAL_PLUGINCMDLIST_MODIFIED          = (NOTEPADPLUS_USER_INTERNAL + 4);
NPPM_INTERNAL_CLEARSCINTILLAKEY               = (NOTEPADPLUS_USER_INTERNAL + 5);
NPPM_INTERNAL_BINDSCINTILLAKEY                = (NOTEPADPLUS_USER_INTERNAL + 6);
NPPM_INTERNAL_SCINTILLAKEYMODIFIED            = (NOTEPADPLUS_USER_INTERNAL + 7);
NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE         = (NOTEPADPLUS_USER_INTERNAL + 8);
NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE       = (NOTEPADPLUS_USER_INTERNAL + 9);
// See Notepad_plus_msgs.h
//NOTEPADPLUS_USER                            = (WM_USER + 1000);
SCINTILLA_USER                                = (WM_USER + 2000);


MACRO_USER                                    = (WM_USER + 4000);
WM_ISCURRENTMACRORECORDED                     = (MACRO_USER + 01);
WM_MACRODLGRUNMACRO                           = (MACRO_USER + 02);


// See Notepad_plus_msgs.h
//RUNCOMMAND_USER                             = (WM_USER + 3000);
SPLITTER_USER                                 = (WM_USER + 4000);
WORDSTYLE_USER                                = (WM_USER + 5000);
COLOURPOPUP_USER                              = (WM_USER + 6000);
BABYGRID_USER                                 = (WM_USER + 7000);

//IDD_DOCKING_MNG                             =	(IDM  + 7000);

MENUINDEX_FILE                                = 0;
MENUINDEX_EDIT                                = 1;
MENUINDEX_SEARCH                              = 2;
MENUINDEX_VIEW                                = 3;
MENUINDEX_FORMAT                              = 4;
MENUINDEX_LANGUAGE                            = 5;
MENUINDEX_SETTINGS                            = 6;
MENUINDEX_MACRO                               = 7;
MENUINDEX_RUN                                 = 8;
MENUINDEX_PLUGINS                             = 9;

type TLangType = (L_TXT,
	                 L_PHP,
	                 L_C,
	                 L_CPP,
	                 L_CS,
	                 L_OBJC,
	                 L_JAVA,
	                 L_RC,
	                 L_HTML,
	                 L_XML,
	                 L_MAKEFILE,
	                 L_PASCAL,
	                 L_BATCH,
	                 L_INI,
	                 L_NFO,
	                 L_USER,
	                 L_ASP,
	                 L_SQL,
	                 L_VB,
	                 L_JS,
	                 L_CSS,
	                 L_PERL,
	                 L_PYTHON,
	                 L_LUA,
	                 L_TEX,
	                 L_FORTRAN,
	                 L_BASH,
	                 L_FLASH,
	                 L_NSIS,
	                 L_TCL,
                  L_LISP,
	                 L_SCHEME,
	                 L_ASM,
	                 L_DIFF,
	                 L_PROPS,
	                 L_PS,
	                 L_RUBY,
	                 L_SMALLTALK,
	                 L_VHDL,
                  L_END);

Added src/NPPInterface.pas.









































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
// $HDR$
// $Log:  157175: NPPInterface.pas 
//
//    Rev 1.0    9/22/2009 16:57:12  merijn
unit NPPInterface;

interface

uses
  Windows, Messages;

{$I NPPConsts.inc}

type TNPPInterface = class(TObject)
     private
      fNPPHandle: hwnd;

      function NPerform(Msg: Cardinal; wParam: integer = 0; lParam: integer = 0): integer;

      function GetCurrentPrimaryScintillaHandle: hwnd;
    function GetCurrentFullPath: string;
    function GetCurrentLangType: TLangType;
    procedure SetCurrentLangType(const Value: TLangType);
     public
      constructor Create;

      property NPPHandle: hwnd read fNPPHandle write fNPPHandle;

      procedure NewFile;
      property CurrentPrimaryScintillaHandle: hwnd read GetCurrentPrimaryScintillaHandle;
      property CurrentFullPath: string read GetCurrentFullPath;

      property LangType: TLangType read GetCurrentLangType write SetCurrentLangType;
     end;

implementation

uses
  SysUtils;

{ TNPPInterface }


function WideStrLen(WideStr: WideString): integer;
begin
 result := 0;

 while (result < Length(WideStr)) and (WideStr[result + 1] <> #0) do
  inc(result);
end;

constructor TNPPInterface.Create;
begin
 inherited;

 fNPPHandle := 0;
end;

function TNPPInterface.GetCurrentFullPath: string;
var Path: WideString;
begin
 SetLength(Path, MAX_PATH);
 ZeroMemory(@Path[1], Length(Path) * SizeOf(WideChar));
 SendMessage(fNPPHandle, NPPM_GETFULLCURRENTPATH, 0, lParam(PWideChar(Path)));
 SetLength(Path, WideStrLen(Path));
 result := Path;
end;

function TNPPInterface.GetCurrentLangType: TLangType;
begin
 SendMessage(fNPPHandle, NPPM_GETCURRENTLANGTYPE, 0, integer(@result));
end;

function TNPPInterface.GetCurrentPrimaryScintillaHandle: hwnd;
var CurEdit: integer;
begin
// result := hwnd(MAIN_VIEW);
 SendMessage(fNPPHandle, NPPM_GETCURRENTSCINTILLA, 0, integer(@CurEdit));
 result := CurEdit;
end;

procedure TNPPInterface.NewFile;
begin
 NPerform(WM_COMMAND, IDM_FILE_NEW)
end;

function TNPPInterface.NPerform(Msg: Cardinal; wParam, lParam: integer): integer;
begin
 if fNPPHandle = 0 then
  raise Exception.Create('no handle defined!');

 result := SendMessage(fNPPHandle, Msg, wParam, lParam);
end;

procedure TNPPInterface.SetCurrentLangType(const Value: TLangType);
begin
 SendMessage(fNPPHandle, NPPM_SETCURRENTLANGTYPE, 0, integer(Value));
end;

end.

Added src/Progress.dfm.

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
object FormProgress: TFormProgress
  Left = 0
  Top = 0
  BorderIcons = [biMinimize]
  BorderStyle = bsSizeToolWin
  Caption = 'filtering'
  ClientHeight = 25
  ClientWidth = 302
  Color = clBtnFace
  Constraints.MaxHeight = 59
  Constraints.MinHeight = 51
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  OnCreate = FormCreate
  DesignSize = (
    302
    25)
  PixelsPerInch = 96
  TextHeight = 13
  object SpeedButtonCancel: TSpeedButton
    Left = 254
    Top = 5
    Width = 43
    Height = 17
    Anchors = [akTop, akRight]
    Caption = 'cancel'
    Flat = True
    OnClick = SpeedButtonCancelClick
  end
  object ProgressBar: TProgressBar
    Left = 4
    Top = 5
    Width = 244
    Height = 17
    Anchors = [akLeft, akTop, akRight]
    Step = 1
    TabOrder = 0
  end
end

Added src/Progress.pas.

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
unit Progress;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, Buttons;

type
  TFormProgress = class(TForm)
    ProgressBar: TProgressBar;
    SpeedButtonCancel: TSpeedButton;
    procedure FormCreate(Sender: TObject);
    procedure SpeedButtonCancelClick(Sender: TObject);
  public
   Cancel: boolean;

   procedure Step;
  end;

var
  FormProgress: TFormProgress;

implementation

{$R *.dfm}

procedure TFormProgress.FormCreate(Sender: TObject);
begin
 Cancel := false;
end;

procedure TFormProgress.SpeedButtonCancelClick(Sender: TObject);
begin
 Cancel := true;
end;

procedure TFormProgress.Step;
begin
 ProgressBar.StepIt();
 Application.ProcessMessages();
end;

end.

Added src/QStrings.pas.

more than 10,000 changes

Added src/SCIConsts.inc.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
const
    INVALID_POSITION = -1;
    SCI_START = 2000;
    SCI_OPTIONAL_START = 3000;
    SCI_LEXER_START = 4000;
    SCI_ADDTEXT = 2001;
    SCI_ADDSTYLEDTEXT = 2002;
    SCI_INSERTTEXT = 2003;
    SCI_CLEARALL = 2004;
    SCI_CLEARDOCUMENTSTYLE = 2005;
    SCI_GETLENGTH = 2006;
    SCI_GETCHARAT = 2007;
    SCI_GETCURRENTPOS = 2008;
    SCI_GETANCHOR = 2009;
    SCI_GETSTYLEAT = 2010;
    SCI_REDO = 2011;
    SCI_SETUNDOCOLLECTION = 2012;
    SCI_SELECTALL = 2013;
    SCI_SETSAVEPOINT = 2014;
    SCI_GETSTYLEDTEXT = 2015;
    SCI_CANREDO = 2016;
    SCI_MARKERLINEFROMHANDLE = 2017;
    SCI_MARKERDELETEHANDLE = 2018;
    SCI_GETUNDOCOLLECTION = 2019;
    SCWS_INVISIBLE = 0;
    SCWS_VISIBLEALWAYS = 1;
    SCWS_VISIBLEAFTERINDENT = 2;
    SCI_GETVIEWWS = 2020;
    SCI_SETVIEWWS = 2021;
    SCI_POSITIONFROMPOINT = 2022;
    SCI_POSITIONFROMPOINTCLOSE = 2023;
    SCI_GOTOLINE = 2024;
    SCI_GOTOPOS = 2025;
    SCI_SETANCHOR = 2026;
    SCI_GETCURLINE = 2027;
    SCI_GETENDSTYLED = 2028;
    SC_EOL_CRLF = 0;
    SC_EOL_CR = 1;
    SC_EOL_LF = 2;
    SCI_CONVERTEOLS = 2029;
    SCI_GETEOLMODE = 2030;
    SCI_SETEOLMODE = 2031;
    SCI_STARTSTYLING = 2032;
    SCI_SETSTYLING = 2033;
    SCI_GETBUFFEREDDRAW = 2034;
    SCI_SETBUFFEREDDRAW = 2035;
    SCI_SETTABWIDTH = 2036;
    SCI_GETTABWIDTH = 2121;
    SC_CP_UTF8 = 65001;
    SC_CP_DBCS = 1;
    SCI_SETCODEPAGE = 2037;
    SCI_SETUSEPALETTE = 2039;
    MARKER_MAX = 31;
    SC_MARK_CIRCLE = 0;
    SC_MARK_ROUNDRECT = 1;
    SC_MARK_ARROW = 2;
    SC_MARK_SMALLRECT = 3;
    SC_MARK_SHORTARROW = 4;
    SC_MARK_EMPTY = 5;
    SC_MARK_ARROWDOWN = 6;
    SC_MARK_MINUS = 7;
    SC_MARK_PLUS = 8;
    SC_MARK_VLINE = 9;
    SC_MARK_LCORNER = 10;
    SC_MARK_TCORNER = 11;
    SC_MARK_BOXPLUS = 12;
    SC_MARK_BOXPLUSCONNECTED = 13;
    SC_MARK_BOXMINUS = 14;
    SC_MARK_BOXMINUSCONNECTED = 15;
    SC_MARK_LCORNERCURVE = 16;
    SC_MARK_TCORNERCURVE = 17;
    SC_MARK_CIRCLEPLUS = 18;
    SC_MARK_CIRCLEPLUSCONNECTED = 19;
    SC_MARK_CIRCLEMINUS = 20;
    SC_MARK_CIRCLEMINUSCONNECTED = 21;
    SC_MARK_BACKGROUND = 22;
    SC_MARK_DOTDOTDOT = 23;
    SC_MARK_ARROWS = 24;
    SC_MARK_PIXMAP = 25;
    SC_MARK_FULLRECT = 26;
    SC_MARK_CHARACTER = 10000;
    SC_MARKNUM_FOLDEREND = 25;
    SC_MARKNUM_FOLDEROPENMID = 26;
    SC_MARKNUM_FOLDERMIDTAIL = 27;
    SC_MARKNUM_FOLDERTAIL = 28;
    SC_MARKNUM_FOLDERSUB = 29;
    SC_MARKNUM_FOLDER = 30;
    SC_MARKNUM_FOLDEROPEN = 31;
    SC_MASK_FOLDERS = $FE000000;
    SCI_MARKERDEFINE = 2040;
    SCI_MARKERSETFORE = 2041;
    SCI_MARKERSETBACK = 2042;
    SCI_MARKERADD = 2043;
    SCI_MARKERDELETE = 2044;
    SCI_MARKERDELETEALL = 2045;
    SCI_MARKERGET = 2046;
    SCI_MARKERNEXT = 2047;
    SCI_MARKERPREVIOUS = 2048;
    SCI_MARKERDEFINEPIXMAP = 2049;
    SCI_MARKERADDSET = 2466;
    SCI_MARKERSETALPHA = 2476;
    SC_MARGIN_SYMBOL = 0;
    SC_MARGIN_NUMBER = 1;
    SC_MARGIN_BACK = 2;
    SC_MARGIN_FORE = 3;
    SCI_SETMARGINTYPEN = 2240;
    SCI_GETMARGINTYPEN = 2241;
    SCI_SETMARGINWIDTHN = 2242;
    SCI_GETMARGINWIDTHN = 2243;
    SCI_SETMARGINMASKN = 2244;
    SCI_GETMARGINMASKN = 2245;
    SCI_SETMARGINSENSITIVEN = 2246;
    SCI_GETMARGINSENSITIVEN = 2247;
    STYLE_DEFAULT = 32;
    STYLE_LINENUMBER = 33;
    STYLE_BRACELIGHT = 34;
    STYLE_BRACEBAD = 35;
    STYLE_CONTROLCHAR = 36;
    STYLE_INDENTGUIDE = 37;
    STYLE_CALLTIP = 38;
    STYLE_LASTPREDEFINED = 39;
    STYLE_MAX = 127;
    SC_CHARSET_ANSI = 0;
    SC_CHARSET_DEFAULT = 1;
    SC_CHARSET_BALTIC = 186;
    SC_CHARSET_CHINESEBIG5 = 136;
    SC_CHARSET_EASTEUROPE = 238;
    SC_CHARSET_GB2312 = 134;
    SC_CHARSET_GREEK = 161;
    SC_CHARSET_HANGUL = 129;
    SC_CHARSET_MAC = 77;
    SC_CHARSET_OEM = 255;
    SC_CHARSET_RUSSIAN = 204;
    SC_CHARSET_CYRILLIC = 1251;
    SC_CHARSET_SHIFTJIS = 128;
    SC_CHARSET_SYMBOL = 2;
    SC_CHARSET_TURKISH = 162;
    SC_CHARSET_JOHAB = 130;
    SC_CHARSET_HEBREW = 177;
    SC_CHARSET_ARABIC = 178;
    SC_CHARSET_VIETNAMESE = 163;
    SC_CHARSET_THAI = 222;
    SC_CHARSET_8859_15 = 1000;
    SCI_STYLECLEARALL = 2050;
    SCI_STYLESETFORE = 2051;
    SCI_STYLESETBACK = 2052;
    SCI_STYLESETBOLD = 2053;
    SCI_STYLESETITALIC = 2054;
    SCI_STYLESETSIZE = 2055;
    SCI_STYLESETFONT = 2056;
    SCI_STYLESETEOLFILLED = 2057;
    SCI_STYLERESETDEFAULT = 2058;
    SCI_STYLESETUNDERLINE = 2059;
    SC_CASE_MIXED = 0;
    SC_CASE_UPPER = 1;
    SC_CASE_LOWER = 2;
    SCI_STYLESETCASE = 2060;
    SCI_STYLESETCHARACTERSET = 2066;
    SCI_STYLESETHOTSPOT = 2409;
    SCI_SETSELFORE = 2067;
    SCI_SETSELBACK = 2068;
    SCI_GETSELALPHA = 2477;
    SCI_SETSELALPHA = 2478;
    SCI_SETCARETFORE = 2069;
    SCI_ASSIGNCMDKEY = 2070;
    SCI_CLEARCMDKEY = 2071;
    SCI_CLEARALLCMDKEYS = 2072;
    SCI_SETSTYLINGEX = 2073;
    SCI_STYLESETVISIBLE = 2074;
    SCI_GETCARETPERIOD = 2075;
    SCI_SETCARETPERIOD = 2076;
    SCI_SETWORDCHARS = 2077;
    SCI_BEGINUNDOACTION = 2078;
    SCI_ENDUNDOACTION = 2079;
    INDIC_MAX = 7;
    INDIC_PLAIN = 0;
    INDIC_SQUIGGLE = 1;
    INDIC_TT = 2;
    INDIC_DIAGONAL = 3;
    INDIC_STRIKE = 4;
    INDIC_HIDDEN = 5;
    INDIC_BOX = 6;
    INDIC_ROUNDBOX = 7;
    INDIC0_MASK = $20;
    INDIC1_MASK = $40;
    INDIC2_MASK = $80;
    INDICS_MASK = $E0;
    SCI_INDICSETSTYLE = 2080;
    SCI_INDICGETSTYLE = 2081;
    SCI_INDICSETFORE = 2082;
    SCI_INDICGETFORE = 2083;
    SCI_SETWHITESPACEFORE = 2084;
    SCI_SETWHITESPACEBACK = 2085;
    SCI_SETSTYLEBITS = 2090;
    SCI_GETSTYLEBITS = 2091;
    SCI_SETLINESTATE = 2092;
    SCI_GETLINESTATE = 2093;
    SCI_GETMAXLINESTATE = 2094;
    SCI_GETCARETLINEVISIBLE = 2095;
    SCI_SETCARETLINEVISIBLE = 2096;
    SCI_GETCARETLINEBACK = 2097;
    SCI_SETCARETLINEBACK = 2098;
    SCI_STYLESETCHANGEABLE = 2099;
    SCI_AUTOCSHOW = 2100;
    SCI_AUTOCCANCEL = 2101;
    SCI_AUTOCACTIVE = 2102;
    SCI_AUTOCPOSSTART = 2103;
    SCI_AUTOCCOMPLETE = 2104;
    SCI_AUTOCSTOPS = 2105;
    SCI_AUTOCSETSEPARATOR = 2106;
    SCI_AUTOCGETSEPARATOR = 2107;
    SCI_AUTOCSELECT = 2108;
    SCI_AUTOCSETCANCELATSTART = 2110;
    SCI_AUTOCGETCANCELATSTART = 2111;
    SCI_AUTOCSETFILLUPS = 2112;
    SCI_AUTOCSETCHOOSESINGLE = 2113;
    SCI_AUTOCGETCHOOSESINGLE = 2114;
    SCI_AUTOCSETIGNORECASE = 2115;
    SCI_AUTOCGETIGNORECASE = 2116;
    SCI_USERLISTSHOW = 2117;
    SCI_AUTOCSETAUTOHIDE = 2118;
    SCI_AUTOCGETAUTOHIDE = 2119;
    SCI_AUTOCSETDROPRESTOFWORD = 2270;
    SCI_AUTOCGETDROPRESTOFWORD = 2271;
    SCI_REGISTERIMAGE = 2405;
    SCI_CLEARREGISTEREDIMAGES = 2408;
    SCI_AUTOCGETTYPESEPARATOR = 2285;
    SCI_AUTOCSETTYPESEPARATOR = 2286;
    SCI_AUTOCSETMAXWIDTH = 2208;
    SCI_AUTOCGETMAXWIDTH = 2209;
    SCI_AUTOCSETMAXHEIGHT = 2210;
    SCI_AUTOCGETMAXHEIGHT = 2211;
    SCI_SETINDENT = 2122;
    SCI_GETINDENT = 2123;
    SCI_SETUSETABS = 2124;
    SCI_GETUSETABS = 2125;
    SCI_SETLINEINDENTATION = 2126;
    SCI_GETLINEINDENTATION = 2127;
    SCI_GETLINEINDENTPOSITION = 2128;
    SCI_GETCOLUMN = 2129;
    SCI_SETHSCROLLBAR = 2130;
    SCI_GETHSCROLLBAR = 2131;
    SCI_SETINDENTATIONGUIDES = 2132;
    SCI_GETINDENTATIONGUIDES = 2133;
    SCI_SETHIGHLIGHTGUIDE = 2134;
    SCI_GETHIGHLIGHTGUIDE = 2135;
    SCI_GETLINEENDPOSITION = 2136;
    SCI_GETCODEPAGE = 2137;
    SCI_GETCARETFORE = 2138;
    SCI_GETUSEPALETTE = 2139;
    SCI_GETREADONLY = 2140;
    SCI_SETCURRENTPOS = 2141;
    SCI_SETSELECTIONSTART = 2142;
    SCI_GETSELECTIONSTART = 2143;
    SCI_SETSELECTIONEND = 2144;
    SCI_GETSELECTIONEND = 2145;
    SCI_SETPRINTMAGNIFICATION = 2146;
    SCI_GETPRINTMAGNIFICATION = 2147;
    SC_PRINT_NORMAL = 0;
    SC_PRINT_INVERTLIGHT = 1;
    SC_PRINT_BLACKONWHITE = 2;
    SC_PRINT_COLOURONWHITE = 3;
    SC_PRINT_COLOURONWHITEDEFAULTBG = 4;
    SCI_SETPRINTCOLOURMODE = 2148;
    SCI_GETPRINTCOLOURMODE = 2149;
    SCFIND_WHOLEWORD = 2;
    SCFIND_MATCHCASE = 4;
    SCFIND_WORDSTART = $00100000;
    SCFIND_REGEXP = $00200000;
    SCFIND_POSIX = $00400000;
    SCI_FINDTEXT = 2150;
    SCI_FORMATRANGE = 2151;
    SCI_GETFIRSTVISIBLELINE = 2152;
    SCI_GETLINE = 2153;
    SCI_GETLINECOUNT = 2154;
    SCI_SETMARGINLEFT = 2155;
    SCI_GETMARGINLEFT = 2156;
    SCI_SETMARGINRIGHT = 2157;
    SCI_GETMARGINRIGHT = 2158;
    SCI_GETMODIFY = 2159;
    SCI_SETSEL = 2160;
    SCI_GETSELTEXT = 2161;
    SCI_GETTEXTRANGE = 2162;
    SCI_HIDESELECTION = 2163;
    SCI_POINTXFROMPOSITION = 2164;
    SCI_POINTYFROMPOSITION = 2165;
    SCI_LINEFROMPOSITION = 2166;
    SCI_POSITIONFROMLINE = 2167;
    SCI_LINESCROLL = 2168;
    SCI_SCROLLCARET = 2169;
    SCI_REPLACESEL = 2170;
    SCI_SETREADONLY = 2171;
    SCI_NULL = 2172;
    SCI_CANPASTE = 2173;
    SCI_CANUNDO = 2174;
    SCI_EMPTYUNDOBUFFER = 2175;
    SCI_UNDO = 2176;
    SCI_CUT = 2177;
    SCI_COPY = 2178;
    SCI_PASTE = 2179;
    SCI_CLEAR = 2180;
    SCI_SETTEXT = 2181;
    SCI_GETTEXT = 2182;
    SCI_GETTEXTLENGTH = 2183;
    SCI_GETDIRECTFUNCTION = 2184;
    SCI_GETDIRECTPOINTER = 2185;
    SCI_SETOVERTYPE = 2186;
    SCI_GETOVERTYPE = 2187;
    SCI_SETCARETWIDTH = 2188;
    SCI_GETCARETWIDTH = 2189;
    SCI_SETTARGETSTART = 2190;
    SCI_GETTARGETSTART = 2191;
    SCI_SETTARGETEND = 2192;
    SCI_GETTARGETEND = 2193;
    SCI_REPLACETARGET = 2194;
    SCI_REPLACETARGETRE = 2195;
    SCI_SEARCHINTARGET = 2197;
    SCI_SETSEARCHFLAGS = 2198;
    SCI_GETSEARCHFLAGS = 2199;
    SCI_CALLTIPSHOW = 2200;
    SCI_CALLTIPCANCEL = 2201;
    SCI_CALLTIPACTIVE = 2202;
    SCI_CALLTIPPOSSTART = 2203;
    SCI_CALLTIPSETHLT = 2204;
    SCI_CALLTIPSETBACK = 2205;
    SCI_CALLTIPSETFORE = 2206;
    SCI_CALLTIPSETFOREHLT = 2207;
    SCI_CALLTIPUSESTYLE = 2212;
    SCI_VISIBLEFROMDOCLINE = 2220;
    SCI_DOCLINEFROMVISIBLE = 2221;
    SCI_WRAPCOUNT = 2235;
    SC_FOLDLEVELBASE = $400;
    SC_FOLDLEVELWHITEFLAG = $1000;
    SC_FOLDLEVELHEADERFLAG = $2000;
    SC_FOLDLEVELBOXHEADERFLAG = $4000;
    SC_FOLDLEVELBOXFOOTERFLAG = $8000;
    SC_FOLDLEVELCONTRACTED = $10000;
    SC_FOLDLEVELUNINDENT = $20000;
    SC_FOLDLEVELNUMBERMASK = $0FFF;
    SCI_SETFOLDLEVEL = 2222;
    SCI_GETFOLDLEVEL = 2223;
    SCI_GETLASTCHILD = 2224;
    SCI_GETFOLDPARENT = 2225;
    SCI_SHOWLINES = 2226;
    SCI_HIDELINES = 2227;
    SCI_GETLINEVISIBLE = 2228;
    SCI_SETFOLDEXPANDED = 2229;
    SCI_GETFOLDEXPANDED = 2230;
    SCI_TOGGLEFOLD = 2231;
    SCI_ENSUREVISIBLE = 2232;
    SC_FOLDFLAG_LINEBEFORE_EXPANDED = $0002;
    SC_FOLDFLAG_LINEBEFORE_CONTRACTED = $0004;
    SC_FOLDFLAG_LINEAFTER_EXPANDED = $0008;
    SC_FOLDFLAG_LINEAFTER_CONTRACTED = $0010;
    SC_FOLDFLAG_LEVELNUMBERS = $0040;
    SC_FOLDFLAG_BOX = $0001;
    SCI_SETFOLDFLAGS = 2233;
    SCI_ENSUREVISIBLEENFORCEPOLICY = 2234;
    SCI_SETTABINDENTS = 2260;
    SCI_GETTABINDENTS = 2261;
    SCI_SETBACKSPACEUNINDENTS = 2262;
    SCI_GETBACKSPACEUNINDENTS = 2263;
    SC_TIME_FOREVER = 10000000;
    SCI_SETMOUSEDWELLTIME = 2264;
    SCI_GETMOUSEDWELLTIME = 2265;
    SCI_WORDSTARTPOSITION = 2266;
    SCI_WORDENDPOSITION = 2267;
    SC_WRAP_NONE = 0;
    SC_WRAP_WORD = 1;
    SC_WRAP_CHAR = 2;
    SCI_SETWRAPMODE = 2268;
    SCI_GETWRAPMODE = 2269;
    SC_WRAPVISUALFLAG_NONE = $0000;
    SC_WRAPVISUALFLAG_END = $0001;
    SC_WRAPVISUALFLAG_START = $0002;
    SCI_SETWRAPVISUALFLAGS = 2460;
    SCI_GETWRAPVISUALFLAGS = 2461;
    SC_WRAPVISUALFLAGLOC_DEFAULT = $0000;
    SC_WRAPVISUALFLAGLOC_END_BY_TEXT = $0001;
    SC_WRAPVISUALFLAGLOC_START_BY_TEXT = $0002;
    SCI_SETWRAPVISUALFLAGSLOCATION = 2462;
    SCI_GETWRAPVISUALFLAGSLOCATION = 2463;
    SCI_SETWRAPSTARTINDENT = 2464;
    SCI_GETWRAPSTARTINDENT = 2465;
    SC_CACHE_NONE = 0;
    SC_CACHE_CARET = 1;
    SC_CACHE_PAGE = 2;
    SC_CACHE_DOCUMENT = 3;
    SCI_SETLAYOUTCACHE = 2272;
    SCI_GETLAYOUTCACHE = 2273;
    SCI_SETSCROLLWIDTH = 2274;
    SCI_GETSCROLLWIDTH = 2275;
    SCI_TEXTWIDTH = 2276;
    SCI_SETENDATLASTLINE = 2277;
    SCI_GETENDATLASTLINE = 2278;
    SCI_TEXTHEIGHT = 2279;
    SCI_SETVSCROLLBAR = 2280;
    SCI_GETVSCROLLBAR = 2281;
    SCI_APPENDTEXT = 2282;
    SCI_GETTWOPHASEDRAW = 2283;
    SCI_SETTWOPHASEDRAW = 2284;
    SCI_TARGETFROMSELECTION = 2287;
    SCI_LINESJOIN = 2288;
    SCI_LINESSPLIT = 2289;
    SCI_SETFOLDMARGINCOLOUR = 2290;
    SCI_SETFOLDMARGINHICOLOUR = 2291;
    SCI_LINEDOWN = 2300;
    SCI_LINEDOWNEXTEND = 2301;
    SCI_LINEUP = 2302;
    SCI_LINEUPEXTEND = 2303;
    SCI_CHARLEFT = 2304;
    SCI_CHARLEFTEXTEND = 2305;
    SCI_CHARRIGHT = 2306;
    SCI_CHARRIGHTEXTEND = 2307;
    SCI_WORDLEFT = 2308;
    SCI_WORDLEFTEXTEND = 2309;
    SCI_WORDRIGHT = 2310;
    SCI_WORDRIGHTEXTEND = 2311;
    SCI_HOME = 2312;
    SCI_HOMEEXTEND = 2313;
    SCI_LINEEND = 2314;
    SCI_LINEENDEXTEND = 2315;
    SCI_DOCUMENTSTART = 2316;
    SCI_DOCUMENTSTARTEXTEND = 2317;
    SCI_DOCUMENTEND = 2318;
    SCI_DOCUMENTENDEXTEND = 2319;
    SCI_PAGEUP = 2320;
    SCI_PAGEUPEXTEND = 2321;
    SCI_PAGEDOWN = 2322;
    SCI_PAGEDOWNEXTEND = 2323;
    SCI_EDITTOGGLEOVERTYPE = 2324;
    SCI_CANCEL = 2325;
    SCI_DELETEBACK = 2326;
    SCI_TAB = 2327;
    SCI_BACKTAB = 2328;
    SCI_NEWLINE = 2329;
    SCI_FORMFEED = 2330;
    SCI_VCHOME = 2331;
    SCI_VCHOMEEXTEND = 2332;
    SCI_ZOOMIN = 2333;
    SCI_ZOOMOUT = 2334;
    SCI_DELWORDLEFT = 2335;
    SCI_DELWORDRIGHT = 2336;
    SCI_LINECUT = 2337;
    SCI_LINEDELETE = 2338;
    SCI_LINETRANSPOSE = 2339;
    SCI_LINEDUPLICATE = 2404;
    SCI_LOWERCASE = 2340;
    SCI_UPPERCASE = 2341;
    SCI_LINESCROLLDOWN = 2342;
    SCI_LINESCROLLUP = 2343;
    SCI_DELETEBACKNOTLINE = 2344;
    SCI_HOMEDISPLAY = 2345;
    SCI_HOMEDISPLAYEXTEND = 2346;
    SCI_LINEENDDISPLAY = 2347;
    SCI_LINEENDDISPLAYEXTEND = 2348;
    SCI_HOMEWRAP = 2349;
    SCI_HOMEWRAPEXTEND = 2450;
    SCI_LINEENDWRAP = 2451;
    SCI_LINEENDWRAPEXTEND = 2452;
    SCI_VCHOMEWRAP = 2453;
    SCI_VCHOMEWRAPEXTEND = 2454;
    SCI_LINECOPY = 2455;
    SCI_MOVECARETINSIDEVIEW = 2401;
    SCI_LINELENGTH = 2350;
    SCI_BRACEHIGHLIGHT = 2351;
    SCI_BRACEBADLIGHT = 2352;
    SCI_BRACEMATCH = 2353;
    SCI_GETVIEWEOL = 2355;
    SCI_SETVIEWEOL = 2356;
    SCI_GETDOCPOINTER = 2357;
    SCI_SETDOCPOINTER = 2358;
    SCI_SETMODEVENTMASK = 2359;
    EDGE_NONE = 0;
    EDGE_LINE = 1;
    EDGE_BACKGROUND = 2;
    SCI_GETEDGECOLUMN = 2360;
    SCI_SETEDGECOLUMN = 2361;
    SCI_GETEDGEMODE = 2362;
    SCI_SETEDGEMODE = 2363;
    SCI_GETEDGECOLOUR = 2364;
    SCI_SETEDGECOLOUR = 2365;
    SCI_SEARCHANCHOR = 2366;
    SCI_SEARCHNEXT = 2367;
    SCI_SEARCHPREV = 2368;
    SCI_LINESONSCREEN = 2370;
    SCI_USEPOPUP = 2371;
    SCI_SELECTIONISRECTANGLE = 2372;
    SCI_SETZOOM = 2373;
    SCI_GETZOOM = 2374;
    SCI_CREATEDOCUMENT = 2375;
    SCI_ADDREFDOCUMENT = 2376;
    SCI_RELEASEDOCUMENT = 2377;
    SCI_GETMODEVENTMASK = 2378;
    SCI_SETFOCUSEX = 2380;
    SCI_GETFOCUS = 2381;
    SCI_SETSTATUS = 2382;
    SCI_GETSTATUS = 2383;
    SCI_SETMOUSEDOWNCAPTURES = 2384;
    SCI_GETMOUSEDOWNCAPTURES = 2385;
    SC_CURSORNORMAL = -1;
    SC_CURSORWAIT = 4;
    SCI_SETCURSOR = 2386;
    SCI_GETCURSOR = 2387;
    SCI_SETCONTROLCHARSYMBOL = 2388;
    SCI_GETCONTROLCHARSYMBOL = 2389;
    SCI_WORDPARTLEFT = 2390;
    SCI_WORDPARTLEFTEXTEND = 2391;
    SCI_WORDPARTRIGHT = 2392;
    SCI_WORDPARTRIGHTEXTEND = 2393;
    VISIBLE_SLOP = $01;
    VISIBLE_STRICT = $04;
    SCI_SETVISIBLEPOLICY = 2394;
    SCI_DELLINELEFT = 2395;
    SCI_DELLINERIGHT = 2396;
    SCI_SETXOFFSET = 2397;
    SCI_GETXOFFSET = 2398;
    SCI_CHOOSECARETX = 2399;
    SCI_GRABFOCUS = 2400;
    CARET_SLOP = $01;
    CARET_STRICT = $04;
    CARET_JUMPS = $10;
    CARET_EVEN = $08;
    SCI_SETXCARETPOLICY = 2402;
    SCI_SETYCARETPOLICY = 2403;
    SCI_SETPRINTWRAPMODE = 2406;
    SCI_GETPRINTWRAPMODE = 2407;
    SCI_SETHOTSPOTACTIVEFORE = 2410;
    SCI_SETHOTSPOTACTIVEBACK = 2411;
    SCI_SETHOTSPOTACTIVEUNDERLINE = 2412;
    SCI_SETHOTSPOTSINGLELINE = 2421;
    SCI_PARADOWN = 2413;
    SCI_PARADOWNEXTEND = 2414;
    SCI_PARAUP = 2415;
    SCI_PARAUPEXTEND = 2416;
    SCI_POSITIONBEFORE = 2417;
    SCI_POSITIONAFTER = 2418;
    SCI_COPYRANGE = 2419;
    SCI_COPYTEXT = 2420;
    SC_SEL_STREAM = 0;
    SC_SEL_RECTANGLE = 1;
    SC_SEL_LINES = 2;
    SCI_SETSELECTIONMODE = 2422;
    SCI_GETSELECTIONMODE = 2423;
    SCI_GETLINESELSTARTPOSITION = 2424;
    SCI_GETLINESELENDPOSITION = 2425;
    SCI_LINEDOWNRECTEXTEND = 2426;
    SCI_LINEUPRECTEXTEND = 2427;
    SCI_CHARLEFTRECTEXTEND = 2428;
    SCI_CHARRIGHTRECTEXTEND = 2429;
    SCI_HOMERECTEXTEND = 2430;
    SCI_VCHOMERECTEXTEND = 2431;
    SCI_LINEENDRECTEXTEND = 2432;
    SCI_PAGEUPRECTEXTEND = 2433;
    SCI_PAGEDOWNRECTEXTEND = 2434;
    SCI_STUTTEREDPAGEUP = 2435;
    SCI_STUTTEREDPAGEUPEXTEND = 2436;
    SCI_STUTTEREDPAGEDOWN = 2437;
    SCI_STUTTEREDPAGEDOWNEXTEND = 2438;
    SCI_WORDLEFTEND = 2439;
    SCI_WORDLEFTENDEXTEND = 2440;
    SCI_WORDRIGHTEND = 2441;
    SCI_WORDRIGHTENDEXTEND = 2442;
    SCI_SETWHITESPACECHARS = 2443;
    SCI_SETCHARSDEFAULT = 2444;
    SCI_AUTOCGETCURRENT = 2445;
    SCI_ALLOCATE = 2446;
    SCI_FINDCOLUMN = 2456;
    SCI_GETCARETSTICKY = 2457;
    SCI_SETCARETSTICKY = 2458;
    SCI_TOGGLECARETSTICKY = 2459;
    SCI_SETPASTECONVERTENDINGS = 2467;
    SCI_GETPASTECONVERTENDINGS = 2468;
    SCI_SELECTIONDUPLICATE = 2469;
    SC_ALPHA_TRANSPARENT = 0;
    SC_ALPHA_OPAQUE = 255;
    SC_ALPHA_NOALPHA = 256;
    SCI_SETCARETLINEBACKALPHA = 2470;
    SCI_GETCARETLINEBACKALPHA = 2471;
    SCI_STARTRECORD = 3001;
    SCI_STOPRECORD = 3002;
    SCI_SETLEXER = 4001;
    SCI_GETLEXER = 4002;
    SCI_COLOURISE = 4003;
    SCI_SETPROPERTY = 4004;
    KEYWORDSET_MAX = 8;
    SCI_SETKEYWORDS = 4005;
    SCI_SETLEXERLANGUAGE = 4006;
    SCI_LOADLEXERLIBRARY = 4007;
    SCI_GETPROPERTY = 4008;
    SCI_GETPROPERTYEXPANDED = 4009;
    SCI_GETPROPERTYINT = 4010;
    SCI_GETSTYLEBITSNEEDED = 4011;
    SC_MOD_INSERTTEXT = $1;
    SC_MOD_DELETETEXT = $2;
    SC_MOD_CHANGESTYLE = $4;
    SC_MOD_CHANGEFOLD = $8;
    SC_PERFORMED_USER = $10;
    SC_PERFORMED_UNDO = $20;
    SC_PERFORMED_REDO = $40;
    SC_MULTISTEPUNDOREDO = $80;
    SC_LASTSTEPINUNDOREDO = $100;
    SC_MOD_CHANGEMARKER = $200;
    SC_MOD_BEFOREINSERT = $400;
    SC_MOD_BEFOREDELETE = $800;
    SC_MULTILINEUNDOREDO = $1000;
    SC_MODEVENTMASKALL = $1FFF;
    SCEN_CHANGE = 768;
    SCEN_SETFOCUS = 512;
    SCEN_KILLFOCUS = 256;
    SCK_DOWN = 300;
    SCK_UP = 301;
    SCK_LEFT = 302;
    SCK_RIGHT = 303;
    SCK_HOME = 304;
    SCK_END = 305;
    SCK_PRIOR = 306;
    SCK_NEXT = 307;
    SCK_DELETE = 308;
    SCK_INSERT = 309;
    SCK_ESCAPE = 7;
    SCK_BACK = 8;
    SCK_TAB = 9;
    SCK_RETURN = 13;
    SCK_ADD = 310;
    SCK_SUBTRACT = 311;
    SCK_DIVIDE = 312;
    SCK_WIN = 313;
    SCK_RWIN = 314;
    SCK_MENU = 315;
    SCMOD_NORM = 0;
    SCMOD_SHIFT = 1;
    SCMOD_CTRL = 2;
    SCMOD_ALT = 4;
    SCLEX_CONTAINER = 0;
    SCLEX_NULL = 1;
    SCLEX_PYTHON = 2;
    SCLEX_CPP = 3;
    SCLEX_HTML = 4;
    SCLEX_XML = 5;
    SCLEX_PERL = 6;
    SCLEX_SQL = 7;
    SCLEX_VB = 8;
    SCLEX_PROPERTIES = 9;
    SCLEX_ERRORLIST = 10;
    SCLEX_MAKEFILE = 11;
    SCLEX_BATCH = 12;
    SCLEX_XCODE = 13;
    SCLEX_LATEX = 14;
    SCLEX_LUA = 15;
    SCLEX_DIFF = 16;
    SCLEX_CONF = 17;
    SCLEX_PASCAL = 18;
    SCLEX_AVE = 19;
    SCLEX_ADA = 20;
    SCLEX_LISP = 21;
    SCLEX_RUBY = 22;
    SCLEX_EIFFEL = 23;
    SCLEX_EIFFELKW = 24;
    SCLEX_TCL = 25;
    SCLEX_NNCRONTAB = 26;
    SCLEX_BULLANT = 27;
    SCLEX_VBSCRIPT = 28;
    SCLEX_BAAN = 31;
    SCLEX_MATLAB = 32;
    SCLEX_SCRIPTOL = 33;
    SCLEX_ASM = 34;
    SCLEX_CPPNOCASE = 35;
    SCLEX_FORTRAN = 36;
    SCLEX_F77 = 37;
    SCLEX_CSS = 38;
    SCLEX_POV = 39;
    SCLEX_LOUT = 40;
    SCLEX_ESCRIPT = 41;
    SCLEX_PS = 42;
    SCLEX_NSIS = 43;
    SCLEX_MMIXAL = 44;
    SCLEX_CLW = 45;
    SCLEX_CLWNOCASE = 46;
    SCLEX_LOT = 47;
    SCLEX_YAML = 48;
    SCLEX_TEX = 49;
    SCLEX_METAPOST = 50;
    SCLEX_POWERBASIC = 51;
    SCLEX_FORTH = 52;
    SCLEX_ERLANG = 53;
    SCLEX_OCTAVE = 54;
    SCLEX_MSSQL = 55;
    SCLEX_VERILOG = 56;
    SCLEX_KIX = 57;
    SCLEX_GUI4CLI = 58;
    SCLEX_SPECMAN = 59;
    SCLEX_AU3 = 60;
    SCLEX_APDL = 61;
    SCLEX_BASH = 62;
    SCLEX_ASN1 = 63;
    SCLEX_VHDL = 64;
    SCLEX_CAML = 65;
    SCLEX_BLITZBASIC = 66;
    SCLEX_PUREBASIC = 67;
    SCLEX_HASKELL = 68;
    SCLEX_PHPSCRIPT = 69;
    SCLEX_TADS3 = 70;
    SCLEX_REBOL = 71;
    SCLEX_SMALLTALK = 72;
    SCLEX_FLAGSHIP = 73;
    SCLEX_CSOUND = 74;
    SCLEX_FREEBASIC = 75;
    SCLEX_INNOSETUP = 76;
    SCLEX_OPAL = 77;
    SCLEX_SPICE = 78;
    SCLEX_AUTOMATIC = 1000;
    SCE_P_DEFAULT = 0;
    SCE_P_COMMENTLINE = 1;
    SCE_P_NUMBER = 2;
    SCE_P_STRING = 3;
    SCE_P_CHARACTER = 4;
    SCE_P_WORD = 5;
    SCE_P_TRIPLE = 6;
    SCE_P_TRIPLEDOUBLE = 7;
    SCE_P_CLASSNAME = 8;
    SCE_P_DEFNAME = 9;
    SCE_P_OPERATOR = 10;
    SCE_P_IDENTIFIER = 11;
    SCE_P_COMMENTBLOCK = 12;
    SCE_P_STRINGEOL = 13;
    SCE_P_WORD2 = 14;
    SCE_P_DECORATOR = 15;
    SCE_C_DEFAULT = 0;
    SCE_C_COMMENT = 1;
    SCE_C_COMMENTLINE = 2;
    SCE_C_COMMENTDOC = 3;
    SCE_C_NUMBER = 4;
    SCE_C_WORD = 5;
    SCE_C_STRING = 6;
    SCE_C_CHARACTER = 7;
    SCE_C_UUID = 8;
    SCE_C_PREPROCESSOR = 9;
    SCE_C_OPERATOR = 10;
    SCE_C_IDENTIFIER = 11;
    SCE_C_STRINGEOL = 12;
    SCE_C_VERBATIM = 13;
    SCE_C_REGEX = 14;
    SCE_C_COMMENTLINEDOC = 15;
    SCE_C_WORD2 = 16;
    SCE_C_COMMENTDOCKEYWORD = 17;
    SCE_C_COMMENTDOCKEYWORDERROR = 18;
    SCE_C_GLOBALCLASS = 19;
    SCE_TCL_DEFAULT = 0;
    SCE_TCL_COMMENT = 1;
    SCE_TCL_COMMENTLINE = 2;
    SCE_TCL_NUMBER = 3;
    SCE_TCL_WORD_IN_QUOTE = 4;
    SCE_TCL_IN_QUOTE = 5;
    SCE_TCL_OPERATOR = 6;
    SCE_TCL_IDENTIFIER = 7;
    SCE_TCL_SUBSTITUTION = 8;
    SCE_TCL_SUB_BRACE = 9;
    SCE_TCL_MODIFIER = 10;
    SCE_TCL_EXPAND = 11;
    SCE_TCL_WORD = 12;
    SCE_TCL_WORD2 = 13;
    SCE_TCL_WORD3 = 14;
    SCE_TCL_WORD4 = 15;
    SCE_TCL_WORD5 = 16;
    SCE_TCL_WORD6 = 17;
    SCE_TCL_WORD7 = 18;
    SCE_TCL_WORD8 = 19;
    SCE_TCL_COMMENT_BOX = 20;
    SCE_TCL_BLOCK_COMMENT = 21;
    SCE_H_DEFAULT = 0;
    SCE_H_TAG = 1;
    SCE_H_TAGUNKNOWN = 2;
    SCE_H_ATTRIBUTE = 3;
    SCE_H_ATTRIBUTEUNKNOWN = 4;
    SCE_H_NUMBER = 5;
    SCE_H_DOUBLESTRING = 6;
    SCE_H_SINGLESTRING = 7;
    SCE_H_OTHER = 8;
    SCE_H_COMMENT = 9;
    SCE_H_ENTITY = 10;
    SCE_H_TAGEND = 11;
    SCE_H_XMLSTART = 12;
    SCE_H_XMLEND = 13;
    SCE_H_SCRIPT = 14;
    SCE_H_ASP = 15;
    SCE_H_ASPAT = 16;
    SCE_H_CDATA = 17;
    SCE_H_QUESTION = 18;
    SCE_H_VALUE = 19;
    SCE_H_XCCOMMENT = 20;
    SCE_H_SGML_DEFAULT = 21;
    SCE_H_SGML_COMMAND = 22;
    SCE_H_SGML_1ST_PARAM = 23;
    SCE_H_SGML_DOUBLESTRING = 24;
    SCE_H_SGML_SIMPLESTRING = 25;
    SCE_H_SGML_ERROR = 26;
    SCE_H_SGML_SPECIAL = 27;
    SCE_H_SGML_ENTITY = 28;
    SCE_H_SGML_COMMENT = 29;
    SCE_H_SGML_1ST_PARAM_COMMENT = 30;
    SCE_H_SGML_BLOCK_DEFAULT = 31;
    SCE_HJ_START = 40;
    SCE_HJ_DEFAULT = 41;
    SCE_HJ_COMMENT = 42;
    SCE_HJ_COMMENTLINE = 43;
    SCE_HJ_COMMENTDOC = 44;
    SCE_HJ_NUMBER = 45;
    SCE_HJ_WORD = 46;
    SCE_HJ_KEYWORD = 47;
    SCE_HJ_DOUBLESTRING = 48;
    SCE_HJ_SINGLESTRING = 49;
    SCE_HJ_SYMBOLS = 50;
    SCE_HJ_STRINGEOL = 51;
    SCE_HJ_REGEX = 52;
    SCE_HJA_START = 55;
    SCE_HJA_DEFAULT = 56;
    SCE_HJA_COMMENT = 57;
    SCE_HJA_COMMENTLINE = 58;
    SCE_HJA_COMMENTDOC = 59;
    SCE_HJA_NUMBER = 60;
    SCE_HJA_WORD = 61;
    SCE_HJA_KEYWORD = 62;
    SCE_HJA_DOUBLESTRING = 63;
    SCE_HJA_SINGLESTRING = 64;
    SCE_HJA_SYMBOLS = 65;
    SCE_HJA_STRINGEOL = 66;
    SCE_HJA_REGEX = 67;
    SCE_HB_START = 70;
    SCE_HB_DEFAULT = 71;
    SCE_HB_COMMENTLINE = 72;
    SCE_HB_NUMBER = 73;
    SCE_HB_WORD = 74;
    SCE_HB_STRING = 75;
    SCE_HB_IDENTIFIER = 76;
    SCE_HB_STRINGEOL = 77;
    SCE_HBA_START = 80;
    SCE_HBA_DEFAULT = 81;
    SCE_HBA_COMMENTLINE = 82;
    SCE_HBA_NUMBER = 83;
    SCE_HBA_WORD = 84;
    SCE_HBA_STRING = 85;
    SCE_HBA_IDENTIFIER = 86;
    SCE_HBA_STRINGEOL = 87;
    SCE_HP_START = 90;
    SCE_HP_DEFAULT = 91;
    SCE_HP_COMMENTLINE = 92;
    SCE_HP_NUMBER = 93;
    SCE_HP_STRING = 94;
    SCE_HP_CHARACTER = 95;
    SCE_HP_WORD = 96;
    SCE_HP_TRIPLE = 97;
    SCE_HP_TRIPLEDOUBLE = 98;
    SCE_HP_CLASSNAME = 99;
    SCE_HP_DEFNAME = 100;
    SCE_HP_OPERATOR = 101;
    SCE_HP_IDENTIFIER = 102;
    SCE_HPHP_COMPLEX_VARIABLE = 104;
    SCE_HPA_START = 105;
    SCE_HPA_DEFAULT = 106;
    SCE_HPA_COMMENTLINE = 107;
    SCE_HPA_NUMBER = 108;
    SCE_HPA_STRING = 109;
    SCE_HPA_CHARACTER = 110;
    SCE_HPA_WORD = 111;
    SCE_HPA_TRIPLE = 112;
    SCE_HPA_TRIPLEDOUBLE = 113;
    SCE_HPA_CLASSNAME = 114;
    SCE_HPA_DEFNAME = 115;
    SCE_HPA_OPERATOR = 116;
    SCE_HPA_IDENTIFIER = 117;
    SCE_HPHP_DEFAULT = 118;
    SCE_HPHP_HSTRING = 119;
    SCE_HPHP_SIMPLESTRING = 120;
    SCE_HPHP_WORD = 121;
    SCE_HPHP_NUMBER = 122;
    SCE_HPHP_VARIABLE = 123;
    SCE_HPHP_COMMENT = 124;
    SCE_HPHP_COMMENTLINE = 125;
    SCE_HPHP_HSTRING_VARIABLE = 126;
    SCE_HPHP_OPERATOR = 127;
    SCE_PL_DEFAULT = 0;
    SCE_PL_ERROR = 1;
    SCE_PL_COMMENTLINE = 2;
    SCE_PL_POD = 3;
    SCE_PL_NUMBER = 4;
    SCE_PL_WORD = 5;
    SCE_PL_STRING = 6;
    SCE_PL_CHARACTER = 7;
    SCE_PL_PUNCTUATION = 8;
    SCE_PL_PREPROCESSOR = 9;
    SCE_PL_OPERATOR = 10;
    SCE_PL_IDENTIFIER = 11;
    SCE_PL_SCALAR = 12;
    SCE_PL_ARRAY = 13;
    SCE_PL_HASH = 14;
    SCE_PL_SYMBOLTABLE = 15;
    SCE_PL_VARIABLE_INDEXER = 16;
    SCE_PL_REGEX = 17;
    SCE_PL_REGSUBST = 18;
    SCE_PL_LONGQUOTE = 19;
    SCE_PL_BACKTICKS = 20;
    SCE_PL_DATASECTION = 21;
    SCE_PL_HERE_DELIM = 22;
    SCE_PL_HERE_Q = 23;
    SCE_PL_HERE_QQ = 24;
    SCE_PL_HERE_QX = 25;
    SCE_PL_STRING_Q = 26;
    SCE_PL_STRING_QQ = 27;
    SCE_PL_STRING_QX = 28;
    SCE_PL_STRING_QR = 29;
    SCE_PL_STRING_QW = 30;
    SCE_PL_POD_VERB = 31;
    SCE_RB_DEFAULT = 0;
    SCE_RB_ERROR = 1;
    SCE_RB_COMMENTLINE = 2;
    SCE_RB_POD = 3;
    SCE_RB_NUMBER = 4;
    SCE_RB_WORD = 5;
    SCE_RB_STRING = 6;
    SCE_RB_CHARACTER = 7;
    SCE_RB_CLASSNAME = 8;
    SCE_RB_DEFNAME = 9;
    SCE_RB_OPERATOR = 10;
    SCE_RB_IDENTIFIER = 11;
    SCE_RB_REGEX = 12;
    SCE_RB_GLOBAL = 13;
    SCE_RB_SYMBOL = 14;
    SCE_RB_MODULE_NAME = 15;
    SCE_RB_INSTANCE_VAR = 16;
    SCE_RB_CLASS_VAR = 17;
    SCE_RB_BACKTICKS = 18;
    SCE_RB_DATASECTION = 19;
    SCE_RB_HERE_DELIM = 20;
    SCE_RB_HERE_Q = 21;
    SCE_RB_HERE_QQ = 22;
    SCE_RB_HERE_QX = 23;
    SCE_RB_STRING_Q = 24;
    SCE_RB_STRING_QQ = 25;
    SCE_RB_STRING_QX = 26;
    SCE_RB_STRING_QR = 27;
    SCE_RB_STRING_QW = 28;
    SCE_RB_WORD_DEMOTED = 29;
    SCE_RB_STDIN = 30;
    SCE_RB_STDOUT = 31;
    SCE_RB_STDERR = 40;
    SCE_RB_UPPER_BOUND = 41;
    SCE_B_DEFAULT = 0;
    SCE_B_COMMENT = 1;
    SCE_B_NUMBER = 2;
    SCE_B_KEYWORD = 3;
    SCE_B_STRING = 4;
    SCE_B_PREPROCESSOR = 5;
    SCE_B_OPERATOR = 6;
    SCE_B_IDENTIFIER = 7;
    SCE_B_DATE = 8;
    SCE_B_STRINGEOL = 9;
    SCE_B_KEYWORD2 = 10;
    SCE_B_KEYWORD3 = 11;
    SCE_B_KEYWORD4 = 12;
    SCE_B_CONSTANT = 13;
    SCE_B_ASM = 14;
    SCE_B_LABEL = 15;
    SCE_B_ERROR = 16;
    SCE_B_HEXNUMBER = 17;
    SCE_B_BINNUMBER = 18;
    SCE_PROPS_DEFAULT = 0;
    SCE_PROPS_COMMENT = 1;
    SCE_PROPS_SECTION = 2;
    SCE_PROPS_ASSIGNMENT = 3;
    SCE_PROPS_DEFVAL = 4;
    SCE_PROPS_KEY = 5;
    SCE_L_DEFAULT = 0;
    SCE_L_COMMAND = 1;
    SCE_L_TAG = 2;
    SCE_L_MATH = 3;
    SCE_L_COMMENT = 4;
    SCE_LUA_DEFAULT = 0;
    SCE_LUA_COMMENT = 1;
    SCE_LUA_COMMENTLINE = 2;
    SCE_LUA_COMMENTDOC = 3;
    SCE_LUA_NUMBER = 4;
    SCE_LUA_WORD = 5;
    SCE_LUA_STRING = 6;
    SCE_LUA_CHARACTER = 7;
    SCE_LUA_LITERALSTRING = 8;
    SCE_LUA_PREPROCESSOR = 9;
    SCE_LUA_OPERATOR = 10;
    SCE_LUA_IDENTIFIER = 11;
    SCE_LUA_STRINGEOL = 12;
    SCE_LUA_WORD2 = 13;
    SCE_LUA_WORD3 = 14;
    SCE_LUA_WORD4 = 15;
    SCE_LUA_WORD5 = 16;
    SCE_LUA_WORD6 = 17;
    SCE_LUA_WORD7 = 18;
    SCE_LUA_WORD8 = 19;
    SCE_ERR_DEFAULT = 0;
    SCE_ERR_PYTHON = 1;
    SCE_ERR_GCC = 2;
    SCE_ERR_MS = 3;
    SCE_ERR_CMD = 4;
    SCE_ERR_BORLAND = 5;
    SCE_ERR_PERL = 6;
    SCE_ERR_NET = 7;
    SCE_ERR_LUA = 8;
    SCE_ERR_CTAG = 9;
    SCE_ERR_DIFF_CHANGED = 10;
    SCE_ERR_DIFF_ADDITION = 11;
    SCE_ERR_DIFF_DELETION = 12;
    SCE_ERR_DIFF_MESSAGE = 13;
    SCE_ERR_PHP = 14;
    SCE_ERR_ELF = 15;
    SCE_ERR_IFC = 16;
    SCE_ERR_IFORT = 17;
    SCE_ERR_ABSF = 18;
    SCE_ERR_TIDY = 19;
    SCE_ERR_JAVA_STACK = 20;
    SCE_BAT_DEFAULT = 0;
    SCE_BAT_COMMENT = 1;
    SCE_BAT_WORD = 2;
    SCE_BAT_LABEL = 3;
    SCE_BAT_HIDE = 4;
    SCE_BAT_COMMAND = 5;
    SCE_BAT_IDENTIFIER = 6;
    SCE_BAT_OPERATOR = 7;
    SCE_MAKE_DEFAULT = 0;
    SCE_MAKE_COMMENT = 1;
    SCE_MAKE_PREPROCESSOR = 2;
    SCE_MAKE_IDENTIFIER = 3;
    SCE_MAKE_OPERATOR = 4;
    SCE_MAKE_TARGET = 5;
    SCE_MAKE_IDEOL = 9;
    SCE_DIFF_DEFAULT = 0;
    SCE_DIFF_COMMENT = 1;
    SCE_DIFF_COMMAND = 2;
    SCE_DIFF_HEADER = 3;
    SCE_DIFF_POSITION = 4;
    SCE_DIFF_DELETED = 5;
    SCE_DIFF_ADDED = 6;
    SCE_CONF_DEFAULT = 0;
    SCE_CONF_COMMENT = 1;
    SCE_CONF_NUMBER = 2;
    SCE_CONF_IDENTIFIER = 3;
    SCE_CONF_EXTENSION = 4;
    SCE_CONF_PARAMETER = 5;
    SCE_CONF_STRING = 6;
    SCE_CONF_OPERATOR = 7;
    SCE_CONF_IP = 8;
    SCE_CONF_DIRECTIVE = 9;
    SCE_AVE_DEFAULT = 0;
    SCE_AVE_COMMENT = 1;
    SCE_AVE_NUMBER = 2;
    SCE_AVE_WORD = 3;
    SCE_AVE_STRING = 6;
    SCE_AVE_ENUM = 7;
    SCE_AVE_STRINGEOL = 8;
    SCE_AVE_IDENTIFIER = 9;
    SCE_AVE_OPERATOR = 10;
    SCE_AVE_WORD1 = 11;
    SCE_AVE_WORD2 = 12;
    SCE_AVE_WORD3 = 13;
    SCE_AVE_WORD4 = 14;
    SCE_AVE_WORD5 = 15;
    SCE_AVE_WORD6 = 16;
    SCE_ADA_DEFAULT = 0;
    SCE_ADA_WORD = 1;
    SCE_ADA_IDENTIFIER = 2;
    SCE_ADA_NUMBER = 3;
    SCE_ADA_DELIMITER = 4;
    SCE_ADA_CHARACTER = 5;
    SCE_ADA_CHARACTEREOL = 6;
    SCE_ADA_STRING = 7;
    SCE_ADA_STRINGEOL = 8;
    SCE_ADA_LABEL = 9;
    SCE_ADA_COMMENTLINE = 10;
    SCE_ADA_ILLEGAL = 11;
    SCE_BAAN_DEFAULT = 0;
    SCE_BAAN_COMMENT = 1;
    SCE_BAAN_COMMENTDOC = 2;
    SCE_BAAN_NUMBER = 3;
    SCE_BAAN_WORD = 4;
    SCE_BAAN_STRING = 5;
    SCE_BAAN_PREPROCESSOR = 6;
    SCE_BAAN_OPERATOR = 7;
    SCE_BAAN_IDENTIFIER = 8;
    SCE_BAAN_STRINGEOL = 9;
    SCE_BAAN_WORD2 = 10;
    SCE_LISP_DEFAULT = 0;
    SCE_LISP_COMMENT = 1;
    SCE_LISP_NUMBER = 2;
    SCE_LISP_KEYWORD = 3;
    SCE_LISP_KEYWORD_KW = 4;
    SCE_LISP_SYMBOL = 5;
    SCE_LISP_STRING = 6;
    SCE_LISP_STRINGEOL = 8;
    SCE_LISP_IDENTIFIER = 9;
    SCE_LISP_OPERATOR = 10;
    SCE_LISP_SPECIAL = 11;
    SCE_LISP_MULTI_COMMENT = 12;
    SCE_EIFFEL_DEFAULT = 0;
    SCE_EIFFEL_COMMENTLINE = 1;
    SCE_EIFFEL_NUMBER = 2;
    SCE_EIFFEL_WORD = 3;
    SCE_EIFFEL_STRING = 4;
    SCE_EIFFEL_CHARACTER = 5;
    SCE_EIFFEL_OPERATOR = 6;
    SCE_EIFFEL_IDENTIFIER = 7;
    SCE_EIFFEL_STRINGEOL = 8;
    SCE_NNCRONTAB_DEFAULT = 0;
    SCE_NNCRONTAB_COMMENT = 1;
    SCE_NNCRONTAB_TASK = 2;
    SCE_NNCRONTAB_SECTION = 3;
    SCE_NNCRONTAB_KEYWORD = 4;
    SCE_NNCRONTAB_MODIFIER = 5;
    SCE_NNCRONTAB_ASTERISK = 6;
    SCE_NNCRONTAB_NUMBER = 7;
    SCE_NNCRONTAB_STRING = 8;
    SCE_NNCRONTAB_ENVIRONMENT = 9;
    SCE_NNCRONTAB_IDENTIFIER = 10;
    SCE_FORTH_DEFAULT = 0;
    SCE_FORTH_COMMENT = 1;
    SCE_FORTH_COMMENT_ML = 2;
    SCE_FORTH_IDENTIFIER = 3;
    SCE_FORTH_CONTROL = 4;
    SCE_FORTH_KEYWORD = 5;
    SCE_FORTH_DEFWORD = 6;
    SCE_FORTH_PREWORD1 = 7;
    SCE_FORTH_PREWORD2 = 8;
    SCE_FORTH_NUMBER = 9;
    SCE_FORTH_STRING = 10;
    SCE_FORTH_LOCALE = 11;
    SCE_MATLAB_DEFAULT = 0;
    SCE_MATLAB_COMMENT = 1;
    SCE_MATLAB_COMMAND = 2;
    SCE_MATLAB_NUMBER = 3;
    SCE_MATLAB_KEYWORD = 4;
    SCE_MATLAB_STRING = 5;
    SCE_MATLAB_OPERATOR = 6;
    SCE_MATLAB_IDENTIFIER = 7;
    SCE_MATLAB_DOUBLEQUOTESTRING = 8;
    SCE_SCRIPTOL_DEFAULT = 0;
    SCE_SCRIPTOL_WHITE = 1;
    SCE_SCRIPTOL_COMMENTLINE = 2;
    SCE_SCRIPTOL_PERSISTENT = 3;
    SCE_SCRIPTOL_CSTYLE = 4;
    SCE_SCRIPTOL_COMMENTBLOCK = 5;
    SCE_SCRIPTOL_NUMBER = 6;
    SCE_SCRIPTOL_STRING = 7;
    SCE_SCRIPTOL_CHARACTER = 8;
    SCE_SCRIPTOL_STRINGEOL = 9;
    SCE_SCRIPTOL_KEYWORD = 10;
    SCE_SCRIPTOL_OPERATOR = 11;
    SCE_SCRIPTOL_IDENTIFIER = 12;
    SCE_SCRIPTOL_TRIPLE = 13;
    SCE_SCRIPTOL_CLASSNAME = 14;
    SCE_SCRIPTOL_PREPROCESSOR = 15;
    SCE_ASM_DEFAULT = 0;
    SCE_ASM_COMMENT = 1;
    SCE_ASM_NUMBER = 2;
    SCE_ASM_STRING = 3;
    SCE_ASM_OPERATOR = 4;
    SCE_ASM_IDENTIFIER = 5;
    SCE_ASM_CPUINSTRUCTION = 6;
    SCE_ASM_MATHINSTRUCTION = 7;
    SCE_ASM_REGISTER = 8;
    SCE_ASM_DIRECTIVE = 9;
    SCE_ASM_DIRECTIVEOPERAND = 10;
    SCE_ASM_COMMENTBLOCK = 11;
    SCE_ASM_CHARACTER = 12;
    SCE_ASM_STRINGEOL = 13;
    SCE_ASM_EXTINSTRUCTION = 14;
    SCE_F_DEFAULT = 0;
    SCE_F_COMMENT = 1;
    SCE_F_NUMBER = 2;
    SCE_F_STRING1 = 3;
    SCE_F_STRING2 = 4;
    SCE_F_STRINGEOL = 5;
    SCE_F_OPERATOR = 6;
    SCE_F_IDENTIFIER = 7;
    SCE_F_WORD = 8;
    SCE_F_WORD2 = 9;
    SCE_F_WORD3 = 10;
    SCE_F_PREPROCESSOR = 11;
    SCE_F_OPERATOR2 = 12;
    SCE_F_LABEL = 13;
    SCE_F_CONTINUATION = 14;
    SCE_CSS_DEFAULT = 0;
    SCE_CSS_TAG = 1;
    SCE_CSS_CLASS = 2;
    SCE_CSS_PSEUDOCLASS = 3;
    SCE_CSS_UNKNOWN_PSEUDOCLASS = 4;
    SCE_CSS_OPERATOR = 5;
    SCE_CSS_IDENTIFIER = 6;
    SCE_CSS_UNKNOWN_IDENTIFIER = 7;
    SCE_CSS_VALUE = 8;
    SCE_CSS_COMMENT = 9;
    SCE_CSS_ID = 10;
    SCE_CSS_IMPORTANT = 11;
    SCE_CSS_DIRECTIVE = 12;
    SCE_CSS_DOUBLESTRING = 13;
    SCE_CSS_SINGLESTRING = 14;
    SCE_CSS_IDENTIFIER2 = 15;
    SCE_CSS_ATTRIBUTE = 16;
    SCE_POV_DEFAULT = 0;
    SCE_POV_COMMENT = 1;
    SCE_POV_COMMENTLINE = 2;
    SCE_POV_NUMBER = 3;
    SCE_POV_OPERATOR = 4;
    SCE_POV_IDENTIFIER = 5;
    SCE_POV_STRING = 6;
    SCE_POV_STRINGEOL = 7;
    SCE_POV_DIRECTIVE = 8;
    SCE_POV_BADDIRECTIVE = 9;
    SCE_POV_WORD2 = 10;
    SCE_POV_WORD3 = 11;
    SCE_POV_WORD4 = 12;
    SCE_POV_WORD5 = 13;
    SCE_POV_WORD6 = 14;
    SCE_POV_WORD7 = 15;
    SCE_POV_WORD8 = 16;
    SCE_LOUT_DEFAULT = 0;
    SCE_LOUT_COMMENT = 1;
    SCE_LOUT_NUMBER = 2;
    SCE_LOUT_WORD = 3;
    SCE_LOUT_WORD2 = 4;
    SCE_LOUT_WORD3 = 5;
    SCE_LOUT_WORD4 = 6;
    SCE_LOUT_STRING = 7;
    SCE_LOUT_OPERATOR = 8;
    SCE_LOUT_IDENTIFIER = 9;
    SCE_LOUT_STRINGEOL = 10;
    SCE_ESCRIPT_DEFAULT = 0;
    SCE_ESCRIPT_COMMENT = 1;
    SCE_ESCRIPT_COMMENTLINE = 2;
    SCE_ESCRIPT_COMMENTDOC = 3;
    SCE_ESCRIPT_NUMBER = 4;
    SCE_ESCRIPT_WORD = 5;
    SCE_ESCRIPT_STRING = 6;
    SCE_ESCRIPT_OPERATOR = 7;
    SCE_ESCRIPT_IDENTIFIER = 8;
    SCE_ESCRIPT_BRACE = 9;
    SCE_ESCRIPT_WORD2 = 10;
    SCE_ESCRIPT_WORD3 = 11;
    SCE_PS_DEFAULT = 0;
    SCE_PS_COMMENT = 1;
    SCE_PS_DSC_COMMENT = 2;
    SCE_PS_DSC_VALUE = 3;
    SCE_PS_NUMBER = 4;
    SCE_PS_NAME = 5;
    SCE_PS_KEYWORD = 6;
    SCE_PS_LITERAL = 7;
    SCE_PS_IMMEVAL = 8;
    SCE_PS_PAREN_ARRAY = 9;
    SCE_PS_PAREN_DICT = 10;
    SCE_PS_PAREN_PROC = 11;
    SCE_PS_TEXT = 12;
    SCE_PS_HEXSTRING = 13;
    SCE_PS_BASE85STRING = 14;
    SCE_PS_BADSTRINGCHAR = 15;
    SCE_NSIS_DEFAULT = 0;
    SCE_NSIS_COMMENT = 1;
    SCE_NSIS_STRINGDQ = 2;
    SCE_NSIS_STRINGLQ = 3;
    SCE_NSIS_STRINGRQ = 4;
    SCE_NSIS_FUNCTION = 5;
    SCE_NSIS_VARIABLE = 6;
    SCE_NSIS_LABEL = 7;
    SCE_NSIS_USERDEFINED = 8;
    SCE_NSIS_SECTIONDEF = 9;
    SCE_NSIS_SUBSECTIONDEF = 10;
    SCE_NSIS_IFDEFINEDEF = 11;
    SCE_NSIS_MACRODEF = 12;
    SCE_NSIS_STRINGVAR = 13;
    SCE_NSIS_NUMBER = 14;
    SCE_NSIS_SECTIONGROUP = 15;
    SCE_NSIS_PAGEEX = 16;
    SCE_NSIS_FUNCTIONDEF = 17;
    SCE_NSIS_COMMENTBOX = 18;
    SCE_MMIXAL_LEADWS = 0;
    SCE_MMIXAL_COMMENT = 1;
    SCE_MMIXAL_LABEL = 2;
    SCE_MMIXAL_OPCODE = 3;
    SCE_MMIXAL_OPCODE_PRE = 4;
    SCE_MMIXAL_OPCODE_VALID = 5;
    SCE_MMIXAL_OPCODE_UNKNOWN = 6;
    SCE_MMIXAL_OPCODE_POST = 7;
    SCE_MMIXAL_OPERANDS = 8;
    SCE_MMIXAL_NUMBER = 9;
    SCE_MMIXAL_REF = 10;
    SCE_MMIXAL_CHAR = 11;
    SCE_MMIXAL_STRING = 12;
    SCE_MMIXAL_REGISTER = 13;
    SCE_MMIXAL_HEX = 14;
    SCE_MMIXAL_OPERATOR = 15;
    SCE_MMIXAL_SYMBOL = 16;
    SCE_MMIXAL_INCLUDE = 17;
    SCE_CLW_DEFAULT = 0;
    SCE_CLW_LABEL = 1;
    SCE_CLW_COMMENT = 2;
    SCE_CLW_STRING = 3;
    SCE_CLW_USER_IDENTIFIER = 4;
    SCE_CLW_INTEGER_CONSTANT = 5;
    SCE_CLW_REAL_CONSTANT = 6;
    SCE_CLW_PICTURE_STRING = 7;
    SCE_CLW_KEYWORD = 8;
    SCE_CLW_COMPILER_DIRECTIVE = 9;
    SCE_CLW_RUNTIME_EXPRESSIONS = 10;
    SCE_CLW_BUILTIN_PROCEDURES_FUNCTION = 11;
    SCE_CLW_STRUCTURE_DATA_TYPE = 12;
    SCE_CLW_ATTRIBUTE = 13;
    SCE_CLW_STANDARD_EQUATE = 14;
    SCE_CLW_ERROR = 15;
    SCE_CLW_DEPRECATED = 16;
    SCE_LOT_DEFAULT = 0;
    SCE_LOT_HEADER = 1;
    SCE_LOT_BREAK = 2;
    SCE_LOT_SET = 3;
    SCE_LOT_PASS = 4;
    SCE_LOT_FAIL = 5;
    SCE_LOT_ABORT = 6;
    SCE_YAML_DEFAULT = 0;
    SCE_YAML_COMMENT = 1;
    SCE_YAML_IDENTIFIER = 2;
    SCE_YAML_KEYWORD = 3;
    SCE_YAML_NUMBER = 4;
    SCE_YAML_REFERENCE = 5;
    SCE_YAML_DOCUMENT = 6;
    SCE_YAML_TEXT = 7;
    SCE_YAML_ERROR = 8;
    SCE_TEX_DEFAULT = 0;
    SCE_TEX_SPECIAL = 1;
    SCE_TEX_GROUP = 2;
    SCE_TEX_SYMBOL = 3;
    SCE_TEX_COMMAND = 4;
    SCE_TEX_TEXT = 5;
    SCE_METAPOST_DEFAULT = 0;
    SCE_METAPOST_SPECIAL = 1;
    SCE_METAPOST_GROUP = 2;
    SCE_METAPOST_SYMBOL = 3;
    SCE_METAPOST_COMMAND = 4;
    SCE_METAPOST_TEXT = 5;
    SCE_METAPOST_EXTRA = 6;
    SCE_ERLANG_DEFAULT = 0;
    SCE_ERLANG_COMMENT = 1;
    SCE_ERLANG_VARIABLE = 2;
    SCE_ERLANG_NUMBER = 3;
    SCE_ERLANG_KEYWORD = 4;
    SCE_ERLANG_STRING = 5;
    SCE_ERLANG_OPERATOR = 6;
    SCE_ERLANG_ATOM = 7;
    SCE_ERLANG_FUNCTION_NAME = 8;
    SCE_ERLANG_CHARACTER = 9;
    SCE_ERLANG_MACRO = 10;
    SCE_ERLANG_RECORD = 11;
    SCE_ERLANG_SEPARATOR = 12;
    SCE_ERLANG_NODE_NAME = 13;
    SCE_ERLANG_UNKNOWN = 31;
    SCE_MSSQL_DEFAULT = 0;
    SCE_MSSQL_COMMENT = 1;
    SCE_MSSQL_LINE_COMMENT = 2;
    SCE_MSSQL_NUMBER = 3;
    SCE_MSSQL_STRING = 4;
    SCE_MSSQL_OPERATOR = 5;
    SCE_MSSQL_IDENTIFIER = 6;
    SCE_MSSQL_VARIABLE = 7;
    SCE_MSSQL_COLUMN_NAME = 8;
    SCE_MSSQL_STATEMENT = 9;
    SCE_MSSQL_DATATYPE = 10;
    SCE_MSSQL_SYSTABLE = 11;
    SCE_MSSQL_GLOBAL_VARIABLE = 12;
    SCE_MSSQL_FUNCTION = 13;
    SCE_MSSQL_STORED_PROCEDURE = 14;
    SCE_MSSQL_DEFAULT_PREF_DATATYPE = 15;
    SCE_MSSQL_COLUMN_NAME_2 = 16;
    SCE_V_DEFAULT = 0;
    SCE_V_COMMENT = 1;
    SCE_V_COMMENTLINE = 2;
    SCE_V_COMMENTLINEBANG = 3;
    SCE_V_NUMBER = 4;
    SCE_V_WORD = 5;
    SCE_V_STRING = 6;
    SCE_V_WORD2 = 7;
    SCE_V_WORD3 = 8;
    SCE_V_PREPROCESSOR = 9;
    SCE_V_OPERATOR = 10;
    SCE_V_IDENTIFIER = 11;
    SCE_V_STRINGEOL = 12;
    SCE_V_USER = 19;
    SCE_KIX_DEFAULT = 0;
    SCE_KIX_COMMENT = 1;
    SCE_KIX_STRING1 = 2;
    SCE_KIX_STRING2 = 3;
    SCE_KIX_NUMBER = 4;
    SCE_KIX_VAR = 5;
    SCE_KIX_MACRO = 6;
    SCE_KIX_KEYWORD = 7;
    SCE_KIX_FUNCTIONS = 8;
    SCE_KIX_OPERATOR = 9;
    SCE_KIX_IDENTIFIER = 31;
    SCE_GC_DEFAULT = 0;
    SCE_GC_COMMENTLINE = 1;
    SCE_GC_COMMENTBLOCK = 2;
    SCE_GC_GLOBAL = 3;
    SCE_GC_EVENT = 4;
    SCE_GC_ATTRIBUTE = 5;
    SCE_GC_CONTROL = 6;
    SCE_GC_COMMAND = 7;
    SCE_GC_STRING = 8;
    SCE_GC_OPERATOR = 9;
    SCE_SN_DEFAULT = 0;
    SCE_SN_CODE = 1;
    SCE_SN_COMMENTLINE = 2;
    SCE_SN_COMMENTLINEBANG = 3;
    SCE_SN_NUMBER = 4;
    SCE_SN_WORD = 5;
    SCE_SN_STRING = 6;
    SCE_SN_WORD2 = 7;
    SCE_SN_WORD3 = 8;
    SCE_SN_PREPROCESSOR = 9;
    SCE_SN_OPERATOR = 10;
    SCE_SN_IDENTIFIER = 11;
    SCE_SN_STRINGEOL = 12;
    SCE_SN_REGEXTAG = 13;
    SCE_SN_SIGNAL = 14;
    SCE_SN_USER = 19;
    SCE_AU3_DEFAULT = 0;
    SCE_AU3_COMMENT = 1;
    SCE_AU3_COMMENTBLOCK = 2;
    SCE_AU3_NUMBER = 3;
    SCE_AU3_FUNCTION = 4;
    SCE_AU3_KEYWORD = 5;
    SCE_AU3_MACRO = 6;
    SCE_AU3_STRING = 7;
    SCE_AU3_OPERATOR = 8;
    SCE_AU3_VARIABLE = 9;
    SCE_AU3_SENT = 10;
    SCE_AU3_PREPROCESSOR = 11;
    SCE_AU3_SPECIAL = 12;
    SCE_AU3_EXPAND = 13;
    SCE_AU3_COMOBJ = 14;
    SCE_AU3_UDF = 15;
    SCE_APDL_DEFAULT = 0;
    SCE_APDL_COMMENT = 1;
    SCE_APDL_COMMENTBLOCK = 2;
    SCE_APDL_NUMBER = 3;
    SCE_APDL_STRING = 4;
    SCE_APDL_OPERATOR = 5;
    SCE_APDL_WORD = 6;
    SCE_APDL_PROCESSOR = 7;
    SCE_APDL_COMMAND = 8;
    SCE_APDL_SLASHCOMMAND = 9;
    SCE_APDL_STARCOMMAND = 10;
    SCE_APDL_ARGUMENT = 11;
    SCE_APDL_FUNCTION = 12;
    SCE_SH_DEFAULT = 0;
    SCE_SH_ERROR = 1;
    SCE_SH_COMMENTLINE = 2;
    SCE_SH_NUMBER = 3;
    SCE_SH_WORD = 4;
    SCE_SH_STRING = 5;
    SCE_SH_CHARACTER = 6;
    SCE_SH_OPERATOR = 7;
    SCE_SH_IDENTIFIER = 8;
    SCE_SH_SCALAR = 9;
    SCE_SH_PARAM = 10;
    SCE_SH_BACKTICKS = 11;
    SCE_SH_HERE_DELIM = 12;
    SCE_SH_HERE_Q = 13;
    SCE_ASN1_DEFAULT = 0;
    SCE_ASN1_COMMENT = 1;
    SCE_ASN1_IDENTIFIER = 2;
    SCE_ASN1_STRING = 3;
    SCE_ASN1_OID = 4;
    SCE_ASN1_SCALAR = 5;
    SCE_ASN1_KEYWORD = 6;
    SCE_ASN1_ATTRIBUTE = 7;
    SCE_ASN1_DESCRIPTOR = 8;
    SCE_ASN1_TYPE = 9;
    SCE_ASN1_OPERATOR = 10;
    SCE_VHDL_DEFAULT = 0;
    SCE_VHDL_COMMENT = 1;
    SCE_VHDL_COMMENTLINEBANG = 2;
    SCE_VHDL_NUMBER = 3;
    SCE_VHDL_STRING = 4;
    SCE_VHDL_OPERATOR = 5;
    SCE_VHDL_IDENTIFIER = 6;
    SCE_VHDL_STRINGEOL = 7;
    SCE_VHDL_KEYWORD = 8;
    SCE_VHDL_STDOPERATOR = 9;
    SCE_VHDL_ATTRIBUTE = 10;
    SCE_VHDL_STDFUNCTION = 11;
    SCE_VHDL_STDPACKAGE = 12;
    SCE_VHDL_STDTYPE = 13;
    SCE_VHDL_USERWORD = 14;
    SCE_CAML_DEFAULT = 0;
    SCE_CAML_IDENTIFIER = 1;
    SCE_CAML_TAGNAME = 2;
    SCE_CAML_KEYWORD = 3;
    SCE_CAML_KEYWORD2 = 4;
    SCE_CAML_KEYWORD3 = 5;
    SCE_CAML_LINENUM = 6;
    SCE_CAML_OPERATOR = 7;
    SCE_CAML_NUMBER = 8;
    SCE_CAML_CHAR = 9;
    SCE_CAML_STRING = 11;
    SCE_CAML_COMMENT = 12;
    SCE_CAML_COMMENT1 = 13;
    SCE_CAML_COMMENT2 = 14;
    SCE_CAML_COMMENT3 = 15;
    SCE_HA_DEFAULT = 0;
    SCE_HA_IDENTIFIER = 1;
    SCE_HA_KEYWORD = 2;
    SCE_HA_NUMBER = 3;
    SCE_HA_STRING = 4;
    SCE_HA_CHARACTER = 5;
    SCE_HA_CLASS = 6;
    SCE_HA_MODULE = 7;
    SCE_HA_CAPITAL = 8;
    SCE_HA_DATA = 9;
    SCE_HA_IMPORT = 10;
    SCE_HA_OPERATOR = 11;
    SCE_HA_INSTANCE = 12;
    SCE_HA_COMMENTLINE = 13;
    SCE_HA_COMMENTBLOCK = 14;
    SCE_HA_COMMENTBLOCK2 = 15;
    SCE_HA_COMMENTBLOCK3 = 16;
    SCE_T3_DEFAULT = 0;
    SCE_T3_X_DEFAULT = 1;
    SCE_T3_PREPROCESSOR = 2;
    SCE_T3_BLOCK_COMMENT = 3;
    SCE_T3_LINE_COMMENT = 4;
    SCE_T3_OPERATOR = 5;
    SCE_T3_KEYWORD = 6;
    SCE_T3_NUMBER = 7;
    SCE_T3_IDENTIFIER = 8;
    SCE_T3_S_STRING = 9;
    SCE_T3_D_STRING = 10;
    SCE_T3_X_STRING = 11;
    SCE_T3_LIB_DIRECTIVE = 12;
    SCE_T3_MSG_PARAM = 13;
    SCE_T3_HTML_TAG = 14;
    SCE_T3_HTML_DEFAULT = 15;
    SCE_T3_HTML_STRING = 16;
    SCE_T3_USER1 = 17;
    SCE_T3_USER2 = 18;
    SCE_T3_USER3 = 19;
    SCE_REBOL_DEFAULT = 0;
    SCE_REBOL_COMMENTLINE = 1;
    SCE_REBOL_COMMENTBLOCK = 2;
    SCE_REBOL_PREFACE = 3;
    SCE_REBOL_OPERATOR = 4;
    SCE_REBOL_CHARACTER = 5;
    SCE_REBOL_QUOTEDSTRING = 6;
    SCE_REBOL_BRACEDSTRING = 7;
    SCE_REBOL_NUMBER = 8;
    SCE_REBOL_PAIR = 9;
    SCE_REBOL_TUPLE = 10;
    SCE_REBOL_BINARY = 11;
    SCE_REBOL_MONEY = 12;
    SCE_REBOL_ISSUE = 13;
    SCE_REBOL_TAG = 14;
    SCE_REBOL_FILE = 15;
    SCE_REBOL_EMAIL = 16;
    SCE_REBOL_URL = 17;
    SCE_REBOL_DATE = 18;
    SCE_REBOL_TIME = 19;
    SCE_REBOL_IDENTIFIER = 20;
    SCE_REBOL_WORD = 21;
    SCE_REBOL_WORD2 = 22;
    SCE_REBOL_WORD3 = 23;
    SCE_REBOL_WORD4 = 24;
    SCE_REBOL_WORD5 = 25;
    SCE_REBOL_WORD6 = 26;
    SCE_REBOL_WORD7 = 27;
    SCE_REBOL_WORD8 = 28;
    SCE_SQL_DEFAULT = 0;
    SCE_SQL_COMMENT = 1;
    SCE_SQL_COMMENTLINE = 2;
    SCE_SQL_COMMENTDOC = 3;
    SCE_SQL_NUMBER = 4;
    SCE_SQL_WORD = 5;
    SCE_SQL_STRING = 6;
    SCE_SQL_CHARACTER = 7;
    SCE_SQL_SQLPLUS = 8;
    SCE_SQL_SQLPLUS_PROMPT = 9;
    SCE_SQL_OPERATOR = 10;
    SCE_SQL_IDENTIFIER = 11;
    SCE_SQL_SQLPLUS_COMMENT = 13;
    SCE_SQL_COMMENTLINEDOC = 15;
    SCE_SQL_WORD2 = 16;
    SCE_SQL_COMMENTDOCKEYWORD = 17;
    SCE_SQL_COMMENTDOCKEYWORDERROR = 18;
    SCE_SQL_USER1 = 19;
    SCE_SQL_USER2 = 20;
    SCE_SQL_USER3 = 21;
    SCE_SQL_USER4 = 22;
    SCE_SQL_QUOTEDIDENTIFIER = 23;
    SCE_ST_DEFAULT = 0;
    SCE_ST_STRING = 1;
    SCE_ST_NUMBER = 2;
    SCE_ST_COMMENT = 3;
    SCE_ST_SYMBOL = 4;
    SCE_ST_BINARY = 5;
    SCE_ST_BOOL = 6;
    SCE_ST_SELF = 7;
    SCE_ST_SUPER = 8;
    SCE_ST_NIL = 9;
    SCE_ST_GLOBAL = 10;
    SCE_ST_RETURN = 11;
    SCE_ST_SPECIAL = 12;
    SCE_ST_KWSEND = 13;
    SCE_ST_ASSIGN = 14;
    SCE_ST_CHARACTER = 15;
    SCE_ST_SPEC_SEL = 16;
    SCE_FS_DEFAULT = 0;
    SCE_FS_COMMENT = 1;
    SCE_FS_COMMENTLINE = 2;
    SCE_FS_COMMENTDOC = 3;
    SCE_FS_COMMENTLINEDOC = 4;
    SCE_FS_COMMENTDOCKEYWORD = 5;
    SCE_FS_COMMENTDOCKEYWORDERROR = 6;
    SCE_FS_KEYWORD = 7;
    SCE_FS_KEYWORD2 = 8;
    SCE_FS_KEYWORD3 = 9;
    SCE_FS_KEYWORD4 = 10;
    SCE_FS_NUMBER = 11;
    SCE_FS_STRING = 12;
    SCE_FS_PREPROCESSOR = 13;
    SCE_FS_OPERATOR = 14;
    SCE_FS_IDENTIFIER = 15;
    SCE_FS_DATE = 16;
    SCE_FS_STRINGEOL = 17;
    SCE_FS_CONSTANT = 18;
    SCE_FS_ASM = 19;
    SCE_FS_LABEL = 20;
    SCE_FS_ERROR = 21;
    SCE_FS_HEXNUMBER = 22;
    SCE_FS_BINNUMBER = 23;
    SCE_CSOUND_DEFAULT = 0;
    SCE_CSOUND_COMMENT = 1;
    SCE_CSOUND_NUMBER = 2;
    SCE_CSOUND_OPERATOR = 3;
    SCE_CSOUND_INSTR = 4;
    SCE_CSOUND_IDENTIFIER = 5;
    SCE_CSOUND_OPCODE = 6;
    SCE_CSOUND_HEADERSTMT = 7;
    SCE_CSOUND_USERKEYWORD = 8;
    SCE_CSOUND_COMMENTBLOCK = 9;
    SCE_CSOUND_PARAM = 10;
    SCE_CSOUND_ARATE_VAR = 11;
    SCE_CSOUND_KRATE_VAR = 12;
    SCE_CSOUND_IRATE_VAR = 13;
    SCE_CSOUND_GLOBAL_VAR = 14;
    SCE_CSOUND_STRINGEOL = 15;
    SCE_INNO_DEFAULT = 0;
    SCE_INNO_COMMENT = 1;
    SCE_INNO_KEYWORD = 2;
    SCE_INNO_PARAMETER = 3;
    SCE_INNO_SECTION = 4;
    SCE_INNO_PREPROC = 5;
    SCE_INNO_PREPROC_INLINE = 6;
    SCE_INNO_COMMENT_PASCAL = 7;
    SCE_INNO_KEYWORD_PASCAL = 8;
    SCE_INNO_KEYWORD_USER = 9;
    SCE_INNO_STRING_DOUBLE = 10;
    SCE_INNO_STRING_SINGLE = 11;
    SCE_INNO_IDENTIFIER = 12;
    SCE_OPAL_SPACE = 0;
    SCE_OPAL_COMMENT_BLOCK = 1;
    SCE_OPAL_COMMENT_LINE = 2;
    SCE_OPAL_INTEGER = 3;
    SCE_OPAL_KEYWORD = 4;
    SCE_OPAL_SORT = 5;
    SCE_OPAL_STRING = 6;
    SCE_OPAL_PAR = 7;
    SCE_OPAL_BOOL_CONST = 8;
    SCE_OPAL_DEFAULT = 32;
    SCE_SPICE_DEFAULT = 0;
    SCE_SPICE_IDENTIFIER = 1;
    SCE_SPICE_KEYWORD = 2;
    SCE_SPICE_KEYWORD2 = 3;
    SCE_SPICE_KEYWORD3 = 4;
    SCE_SPICE_NUMBER = 5;
    SCE_SPICE_DELIMITER = 6;
    SCE_SPICE_VALUE = 7;
    SCE_SPICE_COMMENTLINE = 8;
    SCN_STYLENEEDED = 2000;
    SCN_CHARADDED = 2001;
    SCN_SAVEPOINTREACHED = 2002;
    SCN_SAVEPOINTLEFT = 2003;
    SCN_MODIFYATTEMPTRO = 2004;
    SCN_DOUBLECLICK = 2006;
    SCN_UPDATEUI = 2007;
    SCN_MODIFIED = 2008;
    SCN_MACRORECORD = 2009;
    SCN_MARGINCLICK = 2010;
    SCN_NEEDSHOWN = 2011;
    SCN_PAINTED = 2013;
    SCN_USERLISTSELECTION = 2014;
    SCN_DWELLSTART = 2016;
    SCN_DWELLEND = 2017;
    SCN_ZOOM = 2018;
    SCN_HOTSPOTCLICK = 2019;
    SCN_HOTSPOTDOUBLECLICK = 2020;
    SCN_CALLTIPCLICK = 2021;
    SCN_AUTOCSELECTION = 2022;

Added src/SCIInterface.pas.

























































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
// $HDR$
// $Log:  157187: SCIInterface.pas 
//
//    Rev 1.0    9/22/2009 16:57:18  merijn
unit SCIInterface;

interface

uses
  Windows;

{$I SCIConsts.inc}

type TNotifyHeader = record
      hwndFrom : Pointer;
      idFrom   : Cardinal;
      code     : Cardinal;
     end;

     TSCNotification = record
      nmhdr             : TNotifyHeader;
      position          : Integer;    // SCN_STYLENEEDED, SCN_MODIFIED
      ch                : Integer;    // SCN_CHARADDED, SCN_KEY
      modifiers         : Integer;    // SCN_KEY
      modificationType  : Integer;    // SCN_MODIFIED
      text              : PChar;      // SCN_MODIFIED
      length            : Integer;    // SCN_MODIFIED
      linesAdded        : Integer;    // SCN_MODIFIED
      message           : Integer;    // SCN_MACRORECORD
      wParam            : Longword;   // SCN_MACRORECORD
      lParam            : LongInt;    // SCN_MACRORECORD
      line              : Integer;    // SCN_MODIFIED
      foldLevelNow      : Integer;    // SCN_MODIFIED
      foldLevelPrev     : Integer;    // SCN_MODIFIED
      margin            : Integer;    // SCN_MARGINCLICK
      listType          : Integer;    // SCN_USERLISTSELECTION
     end;
     PSCNotification = ^TSCNotification;

type TSCIInterface = class(TObject)
     private
      fSCIHandle: hwnd;

      function SPerform(Msg: Cardinal; wParam: integer = 0; lParam: integer = 0): integer; 

      function GetSelText: string;
      function GetSelectionStart: integer;
      function GetSelectionEnd: integer;
      function GetLineLength(LineNr: integer): integer;
      function GetLineNr(LineNr: integer): string;
      function GetLineCount: integer;
      function GetAllText: string;
      procedure SetAllText(const Value: string);
      function GetAllLength: integer;
    procedure SetAllBinary(const Value: string);
    function GetReadOnly: boolean;
    procedure SetReadOnly(const Value: boolean);
     public
      constructor Create;

      procedure AppendText(Text: string);
      procedure ClearAll;

      property SCIHandle: hwnd read fSCIHandle write fSCIHandle;

      property SelText: string read GetSelText;
      property SelectionStart: integer read GetSelectionStart;
      property SelectionEnd: integer read GetSelectionEnd;

      property LineLength[LineNr: integer]: integer read GetLineLength;
      property Line[LineNr: integer]: string read GetLineNr;
      property LineCount: integer read GetLineCount;

      property AllLength: integer read GetAllLength;
      property AllText: string read GetAllText write SetAllText;
      property AllBinary: string read GetAllText write SetAllBinary;

      property ReadOnly: boolean read GetReadOnly write SetReadOnly;



      procedure BeginUndoAction;
      procedure EndUndoAction;

      function ShowLines(LineStart: integer; LineEnd: integer = -1): integer;
      function HideLines(LineStart: integer; LineEnd: integer = -1): integer;
      function ShowAllLines: integer;

      function CreateDocument: integer;
      procedure MarkUnchanged;
     end;


implementation

uses
  SysUtils;

{ TSCIInterface }

procedure TSCIInterface.AppendText(Text: string);
begin
 SPerform(SCI_APPENDTEXT, Length(Text), integer(@Text[1]));
end;

procedure TSCIInterface.BeginUndoAction;
begin
 SPerform(SCI_BEGINUNDOACTION);
end;

procedure TSCIInterface.ClearAll;
begin
 SPerform(SCI_CLEARALL);
end;

constructor TSCIInterface.Create;
begin
 inherited;

 fSCIHandle := 0;
end;

procedure TSCIInterface.SetAllBinary(const Value: string);
begin
 BeginUndoAction();
 ClearAll();
 AppendText(Value);
 EndUndoAction;
end;

procedure TSCIInterface.SetAllText(const Value: string);
var Data: PChar;
begin
 Data := StrAlloc(Length(Value) + 1);
 ZeroMemory(Data, Length(Value) + 1);
 StrPCopy(Data, Value);

 SPerform(SCI_SETTEXT, 0, integer(Data));
 StrDispose(Data);
end;

procedure TSCIInterface.SetReadOnly(const Value: boolean);
begin
 SPerform(SCI_SETREADONLY, 0, integer(value));
end;

function TSCIInterface.ShowAllLines: integer;
begin
 result := SPerform(SCI_SHOWLINES, 0, LineCount - 1);
end;

function TSCIInterface.ShowLines(LineStart, LineEnd: integer): integer;
begin
 if LineEnd = -1 then
  LineEnd := LineStart;

 result := SPerform(SCI_SHOWLINES, LineStart, LineEnd);
end;

function TSCIInterface.SPerform(Msg: Cardinal; wParam: integer = 0; lParam: integer = 0): integer;
begin
 if fSCIHandle = 0 then
  raise Exception.Create('no handle defined!');

 result := SendMessage(fSCIHandle, Msg, wParam, lParam);
end;


function TSCIInterface.CreateDocument: integer;
begin
 result := SPerform(SCI_CREATEDOCUMENT);
end;

procedure TSCIInterface.EndUndoAction;
begin
 SPerform(SCI_ENDUNDOACTION);
end;

function TSCIInterface.GetAllText: string;
begin
 SetLength(result, AllLength + 1);
 SPerform(SCI_GETTEXT, Length(result), integer(@result[1]));

 // now strip the extra 0x00 at the end of the string
 SetLength(result, Length(result) - 1);
end;

function TSCIInterface.GetAllLength: integer;
begin
 result := SPerform(SCI_GETLENGTH);
end;

function TSCIInterface.GetLineCount: integer;
begin
 result := SPerform(SCI_GETLINECOUNT);
end;

function TSCIInterface.GetLineLength(LineNr: integer): integer;
begin
 result := SPerform(SCI_LINELENGTH, LineNr);
end;

function TSCIInterface.GetLineNr(LineNr: integer): string;
begin
 SetLength(result, LineLength[LineNr]);
 SPerform(SCI_GETLINE, LineNr, integer(@result[1]));
end;

function TSCIInterface.GetReadOnly: boolean;
begin
 result := boolean(SPerform(SCI_GETREADONLY));
end;

function TSCIInterface.GetSelectionEnd: integer;
begin
 result := SPerform(SCI_GETSELECTIONEND);
end;

function TSCIInterface.GetSelectionStart: integer;
begin
 result := SPerform(SCI_GETSELECTIONSTART);
end;

function TSCIInterface.GetSelText: string;
var SelLength: integer;
begin
 result := '';

 SelLength := SelectionEnd - SelectionStart;

 if SelLength > 0 then
 begin
  SetLength(Result, SelLength + 1);
  SPerform(SCI_GETSELTEXT, 0, integer(@result[1]));
  result := Copy(result, 1, SelLength);
 end;
end;

function TSCIInterface.HideLines(LineStart, LineEnd: integer): integer;
begin
 if LineEnd = -1 then
  LineEnd := LineStart;

 result := SPerform(SCI_SHOWLINES, LineStart, LineEnd);
end;

procedure TSCIInterface.MarkUnchanged;
begin
 SPerform(SCI_SETSAVEPOINT);
end;

end.

Added src/ToolTips.pas.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
unit ToolTips;

(*******************************************************************************

  Tool tips API Wrapper - allow to manage the tool tips easily

  Programmed by Leonid Lebedev <lebedevlp@mail.ru>, all rights reserved
  Fixed and improved by Samuel Soldat <samuel.soldat@snafu.de>, see SSyymmdd
  Any bug reports and improvement suggestions are welcomed
  Please do have respect for the copyright and do not change this header

  Last update: 13 March 2011

*******************************************************************************)

interface

uses
  SysUtils, Windows, Messages, Graphics, Classes, Controls, CommCtrl;

const
  TTN_GETDISPINFO = (TTN_FIRST - 0);
  TTN_SHOW = (TTN_FIRST - 1);
  TTN_POP = (TTN_FIRST - 2);
  TTN_LINKCLICK = (TTN_FIRST - 3);

  TTID_AUTO = 0;

type
  // An application-defined function that processes messages sent to a window.
  // To explain STRICT in detail see Remarks section of CallWindowProc function.
  {$IFDEF STRICT}
  TWndProc = function(
    hwnd: THandle; {handle of window}
    uMsg: Longword; {message identifier}
    wParam: Longint; {first message parameter}
    lParam: Longint {second message parameter}
  ): Longint; stdcall;
  {$ELSE}
  TWndProc = TFarProc;
  {$ENDIF}

  // Contains information used in handling the TTN_GETDISPINFO notification
  // message.
  TTTNGetDispInfo = packed record
    Msg: Cardinal;
    idCtrl: Longint;
    lpnmtdi: PNMTTDispInfo;
    Result: Longint;
  end;
  TTTNLinkClick = TWMNoParams;
  // Contains information about a notification message.
  TTTNPop = packed record
    Msg: Cardinal;
    idTT: Longint;
    pnmh: PNMHdr;
    Result: Longint;
  end;
  TTTNShow = TTTNPop;

  TToolTipStyle = (ttsAlwaysTip, ttsBalloon, ttsNoAnimate, ttsNoFade,
    ttsNoPrefix, ttsClose, ttsUseVisualStyle);
  TToolTipStyles = set of TToolTipStyle;

  TOnTTGetDispInfo = procedure(
    Sender: TObject;
    var DispInfo: TNMTTDispInfo
  ) of object;
  TOnTTLinkClick = TNotifyEvent;
  TOnTTPop = procedure(
    Sender: TObject;
    Id: Integer;
    const Header: TNMHdr
  ) of object;
  TOnTTShow = TOnTTPop;

  // Lightweight window control class for the tool tips usage.
  TToolTipWindow = class
  private
    fHandle: THandle;
    fParent: TWinControl;
    fWndProcPtr: Pointer;
    fPrevWndProc: Pointer;
    fOnGetDispInfo: TOnTTGetDispInfo;
    fOnLinkClick: TOnTTLinkClick;
    fOnPop: TOnTTPop;
    fOnShow: TOnTTShow;
    fStyles: TToolTipStyles;
    function GetStyles: TToolTipStyles;
  protected
    procedure WndProc(var Msg: TMessage); virtual;

    // Creates an overlapped, pop-up, or child window with an extended window
    // style.
    class function Window_CreateEx(dwExStyle: Longword; lpClassName: PAnsiChar;
      lpWindowName: PAnsiChar; dwStyle: Longword; x, y: Integer;
      nWidth, nHeight: Integer; hWndParent: THandle; hMenu: THandle;
      lpParam: Pointer): THandle;
    // Retrieves information about the specified window.
    class function Window_GetLong(hWnd: THandle; nIndex: Integer): Longint;
    // Changes an attribute of the specified window.
    class function Window_SetLong(hWnd: THandle; nIndex: Integer;
      dwNewLong: Longint): Longint;
    // Changes the size, position, and Z order of a child, pop-up, or top-level
    // window.
    class function Window_SetPos(hWnd: THandle; hWndInsertAfter: THandle;
      x, y: Integer; nWidth, nHeight: Integer; uFlags: Longword): Boolean;
    // Passes message information to the specified window procedure.
    class function Window_CallProc(lpPrevWndFunc: TWndProc; hWnd: THandle;
      Msg: Longword; wParam: Longint; lParam: Longint): Longint;

    // Sent when a window is being destroyed.
    procedure WMDestroy(var Message: TWMDestroy);
    // Sent by a common control to its parent window when an event has occurred
    // or the control requires some information.
    // SS110312: WMNotify now returns result
    function WMNotify(var Message: TWMNotify): Boolean;

    // Sent by a ToolTip control to retrieve information needed to display a
    // ToolTip window. This notification is sent in the form of a WM_NOTIFY
    // message.
    procedure TTNGetDispInfo(var Message: TTTNGetDispInfo); virtual;
    // Sent when a text link inside a balloon ToolTip is clicked.
    procedure TTNLinkClick(var Message: TTTNLinkClick); virtual;
    // Notifies the owner window that a ToolTip is about to be hidden. This
    // notification message is sent in the form of a WM_NOTIFY message.
    procedure TTNPop(var Message: TTTNPop); virtual;
    // Notifies the owner window that a ToolTip control is about to be
    // displayed. This notification message is sent in the form of a WM_NOTIFY
    // message.
    procedure TTNShow(var Message: TTTNShow); virtual;

    function GetWindowExStyle: Longword; virtual;
    function GetWindowClassName: PAnsiChar; virtual;
    function GetWindowStyle: Longword; virtual;
  public
    constructor Create(AParent: TWinControl); virtual;
    constructor CreateStyled(AParent: TWinControl; AStyles: TToolTipStyles);
    procedure AfterConstruction; override;
    property Handle: THandle read fHandle;
    property Parent: TWinControl read fParent;
    property Styles: TToolTipStyles read GetStyles;
    property OnGetDispInfo: TOnTTGetDispInfo read fOnGetDispInfo write fOnGetDispInfo;
    property OnLinkClick: TOnTTLinkClick read fOnLinkClick write fOnLinkClick;
    property OnPop: TOnTTPop read fOnPop write fOnPop;
    property OnShow: TOnTTShow read fOnShow write fOnShow;
  end;

  // Provides information about the title of a tooltip control.
  TTTGetTitleA = packed record
    dwSize: Longword; {size of structure}
    uTitleBitmap: Longword; {the tooltip icon}
    cch: Longword; {the number of characters in the title}
    pszTitle: PAnsiChar; {pointer to a multibyte string that contains the title}
  end;
  TTTGetTitleW = packed record
    dwSize: Longword; {size of structure}
    uTitleBitmap: Longword; {the tooltip icon}
    cch: Longword; {the number of characters in the title}
    pszTitle: PWideChar; {pointer to a wide string that contains the title}
  end;
  {$IFDEF UNICODE}
  TTTGetTitle = TTTGetTitleW;
  {$ELSE}
  TTTGetTitle = TTTGetTitleA;
  {$ENDIF}
  PTTGetTitle = ^TTTGetTitle;

  TToolTipIcon = (ttiNone, ttiInfo, ttiWarning, ttiError, ttiInfoLarge,
    ttiWarningLarge, ttiErrorLarge);

  TToolTipFlag = (ttfAbsolute, ttfCenterTip, ttfIdIsHWND, ttfParseLinks,
    ttfRTLReading, ttfSubClass, ttfTrack, ttfTransparent);
  TToolTipFlags = set of TToolTipFlag;

  TToolTip = class;
  TToolTipControl = class(TToolTipWindow)
  private
    // SS110312: Use TList instead of TObjectList so uses Contnrs obsoleted
    fToolTips: TList;
    fInfo: TTTGetTitle;
    // SS110312: fInfo.pszTitle will refer to fTitle so GetTitle obsoleted
    fTitle: string;
    fFlagsToInclude: TToolTipFlags;
    fFlagsToExclude: TToolTipFlags;
    function GetAutoPopTime: Cardinal;
    procedure SetAutoPopTime(const Value: Cardinal);
    function GetInitialTime: Cardinal;
    procedure SetInitialTime(const Value: Cardinal);
    function GetReshowTime: Cardinal;
    procedure SetReshowTime(const Value: Cardinal);
    function GetMargin: TRect;
    procedure SetMargin(const Value: TRect);
    function GetLeftMargin: Integer;
    procedure SetLeftMargin(const Value: Integer);
    function GetTopMargin: Integer;
    procedure SetTopMargin(const Value: Integer);
    function GetRightMargin: Integer;
    procedure SetRightMargin(const Value: Integer);
    function GetBottomMargin: Integer;
    procedure SetBottomMargin(const Value: Integer);
    function GetMaxTipWidth: Integer;
    procedure SetMaxTipWidth(const Value: Integer);
    function GetBackColor: TColor;
    procedure SetBackColor(const Value: TColor);
    function GetTextColor: TColor;
    procedure SetTextColor(const Value: TColor);
    function GetIcon: TToolTipIcon;
    procedure SetIcon(const Value: TToolTipIcon);
    procedure SetTitle(const Value: string);
    function GetItem(const Index: Integer): TToolTip;
    function GetCount: Integer;
    function GetCurrentTool: TToolInfo;
    function GetCurrentToolExists: Boolean;
    function GetTool(iTool: Cardinal): TToolInfo;
    function GetToolCount: Integer;
  protected
    // Registers specific common control classes from the common control DLL.
    class function CommonControls_InitEx(dwICC: Longword): Boolean;

    procedure TTNGetDispInfo(var Message: TTTNGetDispInfo); override;
    procedure TTNLinkClick(var Message: TTTNLinkClick); override;
    procedure TTNPop(var Message: TTTNPop); override;
    procedure TTNShow(var Message: TTTNShow); override;

    procedure AfterAdjustRect(var ARect: TRect); virtual;

    function EnumTools(iTool: Longword; var AInfo: TToolInfo): Boolean; virtual;
    function HitTest(APoint: TPoint; var AInfo: TToolInfo): Boolean; virtual;

    property Tools[iTool: Cardinal]: TToolInfo read GetTool;
    property Margin: TRect read GetMargin write SetMargin;
    property CurrentToolExists: Boolean read GetCurrentToolExists;
    property CurrentTool: TToolInfo read GetCurrentTool;
    property ToolCount: Integer read GetToolCount;
  public
    // NOTICE: Control destruction will remove all the tool tips owned.
    constructor Create(AParent: TWinControl); override;
    procedure AfterConstruction; override;
    procedure BeforeDestruction; override;
    function Add(AToolTip: TToolTip): Integer; virtual;
    // NOTICE: Remove will destroy AToolTip.
    function Remove(AToolTip: TToolTip): Integer; virtual;
    procedure Activate;
    procedure Deactivate;
    function AdjustTextRect(var ARect: TRect): Boolean;
    function AdjustWindowRect(var ARect: TRect): Boolean;
    // Set all three delay times to default proportions.
    procedure SetAutomaticDelayTime;
    procedure Pop;
    procedure Popup;
    procedure RelayEvent(var Msg: TMsg);
    // SS110312: ATheme is a constant parameter now
    procedure SetWindowTheme(const ATheme: string);
    procedure TrackPosition(X, Y: Word);
    procedure Update;
    function WindowFromPoint(APoint: TPoint): THandle;
    // SS110312: AddHints add tool tips according Hint properties from AControl
    //           and all of its children recursively
    procedure AddHints(AControl: TControl);
    // The amount of time a ToolTip window remains visible if the pointer is
    // stationary within a tool's bounding rectangle.
    property AutoPopTime: Cardinal read GetAutoPopTime write SetAutoPopTime;
    // The amount of time a pointer must remain stationary within a tool's
    // bounding rectangle before the ToolTip window appears.
    property InitialTime: Cardinal read GetInitialTime write SetInitialTime;
    // The amount of time it takes for subsequent ToolTip windows to appear as
    // the pointer moves from one tool to another.
    property ReshowTime: Cardinal read GetReshowTime write SetReshowTime;
    property LeftMargin: Integer read GetLeftMargin write SetLeftMargin;
    property TopMargin: Integer read GetTopMargin write SetTopMargin;
    property RightMargin: Integer read GetRightMargin write SetRightMargin;
    property BottomMargin: Integer read GetBottomMargin write SetBottomMargin;
    property MaxTipWidth: Integer read GetMaxTipWidth write SetMaxTipWidth;
    property BackColor: TColor read GetBackColor write SetBackColor;
    property TextColor: TColor read GetTextColor write SetTextColor;
    property Icon: TToolTipIcon read GetIcon write SetIcon;
    property Title: string read fTitle write SetTitle;
    property Items[const Index: Integer]: TToolTip read GetItem; default;
    property Count: Integer read GetCount;
  end;

  TStandardToolTipControl = class(TToolTipControl)
  public
    constructor Create(AParent: TWinControl); override;
  end;

  TTrackingToolTipControl = class(TToolTipControl)
  public
    constructor Create(AParent: TWinControl); override;
  end;

  TMultilineToolTipControl = class(TStandardToolTipControl)
  public
    constructor Create(AParent: TWinControl); override;
  end;

  TBalloonToolTipControl = class(TToolTipControl)
  public
    constructor Create(AParent: TWinControl); override;
  end;

  TInPlaceToolTipControl = class(TStandardToolTipControl)
  protected
    procedure AfterAdjustRect(var ARect: TRect); override;
  end;

  TToolTipId = Longword;

  TOnToolTipGetDispInfo = function(
    Sender: TObject;
    var Instance: THandle;
    var ResName: string;
    var Text: string;
    Data: Longint
  ): Boolean of object;
  TOnToolTipLinkClick = TNotifyEvent;
  TOnToolTipPop = TNotifyEvent;
  TOnToolTipShow = TOnToolTipPop;

  TToolTip = class
  private
    fOwner: TToolTipControl;
    fControl: TControl;
    fParent: TWinControl;
    fInfo: TToolInfo;
    // SS110312: fInfo.lpszText will refer to fText so GetText obsoleted
    fText: string;
    fTrackActivated: Boolean;
    fOnGetDispInfo: TOnToolTipGetDispInfo;
    fOnLinkClick: TOnToolTipLinkClick;
    fOnPop: TOnToolTipPop;
    fOnShow: TOnToolTipShow;
    procedure SetOwner(const Value: TToolTipControl);
    procedure SetControl(const Value: TControl);
    function GetId: TToolTipId;
    function GetFlags: TToolTipFlags;
    procedure SetFlags(const Value: TToolTipFlags);
    function GetClipRect: TRect;
    procedure SetText(const Value: string);
    function GetBubbleSize: TSize;
    function GetToolInfo: TToolInfo;
  protected
    class function GetWinControl(AControl: TControl): TWinControl;

    function DoGetDispInfo(var Instance: THandle; var ResName: string;
      var Text: string; Data: Longint): Boolean; virtual;
    procedure DoLinkClick; virtual;
    procedure DoPop; virtual;
    procedure DoShow; virtual;

    procedure CheckOwner(const MethodName: string);

    function AddTool: Boolean; virtual;
    procedure DelTool; virtual;
    procedure SetInfo(const Value: TToolInfo); virtual;

    property ToolInfo: TToolInfo read GetToolInfo;
  public
    constructor Create(AControl: TControl; const GetDispInfo: Boolean = False;
       AId: TToolTipId = TTID_AUTO); virtual;
    procedure AfterConstruction; override;
    procedure BeforeDestruction; override;
    procedure SetClipRect(const Value: TRect); overload;
    procedure SetClipRect(AControl: TControl; const Value: TRect); overload;
    procedure NewToolRect(const ARect: TRect);
    procedure TrackActivate;
    procedure TrackDisactivate;
    procedure TrackPosition(X, Y: Word);
    property Owner: TToolTipControl read fOwner write SetOwner;
    property Control: TControl read fControl write SetControl;
    property Parent: TWinControl read fParent;
    property Id: TToolTipId read GetId;
    property Flags: TToolTipFlags read GetFlags write SetFlags;
    property ClipRect: TRect read GetClipRect;
    // NOTICE: GetBubbleSize will return zeroes if called before TrackActivate.
    property BubbleSize: TSize read GetBubbleSize;
    property Text: string read fText write SetText;
    property OnGetDispInfo: TOnToolTipGetDispInfo read fOnGetDispInfo write fOnGetDispInfo;
    property OnLinkClick: TOnToolTipLinkClick read fOnLinkClick write fOnLinkClick;
    property OnPop: TOnToolTipPop read fOnPop write fOnPop;
    property OnShow: TOnToolTipShow read fOnShow write fOnShow;
  end;

  EToolTip = class(Exception);

implementation

uses Types;

resourcestring
  S_EWin32Error = 'Win32 API call of %s failed'#13#10'Error code %d (%s)';
  S_EUnkWin32Error = 'Win32 API call of %s failed'#13#10'Error code %d';
  S_ENotSupported = 'This kind of the tool tips is not supported';
  S_EMessage = 'Error sending message %s';
  S_ECheckOwner = 'Call of %s.%s failed due to ToolTip has no owner window';
  S_ENoWindow = 'Control %s: %s has no parent window';
  S_EId = 'Invalid tool id %d';
  S_ESetText = 'Unable to set ToolTip text due to GetDispInfo was TRUE';

procedure RaiseLastWin32Error(const FunctionName: string);
{$IFNDEF SUPPRESS_WIN32ERROR}
var
  LastError: DWORD;
  Error: EOSError;
{$ENDIF}
begin
  {$IFNDEF SUPPRESS_WIN32ERROR}
  LastError := GetLastError;
  if LastError <> ERROR_SUCCESS then
    Error := EOSError.CreateFmt(S_EWin32Error,
      [FunctionName, LastError, SysErrorMessage(LastError)])
  else
    Error := EOSError.CreateFmt(S_EUnkWin32Error,
      [FunctionName, LastError]);
  Error.ErrorCode := LastError;
  raise Error;
  {$ENDIF}
end;

procedure RaiseToolTipError(const MessageName: string);
begin
  {$IFNDEF SUPPRESS_TOOLTIPERROR}
  raise EToolTip.CreateFmt(S_EMessage, [MessageName]);
  {$ENDIF}
end;

const
  CCM_SETWINDOWTHEME = (CCM_FIRST + $0B);
  TTF_PARSELINKS = $1000;
  TTM_GETBUBBLESIZE = (WM_USER + 30);
  TTM_ADJUSTRECT = (WM_USER + 31);
  {$IFDEF UNICODE}
  TTM_SETTITLE = (WM_USER + 33);
  {$ELSE}
  TTM_SETTITLE = (WM_USER + 32);
  {$ENDIF}
  TTM_POPUP = (WM_USER + 34);
  TTM_GETTITLE = (WM_USER + 35);
  TTM_SETWINDOWTHEME = CCM_SETWINDOWTHEME;
  TTS_BALLOON = $40;

type
  ToolTipsAPI = class
  protected
    // Activates or deactivates a ToolTip control.
    class procedure Activate(hWndControl: THandle; fActivate: Boolean);
    // Registers a tool with a ToolTip control.
    // Returns TRUE if successful, or FALSE otherwise.
    class function Add(hWndControl: THandle; lpti: PToolInfo): Boolean;
    // Calculates a ToolTip control's text display rectangle from its window
    // rectangle, or the ToolTip window rectangle needed to display a specified
    // text display rectangle.
    // Returns a non-zero value if the rectangle is successfully adjusted, and
    // returns zero if an error occurs.
    class function AdjustRect(hWndControl: THandle; fLarger: Boolean; prc: PRect): Longint;
    // Removes a tool from a ToolTip control.
    class procedure Del(hWndControl: THandle; lpti: PToolInfo);
    // Retrieves the information that a ToolTip control maintains about the
    // current tool—that is, the tool for which the ToolTip is currently
    // displaying text.
    // Returns TRUE if any tools are enumerated, or FALSE otherwise.
    class function Enum(hWndControl: THandle; iTool: Longword; lpti: PToolInfo): Boolean;
    // Returns the width and height of a ToolTip control.
    // Returns the width of the ToolTip in the low word and the height in the
    // high word if successful. Otherwise, it returns FALSE.
    class function GetBubbleSize(hWndControl: THandle; pTtm: PToolInfo): Longint;
    // Retrieves the information for the current tool in a ToolTip control.
    // Returns nonzero if successful, or zero otherwise. If lpti is NULL,
    // returns nonzero if a current tool exists, or zero otherwise.
    class function GetCurrent(hWndControl: THandle; lpti: PToolInfo): Longint;
    // Retrieves the initial, pop-up, and reshow durations currently set for a
    // ToolTip control.
    // Returns and INT value with the specified duration in milliseconds.
    class function GetDelayTime(hWndControl: THandle; dwDuration: Longword): Integer;
    // Retrieves the top, left, bottom, and right margins set for a ToolTip
    // window. A margin is the distance, in pixels, between the ToolTip window
    // border and the text contained within the ToolTip window.
    class procedure GetMargin(hWndControl: THandle; lprc: PRect);
    // Retrieves the maximum width for a ToolTip window.
    // Returns an INT value that represents the maximum ToolTip width, in
    // pixels. If no maximum width was set previously, the message returns -1.
    class function GetMaxWidth(hWndControl: THandle): Integer;
    // Retrieves the information a ToolTip control maintains about a tool.
    class procedure GetText(hWndControl: THandle; wNumber: Longint; lpti: PToolInfo);
    // Retrieves the background color in a ToolTip window.
    // Returns a Longword value that represents the background color.
    class function GetBkColor(hWndControl: THandle): Longword;
    // Retrieves the text color in a ToolTip window.
    // Returns a Longword value that represents the text color.
    class function GetTextColor(hWndControl: THandle): Longword;
    // Retrieve information concerning the title of a toolTip control.
    class procedure GetTitle(hWndControl: THandle; pGetTitle: PTTGetTitle);
    // Retrieves a count of the tools maintained by a ToolTip control.
    // Returns a count of tools.
    class function GetCount(hWndControl: THandle): Longint;
    // Retrieves the information that a ToolTip control maintains about a tool.
    // Returns TRUE if successful, or FALSE otherwise.
    class function GetInfo(hWndControl: THandle; lpti: PToolInfo): Boolean;
    // Tests a point to determine whether it is within the bounding rectangle of
    // the specified tool and, if it is, retrieves information about the tool.
    // Returns TRUE if the tool occupies the specified point, or FALSE
    // otherwise.
    class function HitTest(hWndControl: THandle; lphti: PTTHitTestInfo): Boolean;
    // Sets a new bounding rectangle for a tool.
    class procedure NewRect(hWndControl: THandle; lpti: PToolInfo);
    // Removes a displayed ToolTip window from view.
    class procedure Pop(hWndControl: THandle);
    // Causes the ToolTip to display at the coordinates of the last mouse
    // message.
    class procedure Popup(hWndControl: THandle);
    // Passes a mouse message to a ToolTip control for processing.
    class procedure RelayEvent(hWndControl: THandle; lpmsg: PMsg);
    // Sets the initial, pop-up, and reshow durations for a ToolTip control.
    class procedure SetDelayTime(hWndControl: THandle; dwDuration: Word; iTime: Longword);
    // Sets the top, left, bottom, and right margins for a ToolTip window. A
    // margin is the distance, in pixels, between the ToolTip window border and
    // the text contained within the ToolTip window.
    class procedure SetMargin(hWndControl: THandle; lprc: PRect);
    // Sets the maximum width for a ToolTip window.
    // Returns the previous maximum ToolTip width.
    class function SetMaxWidth(hWndControl: THandle; iWidth: Integer): Longint;
    // Sets the background color in a ToolTip window.
    class procedure SetBkColor(hWndControl: THandle; clr: Longword);
    // Sets the text color in a ToolTip window.
    class procedure SetTextColor(hWndControl: THandle; clr: Longword);
    // Adds a standard icon and title string to a ToolTip.
    // Returns TRUE if successful, FALSE if not.
    {$IFDEF UNICODE}
    class function SetTitle(hWndControl: THandle; icon: Integer; pszTitle: PWideChar): Boolean;
    {$ELSE}
    class function SetTitle(hWndControl: THandle; icon: Integer; pszTitle: PAnsiChar): Boolean;
    {$ENDIF}
    // Sets the information that a ToolTip control maintains for a tool.
    class procedure SetInfo(hWndControl: THandle; lpti: PToolInfo);
    // Sets the visual style of a ToolTip control.
    class procedure SetWindowTheme(hWndControl: THandle; pwStr: PWideChar);
    // Activates or deactivates a tracking ToolTip.
    class procedure TrackActivate(hWndControl: THandle; bActivate: Boolean; lpti: PToolInfo);
    // Sets the position of a tracking ToolTip.
    class procedure TrackPosition(hWndControl: THandle; xPos, yPos: Word);
    // Forces the current tool to be redrawn.
    class procedure Update(hWndControl: THandle);
    // Sets the ToolTip text for a tool.
    class procedure UpdateText(hWndControl: THandle; lpti: PToolInfo);
    // Allows a subclass procedure to cause a ToolTip to display text for a
    // window other than the one beneath the mouse cursor.
    // The return value is the handle to the window that contains the point, or
    // NULL if no window exists at the specified point.
    class function WindowFromPoint(hWndControl: THandle; lppt: PPoint): Longint;
  end;

{ ToolTipsAPI }

class procedure ToolTipsAPI.Activate(hWndControl: THandle;
  fActivate: Boolean);
begin
  SendMessage(hWndControl, TTM_ACTIVATE, Integer(fActivate), 0);
end;

class function ToolTipsAPI.Add(hWndControl: THandle;
  lpti: PToolInfo): Boolean;
begin
  Result := SendMessage(hWndControl, TTM_ADDTOOL, 0, Integer(lpti)) <> 0;
  if not Result then
    RaiseToolTipError('TTM_ADDTOOL');
end;

class function ToolTipsAPI.AdjustRect(hWndControl: THandle;
  fLarger: Boolean; prc: PRect): Longint;
begin
  Result := SendMessage(hWndControl, TTM_ADJUSTRECT, Integer(fLarger), Integer(prc));
  if Result = 0 then
    RaiseToolTipError('TTM_ADJUSTRECT');
end;

class procedure ToolTipsAPI.Del(hWndControl: THandle; lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_DELTOOL, 0, Integer(lpti));
end;

class function ToolTipsAPI.Enum(hWndControl: THandle; iTool: Longword;
  lpti: PToolInfo): Boolean;
begin
  Result := SendMessage(hWndControl, TTM_ENUMTOOLS, iTool, Integer(lpti)) <> 0;
  if not Result then
    RaiseToolTipError('TTM_ENUMTOOLS');
end;

class function ToolTipsAPI.GetBkColor(hWndControl: THandle): Longword;
begin
  Result := SendMessage(hWndControl, TTM_GETTIPBKCOLOR, 0, 0);
end;

class function ToolTipsAPI.GetBubbleSize(hWndControl: THandle;
  pTtm: PToolInfo): Longint;
begin
  Result := SendMessage(hWndControl, TTM_GETBUBBLESIZE, 0, Integer(pTtm));
  if Result = 0 then
    RaiseToolTipError('TTM_GETBUBBLESIZE');
end;

class function ToolTipsAPI.GetCount(hWndControl: THandle): Longint;
begin
  Result := SendMessage(hWndControl, TTM_GETTOOLCOUNT, 0, 0);
end;

class function ToolTipsAPI.GetCurrent(hWndControl: THandle;
  lpti: PToolInfo): Longint;
begin
  Result := SendMessage(hWndControl, TTM_GETCURRENTTOOL, 0, Integer(lpti));
  if Result = 0 then
    RaiseToolTipError('TTM_GETCURRENTTOOL');
end;

class function ToolTipsAPI.GetDelayTime(hWndControl: THandle;
  dwDuration: Longword): Integer;
begin
  Result := SendMessage(hWndControl, TTM_GETDELAYTIME, dwDuration, 0)
end;

class function ToolTipsAPI.GetInfo(hWndControl: THandle;
  lpti: PToolInfo): Boolean;
begin
  Result := SendMessage(hWndControl, TTM_GETTOOLINFO, 0, Integer(lpti)) <> 0;
  if not Result then
    RaiseToolTipError('TTM_GETTOOLINFO');
end;

class procedure ToolTipsAPI.GetMargin(hWndControl: THandle; lprc: PRect);
begin
  SendMessage(hWndControl, TTM_GETMARGIN, 0, Integer(lprc));
end;

class function ToolTipsAPI.GetMaxWidth(hWndControl: THandle): Integer;
begin
  Result := SendMessage(hWndControl, TTM_GETMAXTIPWIDTH, 0, 0);
end;

class procedure ToolTipsAPI.GetText(hWndControl: THandle; wNumber: Integer;
  lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_GETTEXT, wNumber, Integer(lpti));
end;

class function ToolTipsAPI.GetTextColor(hWndControl: THandle): Longword;
begin
  Result := SendMessage(hWndControl, TTM_GETTIPTEXTCOLOR, 0, 0);
end;

class procedure ToolTipsAPI.GetTitle(hWndControl: THandle;
  pGetTitle: PTTGetTitle);
begin
  SendMessage(hWndControl, TTM_GETTITLE, 0, Integer(pGetTitle));
end;

class function ToolTipsAPI.HitTest(hWndControl: THandle;
  lphti: PTTHitTestInfo): Boolean;
begin
  Result := SendMessage(hWndControl, TTM_HITTEST, 0, Integer(lphti)) <> 0;
end;

class procedure ToolTipsAPI.NewRect(hWndControl: THandle; lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_NEWTOOLRECT, 0, Integer(lpti));
end;

class procedure ToolTipsAPI.Pop(hWndControl: THandle);
begin
  SendMessage(hWndControl, TTM_POP, 0, 0);
end;

class procedure ToolTipsAPI.Popup(hWndControl: THandle);
begin
  SendMessage(hWndControl, TTM_POPUP, 0, 0);
end;

class procedure ToolTipsAPI.RelayEvent(hWndControl: THandle; lpmsg: PMsg);
begin
  SendMessage(hWndControl, TTM_RELAYEVENT, 0, Integer(lpmsg));
end;

class procedure ToolTipsAPI.SetBkColor(hWndControl: THandle;
  clr: Longword);
begin
  SendMessage(hWndControl, TTM_SETTIPBKCOLOR, clr, 0);
end;

class procedure ToolTipsAPI.SetDelayTime(hWndControl: THandle;
  dwDuration: Word; iTime: Longword);
begin
  SendMessage(hWndControl, TTM_SETDELAYTIME, dwDuration, iTime);
end;

class procedure ToolTipsAPI.SetInfo(hWndControl: THandle; lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_SETTOOLINFO, 0, Integer(lpti));
end;

class procedure ToolTipsAPI.SetMargin(hWndControl: THandle; lprc: PRect);
begin
  SendMessage(hWndControl, TTM_SETMARGIN, 0, Integer(lprc));
end;

class function ToolTipsAPI.SetMaxWidth(hWndControl: THandle;
  iWidth: Integer): Longint;
begin
  Result := SendMessage(hWndControl, TTM_SETMAXTIPWIDTH, 0, iWidth);
end;

class procedure ToolTipsAPI.SetTextColor(hWndControl: THandle;
  clr: Longword);
begin
  SendMessage(hWndControl, TTM_SETTIPTEXTCOLOR, clr, 0);
end;

{$IFDEF UNICODE}
class function ToolTipsAPI.SetTitle(hWndControl: THandle; icon: Integer;
  pszTitle: PWideChar): Boolean;
{$ELSE}
class function ToolTipsAPI.SetTitle(hWndControl: THandle; icon: Integer;
  pszTitle: PAnsiChar): Boolean;
{$ENDIF}
begin
  Result := SendMessage(hWndControl, TTM_SETTITLE, icon, Integer(pszTitle)) <> 0;
  if not Result then
    RaiseToolTipError('TTM_SETTITLE');
end;

class procedure ToolTipsAPI.SetWindowTheme(hWndControl: THandle;
  pwStr: PWideChar);
begin
  SendMessage(hWndControl, TTM_SETWINDOWTHEME, 0, Integer(pwStr));
end;

class procedure ToolTipsAPI.TrackActivate(hWndControl: THandle;
  bActivate: Boolean; lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_TRACKACTIVATE, Integer(bActivate), Integer(lpti));
end;

class procedure ToolTipsAPI.TrackPosition(hWndControl: THandle; xPos,
  yPos: Word);
begin
  SendMessage(hWndControl, TTM_TRACKPOSITION, 0, MakeLong(xPos, yPos));
end;

class procedure ToolTipsAPI.Update(hWndControl: THandle);
begin
  SendMessage(hWndControl, TTM_UPDATE, 0, 0);
end;

class procedure ToolTipsAPI.UpdateText(hWndControl: THandle;
  lpti: PToolInfo);
begin
  SendMessage(hWndControl, TTM_UPDATETIPTEXT, 0, Integer(lpti));
end;

class function ToolTipsAPI.WindowFromPoint(hWndControl: THandle;
  lppt: PPoint): Longint;
begin
  Result := SendMessage(hWndControl, TTM_WINDOWFROMPOINT, 0, Integer(lppt));
end;

{ TToolTipWindow }

const
  TTS_NOANIMATE = $10;
  TTS_NOFADE = $20;
  TTS_CLOSE = $80;
  TTS_USEVISUALSTYLE = $100;

const
  ToolTipStyleValue: array [TToolTipStyle] of Longword = (TTS_ALWAYSTIP,
    TTS_BALLOON, TTS_NOANIMATE, TTS_NOFADE, TTS_NOPREFIX, TTS_CLOSE,
    TTS_USEVISUALSTYLE);

function ToolTipStylesValue(const Styles: TToolTipStyles): Longword;
var
  Style: TToolTipStyle;
begin
  Result := 0;
  for Style := Low(TToolTipStyle) to High(TToolTipStyle) do
    if Style in Styles then
      Result := Result or ToolTipStyleValue[Style];
end;

function GetToolTipStyles(const Value: Longint): TToolTipStyles;
var
  Style: TToolTipStyle;
begin
  Result := [];
  for Style := Low(TToolTipStyle) to High(TToolTipStyle) do
    if Value and ToolTipStyleValue[Style] <> 0 then
      Include(Result, Style);
end;

procedure TToolTipWindow.AfterConstruction;
const
  nIndex = GWL_WNDPROC; {offset of value to set}
var
  dwNewLong: Longint; {new value}
begin
  inherited;

  // Subclass ToolTip control.
  fWndProcPtr := MakeObjectInstance(WndProc);
  dwNewLong := Longint(fWndProcPtr);
  fPrevWndProc := Pointer(Window_SetLong(Parent.Handle, nIndex, dwNewLong));
end;

constructor TToolTipWindow.Create(AParent: TWinControl);
const
  lpWindowName = nil; {pointer to window name}
  hMenu = 0; {handle to menu, or child-window identifier}
  lpParam = nil; {pointer to window-creation data}
  hWndInsertAfter = HWND_TOPMOST; {placement-order handle}
  uFlags = SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE; {positioning flags}
var
  dwExStyle: Longword; {extended window style}
  lpClassName: PAnsiChar; {pointer to registered class name}
  dwStyle: Longword; {window style}
  x: Integer; {horizontal position of window}
  y: Integer; {vertical position of window}
  nWidth: Integer; {window width}
  nHeight: Integer; {window height}
  hWndParent: THandle; {handle to parent or owner window}
begin
  fParent := AParent;
  (* CREATE A TOOLTIP WINDOW *)
  dwExStyle := WS_EX_TOPMOST or GetWindowExStyle;
  lpClassName := GetWindowClassName;
  // SS110312: WS_EX_TOOLWINDOW removed from window style
  dwStyle := WS_POPUP or GetWindowStyle;
  x := Integer(CW_USEDEFAULT);
  y := Integer(CW_USEDEFAULT);
  nWidth := Integer(CW_USEDEFAULT);
  nHeight := Integer(CW_USEDEFAULT);
  hWndParent := fParent.Handle;
  fHandle := Window_CreateEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
    x, y, nWidth, nHeight, hWndParent, hMenu, lpParam);

  x := 0;
  y := 0;
  nWidth := 0;
  nHeight := 0;
  Window_SetPos(fHandle, hWndInsertAfter, x, y, nWidth, nHeight, uFlags);
end;

constructor TToolTipWindow.CreateStyled(AParent: TWinControl;
  AStyles: TToolTipStyles);
begin
  fStyles := AStyles;

  Create(AParent);
end;

function TToolTipWindow.GetStyles: TToolTipStyles;
const
  nIndex = GWL_STYLE; {offset of value to retrieve}
begin
  fStyles := GetToolTipStyles(Window_GetLong(Handle, nIndex));
  Result := fStyles;
end;

function TToolTipWindow.GetWindowClassName: PAnsiChar;
begin
  Result := TOOLTIPS_CLASS;
end;

function TToolTipWindow.GetWindowExStyle: Longword;
begin
  Result := 0;  
end;

function TToolTipWindow.GetWindowStyle: Longword;
begin
  Result := ToolTipStylesValue(fStyles);
end;

procedure TToolTipWindow.TTNGetDispInfo(var Message: TTTNGetDispInfo);
begin
  if Assigned(fOnGetDispInfo) then
    fOnGetDispInfo(Self, Message.lpnmtdi^);
end;

procedure TToolTipWindow.TTNLinkClick(var Message: TTTNLinkClick);
begin
  if Assigned(fOnLinkClick) then
    fOnLinkClick(Self);
end;

procedure TToolTipWindow.TTNPop(var Message: TTTNPop);
begin
  if Assigned(fOnPop) then
    fOnPop(Self, Message.idTT, Message.pnmh^);
  // SS110312: If in-place tooltip canceled, XP does not send further TTN_GETDISPINFO
  PostMessage(Handle, TTM_POP, 0, 0);
end;

procedure TToolTipWindow.TTNShow(var Message: TTTNShow);
begin
  if Assigned(fOnShow) then
    fOnShow(Self, Message.idTT, Message.pnmh^);
end;

class function TToolTipWindow.Window_CallProc(lpPrevWndFunc: TWndProc;
  hWnd: THandle; Msg: Longword; wParam, lParam: Integer): Longint;
begin
  Result := CallWindowProc(lpPrevWndFunc, hWnd, Msg, wParam, lParam);
end;

class function TToolTipWindow.Window_CreateEx(dwExStyle: Longword;
  lpClassName, lpWindowName: PAnsiChar; dwStyle: Longword; x, y, nWidth,
  nHeight: Integer; hWndParent, hMenu: THandle; lpParam: Pointer): THandle;
begin
  Result := CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
    x, y, nWidth, nHeight, hWndParent, hMenu, HInstance, lpParam);
  if Result = 0 then
    RaiseLastWin32Error('CreateWindowEx');
end;

class function TToolTipWindow.Window_GetLong(hWnd: THandle;
  nIndex: Integer): Longint;
begin
  Result := GetWindowLong(hWnd, nIndex);
  if Result = 0 then
    RaiseLastWin32Error('GetWindowLong');
end;

class function TToolTipWindow.Window_SetLong(hWnd: THandle; nIndex,
  dwNewLong: Integer): Longint;
begin
  Result := SetWindowLong(hWnd, nIndex, dwNewLong);
  if Result = 0 then
    RaiseLastWin32Error('SetWindowLong');
end;

class function TToolTipWindow.Window_SetPos(hWnd, hWndInsertAfter: THandle;
  x, y, nWidth, nHeight: Integer; uFlags: Longword): Boolean;
begin
  Result := SetWindowPos(hWnd, hWndInsertAfter, x, y, nWidth, nHeight, uFlags);
  if not Result then
    RaiseLastWin32Error('SetWindowPos');
end;

procedure TToolTipWindow.WMDestroy(var Message: TWMDestroy);
const
  nIndex = GWL_WNDPROC; {offset of value to set}
var
  dwNewLong: Longint; {new value}
begin
  // Remove the subclass from ToolTip control.
  dwNewLong := Longint(fPrevWndProc);
  Window_SetLong(Parent.Handle, nIndex, dwNewLong);
  FreeObjectInstance(fWndProcPtr);
  // SS110312: Force fParent to point nil
  fParent := nil;
end;

function TToolTipWindow.WMNotify(var Message: TWMNotify): Boolean;
begin
  // SS110312: return True if WM_NOTIFY message has been processed
  Result := Message.NMHdr.hwndFrom = Handle;
  if Result then
    case Message.NMHdr.code of
      TTN_GETDISPINFO: TTNGetDispInfo(TTTNGetDispInfo(Message));
      TTN_LINKCLICK: TTNLinkClick(TTTNLinkClick(Message));
      TTN_POP: TTNPop(TTTNPop(Message));
      TTN_SHOW: TTNShow(TTTNShow(Message));
    end;
end;

procedure TToolTipWindow.WndProc(var Msg: TMessage);
var
  Done: Boolean;
begin
  // SS110312: Message have to be dispatched only if it has not been processed
  Done := False;
  case Msg.Msg of
    WM_NOTIFY: Done := WMNotify(TWMNotify(Msg));
    WM_DESTROY: WMDestroy(TWMDestroy(Msg));
  end;

  if not Done and (Parent <> nil) then
    with Msg do
      Result := Window_CallProc(fPrevWndProc, Parent.Handle, Msg, wParam, lParam);
end;

type
  // SS110312: TToolTipList inherits TList instead of TObjectList
  TToolTipList = class(TList)
  private
    function GetItem(Index: Integer): TToolTip;
    procedure SetItem(Index: Integer; const Value: TToolTip);
  protected
    function GetNextId: TToolTipId;

    function DispatchGetDispInfo(AId: TToolTipId;
      var Instance: THandle; var ResName: string;
      var Text: string; Data: Longint): Boolean; virtual;
    procedure DispatchLinkClick(AId: TToolTipId); virtual;
    procedure DispatchPop(AId: TToolTipId); virtual;
    procedure DispatchShow(AId: TToolTipId); virtual;
  public
    procedure Insert(Index: Integer; AObject: TToolTip); virtual;
    function Add(AObject: TToolTip): Integer;
    function Extract(Item: TToolTip): TToolTip;
    function First: TToolTip;
    function Last: TToolTip;
    function IndexOfId(AId: TToolTipId): Integer; virtual;
    function FindById(AId: TToolTipId): TToolTip;
    property Items[Index: Integer]: TToolTip read GetItem write SetItem; default;
  end;

{ TToolTipList }

function TToolTipList.Add(AObject: TToolTip): Integer;
begin
  Result := Count;
  Insert(Result, AObject);
end;

function TToolTipList.DispatchGetDispInfo(AId: TToolTipId;
  var Instance: THandle; var ResName, Text: string;
  Data: Integer): Boolean;
begin
  Result := FindById(AId).DoGetDispInfo(Instance, ResName, Text, Data);
end;

procedure TToolTipList.DispatchLinkClick(AId: TToolTipId);
begin
  FindById(AId).DoLinkClick;
end;

procedure TToolTipList.DispatchPop(AId: TToolTipId);
begin
  FindById(AId).DoPop;
end;

procedure TToolTipList.DispatchShow(AId: TToolTipId);
begin
  FindById(AId).DoShow;
end;

function TToolTipList.Extract(Item: TToolTip): TToolTip;
begin
  Result := TToolTip(inherited Extract(Item));
end;

function TToolTipList.FindById(AId: TToolTipId): TToolTip;
var
  Index: Integer;
begin
  Index := IndexOfId(AId);
  if Index < 0 then
    raise EToolTip.CreateFmt(S_EId, [AId]);
  Result := GetItem(Index);
end;

function TToolTipList.First: TToolTip;
begin
  Result := TToolTip(inherited First);
end;

function TToolTipList.GetItem(Index: Integer): TToolTip;
begin
  // SS110312: Use Get instead of inherited GetItem
  Result := TToolTip(Get(Index));
end;

function TToolTipList.GetNextId: TToolTipId;
begin
  Result := 1;
  while IndexOfId(Result) >= 0 do
    Inc(Result);
end;

function TToolTipList.IndexOfId(AId: TToolTipId): Integer;
var
  Index: Integer;
begin
  Result := -1;
  if Count = 0 then
    Exit;

  for Index := 0 to Count - 1 do
    if Items[Index].Id = AId then
    begin
      Result := Index;
      Break;
    end;
end;

procedure TToolTipList.Insert(Index: Integer; AObject: TToolTip);
begin
  inherited Insert(Index, AObject);
end;

function TToolTipList.Last: TToolTip;
begin
  Result := TToolTip(inherited Last);
end;

procedure TToolTipList.SetItem(Index: Integer; const Value: TToolTip);
begin
  // SS110312: Use Put instead of inherited SetItem
  Put(Index, Value);
end;

{ TToolTipControl }

var
  CommonControls: Cardinal = 0;

var
  AllToolTips: TToolTipList;

const
  TTI_NONE = 0;
  TTI_INFO = 1;
  TTI_WARNING = 2;
  TTI_ERROR = 3;
  TTI_INFO_LARGE = 4;
  TTI_WARNING_LARGE = 5;
  TTI_ERROR_LARGE = 6;

const
  MAX_TITLE = 99;

const
  ToolTipIconValue: array [TToolTipIcon] of Integer = (TTI_NONE, TTI_INFO,
    TTI_WARNING, TTI_ERROR, TTI_INFO_LARGE, TTI_WARNING_LARGE, TTI_ERROR_LARGE);

function GetToolTipIcon(const Value: Integer): TToolTipIcon;
var
  Icon: TToolTipIcon;
begin
  Result := ttiNone;
  for Icon := Low(TToolTipIcon) to High(TToolTipIcon) do
    if Value = ToolTipIconValue[Icon] then
    begin
      Result := Icon;
      Break;
    end;
end;

procedure TToolTipControl.Activate;
begin
  ToolTipsAPI.Activate(Handle, True);
end;

function TToolTipControl.Add(AToolTip: TToolTip): Integer;
begin
  AToolTip.Flags := AToolTip.Flags + fFlagsToInclude - fFlagsToExclude;

  AToolTip.SetOwner(Self);
  AToolTip.AddTool;

  Result := fToolTips.Add(AToolTip);
end;

procedure TToolTipControl.AddHints(AControl: TControl);
var
  Index: Integer;
begin
  if Length(AControl.Hint) > 0 then
  begin
    AControl.ShowHint := False;
    Add(TToolTip.Create(AControl));
  end;

  if AControl.ComponentCount > 0 then
    for Index := 0 to AControl.ComponentCount - 1 do
      if AControl.Components[Index] is TControl then
        AddHints(TControl(AControl.Components[Index]));
end;

function TToolTipControl.AdjustTextRect(var ARect: TRect): Boolean;
begin
  Result := ToolTipsAPI.AdjustRect(Handle, True, @ARect) <> 0;
  AfterAdjustRect(ARect);
end;

function TToolTipControl.AdjustWindowRect(var ARect: TRect): Boolean;
begin
  Result := ToolTipsAPI.AdjustRect(Handle, False, @ARect) <> 0;
  AfterAdjustRect(ARect);
end;

procedure TToolTipControl.AfterAdjustRect(var ARect: TRect);
begin
  // Nothing to do here
end;

procedure TToolTipControl.AfterConstruction;
begin
  inherited;

  fToolTips := TToolTipList.Create;
end;

procedure TToolTipControl.BeforeDestruction;
begin
  while Count > 0 do
    Remove(Items[0]);

  fToolTips.Free;
  // SS110312: Force fInfo.pszTitle to point nil
  fInfo.pszTitle := nil;

  inherited;
end;

class function TToolTipControl.CommonControls_InitEx(
  dwICC: Longword): Boolean;
var
  iccex: TInitCommonControlsEx; {struct specifying control classes to register}
begin
  Result := CommonControls and dwICC = dwICC;
  if Result then
    Exit;

  iccex.dwSize := SizeOf(TInitCommonControlsEx);
  iccex.dwICC := dwICC;
  Result := InitCommonControlsEx(iccex);
  if not Result then
    RaiseLastWin32Error('InitCommonControlsEx');
  CommonControls := CommonControls or dwICC;
end;

constructor TToolTipControl.Create(AParent: TWinControl);
begin
  inherited;

  ZeroMemory(@fInfo, SizeOf(TTTGetTitle));
  fInfo.dwSize := SizeOf(TTTGetTitle);
  // SS110312: Allocate empty string
  fInfo.cch := 0;
  fTitle := #0;
  fInfo.pszTitle := PChar(fTitle);
end;

procedure TToolTipControl.Deactivate;
begin
  ToolTipsAPI.Activate(Handle, False);
end;

function TToolTipControl.EnumTools(iTool: Longword;
  var AInfo: TToolInfo): Boolean;
begin
  Result := ToolTipsAPI.Enum(Handle, iTool, @AInfo);
end;

function TToolTipControl.GetAutoPopTime: Cardinal;
begin
  Result := ToolTipsAPI.GetDelayTime(Handle, TTDT_AUTOPOP);
end;

function TToolTipControl.GetBackColor: TColor;
begin
  Result := ToolTipsAPI.GetBkColor(Handle);
end;

function TToolTipControl.GetBottomMargin: Integer;
begin
  Result := GetMargin.Bottom;
end;

function TToolTipControl.GetCount: Integer;
begin
  Result := fToolTips.Count;
end;

function TToolTipControl.GetCurrentTool: TToolInfo;
begin
  // SS110312: Result.cbSize must be initialized
  Result.cbSize := SizeOf(ToolInfo);
  ToolTipsAPI.GetCurrent(Handle, @Result);
end;

function TToolTipControl.GetCurrentToolExists: Boolean;
begin
  Result := ToolTipsAPI.GetCurrent(Handle, nil) <> 0;
end;

function TToolTipControl.GetIcon: TToolTipIcon;
begin
  // SS110312: fInfo should not be overriden to avoid memory leaks
//  ToolTipsAPI.GetTitle(Handle, @fInfo);
  Result := GetToolTipIcon(fInfo.uTitleBitmap);
end;

function TToolTipControl.GetInitialTime: Cardinal;
begin
  Result := ToolTipsAPI.GetDelayTime(Handle, TTDT_INITIAL);
end;

function TToolTipControl.GetItem(const Index: Integer): TToolTip;
begin
  Result := TToolTipList(fToolTips).Items[Index];
end;

function TToolTipControl.GetLeftMargin: Integer;
begin
  Result := GetMargin.Left;
end;

function TToolTipControl.GetMargin: TRect;
begin
  ToolTipsAPI.GetMargin(Handle, @Result);
end;

function TToolTipControl.GetMaxTipWidth: Integer;
begin
  Result := ToolTipsAPI.GetMaxWidth(Handle);
end;

function TToolTipControl.GetReshowTime: Cardinal;
begin
  Result := ToolTipsAPI.GetDelayTime(Handle, TTDT_RESHOW);
end;

function TToolTipControl.GetRightMargin: Integer;
begin
  Result := GetMargin.Right;
end;

function TToolTipControl.GetTextColor: TColor;
begin
  Result := ToolTipsAPI.GetTextColor(Handle);
end;

function TToolTipControl.GetTool(iTool: Cardinal): TToolInfo;
begin
  ToolTipsAPI.Enum(Handle, iTool, @Result);
end;

function TToolTipControl.GetToolCount: Integer;
begin
  Result := ToolTipsAPI.GetCount(Handle);
end;

function TToolTipControl.GetTopMargin: Integer;
begin
  Result := GetMargin.Top;
end;

function TToolTipControl.HitTest(APoint: TPoint;
  var AInfo: TToolInfo): Boolean;
var
  AHitTestInfo: TTHitTestInfo;
begin
  AHitTestInfo.hwnd := Parent.Handle;
  AHitTestInfo.pt := APoint;
  AHitTestInfo.ti := AInfo;
  Result := ToolTipsAPI.HitTest(Handle, @AHitTestInfo);
  if Result then
    AInfo := AHitTestInfo.ti;
end;

procedure TToolTipControl.Pop;
begin
  ToolTipsAPI.Pop(Handle);
end;

procedure TToolTipControl.Popup;
begin
  ToolTipsAPI.Popup(Handle);
end;

procedure TToolTipControl.RelayEvent(var Msg: TMsg);
begin
  ToolTipsAPI.RelayEvent(Handle, @Msg);
end;

function TToolTipControl.Remove(AToolTip: TToolTip): Integer;
begin
  AToolTip.DelTool;
  AToolTip.SetOwner(nil);

  Result := fToolTips.Remove(AToolTip);

  // SS110312: Destroy AToolTip
  AToolTip.Free;
end;

procedure TToolTipControl.SetAutomaticDelayTime;
begin
  ToolTipsAPI.SetDelayTime(Handle, TTDT_AUTOMATIC, MakeLong(Word(-1), 0));
end;

procedure TToolTipControl.SetAutoPopTime(const Value: Cardinal);
begin
  ToolTipsAPI.SetDelayTime(Handle, TTDT_AUTOPOP, Value);
end;

procedure TToolTipControl.SetBackColor(const Value: TColor);
begin
  ToolTipsAPI.SetBkColor(Handle, Value);
end;

procedure TToolTipControl.SetBottomMargin(const Value: Integer);
var
  AMargin: TRect;
begin
  AMargin := GetMargin;
  AMargin.Bottom := Value;
  Margin := AMargin;
end;

procedure TToolTipControl.SetIcon(const Value: TToolTipIcon);
begin
  // SS110312: fInfo should not be overriden to avoid memory leaks
//  ToolTipsAPI.GetTitle(Handle, @fInfo);
  fInfo.uTitleBitmap := ToolTipIconValue[Value];
  ToolTipsAPI.SetTitle(Handle, fInfo.uTitleBitmap, fInfo.pszTitle);
end;

procedure TToolTipControl.SetInitialTime(const Value: Cardinal);
begin
  ToolTipsAPI.SetDelayTime(Handle, TTDT_INITIAL, Value);
end;

procedure TToolTipControl.SetLeftMargin(const Value: Integer);
var
  AMargin: TRect;
begin
  AMargin := GetMargin;
  AMargin.Left := Value;
  Margin := AMargin;
end;

procedure TToolTipControl.SetMargin(const Value: TRect);
begin
  ToolTipsAPI.SetMargin(Handle, @Value);
end;

procedure TToolTipControl.SetMaxTipWidth(const Value: Integer);
begin
  ToolTipsAPI.SetMaxWidth(Handle, Value);
end;

procedure TToolTipControl.SetReshowTime(const Value: Cardinal);
begin
  ToolTipsAPI.SetDelayTime(Handle, TTDT_RESHOW, Value);
end;

procedure TToolTipControl.SetRightMargin(const Value: Integer);
var
  AMargin: TRect;
begin
  AMargin := GetMargin;
  AMargin.Right := Value;
  Margin := AMargin;
end;

procedure TToolTipControl.SetTextColor(const Value: TColor);
begin
  ToolTipsAPI.SetTextColor(Handle, Value);
end;

procedure TToolTipControl.SetTitle(const Value: string);
begin
  // SS110312: Use local fTitle instead of memory management routines
  if Value = fTitle then
    Exit;

  // SS110312: Remove title limit
  if Length(Value) = 0 then
    fTitle := #0
  else
    fTitle := Value;
  fInfo.cch := Length(Value);
  fInfo.pszTitle := PChar(fTitle);
  ToolTipsAPI.SetTitle(Handle, fInfo.uTitleBitmap, fInfo.pszTitle);
end;

procedure TToolTipControl.SetTopMargin(const Value: Integer);
var
  AMargin: TRect;
begin
  AMargin := GetMargin;
  AMargin.Top := Value;
  Margin := AMargin;
end;

// SS110312: Unicode support improved
procedure TToolTipControl.SetWindowTheme(const ATheme: string);
{$IFDEF UNICODE}
begin
  ToolTipsAPI.SetWindowTheme(Handle, Pointer(ATheme));
{$ELSE}
var
  S: WideString;
begin
  S := ATheme;
  ToolTipsAPI.SetWindowTheme(Handle, PWideChar(S));
{$ENDIF}
end;

procedure TToolTipControl.TrackPosition(X, Y: Word);
begin
  ToolTipsAPI.TrackPosition(Handle, X, Y);
end;

procedure TToolTipControl.TTNGetDispInfo(var Message: TTTNGetDispInfo);
var
  AId: TToolTipId;
  Instance: THandle;
  ResName: string;
  Text: string;
  Data: Longint;
begin
  inherited;

  with Message do
  begin
    AId := lpnmtdi.hdr.idFrom;
    Instance := lpnmtdi.hinst;
    SetLength(ResName, 0);
    SetLength(Text, 0);
    Data := lpnmtdi.lParam;
    if TToolTipList(fToolTips).DispatchGetDispInfo(AId, Instance, ResName, Text,
      Data) then
      lpnmtdi.uFlags := lpnmtdi.uFlags or TTF_DI_SETITEM;
    lpnmtdi.hinst := Instance;
    if Length(Text) > 0 then
    begin
      // SS110312: Use local fTitle instead of memory management routines
      fInfo.cch := Length(Text);
      fTitle := Text;
      lpnmtdi.lpszText := PChar(fTitle);
    end
    else
      // SS110312: If in-place tooltip canceled, XP does not send further TTN_GETDISPINFO,
      //           see http://www.codeproject.com/KB/wtl/WTLTitleTipHandler.aspx?display=Print
      //           for details (German)
      PostMessage(Handle, TTM_POP, 0, 0);
  end;
end;

procedure TToolTipControl.TTNLinkClick(var Message: TTTNLinkClick);
var
  AId: TToolTipId;
begin
  inherited;

  AId := TWMNotify(Message).IDCtrl;
  TToolTipList(fToolTips).DispatchLinkClick(AId);
end;

procedure TToolTipControl.TTNPop(var Message: TTTNPop);
var
  AId: TToolTipId;
begin
  inherited;

  AId := Message.idTT;
  TToolTipList(fToolTips).DispatchPop(AId);
end;

procedure TToolTipControl.TTNShow(var Message: TTTNShow);
var
  AId: TToolTipId;
begin
  inherited;

  AId := Message.idTT;
  TToolTipList(fToolTips).DispatchShow(AId);
  // SS110312: Do not use default tooltip position
  Message.Result := 1;
end;

procedure TToolTipControl.Update;
begin
  ToolTipsAPI.Update(Handle);
end;

function TToolTipControl.WindowFromPoint(APoint: TPoint): THandle;
begin
  Result := ToolTipsAPI.WindowFromPoint(Handle, @APoint);
end;

{ TStandardToolTipControl }

constructor TStandardToolTipControl.Create(AParent: TWinControl);
const
  dwICC = ICC_WIN95_CLASSES;
begin
  if not CommonControls_InitEx(dwICC) then
    raise EToolTip.Create(S_ENotSupported);

  // SS110312: Deal with value of fStyles if CreateStyled has been executed
  fStyles := fStyles + [ttsAlwaysTip, ttsNoPrefix];
  fFlagsToInclude := [ttfSubClass];
  fFlagsToExclude := [ttfTrack];

  inherited;
end;

{ TTrackingToolTipControl }

constructor TTrackingToolTipControl.Create(AParent: TWinControl);
const
  dwICC = ICC_BAR_CLASSES;
begin
  if not CommonControls_InitEx(dwICC) then
    raise EToolTip.Create(S_ENotSupported);

  fStyles := [ttsAlwaysTip, ttsNoPrefix];
  fFlagsToInclude := [ttfTrack];
  fFlagsToExclude := [ttfSubClass];

  inherited;
end;

{ TMultilineToolTipControl }

const
  TTWM_DEFAULT = 250;

constructor TMultilineToolTipControl.Create(AParent: TWinControl);
begin
  inherited;

  SetMaxTipWidth(TTWM_DEFAULT);
end;

{ TBalloonToolTipControl }

constructor TBalloonToolTipControl.Create(AParent: TWinControl);
const
  dwICC = ICC_WIN95_CLASSES;
begin
  if not CommonControls_InitEx(dwICC) then
    raise EToolTip.Create(S_ENotSupported);

  fStyles := [ttsAlwaysTip, ttsBalloon, ttsNoPrefix];
  fFlagsToInclude := [ttfSubClass, ttfTransparent];
  fFlagsToExclude := [ttfTrack];

  inherited;
end;

{ TToolTip }

procedure MakeWords(const lValue: Longword; var wLow, wHigh: Word);
asm
  push EAX
  mov EAX, lValue
  mov [wLow], AX
  shr EAX, 16
  mov [wHigh], AX
  pop EAX
end;

const
  ToolTipFlagValue: array [TToolTipFlag] of Longword = (TTF_ABSOLUTE,
    TTF_CENTERTIP, TTF_IDISHWND, TTF_PARSELINKS, TTF_RTLREADING, TTF_SUBCLASS,
    TTF_TRACK, TTF_TRANSPARENT);

function ToolTipFlagsValue(const Flags: TToolTipFlags): Longword;
var
  Flag: TToolTipFlag;
begin
  Result := 0;
  for Flag := Low(TToolTipFlag) to High(TToolTipFlag) do
    if Flag in Flags then
      Result := Result or ToolTipFlagValue[Flag];
end;

function GetToolTipFlags(const Value: Longword): TToolTipFlags;
var
  Flag: TToolTipFlag;
begin
  Result := [];
  for Flag := Low(TToolTipFlag) to High(TToolTipFlag) do
    if Value and ToolTipFlagValue[Flag] <> 0 then
      Include(Result, Flag);
end;

function TToolTip.AddTool: Boolean;
begin
  CheckOwner('AddTool');
  Result := ToolTipsAPI.Add(Owner.Handle, @fInfo);
end;

procedure TToolTip.AfterConstruction;
begin
  inherited;

  AllToolTips.Add(Self);
end;

procedure TToolTip.BeforeDestruction;
begin
  AllToolTips.Remove(Self);
  // SS110312: Force fInfo.lpszText to point nil
  fInfo.lpszText := nil;

  inherited;
end;

procedure TToolTip.CheckOwner(const MethodName: string);
begin
  if Owner = nil then
    raise EToolTip.CreateFmt(S_ECheckOwner, [ClassName, MethodName]);
end;

constructor TToolTip.Create(AControl: TControl; const GetDispInfo: Boolean;
  AId: TToolTipId);
begin
  inherited Create;

  fOwner := nil;
  fControl := nil;
  fParent := nil;

  (* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE *)
  ZeroMemory(@fInfo, SizeOf(TToolInfo));
  fInfo.cbSize := SizeOf(TToolInfo);
  // SS110312: fInfo.hwnd is the handle of the window that provide the text,
  //           fInfo.uId becomes the handle of the parent
  if AId = TTID_AUTO then
    fInfo.uId := AllToolTips.GetNextId
  else
    fInfo.uId := AId;
  fInfo.hInst := HInstance;
  if GetDispInfo then
  begin
    fInfo.lpszText := LPSTR_TEXTCALLBACK;
    fInfo.uFlags := fInfo.uFlags or TTF_IDISHWND or TTF_TRANSPARENT;
    fInfo.hwnd := AId;
  end;
  fInfo.lParam := Integer(Self);
  SetControl(AControl);
  // SS110312: Initialize fText
  fText := #0;
end;

procedure TToolTip.DelTool;
begin
  CheckOwner('DelTool');
  ToolTipsAPI.Del(Owner.Handle, @fInfo);
end;

function TToolTip.DoGetDispInfo(var Instance: THandle; var ResName,
  Text: string; Data: Integer): Boolean;
begin
  if Assigned(fOnGetDispInfo) then
    Result := fOnGetDispInfo(Self, Instance, ResName, Text, Data)
  else
    Result := False;
end;

procedure TToolTip.DoLinkClick;
begin
  if Assigned(fOnLinkClick) then
    fOnLinkClick(Self);
end;

procedure TToolTip.DoPop;
begin
  if Assigned(fOnPop) then
    fOnPop(Self);
end;

procedure TToolTip.DoShow;
begin
  if Assigned(fOnShow) then
    fOnShow(Self);
end;

function TToolTip.GetBubbleSize: TSize;
var
  ABubbleSize: Longint;
  wLow, wHigh: Word;
begin
  CheckOwner('GetBubbleSize');
  if fTrackActivated then
    ABubbleSize := ToolTipsAPI.GetBubbleSize(Owner.Handle, @fInfo)
  else
    ABubbleSize := 0;
  wLow := 0;
  wHigh := 0;
  if ABubbleSize <> 0 then
    MakeWords(ABubbleSize, wLow, wHigh);
  Result.cx := wLow;
  Result.cy := wHigh;
end;

function TToolTip.GetClipRect: TRect;
begin
  if Owner <> nil then
    ToolTipsAPI.GetInfo(Owner.Handle, @fInfo);
  Result := fInfo.Rect;
end;

function TToolTip.GetFlags: TToolTipFlags;
begin
  // SS110312: fInfo should not be overriden to avoid memory leaks
//  if Owner <> nil then
//    ToolTipsAPI.GetInfo(Owner.Handle, @fInfo);
  Result := GetToolTipFlags(fInfo.uFlags);
end;

function TToolTip.GetId: TToolTipId;
begin
  Result := fInfo.uId;
end;

function TToolTip.GetToolInfo: TToolInfo;
begin
  CheckOwner('GetToolInfo');
  ToolTipsAPI.GetInfo(Owner.Handle, @Result);
end;

class function TToolTip.GetWinControl(AControl: TControl): TWinControl;
begin
  if AControl is TWinControl then
    Result := TWinControl(AControl)
  else if AControl.Parent <> nil then
    Result := AControl.Parent
  else if AControl.Owner is TControl then
    Result := GetWinControl(TControl(AControl.Owner))
  else
    raise EToolTip.CreateFmt(S_ENoWindow, [AControl.Name, AControl.ClassName]);
end;

procedure TToolTip.NewToolRect(const ARect: TRect);
begin
  fInfo.Rect := ARect;
  if Owner <> nil then
    ToolTipsAPI.NewRect(Owner.Handle, @fInfo);
end;

procedure TToolTip.SetClipRect(const Value: TRect);
begin
  fInfo.Rect := Value;
  if Owner <> nil then
    ToolTipsAPI.SetInfo(Owner.Handle, @fInfo);
end;

procedure TToolTip.SetClipRect(AControl: TControl; const Value: TRect);
var
  ARect: TRect;
begin
  if (AControl = nil) or (AControl is TWinControl) or
    (AControl.Parent = nil) then
    ARect := Value
  else
  begin
    ARect.TopLeft := AControl.ClientToParent(Point(0, 0), AControl.Parent);
    ARect.Right := ARect.Left + AControl.ClientRect.Left +
      AControl.ClientWidth;
    ARect.Bottom := ARect.Top + AControl.ClientRect.Top +
      AControl.ClientHeight;
  end;
  SetClipRect(ARect);
end;

procedure TToolTip.SetControl(const Value: TControl);
var
  ARect: TRect;
begin
  if Value = fControl then
    Exit;

  fControl := Value;
  if fControl = nil then
  begin
    fParent := nil;
    fInfo.hwnd := INVALID_HANDLE_VALUE;
    ZeroMemory(@ARect, SizeOf(TRect));
  end
  else
  begin
    fParent := GetWinControl(fControl);
    // SS110312: Store parental handle depending on TTF_IDISHWND presence
    if fInfo.uFlags and TTF_IDISHWND = TTF_IDISHWND then
      fInfo.uId := fParent.Handle
    else
      fInfo.hwnd := fParent.Handle;
    if fControl is TWinControl then
      ARect := fControl.ClientRect
    else
    begin
      ARect.TopLeft := fControl.ClientToParent(Point(0, 0), fParent);
      ARect.Right := ARect.Left + fControl.ClientRect.Left +
        fControl.ClientWidth;
      ARect.Bottom := ARect.Top + fControl.ClientRect.Top +
        fControl.ClientHeight;
    end;
    if fInfo.lpszText <> LPSTR_TEXTCALLBACK then
      SetText(fControl.Hint);
  end;
  SetClipRect(ARect);
end;

procedure TToolTip.SetFlags(const Value: TToolTipFlags);
begin
  fInfo.uFlags := ToolTipFlagsValue(Value);
  if Owner <> nil then
    ToolTipsAPI.SetInfo(Owner.Handle, @fInfo);
end;

procedure TToolTip.SetInfo(const Value: TToolInfo);
begin
  fInfo := Value;
  if Owner <> nil then
    ToolTipsAPI.SetInfo(Owner.Handle, @fInfo);
end;

procedure TToolTip.SetOwner(const Value: TToolTipControl);
begin
  fOwner := Value;
  if Owner <> nil then
    Owner.Update;
  fTrackActivated := False;
end;

procedure TToolTip.SetText(const Value: string);
begin
  // SS110312: Use local fText instead of memory management routines
  if Value = fText then
    Exit;

  fText := Value;
  if Length(Value) > 0 then
  begin
    if fInfo.lpszText = LPSTR_TEXTCALLBACK then
      raise EToolTip.Create(S_ESetText);

    fInfo.lpszText := PChar(fText);
  end
  else if fInfo.lpszText <> LPSTR_TEXTCALLBACK then
    fInfo.lpszText := nil
  else
  begin
    fText := #0;
    fInfo.lpszText := PChar(fText);
  end;

  if Owner <> nil then
    ToolTipsAPI.UpdateText(Owner.Handle, @fInfo);
end;

procedure TToolTip.TrackActivate;
begin
  CheckOwner('TrackActivate');
  ToolTipsAPI.TrackActivate(Owner.Handle, True, @fInfo);
  fTrackActivated := True;
end;

procedure TToolTip.TrackDisactivate;
begin
  CheckOwner('TrackDisactivate');
  ToolTipsAPI.TrackActivate(Owner.Handle, False, @fInfo);
end;

procedure TToolTip.TrackPosition(X, Y: Word);
begin
  CheckOwner('TrackPosition');
  Owner.TrackPosition(X, Y);
end;

{ TInPlaceToolTipControl }

procedure TInPlaceToolTipControl.AfterAdjustRect(var ARect: TRect);
const
  hWndInsertAfter = HWND_TOP; {placement-order handle}
  uFlags = SWP_NOSIZE or SWP_NOZORDER or SWP_NOACTIVATE; {positioning flags}
var
  x: Integer; {horizontal position of window}
  y: Integer; {vertical position of window}
  nWidth: Integer; {window width}
  nHeight: Integer; {window height}
begin
  inherited;

  x := ARect.Left;
  y := ARect.Top;
  nWidth := 0;
  nHeight := 0;
  Window_SetPos(Handle, hWndInsertAfter, x, y, nWidth, nHeight, uFlags);
end;

initialization
  AllToolTips := TToolTipList.Create;

finalization
  AllToolTips.Free;

end.

Added src/delphisci/Accessor.pas.





























































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
 Unit    : Accessor
 Purpose : Delphi implementation of Accessor class.
 Created : 05/03/2001
 Author  : Simon Steele (ss@pnotepad.org)
      $Id: Accessor.pas,v 1.4 2004/11/13 04:29:49 hdalis Exp $
 History : 03/12/2001 Fixed indentation (uses tabs).
           29/09/2004 Initial Release with Delphi Scintilla Interface Components
                      Not really in use yet.
                      hdalis (hdalis@users.sourceforge.net)
           25/02/2005 Changed this to fit the TScintillaBase instead of dealing with handles
                      and such.. Swapped the contents of LevelAt and LineStart functions as it was
                      swapped before..
                      It's a bit more useful for the components now I think..
                      hdalis (hdalis@users.sourceforge.net)
}
{$Include SciCommonDef.Inc}
unit Accessor;
interface
uses scisupport,scilexer, classes, windows;
const
  extremePosition = $7FFFFFFF;
  bufferSize = 4000;
  slopSize = (bufferSize div 8);
  wsSpace = 1;
  wsTab = 2;
  wsSpaceTab = 4;
  wsInconsistent = 8;
{
void WindowAccessor::StartSegment(unsigned int pos) {
void WindowAccessor::ColourTo(unsigned int pos, int chAttr) {
}

type
    PAccessor = ^TAccessor;
    TfnIsCommentLeader = function(styler : PAccessor; pos, len : Integer) : Boolean;
    TAccessor = class(TObject)
    private
        function Get(Position: Integer): Char;
        function InternalIsLeadByte(ch : Char) : Boolean;
    protected
        id : TScintillaBase;
        buf : array[0..bufferSize] of Char;
        styleBuf : array[0..bufferSize] of Char;
        startPos : Integer;
        endPos : Integer;
        codePage : Integer;
        lenDoc : Integer;
        validLen : Integer;
        chFlags : Char;
        chWhile : Char;
        startSeg : Cardinal;
        procedure Fill(Position : Integer);
  public
        function StyleAt(Position : Integer) : Char;
        function GetLine(Position : Integer) : Integer;
        function LineStart(line : Integer) : Integer;
        function LevelAt(line : Integer) : Integer;
        property Chars[Position: Integer]: Char read Get; default;
        // Safe version of [] returns default value for invalid position.
        function SafeGetCharAt(Position : Integer; chDefault : Char = ' ') : Char;
        procedure SetCodePage(codePage_ : Integer);
        function Len : Integer;
        function GetLineState(Line : Integer) : Integer;
        procedure SetLineState(Line, State : Integer);
        procedure StartAt(start : Cardinal; chMask : Char = #31);
        procedure StartSegment(Pos : Cardinal);
        procedure ColourTo(Pos : Cardinal; chAttr : Integer);
        procedure Flush;
        procedure SetLevel(Line, Level : Integer);
        function IndentAmount(Line : Integer; var Flags : Integer; pfnIsCommentLeader : TfnIsCommentLeader) : Integer;
        function IsLeadByte(ch : Char) : Boolean;
        procedure SetFlags(chFlags_, chWhile_ : Char);
        function GetStartSegment : Integer;
        constructor Create(windowID : TScintillaBase);
        destructor Destroy; override;
  end;

function isspacechar(ch : Char) : Boolean;
function tolower(ch : Char) : Char;
function isspace(ch : Char) : Boolean;
function isdigit(ch : Char) : Boolean;
function isoperator(ch : Char) : Boolean;
function isascii(ch : Char) : Boolean;
function isalnum(ch : Char) : Boolean;
function iswordchar(ch : Char) : Boolean;
function iswordstart(ch : Char) : Boolean;

implementation

function isascii(ch : Char) : Boolean;
begin
  Result := Ord(ch) < $80;
end;

function isalnum(ch : Char) : Boolean;
var i : Integer;
begin
  i := Ord(ch);
  Result := (
         ((i >= 48) and (i <= 57)) or
         ((i >= 65) and (i <= 90)) or
         ((i >= 97) and (i <= 122))
         );
end;

function isoperator(ch : Char) : Boolean;
begin
  if (isascii(ch) and isalnum(ch)) then
  begin
      Result := false;
      Exit;
  end;
  // '.' left out as it is used to make up numbers
  Result := ((ch = '%') or (ch = '^') or (ch = '&') or (ch = '*') or
          (ch = '(') or (ch = ')') or (ch = '-') or (ch = '+') or
          (ch = '=') or (ch = '|') or (ch = '{') or (ch = '}') or
          (ch = '[') or (ch = ']') or (ch = ':') or (ch = ';') or
          (ch = '<') or (ch = '>') or (ch = ',') or (ch = '/') or
          (ch = '?') or (ch = '!') or (ch = '.') or (ch = '~'));
end;

function isspacechar(ch : Char) : Boolean;
begin
  Result := ((ch = #09) or (ch = #13) or (ch = #32));
end;

function isspace(ch : Char) : Boolean;
begin
  Result := ((ch = #09) or (ch = #10) or (ch = #13) or (ch = #32));
end;

function tolower(ch : Char) : Char;
var i : Integer;
begin
  i := Ord(ch);
  if (i >= 65) and (i <= 90) then
    Result := Chr(i + 32)
  else
    Result := ch;
end;

function isdigit(ch : Char) : Boolean;
var i : Integer;
begin
  i := Ord(ch);
  Result := ( (i >= 48) and (i <= 57));
end;

function iswordchar(ch : Char) : Boolean;
begin
  Result := isascii(ch) and (isalnum(ch) or (ch = '.') or (ch = '_'));
end;

function iswordstart(ch : Char) : Boolean;
begin
  Result := isascii(ch) and (isalnum(ch) or (ch = '_'));
end;

{ TAccessor }

procedure TAccessor.ColourTo(Pos: Cardinal; chAttr: Integer);
var i : Cardinal;
begin
    if Pos <> (StartSeg - 1) then
    begin
    if Pos < startSeg then
      OutputDebugString('Bad Colour Positions'); // %d - %d : startSeg, pos

    if Cardinal(validLen) + (Pos - startSeg + 1) >= bufferSize then
      Flush;

    if Cardinal(validLen) + (Pos - startSeg + 1) >= bufferSize then
    begin
      // Too big for buffer size so send directly
      id.SetStyling(Pos - startSeg + 1, chAttr);
    end else
    begin
      if (Char(chAttr) <> chWhile) then
        chFlags := #0;
      chAttr := chAttr or Ord(chFlags);
      for i := startSeg to Pos do
      begin
        styleBuf[validLen] := Char(chAttr);
        Inc(validLen);
      end;
    end;
  end;
  startSeg := Pos + 1;
end;

constructor TAccessor.Create(windowID: TScintillaBase);
begin
  inherited Create;
  id := windowID;
  lenDoc := -1;
  startPos := extremePosition;
  endPos := 0;
  codePage := 0;
  validLen := 0;
  chFlags := #0;
  chWhile := #0;
//TODO Properties...
end;

destructor TAccessor.Destroy;
begin
  inherited;
end;

procedure TAccessor.Fill(Position: Integer);
var
  tr : TTextRange;
begin
  if lenDoc = -1 then
    lenDoc := id.GetTextLength;
  startPos := Position - slopSize;
  if (startPos + bufferSize > lenDoc) then
    startPos := lenDoc - bufferSize;
  if (startPos < 0) then
    startPos := 0;
  endPos := startPos + bufferSize;
  if (endPos > lenDoc) then
    endPos := lenDoc;

  tr.chrg.cpMin := startPos;
  tr.chrg.cpMax := endPos;
  tr.lpstrText := buf;

  id.GetTextRange(@tr);
end;

procedure TAccessor.Flush;
begin
    startPos := extremePosition;
    lenDoc := -1;
    if (validLen > 0) then
    begin
    id.SetStylingEx(validLen, PChar(@styleBuf));
    validLen := 0;
  end;
end;

function TAccessor.Get(Position: Integer): Char;
begin
  if (Position < startPos) or (Position >= endPos) then
    Fill(Position);
  Result := buf[Position - startPos];
end;

function TAccessor.GetLine(Position: Integer): Integer;
begin
  Result := id.LineFromPosition(Position);
end;

function TAccessor.GetLineState(Line: Integer): Integer;
begin
  Result := id.GetLineState(Line);
end;

function TAccessor.Len: Integer;
begin
  Result := id.GetTextLength;
end;

function TAccessor.LevelAt(line: Integer): Integer;
begin
  Result := id.GetFoldLevel(line);
end;

function TAccessor.LineStart(line: Integer): Integer;
begin
   Result := id.PositionFromLine(line);
end;

function TAccessor.SafeGetCharAt(Position: Integer; chDefault: Char): Char;
begin
  if (Position < startPos) or (Position >= endPos) then
  begin
    Fill(Position);
    if (Position < startPos) or (Position >= endPos) then
    begin
      Result := chDefault;
      Exit;
      end;
    end;
  Result := buf[Position - startPos];
end;

procedure TAccessor.SetCodePage(codePage_: Integer);
begin
  codePage := codePage_;
end;

procedure TAccessor.SetLevel(Line, Level: Integer);
begin
  id.SetFoldLevel(Line, Level);
end;

procedure TAccessor.SetLineState(Line, State: Integer);
begin
  id.SetLineState(Line, State);
end;

procedure TAccessor.StartAt(start: Cardinal; chMask: Char);
begin
  id.StartStyling(start, Ord(chMask));
end;

procedure TAccessor.StartSegment(Pos: Cardinal);
begin
  startSeg := Pos;
end;

function TAccessor.StyleAt(Position: Integer): Char;
begin
  Result := Char( id.GetStyleAt(Position) );
end;

function TAccessor.IndentAmount(Line : Integer; var Flags : Integer; pfnIsCommentLeader : TfnIsCommentLeader) : Integer;
var
  iend : Integer;
  spaceFlags : Integer;
  Pos : Integer;
  ch : Char;
  chPrev : Char;
  indent : Integer;
  inPrevPrefix : Boolean;
  posPrev : Integer;
begin
    iend := Len;
    spaceFlags := 0;

  // Determines the indentation level of the current line and also checks for consistent
  // indentation compared to the previous line.
  // Indentation is judged consistent when the indentation whitespace of each line lines
  // the same or the indentation of one line is a prefix of the other.

  pos := LineStart(line);
  ch := Chars[Pos];
  indent := 0;
  inPrevPrefix := line > 0;
  if inPrevPrefix then
      posPrev := LineStart(line-1)
    else
      posPrev := 0;

  while ( ((ch = ' ') or (ch = #09)) and (pos < iend) ) do
  begin
    if (inPrevPrefix) then
    begin
      chPrev := Chars[posPrev];
      Inc(posPrev);
      if ((chPrev = ' ') or (chPrev = #09)) then
      begin
        if (chPrev <> ch) then
          spaceFlags := spaceFlags or wsInconsistent;
      end else
      begin
        inPrevPrefix := false;
      end;
    end;
    if (ch = ' ') then
    begin
      spaceFlags := spaceFlags or wsSpace;
      Inc(indent);
    end else
    begin  // Tab
      spaceFlags := spaceFlags or wsTab;
      if ((spaceFlags and wsSpace) = wsSpace) then
        spaceFlags := spaceFlags or wsSpaceTab;
      indent := (indent div 8 + 1) * 8;
    end;
    Inc(Pos);
    ch := Chars[Pos];
  end;

  Flags := spaceFlags;
  indent := indent + SC_FOLDLEVELBASE;
  // if completely empty line or the start of a comment...
  if ( isspace(ch) or ((@pfnIsCommentLeader <> nil) and pfnIsCommentLeader(@self, pos, iend-pos) ) ) then
  begin
    result :=  indent or SC_FOLDLEVELWHITEFLAG;
  end else
    result := indent;
end;

function TAccessor.IsLeadByte(ch: Char): Boolean;
begin
  Result := (codePage > 0) and InternalIsLeadByte(ch);
end;

function TAccessor.InternalIsLeadByte(ch: Char): Boolean;
begin
  if (SC_CP_UTF8 = codePage) then
    // For lexing, all characters >= 0x80 are treated the
    // same so none is considered a lead byte.
    Result :=  false
  else
    Result := IsDBCSLeadByteEx(codePage, Byte(ch));
end;

function TAccessor.GetStartSegment: Integer;
begin
  Result := startSeg;
end;

procedure TAccessor.SetFlags(chFlags_, chWhile_: Char);
begin
  chFlags := chFlags_;
  chWhile := chWhile_;
end;

end.

Added src/delphisci/EdOptionsWin.ddp.

cannot compute difference between binary files

Added src/delphisci/EdOptionsWin.dfm.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
object EdOptionsWindow: TEdOptionsWindow
  Left = 830
  Top = 236
  BorderIcons = [biSystemMenu]
  BorderStyle = bsDialog
  Caption = 'Editor Options'
  ClientHeight = 410
  ClientWidth = 380
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clBtnText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  ShowHint = True
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  PixelsPerInch = 96
  TextHeight = 13
  object OptionPages: TPageControl
    Left = 0
    Top = 0
    Width = 380
    Height = 372
    ActivePage = OptionsPage
    Align = alTop
    TabOrder = 0
    OnChange = OptionPagesChange
    object OptionsPage: TTabSheet
      Caption = 'Options'
      object optionsPanel: TPanel
        Left = 0
        Top = 0
        Width = 372
        Height = 344
        Align = alClient
        BevelOuter = bvNone
        TabOrder = 0
        object viewOptionsBox: TGroupBox
          Left = 0
          Top = 0
          Width = 183
          Height = 188
          Caption = 'View Options'
          TabOrder = 0
          object CodeFoldingCB: TCheckBox
            Left = 38
            Top = 75
            Width = 112
            Height = 17
            Caption = 'Code Folding'
            TabOrder = 2
          end
          object GutterCB: TCheckBox
            Left = 38
            Top = 34
            Width = 112
            Height = 17
            Caption = 'Gutter'
            TabOrder = 0
          end
          object LineNumbersCB: TCheckBox
            Left = 38
            Top = 54
            Width = 112
            Height = 17
            Caption = 'Line Numbers'
            TabOrder = 1
          end
          object IndentationGuidesCB: TCheckBox
            Left = 38
            Top = 96
            Width = 112
            Height = 17
            Caption = 'Indentation Guides'
            TabOrder = 3
          end
          object BraceHiliteCB: TCheckBox
            Left = 38
            Top = 117
            Width = 112
            Height = 17
            Caption = 'Brace Highlight'
            TabOrder = 4
          end
          object WordWrapCB: TComboBox
            Left = 38
            Top = 140
            Width = 120
            Height = 21
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 13
            ItemIndex = 0
            ParentFont = False
            TabOrder = 5
            Text = 'No Word wrap'
            Items.Strings = (
              'No Word wrap'
              'Word Wrap'
              'Wrap Characters')
          end
        end
        object gbRightEdge: TGroupBox
          Left = 187
          Top = 190
          Width = 183
          Height = 153
          Caption = 'Right Edge'
          TabOrder = 3
          object Label28: TLabel
            Left = 6
            Top = 71
            Width = 55
            Height = 13
            Caption = 'Edge Color:'
            Transparent = True
          end
          object Label29: TLabel
            Left = 15
            Top = 41
            Width = 46
            Height = 13
            Caption = 'Edge Col:'
            Transparent = True
          end
          object Label30: TLabel
            Left = 6
            Top = 99
            Width = 55
            Height = 13
            Caption = 'Edge Type:'
            Transparent = True
          end
          object EdgeColumnSE: TEdit
            Left = 62
            Top = 38
            Width = 51
            Height = 21
            Hint = 'Edge Column'
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ParentFont = False
            TabOrder = 0
            Text = '0'
            OnKeyPress = TestNumericOnly
          end
          object EdgeColorCB: TColorBox
            Left = 62
            Top = 66
            Width = 110
            Height = 22
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
          object EdgeTypeCB: TComboBox
            Left = 62
            Top = 94
            Width = 110
            Height = 21
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 13
            ParentFont = False
            TabOrder = 2
            Items.Strings = (
              'None'
              'Line'
              'Background')
          end
        end
        object indentationBox: TGroupBox
          Left = 188
          Top = 0
          Width = 183
          Height = 188
          Caption = 'Indentation Options'
          TabOrder = 1
          object Label1: TLabel
            Left = 27
            Top = 128
            Width = 64
            Height = 13
            Caption = 'Indent Width:'
          end
          object Label2: TLabel
            Left = 38
            Top = 100
            Width = 53
            Height = 13
            Caption = 'Tab Width:'
          end
          object KeepIndentCB: TCheckBox
            Left = 26
            Top = 34
            Width = 117
            Height = 17
            Caption = 'Keep Indent'
            TabOrder = 0
          end
          object TabIndentsCB: TCheckBox
            Left = 26
            Top = 54
            Width = 117
            Height = 17
            Caption = 'Tab Indents'
            TabOrder = 1
          end
          object BackSpaceUnIndentsCB: TCheckBox
            Left = 26
            Top = 75
            Width = 117
            Height = 17
            Caption = 'B.Space Unindents'
            TabOrder = 2
          end
          object TabWidthSE: TEdit
            Left = 95
            Top = 96
            Width = 41
            Height = 21
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ParentFont = False
            TabOrder = 3
            OnKeyPress = TestNumericOnly
          end
          object IndentWidthSE: TEdit
            Left = 95
            Top = 124
            Width = 41
            Height = 21
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ParentFont = False
            TabOrder = 4
            OnKeyPress = TestNumericOnly
          end
        end
        object OtherGB: TGroupBox
          Left = 1
          Top = 190
          Width = 183
          Height = 153
          Caption = 'Other Options'
          TabOrder = 2
          object Label3: TLabel
            Left = 18
            Top = 113
            Width = 50
            Height = 13
            Caption = 'EOL Style:'
            Transparent = True
          end
          object Label43: TLabel
            Left = 15
            Top = 85
            Width = 53
            Height = 13
            Caption = 'CodePage:'
          end
          object SaveClearsUndoCB: TCheckBox
            Left = 32
            Top = 40
            Width = 115
            Height = 17
            Hint = 'Clear the undobuffer when saving.'
            Caption = 'Save Clears Undo'
            TabOrder = 0
          end
          object ReadOnlyCB: TCheckBox
            Left = 32
            Top = 60
            Width = 115
            Height = 17
            Caption = 'Read Only'
            TabOrder = 1
          end
          object EOLStyleCB: TComboBox
            Left = 71
            Top = 110
            Width = 97
            Height = 21
            Hint = 
              'Sets the characters that are added into the document when the us' +
              'er presses the Enter key. Default CRLF'
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 13
            ParentFont = False
            TabOrder = 2
            Items.Strings = (
              'CR+LF'
              'CR'
              'LF')
          end
          object CodePageCB: TComboBox
            Left = 72
            Top = 82
            Width = 96
            Height = 21
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 13
            ParentFont = False
            TabOrder = 3
          end
        end
      end
    end
    object ColorsPage: TTabSheet
      Caption = 'Colors etc'
      ImageIndex = 4
      object colorsPanel: TPanel
        Left = 0
        Top = 0
        Width = 372
        Height = 344
        Align = alClient
        BevelOuter = bvNone
        TabOrder = 0
        object MarkersGB: TGroupBox
          Left = 0
          Top = 124
          Width = 372
          Height = 78
          Align = alTop
          Caption = 'Markers'
          TabOrder = 2
          object Label20: TLabel
            Left = 188
            Top = 22
            Width = 61
            Height = 13
            Caption = 'Marker Back'
            Transparent = True
          end
          object Label21: TLabel
            Left = 8
            Top = 22
            Width = 57
            Height = 13
            Caption = 'Marker Fore'
            Transparent = True
          end
          object Label22: TLabel
            Left = 187
            Top = 48
            Width = 62
            Height = 13
            Caption = 'B.Mark Back'
            Transparent = True
          end
          object Label23: TLabel
            Left = 7
            Top = 48
            Width = 58
            Height = 13
            Caption = 'B.Mark Fore'
            Transparent = True
          end
          object MarkerForeCB: TColorBox
            Left = 70
            Top = 18
            Width = 110
            Height = 22
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 0
          end
          object MarkerBackCB: TColorBox
            Left = 252
            Top = 18
            Width = 110
            Height = 22
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
          object BMarkForeCB: TColorBox
            Left = 70
            Top = 45
            Width = 110
            Height = 22
            Hint = 'Bookmark foreground color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 2
          end
          object BMarkBackCB: TColorBox
            Left = 252
            Top = 45
            Width = 110
            Height = 22
            Hint = 'Bookmark background color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 3
          end
        end
        object CaretGB: TGroupBox
          Left = 0
          Top = 49
          Width = 372
          Height = 75
          Align = alTop
          Caption = 'Caret'
          TabOrder = 1
          object Label13: TLabel
            Left = 12
            Top = 24
            Width = 24
            Height = 13
            Caption = 'Color'
            Transparent = True
          end
          object Label15: TLabel
            Left = 165
            Top = 24
            Width = 81
            Height = 13
            Caption = 'Line Background'
            Transparent = True
          end
          object Label14: TLabel
            Left = 8
            Top = 48
            Width = 28
            Height = 13
            Caption = 'Width'
            Transparent = True
          end
          object CaretCB: TColorBox
            Left = 40
            Top = 19
            Width = 110
            Height = 22
            Hint = 'Caret Color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 0
          end
          object CaretBackCB: TColorBox
            Left = 250
            Top = 19
            Width = 110
            Height = 22
            Hint = 'Caret line background color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
          object CaretWidthSE: TEdit
            Left = 40
            Top = 45
            Width = 40
            Height = 21
            Hint = 'Width of the caret (0-3)'
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ParentFont = False
            TabOrder = 2
            OnKeyPress = TestNumericOnly
          end
          object CaretLineVisCB: TCheckBox
            Left = 160
            Top = 49
            Width = 103
            Height = 17
            Hint = 
              'Checked when the caretline should be shown with the defined colo' +
              'r'
            Alignment = taLeftJustify
            Caption = 'Caret Line Visible'
            TabOrder = 3
          end
        end
        object SelectionGB: TGroupBox
          Left = 0
          Top = 0
          Width = 372
          Height = 49
          Align = alTop
          Caption = 'Selection'
          TabOrder = 0
          object Label16: TLabel
            Left = 6
            Top = 22
            Width = 54
            Height = 13
            Caption = 'Foreground'
            Transparent = True
          end
          object Label17: TLabel
            Left = 187
            Top = 22
            Width = 58
            Height = 13
            Caption = 'Background'
            Transparent = True
          end
          object SelForeCB: TColorBox
            Left = 63
            Top = 17
            Width = 110
            Height = 22
            Hint = 'Selection foreground color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 0
          end
          object SelBackCB: TColorBox
            Left = 250
            Top = 17
            Width = 110
            Height = 22
            Hint = 'Selection background color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
        end
        object HotspotGB: TGroupBox
          Left = 0
          Top = 276
          Width = 372
          Height = 68
          Align = alClient
          Caption = 'Active Hotspot'
          TabOrder = 4
          object Label24: TLabel
            Left = 11
            Top = 23
            Width = 54
            Height = 13
            Caption = 'Foreground'
            Transparent = True
          end
          object Label25: TLabel
            Left = 192
            Top = 23
            Width = 58
            Height = 13
            Caption = 'Background'
            Transparent = True
          end
          object HotActiveForeCB: TColorBox
            Left = 70
            Top = 19
            Width = 110
            Height = 22
            Hint = 'Hotspot foreground color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 0
          end
          object HotActiveBackCB: TColorBox
            Left = 253
            Top = 19
            Width = 110
            Height = 22
            Hint = 'Hotspot background color'
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
          object HotActiveUnderlineCB: TCheckBox
            Left = 59
            Top = 45
            Width = 70
            Height = 17
            Hint = 'Underline when the mouse hovers over the hotspot'
            Caption = 'Underline'
            TabOrder = 2
          end
          object HotActiveSingleLineCB: TCheckBox
            Left = 238
            Top = 45
            Width = 74
            Height = 17
            Hint = 'Single line mode stops a hotspot from wrapping onto next line'
            Caption = 'Single Line'
            TabOrder = 3
          end
        end
        object FoldingGB: TGroupBox
          Left = 0
          Top = 202
          Width = 372
          Height = 74
          Align = alTop
          Caption = 'Folding'
          TabOrder = 3
          object Label26: TLabel
            Left = 10
            Top = 22
            Width = 55
            Height = 13
            Caption = 'Fold Margin'
            Transparent = True
          end
          object Label27: TLabel
            Left = 185
            Top = 22
            Width = 64
            Height = 13
            Caption = 'Fold Highlight'
            Transparent = True
          end
          object Label31: TLabel
            Left = 41
            Top = 47
            Width = 24
            Height = 13
            Caption = 'Type'
            Transparent = True
          end
          object FoldLoCB: TColorBox
            Left = 70
            Top = 19
            Width = 110
            Height = 22
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 0
          end
          object FoldHiCB: TColorBox
            Left = 252
            Top = 19
            Width = 110
            Height = 22
            Selected = clDefault
            Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 16
            ParentFont = False
            TabOrder = 1
          end
          object markerTypeCB: TComboBox
            Left = 71
            Top = 45
            Width = 109
            Height = 21
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 13
            ParentFont = False
            TabOrder = 2
            Items.Strings = (
              'Circle'
              'Box'
              'Plus/Minus'
              'Arrows'
              'Custom')
          end
        end
      end
    end
    object HighlighterPage: TTabSheet
      Caption = 'LanguageManager'
      ImageIndex = 1
      object highlighterPanel: TPanel
        Left = 0
        Top = 0
        Width = 372
        Height = 344
        Align = alClient
        BevelOuter = bvNone
        TabOrder = 0
        object languageCBBox: TGroupBox
          Left = 0
          Top = 0
          Width = 372
          Height = 45
          Align = alTop
          Caption = 'Language'
          TabOrder = 0
          object LanguageCB: TComboBox
            Left = 9
            Top = 18
            Width = 145
            Height = 21
            Hint = 'The selected language/lexer.'
            Style = csDropDownList
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'MS Sans Serif'
            Font.Style = []
            ItemHeight = 0
            ParentFont = False
            Sorted = True
            TabOrder = 0
            OnChange = LanguageCBChange
          end
          object addLangButton: TBitBtn
            Left = 163
            Top = 17
            Width = 58
            Height = 22
            Hint = 'Add new language'
            Caption = 'Add'
            TabOrder = 1
            OnClick = addLangButtonClick
            Glyph.Data = {
              DE010000424DDE01000000000000760000002800000024000000120000000100
              0400000000006801000000000000000000001000000010000000000000000000
              80000080000000808000800000008000800080800000C0C0C000808080000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000666666666666666666666666666666666666000066666666FFF666666666
              666666FFF666666600006666666844F66666666666666888F666666600006666
              666844F66666666666666888F666666600006666666844F66666666666666888
              F666666600006666FFF644FFFFF6666666FFF888FFFFF6660000666844444444
              44F66666688888888888F666000066684444444444F66666688888888888F666
              000066688888446888666666688888888888666600006666666844F666666666
              66666888F666666600006666666844F66666666666666888F666666600006666
              666844F66666666666666888F666666600006666666888666666666666666888
              6666666600006666666666666666666666666666666666660000666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000}
            NumGlyphs = 2
          end
          object remLangButton: TBitBtn
            Left = 305
            Top = 17
            Width = 58
            Height = 22
            Hint = 'Remove selected language'
            Caption = 'Rem'
            TabOrder = 3
            OnClick = remLangButtonClick
            Glyph.Data = {
              DE010000424DDE01000000000000760000002800000024000000120000000100
              0400000000006801000000000000000000001000000010000000000000000000
              80000080000000808000800000008000800080800000C0C0C000808080000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000666666666666661F66666666666666668F66000066661F66666666666666
              668F6666666666660000666111F6666661F666666888F6666668F66600006661
              11F666661F6666666888F666668F666600006666111F66611F66666666888F66
              688F6666000066666111F611F6666666666888F688F66666000066666611111F
              66666666666688888F66666600006666666111F66666666666666888F6666666
              000066666611111F66666666666688888F666666000066666111F61F66666666
              666888F68F66666600006661111F66611F66666668888F66688F666600006611
              11F6666611F666668888F6666688F66600006611F6666666611F666688F66666
              66688F6600006666666666666666666666666666666666660000666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000}
            NumGlyphs = 2
          end
          object copyLangButton: TBitBtn
            Left = 234
            Top = 17
            Width = 58
            Height = 22
            Hint = 'Copy Language'
            Caption = 'Copy'
            TabOrder = 2
            OnClick = copyLangButtonClick
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              04000000000080000000CE0E0000D80E00001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00888888888888
              8888888888888888888888888844444444488888884FFFFFFF488888884F0000
              0F480000004FFFFFFF480FFFFF4F00000F480F00004FFFFFFF480FFFFF4F00F4
              44480F00004FFFF4F4880FFFFF4FFFF448880F00F044444488880FFFF0F08888
              88880FFFF0088888888800000088888888888888888888888888}
          end
        end
        object highlighterPageCtrl: TPageControl
          Left = 0
          Top = 45
          Width = 372
          Height = 299
          ActivePage = stylesTabSheet
          Align = alClient
          TabOrder = 1
          object stylesTabSheet: TTabSheet
            Caption = 'Styles'
            object Label19: TLabel
              Left = 0
              Top = 112
              Width = 364
              Height = 18
              Align = alTop
              Alignment = taCenter
              AutoSize = False
              Caption = 'Style Definition'
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = 'MS Sans Serif'
              Font.Style = [fsBold]
              ParentFont = False
              Layout = tlCenter
            end
            object topStylePanel: TPanel
              Left = 0
              Top = 0
              Width = 364
              Height = 112
              Align = alTop
              BevelOuter = bvNone
              TabOrder = 0
              object GroupBox5: TGroupBox
                Left = 4
                Top = 0
                Width = 162
                Height = 108
                Caption = 'Styles:'
                TabOrder = 0
                object StylesLB: TListBox
                  Left = 9
                  Top = 15
                  Width = 144
                  Height = 85
                  Hint = 'List of styles belonging to the selected language/lexer.'
                  BevelKind = bkSoft
                  BorderStyle = bsNone
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ImeName = 'The styles this language/lexer contains'
                  ItemHeight = 13
                  ParentFont = False
                  TabOrder = 0
                  OnClick = StylesLBClick
                end
              end
              object stylenoBox: TGroupBox
                Left = 171
                Top = 0
                Width = 190
                Height = 108
                Caption = 'Style'
                TabOrder = 1
                object Label4: TLabel
                  Left = 6
                  Top = 23
                  Width = 66
                  Height = 13
                  Caption = 'Style Number:'
                  Transparent = True
                end
                object Label9: TLabel
                  Left = 16
                  Top = 48
                  Width = 56
                  Height = 13
                  Caption = 'Description:'
                  Transparent = True
                end
                object StyleNumberSE: TEdit
                  Left = 73
                  Top = 20
                  Width = 47
                  Height = 21
                  Hint = 'Stylenumber for this style'
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ParentFont = False
                  TabOrder = 0
                  OnExit = StyleElementChanged
                  OnKeyPress = StyleNumberSEKeyPress
                end
                object DescriptionEB: TEdit
                  Left = 72
                  Top = 45
                  Width = 111
                  Height = 21
                  Hint = 'Description of this style'
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ParentFont = False
                  TabOrder = 1
                  OnChange = StyleElementChanged
                end
                object AddStyleB: TBitBtn
                  Left = 37
                  Top = 72
                  Width = 58
                  Height = 22
                  Hint = 'Add Style'
                  Caption = 'Add'
                  TabOrder = 2
                  OnClick = AddStyleBClick
                  Glyph.Data = {
                    DE010000424DDE01000000000000760000002800000024000000120000000100
                    0400000000006801000000000000000000001000000010000000000000000000
                    80000080000000808000800000008000800080800000C0C0C000808080000000
                    FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000666666666666666666666666666666666666000066666666FFF666666666
                    666666FFF666666600006666666844F66666666666666888F666666600006666
                    666844F66666666666666888F666666600006666666844F66666666666666888
                    F666666600006666FFF644FFFFF6666666FFF888FFFFF6660000666844444444
                    44F66666688888888888F666000066684444444444F66666688888888888F666
                    000066688888446888666666688888888888666600006666666844F666666666
                    66666888F666666600006666666844F66666666666666888F666666600006666
                    666844F66666666666666888F666666600006666666888666666666666666888
                    6666666600006666666666666666666666666666666666660000666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000}
                  NumGlyphs = 2
                end
                object DeleteStyleB: TBitBtn
                  Left = 99
                  Top = 72
                  Width = 58
                  Height = 22
                  Hint = 'Delete Style'
                  Caption = 'Rem'
                  TabOrder = 3
                  OnClick = DeleteStyleBClick
                  Glyph.Data = {
                    DE010000424DDE01000000000000760000002800000024000000120000000100
                    0400000000006801000000000000000000001000000010000000000000000000
                    80000080000000808000800000008000800080800000C0C0C000808080000000
                    FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000666666666666661F66666666666666668F66000066661F66666666666666
                    668F6666666666660000666111F6666661F666666888F6666668F66600006661
                    11F666661F6666666888F666668F666600006666111F66611F66666666888F66
                    688F6666000066666111F611F6666666666888F688F66666000066666611111F
                    66666666666688888F66666600006666666111F66666666666666888F6666666
                    000066666611111F66666666666688888F666666000066666111F61F66666666
                    666888F68F66666600006661111F66611F66666668888F66688F666600006611
                    11F6666611F666668888F6666688F66600006611F6666666611F666688F66666
                    66688F6600006666666666666666666666666666666666660000666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000}
                  NumGlyphs = 2
                end
              end
            end
            object StyleDefGB: TPanel
              Left = 0
              Top = 130
              Width = 364
              Height = 141
              Align = alClient
              BevelOuter = bvNone
              TabOrder = 1
              object Label5: TLabel
                Left = 13
                Top = 8
                Width = 24
                Height = 13
                Caption = 'Font:'
                Transparent = True
              end
              object Label6: TLabel
                Left = 13
                Top = 36
                Width = 112
                Height = 13
                Caption = 'Font Size (0 for default):'
                Transparent = True
              end
              object Label7: TLabel
                Left = 16
                Top = 115
                Width = 57
                Height = 13
                Caption = 'Foreground:'
                Transparent = True
              end
              object Label8: TLabel
                Left = 190
                Top = 115
                Width = 61
                Height = 13
                Caption = 'Background:'
                Transparent = True
              end
              object Label10: TLabel
                Left = 18
                Top = 86
                Width = 55
                Height = 13
                Caption = 'Char. Case:'
                Transparent = True
              end
              object DefaultFontCB: TCheckBox
                Left = 228
                Top = 6
                Width = 109
                Height = 17
                Hint = 
                  'If unchecked, use the fontname, else use the default (Style 32 f' +
                  'ont).'
                Caption = 'Use Default Font'
                TabOrder = 0
                OnClick = StyleElementChanged
              end
              object SizeSE: TEdit
                Left = 127
                Top = 33
                Width = 47
                Height = 21
                Hint = 'Size of the font, 0 for default size.'
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 2
                OnExit = StyleElementChanged
              end
              object ForeCB: TColorBox
                Left = 77
                Top = 111
                Width = 101
                Height = 22
                Hint = 'Foreground color (text color)'
                DefaultColorColor = clDefault
                NoneColorColor = clDefault
                Selected = clDefault
                Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ItemHeight = 16
                ParentFont = False
                TabOrder = 11
                OnChange = StyleElementChanged
              end
              object BackCB: TColorBox
                Left = 254
                Top = 111
                Width = 101
                Height = 22
                Hint = 'Background color'
                DefaultColorColor = clDefault
                NoneColorColor = clDefault
                Selected = clDefault
                Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ItemHeight = 16
                ParentFont = False
                TabOrder = 12
                OnChange = StyleElementChanged
              end
              object ItalicCB: TCheckBox
                Left = 180
                Top = 34
                Width = 43
                Height = 17
                Caption = 'Italic'
                TabOrder = 3
                OnClick = StyleElementChanged
              end
              object BoldCB: TCheckBox
                Left = 228
                Top = 34
                Width = 46
                Height = 17
                Caption = 'Bold'
                TabOrder = 4
                OnClick = StyleElementChanged
              end
              object UnderlineCB: TCheckBox
                Left = 277
                Top = 34
                Width = 68
                Height = 17
                Caption = 'Underline'
                TabOrder = 5
                OnClick = StyleElementChanged
              end
              object VisibleCB: TCheckBox
                Left = 37
                Top = 61
                Width = 54
                Height = 17
                Caption = 'Visible'
                TabOrder = 6
                OnClick = StyleElementChanged
              end
              object ChangeableCB: TCheckBox
                Left = 180
                Top = 61
                Width = 84
                Height = 17
                Caption = 'Changeable'
                TabOrder = 8
                OnClick = StyleElementChanged
              end
              object EOLFilledCB: TCheckBox
                Left = 103
                Top = 61
                Width = 71
                Height = 17
                Caption = 'EOL Filled'
                TabOrder = 7
                OnClick = StyleElementChanged
              end
              object CaseCB: TComboBox
                Left = 77
                Top = 83
                Width = 101
                Height = 21
                Style = csDropDownList
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ItemHeight = 13
                ParentFont = False
                TabOrder = 10
                OnChange = StyleElementChanged
                Items.Strings = (
                  'Mixed'
                  'Upper'
                  'Lower')
              end
              object HotspotCB: TCheckBox
                Left = 277
                Top = 61
                Width = 59
                Height = 17
                Caption = 'Hotspot'
                TabOrder = 9
                OnClick = StyleElementChanged
              end
              object FontCB: TtcFontCombobox
                Left = 40
                Top = 3
                Width = 183
                Height = 24
                Hint = 'Font for the current style (only when Use Default is unchecked)'
                OnChange = StyleElementChanged
                OnClick = StyleElementChanged
                DropDownCount = 12
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -13
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ItemHeight = 18
                ParentFont = False
                TabOrder = 1
                PreviewWidth = 240
                PreviewHeight = 60
                FontTypes = [ftTrueTypeAnsi, ftTrueTypeSymbol]
                ShowPreviewInList = False
              end
            end
          end
          object keywordsTabSheet: TTabSheet
            Caption = 'Keywords'
            ImageIndex = 1
            object Label18: TLabel
              Left = 0
              Top = 112
              Width = 364
              Height = 18
              Align = alTop
              Alignment = taCenter
              AutoSize = False
              Caption = 'Keywords (separated by space)'
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = 'MS Sans Serif'
              Font.Style = [fsBold]
              ParentFont = False
              Transparent = True
              Layout = tlCenter
            end
            object topKeywordsPanel: TPanel
              Left = 0
              Top = 0
              Width = 364
              Height = 112
              Align = alTop
              BevelOuter = bvNone
              TabOrder = 0
              object keywordlistBox: TGroupBox
                Left = 4
                Top = 0
                Width = 162
                Height = 108
                Caption = 'Keyword Lists:'
                TabOrder = 0
                object KeyListsLB: TListBox
                  Left = 9
                  Top = 15
                  Width = 144
                  Height = 85
                  Hint = 'Keywordlists for the currently selected language/lexer'
                  BevelKind = bkSoft
                  BorderStyle = bsNone
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ItemHeight = 13
                  ParentFont = False
                  TabOrder = 0
                  OnClick = KeyListsLBClick
                end
              end
              object KeywordListGB: TGroupBox
                Left = 171
                Top = 0
                Width = 190
                Height = 108
                Caption = 'Keyword List'
                TabOrder = 1
                object Label11: TLabel
                  Left = 13
                  Top = 23
                  Width = 59
                  Height = 13
                  Caption = 'List Number:'
                  Transparent = True
                end
                object Label12: TLabel
                  Left = 16
                  Top = 48
                  Width = 56
                  Height = 13
                  Caption = 'Description:'
                  Transparent = True
                end
                object KeyListNumberSE: TEdit
                  Left = 73
                  Top = 20
                  Width = 47
                  Height = 21
                  Hint = 'Keywordlist number for the selected list.'
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ParentFont = False
                  TabOrder = 0
                  OnExit = KeyListElementsChange
                  OnKeyPress = TestNumericOnly
                end
                object KeyListDescriptionEB: TEdit
                  Left = 73
                  Top = 45
                  Width = 111
                  Height = 21
                  Hint = 'Description for the selected list.'
                  Font.Charset = DEFAULT_CHARSET
                  Font.Color = clWindowText
                  Font.Height = -11
                  Font.Name = 'MS Sans Serif'
                  Font.Style = []
                  ParentFont = False
                  TabOrder = 1
                  OnChange = KeyListElementsChange
                end
                object KeyListAdd: TBitBtn
                  Left = 37
                  Top = 72
                  Width = 58
                  Height = 22
                  Hint = 'Add Keyword List'
                  Caption = 'Add'
                  TabOrder = 2
                  OnClick = KeyListAddClick
                  Glyph.Data = {
                    DE010000424DDE01000000000000760000002800000024000000120000000100
                    0400000000006801000000000000000000001000000010000000000000000000
                    80000080000000808000800000008000800080800000C0C0C000808080000000
                    FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000666666666666666666666666666666666666000066666666FFF666666666
                    666666FFF666666600006666666844F66666666666666888F666666600006666
                    666844F66666666666666888F666666600006666666844F66666666666666888
                    F666666600006666FFF644FFFFF6666666FFF888FFFFF6660000666844444444
                    44F66666688888888888F666000066684444444444F66666688888888888F666
                    000066688888446888666666688888888888666600006666666844F666666666
                    66666888F666666600006666666844F66666666666666888F666666600006666
                    666844F66666666666666888F666666600006666666888666666666666666888
                    6666666600006666666666666666666666666666666666660000666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000}
                  NumGlyphs = 2
                end
                object KeyListDelete: TBitBtn
                  Left = 99
                  Top = 72
                  Width = 58
                  Height = 22
                  Hint = 'Delete Keyword List'
                  Caption = 'Rem'
                  TabOrder = 3
                  OnClick = KeyListDeleteClick
                  Glyph.Data = {
                    DE010000424DDE01000000000000760000002800000024000000120000000100
                    0400000000006801000000000000000000001000000010000000000000000000
                    80000080000000808000800000008000800080800000C0C0C000808080000000
                    FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000666666666666661F66666666666666668F66000066661F66666666666666
                    668F6666666666660000666111F6666661F666666888F6666668F66600006661
                    11F666661F6666666888F666668F666600006666111F66611F66666666888F66
                    688F6666000066666111F611F6666666666888F688F66666000066666611111F
                    66666666666688888F66666600006666666111F66666666666666888F6666666
                    000066666611111F66666666666688888F666666000066666111F61F66666666
                    666888F68F66666600006661111F66611F66666668888F66688F666600006611
                    11F6666611F666668888F6666688F66600006611F6666666611F666688F66666
                    66688F6600006666666666666666666666666666666666660000666666666666
                    6666666666666666666666660000666666666666666666666666666666666666
                    0000}
                  NumGlyphs = 2
                end
              end
            end
            object KeywordsM: TMemo
              Left = 0
              Top = 130
              Width = 364
              Height = 141
              Hint = 'List of keywords for the selected list.'
              Align = alClient
              BevelKind = bkSoft
              BorderStyle = bsNone
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = 'MS Sans Serif'
              Font.Style = []
              ParentFont = False
              ScrollBars = ssVertical
              TabOrder = 1
              OnChange = KeyListElementsChange
            end
          end
          object DefaultsPage: TTabSheet
            Caption = 'Defaults'
            ImageIndex = 2
            object Label35: TLabel
              Left = 152
              Top = 78
              Width = 61
              Height = 13
              Caption = 'Background:'
              Transparent = True
            end
            object Label32: TLabel
              Left = 0
              Top = 0
              Width = 364
              Height = 18
              Align = alTop
              Alignment = taCenter
              AutoSize = False
              Caption = 'Default style settings'
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = 'MS Sans Serif'
              Font.Style = [fsBold]
              ParentFont = False
              Transparent = True
              Layout = tlCenter
            end
            object Label33: TLabel
              Left = 45
              Top = 78
              Width = 24
              Height = 13
              Caption = 'Font:'
            end
            object Label34: TLabel
              Left = 0
              Top = 18
              Width = 364
              Height = 13
              Align = alTop
              Alignment = taCenter
              Caption = 'These settings are used when you use a style'
            end
            object Label36: TLabel
              Left = 0
              Top = 31
              Width = 364
              Height = 13
              Align = alTop
              Alignment = taCenter
              Caption = 
                'which uses the clDefault color, or the '#39'Use default font'#39' is che' +
                'cked.'
            end
            object defaultBackgroundCB: TColorBox
              Left = 219
              Top = 74
              Width = 101
              Height = 22
              Hint = 'Background color'
              DefaultColorColor = clDefault
              NoneColorColor = clDefault
              Selected = clDefault
              Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = 'MS Sans Serif'
              Font.Style = []
              ItemHeight = 16
              ParentFont = False
              TabOrder = 0
            end
            object FontButton: TBitBtn
              Left = 74
              Top = 73
              Width = 68
              Height = 25
              Hint = 'Set default font settings (STYLE_DEFAULT 32)'
              Caption = '&Font'
              TabOrder = 1
              OnClick = FontButtonClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000130B0000130B00001000000000000000000000000000
                800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                3333333333333333333333333333333333333333FFF33FFFFF33333300033000
                00333337773377777333333330333300033333337FF33777F333333330733300
                0333333377FFF777F33333333700000073333333777777773333333333033000
                3333333337FF777F333333333307300033333333377F777F3333333333703007
                33333333377F7773333333333330000333333333337777F33333333333300003
                33333333337777F3333333333337007333333333337777333333333333330033
                3333333333377333333333333333033333333333333733333333333333333333
                3333333333333333333333333333333333333333333333333333}
              NumGlyphs = 2
            end
          end
          object otherPage: TTabSheet
            Caption = 'Other Settings'
            ImageIndex = 3
            object langOperators: TGroupBox
              Left = 10
              Top = 65
              Width = 346
              Height = 53
              Caption = 'Operators'
              TabOrder = 0
              object Label37: TLabel
                Left = 14
                Top = 23
                Width = 54
                Height = 13
                Caption = 'Assignment'
              end
              object Label38: TLabel
                Left = 142
                Top = 23
                Width = 84
                Height = 13
                Caption = 'End Of Statement'
              end
              object AssignmentOperatorED: TEdit
                Left = 73
                Top = 20
                Width = 50
                Height = 21
                Hint = 'Assignment operator for this language'
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                ParentShowHint = False
                ShowHint = True
                TabOrder = 0
                OnChange = AssignmentOperatorEDChange
              end
              object EndOfStatementED: TEdit
                Left = 231
                Top = 20
                Width = 50
                Height = 21
                Hint = 'End of statement operator for this language'
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                ParentShowHint = False
                ShowHint = True
                TabOrder = 1
                OnChange = EndOfStatementEDChange
              end
            end
            object langComments: TGroupBox
              Left = 10
              Top = 124
              Width = 346
              Height = 117
              Caption = 'Commenting'
              TabOrder = 1
              object Label39: TLabel
                Left = 25
                Top = 22
                Width = 43
                Height = 13
                Caption = 'Box Start'
              end
              object Label40: TLabel
                Left = 248
                Top = 22
                Width = 40
                Height = 13
                Caption = 'Box End'
              end
              object Label41: TLabel
                Left = 133
                Top = 22
                Width = 52
                Height = 13
                Caption = 'Box Middle'
              end
              object Label42: TLabel
                Left = 46
                Top = 80
                Width = 27
                Height = 13
                Caption = 'Block'
              end
              object Label49: TLabel
                Left = 9
                Top = 51
                Width = 58
                Height = 13
                Caption = 'Stream Start'
              end
              object Label50: TLabel
                Left = 129
                Top = 51
                Width = 55
                Height = 13
                Caption = 'Stream End'
              end
              object commentBoxStart: TEdit
                Left = 73
                Top = 18
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 0
                OnChange = commentBoxStartChange
              end
              object commentBoxEnd: TEdit
                Left = 290
                Top = 18
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 2
                OnChange = commentBoxEndChange
              end
              object commentBoxMiddle: TEdit
                Left = 187
                Top = 18
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 1
                OnChange = commentBoxMiddleChange
              end
              object commentBlock: TEdit
                Left = 73
                Top = 76
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 5
                OnChange = commentBlockChange
              end
              object commentStreamStart: TEdit
                Left = 73
                Top = 47
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 3
                OnChange = commentStreamStartChange
              end
              object commentStreamEnd: TEdit
                Left = 187
                Top = 47
                Width = 50
                Height = 21
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                TabOrder = 4
                OnChange = commentStreamEndChange
              end
            end
            object langSettingsBox: TGroupBox
              Left = 10
              Top = 5
              Width = 346
              Height = 52
              Caption = 'Language Settings'
              TabOrder = 2
              object Label53: TLabel
                Left = 26
                Top = 24
                Width = 40
                Height = 13
                Caption = 'StyleBits'
              end
              object Label54: TLabel
                Left = 136
                Top = 24
                Width = 26
                Height = 13
                Caption = 'Lexer'
              end
              object NumStyleBitsED: TEdit
                Left = 72
                Top = 21
                Width = 50
                Height = 21
                Hint = 'Number of stylebits used by this highlighter'
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ParentFont = False
                ParentShowHint = False
                ShowHint = True
                TabOrder = 0
                OnExit = NumStyleBitsEDExit
                OnKeyPress = TestNumericOnly
              end
              object lexerforlangCB: TComboBox
                Left = 170
                Top = 21
                Width = 116
                Height = 21
                Hint = 'Highlighter/lexer to use'
                Style = csDropDownList
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = 'MS Sans Serif'
                Font.Style = []
                ItemHeight = 0
                ParentFont = False
                ParentShowHint = False
                ShowHint = True
                Sorted = True
                TabOrder = 1
                OnExit = lexerforlangCBExit
              end
            end
          end
        end
      end
    end
    object KeyCommandsPage: TTabSheet
      Caption = 'Key commands'
      ImageIndex = 3
      object keycommandsPanel: TPanel
        Left = 0
        Top = 0
        Width = 372
        Height = 344
        Align = alClient
        BevelOuter = bvNone
        TabOrder = 0
        object KeyCmdList: TListView
          Left = 0
          Top = 0
          Width = 372
          Height = 308
          Align = alClient
          Columns = <
            item
              Caption = 'Command'
              Width = 160
            end
            item
              Caption = 'Keystroke'
              Width = 110
            end>
          ColumnClick = False
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -11
          Font.Name = 'MS Sans Serif'
          Font.Style = []
          HideSelection = False
          HotTrack = True
          HotTrackStyles = [htUnderlineCold]
          ParentFont = False
          PopupMenu = KeyMenu
          SortType = stText
          TabOrder = 0
          ViewStyle = vsReport
          OnCompare = KeyCmdListCompare
          OnDblClick = btnEditClick
        end
        object keybuttonsPanel: TPanel
          Left = 0
          Top = 308
          Width = 372
          Height = 36
          Align = alBottom
          BevelOuter = bvNone
          PopupMenu = KeyMenu
          TabOrder = 1
          DesignSize = (
            372
            36)
          object btnAdd: TBitBtn
            Left = 127
            Top = 6
            Width = 66
            Height = 25
            Hint = 'Add a new keyboard command'
            Anchors = [akTop, akRight]
            Caption = '&Add'
            TabOrder = 0
            OnClick = btnAddClick
            Glyph.Data = {
              DE010000424DDE01000000000000760000002800000024000000120000000100
              0400000000006801000000000000000000001000000010000000000000000000
              80000080000000808000800000008000800080800000C0C0C000808080000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000666666666666666666666666666666666666000066666666FFF666666666
              666666FFF666666600006666666844F66666666666666888F666666600006666
              666844F66666666666666888F666666600006666666844F66666666666666888
              F666666600006666FFF644FFFFF6666666FFF888FFFFF6660000666844444444
              44F66666688888888888F666000066684444444444F66666688888888888F666
              000066688888446888666666688888888888666600006666666844F666666666
              66666888F666666600006666666844F66666666666666888F666666600006666
              666844F66666666666666888F666666600006666666888666666666666666888
              6666666600006666666666666666666666666666666666660000666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000}
            NumGlyphs = 2
          end
          object btnEdit: TBitBtn
            Left = 199
            Top = 6
            Width = 66
            Height = 25
            Hint = 'Edit the selected keyboard command'
            Anchors = [akTop, akRight]
            Caption = '&Edit'
            TabOrder = 1
            OnClick = btnEditClick
            Glyph.Data = {
              36040000424D3604000000000000360000002800000010000000100000000100
              2000000000000004000000000000000000000000000000000000008080000080
              8000008080000080800000808000008080000000000000000000000000000000
              0000000000000000000000000000000000000000000000000000008080000080
              800000808000008080000080800000808000000000FFFFFFFF00FFFFFFFFFFFF
              FF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFF0000000000000000000000
              0000008080000000000000000000000000000000000000000000FFFFFFFFFFFF
              FF00000000FFFFFFFF000000000000000000FFFFFF0000000000FFFF00000000
              00000000000000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00000000FFFFFF
              FF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFF0000000000FFFF00000000
              000000FFFFFFFFFFFF0000FFFFFFFFFFFF000000000000000000000000FFFFFF
              FF00FFFFFFFFFFFFFF00FFFFFF0000000000FFFFFF0000000000FFFF00000000
              0000FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF000000
              0000FFFFFF0000000000000000FFFFFFFF00FFFFFF0000000000FFFF00000000
              000000FFFFFFFFFFFF0000FFFFFFFFFFFF000000000000000000000000000000
              00000000000000FFFF00000000FFFFFFFF00FFFFFF0000000000FFFF00000000
              0000FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF
              FF00FFFFFF0000000000FFFFFFFFFFFFFF00FFFFFF0000000000FFFF00000000
              000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000
              0000000000FFFFFFFF00FFFFFFFFFFFFFF00FFFFFF0000000000000000000000
              00000000000000FFFF00FFFFFF0000FFFF00000000000000000000FFFF000000
              0000FFFFFFFFFFFFFF000000000000000000FFFFFF0000000000008080000080
              8000008080000000000000000000000000000000000000FFFF00000000FFFFFF
              FF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFF0000000000008080000080
              80000080800000808000008080000000000000FFFF0000000000FFFFFFFFFFFF
              FF00FFFFFFFFFFFFFF0000000000000000000000000000000000008080000080
              800000808000008080000000000000FFFF00000000FFFFFFFF00FFFFFF000000
              0000000000FFFFFFFF00000000FFFFFFFF00FFFFFF0000000000008080000080
              8000008080000000000000FFFF0000000000000000FFFFFFFF00FFFFFFFFFFFF
              FF00FFFFFFFFFFFFFF00000000FFFFFFFF000000000000808000008080000080
              8000000000000000FF000000000000808000000000FFFFFFFF00FFFFFFFFFFFF
              FF00FFFFFFFFFFFFFF0000000000000000000080800000808000008080000080
              8000008080000000000000808000008080000000000000000000000000000000
              0000000000000000000000000000008080000080800000808000}
          end
          object btnDelete: TBitBtn
            Left = 272
            Top = 6
            Width = 66
            Height = 25
            Hint = 'Delete the selected keyboard command'
            Anchors = [akTop, akRight]
            Caption = '&Delete'
            TabOrder = 2
            OnClick = btnDeleteClick
            Glyph.Data = {
              DE010000424DDE01000000000000760000002800000024000000120000000100
              0400000000006801000000000000000000001000000010000000000000000000
              80000080000000808000800000008000800080800000C0C0C000808080000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000666666666666661F66666666666666668F66000066661F66666666666666
              668F6666666666660000666111F6666661F666666888F6666668F66600006661
              11F666661F6666666888F666668F666600006666111F66611F66666666888F66
              688F6666000066666111F611F6666666666888F688F66666000066666611111F
              66666666666688888F66666600006666666111F66666666666666888F6666666
              000066666611111F66666666666688888F666666000066666111F61F66666666
              666888F68F66666600006661111F66611F66666668888F66688F666600006611
              11F6666611F666668888F6666688F66600006611F6666666611F666688F66666
              66688F6600006666666666666666666666666666666666660000666666666666
              6666666666666666666666660000666666666666666666666666666666666666
              0000}
            NumGlyphs = 2
          end
          object btnReset: TBitBtn
            Left = 35
            Top = 6
            Width = 66
            Height = 25
            Hint = 'Reset the command list to default'
            Anchors = [akTop, akRight]
            Caption = '&Reset'
            TabOrder = 3
            OnClick = btnResetClick
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              04000000000080000000CE0E0000D80E00001000000000000000000000000000
              80000080000000808000800000008000800080800000C0C0C000808080000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
              7777777777777777777777777777777777777777777777777777777777777777
              7777777777777778477777444447777748777744447777777477774447777777
              7477774474777777747777477748777748777777777844448777777777777777
              7777777777777777777777777777777777777777777777777777}
          end
        end
      end
    end
  end
  object buttonPanel: TPanel
    Left = 0
    Top = 369
    Width = 380
    Height = 41
    Align = alBottom
    BevelInner = bvRaised
    BevelOuter = bvLowered
    TabOrder = 1
    object CancelBtn: TBitBtn
      Left = 290
      Top = 8
      Width = 75
      Height = 25
      Hint = 'Cancel, and revert to previous settings'
      TabOrder = 0
      OnClick = CancelBtnClick
      Kind = bkCancel
    end
    object ApplyBtn: TBitBtn
      Left = 154
      Top = 8
      Width = 75
      Height = 25
      Hint = 'Apply the settings'
      Caption = 'Apply'
      TabOrder = 1
      OnClick = ApplyBtnClick
      Glyph.Data = {
        DE010000424DDE01000000000000760000002800000024000000120000000100
        0400000000006801000000000000000000001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
        6666666666666F6666666666000066666636666666666666666686F666666666
        0000666666306666666666666666886F66666666000066666663066666666666
        66666886F6666666000066666663B066666666666666F8F86F66666600006666
        63000F06666666666668888686F666660000666663FBFBF06666666666686F66
        686F666600006666663FB0333666666666668F688886666600006666663BFB06
        6666666666FF8FF686F66666000066630000BFB06666666668888866686F6666
        00006663FBFBFBFB06666666686F6666668F6666000066663FBFB03336666666
        668F666888866666000066663BFBFB06666666666686F66686F6666600006666
        63BFBFB0666666666668F666686F66660000666663FBFBFB0666666666686F66
        6686F66600006666663FBFBFB066666666668FFFFFF8FF660000666666333333
        3336666666668888888886660000666666666666666666666666666666666666
        0000}
      NumGlyphs = 2
    end
    object OKBtn: TBitBtn
      Left = 18
      Top = 8
      Width = 75
      Height = 25
      Hint = 'Apply the settings and close dialog'
      TabOrder = 2
      OnClick = OKBtnClick
      Kind = bkOK
    end
  end
  object FontDialog: TFontDialog
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    Left = 292
  end
  object KeyMenu: TPopupMenu
    Left = 101
    Top = 112
    object LoadKeyCommands1: TMenuItem
      Caption = 'Load Keycommands..'
      OnClick = LoadKeyCommands1Click
    end
    object SaveKeycommands1: TMenuItem
      Caption = '&Save Keycommands..'
      OnClick = SaveKeycommands1Click
    end
  end
  object odia: TOpenDialog
    Filter = 'Keycommands (*.key)|*.key|All Files (*.*)|*.*'
    Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
    Title = 'Load keycommands from..'
    Left = 201
    Top = 120
  end
  object sdia: TSaveDialog
    Filter = 'Keycommands (*.key)|*.key|All Files (*.*)|*.*'
    Options = [ofHideReadOnly, ofPathMustExist, ofEnableSizing]
    Title = 'Save Keycommands to..'
    Left = 229
    Top = 121
  end
end

Added src/delphisci/EdOptionsWin.pas.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
{$Include SciCommonDef.Inc}
unit EdOptionsWin;
{
Unit    : EdOptionsWin
Purpose : Options Dialog for Scintilla editors
Created : 20/03/2003
     $Id: EdOptionsWin.pas,v 1.7 2004/12/03 17:18:58 hdalis Exp $
Original Author: Kiriakos Vlahos (kvlahos@london.edu)
Current Author : hdalis
History 29/09/2004 Initial Release with Delphi Scintilla Interface Components
                   Extended and customized the optionsbox
                   No longer accepts enums, now it accepts strings.
                   Color,Caret,Hotspot etc properties added.
                   (hdalis@users.sourceforge.net)
        13/10/2004 Added help using ClassExplorer 6.0, Use the helpgenerator to
                   generate the help.
                   Renamed the Scintilla property to Editor
                   (hdalis@users.sourceforge.net)
        25/10/2004 Redesigned the whole form. Added add,copy,remove languages buttons.
                   Added Active Hotspot options.
                   The Keywords page doesn't exist anymore, it is now a part of the
                   Highlighter page.
                   (hdalis@users.sourceforge.net)
        02/11/2004 No longer displays a list of all lexers, now only defined languages
                   are displayed, i.e those defined in the Highlighter.LanguageList.
                   If you want to add a language, click Add and set the languagename and
                   the lexer to use for it. You can have as many languages defined as you wish.
        09/11/2004 Added EdgeColumn,EdgeType,EdgeColor
                   Some redesign of the Options page to
                   make it fit.. To be adjusted later.
        18/11/2004 Changed the TSciSynLexer to TSciLanguageManager, and changed all properties etc to reflect that.
        26/11/2004 Renamed the SetScintilla function to SetEditor to conform with the rest of them..
BUGFIXES:
        04/11/2004 When a new keylist was added, and you typed a description then the text
                   in the listbox wasn't updated. Fixed.
        15/01/2005 Added Comment* and AssignmentOperator,EndOfStatementOperator to the dialog.
                   Changed the Update* procs to take a TSciLangItem, and use that instead of
                   looking up the language all the time.. Improves performance of the dialog somewhat,
                   microscopic but..
        27/05/2005 Swapped the columns in the KeyBindings listview. Added sort.
                   Fixed a couple of memoryleaks. Now it's sorted by Command.

}
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons,SciLexer,SciLexerMod,SciLexerMemo,SciKeyBindings,
  ComCtrls, ScintillaLanguageManager, tcFontCombobox, Menus;

type
  TEditorOptions = class(TPersistent)
  private
    FReadOnly : boolean;
    FBraceHilite : boolean;
    FGutter: boolean;
    FWordWrap: TWordWrapType;
    FLineNumbers: boolean;
    FIndentation : TIndentationOptions;
    FCodeFolding: sciCodeFoldingFlags;
    FCaretFore : TColor;
    FIndentWidth: Integer;
    FTabWidth: Integer;
    FEOLStyle: TEOLStyle;
    FCaretLineVisible : Boolean;
    FCaretBack : TColor;
    FSaveClearsUndo : Boolean;
    FFont: TFont;
    FLanguageManager: TSciLanguageManager;
    fKeyCommands : TSciKeyCommandCollection;
    FCaretWidth: Integer;
    FSelFore : TColor;
    FSelBack : TColor;
    FFoldLo : TColor;
    FFoldHi : TColor;
    FMarkerFore : TColor;
    FMarkerBack : TColor;
    FBMarkFore : TColor;
    FBMarkBack : TColor;
    FHotActiveFore : TColor;
    FHotActiveBack : TColor;
    FHotActiveUnderline : Boolean;
    FHotActiveSingleLine : Boolean;
    FEdgeColor : TColor;
    FEdgeColumn : TColor;
    FEdgeType : sciEdgeType;
    FColor : TColor;
    FMarkerType : sciMarkerType;
    FCodePage : CodePageType;
    procedure SetFont(const Value: TFont);
    procedure SetLanguageManager(const Value: TSciLanguageManager);
    procedure SetKeyCommands(const Value: TSciKeyCommandCollection);
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent);override;
    procedure GetOptions(Scintilla : TScintilla);
    procedure SetOptions(Scintilla : TScintilla);
  published
    property LanguageManager : TSciLanguageManager read FLanguageManager write SetLanguageManager;
    property ReadOnly : boolean read fReadOnly write fReadOnly default False;
    property BraceHilite : boolean read FBraceHilite write FBraceHilite default True;
    property Gutter : boolean read FGutter write FGutter default True;
    property Indentation : TIndentationOptions read FIndentation write fIndentation;
    property LineNumbers : boolean read FLineNumbers write FLineNumbers default False;
    property WordWrap : TWordWrapType read FWordWrap write FWordWrap default sciNoWrap;
    property CodeFolding : sciCodeFoldingFlags read FCodeFolding write FCodeFolding default [foldFold,foldCompact,foldComment,foldPreprocessor,foldAtElse,foldHTML,foldHTMLPreProcessor];
    property EOLStyle : TEOLStyle read FEOLStyle write FEOLStyle default eolCRLF;
    property TabWidth : Integer read FTabWidth write FTabWidth  default 8;
    property IndentWidth : Integer read FIndentWidth write FIndentWidth default 0;
    property KeyCommands : TSciKeyCommandCollection read FKeyCommands write SetKeyCommands;
    property CaretFore : TColor read FCaretFore Write FCaretFore;
    property CaretBack : TColor read FCaretBack Write FCaretBack;
    property Font : TFont read FFont write SetFont;
    property CaretWidth : Integer read FCaretWidth write FCaretWidth;
    property CaretLineVisible : Boolean read FCaretLineVisible write FCaretLineVisible;
    property SelFore : TColor read FSelFore write FSelFore default clDefault;
    property SelBack : TColor read FSelBack write FSelBack default clDefault;
    property FoldLo : TColor read FFoldLo write FFoldLo default clDefault;
    property FoldHi : TColor read FFoldHi write FFoldHi default clDefault;
    property MarkerFore : TColor read FMarkerFore write FMarkerFore default clDefault;
    property MarkerBack : TColor read FMarkerBack write FMarkerBack default clDefault;
    property BMarkFore : TColor read FBMarkFore write FBMarkFore default clDefault;
    property BMarkBack : TColor read FBMarkBack write FBMarkBack default clDefault;
    property XSaveClearsUndo : Boolean read FSaveClearsUndo write FSaveClearsUndo default false;
    property HotActiveFore : TColor read FHotActiveFore write FHotActiveFore default clDefault;
    property HotActiveBack : TColor read FHotActiveBack write FHotActiveBack default clDefault;
    property HotActiveUnderline : Boolean read FHotActiveUnderline write FHotActiveUnderline;
    property HotActiveSingleLine : Boolean read FHotActiveSingleLine write FHotActiveSingleLine;
    property EdgeColor : TColor read FEdgeColor write FEdgeColor;
    property EdgeColumn : TColor read FEdgeColumn write FEdgeColumn;
    property EdgeType : sciEdgeType read FEdgeType write FEdgeType;
    property MarkerType : sciMarkerType read FMarkerType write FMarkerType;
    property Color : TColor read FColor write FColor;
    property CodePage : CodePageType read FCodePage write FCodePage;
  end;


  TEdOptionsWindow = class(TForm)
    OptionPages: TPageControl;
    OptionsPage: TTabSheet;
    ColorsPage: TTabSheet;
    colorsPanel: TPanel;
    optionsPanel: TPanel;
    viewOptionsBox: TGroupBox;
    CodeFoldingCB: TCheckBox;
    GutterCB: TCheckBox;
    LineNumbersCB: TCheckBox;
    IndentationGuidesCB: TCheckBox;
    indentationBox: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    KeepIndentCB: TCheckBox;
    TabIndentsCB: TCheckBox;
    BackSpaceUnIndentsCB: TCheckBox;
    buttonPanel: TPanel;
    CancelBtn: TBitBtn;
    ApplyBtn: TBitBtn;
    OKBtn: TBitBtn;
    HighlighterPage: TTabSheet;
    highlighterPanel: TPanel;
    FontDialog: TFontDialog;
    languageCBBox: TGroupBox;
    LanguageCB: TComboBox;
    Label13: TLabel;
    CaretCB: TColorBox;
    Label14: TLabel;
    CaretWidthSE: TEdit;
    KeyCommandsPage: TTabSheet;
    keycommandsPanel: TPanel;
    KeyCmdList: TListView;
    TabWidthSE: TEdit;
    IndentWidthSE: TEdit;
    CaretLineVisCB : TCheckBox;
    CaretBackCB : TColorBox;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    SelForeCB: TColorBox;
    SelBackCB: TColorBox;
    MarkerForeCB: TColorBox;
    MarkerBackCB: TColorBox;
    BMarkForeCB  : TColorBox;
    BMarkBackCB  : TColorBox;
    Label22 : TLabel;
    Label23 : TLabel;
    addLangButton: TBitBtn;
    remLangButton: TBitBtn;
    copyLangButton: TBitBtn;
    keybuttonsPanel: TPanel;
    btnAdd: TBitBtn;
    btnEdit: TBitBtn;
    btnDelete: TBitBtn;
    btnReset: TBitBtn;
    HotspotGB: TGroupBox;
    Label24: TLabel;
    Label25: TLabel;
    HotActiveForeCB: TColorBox;
    HotActiveBackCB: TColorBox;
    HotActiveUnderlineCB: TCheckBox;
    HotActiveSingleLineCB: TCheckBox;
    FoldingGB: TGroupBox;
    Label26: TLabel;
    Label27: TLabel;
    FoldLoCB: TColorBox;
    FoldHiCB: TColorBox;
    MarkersGB: TGroupBox;
    highlighterPageCtrl: TPageControl;
    stylesTabSheet: TTabSheet;
    keywordsTabSheet: TTabSheet;
    topStylePanel: TPanel;
    GroupBox5: TGroupBox;
    StylesLB: TListBox;
    stylenoBox: TGroupBox;
    Label4: TLabel;
    Label9: TLabel;
    StyleNumberSE: TEdit;
    DescriptionEB: TEdit;
    AddStyleB: TBitBtn;
    DeleteStyleB: TBitBtn;
    topKeywordsPanel: TPanel;
    keywordlistBox: TGroupBox;
    KeyListsLB: TListBox;
    KeywordListGB: TGroupBox;
    Label11: TLabel;
    Label12: TLabel;
    KeyListNumberSE: TEdit;
    KeyListDescriptionEB: TEdit;
    KeyListAdd: TBitBtn;
    KeyListDelete: TBitBtn;
    KeywordsM: TMemo;
    Label18: TLabel;
    Label19: TLabel;
    StyleDefGB: TPanel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label10: TLabel;
    DefaultFontCB: TCheckBox;
    SizeSE: TEdit;
    ForeCB: TColorBox;
    BackCB: TColorBox;
    ItalicCB: TCheckBox;
    BoldCB: TCheckBox;
    UnderlineCB: TCheckBox;
    VisibleCB: TCheckBox;
    ChangeableCB: TCheckBox;
    EOLFilledCB: TCheckBox;
    CaseCB: TComboBox;
    HotspotCB: TCheckBox;
    FontCB: TtcFontCombobox;
    gbRightEdge: TGroupBox;
    Label28: TLabel;
    Label29: TLabel;
    EdgeColumnSE: TEdit;
    EdgeColorCB: TColorBox;
    BraceHiliteCB: TCheckBox;
    Label30: TLabel;
    EdgeTypeCB: TComboBox;
    markerTypeCB: TComboBox;
    Label31: TLabel;
    OtherGB: TGroupBox;
    SaveClearsUndoCB: TCheckBox;
    ReadOnlyCB: TCheckBox;
    Label3: TLabel;
    EOLStyleCB: TComboBox;
    DefaultsPage: TTabSheet;
    Label35: TLabel;
    defaultBackgroundCB: TColorBox;
    FontButton: TBitBtn;
    Label32: TLabel;
    Label33: TLabel;
    Label34: TLabel;
    Label36: TLabel;
    otherPage: TTabSheet;
    langOperators: TGroupBox;
    Label37: TLabel;
    Label38: TLabel;
    AssignmentOperatorED: TEdit;
    EndOfStatementED: TEdit;
    langComments: TGroupBox;
    Label39: TLabel;
    Label40: TLabel;
    Label41: TLabel;
    Label42: TLabel;
    Label49: TLabel;
    Label50: TLabel;
    commentBoxStart: TEdit;
    commentBoxEnd: TEdit;
    commentBoxMiddle: TEdit;
    commentBlock: TEdit;
    commentStreamStart: TEdit;
    commentStreamEnd: TEdit;
    langSettingsBox: TGroupBox;
    Label53: TLabel;
    Label54: TLabel;
    NumStyleBitsED: TEdit;
    lexerforlangCB: TComboBox;
    WordWrapCB: TComboBox;
    KeyMenu: TPopupMenu;
    LoadKeyCommands1: TMenuItem;
    SaveKeycommands1: TMenuItem;
    odia: TOpenDialog;
    sdia: TSaveDialog;
    Label43: TLabel;
    CodePageCB: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ApplyBtnClick(Sender: TObject);
    procedure FontButtonClick(Sender: TObject);
    procedure OKBtnClick(Sender: TObject);
    procedure CancelBtnClick(Sender: TObject);
    procedure StylesLBClick(Sender: TObject);
    procedure LanguageCBChange(Sender: TObject);
    procedure StyleElementChanged(Sender: TObject);
    procedure DeleteStyleBClick(Sender: TObject);
    procedure AddStyleBClick(Sender: TObject);
    procedure KeyListsLBClick(Sender: TObject);
    procedure KeyListElementsChange(Sender: TObject);
    procedure KeyListDeleteClick(Sender: TObject);
    procedure KeyListAddClick(Sender: TObject);
    procedure btnDeleteClick(Sender: TObject);
    procedure btnResetClick(Sender: TObject);
    procedure btnEditClick(Sender: TObject);
    procedure btnAddClick(Sender: TObject);
    procedure StyleNumberSEKeyPress(Sender : TObject;var ch : Char);
    procedure TestNumericOnly(Sender: TObject; var Key: Char);
    procedure addLangButtonClick(Sender: TObject);
    procedure remLangButtonClick(Sender: TObject);
    procedure copyLangButtonClick(Sender: TObject);
    procedure OptionPagesChange(Sender: TObject);
    procedure KeyCmdListCompare(Sender: TObject; Item1, Item2: TListItem;
      Data: Integer; var Compare: Integer);
    procedure AssignmentOperatorEDChange(Sender: TObject);
    procedure EndOfStatementEDChange(Sender: TObject);
    procedure commentBoxStartChange(Sender: TObject);
    procedure commentBoxMiddleChange(Sender: TObject);
    procedure commentBoxEndChange(Sender: TObject);
    procedure commentBlockChange(Sender: TObject);
    procedure commentStreamStartChange(Sender: TObject);
    procedure commentStreamEndChange(Sender: TObject);
    procedure lexerforlangCBExit(Sender: TObject);
    procedure NumStyleBitsEDExit(Sender: TObject);
    procedure LoadKeyCommands1Click(Sender: TObject);
    procedure SaveKeycommands1Click(Sender: TObject);
  private
    { Private declarations }
    FEditor : TScintilla;
    fEditorOptions : TEditorOptions;
    fOldEditorOptions : TEditorOptions;
    UpdatingStyle : Boolean;
    UpdatingKeyList : Boolean;
    procedure SetEditor(const Value: TScintilla);
    procedure UpdateStyles(curlng : TSciLangItem=nil);
    procedure UpdateKeywords(curlng : TSciLangItem=nil);
    procedure UpdateKeyCommands;
    procedure UpdateOther(curlng : TSciLangItem=nil);
    function  CurrentLang : TSciLangItem;    
  public
    { Public declarations }
    property Editor : TScintilla read FEditor write SetEditor;
    procedure   RescanLanguageList;

  end;

var
  EdOptionsWindow: TEdOptionsWindow;

implementation

{$R *.dfm}

Uses
  SciSupport,SciKeyEditForm,SciAddLanguageFormUnit,SciResLang,sciUtils;

{ TEditorOptions }
constructor TEditorOptions.Create;
begin
  inherited;
  FFont := TFont.Create;
  FLanguageManager := TSciLanguageManager.Create(nil);
  fKeyCommands := TSciKeyCommandCollection.Create(nil);
end;

destructor TEditorOptions.Destroy;
begin
  if assigned(FFont) then FreeAndNil(FFont);
  if assigned (FLanguageManager) then FreeAndNil(FLanguageManager);
  if assigned (fKeyCommands) then FreeAndNil(fKeyCommands); //added to avoid a memoryleak after a tip by mak
  inherited;
end;

procedure TEditorOptions.Assign(Source: TPersistent);
begin
  if Source is TEditorOptions then
    with TEditorOptions(Source) do
    begin
      Self.FReadOnly := ReadOnly;
      Self.FBraceHilite := BraceHilite;
      Self.FGutter := Gutter;
      Self.FWordWrap := WordWrap;
      Self.FLineNumbers := LineNumbers;
      Self.FIndentation := Indentation;
      Self.FCodeFolding := CodeFolding;
      Self.FTabWidth := TabWidth ;
      Self.FIndentWidth := IndentWidth;
      Self.FEOLStyle := EOLStyle;
      Self.SetFont(Font);
      Self.FLanguageManager.Assign(LanguageManager);
      Self.KeyCommands.Assign(KeyCommands);
      Self.FCaretBack :=CaretBack;
      Self.FCaretFore :=CaretFore;
      Self.FSelFore := SelFore;
      Self.FFoldLo :=FoldLo;
      Self.FFoldHi :=FoldHi;
      Self.FMarkerFore :=MarkerFore;
      Self.FMarkerBack :=MarkerBack;
      Self.FBMarkFore :=BMarkFore;
      Self.FBMarkBack :=BMarkBack;
      Self.FSelBack := SelBack;
      Self.FCaretWidth :=CaretWidth;
      Self.FCaretLineVisible :=CaretLineVisible;
      Self.FSaveClearsUndo :=XSaveClearsUndo;
      Self.FHotActiveFore:=HotActiveFore;
      Self.FHotActiveBack:=HotActiveBack;
      Self.FHotActiveUnderline:=HotActiveUnderline;
      Self.FHotActiveSingleLine:=HotActiveSingleLine;
      Self.FEdgeColor:=EdgeColor;
      Self.FEdgeColumn:=EdgeColumn;
      Self.FEdgeType:=EdgeType;
      Self.FMarkerType:=MarkerType;
      Self.FColor:=Color;
      Self.FCodePage:=CodePage;
    end
  else if Source is TScintilla then
  begin
    GetOptions(Source as TScintilla);
  end else
    inherited;
end;

procedure TEditorOptions.GetOptions(Scintilla: TScintilla);
begin
  with Scintilla do
  begin
      FReadOnly := ReadOnly;
      FBraceHilite := BraceHilite;
      FGutter := Gutter1.Width <> 0;
      FWordWrap := WordWrap;
      FLineNumbers := Gutter0.Width <> 0;
      FIndentation := Indentation;
      FCodeFolding := Folding;
      FTabWidth := TabWidth ;
      FIndentWidth := IndentWidth;
      FEOLStyle := EOLStyle;
      Self.SetFont(Font);
      FLanguageManager.Assign(LanguageManager);
      fKeyCommands.Assign(Scintilla.KeyCommands);
      FSelFore:=Colors.SelFore;
      FSelBack:=Colors.SelBack;
      FFoldLo :=Colors.FoldLo;
      FFoldHi :=Colors.FoldHi;
      FMarkerFore :=Colors.MarkerFore;
      FMarkerBack :=Colors.MarkerBack;
      FBMarkFore :=Bookmark.ForeColor;
      FBMarkBack :=Bookmark.BackColor;
      FHotActiveFore:=ActiveHotSpot.ForeColor;
      FHotActiveBack:=ActiveHotSpot.BackColor;
      Self.FHotActiveUnderline:=ActiveHotSpot.Underlined;
      Self.FHotActiveSingleLine:=ActiveHotSpot.SingleLine;
      Self.FEdgeColor:=EdgeColor;
      Self.FCodePage:=CodePage;
      Self.FEdgeColumn:=EdgeColumn;
      Self.FEdgeType:=EdgeMode;
      Self.FMarkerType:=FoldMarkers.MarkerType;
      Self.FColor:=Color;
      FSaveClearsUndo :=ClearUndoAfterSave;
      FCaretFore :=Caret.ForeColor;
      FCaretBack :=Caret.LineBackColor;
      FCaretWidth :=Caret.Width;
      FCaretLineVisible :=Caret.LineVisible;
  end;
end;

procedure TEditorOptions.SetFont(const Value: TFont);
begin
  FFont.Assign(Value);
end;

procedure TEditorOptions.SetKeyCommands(const Value: TSciKeyCommandCollection);
begin
  FKeyCommands.Assign(Value);
end;

procedure TEditorOptions.SetOptions(Scintilla: TScintilla);
begin
  with Scintilla do
  begin
    try
      LanguageManager.BeginUpdate;
      Color:=FColor;
      Caret.ForeColor:=CaretFore;
      //ColorToRGB(CaretFore);
      Caret.Width:=FCaretWidth;
      Caret.LineVisible :=FCaretLineVisible;
      Caret.LineBackColor :=FCaretBack;
      Colors.SelFore :=SelFore;
      Colors.SelBack :=SelBack;
      Colors.FoldLo :=FFoldLo;
      Colors.FoldHi :=FFoldHi;
      Colors.MarkerFore :=FMarkerFore;
      Colors.MarkerBack :=FMarkerBack;
      Bookmark.BackColor :=FBMarkBack;
      Bookmark.ForeColor :=FBMarkFore;
      ActiveHotSpot.ForeColor:=FHotActiveFore;
      ActiveHotSpot.BackColor:=FHotActiveBack;
      ActiveHotSpot.Underlined :=Self.FHotActiveUnderline;
      ActiveHotSpot.SingleLine :=Self.FHotActiveSingleLine;
      ClearUndoAfterSave :=FSaveClearsUndo;
      EdgeColor:=FEdgeColor;
      EdgeColumn:=FEdgeColumn;
      EdgeMode:=FEdgeType;
      CodePage:=FCodePage;
      Scintilla.FoldMarkers.MarkerType:=FMarkerType;
      if ReadOnly <> FReadOnly then ReadOnly := FReadOnly;
      BraceHilite := FBraceHilite;
      if FGutter <> (Gutter1.Width <> 0) then
      begin
        if FGutter then  Gutter1.Width := 16
          else
            Gutter1.Width := 0;
      end;
      if WordWrap <> FWordWrap then WordWrap := FWordWrap;
      if FLineNumbers <> (Gutter0.Width <> 0) then
      begin
        if FLineNumbers then
        begin
          Gutter0.Width := 32;
          Gutter0.MarginType := gutLineNumber;
        end else
          Gutter0.Width := 0;
      end;
      if Indentation <> FIndentation then
        Indentation := FIndentation;
      if CodeFolding<>Folding then
      begin
        Folding:=CodeFolding;
      end;
      if IndentWidth <> FIndentWidth then
        IndentWidth := FIndentWidth;
      if TabWidth <> FTabWidth then
        TabWidth := FTabWidth;
      if EOLStyle <> FEOLStyle then
        EOLStyle := FEOLStyle;
      if (Font.Name <> FFont.Name) or (Font.Size <> FFont.Size) or (Font.Charset <> FFont.Charset) or (Font.Style <> FFont.Style) or (Font.Color<>FFont.Color) then
        Font := FFont;
      LanguageManager.Assign(Self.FLanguageManager);
    finally
      LanguageManager.EndUpdate;
    end;
    //LanguageManager.Update;
    KeyCommands.Assign(FKeyCommands);
  end;
end;

procedure TEditorOptions.SetLanguageManager(const Value: TSciLanguageManager);
begin
  FLanguageManager.Assign(Value);
end;

{ TEdOptionsWindow }

function TEdOptionsWindow.CurrentLang : TSciLangItem;
begin
  Result:=FEditorOptions.LanguageManager.LanguageList.GetStyleList(LanguageCB.Items[LanguageCB.ItemIndex]);
end;

procedure TEdOptionsWindow.SetEditor(const Value: TScintilla);
var
xitm : TSciLangItem;
i : Integer;
cp : String;
begin
  FEditor := Value;
  RescanLanguageList;
  fEditorOptions.GetOptions(Editor);
  with fEditorOptions do
  begin
    ReadOnlyCB.Checked := ReadOnly;
    BraceHiliteCB.Checked := BraceHilite;
    GutterCB.Checked := Gutter;
    WordWrapCB.ItemIndex:= LongInt(WordWrap);
    LineNumbersCB.Checked := LineNumbers;
    KeepIndentCB.Checked := SciLexerMemo.KeepIndent in Indentation;
    TabIndentsCB.Checked := SciLexerMemo.TabIndents in Indentation;
    BackSpaceUnindentsCB.Checked := SciLexerMemo.BackSpaceUnindents in Indentation;
    IndentationGuidesCB.Checked := SciLexerMemo.IndentationGuides in Indentation;
    CodeFoldingCB.Checked := (foldFold in CodeFolding);
    TabWidthSE.Text := IntToStr(TabWidth);
    IndentWidthSE.Text := IntToStr(IndentWidth);
    EOLStyleCB.ItemIndex := Integer(EOLStyle);
    CaretCB.Selected:=CaretFore;
    SelForeCB.Selected:=SelFore;
    SelBackCB.Selected:=SelBack;
    CaretWidthSE.Text:=IntToStr(CaretWidth);
    CaretLineVisCB.Checked :=CaretLineVisible;
    CaretBackCB.Selected :=CaretBack;
    FoldLoCB.Selected :=FoldLo;
    FoldHiCB.Selected :=FoldHi;
    MarkerForeCB.Selected :=MarkerFore;
    MarkerBackCB.Selected :=MarkerBack;
    BMarkForeCB.Selected :=BMarkFore;
    BMarkBackCB.Selected :=BMarkBack;
    HotActiveForeCB.Selected:=HotActiveFore;
    HotActiveBackCB.Selected:=HotActiveBack;
    HotActiveUnderlineCB.Checked:=HotActiveUnderline;
    HotActiveSingleLineCB.Checked:=HotActiveSingleLine;
    SaveClearsUndoCB.Checked :=XSaveClearsUndo;
    EdgeColorCB.Selected:=EdgeColor;
    EdgeColumnSE.Text:=IntToStr(EdgeColumn);
    EdgeTypeCB.ItemIndex:=LongInt(EdgeType);
    markerTypeCB.ItemIndex:=LongInt(MarkerType);
    defaultBackgroundCB.Selected:=Color;
    //  Syntax Highlighter
    LanguageCB.ItemIndex := LanguageCB.Items.IndexOf(LanguageManager.SelectedLanguage);
    xitm:=LanguageManager.LanguageList.Find(LanguageManager.SelectedLanguage);

    if CodePageToIdent(CodePage,cp) then
    begin
      i:=FindStrInList(cp,CodePageCB.Items);
      if (i>=0) then
      begin
        CodePageCB.ItemIndex:=i;
      end;
    end;

    UpdateStyles(xitm);
    UpdateKeywords(xitm);
    UpdateKeyCommands;
    UpdateOther(xitm);
  end;
  fEditor.LanguageManager.FillListWithLanguages(lexerforlangCB.Items,[sciLexers]);
  i:=FindStrInList(xitm.Lexer,lexerforlangCB.Items);
  if (i>=0) then
  begin
    lexerforlangCB.ItemIndex:=i;
  end;
  fOldEditorOptions.Assign(FEditorOptions);
end;

procedure TEdOptionsWindow.UpdateOther(curlng : TSciLangItem);
var
itm : TSciLangItem;
langstr : String;
i : Integer;
begin
  if curlng=nil then
  begin
    langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
    itm:=FEditorOptions.FLanguageManager.LanguageList.GetStyleList(langstr);
  end else
    itm:=curlng;
  commentBoxStart.Text:=itm.CommentBoxStart;
  commentBoxEnd.Text:=itm.CommentBoxEnd;
  commentBoxMiddle.Text:=itm.CommentBoxMiddle;
  commentStreamStart.Text:=itm.CommentStreamStart;
  commentStreamEnd.Text:=itm.CommentStreamEnd;
  commentBlock.Text:=itm.CommentBlock;
  AssignmentOperatorED.Text:=itm.AssignmentOperator;
  EndOfStatementED.Text:=itm.EndOfStatementOperator;
  NumStyleBitsED.Text:=ToStr(itm.NumStyleBits);
  i:=FindStrInList(itm.Lexer,lexerforlangCB.Items);
  if (i>=0) then
  begin
    lexerforlangCB.ItemIndex:=i;
  end;
end;

procedure TEdOptionsWindow.UpdateStyles(curlng : TSciLangItem);
Var
  i : Integer;
  itm : TSciLangItem;
  langstr : String;
begin
  langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
  with FEditorOptions do
  begin
    StylesLB.Items.BeginUpdate;
    try
      StylesLB.Items.Clear;
      if AnsiCompareText(langstr,cContainerLexer)=0 then
      begin
        highlighterPageCtrl.Enabled:=False;
        remLangButton.Enabled:=False;
        copyLangButton.Enabled:=False;

        StylesLB.Items.Add(sSetByCodeOnly);
        StylesLB.Items.Add(sSeeTheHelp);
      end else
      begin
        if (highlighterPageCtrl.Enabled=False) then
          highlighterPageCtrl.Enabled:=True;
        if remLangButton.Enabled=False then remLangButton.Enabled:=True;
        if copyLangButton.Enabled=False then copyLangButton.Enabled:=True;
        if assigned(curlng) then
          itm:=curlng
        else itm:=FLanguageManager.LanguageList.GetStyleList(langstr);
        for i := 0 to itm.Styles.Count - 1 do
          with itm.Styles.Items[i] as TSciStyle do
            StylesLB.Items.Add(Name);
      end;
    finally
      StylesLB.Items.EndUpdate;
    end;
    if AnsiCompareText(langstr,cContainerLexer)<>0 then
    begin
      if StylesLB.Count > 0 then
      begin
        StyleDefGB.Enabled := True;
        StylesLB.ItemIndex := 0;
        StylesLBClick(Self);
      end else
        StyleDefGB.Enabled := False;
    end;
  end;
end;

procedure TEdOptionsWindow.UpdateKeywords(curlng : TSciLangItem);
Var
  i : Integer;
  itm : TSciLangItem;
  langstr : String;
begin
  langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
  with FEditorOptions do
  begin
    KeyListsLB.Items.BeginUpdate;
    try
      KeyListsLB.Items.Clear;
      if AnsiCompareText(langstr,cContainerLexer)=0 then
      begin
        highlighterPageCtrl.Enabled:=False;
        remLangButton.Enabled:=False;
        copyLangButton.Enabled:=False;
        KeylistsLB.Items.Add(sSetByCodeOnly);
        KeylistsLB.Items.Add(sSeeTheHelp);
      end else
      begin
        if (highlighterPageCtrl.Enabled=False) then
          highlighterPageCtrl.Enabled:=True;
        if remLangButton.Enabled=False then remLangButton.Enabled:=True;
        if copyLangButton.Enabled=False then copyLangButton.Enabled:=True;
        if assigned(curlng) then
          itm:=curlng
        else
          itm:=FLanguageManager.LanguageList.GetStyleList(langstr);
        for i := 0 to itm.Keywords.Count - 1 do
          with itm.Keywords.Items[i] as TSciKeywords do
            KeyListsLB.Items.Add(Name);
      end;
    finally
      KeyListsLB.Items.EndUpdate;
    end;
    if AnsiCompareText(langstr,cContainerLexer)<>0 then
    begin
      if KeyListsLB.Count > 0 then
      begin
        KeywordsM.Enabled := True;
        KeyListsLB.ItemIndex := 0;
        KeyListsLBClick(Self);
      end else
      begin
        KeywordsM.Text := '';
        KeywordsM.Enabled := False;
      end;
    end;
  end;
end;

procedure TEdOptionsWindow.UpdateKeyCommands;
Var
  i : Integer;
  KeyCommand : TSciKeyCommand;
  Item : TListItem;
  Ident : string;
begin
  KeyCmdList.Items.BeginUpdate;
  try
    KeyCmdList.Clear;
    for i := 0 to fEditorOptions.fKeyCommands.Count - 1 do
    begin
      KeyCommand := fEditorOptions.fKeyCommands.Items[i] as TSciKeyCommand;
      Item := KeyCmdList.Items.Add;
      Ident:='Unknown';
      IntToIdent(KeyCommand.Command, Ident, Sci_KeyboardCommandMap);
      Item.Caption:=Ident;
      Item.SubItems.Add(ShortCutToText(KeyCommand.ShortCut));
      Item.Data := KeyCommand;
    end;
  finally
    KeyCmdList.Items.EndUpdate;
  end;
end;

procedure   TEdOptionsWindow.RescanLanguageList;
var
cnt,i : Integer;
begin
  LanguageCB.Items.Clear;
  cnt :=FEditor.LanguageManager.LanguageList.Count;
  for i:=0 to (cnt-1) do
  begin
    LanguageCB.Items.Add(FEditor.LanguageManager.LanguageList.Items[i].Name);
  end;
  if (LanguageCB.Items.IndexOf(cContainerLexer)=-1) then
  begin
    LanguageCB.Items.Add(cContainerLexer);
  end;
end;

procedure TEdOptionsWindow.FormCreate(Sender: TObject);
begin
  fEditorOptions := TEditorOptions.Create;
  fOldEditorOptions := TEditorOptions.Create;
  GetCodePageValues(CodePageCB.Items.Append);
end;

procedure TEdOptionsWindow.FormDestroy(Sender: TObject);
begin
  FreeAndNil(fEditorOptions);
  FreeAndNil(fOldEditorOptions);
end;

procedure TEdOptionsWindow.KeyCmdListCompare(Sender: TObject; Item1,
  Item2: TListItem; Data: Integer; var Compare: Integer);
begin
  Compare:=CompStr(Item1.Caption,Item2.Caption);
end;

procedure TEdOptionsWindow.AssignmentOperatorEDChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.AssignmentOperator:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.EndOfStatementEDChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.EndOfStatementOperator:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.commentBoxStartChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentBoxStart:=TEdit(Sender).Text;

end;

procedure TEdOptionsWindow.commentBoxMiddleChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentBoxMiddle:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.commentBoxEndChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentBoxEnd:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.commentBlockChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentBlock:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.commentStreamStartChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentStreamStart:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.commentStreamEndChange(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.CommentStreamEnd:=TEdit(Sender).Text;
end;

procedure TEdOptionsWindow.lexerforlangCBExit(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  if itm.Lexer<>lexerforlangCB.Text then
    itm.Lexer:=lexerforlangCB.Text;
end;

procedure TEdOptionsWindow.NumStyleBitsEDExit(Sender: TObject);
var
  itm : TSciLangItem;
begin
  itm:=CurrentLang;
  itm.NumStyleBits:=ToInt(TEdit(Sender).Text);
end;

procedure TEdOptionsWindow.LoadKeyCommands1Click(Sender: TObject);
begin
  if odia.Execute then
  begin
    LoadKeyCommands(fEditorOptions.fKeyCommands,odia.FileName);
    UpdateKeyCommands;
  end;
end;

procedure TEdOptionsWindow.SaveKeycommands1Click(Sender: TObject);
begin
  if sdia.Execute then
    SaveKeyCommands(fEditorOptions.fKeyCommands,sdia.FileName);
end;

procedure TEdOptionsWindow.StyleNumberSEKeyPress(Sender : TObject;var ch : Char);
begin
  TestNumericOnly(Sender,ch);
  if ch<>#0 then StyleElementChanged(Sender);
end;

procedure TEdOptionsWindow.ApplyBtnClick(Sender: TObject);
var
  cp : LongInt;
begin
  with fEditorOptions do
  begin
    Color:=defaultBackgroundCB.Selected;
    ReadOnly := ReadOnlyCB.Checked;
    BraceHilite := BraceHiliteCB.Checked;
    Gutter := GutterCB.Checked;
    WordWrap := TWordWrapType(WordWrapCB.ItemIndex);
    LineNumbers := LineNumbersCB.Checked;
    XSaveClearsUndo :=SaveClearsUndoCB.Checked;
    Indentation := [];
    if KeepIndentCB.Checked then
      Indentation := Indentation + [SciLexerMemo.KeepIndent];
    if TabIndentsCB.Checked then
      Indentation := Indentation + [SciLexerMemo.TabIndents];
    if BackSpaceUnindentsCB.Checked then
      Indentation := Indentation + [SciLexerMemo.BackSpaceUnindents];
    if IndentationGuidesCB.Checked then
      Indentation := Indentation + [SciLexerMemo.IndentationGuides];
    if CodeFoldingCB.Checked then
    CodeFolding := CodeFolding+[foldFold]
    else
    CodeFolding := CodeFolding-[foldFold];

    TabWidth := ToInt(TabWidthSE.Text);
    IndentWidth := ToInt(IndentWidthSE.Text);
    EOLStyle := TEOLStyle(EOLStyleCB.ItemIndex);
    CaretFore :=CaretCB.Selected;
    SelFore :=SelForeCB.Selected;
    SelBack :=SelBackCB.Selected;
    FoldLo :=FoldLoCB.Selected;
    FoldHi :=FoldHiCB.Selected;
    MarkerFore:=MarkerForeCB.Selected;
    MarkerBack:=MarkerBackCB.Selected;
    BMarkFore :=BMarkForeCB.Selected;
    BMarkBack :=BMarkBackCB.Selected;

    HotActiveFore:=HotActiveForeCB.Selected;
    HotActiveBack :=HotActiveBackCB.Selected;
    HotActiveUnderline :=HotActiveUnderlineCB.Checked;
    HotActiveSingleLine :=HotActiveSingleLineCB.Checked;
    CaretWidth :=ToInt(CaretWidthSE.Text);
    CaretBack :=CaretBackCB.Selected;
    CaretLineVisible :=CaretLineVisCB.Checked;
    EdgeColor:=EdgeColorCB.Selected;
    MarkerType:=sciMarkerType(markerTypeCB.ItemIndex);
    EdgeColumn:=ToInt(EdgeColumnSE.Text);
    EdgeType:=sciEdgeType(EdgeTypeCB.ItemIndex);

    if IdentToCodePage(CodePageCB.Items.Strings[CodePageCB.ItemIndex],cp) then
      CodePage:=cp;
    if Assigned(Editor) then
      SetOptions(FEditor);
  end;
end;

procedure TEdOptionsWindow.FontButtonClick(Sender: TObject);
begin
  FontDialog.Font := fEditorOptions.Font;
  if FontDialog.Execute then
    fEditorOptions.Font := FontDialog.Font;
end;

procedure TEdOptionsWindow.OKBtnClick(Sender: TObject);
begin
  ApplyBtnClick(Self);
end;

procedure TEdOptionsWindow.CancelBtnClick(Sender: TObject);
begin
// removed by hdalis.. No need to refresh the styles if nothing isn't changed.. I thing..
//  if not Assigned(Scintilla) then Exit;
//  fOldEditorOptions.SetOptions(FEditor);
end;

procedure TEdOptionsWindow.StylesLBClick(Sender: TObject);
Var
  SciStyle : TSciStyle;
  langstr : String;
begin
  if StylesLB.ItemIndex >= 0 then
  begin
    // To avoid getting into StyleElementChanged
    UpdatingStyle := True;

    langstr :=LanguageCB.Items[LanguageCB.ItemIndex];
    SciStyle := FEditorOptions.LanguageManager.LanguageList.GetStyleList(langstr).Styles.Items[StylesLB.ItemIndex] as TSciStyle;
    StyleNumberSE.Text := IntToStr(SciStyle.StyleNumber);
    DescriptionEB.Text := SciStyle.Name;
    if SciStyle.FontName = '' then
    begin
      FontCB.FontName := '';
      FontCB.Enabled:=False;
      DefaultFontCB.Checked := True;
    end else
    begin
      FontCB.FontName := SciStyle.FontName;
      FontCB.Enabled:=True;
      DefaultFontCB.Checked := False;
    end;
    SizeSE.Text := IntToStr(SciStyle.FontSize);
    if SciStyle.StyleNumber=STYLE_CONTROLCHAR then
    begin
      ForeCB.Enabled:=False;
      BackCB.Enabled:=False;
    end else
    begin
      if ForeCB.Enabled=False then ForeCB.Enabled:=True;
      if BackCB.Enabled=False then BackCB.Enabled:=True;

      ForeCB.Selected := SciStyle.ForeColor;
      ForeCB.Repaint;
      BackCB.Selected := SciStyle.BackColor;
      BackCB.Repaint;
    end;
    CaseCB.ItemIndex := Integer(SciStyle.CharCase);
    ItalicCB.Checked := fsItalic in SciStyle.FontStyles;
    BoldCB.Checked := fsBold in SciStyle.FontStyles;
    UnderlineCB.Checked := fsUnderline in SciStyle.FontStyles;
    VisibleCB.Checked := SciStyle.Visible;
    ChangeableCB.Checked := SciStyle.Changeable;
    EOLFilledCB.Checked := SciStyle.EOLFilled;
    HotspotCB.Checked := SciStyle.Hotspot;
    // Now set it to false
    UpdatingStyle := False;
  end;
end;

procedure TEdOptionsWindow.LanguageCBChange(Sender: TObject);
var
langstr : String;
itm : TSciLangItem;
begin
  langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
  fEditorOptions.LanguageManager.SelectedLanguage := langstr;
  itm:=fEditorOptions.LanguageManager.LanguageList.Find(langstr);
  UpdateStyles(itm);
  UpdateKeywords(itm);
  UpdateOther(itm);
end;

procedure TEdOptionsWindow.StyleElementChanged(Sender: TObject);
Var
  SciStyle : TSciStyle;
begin
  if UpdatingStyle then
    Exit;
  if StylesLB.ItemIndex >= 0 then
  begin
    SciStyle := FEditorOptions.LanguageManager.LanguageList.GetStyleList(LanguageCB.Items[LanguageCB.ItemIndex]).Styles.Items[StylesLB.ItemIndex] as TSciStyle;
    SciStyle.StyleNumber := ToInt(StyleNumberSE.Text);
    SciStyle.Name := DescriptionEB.Text;
    StylesLB.Items[StylesLB.ItemIndex] := DescriptionEB.Text;
    if DefaultFontCB.Checked=True then
    begin
      SciStyle.FontName := '';
      FontCB.Enabled:=False;
    end  else
    begin
      SciStyle.FontName := FontCB.FontName;
      FontCB.Enabled:=True;
    end;
    SciStyle.FontSize := ToInt(SizeSE.Text);
    SciStyle.ForeColor := ForeCB.Selected;
    SciStyle.BackColor := BackCB.Selected;
    SciStyle.CharCase := TSciCase(CaseCB.ItemIndex);
    SciStyle.FontStyles := [];
    if ItalicCB.Checked then
      SciStyle.FontStyles := SciStyle.FontStyles + [fsItalic];
    if BoldCB.Checked then
      SciStyle.FontStyles := SciStyle.FontStyles + [fsBold];
    if UnderlineCB.Checked then
      SciStyle.FontStyles := SciStyle.FontStyles + [fsUnderline];
    SciStyle.Visible := VisibleCB.Checked;
    SciStyle.Changeable := ChangeableCB.Checked;
    SciStyle.EOLFilled := EOLFilledCB.Checked;
    SciStyle.Hotspot := HotspotCB.Checked;
  end;
end;

procedure TEdOptionsWindow.DeleteStyleBClick(Sender: TObject);
var
itm : TSciLangItem;
style : TSciStyle;
begin
  if StylesLB.ItemIndex >= 0 then
  begin
    itm:=CurrentLang;
    style:=itm.Styles.Items[StylesLB.ItemIndex];
    FreeAndNil(style);
    StylesLB.Items.Delete(StylesLB.ItemIndex);
    UpdateStyles(itm);
  end;
end;

procedure TEdOptionsWindow.AddStyleBClick(Sender: TObject);
var
  langstr : String;
  stylescnt : Integer;
  itm : TSciLangItem;

begin
  langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
  itm:=FEditorOptions.LanguageManager.LanguageList.GetStyleList(langstr);
  with itm.Styles.Add as TSciStyle do
  begin
    Name := sNewStyle;
    StyleNumber :=  itm.Styles.Count-1;
  end;
  UpdateStyles(itm);
  stylescnt:=StylesLB.Items.Count;
  StylesLB.Selected[stylescnt-1] := True;
  StylesLBClick(Self);
end;

procedure TEdOptionsWindow.KeyListsLBClick(Sender: TObject);
var
  SciKeywords : TSciKeywords;
  itm : TSciLangItem;
begin
  if KeyListsLB.ItemIndex >= 0 then
  begin
    // To avoid getting into KeyListElementChanged
    UpdatingKeyList := True;
    itm:=CurrentLang;
    SciKeywords := itm.Keywords.Items[KeyListsLB.ItemIndex] as TSciKeywords;
    KeyListNumberSE.Text := IntToStr(SciKeywords.KeywordListNumber);
    KeyListDescriptionEB.Text := SciKeywords.Name;
{$Ifdef COMPILER6_UP}
    SciKeywords.Keywords.Delimiter := ' ';
    KeywordsM.Text := SciKeywords.Keywords.DelimitedText;
{$Else}
    KeywordsM.Text:=MergeStrings(SciKeywords.Keywords);
{$Endif}
    UpdatingKeyList := False;
  end;
end;

procedure TEdOptionsWindow.KeyListElementsChange(Sender: TObject);
Var
  SciKeywords : TSciKeywords;
begin
  if UpdatingKeyList then
    Exit;
  if KeyListsLB.ItemIndex >= 0 then
  begin
    SciKeywords := CurrentLang.Keywords.Items[KeyListsLB.ItemIndex] as TSciKeywords;
    SciKeywords.Name := KeyListDescriptionEB.Text;
    KeyListsLB.Items[KeyListsLB.ItemIndex] := KeyListDescriptionEB.Text;
    SciKeywords.KeywordListNumber := ToInt(KeyListNumberSE.Text);
{$Ifdef COMPILER6_UP}
    SciKeywords.Keywords.Delimiter := ' ';
    SciKeywords.Keywords.DelimitedText := KeywordsM.Text;
{$Else}
    SplitStrings(KeywordsM.Text,SciKeywords.Keywords);
{$Endif}
  end;
end;

procedure TEdOptionsWindow.KeyListDeleteClick(Sender: TObject);
var
  keywd : TSciKeywords;
begin
  if KeyListsLB.ItemIndex >= 0 then
  begin
    keywd:=CurrentLang.Keywords.Items[KeyListsLB.ItemIndex];
    FreeAndNil(keywd);
    KeyListsLB.Items.Delete(KeyListsLB.ItemIndex);
    UpdateKeywords;
  end;
end;

procedure TEdOptionsWindow.KeyListAddClick(Sender: TObject);
var
  langstr : String;
  itm : TSciLangItem;
begin
  langstr:=LanguageCB.Items[LanguageCB.ItemIndex];
  itm:=FEditorOptions.LanguageManager.LanguageList.GetStyleList(langstr);
  with itm.Keywords.Add as TSciKeywords do
  begin
    Name := sNewKeyList;
    KeywordListNumber:=  itm.Keywords.Count-1;
  end;
  UpdateKeywords(itm);
  KeyListsLB.Selected[KeyListsLB.Items.Count-1] := True;
  KeyListsLBClick(Self);
end;

procedure TEdOptionsWindow.btnDeleteClick(Sender: TObject);
var
  keyc : TSciKeyCommand;
begin
  if Assigned(KeyCmdList.Selected) then
  begin
    keyc:=TSciKeyCommand(KeyCmdList.Selected.Data);
    FreeAndNil(keyc);
    UpdateKeyCommands;
  end;
end;

procedure TEdOptionsWindow.btnResetClick(Sender: TObject);
begin
  fEditorOptions.fKeyCommands.ResetDefaultCommands;
  UpdateKeyCommands;
end;

procedure TEdOptionsWindow.btnEditClick(Sender: TObject);
Var
  KeyCommand : TSciKeyCommand;
begin
  if Assigned(KeyCmdList.Selected) then
  begin
    KeyCommand := TSciKeyCommand(KeyCmdList.Selected.Data);
    with TKeyEditForm.Create(Self) do
    begin
      cmbCommand.ItemIndex :=  cmbCommand.Items.IndexOf(KeyCmdList.Selected.Caption);

      HotKey.HotKey := KeyCommand.ShortCut;
      if (ShowModal = mrOK) and (cmbCommand.ItemIndex >= 0) and (HotKey.HotKey <> 0) then
      begin
        KeyCommand.ShortCut := HotKey.HotKey;
        KeyCommand.Command :=  Integer(cmbCommand.Items.Objects[cmbCommand.ItemIndex]);
        UpdateKeyCommands;
      end;
      Release;
    end;
  end;
end;


procedure TEdOptionsWindow.btnAddClick(Sender: TObject);
Var
  KeyCommand : TSciKeyCommand;
begin
    with TKeyEditForm.Create(Self) do
    begin
      if (ShowModal = mrOK) and (cmbCommand.ItemIndex >= 0) and (HotKey.HotKey <> 0) then
      begin
        KeyCommand := fEditorOptions.fKeyCommands.FindShortCut(HotKey.HotKey);
        if not Assigned(KeyCommand) then
          KeyCommand := fEditorOptions.fKeyCommands.Add as TSciKeyCommand;
        KeyCommand.ShortCut := HotKey.HotKey;
        KeyCommand.Command :=  Integer(cmbCommand.Items.Objects[cmbCommand.ItemIndex]);
        UpdateKeyCommands;
      end;
      Release;
    end;
end;

procedure TEdOptionsWindow.TestNumericOnly(Sender: TObject; var Key: Char);
begin
  if (Key>#31) and ((Key<'0') or (Key>'9')) then Key:=#0;
end;

procedure TEdOptionsWindow.addLangButtonClick(Sender: TObject);
var
  itm : TSciLangItem;
  itmpos : Integer;
begin
  sciAddLanguageForm:=TsciAddLanguageForm.Create(self);
  FEditorOptions.FLanguageManager.FillListWithLanguages(sciAddLanguageForm.LexerToUseCB.Items,[sciLexers]);
  sciAddLanguageForm.LexerToUseCB.ItemIndex:=sciAddLanguageForm.LexerToUseCB.Items.IndexOf('null');
  if sciAddLanguageForm.ShowModal=mrOk then
  begin
    itm:=FEditorOptions.FLanguageManager.AddLanguage(sciAddLanguageForm.languagename.Text,sciAddLanguageForm.LexerToUseCB.Items[sciAddLanguageForm.LexerToUseCB.ItemIndex]);
    if itm<>nil then
    begin
      itmpos:=LanguageCB.Items.Add(sciAddLanguageForm.languagename.Text);
      if itmpos>=0 then
      begin
        //Just check to see if we have this message first.
        LanguageCB.ItemIndex:=itmpos;
        LanguageCBChange(self);
        if (LanguageCB.Items.Count>0) then
          highlighterPageCtrl.Enabled:=True
        else
          highlighterPageCtrl.Enabled:=False;
      end;
    end else
      raise Exception.Create(eCouldntAddTheLanguage);
  end;
end;

procedure TEdOptionsWindow.remLangButtonClick(Sender: TObject);
var
  itmpos : Integer;
  langstr : String;
  notinstat : Boolean;
begin
  itmpos:=LanguageCB.ItemIndex;
  if itmpos=-1 then Exit;
  langstr:=LanguageCB.Items[itmpos];
  if AnsiCompareText(langstr,cContainerLexer)=0 then
  begin
    raise Exception.Create(eCantRemoveLanguage);
    Exit;
  end;

  if(FEditorOptions.FLanguageManager.RemoveLanguage(langstr,notinstat)=True) then
  begin
    if notinstat=True then //if not a static lexer
    begin
      try
        LanguageCB.Items.BeginUpdate;
        LanguageCB.Items.Delete(itmpos);
        if itmpos>=LanguageCB.Items.Count then
          itmpos:=(LanguageCB.Items.Count-1)
        else
          Dec(itmpos);
        LanguageCB.ItemIndex:=itmpos;
        LanguageCBChange(self);
      finally
        LanguageCB.Items.EndUpdate;
      end;
      if (LanguageCB.Items.Count>0) then
        highlighterPageCtrl.Enabled:=True
      else
        highlighterPageCtrl.Enabled:=False;

    end else //it was a static lexer, just update the styles and keywords.
    begin
      UpdateStyles;
      UpdateKeywords;
    end;
  end;

end;

procedure TEdOptionsWindow.copyLangButtonClick(Sender: TObject);
var
  srclang,langstr : String;
  itm : TSciLangItem;
begin
  srclang:=LanguageCB.Items[LanguageCB.ItemIndex];
  if AnsiCompareText(srclang,cContainerLexer)=0 then
  begin
    raise Exception.Create(eCantCopyLanguage);
    Exit;
  end;

  itm:=FEditorOptions.FLanguageManager.DupLanguage(srclang);
  if itm<>nil then
  begin
    langstr:=sLMLanguage+'['+IntToStr(itm.ID)+']';
    if(InputQuery(Format(sCopyLanguageQueryTitle,[srclang]),sNameOfNewLanguage,langstr)) then
    begin
    itm.Name:=langstr;
    LanguageCB.ItemIndex:=LanguageCB.Items.Add(itm.Name);
    LanguageCBChange(self);
    end else
    FEditorOptions.FLanguageManager.LanguageList.Delete(itm.Index);
  end else
  raise Exception.CreateResFmt(@eCouldntCopyLangTo,[srclang,langstr]);
end;

procedure TEdOptionsWindow.OptionPagesChange(Sender: TObject);
begin
  if OptionPages.Showing then
  begin
    case OptionPages.ActivePageIndex of
      0: GutterCB.SetFocus;
      1: SelForeCB.SetFocus;
      2: LanguageCB.SetFocus;
      3: KeyCmdList.SetFocus;
    end;
  end;
end;


end.

Added src/delphisci/LangResources.RES.

cannot compute difference between binary files

Added src/delphisci/LangResources.rc.



>
1
BuiltInLangs 10 "h:\\MyEditor\\Styles\\Black.styles"

Added src/delphisci/SciActions.pas.























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author : hdalis
  Created: 27/06/2005, 19:51:14
  History: 27/06/2005 Initial Release
           18/05/2006 inherited wasn't called in the destructor of TSciActionBase, resulting in
                      a small memoryleak. Fixed.
      $Id: $
}
{$Include SciCommonDef.Inc}
unit SciActions;
interface
uses Classes,ActnList,SciLexer;
  type
  TSciActionBase=class(TAction)
  private
    FControl : TScintillaBase;
  protected
    procedure SetControl(Value : TScintillaBase);
    function GetControl(Target: TObject): TScintillaBase;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure AssignTo(Dest: TPersistent); override;

  public
    function HandlesTarget(Target: TObject): Boolean; override;

    property Control: TScintillaBase read FControl write SetControl;
    destructor Destroy; override;
  end;

  TSciRedo = class(TSciActionBase)
  public
    procedure UpdateTarget(Target: TObject);override;
    procedure ExecuteTarget(Target: TObject);override;
  published
  end;

implementation
destructor TSciActionBase.Destroy;
begin
  if assigned(FControl) then
    FControl.RemoveFreeNotification(Self);
  inherited;
end;
function TSciActionBase.GetControl(Target: TObject): TScintillaBase;
begin
  Result := Target as TScintillaBase;
end;

procedure TSciActionBase.SetControl(Value : TScintillaBase);
begin
  if Value<>FControl then
  begin
    FControl:=Value;
    if Value <> nil then Value.FreeNotification(Self);
  end;
end;
function TSciActionBase.HandlesTarget(Target: TObject): Boolean;
begin
  Result := ((Control <> nil) and (Target = Control) or
    (Control = nil) and (Target is TScintillaBase)) and TScintillaBase(Target).Focused;
end;
procedure TSciActionBase.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) and (AComponent = Control) then Control := nil;
end;

procedure TSciActionBase.AssignTo(Dest: TPersistent);
begin
  inherited AssignTo(Dest);
  if Dest is TSciActionBase then
    TSciActionBase(Dest).Control:=FControl;
end;

procedure TSciRedo.ExecuteTarget(Target: TObject);
begin
  GetControl(Target).Redo;
end;

procedure TSciRedo.UpdateTarget(Target: TObject);
begin
  if (assigned(Target)) and (GetControl(Target).HandleAllocated) and (GetControl(Target).CanRedo) then
    Enabled:=True
  else
    Enabled:=False;
end;
end.

Added src/delphisci/SciActionsRes.ddp.

cannot compute difference between binary files

Added src/delphisci/SciActionsRes.dfm.





































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
object SciActionsData: TSciActionsData
  OldCreateOrder = False
  Left = 234
  Top = 56
  Height = 150
  Width = 215
  object ActionList1: TActionList
    Images = ImageList1
    Left = 82
    Top = 49
    object SciRedo1: TSciRedo
      Category = 'Edit'
      Caption = '&Redo'
      Hint = 'Redo|Reverses the action of the last undo command'
      ImageIndex = 0
      ShortCut = 24666
    end
  end
  object ImageList1: TImageList
    Left = 57
    Top = 18
    Bitmap = {
      494C010101000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
      0000000000003600000028000000400000001000000001002000000000000010
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000008000
      0000808080000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000808080008000
      0000000000000000000000000000000000000000000080000000800000008000
      0000800000008000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000800000000000
      0000000000000000000000000000000000000000000000000000800000008000
      0000800000008000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000800000000000
      0000000000000000000000000000000000000000000000000000000000008000
      0000800000008000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000800000000000
      0000000000000000000000000000000000000000000000000000800000000000
      0000800000008000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000808080008000
      0000000000000000000000000000000000008080800080000000000000000000
      0000000000008000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000008080
      8000800000008000000080000000800000008080800000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      0000000000000000000000000000000000000000000000000000000000000000
      000000000000000000000000000000000000424D3E000000000000003E000000
      2800000040000000100000000100010000000000800000000000000000000000
      000000000000000000000000FFFFFF00FFFF000000000000FFFF000000000000
      FFFF000000000000FFFF000000000000FFFF000000000000E7FF000000000000
      CF83000000000000DFC3000000000000DFE3000000000000DFD3000000000000
      CF3B000000000000E07F000000000000FFFF000000000000FFFF000000000000
      FFFF000000000000FFFF00000000000000000000000000000000000000000000
      000000000000}
  end
end

Added src/delphisci/SciActionsRes.pas.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
unit SciActionsRes;

interface
(*$HPPEMIT '#pragma link "dclact.lib"'*)
uses
  SysUtils, Classes, ImgList, Controls, ActnList, SciActions;

type
  TSciActionsData = class(TDataModule)
    ActionList1: TActionList;
    ImageList1: TImageList;
    SciRedo1: TSciRedo;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SciActionsData: TSciActionsData;

implementation

{$R *.dfm}

end.

Added src/delphisci/SciAutoComplete.pas.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author : hdalis
  Created: 18/11/2004, 19:51:14
  History: 18/11/2004 Initial Release
           12/04/2005 Added the OnBeforeShow event
           15/04/2005 Added MaxWidth,MaxHeight properties and the OnAutoCSelection event
                      to conform to Scintilla 1.63
           03/06/2005 Reintroduced the functionality of NumStartChars.. Hope it works now.
                      Note: The test for NumStartChars is done BEFORE the OnBeforeShow event,
                      and because of that, if there are'nt enough chars in the word typed,
                      then no OnBeforeShow event is fired.
           18/08/2005 Renamed CompleteWord and CompleteWordOnlyOne to FromDocument and FromDocumentOnlyOne,
                      as this more accurately describes its purpose.. CompleteWord is rather understood
                      to complete words or not, and this is a autocomplete component.. ahem..
           23/03/2006 Fixed a bug in StartAutoCompleteWord which caused length of typed word>NumStartChars when it was not.
      $Id: SciAutoComplete.pas,v 1.1 2004/11/18 19:51:14 hdalis Exp $
     TODO: Find a solution to the setting of the properties of a linked component
           without reassigning the properties in the Loaded procedure.
}
{$Include SciCommonDef.Inc}
unit SciAutoComplete;
interface
uses Classes, SciLexer,SciLexerMemo,SciControllerHandler;

type
  //Note: If we are fetching words from the document, then the ListToDisplay is NIL because this event
  //is fired BEFORE we start to search for words.
  TSciBeforeAutoCompleteShowEvent = procedure(Sender : TObject; const Position : LongInt;const TypedLen : Integer;ListToDisplay : TStrings;var CancelDisplay : Boolean) of object;

TSciAutoComplete = class(TComponent)
  private
    FEditor : TScintillaMemo;
    fCharAddedProc : TCharAddedProc;
    fAutoCSelectionProc : TAutoCSelectionProc;
    FAStrings : TStrings;
    FNumStartChars : Integer;
    FTypeSeparator : Char;
    FStopChars,FAutoStrings,FStartChars : String;
    FAutoCompleteDisabled,FAutoCompleteWord,FAutoCompleteWordOnlyOne,
    FAutoCSetIgnoreCase,FAutoCSetChooseSingle,FAutoCSetAutoHide,
    FAutoCSetDropRestOfWord,FAutoCSetCancelAtStart,autoCCausedByOnlyOne : boolean;
    FAutoCompleteWordCharacters : String;
    FOnAutoCSelection : TSCEvent_autocselection; 
    FOnBeforeShow : TSciBeforeAutoCompleteShowEvent;
    procedure setStrings(Value : TStrings);
    procedure setAutoCompleteStopChars(const Value : String);
    procedure setOpt(const Index : Integer;const Value : Boolean);
    function  getOpt(Index : Integer) : Boolean;
    procedure setScintilla(Value : TScintillaMemo);
    procedure detachScintilla;
    procedure setMaxWidth(const Value : Integer);
    procedure setMaxHeight(const Value : Integer);
    function getMaxWidth : Integer;
    function getMaxHeight : Integer;
    procedure setTypeSeparator(Value : Char);
    function  getTypeSeparator : Char;
  protected
    procedure EvtCharAdded (Sender : TObject; const ch : LongInt);virtual;
    procedure EvtAutoCSelection(Sender : TObject;text : PChar);virtual;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
    procedure Loaded; override;

  public
    constructor Create(AOwner : TComponent);override;
    destructor  Destroy; override;
    function  StartAutoCompleteWord(const onlyOneWord : boolean) : Boolean;
    procedure StartAutoComplete;
  published
    property Disabled : Boolean read FAutoCompleteDisabled write FAutoCompleteDisabled default False;
    property NumStartChars : Integer read FNumStartChars write FNumStartChars default 1;
    property StartChars : String read FStartChars write FStartChars;
    property StopChars  : String read FStopChars write setAutoCompleteStopChars;
    property AStrings : TStrings read FAStrings write setStrings;
    property IgnoreCase : Boolean index 0 read getOpt Write setOpt;
    property ChooseSingle : Boolean index 1 read getOpt Write setOpt;
    property AutoHide : Boolean index 2 read getOpt Write setOpt;
    property DropRestOfWord : Boolean index 3 read getOpt Write setOpt;
    property CancelAtStart : Boolean index 4 read getOpt Write setOpt;
    property FromDocument : boolean read FAutoCompleteWord write FAutoCompleteWord default True;
    property FromDocumentOnlyOne : boolean read FAutoCompleteWordOnlyOne write FAutoCompleteWordOnlyOne default False;
    property TypeSeparator : Char read getTypeSeparator write setTypeSeparator default '?';

    property Editor : TScintillaMemo read FEditor write setScintilla;
    property WordCharacters : String read FAutoCompleteWordCharacters write FAutoCompleteWordCharacters;
    property OnBeforeShow : TSciBeforeAutoCompleteShowEvent read FOnBeforeShow write FOnBeforeShow;
    property MaxWidth : Integer read getMaxWidth write setMaxWidth;
    property MaxHeight : Integer read getMaxHeight write setMaxHeight;
    property OnAutoCSelection : TSCEvent_autocselection read FOnAutoCSelection write FOnAutoCSelection;
  end;


implementation

uses Math,SciSupport,sciUtils,SysUtils;

// TSciAutoComplete
constructor TSciAutoComplete.Create(AOwner : TComponent);
begin
  Inherited Create(AOwner);
  FEditor := nil;
  FStartChars :='';
  FStopChars :='';
  FAutoCompleteWordCharacters:='';
  FAutoCompleteWord:=True;
  FAutoCompleteWordOnlyOne:=False;
  FTypeSeparator:='?';
  FNumStartChars:=1;
  FAutoCompleteDisabled:=False;
  FAStrings :=TMyStringList.Create;
  TMyStringList(FAStrings).Sorted:=true;
  TMyStringList(FAStrings).Duplicates :=dupIgnore;
  FCharAddedProc:=TCharAddedProc.Create(EvtCharAdded);
  FAutoCSelectionProc:=TAutoCSelectionProc.Create(EvtAutoCSelection);
end;

destructor TSciAutoComplete.Destroy;
begin
  DetachScintilla;
  if assigned(FAStrings) then FreeAndNil(FAStrings);
  if assigned(fCharAddedProc) then FreeAndNil(FCharAddedProc);
  if assigned(FAutoCSelectionProc) then FreeAndNil(FAutoCSelectionProc);
  inherited Destroy;
end;

procedure TSciAutoComplete.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent,Operation);
  if assigned(AComponent) then
  begin
    if Operation=opRemove then
    begin
      if AComponent=FEditor then
      begin
        DetachScintilla;
        FEditor:=nil;
      end;
    end;
  end;
end;

procedure TSciAutoComplete.Loaded;
begin
  if assigned(FEditor) then
  begin
    {Update the connected Scintilla control with the settings here, as we don't have any Editor attached before now}
    IgnoreCase:=FAutoCSetIgnoreCase;
    ChooseSingle:=FAutoCSetChooseSingle;
    AutoHide:=FAutoCSetAutoHide;
    DropRestOfWord:=FAutoCSetDropRestOfWord;
    CancelAtStart:=FAutoCSetCancelAtStart;
    StopChars:=FStopChars;
  end;
end;

procedure TSciAutoComplete.detachScintilla;
begin
  if assigned(FEditor) then
  begin
    FEditor.RemoveHandler(FCharAddedProc);
    FEditor.RemoveHandler(FAutoCSelectionProc);
  end;
  FEditor:=nil;
end;

procedure TSciAutoComplete.setScintilla(Value : TScintillaMemo);
begin
  if assigned(Value) then
  begin
    DetachScintilla;
    FEditor:=Value;
    if FAutoCompleteWordCharacters='' then
      FAutoCompleteWordCharacters:=FEditor.WordChars;
    FEditor.AddHandler(FCharAddedProc);
    FEditor.AddHandler(FAutoCSelectionProc);
  end else
  begin
    DetachScintilla;
  end;
end;

procedure TSciAutoComplete.setTypeSeparator(Value : Char);
begin
  FTypeSeparator:=Value;
  if not assigned(FEditor) then Exit;
  fEditor.AutoCSetTypeSeparator(Integer(Value));
end;

function  TSciAutoComplete.getTypeSeparator : Char;
begin
  if not assigned(FEditor) then
    Result:=FTypeSeparator
  else
    Result:=Char(fEditor.AutoCGetTypeSeparator);
end;

procedure TSciAutoComplete.setMaxWidth(const Value : Integer);
begin
  if not assigned(FEditor) then Exit;
  FEditor.AutoCSetMaxWidth(Value);
end;

procedure TSciAutoComplete.setMaxHeight(const Value : Integer);
begin
  if not assigned(FEditor) then Exit;
  FEditor.AutoCSetMaxHeight(Value);
end;

function TSciAutoComplete.getMaxWidth : Integer;
begin
  if not assigned(FEditor) then
  begin
    Result:=0;
    Exit;
  end;
  Result:=FEditor.AutoCGetMaxWidth;
end;

function TSciAutoComplete.getMaxHeight : Integer;
begin
  if not assigned(FEditor) then
  begin
    Result:=0;
    Exit;
  end;
  Result:=FEditor.AutoCGetMaxHeight;
end;

procedure TSciAutoComplete.setOpt(const Index : Integer;const Value : Boolean);
begin
  case Index of // Set backup variables, so that when Loaded is called we can assign the settings.
    0:  FAutoCSetIgnoreCase:=Value;
    1:  FAutoCSetChooseSingle:=Value;
    2:  FAutoCSetAutoHide:=Value;
    3:  FAutoCSetDropRestOfWord:=Value;
    4:  FAutoCSetCancelAtStart:=Value;
  end;
  if FEditor=nil then Exit; // Exit if we don't have any attached control.
  case Index of
    0: FEditor.AutoCSetIgnoreCase(Value);
    1: FEditor.AutoCSetChooseSingle(Value);
    2: FEditor.AutoCSetAutoHide(Value);
    3: FEditor.AutoCSetDropRestOfWord(Value);
    4: FEditor.AutoCSetCancelAtStart(Value);
  end;
end;

function TSciAutoComplete.getOpt(Index : Integer) : Boolean;
begin
  if FEditor=nil then
  begin
    case Index of // Return the settings from backup variables if we don't have any attached control.
      0:  Result:=FAutoCSetIgnoreCase;
      1:  Result:=FAutoCSetChooseSingle;
      2:  Result:=FAutoCSetAutoHide;
      3:  Result:=FAutoCSetDropRestOfWord;
      4:  Result:=FAutoCSetCancelAtStart;
      else Result:=False;
    end;
    Exit; // Exit if we don't have any attached control.
  end;
  case Index of
    0: Result :=FEditor.AutoCGetIgnoreCase;
    1: Result :=FEditor.AutoCGetChooseSingle;
    2: Result :=FEditor.AutoCGetAutoHide;
    3: Result :=FEditor.AutoCGetDropRestOfWord;
    4: Result :=FEditor.AutoCGetCancelAtStart;
    else Result :=False;
  end;
end;

procedure TSciAutoComplete.setStrings(Value : TStrings);
begin
  FAStrings.Assign(Value);
  TMyStringList(FAStrings).Sort;
end;

procedure TSciAutoComplete.SetAutoCompleteStopChars(const Value : String);
begin
  FStopChars :=Value;
  if not assigned(FEditor) then Exit;
  FEditor.AutoCStops(PChar(Value));
end;

procedure TSciAutoComplete.StartAutoComplete;
var
  line,startswith : String;
  linenum,current,startword,typedlen : LongInt;
  cancelit : Boolean;
begin
  if not assigned(FEditor) then Exit;
  linenum :=FEditor.GetCurrentLineNumber;
  line :=FEditor.GetLineS(linenum);
  current :=FEditor.GetCaretInLine;
  startword :=current;
  if startword=0 then Exit;
  while ((startword>0) and (CharPos(FEditor.WordChars,AnsiChar(line[startword-1]),1)<>0) or (CharPos(StartChars,AnsiChar(line[startword-1]),1)<>0))
    do startword:=startword-1;
  typedlen :=current-startword+1;
  if typedlen>=FNumStartChars then
  begin
    startswith:=Copy(WideString(line), startword, typedlen);
    if assigned(FOnBeforeShow) then
    begin
      cancelit:=False;
      FOnBeforeShow(Self,FEditor.GetCurrentPos,typedlen,FAStrings,cancelit);
      if cancelit then Exit;
    end;

    FillMatching(startswith,FAutoStrings,FAStrings,IgnoreCase);
    FAutoStrings:=Trim(FAutoStrings);
    if FAutoStrings<>'' then
      FEditor.AutoCShow(typedlen,PChar(FAutoStrings));
  end;
end;

function TSciAutoComplete.StartAutoCompleteWord(const onlyOneWord : boolean) : Boolean;
var
  line,wordsNear,root : String;
  current,startword,doclen,flags,posCurrentWord,minWordLength,nwords,wordMaxSize,wordlen,len,posFind : LongInt;
  allnumber : boolean;
  ft : TTextToFind;
  wordstart : array[0..160] of char;
  wordend : PChar;
  cancelit : Boolean;
begin
  Result:=False;
  if not assigned(FEditor) then Exit;
  line :=FEditor.GetLineS;
  wordMaxSize:=80;
  minWordLength:=0;
  nwords:=0;

  current:=FEditor.GetCaretInLine;
  startword:=current;
  allnumber :=true;
  doclen:=FEditor.GetLength;
  while ((startword>0) and (CharPos(FEditor.WordChars,AnsiChar(line[startword-1]),1)<>0)) do
  begin
    startword:=startword-1;
    if Boolean(line[startword] < '0') or Boolean(line[startword] > '9') then allNumber := false;
  end;
  if Boolean(startword=current) or Boolean(allnumber=true) then
  begin
    Result :=True;
    Exit;
  end;
  root:=Copy(WideString(line), startword, current-startword+1);
  cancelit:=False;
  if assigned(FOnBeforeShow) then
  begin
    cancelit:=False;
    FOnBeforeShow(Self,FEditor.GetCurrentPos,Length(root),nil,cancelit);
    if cancelit then Exit;
  end;

  ft.lpstrText:=PChar(root);
  ft.chrg.cpMin :=0;
  ft.chrgText.cpMin :=0;
  ft.chrgText.cpMax :=0;
  flags:=SCFIND_WORDSTART;
  if not IgnoreCase then
    flags :=flags or SCFIND_MATCHCASE;
  posCurrentWord :=FEditor.GetCurrentPos-Length(root);
  wordsNear:='';
  while true do
  begin
    ft.chrg.cpMax := doclen;
    posFind:=FEditor.FindTextX(flags,@ft);
    if (posFind=-1) or (posFind>=doclen) then
    begin
      Break;
    end;
    if posFind=posCurrentWord then
    begin
      ft.chrg.cpMin := posFind + Length(root);
      Continue;
    end;
    FEditor.GetRange(posFind, Min(posFind + wordMaxSize - 3, doclen), wordstart);
    wordend:=Pointer(wordstart + Length(root));
    while (CharPos(FAutoCompleteWordCharacters,AnsiChar(wordend^))>0) do Inc(wordend); //compare to the wordchars property
    wordend^:=#0;
    wordlen :=(wordend-@wordstart);
    if wordlen>Length(root) then
    begin
      if (Pos(wordstart+' ',wordsNear+' ')=0) then
      begin
        if(nwords>0) then
            wordsNear:=wordsNear+' '+String(wordstart)
        else
        wordsNear:=String(wordstart);

        if minWordLength<wordlen then minWordLength:=wordlen;
        nwords:=nwords+1;
        if (onlyOneWord=true) and Boolean(nwords>1) then
        begin
          result :=true;
          Exit;
        end;
      end;
    end;
    ft.chrg.cpMin := posFind + wordlen;
  end;
  len:=Length(root); //Fixed: was checking length of wordsNear.
  if (len>=NumStartChars) and ((not onlyOneWord) or (minWordLength>len)) then
  begin
    FEditor.AutoCShow(len,PChar(wordsNear));
  end else FEditor.AutoCCancel;
  result :=true;
end;

procedure TSciAutoComplete.EvtAutoCSelection(Sender : TObject;text : PChar);
begin
  if assigned(FOnAutoCSelection) then
    FOnAutoCSelection(Sender,text);
end;

procedure TSciAutoComplete.EvtCharAdded (Sender : TObject; const ch : LongInt);
var
  crange : TCharacterRange;
  selStart,selEnd,style : LongInt;
begin
  if (FAutoCompleteDisabled=True) or (not assigned(FEditor)) then Exit;

  crange:=FEditor.GetSelectionRng();
  selStart:=crange.cpMin;
  selEnd:=crange.cpMax;
  if (selEnd=selStart) and (selStart>0) then
  begin
    style:=FEditor.GetStyleAt(selStart-1);
    if style<>1 then
    begin
      if FEditor.CallTipActive then
      begin
        Exit; // We're in a calltip.. don't disturb..
      end else
      if FEditor.AutoCActive then
      begin
        if (CharPos(FEditor.WordChars,AnsiChar(ch),1)=0) then
        begin
          FEditor.AutoCCancel;
          if (CharPos(StartChars,AnsiChar(ch),1)<>0) or ((FromDocument=False)) then
          begin
            StartAutoComplete;
          end;
        end else
        if (autoCCausedByOnlyOne) then
          StartAutoCompleteWord(FromDocumentOnlyOne);
      end else
      begin
        autoCCausedByOnlyOne := false;
        if (CharPos(StartChars,AnsiChar(ch),1)<>0) or ((FromDocument=False) and (CharPos(FEditor.WordChars,AnsiChar(ch),1)<>0)) then
        begin
          StartAutoComplete;
        end else
        if (FromDocument=true) and ((CharPos(FEditor.WordChars,AnsiChar(ch),1)<>0)) then
        begin
          StartAutoCompleteWord(FromDocumentOnlyOne);
          autoCCausedByOnlyOne := FEditor.AutoCActive;
        end else
        if (FromDocument=False) and ((CharPos(FEditor.WordChars,AnsiChar(ch),1)<>0)) then
        begin
          StartAutoComplete;
        end;
      end;
    end;
  end;
end;
end.

Added src/delphisci/SciBall.ico.

cannot compute difference between binary files

Added src/delphisci/SciCallTips.pas.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author : hdalis
  Created: 18/11/2004, 19:51:14
  History: 18/11/2004 Initial Release
           12/04/2005 Added the OnBeforeShow event
  
      $Id: SciCallTips.pas,v 1.1 2004/11/18 19:51:14 hdalis Exp $

     TODO: Find a solution to the setting of the properties of a linked component
           without reassigning the properties in the Loaded procedure.

}
{$Include SciCommonDef.Inc}
unit SciCallTips;
interface
uses Classes, SysUtils,SciLexerMemo,Graphics,SciControllerHandler;
type
  TSciBeforeCallTipShowEvent = procedure(Sender : TObject; const Position : LongInt;ListToDisplay : TStrings;var CancelDisplay : Boolean) of object;

TSciCallTips = class(TComponent)
  private
    fCharAddedProc : TCharAddedProc;
    fCallTipClickProc : TCallTipClickProc;
    braceCount,FStartCalltipWord,FCurrentCallTip,FMaxCallTips,FLastPosCallTip : LongInt;
    FApiStrings : TStrings;
    FCurrentCallTipWord,FFunctionDefinition,FWordCharacters, FParametersStart, FParametersEnd,FParametersSeparators,FEndDefinition : String;
    FForeColor,FBackColor,FHltColor : TColor;
    FDisabled,FIgnoreCase : Boolean;
    FEditor : TScintillaMemo;
    FOnBeforeShow : TSciBeforeCallTipShowEvent;
    FUseStyle : Boolean;
    FTabSize : Integer;
    procedure SetApiStrings(Value : TStrings);
    procedure SetHltColor(Value : TColor);
    procedure SetForeColor(Value : TColor);
    procedure SetBackColor(Value : TColor);
    procedure FillFunctionDefinition(xpos : LongInt=-1);
    procedure ContinueCallTip;
    procedure CallMatching(const startwith : String;var deststr : String;fromlist : TStrings;const ignorecase : Boolean;const stopat:Char=#0;const wordindex:LongInt=-1;matchlen:LongInt=-1);
    procedure SetScintilla(Value : TScintillaMemo);
    procedure DetachScintilla;
    procedure SetTabSize(const Value : Integer);
    procedure SetUseStyle(const Value : Boolean);
  protected
    procedure Loaded; override;
    procedure EvtCharAdded (Sender : TObject; const ch : LongInt);virtual;
    procedure EvtCallTipClick(Sender : TObject; const position : LongInt);virtual;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  public
    constructor Create(AOwner : TComponent);override;
    destructor  Destroy; override;
    procedure StartCallTip;
  published
    property Disabled : Boolean read FDisabled write FDisabled default False;
    property ApiStrings : TStrings read FApiStrings write SetApiStrings;
    property ForeColor : TColor read FForeColor write SetForeColor default clDefault;
    property BackColor : TColor read FBackColor write SetBackColor default clDefault;
    property HighlightColor : TColor read FHltColor write SetHltColor default clDefault;
    property EndDefinition : String read FEndDefinition write FEndDefinition;
    property Editor : TScintillaMemo read FEditor write SetScintilla;
    property ParametersEnd : String read FParametersEnd write FParametersEnd;
    property ParametersSeparators : String read FParametersSeparators write FParametersSeparators;
    property ParametersStart : String read FParametersStart write FParametersStart;
    property WordCharacters : String read FWordCharacters write FWordCharacters;
    property IgnoreCase : Boolean read FIgnoreCase write FIgnoreCase default False;
    property TabSize : Integer read FTabSize write SetTabSize;
    property UseStyle : Boolean read FUseStyle write SetUseStyle;
    property OnBeforeShow : TSciBeforeCallTipShowEvent read FOnBeforeShow write FOnBeforeShow;
end;

implementation

uses SciSupport,SciLexer,sciUtils,Windows;

// TSciCallTips
constructor TSciCallTips.Create(AOwner : TComponent);
begin
  FEditor:=nil;
  inherited Create(AOwner);
  braceCount:=0;
  FParametersStart:='(';
  FParametersEnd:=')';
  FParametersSeparators:=',';
  FEndDefinition:=')';
  FWordCharacters:='';
  FDisabled:=False;
  FForeColor:=clDefault;
  FBackColor:=clDefault;
  FHltColor:=clDefault;
  FUseStyle:=False;
  FTabSize:=0;
  FIgnoreCase:=False;
  FApiStrings :=TMyStringList.Create;
  TMyStringList(FApiStrings).Sorted:=True;
  TMyStringList(FApiStrings).Duplicates:=dupIgnore;
  FCharAddedProc:=TCharAddedProc.Create(EvtCharAdded);
  FCallTipClickProc:=TCallTipClickProc.Create(EvtCallTipClick);
end;

destructor TSciCallTips.Destroy;
begin
  DetachScintilla;
  if assigned(FApiStrings) then FreeAndNil(FApiStrings);
  if assigned(fCharAddedProc) then FreeAndNil(fCharAddedProc);
  if assigned(fCallTipClickProc) then FreeAndNil(fCallTipClickProc);
  Inherited Destroy;
end;

procedure TSciCallTips.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent,Operation);
  if Operation=opRemove then
  begin
    if AComponent=FEditor then
    begin
      DetachScintilla;
    end;
  end;
end;

procedure TSciCallTips.Loaded;
begin
  Inherited Loaded;
  if assigned(FEditor) then
  begin
  {Update the connected Scintilla control with the settings here, as we don't have any Editor attached before now}
    ForeColor:=FForeColor;
    BackColor:=FBackColor;
    HighlightColor:=FHltColor;
  end;
end;

procedure TSciCallTips.DetachScintilla;
begin
  if FEditor<>nil then
  begin
    FEditor.RemoveHandler(fCharAddedProc);
    FEditor.RemoveHandler(fCallTipClickProc);
  end;
  FEditor:=nil;
end;

procedure TSciCallTips.SetScintilla(Value : TScintillaMemo);
begin
  if assigned(Value) then
  begin
    DetachScintilla;
    FEditor:=Value;
    FEditor.AddHandler(fCharAddedProc);
    FEditor.AddHandler(fCallTipClickProc);
    if FWordCharacters='' then
      FWordCharacters:=FEditor.WordChars;
  end else
  begin
    DetachScintilla;
  end;
end;

procedure TSciCallTips.SetTabSize(const Value : Integer);
begin
  FTabSize:=Value;
  if FUseStyle then
    FEditor.CallTipUseStyle(FTabSize);
end;

procedure TSciCallTips.SetUseStyle(const Value : Boolean);
begin
  FUseStyle:=Value;
  if FUseStyle then
    FEditor.CallTipUseStyle(FTabSize);
end;

procedure TSciCallTips.EvtCharAdded (Sender : TObject; const ch : LongInt);
var
  crange : TCharacterRange;
  selStart,selEnd,style : LongInt;
begin
  if not assigned(FEditor) then Exit;
  crange:=FEditor.GetSelectionRng();
  selStart:=crange.cpMin;
  selEnd:=crange.cpMax;
  if (selEnd=selStart) and (selStart>0) then
  begin
    style:=FEditor.GetStyleAt(selStart-1);
    if style<>1 then
    begin
      if FEditor.CallTipActive then
      begin
        if CharPos(FParametersEnd,AnsiChar(ch),1)<>0 then
        begin
          Dec(braceCount);
          if braceCount<1 then
            FEditor.CallTipCancel
          else
          begin
            StartCallTip;
          end;
        end else
        if CharPos(FParametersStart,AnsiChar(ch),1)<>0 then
        begin
          Inc(braceCount);
          StartCallTip;
        end else
        begin
          ContinueCallTip;
        end;
      end else
      if FEditor.AutoCActive then //We're in a autocompletesession, disturb if neccesary.
      begin
        if (CharPos(FParametersStart,AnsiChar(ch),1)<>0) then
        begin
          Inc(braceCount);
          StartCallTip;
        end else
        if (CharPos(FParametersEnd,AnsiChar(ch),1)<>0) then
        begin
          Dec(braceCount);
        end;
      end else
      begin
        if (CharPos(FParametersStart,AnsiChar(ch),1)<>0) then
        begin
          braceCount:=1;
          StartCallTip;
        end;
      end;
    end;
  end;
end;

procedure TSciCallTips.SetHltColor(Value : TColor);
begin
  FHltColor:=Value;
  if (Value<>clDefault) and assigned(FEditor) then
  begin
    FEditor.CallTipSetForeHlt(Value);
  end;
end;

procedure TSciCallTips.SetForeColor(Value : TColor);
begin
  FForeColor:=Value;
  if (Value<>clDefault) and assigned(FEditor) then
  begin
    FEditor.CallTipSetFore(Value);
  end;
end;

procedure TSciCallTips.SetBackColor(Value : TColor);
begin
  FBackColor:=Value;
  if (Value<>clDefault) and assigned(FEditor) then
  begin
    if FEditor=nil then Exit;
    FEditor.CallTipSetBack(Value);
  end;
end;

procedure TSciCallTips.SetApiStrings(Value : TStrings);
begin
  FApiStrings.Assign(Value);
end;

procedure TSciCallTips.CallMatching(const startwith : String;var deststr : String;fromlist : TStrings;const ignorecase : Boolean;const stopat:Char=#0;const wordindex:LongInt=-1;matchlen:LongInt=-1);
var
  cnt,i,numadded,stopatwhere,amatch : LongInt;
  tmp : String;
begin
  deststr:='';
  numadded:=0;
  cnt:=fromlist.Count;
  if matchlen=-1 then
    matchlen:=Length(startwith);
  for i:=0 to (cnt-1) do
  begin
    tmp:=fromlist.Strings[i];
    if stopat<>#0 then
    begin
      stopatwhere:=Pos(stopat,tmp);
      if stopatwhere>0 then tmp:=Copy(tmp,1,stopatwhere-1);
    end;
    //amatch:=-1;
    if stopat<>#0 then
    begin
      if ignorecase=True then
        amatch:=AnsiStrIComp(PChar(tmp),PChar(startwith))
      else
        amatch:=AnsiStrComp(PChar(tmp),PChar(startwith));
    end else
    begin
      if ignorecase=True then
        amatch:=AnsiStrLIComp(PChar(tmp),PChar(startwith),matchlen)
      else
        amatch:=AnsiStrLComp(PChar(tmp),PChar(startwith),matchlen);
    end;
      if amatch=0 then
      begin
        if (wordindex>=0) and (numadded=(wordindex)) then
        begin
          deststr:=tmp;
          Exit;
        end;
        if numadded>0 then deststr:=deststr+' ';
        deststr:=deststr+tmp;
        numadded:=numadded+1;
      end;
  end;
end;

procedure TSciCallTips.FillFunctionDefinition(xpos : LongInt);
var
  Words : String;
  spacepos : LongInt;
  posEndDef : LongInt;
  calltipenddeflen : LongInt;
  funclen : LongInt;
begin
  if xpos>0 then FLastPosCallTip:=xpos;
  CallMatching(FCurrentCallTipWord,Words,FApiStrings,FIgnoreCase,FParametersStart[1],-1,Length(FCurrentCallTipWord));
  if Words<>'' then
  begin
    FMaxCallTips:=1;
    spacepos:=1;
    repeat
      spacepos:=CharPos(Words,' ',spacepos);
      if spacepos<>0 then
      begin
        Inc(FMaxCallTips);
        Inc(spacepos);
      end;
    until spacepos=0;
    CallMatching(FCurrentCallTipWord,Words,FApiStrings,FIgnoreCase,#0,FCurrentCallTip,Length(FCurrentCallTipWord));
    if Words<>'' then
    begin
      FFunctionDefinition:=Words;
      if FMaxCallTips>1 then
        Insert(#1,FFunctionDefinition,0);
      if FEndDefinition<>'' then
      begin
        calltipenddeflen:=Length(FEndDefinition);
        posEndDef:=Pos(FEndDefinition,FFunctionDefinition);
        funclen:=Length(FFunctionDefinition);
        if FMaxCallTips>1 then
        begin
          if (posEndDef>0) and ((posEndDef+calltipenddeflen+1)< Length(FFunctionDefinition)) then
          begin
            Insert(#10#02,FFunctionDefinition,posEndDef+calltipenddeflen);
          end else
          begin
            FFunctionDefinition:=FFunctionDefinition+#10#02;
          end;
        end else
        begin
          if (posEndDef>1) and ((posEndDef+calltipenddeflen+1)< funclen) then
          begin
            Insert(#10,FFunctionDefinition,posEndDef+calltipenddeflen);
          end;
        end;
      end else
      //added in 0.23
      if FMaxCallTips>1 then
      begin
        Insert(#02,FFunctionDefinition,1);
      end;
      FEditor.CallTipShow(FLastPosCallTip-Length(FCurrentCallTipWord),PChar(FFunctionDefinition));
      ContinueCallTip;
    end;
  end;
end;

procedure TSciCallTips.StartCallTip;
var
  line : String;
  current,xpos,braces : LongInt;
  cancelit : Boolean;
begin
  if not assigned(FEditor) then Exit;
  with FEditor do
  begin
  if (FDisabled=True) then Exit;
    FCurrentCallTip:=0;
    FCurrentCalltipWord:='';
    line:=GetLineS;
    current:=GetCaretInLine;
    xpos:=GetCurrentPos;
    if assigned(FOnBeforeShow) then
    begin
      cancelit:=False;
      FOnBeforeShow(Self,xpos,FApiStrings,cancelit);
      if cancelit then Exit;
    end;

    repeat
      braces:=0;
      while ((current > 0) and ((braces<>0) or (CharPos(FParametersStart,AnsiChar(line[current]),1)=0))) do
      begin
        if (CharPos(FParametersStart,AnsiChar(line[current]),1)<>0) then
          Dec(braces)
        else if (CharPos(FParametersEnd,AnsiChar(line[current]),1)<>0) then
          Inc(braces);
        Dec(current);
        Dec(xpos);
      end;
      if current>0 then
      begin
        Dec(current);
        Dec(xpos);
      end else
        break;
      while (current>0) and (IsSpace(Integer(line[current]))) do
      begin
        Dec(current);
        Dec(xpos);
      end;
    until ((current <= 0) or (CharPos(FWordCharacters,AnsiChar(line[current]),1)<>0));
    if current<=0 then Exit;
    FStartCalltipWord:=current;
    while((FStartCalltipWord>0) and (CharPos(FWordCharacters,AnsiChar(line[FStartCalltipWord-1]),1)<>0)) do
    begin
      Dec(FStartCalltipWord);
    end;
    FCurrentCallTipWord:=System.Copy(line,FStartCalltipWord,(current-FStartCalltipWord)+1);
    FFunctionDefinition:='';
    FillFunctionDefinition(xpos);
  end;
end;

procedure TSciCallTips.ContinueCallTip;
var
  line : String;
  current,braces,commas,i : LongInt;
  startHighlight,endHighlight : LongInt;
  funclen : Integer;
begin
  if (FDisabled=True) or (not assigned(FEditor)) then Exit;
  with FEditor do
  begin
    startHighlight:=0;
    commas:=0;
    braces:=0;
    funclen:=Length(FFunctionDefinition);
    FFunctionDefinition:=FFunctionDefinition+' ';
    line:=GetLineS;
    current:=GetCaretInLine;
    for i:=FStartCalltipWord to (current) do
    begin
      if (CharPos(FParametersStart,AnsiChar(line[i]),1)<>0) then
        Inc(braces)
      else if (CharPos(FParametersEnd,AnsiChar(line[i]),1)<>0) and (braces>0) then
        Dec(braces)
      else if (braces=1) and (CharPos(FParametersSeparators,AnsiChar(line[i]),1)<>0) then
        Inc(commas);
    end;
    while (startHighlight<funclen) and
          (CharPos(FParametersStart,AnsiChar(FFunctionDefinition[startHighlight]),1)=0) do
    begin
      Inc(startHighlight);
    end;
    if (CharPos(FParametersStart,AnsiChar(FFunctionDefinition[startHighlight]),1)<>0) then
    begin
      Inc(startHighlight);
    end;
    while ((startHighlight<funclen) and (commas > 0)) do
    begin
      if (CharPos(FParametersSeparators,AnsiChar(FFunctionDefinition[startHighlight]),1)<>0) then
        Dec(commas);
      if (CharPos(FParametersEnd,AnsiChar(FFunctionDefinition[startHighlight]),1)<>0) then
        commas:=0
      else
        Inc(startHighlight);
    end;
    if (CharPos(FParametersSeparators,AnsiChar(FFunctionDefinition[startHighlight]),1)<>0) then
      Inc(startHighlight);
    endHighlight:=startHighlight;
    while (endHighlight<funclen) and (CharPos(FParametersSeparators,AnsiChar(FFunctionDefinition[endHighlight]),1)=0) and (CharPos(FParametersEnd,AnsiChar(FFunctionDefinition[endHighlight]),1)=0) do
    begin
      Inc(endHighlight);
    end;
    // Adjust the start and end so we do not highlight end or separators.
    if (CharPos(FParametersEnd,AnsiChar(FFunctionDefinition[endHighlight]),1)<>0) or (CharPos(FParametersSeparators,AnsiChar(FFunctionDefinition[endHighlight]),1)<>0) then Dec(endHighlight);
    if (CharPos(FWordCharacters,AnsiChar(FFunctionDefinition[startHighlight]),1)<>0) then Dec(startHighlight);
    CallTipSetHlt(startHighlight,endHighlight);
  end;
end;

procedure TSciCallTips.EvtCallTipClick(Sender : TObject; const position : LongInt);
begin
    case position of
    1:begin
        if (FCurrentCallTip>0) then
        begin
          Dec(FCurrentCallTip);
          FillFunctionDefinition;
        end;
      end;
    //Calltip event was fixed in 1.65, so the down arrow sets position to 2..
    //Also allow 0 for compatibility with previous SciLexer.dlls
    0,2:begin
        if ((FCurrentCallTip+1)<FMaxCalltips)  then
        begin
          Inc(FCurrentCallTip);
          FillFunctionDefinition;
        end;
      end;
    end;
end;


end.

Added src/delphisci/SciCommonDef.Inc.

























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}

{Notice: This is here because of some intention to eventually get these
controls to support more than Borland C++ Builder 6,Delphi 7, and
Delphi 2005 (Win32 Mode), and BDS2006 (Win32 Mode, somewhat).

Drop me a hint of how (if you you had to) modify the code to get it to
work.

I'm also interested in the package source files you've created for that
version, or other contributions of code.
}
  {$IFDEF VER180}
    {$DEFINE COMPILER10}
    {$DEFINE DELPHI10}
    {$DEFINE DELPHICOMPILER10}
    {$Define HASUTFFUNCS}
  {$ENDIF}

  {$IFDEF VER170}
    {$DEFINE COMPILER9}
    {$DEFINE DELPHI9}
    {$DEFINE DELPHICOMPILER9}
    {$Define HASUTFFUNCS}
  {$ENDIF}

  {$IFDEF VER160}
    {$DEFINE COMPILER8}
    {$DEFINE DELPHI8}
    {$DEFINE DELPHICOMPILER8}
    {$Define HASUTFFUNCS}
  {$ENDIF}

  {$IFDEF VER150}
    {$DEFINE COMPILER7}
    {$IFDEF BCB}
      {$DEFINE BCB7}
    {$ELSE}
      {$DEFINE DELPHI7}
      {$DEFINE DELPHICOMPILER7}
    {$ENDIF}
    {$Define HASUTFFUNCS}
  {$ENDIF}

  {$IFDEF VER140}
    {$DEFINE COMPILER6}
    {$IFDEF BCB}
      {$DEFINE BCB6}
      {$Define HASUTFFUNCS}
    {$ELSE}
      {$DEFINE DELPHI6}
      {$DEFINE DELPHICOMPILER6}
    {$ENDIF}
  {$ENDIF}

  {$IFDEF VER130}
    {$DEFINE COMPILER5}
    {$IFDEF BCB}
      {$DEFINE BCB5}
    {$ELSE}
      {$DEFINE DELPHI5}
      {$DEFINE DELPHICOMPILER5}
    {$ENDIF}
  {$ENDIF}

  {$IFDEF BCB}
    {$DEFINE CPPBUILDER}
    {$DEFINE BCBCOMPILER}
  {$ELSE ~BCB}
    {$DEFINE DELPHI}
    {$DEFINE DELPHICOMPILER}
  {$ENDIF ~BCB}

{$Ifdef COMPILER5}
  {$Define COMPILER5_UP}
{$Endif}

{$Ifdef COMPILER6}
  {$Define COMPILER5_UP}
  {$Define COMPILER6_UP}
{$Endif}

{$Ifdef COMPILER7}
  {$Define COMPILER5_UP}
  {$Define COMPILER6_UP}
  {$Define COMPILER7_UP}
{$Endif}
{$Ifdef COMPILER8}
  {$Define COMPILER5_UP}
  {$Define COMPILER6_UP}
  {$Define COMPILER7_UP}
  {$Define COMPILER8_UP}
{$Endif}
{$Ifdef COMPILER9}
  {$Define COMPILER5_UP}
  {$Define COMPILER6_UP}
  {$Define COMPILER7_UP}
  {$Define COMPILER8_UP}
  {$Define COMPILER9_UP}
{$Endif}
{$Ifdef COMPILER10}
  {$Define COMPILER5_UP}
  {$Define COMPILER6_UP}
  {$Define COMPILER7_UP}
  {$Define COMPILER8_UP}
  {$Define COMPILER9_UP}
  {$Define COMPILER10_UP}
{$Endif}

{$Define BADFILEEXISTS}
{.$Define USENEWLOADLEXER}
{
  If you want the more specialized LoadLexerLibrary in TScintilla then remove the dot above.
}
//Newabbrews is not done yet, and isn't tested.
{.$Define NEWABBREVS}

{$Define ALLOWSEARCHPOPUPMENUS}
{If USEDEFAULTSTREAMBYDEFAULT is defined then TSciStreamDefault is used as the default StreamClass without needed any assignment.
}
{.$Define USEDEFAULTSTREAMBYDEFAULT}

Added src/delphisci/SciConfirmReplaceDlg.ddp.

cannot compute difference between binary files

Added src/delphisci/SciConfirmReplaceDlg.dfm.





































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
object ConfirmReplaceDialog: TConfirmReplaceDialog
  Left = 619
  Top = 163
  BorderIcons = [biSystemMenu]
  BorderStyle = bsDialog
  Caption = 'Confirm the replace'
  ClientHeight = 98
  ClientWidth = 328
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clBtnText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poOwnerFormCenter
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object BasePanel: TPanel
    Left = 0
    Top = 0
    Width = 328
    Height = 98
    Align = alClient
    BevelOuter = bvNone
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBtnText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
    TabOrder = 0
    object lblConfirmation: TLabel
      Left = 60
      Top = 12
      Width = 261
      Height = 44
      AutoSize = False
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBtnText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
      WordWrap = True
    end
    object Image1: TImage
      Left = 16
      Top = 16
      Width = 32
      Height = 32
    end
    object btnReplace: TBitBtn
      Left = 8
      Top = 67
      Width = 75
      Height = 23
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBtnText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
      TabOrder = 0
      Kind = bkYes
    end
    object btnSkip: TBitBtn
      Left = 87
      Top = 67
      Width = 75
      Height = 23
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBtnText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
      TabOrder = 1
      Kind = bkNo
    end
    object btnCancel: TBitBtn
      Left = 166
      Top = 67
      Width = 75
      Height = 23
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBtnText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
      TabOrder = 2
      Kind = bkCancel
    end
    object btnReplaceAll: TBitBtn
      Left = 245
      Top = 67
      Width = 75
      Height = 23
      Caption = '&All'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBtnText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ModalResult = 10
      ParentFont = False
      TabOrder = 3
      Glyph.Data = {
        F2010000424DF201000000000000760000002800000024000000130000000100
        0400000000007C01000000000000000000001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333334433333
        3333333333388F3333333333000033334224333333333333338338F333333333
        0000333422224333333333333833338F33333333000033422222243333333333
        83333338F3333333000034222A22224333333338F33F33338F33333300003222
        A2A2224333333338F383F3338F33333300003A2A222A222433333338F8333F33
        38F33333000034A22222A22243333338833333F3338F333300004222A2222A22
        2433338F338F333F3338F3330000222A3A2224A22243338F3838F338F3338F33
        0000A2A333A2224A2224338F83338F338F3338F300003A33333A2224A2224338
        333338F338F3338F000033333333A2224A2243333333338F338F338F00003333
        33333A2224A2233333333338F338F83300003333333333A2224A333333333333
        8F338F33000033333333333A222433333333333338F338F30000333333333333
        A224333333333333338F38F300003333333333333A223333333333333338F8F3
        000033333333333333A3333333333333333383330000}
      NumGlyphs = 2
    end
  end
end

Added src/delphisci/SciConfirmReplaceDlg.pas.











































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{-------------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is: dlgConfirmReplaceText.pas, released 2000-06-23.

The Original Code is part of the SearchReplaceDemo project, written by
Michael Hieke for the SynEdit component suite.
All Rights Reserved.

Contributors to the SynEdit project are listed in the Contributors.txt file.

Alternatively, the contents of this file may be used under the terms of the
GNU General Public License Version 2 or later (the "GPL"), in which case
the provisions of the GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the GPL and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your version
of this file under either the MPL or the GPL.

$Id: SciConfirmReplaceDlg.pas,v 1.4 2004/11/13 04:29:50 hdalis Exp $

You may retrieve the latest version of this file at the SynEdit home page,
located at http://SynEdit.SourceForge.net

Known Issues:
-------------------------------------------------------------------------------}
{
  History:   29/09/2004 Initial Release with Delphi Scintilla Interface Components
                        Removed Dialogs from the uses list.
             24/11/2004 Corrected a little bug. When All was selected, it didn't return
                        the mrYesToAll that was expected.. Now it does..
}
{$Include SciCommonDef.Inc}
unit SciConfirmReplaceDlg;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  StdCtrls, ExtCtrls, Buttons;

type
  TConfirmReplaceDialog = class(TForm)
    BasePanel: TPanel;
    lblConfirmation: TLabel;
    Image1: TImage;
    btnReplace: TBitBtn;
    btnSkip: TBitBtn;
    btnCancel: TBitBtn;
    btnReplaceAll: TBitBtn;
    procedure FormCreate(Sender: TObject);
  public
    procedure PrepareShow(editorRect: TRect; X, Y1, Y2: Integer;AReplaceText: string);
  end;

implementation

{$R *.DFM}
uses SciResLang;

{ TConfirmReplaceDialog }

procedure TConfirmReplaceDialog.FormCreate(Sender: TObject);
begin
  Image1.Picture.Icon.Handle := LoadIcon(0, IDI_QUESTION);
end;

procedure TConfirmReplaceDialog.PrepareShow(editorRect: TRect;
  X, Y1, Y2: Integer; AReplaceText: string);
var
  nW, nH: Integer;
begin
  lblConfirmation.Caption := Format(SAskReplaceText, [AReplaceText]);
  nW := editorRect.Right - editorRect.Left;
  nH := editorRect.Bottom - editorRect.Top;

  if nW <= Width then
    X := editorRect.Left - (Width - nW) div 2
  else begin
    if X + Width > editorRect.Right then
      X := editorRect.Right - Width;
  end;
  if Y2 > editorRect.Top + MulDiv(nH, 2, 3) then
    Y2 := Y1 - Height - 4
  else
    Inc(Y2, 4);
  SetBounds(X, Y2, Width, Height);
end;

end.




Added src/delphisci/SciControllerHandler.pas.

















































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author : hdalis
      $Id: SciControllerHandler.pas,v 1.5 2004/11/18 04:29:51 hdalis Exp $
  Purpose: This manages, and forwards OnCharAdded, OnMacroRecord, OnCallTipClick,
           OnAutoCSelection to any registered eventhandlers..
           Internally used.

  History: 18/11/2004 Initial Release
           15/04/2005 Changed the connection to the ownerclass to wait until the
                      class calls TSciController.Connect, cause it didn't get the
                      initialized events of the owner when the owner created TSciController
                      in the Create constructor.
           03/06/2005 Removed all the Add*Handler and Remove*Handler, and replaced them
                      with AddHandler and RemoveHandler, which itself detects what kind
                      of handler you are trying to add or remove.
                      MUST be a valid handler (those classes ending with Proc below).
}
{$Include SciCommonDef.Inc}
unit SciControllerHandler;
interface
uses Classes,SciLexer;

Type

TControllerControl = class (TScintillaBase)
public
  property OnCharAdded;
  property OnCallTipClick;
  property OnMacroRecord;
  property OnAutoCSelection;
end;

TCharAddedProc = class(TObject)
private
  fCharAddedProc : TSCEvent_charadded;
public
  constructor Create (aCharAddedProc : TSCEvent_charadded);
  property OnCharAdded : TSCEvent_charadded read fCharAddedProc write fCharAddedProc;
end;

TMacroRecordProc = class(TObject)
private
  fMacroRecordProc : TSCEvent_macrorecord;
public
  constructor Create (aMacroRecordProc : TSCEvent_macrorecord);
  property OnMacroRecord : TSCEvent_macrorecord read fMacroRecordProc write fMacroRecordProc;
end;

TCallTipClickProc = class(TObject)
private
  fCallTipClickProc : TSCEvent_calltipclick;
public
  constructor Create (aCallTipClickProc : TSCEvent_calltipclick);
  property OnCallTipClick : TSCEvent_calltipclick read fCallTipClickProc write fCallTipClickProc;
end;

TAutoCSelectionProc = class(TObject)
private
  fAutoCSelectionProc : TSCEvent_autocselection;
public
  constructor Create (aAutoCSelectionProc : TSCEvent_autocselection);
  property OnAutoCSelection : TSCEvent_autocselection read fAutoCSelectionProc write fAutoCSelectionProc;
end;

TSciController = class (TObject)
  private
    fControl : TControllerControl;
    fInCharAdded,FConnected : Boolean;
    fOldCharAdded : TSCEvent_charadded;
    fOldCallTipClick : TSCEvent_calltipclick;
    fOldMacroRecord : TSCEvent_macrorecord;
    fOldAutoCSelection : TSCEvent_autocselection;
    fCharAddedChain,
    fCallTipClickChain,
    fMacroRecordChain,
    fAutoCSelectionChain : TList;
    procedure SetOnCharAdded (const Value: TSCEvent_charadded);
    procedure SetOnCallTipClick (const Value: TSCEvent_calltipclick);
    procedure SetOnMacroRecord (const Value: TSCEvent_macrorecord);
    procedure SetOnAutoCSelection (const Value: TSCEvent_autocselection);
  protected
    {The replacement events}
    procedure EditorCharAdded (Sender : TObject; const ch : LongInt);
    procedure EditorCallTipClick (Sender : TObject; const position : LongInt);
    procedure EditorAutoCSelection (Sender : TObject; text : PChar);
    procedure EditorMacroRecord (Sender : TObject; const message : LongInt; const wParam : LongInt; const lParam : LongInt);
  public
    constructor Create (aControl : TScintillaBase);
    destructor Destroy; override;

    {Connect all eventhandlers}
    procedure Connect;
    {Disconnect all eventhandlers}
    procedure Disconnect;
    {Add a eventhandler}
    procedure AddHandler(aHandler : TObject);
    {Remove a eventhandler}
    procedure RemoveHandler(aHandler : TObject);

    procedure ExecuteCharAdded (Sender: TObject; const ch : LongInt);
    procedure ExecuteMacroRecord (Sender: TObject;const message : LongInt; const wParam : LongInt; const lParam : LongInt);
    procedure ExecuteCallTipClick (Sender: TObject; const position : LongInt);
    procedure ExecuteAutoCSelection (Sender: TObject; text : PChar);

    property  OnCharAdded : TSCEvent_charadded read fOldCharAdded write SetOnCharAdded;
    property  OnCallTipClick : TSCEvent_calltipclick read fOldCallTipClick write SetOnCallTipClick;
    property  OnMacroRecord : TSCEvent_macrorecord read fOldMacroRecord write SetOnMacroRecord;
    property  OnAutoCSelection : TSCEvent_autocselection read fOldAutoCSelection write SetOnAutoCSelection;
end;


implementation
{ TSciController }
uses SciLexerMemo,SysUtils;

constructor TSciController.Create (aControl : TScintillaBase);
begin
  inherited Create;
  FConnected:=False;
  fControl := TControllerControl (aControl);
  fInCharAdded := false;
  fCharAddedChain := TList.Create;
  fCallTipClickChain := TList.Create;
  fMacroRecordChain := TList.Create;
  fAutoCSelectionChain := TList.Create;
end;

destructor TSciController.Destroy;
begin
  Disconnect;
  if assigned(fCharAddedChain) then FreeAndNil(fCharAddedChain);
  if assigned(fCallTipClickChain) then FreeAndNil(fCallTipClickChain);
  if assigned(fMacroRecordChain) then FreeAndNil(fMacroRecordChain);
  if assigned(fAutoCSelectionChain) then FreeAndNil(fAutoCSelectionChain);
  inherited Destroy;
end;

procedure TSciController.AddHandler(aHandler : TObject);
begin
  if aHandler is TMacroRecordProc then //OnMacroRecord
    fMacroRecordChain.Add(TMacroRecordProc(aHandler))
  else
  if aHandler is TAutoCSelectionProc then //OnAutoCSelection
    fAutoCSelectionChain.Add(TAutoCSelectionProc(aHandler))
  else
  if aHandler is TCharAddedProc then //OnCharAdded
    fCharAddedChain.Add(TCharAddedProc(aHandler))
  else
  if aHandler is TCallTipClickProc then //OnCallTipClick
    fCallTipClickChain.Add(TCallTipClickProc(aHandler));
end;
procedure TSciController.RemoveHandler(aHandler : TObject);
begin
  if aHandler is TMacroRecordProc then //OnMacroRecord
    fMacroRecordChain.Remove(TMacroRecordProc(aHandler))
  else
  if aHandler is TAutoCSelectionProc then //OnAutoCSelection
    fAutoCSelectionChain.Remove(TAutoCSelectionProc(aHandler))
  else
  if aHandler is TCharAddedProc then //OnCharAdded
    fCharAddedChain.Remove(TCharAddedProc(aHandler))
  else
  if aHandler is TCallTipClickProc then //OnCallTipClick
    fCallTipClickChain.Remove(TCallTipClickProc(aHandler));
end;

procedure TSciController.Connect;
begin
  fOldCharAdded := nil;
  fOldCallTipClick := nil;
  fOldMacroRecord:=nil;
  fOldAutoCSelection:=nil;
  if FConnected=False then
  begin
    //Store the old events
    if assigned(fControl.OnCharAdded) then fOldCharAdded := fControl.OnCharAdded;
    if assigned(fControl.OnCallTipClick) then fOldCallTipClick := fControl.OnCallTipClick;
    if assigned(fControl.OnMacroRecord) then fOldMacroRecord := fControl.OnMacroRecord;
    if assigned(fControl.OnAutoCSelection) then fOldAutoCSelection := fControl.OnAutoCSelection;
    //Assign the new ones..
    fControl.OnCharAdded := EditorCharAdded;
    fControl.OnCallTipClick := EditorCallTipClick;
    fControl.OnMacroRecord := EditorMacroRecord;
    fControl.OnAutoCSelection := EditorAutoCSelection;
    FConnected:=True;
  end;
end;

procedure TSciController.Disconnect;
begin
  if assigned(fControl) then
  begin
    fControl.OnCharAdded := fOldCharAdded;
    fControl.OnCallTipClick := fOldCallTipClick;
    fControl.OnMacroRecord := fOldMacroRecord;
    fControl.OnAutoCSelection := fOldAutoCSelection;
  end;
  FConnected:=False;
end;

procedure TSciController.EditorMacroRecord (Sender : TObject; const message : LongInt; const wParam : LongInt; const lParam : LongInt);
var
  idx : Integer;
begin
  with fMacroRecordChain do
  begin
    for idx := Count - 1 downto 0 do
    begin
      with TMacroRecordProc(Items[idx]) do
        if Assigned (OnMacroRecord) then
        begin
          OnMacroRecord (Sender,message,wParam,lParam);
        end;
    end;
  end;
  if Assigned (fOldMacroRecord) then
    fOldMacroRecord (Sender,message,wParam,lParam);
end;

procedure TSciController.EditorAutoCSelection (Sender : TObject; text : PChar);
var
  idx : Integer;
begin
  if not (Sender is TScintillaMemo) then Exit;
  with fAutoCSelectionChain do
  begin
    for idx := Count - 1 downto 0 do
    begin
      with TAutoCSelectionProc (Items[idx]) do
        if Assigned (OnAutoCSelection) then
        begin
          OnAutoCSelection (Sender,text);
        end;
    end;
  end;
  if Assigned (fOldAutoCSelection) then
    fOldAutoCSelection (Sender,text);
end;

procedure TSciController.EditorCharAdded (Sender: TObject; const ch : LongInt);
var
  idx : Integer;
begin
  if fInCharAdded then Exit;
  fInCharAdded := true;
  try
    with fCharAddedChain do
    begin
      for idx := Count - 1 downto 0 do
      begin
        with TCharAddedProc (Items[idx]) do
          if Assigned (OnCharAdded) then
          begin
            OnCharAdded (Sender,ch);
            if (ch = 0) then
            begin
              fInCharAdded := false;
              exit;
            end;
          end;
      end;
    end;
    if Assigned (fOldCharAdded) then
      fOldCharAdded (Sender,ch);
  finally
    fInCharAdded := false;
  end;
end;

procedure TSciController.EditorCallTipClick (Sender: TObject; const position : LongInt);
var
  idx : Integer;
begin
  with fCallTipClickChain do
  begin
    for idx := Count - 1 downto 0 do
    begin
      with TCallTipClickProc (Items[idx]) do
        if Assigned (OnCallTipClick) then
        begin
          OnCallTipClick(Sender,position);
        end;
    end;
  end;
  if Assigned (fOldCallTipClick) then
    fOldCallTipClick(Sender,position);
end;

procedure TSciController.ExecuteAutoCSelection (Sender: TObject;text : PChar);
begin
  EditorAutoCSelection(Sender,text);
end;

procedure TSciController.ExecuteMacroRecord (Sender: TObject;const message : LongInt; const wParam : LongInt; const lParam : LongInt);
begin
  EditorMacroRecord(Sender,message,wParam,lParam);
end;

procedure TSciController.ExecuteCharAdded (Sender: TObject; const ch: Integer);
begin
  EditorCharAdded(Sender,ch);
end;

procedure TSciController.ExecuteCallTipClick (Sender: TObject; const position: Integer);
begin
  EditorCallTipClick(Sender,position);
end;

procedure TSciController.SetOnMacroRecord (const Value: TSCEvent_macrorecord);
begin
  fOldMacroRecord := Value;
  fControl.OnMacroRecord := EditorMacroRecord;
end;

procedure TSciController.SetOnCharAdded (const Value: TSCEvent_charadded);
begin
  fOldCharAdded := Value;
  fControl.OnCharAdded := EditorCharAdded;
end;

procedure TSciController.SetOnAutoCSelection (const Value: TSCEvent_autocselection);
begin
  fOldAutoCSelection := Value;
  fControl.OnAutoCSelection := EditorAutoCSelection;
end;

procedure TSciController.SetOnCallTipClick(const Value: TSCEvent_calltipclick);
begin
  fOldCallTipClick := Value;
  fControl.OnCallTipClick := EditorCallTipClick;
end;

constructor TCharAddedProc.Create (aCharAddedProc : TSCEvent_charadded);
begin
  inherited Create;
  fCharAddedProc := aCharAddedProc;
end;

constructor TCallTipClickProc.Create (aCallTipClickProc : TSCEvent_calltipclick);
begin
  inherited Create;
  fCallTipClickProc := aCallTipClickProc;
end;

constructor TMacroRecordProc.Create (aMacroRecordProc : TSCEvent_macrorecord);
begin
  inherited Create;
  fMacroRecordProc := aMacroRecordProc;
end;
constructor TAutoCSelectionProc.Create (aAutoCSelectionProc : TSCEvent_autocselection);
begin
  inherited Create;
  fAutoCSelectionProc := aAutoCSelectionProc;
end;

end.

Added src/delphisci/SciDetectUtils.pas.

























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author  : hdalis (hdalis@users.sourceforge.net)
       $Id: SciDetectUtils.pas,v 1.5 2004/11/13 04:29:50 hdalis Exp $
  History : 29/09/2004 Initial Release
            13/10/2004 Added help using ClassExplorer 6.0, Use the helpgenerator to
                       generate the help.
                       The TExtensionMapper is moved to SciPropertyMgr.pas
            24/10/2004 Removed the TLexerNamesMap class, and the LexerMapper function
                       these are now part of the TSciLanguageManager class (functions AddLanguage,
                       DupLanguage,RemoveLanguage,FillListWithLanguages)

}
{.$WEAKPACKAGEUNIT ON}
{$Include SciCommonDef.Inc}
unit SciDetectUtils;
interface
function GetWordChars(const highlighter : String) : String;
implementation
uses SciLexer,SysUtils,Windows;

function GetWordChars(const highlighter : String) : String;
begin
  if highlighter='' then Result:=sci_alphachars+sci_numericchars+sci_accentedchars+'_'
  else if (AnsiCompareText('PERL',highlighter)=0) or (AnsiCompareText('BASH',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_$@%&'
  else if (AnsiCompareText('PHP',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_-$'
  else if (AnsiCompareText('CSS',highlighter)=0) or (AnsiCompareText('HTML',highlighter)=0) or (AnsiCompareText('HTML',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_-'
  else if (AnsiCompareText('XML',highlighter)=0) or (AnsiCompareText('WML',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_-'
  else if AnsiCompareText('LUA',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars+'_%'
  else if (AnsiCompareText('Ave',highlighter)=0) or (AnsiCompareText('C++/C',highlighter)=0) or
          (AnsiCompareText('Resource',highlighter)=0) or (AnsiCompareText('IDL',highlighter)=0) or
          (AnsiCompareText('Java',highlighter)=0) or (AnsiCompareText('JavaScript',highlighter)=0) or
          (AnsiCompareText('C#',highlighter)=0) or (AnsiCompareText('POV',highlighter)=0) or
          (AnsiCompareText('Specman',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_#'
  else if AnsiCompareText('Baan',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars+'_#.$'
  else if AnsiCompareText('Forth',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars+'%-'
  else if (AnsiCompareText('Lisp',highlighter)=0) or (AnsiCompareText('Scheme',highlighter)=0) then
    Result:=sci_alphachars+sci_numericchars+'_-<>.#+@$%^&=*!?'
  else if AnsiCompareText('lot',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars
  else if AnsiCompareText('nnCronTab',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars+'%-'
  else if AnsiCompareText('Verilog',highlighter)=0 then
    Result:=sci_alphachars+sci_numericchars+'_`$#'
  else
    Result:='_'+sci_alphachars+sci_numericchars;
end;

end.

Added src/delphisci/SciDocuments.pas.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
 Author : hdalis (hdalis@users.sourceforge.net)
 Created: 30/09/2004, 04:24:38
     $Id: SciDocuments.pas,v 1.4 2004/11/13 04:29:50 hdalis Exp $
 Purpose: Tabbed scintilla component.
 Usage: Drop the TScintilla derived control and a TSciDocumentTabControl
        on a form, select the TScintillaBase derived control in the Editor property of TSciDocumentTabControl
        and viola.. Tabbed scintilla control.

 History 30/09/2004 Initial Release
         13/10/2004 Added help using ClassExplorer 6.0, Use the helpgenerator to
                    generate the help.
         11/11/2004 Added per tab hinting. Displays the full pathname of the file when ShowHint is True.
         14/11/2004 At last the TSciDoc saves foldingstates.
         26/11/2004 Added the property DefaultExt for setting the default file extension..
                    Added calls to the OnDetectHighlighter when we're attached to
                    a TScintilla component, and we're attaching ourself.
         05/01/2005 Changed some of the calling to FOnDetectHighlighter, tried to minimize number of calls.
                    Added the OnOpenedAndInited event, this is fired only when Open is called, and is called just
                    before the function exits when successful.. May be the ideal place to add updatingcode which
                    is dependent on the current highlighter, as it's not completely loaded until just at this time.
         24/01/2005 Fixed the Close function so that when the last document is closed, the OnChange is called correctly and,
                    in Remove the Modified is sat to False when we're closing the last document..
         26/01/2005 Found a somewhat serious bug. When the character '\' is the last in the file,
                    and there's no following line, then an exception was thrown 'cause a while statement
                    did the walkin one too many times. Fixed.
         01/02/2005 Somewhat fixed a little problem with the documents not storing properties/folding when changing
                    the page programmaticly via the Activate functions..
                    The TSciDoc class has been extended with a pair of new functions.
         05/02/2005 Quite messy code in this component really, but it does work however.. Some restructuring
                    sorely needed.. TODO: Restructure this component, and use TCollection,TCollectionItems
                    for storing the document settings..
         22/02/2005 A bug in TSciDoc.SetTabWidth caused the that the TabWidth wasn't set correctly.
                    It set the value stored in fIndentWidth instead.
         09/03/2005 Changed the way Remove removes the document. It seems more stable now..
         07/09/2005 Added the event OnTabHint, it is fired when the cursor is above any of the tabs.
                    The HintText is prefilled with the current highlighter for the document if it is a TScintilla
                    editor.
         18/05/2006 Fixed some memoryleaks.

}
{$Include SciCommonDef.Inc}
unit SciDocuments;
interface
Uses
  Windows, Classes, Controls,Contnrs,ComCtrls,Messages,SciLexer,SciLexerMemo;

type
  TSciDoc=class;
  TSCEvent_onclosing = procedure(Sender : TObject; const TabIndex : Integer;var AllowClose : Boolean) of object;
  TSCEvent_detecthighlighter = procedure(Sender : TObject; const Extension : String;var Language : String) of object;
  TSCEvent_removeextradata = procedure(Sender : TObject) of object;
  TSCEvent_openedandinited = procedure(Sender : TObject; const TabIndex : Integer;doc : TSciDoc) of object;
  TSCEvent_onhint = procedure(Sender : TObject; const TabIndex : Integer;var HintText : String;doc : TSciDoc) of object;
  TSciFoldStateRec=record
    Line : Integer;
    Expanded : Boolean;
  end;
  TSciDocumentTabControl=class;
  TSciDoc = class(TObject)
  private
    fEditor : TScintillaBase;
    fTabCtrl : TCustomTabControl;
    FTabName,
    fHighlighter,
    FFileName,
    FWordChars,
    FAutoStartChars,
    FAutoStopChars : string;
    documentid,
    FSelStart,
    FSelLength,
    FFirstLineInView,
    FCodePage : LongInt;
    FIndex,FTabWidth,FIndentWidth : Integer;
    FReadOnly,
    FModified,
    FAutoIgnoreCase,
    FUseTabs : Boolean;
    FIndentation : TIndentationOptions;
    FFoldStates : array of TSciFoldStateRec;
    FOnChanged : TNotifyEvent;
    FExtraData : Pointer;
    FStreamClass : TSciStreamClass;
    FStreamExtra : Integer;
    FStreamExtraStr : String;
    FLastChanged : Integer;
    FOnRemoveExtraData : TSCEvent_removeextradata;
    procedure SetTabName(const Value : string);
    procedure SetHighlighter(const Value : String);
    procedure SetFileName(const Value : string);
    procedure Changed;
    procedure AddRef;
    procedure Release;
    procedure SetWordChars(const Value : String);
    procedure AssignFromEditor;
    procedure AssignToEditor;
    procedure StoreFoldStates;
    procedure RestoreFoldStates;
    procedure SetIndentWidth(const Value : Integer);
    procedure SetTabWidth(const Value : Integer);
    procedure SetIndentation(const Value : TIndentationOptions);
    procedure SetModified(const Value : Boolean);
    procedure SetUseTabs(const Value : Boolean);
    procedure SetCodePage(const Value : LongInt);
    procedure SetStreamClass(Value : TSciStreamClass);
    procedure SetStreamExtra(const Value : Integer);
    procedure SetStreamExtraStr(const Value : String);
    property  OnChanged : TNotifyEvent read FOnChanged write FOnChanged; // Used by TSciDocumentTabControl, internal
  public
    constructor Create(pp : TScintillaBase;ttabctrl : TSciDocumentTabControl;const getcurrent : Boolean=false);
    destructor Destroy;override;
    procedure Activate;
    function IsUntitled : Boolean;
    function IsActive : Boolean;
    procedure Close;
    property TabName : string read FTabName Write SetTabName;
    property ExtraData : Pointer read FExtraData write FExtraData;
    property OnRemoveExtraData : TSCEvent_removeextradata read FOnRemoveExtraData write FOnRemoveExtraData;
    property StreamClass : TSciStreamClass read FStreamClass write SetStreamClass;
    property StreamExtra : Integer read FStreamExtra write SetStreamExtra;
    property StreamExtraStr : String read FStreamExtraStr write SetStreamExtraStr;
  published
    //Get or set indentation options: - KeepIndent, - TabIndents, - BackSpaceUnIndents, - IndentationGuides
    property Indentation : TIndentationOptions read FIndentation write SetIndentation;
    //Number of characters for code (un)indending.  If set to zero then the TabWidth is used instead
    property IndentWidth : Integer read FIndentWidth write SetIndentWidth;
    property TabWidth : Integer read FTabWidth write SetTabWidth;
    // If the current editor is a TScintilla derived class then this property are automatically saved and used
    property Highlighter : String read fHighlighter Write SetHighlighter;
    property FileName : String read FFileName write SetFileName;
    property Index : Integer read FIndex write FIndex;
    property Modified : Boolean read FModified write SetModified;
    property WordChars : String read FWordChars write SetWordChars;
    property AutoIgnoreCase : Boolean read FAutoIgnoreCase write FAutoIgnoreCase;
    property AutoStartChars : String read FAutoStartChars write FAutoStartChars;
    property AutoStopChars  : String read FAutoStopChars write FAutoStopChars;
    property UseTabs : Boolean read FUseTabs write SetUseTabs;
    property CodePage : LongInt read FCodePage write SetCodePage;
    property LastChanged : Integer read FLastChanged write FLastChanged;
  end;

  TSciDocumentTabControl = class(TCustomTabControl)
    private
      docs : TObjectList;
      fEditor : TScintillaBase;
      FOnClosing : TSCEvent_onclosing;
      FOnDetectHighlighter : TSCEvent_detecthighlighter;
      FOnOpenedAndInited : TSCEvent_openedandinited;
      FOnTabHint : TSCEvent_onhint;
      FDefaultExt : String;
      inactivate : Boolean;
      FDefaultTabName : String;

      procedure EvttabChanged(Sender : TObject);
      function getCount : Integer;
      function GetDocItm(const Index : Integer) : TSciDoc;
      procedure SetEditor(Value : TScintillaBase);
      function GetActiveDocument : TSciDoc;

      procedure SetDefaultExt(const Value : String);
      procedure ChgTab(const newtab : Integer);
      procedure Remove(const index : Integer);           // Remove the tab 'index'

    protected
      procedure DoLoadFromFile(const FileName : String);virtual;
      function CanChange : Boolean; override;
      procedure Notification(AComponent: TComponent; Operation: TOperation); override;
      procedure Attach; // Attaches the editor to this tabcontrol
      procedure RefreshTabs; // Refreshes the tablist
      procedure DoTabHint(const TabIndex : Integer;var HintText : String;doc : TSciDoc);virtual;
      procedure CMHintShow(var Message: TMessage);message CM_HINTSHOW;
      procedure Change; override;
    public
      constructor Create(AOwner : TComponent);override;
      destructor Destroy;override;

      function Open(const filename : String;MayBeUnicode : Boolean=False) : Boolean; // Open a file
      procedure Close(const index : Integer=-1;const askifneeded : Boolean=True);         // If 'index' is -1 then close the currently selected Tab, else close the selected index.
      function  NewDocument : Integer;                   // Init a new document, return tabindex
      procedure Activate(const docno : LongInt);         // Activate the tab 'docno'
      function  Add(const tabname : String;const thefilename : String) : Integer;   // Add a tab, set the tabname to 'tabname'

      property Count : Integer read getCount;           // Returns number of tabs/documents
      property Document [const Index : Integer] : TSciDoc read GetDocItm; // Returns the document item for the specified tabindex
      property DisplayRect;
      property Tabs;
      property TabIndex;  // must be after Tabs
      property ActiveDocument : TSciDoc read GetActiveDocument;
    published
      // The current editor used.
      property Editor : TScintillaBase read fEditor write SetEditor;
      property Align;
      property Anchors;
      property BiDiMode;
      property Constraints;
      property DragCursor;
      property DragMode;
      property Enabled;
      property Font;
      property HotTrack default True;
      property MultiLine;
      property OwnerDraw;
      property ParentBiDiMode;
      property ParentShowHint default False;
      property PopupMenu;
      property RaggedRight;
      property ScrollOpposite;
      property ShowHint default True;
      property Style;
      property TabHeight;
      property TabOrder;
      property TabPosition;
      property TabWidth;
      property Visible;
      property OnChange;
      property OnChanging;
      property OnContextPopup;
      property OnDrawTab;
      property OnEndDock;
      property OnEndDrag;
      property OnEnter;
      property OnExit;
      property OnMouseDown;
      property OnMouseMove;
      property OnMouseUp;
      property OnResize;
      property OnStartDock;
      property OnUnDock;
      property ParentFont default False;
      property TabStop default False;
      property DefaultExt : String read FDefaultExt write SetDefaultExt;
      // Fired when a Tab is about to be removed etc. Good place for confirmation dialogs etc.
      property OnClosing : TSCEvent_onclosing read FOnClosing write FOnClosing;
      // This event is only active when a descentant of TScintilla is used
      property OnDetectHighlighter : TSCEvent_detecthighlighter read FOnDetectHighlighter write FOnDetectHighlighter;
      property OnOpenedAndInited : TSCEvent_openedandinited read FOnOpenedAndInited write FOnOpenedAndInited;
      property OnTabHint : TSCEvent_onhint read FOnTabHint write FOnTabHint;
  end;

implementation
uses SysUtils,sciUtils,SciLexerMod,Graphics,Shellapi,Forms,sciSupport,SciResLang,ImgList;//,RTLConsts;
var
  ci : CHARSETINFO  = ( ciCharset: 0; ciACP:0; fs : ( fsUsb:( 0, 0, 0, 0 ); fsCsb: ( 0, 0 ); ) );

function CodePageFromCharSet(CharSet : DWORD;documentCodePage : UINT) : LongWord;
var
  bci : Boolean;
  cp : UINT;
  cpi : CPINFO;
begin
  bci:=TranslateCharsetInfo(charSet,ci, TCI_SRCCHARSET);
  if bci then
    cp:=ci.ciACP
  else
    cp:=documentCodePage;
  if ((not IsValidCodePage(cp)) and (not GetCPInfo(cp,cpi))) then
    cp:=CP_ACP;
  Result:=cp;
end;

function GetFileExt(const fname : String) : String;
begin
  Result :=LowerCase(ExtractFileExt(fname));
end;

constructor TSciDocumentTabControl.Create(AOwner : TComponent);
begin
  fEditor:=nil;
  docs:=nil;
  inactivate:=False;
  inherited Create(AOwner);
  DragKind:=dkDock;
  MultiSelect:=False;
  ParentFont:=False;
  TabStop:=False;
  ShowHint:=True;
  FDefaultExt:='.txt';
  FDefaultTabName:='<'+sUntitled+FDefaultExt+'>';
  ControlStyle:=ControlStyle-[csAcceptsControls];
end;

destructor TSciDocumentTabControl.Destroy;
var
  i : Integer;
  cnt : Integer;
 begin
  if (assigned(docs)) and (assigned(fEditor)) then
  begin
    cnt:=docs.Count;
    for i:=(cnt-1) downto 0 do
    begin
      TSciDoc(docs.Items[i]).OnChanged:=nil;
    end;
  end;
  if assigned(docs) then
  begin
{
    cnt:=docs.Count;
    for i:=(cnt-1) downto 0 do
    begin
      itm:=TSciDoc(docs.Items[i]);
      if Assigned(itm) then
      begin
        docs.Items[i]:=nil;
        FreeAndNil(itm);
      end;
    end;
}
    FreeAndNil(docs);
  end;
  inherited;
end;

procedure TSciDocumentTabControl.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited;
  if Operation=opRemove then
  begin
    if AComponent=fEditor then
    begin
      if assigned(docs) then FreeAndNil(docs);
      if assigned(Tabs) then Tabs.Clear;
      fEditor:=nil;
    end;
  end;
end;

procedure TSciDocumentTabControl.Attach;
var
  sci : TSciDoc;
  highl,theext : String;

begin
  if assigned(docs) then
  begin
    try
      Tabs.BeginUpdate;
      if (assigned(Tabs)) and (Tabs.Count>0) then
        Tabs.Clear;
      if (docs.Count>0) then docs.Clear;
      if assigned(fEditor) then
      begin
        sci:=TSciDoc.Create(fEditor,Self,true);
        sci.Index:=0;
        sci.TabName:=FDefaultTabName;
        sci.OnChanged:=EvttabChanged;
        if fEditor is TScintilla then
        begin
          highl:=nullHighlighter;
          theext :=LowerCase(ExtractFileExt(FDefaultExt));
          if assigned(FOnDetectHighlighter) then
          begin
            FOnDetectHighlighter(self,theext,highl);
          end;
          sci.Highlighter:=highl;

        end;
        docs.Add(sci);
        Tabs.Add(sci.TabName);
        if assigned(FOnOpenedAndInited) then FOnOpenedAndInited(Self,sci.Index,sci);
      end;
    finally
      Tabs.EndUpdate;
    end;
  end;
end;

procedure TSciDocumentTabControl.DoLoadFromFile(const FileName : String);
begin
  FEditor.LoadFromFile(FileName);
end;

function TSciDocumentTabControl.NewDocument : Integer;
begin
  result:=Add(FDefaultTabName,sUntitled+FDefaultExt);
  if result<>-1 then
  TSciDoc(docs.Items[result]).Changed;
  if assigned(FOnOpenedAndInited) then FOnOpenedAndInited(Self,result,TSciDoc(docs.Items[result]));

end;

function TSciDocumentTabControl.Open(const filename : String;MayBeUnicode : Boolean) : Boolean;
var
  itm,nitm : TSciDoc;
  highl,theext : String;
  doccnt : Integer;
  i,newitemindex : Integer;
  efname : String;
  fullfilename : String;
  confirmed : Integer;
begin
  fullfilename:=filename;
  if FExists(fullfilename) then
  begin
    doccnt:=docs.Count;
    for i:=0 to (doccnt-1) do
    begin
      itm:=TSciDoc(docs.Items[i]);
      if assigned(itm) and (CompareText(itm.FileName,fullfilename)=0) then
      begin
        ChgTab(i);
        if (itm.LastChanged<=FileAge(fullfilename)) then
        begin
          if itm.Modified then
            confirmed:=MessageBox(Handle,PChar(Format(sReload,[fullfilename])),PChar(sConfirmation),MB_YESNO)
          else
            confirmed:=IDYES;
          if confirmed=IDYES then
          begin
            DoLoadFromFile(filename);
            itm.LastChanged:=FileAge(fullfilename);
          end;
        end;
        Result:=True;
        Exit;
      end;
    end;
    nitm:=TSciDoc(docs.Items[0]);
    if (doccnt>1) or (fEditor.Modified) or (StrLIComp(PChar(nitm.TabName),PChar(FDefaultTabName),Length(FDefaultTabName))<>0) then
    begin
      efname:=ExtractFileName(filename);
      newitemindex:=Add(efname,fullfilename);
      itm:=TSciDoc(docs.Items[newitemindex]);
      doccnt:=doccnt+1;
    end else
    begin
      itm:=TSciDoc(docs.Items[0]);
      itm.FileName:=fullfilename;
      if fEditor is TScintilla then
      begin
        highl:=nullHighlighter;
        theext :=GetFileExt(filename);
        if assigned(FOnDetectHighlighter) then
        begin
          FOnDetectHighlighter(self,theext,highl);
        end;
        itm.Highlighter:=highl;
      end;
    end;
    DoLoadFromFile(filename);
    if assigned(FEditor.Streamer) then
    begin
      itm.StreamExtra:=fEditor.Streamer.GetData;
      itm.StreamExtraStr:=fEditor.Streamer.GetDataStr;
    end else
    begin
      itm.StreamExtra:=0;
      itm.StreamExtraStr:='';
    end;
    if doccnt=1 then ChgTab(0);
    if assigned(FOnOpenedAndInited) then FOnOpenedAndInited(Self,itm.Index,itm);
    result:=true;
  end else
  begin
    doccnt:=docs.Count;
    if (doccnt>1) or (fEditor.Modified) or (StrLIComp(PChar(TSciDoc(docs.Items[0]).TabName),PChar(FDefaultTabName),Length(FDefaultTabName))<>0) then
    begin
      efname:=ExtractFileName(filename);
      newitemindex:=Add(efname,fullfilename);
      itm:=TSciDoc(docs.Items[newitemindex]);
      doccnt:=doccnt+1;
    end else
    begin
      itm:=TSciDoc(docs.Items[0]);
      itm.FileName:=fullfilename;
      if fEditor is TScintilla then
      begin
        highl:=nullHighlighter;
        theext:=GetFileExt(filename);
        if assigned(FOnDetectHighlighter) then
        begin
          FOnDetectHighlighter(self,theext,highl);
        end;
        itm.Highlighter:=highl;
      end;
    end;
    if doccnt=1 then ChgTab(0);
    if assigned(FOnOpenedAndInited) then FOnOpenedAndInited(Self,itm.Index,itm);
    result:=true;
  end;
end;

procedure  TSciDocumentTabControl.Close(const index : Integer;const askifneeded : Boolean);
var
  allowclose : Boolean;
  idx : Integer;
begin
  allowclose:=true;
  if index=-1 then
    idx:=TabIndex
  else
    idx:=Index;
  if (askifneeded) and (assigned(FOnClosing)) then
  begin
    if TSciDoc(docs[idx]).IsActive<>True then
    begin
      Activate(idx);
    end;
    FOnClosing(self,idx,allowclose)
  end;
  if allowclose then
    Remove(idx);
end;

function TSciDocumentTabControl.Add(const tabname : string;const thefilename : String) : Integer;
var
  sci,itm : TSciDoc;
  atidx : Integer;
  theext,highl : String;
begin
  if assigned(fEditor) and (assigned(docs)) then
  begin
    try
      Tabs.BeginUpdate;
      itm:=ActiveDocument;
      itm.AssignFromEditor;
      sci:=TSciDoc.Create(fEditor,Self,false);
      if tabname<>'' then
        sci.TabName:=tabname;
      if thefilename<>'' then
        sci.FileName:=thefilename;
      atidx:=docs.Add(sci);
      sci.Index:=atidx;
      Tabs.Insert(atidx,tabname);
      sci.OnChanged:=EvttabChanged;
      if thefilename<>'' then sci.Changed;
      if fEditor is TScintilla then
      begin
        highl:=nullHighlighter;
        if thefilename<>'' then
          theext :=GetFileExt(thefilename);
        if assigned(FOnDetectHighlighter) then
        begin
          FOnDetectHighlighter(self,theext,highl);
        end;
        sci.Highlighter:=highl;
      end;
      ChgTab(atidx);
      Result :=atidx;
    finally
      Tabs.EndUpdate;
    end;
  end else
    result:=-1;
end;

procedure TSciDocumentTabControl.ChgTab(const newtab : Integer);
begin
  TabIndex:=newtab;
  Change;
end;

procedure TSciDocumentTabControl.Remove(const index : Integer);
var
  sci : TSciDoc;
  id,cur,i : Integer;
  idxtoremove : Integer;
  highl,theext : String;
begin
  if (assigned(fEditor)) and (assigned(docs)) then
  begin
    try
      Tabs.BeginUpdate;
      sci:=TSciDoc(docs.Items[index]);
      idxtoremove:=sci.Index;
      if docs.Count=1 then
      begin
        fEditor.ClearAll;
      end else
      begin
        docs.Remove(sci);
        docs.Pack;
      end;

      if Tabs.Count>1 then
      begin
        cur:=idxtoremove;
        Tabs.Delete(idxtoremove);
        id:=Tabs.Count;
        if(id>cur+1) then
          Inc(cur)
        else if cur=0 then
        begin
        end else
          Dec(cur);
        for i:=idxtoremove to (docs.Count-1) do //this is moved here to adjust the indexes BEFORE changing tabs.. It got Activate confused it seemd.
        begin
          TSciDoc(docs.Items[i]).Index:=i;
        end;
        ChgTab(cur);
      end else
      begin
        sci:=TSciDoc(docs.Items[0]);
        sci.FileName:=sUntitled+FDefaultExt;
        fEditor.ClearDocument;
        sci.Modified:=false;
        sci.FStreamExtra:=0;
        sci.FStreamExtraStr:='';
        if fEditor is TScintilla then
        begin
          highl:=nullHighlighter;
          theext :=FDefaultExt;
          if assigned(FOnDetectHighlighter) then
          begin
            FOnDetectHighlighter(self,theext,highl);
          end;
          sci.Highlighter:=highl;
        end;
        ChgTab(0);
      end;
    finally
      Tabs.EndUpdate;
    end;
  end;
end;

function TSciDocumentTabControl.CanChange : Boolean;
var
  itm : TSciDoc;
begin
  if (assigned(fEditor)) and (assigned(docs)) then
  begin
    itm :=ActiveDocument;
    if assigned(itm) then  itm.AssignFromEditor;
    result:=Inherited CanChange;
  end else
    result:=false;
end;

procedure TSciDocumentTabControl.Change;
begin
  if assigned(docs) then
  begin
    TSciDoc(docs.Items[TabIndex]).Activate;
  end;
  inherited;
end;

procedure TSciDocumentTabControl.DoTabHint(const TabIndex : Integer;var HintText : String;doc : TSciDoc);
begin
  if assigned(FOnTabHint) then
    FOnTabHint(Self,TabIndex,HintText,doc);
end;

procedure TSciDocumentTabControl.CMHintShow(var Message: TMessage);
var
  Index: Integer;
begin
  with TCMHintShow(Message) do
  begin
    if not ShowHint then Message.Result := 1
    else
    begin
      with HintInfo^ do
      begin
        // show that we want a hint
        Result := 0;
        // predefined colors always get their names as tooltip
        index:=IndexOfTabAt(CursorPos.X,CursorPos.Y);
        if index<>-1 then
        begin
          if FEditor is TScintilla then
            HintStr:=sLang+TSciDoc(docs.Items[index]).Highlighter
          else
            HintStr:='';
          if assigned(FOnTabHint) then
            DoTabHint(index,HintStr,TSciDoc(docs.Items[index]));
          CursorRect:=TabRect(index);
        end else
        begin
          HintStr:=Hint;
        end;
      end;
    end;
  end;
end;

procedure TSciDocumentTabControl.Activate(const docno : LongInt);
begin
  if TabIndex<>docno then
  begin
  if (CanChange) then
  begin
    TabIndex:=docno;
    if assigned(docs) then
    begin
      TSciDoc(docs.Items[docno]).Activate;
    end;
  end;
  end;
end;

procedure TSciDocumentTabControl.RefreshTabs;
var
  cnt : Integer;
  i : Integer;
  ist : String;
begin
  try
    Tabs.BeginUpdate;
    Tabs.Clear;
    if assigned(docs) then
    begin
      cnt:=docs.Count;
      for i:=0 to (cnt-1) do
      begin
        str(i+1,ist);
        if (i+1)<10 then
          Tabs.Add('&'+ist+' '+TSciDoc(docs.Items[i]).TabName)
        else
          Tabs.Add(ist+' '+TSciDoc(docs.Items[i]).TabName);
      end;
    end;
  finally
    Tabs.EndUpdate;
  end;
end;

procedure TSciDocumentTabControl.SetEditor(Value : TScintillaBase);
var
  tp: TPoint;
  r : TRect;
begin
  if (Value<>fEditor) then
  begin
    if assigned(Value) then
    begin
      fEditor:=Value;
      if (not (csWriting in ComponentState)) and (not(csDestroying in ComponentState)) then
      begin
        fEditor.Parent:=self;
        fEditor.Visible:=true;
        fEditor.Align:=alClient;
        docs:=TObjectList.Create(true);
        Attach;
        RefreshTabs;
      end;
    end else
    begin
      if assigned(docs) then
      begin
        FreeAndNil(docs);
      end;
      if assigned(Tabs) and (Tabs.Count>0) then
        Tabs.Clear;
      if fEditor.HandleAllocated then
      begin
        if assigned(Parent) then
        begin
          fEditor.Align:=alNone;
          r :=ClientRect;
          tp.x:=r.Left;
          tp.y:=r.Top;
          tp:=fEditor.ClientToParent(tp);
          fEditor.Parent:=Parent;
          fEditor.Left:=tp.x;
          fEditor.Top:=tp.y;
        end;
      end;
      fEditor:=nil;
    end;
  end;
end;

function TSciDocumentTabControl.getCount : Integer;
begin
  if assigned(docs) then
    result:=docs.Count
  else
    result:=0;
end;

function TSciDocumentTabControl.GetDocItm(const Index : Integer) : TSciDoc;
begin
  if assigned(docs) then
    result :=TSciDoc(docs.Items[Index])
  else
    result:=nil;
end;

function TSciDocumentTabControl.GetActiveDocument : TSciDoc;
begin
  Result :=TSciDoc(docs.Items[TabIndex]);
end;

procedure TSciDocumentTabControl.SetDefaultExt(const Value : String);
var
  oldtab : String;
  i,cnt : Integer;
  itm : TSciDoc;
  theext,highl : String;
begin
  oldtab:=FDefaultTabName;
  FDefaultExt:=Value;
  if Pos('.',FDefaultExt)=0 then
    Insert('.',FDefaultExt,1);
  FDefaultTabName:='<'+sUntitled+FDefaultExt+'>';
  cnt:=Tabs.Count;
  for i:=0 to (cnt-1) do
  begin
    itm:=TSciDoc(docs.Items[i]);
    if StrLIComp(PChar(itm.TabName),PChar(oldtab),Length(oldtab))=0 then
    begin
      itm.TabName:=FDefaultTabName;
      itm.FileName:=sUntitled+FDefaultExt;

      if fEditor is TScintilla then
      begin
        theext :=FDefaultExt;
        highl:=itm.Highlighter;
        if assigned(FOnDetectHighlighter) then
        begin
          FOnDetectHighlighter(self,theext,highl);
        end;
        if itm.Highlighter<>highl then
          itm.Highlighter:=highl;
      end;
    end;
  end;
end;

procedure TSciDocumentTabControl.EvttabChanged(Sender : TObject);
var
  tmp : TSciDoc;
  ist : String;
begin
  tmp:=TSciDoc(Sender);
  if tmp.Index<Tabs.Count then
  begin
    Str(tmp.Index+1,ist);
    if (tmp.Index+1)<10 then
      Tabs.Strings[tmp.Index]:='&'+ist+' '+tmp.TabName
    else
      Tabs.Strings[tmp.Index]:=ist+' '+tmp.TabName;
  end;
end;

procedure TSciDoc.SetFileName(const Value : string);
var
  anExt : string;
  function GetExt : String;
  var
    tmp : String;
    Len : Integer;
  begin
    len:=Length(Value);
    tmp:=ExtractFileExt(Copy(Value,2,len-2));
    Result:=tmp;
  end;
begin
  if Value<>FFileName then
  begin
    FFileName:=Value;
    if Pos('<'+sUntitled,Value)=1 then
    begin
      anExt:=GetExt;
      FTabName:='<'+sUntitled+anExt+'>';
      FFileName:=sUntitled+anExt;
      FLastChanged:=-1;
    end else
    begin
      FTabName:=ExtractFileName(Value);
      FLastChanged:=FileAge(Value);
    end;
    Changed;
  end;
end;

procedure TSciDoc.SetWordChars(const Value : String);
begin
  if FWordChars<>Value then
  begin
    FWordChars:=Value;
    if IsActive then
      TScintillaBase(fEditor).WordChars:=FWordChars;
  end;
end;

procedure TSciDoc.Changed;
begin
  if assigned(FOnChanged) then FOnChanged(self);
end;

procedure TSciDoc.SetTabName(const Value : string);
begin
  if Value<>FTabName then
  begin
    FTabName:=Value;
    Changed;
  end;
end;

function TSciDoc.IsActive : Boolean;
var
  ptr : LongInt;
begin
  if fEditor=nil then
  begin
    Result:=false;
    Exit;
  end;
  ptr :=fEditor.GetDocPointer;
  if ptr=documentid then
    result :=true
  else
    result :=false;
end;

constructor TSciDoc.Create(pp : TScintillaBase;ttabctrl : TSciDocumentTabControl;const getcurrent : Boolean);
begin
  FStreamExtra:=0;
  FStreamExtraStr:='';
  inherited Create;
  fTabCtrl:=ttabctrl;
  fEditor :=pp;
  FCodePage:=pp.GetCodePage;
  FUseTabs:=False;
  FTabName:='<'+sUntitled+TSciDocumentTabControl(fTabCtrl).FDefaultExt+'>';
  FModified:=false;
  FWordChars :='_'+sci_alphachars+sci_numericchars;
  FHighlighter:=nullHighlighter;
  FAutoIgnoreCase:=False;
  FAutoStartChars:='';
  FAutoStopChars:='';
  FLastChanged:=-1;
  FExtraData :=nil;
  FFileName :=sUntitled+TSciDocumentTabControl(fTabCtrl).FDefaultExt;
  if getcurrent=false then
  begin
    documentid:=fEditor.CreateDocument;
    AddRef;
  end  else
  begin
    documentid:=fEditor.GetDocPointer;
    AddRef;
  end;
  AssignFromEditor;
end;

destructor TSciDoc.Destroy;
begin
  FFoldStates:=nil;
  if assigned(FOnRemoveExtraData) then
  begin
    FOnRemoveExtraData(Self);
  end;
  Release;
  inherited;
end;

procedure TSciDoc.StoreFoldStates;
var
  maxLine : LongInt;
  foldPoints : LongInt;
  line : LongInt;
  level : LongInt;
  expanded : Boolean;
  atpos : Integer;
begin
  FFoldStates:=nil;
  if Highlighter=nullHighlighter then Exit;
  foldPoints:=0;
  maxline:=fEditor.GetLineCount;
  for line := 0 to (maxLine-1) do
  begin
    level := fEditor.GetFoldLevel(line);
    if ((level and SC_FOLDLEVELHEADERFLAG)<>0) then Inc(foldPoints);
  end;
  if foldPoints>0 then
  begin
    SetLength(FFoldStates,foldPoints);
    atpos:=0;
    for line := 0 to  (maxLine-1) do
    begin
      level := fEditor.GetFoldLevel(line);
      if ((level and SC_FOLDLEVELHEADERFLAG)<>0) then
      begin
        expanded:=fEditor.GetFoldExpanded(line);
        FFoldStates[atpos].Line:=line;
        FFoldStates[atpos].Expanded:=expanded;
        Inc(atpos);
      end;
    end;
  end;
end;

procedure TSciDoc.RestoreFoldStates;
var
  i : LongInt;
  expanded : Boolean;
begin
  if (not assigned(FFoldStates)) or (Highlighter=nullHighlighter) then Exit;
  for i:=Low(FFoldStates) to High(FFoldStates) do
  begin
    expanded:=fEditor.GetFoldExpanded(FFoldStates[i].Line);
    if (FFoldStates[i].Expanded=False) and (expanded=True) then
    begin
      fEditor.ToggleFold(FFoldStates[i].Line);
    end;
    if (FFoldStates[i].Expanded=True) and (expanded=False) then
    begin
      fEditor.ToggleFold(FFoldStates[i].Line);
    end;
  end;
end;

procedure TSciDoc.AssignFromEditor;
begin
  with fEditor as TScintillaBase do
  begin
    StoreFoldStates;
    FFirstLineInView:=GetCurrentScrollPosition;
    FSelStart:=SelStart;
    FSelLength:=SelLength;
    FModified:=fEditor.Modified;
    FReadOnly :=ReadOnly;
    FWordChars :=WordChars;
    if FEditor is TScintillaMemo then
    begin
      FIndentWidth:=IndentWidth;
      FTabWidth:=TabWidth;
      FIndentation:=Indentation;
      FUseTabs:=UseTabs;
    end;
    FCodePage:=GetCodePage;
    FStreamClass:=StreamClass;
  end;
  if (fEditor is TScintilla) and (assigned(TScintilla(fEditor).LanguageManager)) then
  begin
    fHighlighter:=TScintilla(fEditor).LanguageManager.SelectedLanguage;
  end;
end;

procedure TSciDoc.AssignToEditor;
var
  curtop : LongInt;
  xlinestart : LongInt;
  xlineend : LongInt;
  xlinetop : LongInt;
  hadwordwrap : TWordWrapType;
begin
  hadwordwrap:=fEditor.WordWrap;
  if hadwordwrap<>sciNoWrap then fEditor.WordWrap:=sciNoWrap;
  if (fEditor is TScintilla) and (assigned(TScintilla(fEditor).LanguageManager))
  //and (TScintilla(fEditor).LanguageManager.SelectedLanguage<>self.fHighlighter)
  //Removed to fix a bug which caused not setting correct number of stylebits
  //for languages such as HTML/PHP on new pages if already using the same language.
  //Temporary fix, until a more speedy one can be done.
  then
    TScintilla(fEditor).LanguageManager.SelectedLanguage:=self.fHighlighter;
  with fEditor as TScintillaBase do
  begin
    RestoreFoldStates;
    xlinestart:=LineFromPosition(FSelStart);
    xlineend:=LineFromPosition(FSelStart+FSelLength);
    EnsureVisibleEnforcePolicy(xlinestart);
    EnsureVisibleEnforcePolicy(xlineend);
    SelStart:=FSelStart;
    SelLength:=FSelLength;
    fEditor.Modified:=FModified;
    ReadOnly:=FReadOnly;
    WordChars :=FWordChars;
    StreamClass:=FStreamClass;
    if assigned(Streamer) then
    begin
      Streamer.SetData(FStreamExtra);
      Streamer.SetDataStr(FStreamExtraStr);
    end;
    if FEditor is TScintillaMemo then
    begin
      Indentation:=FIndentation;
      TabWidth:=FTabWidth;
      IndentWidth:=FIndentWidth;
      UseTabs:=FUseTabs;
    end;
    if FEditor.GetCodePage<>FCodePage then
      FEditor.SetCodePage(FCodePage);
    //Position the cursor back where it was
    curtop:=GetFirstVisibleLine;
    xlinetop:=VisibleFromDocLine(FFirstLineInView);
    LineScroll(0,xlinetop-curtop);
    if hadwordwrap<>sciNoWrap then
      WordWrap:=hadwordwrap;
    if Visible and Showing then
    SetFocus;
  end;
end;

procedure TSciDoc.Activate;
begin
  if not IsActive then
  begin
    if (TSciDocumentTabControl(fTabCtrl).TabIndex<>Index) and (TSciDocumentTabControl(fTabCtrl).CanChange) then
    begin
      TSciDocumentTabControl(fTabCtrl).TabIndex:=Index;
    end;
    fEditor.SetDocPointer(documentid);
    AssignToEditor;
  end;
end;

procedure TSciDoc.AddRef;
begin
  if (assigned(fEditor)) and (documentid<>0) then
  begin
    fEditor.AddRefDocument(documentid);
  end;
end;

procedure TSciDoc.Release;
begin
  if (assigned(fEditor)) and (documentid<>0) then
  begin
    if fEditor.HandleAllocated then
      fEditor.ReleaseDocument(documentid);
  end;
  documentid:=0;
end;

function TSciDoc.IsUntitled  : Boolean;
begin
  if (Pos('<'+sUntitled,TabName)<>0) and (Pos('>',TabName)<>0) then
    Result:=True
  else
    Result:=False;
end;

procedure TSciDoc.SetModified(const Value : Boolean);
begin
  FModified:=Value;
  if assigned(fEditor) and (IsActive=True) then
  begin
    fEditor.Modified:=Value;
  end;
end;
procedure TSciDoc.Close;
begin
  if assigned(fTabCtrl) then
  TSciDocumentTabControl(fTabCtrl).Close(Index);
end;

procedure TSciDoc.SetHighlighter(const Value : String);
begin
  fHighlighter:=Value;
  if IsActive then
  begin
    if (fEditor is TScintilla) and (assigned(TScintilla(fEditor).LanguageManager)) then
    begin
      if Value<>TScintilla(fEditor).LanguageManager.SelectedLanguage then
      begin
        TScintilla(fEditor).LanguageManager.SelectedLanguage:=fHighlighter;
      end;
    end;
  end;
end;

procedure TSciDoc.SetIndentWidth(const Value : Integer);
begin
  fIndentWidth:=Value;
  if IsActive then
  begin
    if fEditor is TScintillaMemo then
    begin
      if Value<>TScintillaMemo(fEditor).IndentWidth then
      begin
        TScintillaMemo(fEditor).IndentWidth:=fIndentWidth;
      end;
    end;
  end;
end;

procedure TSciDoc.SetTabWidth(const Value : Integer);
begin
  fTabWidth:=Value;
  if IsActive then
  begin
    if Value<>TScintillaMemo(fEditor).TabWidth then
    begin
      TScintillaMemo(fEditor).TabWidth:=fTabWidth;
    end;
  end;
end;

procedure TSciDoc.SetIndentation(const Value : TIndentationOptions);
begin
  fIndentation:=Value;
  if IsActive then
  begin
    if Value<>TScintillaMemo(fEditor).Indentation then
    begin
      TScintillaMemo(fEditor).Indentation:=fIndentation;
    end;
  end;
end;

procedure TSciDoc.SetUseTabs(const Value : Boolean);
begin
  FUseTabs:=Value;
  if IsActive then
  begin
    if Value<>TScintillaMemo(fEditor).UseTabs then
    begin
      TScintillaMemo(fEditor).UseTabs:=Value;
    end;
  end;
end;

procedure TSciDoc.SetCodePage(const Value : LongInt);
begin
  FCodePage:=Value;
  if IsActive then
  begin
    if Value<>fEditor.GetCodePage then
    begin
      fEditor.SetCodePage(Value);
    end;
  end;
end;

procedure TSciDoc.SetStreamClass(Value : TSciStreamClass);
begin
  FStreamClass:=Value;
  if IsActive then
  begin
    if Value<>fEditor.StreamClass then
    begin
      fEditor.StreamClass:=Value;
    end;
  end;
end;

procedure TSciDoc.SetStreamExtra(const Value : Integer);
begin
  FStreamExtra:=Value;
  if IsActive then
  begin
    if assigned(fEditor.Streamer) then
      fEditor.Streamer.SetData(Value);
  end;
end;

procedure TSciDoc.SetStreamExtraStr(const Value : String);
begin
  FStreamExtraStr:=Value;
  if IsActive then
  begin
    if assigned(fEditor.Streamer) then
      fEditor.Streamer.SetDataStr(Value);
  end;
end;

end.

Added src/delphisci/SciFileExtensionsManager.pas.























































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
  Delphi Scintilla Interface Components
  Copyright (C) 2004,2005 Jan Martin Pettersen (hdalis)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later
  version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free
  Software Foundatifon, Inc., 59 Temple Place, Suite 330, Boston, MA
  02111-1307 USA
}
{
  Author : hdalis (Jan Martin Pettersen)
  Created: 18/04/2005
      $Id: SciFileExtensionsManager.pas,v 1.0 $
  Purpose: Manages file extensions

    Usage: Mostly internally used. Access the class via the ExtMapper function

  History: 18/04/2005 First release
                      Moved the ExtMapper from SciPropertyMgr to SciFileExtensionsManager.Pas, and
                      changed the way the extensions are stored.. Now it's a collection of items,
                      with two properties. Language, and Extensions. Use ExtMapper.Add to add new extensions.
           09/06/2005 Added the GetFileSpec function to the TExtensionItem. This function transforms the
                      filespecs defined (.foo1;.foo2) to filespecs usable for the file dialogs e.g: Description (filespec)|filespec

  Differences from the original ExtensionMapper:
    - Renamed the DetectLexer function to the more logical DetectLanguage
    - Added the possibility to remove a extension/language from the extensionmapping.
    - Added direct access to the extensions via the property ExtensionsList.
    - FillExtensionsMap is not called automatically because if the language isn't
    in the languagemanager, then it's possible it is created on the fly (with the NULL
    settings), and that may not be what you wished for.
    - FillExtensionsMap can now verify that a language exists before adding the extensions
    pertaining to that language.


}
{$Include SciCommonDef.Inc}
unit SciFileExtensionsManager;
interface
uses Classes,ScintillaLanguageManager;
type
  TExtensionItem=class(TCollectionItem)
  private
    FLanguage : String;
    FExtensions : String;
    procedure SetLanguage(const Value : String);
    procedure SetExtensions(const Value : String);
  public
    procedure Assign(Source: TPersistent);override;
  published
    property Language : String read FLanguage write SetLanguage;
    property Extensions : String read FExtensions write SetExtensions;
  end;

  TExtensionsToLanguageList=class(TCollection)
  private
    FExtensionSeparator : AnsiChar;
    lastAccessed : TExtensionItem;
    procedure SetItem(Index:Integer; Value: TExtensionItem);
    function GetItem(Index:Integer): TExtensionItem;
    function LanguageFromExt(const ExtensionToFind : String;const Separator : AnsiChar) : String;
    function RemoveFromList(const ExtensionToFind : String;const Separator : AnsiChar) : Boolean;
    function AddIfNotSame(const MapFromWhatExtension : String;const ToWhatLanguage : String;const Separator : AnsiChar) : Boolean;
  public
    constructor Create(ItemClass: TCollectionItemClass);
    procedure Assign(Source: TPersistent);override;
    property Items[Index : Integer] : TExtensionItem read GetItem write SetItem;default;
    function Add: TExtensionItem;
    procedure Delete(Index: Integer);
    procedure MapLanguageToExts(const WhatLanguage : String;const AllExtensions : String;CheckWith : TSciLanguageManager=nil);
    function GetLangItem(const WhatLanguage : String) : TExtensionItem;
  published
    property ExtensionSeparator : AnsiChar read FExtensionSeparator write FExtensionSeparator default ';';
  end;

  TExtensionMapper=class(TObject)
  private
    FExtensionItems : TExtensionsToLanguageList;
    procedure SetExtensionItems(Value : TExtensionsToLanguageList);
  public
    constructor Create;
    destructor  Destroy;override;
    procedure Add(const MapFromWhatExtension : String;const ToWhatLanguage : String);
    function DetectLanguage(const ExtensionToFind : string) : String;
    procedure Remove(const ExtensionToRemove : String);
    procedure RemoveAllWithLang(const MappedToWhatLang : String);
    procedure FillExtensionMap(LanguageManager : TSciLanguageManager=nil);
    property ExtensionsList : TExtensionsToLanguageList read FExtensionItems write SetExtensionItems;
  end;

function ExtMapper : TExtensionMapper;
implementation
uses SciResLang,sciUtils,SysUtils;
var
  FExtMap : TExtensionMapper;

function ExtMapper : TExtensionMapper;
begin
  if FExtMap=nil then
  FExtMap:=TExtensionMapper.Create;
  Result:=FExtMap;
end;

constructor TExtensionMapper.Create;
begin
  inherited;
  FExtensionItems:=TExtensionsToLanguageList.Create(TExtensionItem);
end;
destructor TExtensionMapper.Destroy;
begin
  if assigned(FExtensionItems) then FreeAndNil(FExtensionItems);
  inherited;
end;

{Fill the list with default extensionmappings.}
procedure TExtensionMapper.FillExtensionMap(LanguageManager : TSciLanguageManager);
begin
  with FExtensionItems do
  begin
    MapLanguageToExts('C++/C','.c;.cc;.cpp;.cxx;.h;.hh;.hxx;.hpp',LanguageManager);
    MapLanguageToExts('C#','.cs',LanguageManager);
    MapLanguageToExts('Resource','.rc;.rc2;.dlg',LanguageManager);
    MapLanguageToExts('HTML','.htm;.html;.asp=;.shtml;.htd;.htt;.cfm;.tpl;.hta',LanguageManager);
    MapLanguageToExts('PHP','.php;.php3;.phtml',LanguageManager);
    MapLanguageToExts('XML','.xml;.xsl;.xslt;.svg;.xul;.xsd;.dtd;.axl;.xrc;.bpk;.bpr;.ant',LanguageManager);
    MapLanguageToExts('WML','.wml',LanguageManager);
    MapLanguageToExts('PERL','.pl;.pm;.cgi;.pod',LanguageManager);
    MapLanguageToExts('CSS','.css',LanguageManager);
    MapLanguageToExts('Pascal','.pas;.inc;.dpk;.dpr',LanguageManager);
    MapLanguageToExts('SQL','.sql',LanguageManager);
    MapLanguageToExts('VB','.vb;.bas;.frm;.cls;.ctl;.pag;.dsr;.dob',LanguageManager);
    MapLanguageToExts('VBScript','.vbs;.dsm',LanguageManager);
    MapLanguageToExts('Java','.java',LanguageManager);
    MapLanguageToExts('JavaScript','.js',LanguageManager);
    MapLanguageToExts('IDL','.idl;.odl',LanguageManager);
    MapLanguageToExts('Python','.py;.pyw',LanguageManager);
    MapLanguageToExts('TCL/TK','.tcl',LanguageManager);
    MapLanguageToExts('LUA','.lua',LanguageManager);
    MapLanguageToExts('ASN1','.mib',LanguageManager);
    MapLanguageToExts('VHDL','.vhdl',LanguageManager);
    MapLanguageToExts('Diff','.diff;.patch',LanguageManager);
    MapLanguageToExts('Makefile','.mak;makefile;.make;.iface=Makefile',LanguageManager);
    MapLanguageToExts('Batch','.bat;.cmd;.nt',LanguageManager);
    MapLanguageToExts('Apache Config','.conf',LanguageManager);
    MapLanguageToExts('Properties','.properties;.ini;.inf;.reg;.url;.cfg;.cnf',LanguageManager);
    MapLanguageToExts('ADA','.ads;.adb',LanguageManager);
    MapLanguageToExts('nnCronTab','.spf;.tab',LanguageManager);
    MapLanguageToExts('Lisp','.lsp;.lisp',LanguageManager);
    MapLanguageToExts('Scheme','.scm;.smd;.ss',LanguageManager);
    MapLanguageToExts('AutoIt_3','.au3',LanguageManager);
    MapLanguageToExts('TEX','.tex;.sty',LanguageManager);
    MapLanguageToExts('BASH','.sh;.bsh',LanguageManager);
    MapLanguageToExts('Fortran','.f90;.f95;.f2k',LanguageManager);
    MapLanguageToExts('Fortran77','.f;.for',LanguageManager);
    MapLanguageToExts('EScript','.em;.src',LanguageManager);
    MapLanguageToExts('Eiffel','.e',LanguageManager);
    MapLanguageToExts('Baan','.bc;.cln',LanguageManager);
    MapLanguageToExts('Avenue','.ave',LanguageManager);
    MapLanguageToExts('ASM','.asm',LanguageManager);
    MapLanguageToExts('KIX','.kix',LanguageManager);
    MapLanguageToExts('Objective_Caml','.ml;.mli',LanguageManager);
    MapLanguageToExts('BlitzBasic','.bb',LanguageManager);
    MapLanguageToExts('PureBasic','.pb',LanguageManager);
  end;
end;

// Add a language mapping.. New mappings removes eventual previous existence.
procedure TExtensionMapper.Add(const MapFromWhatExtension : String;const ToWhatLanguage : String);
var
  restOfString,CurrentWord : String;
begin
  if FExtensionItems=nil then Exit;
  restOfString:=MapFromWhatExtension;
  repeat
    CurrentWord:=WordBefore(restOfString,FExtensionItems.ExtensionSeparator);
    if CurrentWord<>'' then
      FExtensionItems.AddIfNotSame(CurrentWord,ToWhatLanguage,FExtensionItems.ExtensionSeparator);
  until restOfString='';
end;

function TExtensionsToLanguageList.RemoveFromList(const ExtensionToFind : String;const Separator : AnsiChar) : Boolean;
var
  itemCount,i : Integer;
  extensionItem : TExtensionItem;
begin
  Result:=False;
  itemCount:=Count;
  for i:=0 to (itemCount-1) do
  begin
    extensionItem:=Items[i];
    if IsWordInString(extensionItem.FExtensions,ExtensionToFind,True,separator) then
    begin
      extensionItem.Extensions:=BuildWordlistExcept(extensionItem.Extensions,ExtensionToFind,True,separator);
      lastAccessed:=extensionItem;
    end;
  end;
end;

procedure TExtensionMapper.RemoveAllWithLang(const MappedToWhatLang : String);
var
  i,itemCount : Integer;
begin
  itemCount:=FExtensionItems.Count;
  for i:=0 to (itemCount-1) do
  begin
    if FExtensionItems.Items[i].FLanguage=MappedToWhatLang then
    begin
      FExtensionItems.Delete(i);
      Exit;
    end;
  end;
end;

function TExtensionsToLanguageList.AddIfNotSame(const MapFromWhatExtension : String;const ToWhatLanguage : String;const Separator : AnsiChar) : Boolean;
var
  itemCount,i : Integer;
  foundPos : Integer;
  extensionItem : TExtensionItem;
begin
  Result:=False;
  if (MapFromWhatExtension='') or (ToWhatLanguage='') then Exit;
  itemCount:=Count;
  if assigned(lastAccessed) and (lastAccessed.FLanguage=ToWhatLanguage) then
  begin
    if (IsWordInString(lastAccessed.FExtensions,MapFromWhatExtension,True,separator)) then
    begin
      Result:=True;
      Exit;
    end;
  end;

  for i:=0 to (itemCount-1) do
  begin
    extensionItem:=Items[i];
    if IsWordInString(extensionItem.FExtensions,MapFromWhatExtension,True,separator) then
    begin
      if extensionItem.FLanguage=ToWhatLanguage then
      begin
        lastAccessed:=extensionItem;
        Result:=False;
        Exit;
      end;
      foundPos:=Pos(MapFromWhatExtension,extensionItem.FExtensions);
      if(foundPos>0) then
      begin
        extensionItem.Extensions:=BuildWordlistExcept(extensionItem.Extensions,MapFromWhatExtension,True,separator);
      end;
    end;
    if extensionItem.FLanguage=ToWhatLanguage then
    begin
      if Trim(extensionItem.FExtensions)<>'' then
        extensionItem.Extensions:=extensionItem.FExtensions+Separator+MapFromWhatExtension
      else extensionItem.Extensions:=MapFromWhatExtension;
      Result:=True;
      lastAccessed:=extensionItem;
      Exit;
    end;
  end;
  extensionItem:=Add;
  extensionItem.Language:=ToWhatLanguage;
  extensionItem.Extensions:=MapFromWhatExtension;
  lastAccessed:=extensionItem;
  Result:=True;
end;

procedure TExtensionMapper.Remove(const ExtensionToRemove : String);
begin
  FExtensionItems.RemoveFromList(ExtensionToRemove,FExtensionItems.ExtensionSeparator);
end;

function TExtensionsToLanguageList.LanguageFromExt(const ExtensionToFind : String;const Separator : AnsiChar) : String;
var
  itemCount,i : Integer;
  extensionItem : TExtensionItem;
begin
  Result:='null';
  if assigned(lastAccessed) then
  begin
    if IsWordInString(lastAccessed.FExtensions,ExtensionToFind,True,separator) then
    begin
      Result:=lastAccessed.FLanguage;
      Exit;
    end;
  end;
  itemCount:=Count;
  for i:=0 to (itemCount-1) do
  begin
    extensionItem:=Items[i];
    if IsWordInString(extensionItem.FExtensions,ExtensionToFind,True,separator) then
    begin
      Result:=extensionItem.FLanguage;
      lastAccessed:=extensionItem;
      Exit;
    end;
  end;
end;

function TExtensionsToLanguageList.GetLangItem(const WhatLanguage : String) : TExtensionItem;
var
  extensionItem : TExtensionItem;
  i,itemCount : Integer;
begin
  if assigned(lastAccessed) then
  begin
    if lastAccessed.FLanguage=WhatLanguage then
    begin
      Result:=lastAccessed;
      Exit;
    end;
  end;
  Result:=nil;
  itemCount:=Count;
  for i:=0 to (itemCount-1) do
  begin
    extensionItem:=Items[i];
    if extensionItem.FLanguage=WhatLanguage then
    begin
      Result:=extensionItem;
      lastAccessed:=extensionItem;
      Exit;
    end;
  end;
end;

procedure TExtensionsToLanguageList.MapLanguageToExts(const WhatLanguage : String;const AllExtensions : String;CheckWith : TSciLanguageManager);
var
  extensionItem : TExtensionItem;
begin
  if assigned(CheckWith) then
    if CheckWith.HasLanguage(WhatLanguage)=False then
      Exit;
  extensionItem:=GetLangItem(WhatLanguage);
  if not assigned(extensionItem) then
  begin
    extensionItem:=Add;
    extensionItem.Language:=WhatLanguage;
    lastAccessed:=extensionItem;
  end;
  extensionItem.Extensions:=AllExtensions;
end;

function TExtensionMapper.DetectLanguage(const ExtensionToFind : string) : String;
begin
  if FExtensionItems=nil then
  begin
    Result:='null';
    Exit;
  end;
  Result:=FExtensionItems.LanguageFromExt(ExtensionToFind,FExtensionItems.ExtensionSeparator);
end;

procedure TExtensionMapper.SetExtensionItems(Value : TExtensionsToLanguageList);
begin
  FExtensionItems.Assign(Value);
end;

procedure TExtensionItem.Assign(Source: TPersistent);
begin
  if Source is TExtensionItem then
  begin
    FLanguage:=TExtensionItem(Source).Language;
    FExtensions:=TExtensionItem(Source).Extensions;
  end else
  Inherited;
end;

procedure TExtensionItem.SetLanguage(const Value : String);
begin
  FLanguage:=Value;
  Changed(False);
end;

procedure TExtensionItem.SetExtensions(const Value : String);
begin
  FExtensions:=Value;
  Changed(False);
end;

constructor TExtensionsToLanguageList.Create(ItemClass: TCollectionItemClass);
begin
  inherited Create(ItemClass);
  FExtensionSeparator:=';';
end;

procedure TExtensionsToLanguageList.Assign(Source: TPersistent);
begin
  inherited;
  lastAccessed:=nil;
end;

procedure TExtensionsToLanguageList.SetItem(Index:Integer; Value: TExtensionItem);
begin
  inherited SetItem(Index,Value);
end;

function TExtensionsToLanguageList.GetItem(Index:Integer): TExtensionItem;
begin
  Result:=TExtensionItem(inherited GetItem(Index));
end;

function TExtensionsToLanguageList.Add: TExtensionItem;
begin
  Result:=TExtensionItem(inherited Add);
end;

procedure TExtensionsToLanguageList.Delete(Index: Integer);
begin
  lastAccessed:=nil;
  inherited Delete(Index);
end;

initialization

finalization
  FreeAndNil(FExtMap);//added to avoid a memoryleak after a tip by mak
end.

Added src/delphisci/SciKeyBindings.pas.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{
 Adopted from the DelphiWrapper at http://www.pnotepad.com/scintilla
     $Id: SciKeyBindings.pas,v 1.4 2004/11/13 04:29:50 hdalis Exp $
 History:   29/09/2004 Initial Release with Delphi Scintilla Interface Components
            13/10/2004 Added help using ClassExplorer 6.0, Use the helpgenerator to
                       generate the help.
            29/10/2004 Changed the shortcuts for Paraup/Paradown/Wordpartleft/wordpartright * commands 'cause it didn't work with
                       []/\ in all languages. Seemed more logical also.
                       removed the commenting of the stuttered commands.. Don't know if these work, but..
                       (hdalis@users.sourceforge.net)
            19/04/2005 Added the TSciCommandRecHeader, TSciCommandRec records.
                       Added the StickyCaret to the command list. (v1.63)
                       Added VCStyle property..
            20/05/2005 Added LoadKeyCommands and SaveKeyCommands (both stream and file).
            09/06/2005 Changed TSciKeyCommandCollection so the Items property and Add returns/sets
                       the corresponding item class, not just TCollectionItem.. No need to cast those anymore.
            12/09/2006 Added the new mappings from scintilla (SCK_WIN,SCK_RWIN,SCK_MENU).
}
{$Include SciCommonDef.Inc}
unit SciKeyBindings;

interface
Uses
  Windows, Classes, Controls, SciSupport,SciResLang;

const KeyFileHeaderSignature =$EDEDED;

Type
  TSciKey = Cardinal;

  //This is the header structure you could use when saving the keys to
  //a file..
  TSciCommandRecHeader=record
    Signature : Integer;
    NumberOfKeys : Integer;
  end;

  //This is the actual key/command.
  TSciCommandRec = record
    ShortCut : TShortCut;
    Command : Integer;
  end;

  function KeyToSciKey(keyIn : word) : word;
  function SciKeyToKey(keyIn : word) : word;
  function ShiftStateToSciMode(Shift : TShiftState) : word;
  function SciModeToShiftState(SciMode : word) : TShiftState;
  function SciKey(Key, Mode : word): TSciKey;
  function SciKeyToShortCut(Key : TSciKey) : TShortCut;
  function ShortCutToSciKey(ShortCut : TShortCut) : TSciKey;

const
  SCI_NORM : word = 0;
  SCI_SHIFT : word = SCMOD_SHIFT;
  SCI_CTRL : word  = SCMOD_CTRL;
  SCI_ALT : word  = SCMOD_ALT;
  SCI_ASHIFT : word = SCMOD_ALT or SCMOD_SHIFT;
  SCI_ACTRL : word = SCMOD_ALT or SCMOD_CTRL;
  SCI_CSHIFT : word = SCMOD_CTRL or SCMOD_SHIFT;
  SCI_ACSHIFT : word = SCMOD_ALT or SCMOD_CTRL or SCMOD_SHIFT;

  Sci_KeyboardCommandMap: array[0..95] of TIdentMapEntry = (
    (Value: SCI_Null; Name: sKeyNoCommand),
    (Value: SCI_CLEAR; Name: sKeyClear),
    (Value: SCI_COPY; Name: sKeyCopy),
    (Value: SCI_CUT; Name: sKeyCut),
    (Value: SCI_PASTE; Name: sKeyPaste),
    (Value: SCI_ZOOMIN; Name: sKeyZoomIn),
    (Value: SCI_ZOOMOUT; Name: sKeyZoo