├── .gitignore
├── Assetts
└── TTextEditor_Icon.png
├── Delphinus.Info.json
├── Delphinus.Install.json
├── Demos
└── Simple
│ ├── TTextEditorDemo.Form.Main.dfm
│ ├── TTextEditorDemo.Form.Main.pas
│ ├── TTextEditorDemo.dpr
│ ├── TTextEditorDemo.dproj
│ └── TTextEditorDemo.res
├── Highlighters
├── ABAP.json
├── ASP.json
├── AWK.json
├── ActionScript.json
├── Ada.json
├── Apex.json
├── Arduino.json
├── Assembler - 6502.json
├── Assembler - 68HC11.json
├── AutoHotkey.json
├── AutoIt v3.json
├── Bash.json
├── Batch.json
├── C#.json
├── C++.json
├── C.json
├── CMake.json
├── CSS.json
├── Carbon.json
├── Chapel.json
├── Clojure.json
├── CoffeeScript.json
├── Component Pascal.json
├── D.json
├── DWScript.json
├── Dart.json
├── Delphi Form Module.json
├── Diff.json
├── Eiffel.json
├── Elixir.json
├── Elm.json
├── Erlang.json
├── Euphoria.json
├── F#.json
├── Free Pascal.json
├── FreeBASIC.json
├── G-code.json
├── GDScript.json
├── GLSL.json
├── Git Ignore.json
├── Go.json
├── Gravity.json
├── Groovy.json
├── HTML with Scripts.json
├── Hack.json
├── INI.json
├── Inno Setup.json
├── JSON.json
├── JSON5.json
├── Java.json
├── JavaScript.json
├── Julia.json
├── Kotlin.json
├── LaTex.json
├── Lisp.json
├── Log file.json
├── Lua.json
├── MATLAB.json
├── MIME.json
├── Makefile.json
├── Markdown.json
├── Modula-2.json
├── Modula-3.json
├── NSIS.json
├── Nim.json
├── OCaml.json
├── Objeck.json
├── Object Pascal.json
├── Objective-C.json
├── Odin.json
├── PHP.json
├── Perl.json
├── PowerShell.json
├── PureBasic.json
├── Python.json
├── R.json
├── Racket.json
├── Red.json
├── Rich Text Format.json
├── Ruby.json
├── Rust.json
├── SQL - Firebird.json
├── SQL - Informix.json
├── SQL - InterBase.json
├── SQL - MariaDB.json
├── SQL - MySQL.json
├── SQL - Oracle.json
├── SQL - PostgreSQL.json
├── SQL - SQLite.json
├── SQL - Standard.json
├── SQL - Sybase.json
├── SQL - Transact.json
├── Scala.json
├── Solidity.json
├── Structured Text.json
├── Swift.json
├── TclTk.json
├── Text Simple.json
├── Text.json
├── TypeScript.json
├── UnrealScript.json
├── V.json
├── VBScript.json
├── VRCalc++.json
├── VTL.json
├── Visual Basic.json
├── Visual FoxPro.json
├── XML.json
├── XSL.json
├── YAML.json
└── Zig.json
├── LICENSE
├── Packages
├── Images
│ ├── TDBTextEditor.bmp
│ ├── TTextEditor.bmp
│ ├── TTextEditorCompareScrollBar.bmp
│ ├── TTextEditorMacroRecorder.bmp
│ ├── TTextEditorPrint.bmp
│ ├── TTextEditorPrintPreview.bmp
│ └── TTextEditorSpellCheck.bmp
├── TextEditor.CBuilder.Alexandria.Designtime.cbproj
├── TextEditor.CBuilder.Alexandria.Designtime.cpp
├── TextEditor.CBuilder.Alexandria.DesigntimePCH1.h
├── TextEditor.CBuilder.Alexandria.Designtime_resources.rc
├── TextEditor.CBuilder.Alexandria.Runtime.cbproj
├── TextEditor.CBuilder.Alexandria.Runtime.cpp
├── TextEditor.CBuilder.Alexandria.RuntimePCH1.h
├── TextEditor.CBuilder.Alexandria.groupproj
├── TextEditor.CBuilder.Athens.Designtime.cbproj
├── TextEditor.CBuilder.Athens.Designtime.cpp
├── TextEditor.CBuilder.Athens.DesigntimePCH1.h
├── TextEditor.CBuilder.Athens.Designtime_resources.rc
├── TextEditor.CBuilder.Athens.Runtime.cbproj
├── TextEditor.CBuilder.Athens.Runtime.cpp
├── TextEditor.CBuilder.Athens.RuntimePCH1.h
├── TextEditor.CBuilder.Athens.groupproj
├── TextEditor.Delphi.Alexandria.Designtime.dpk
├── TextEditor.Delphi.Alexandria.Designtime.dproj
├── TextEditor.Delphi.Alexandria.Designtime.dres
├── TextEditor.Delphi.Alexandria.Runtime.dpk
├── TextEditor.Delphi.Alexandria.Runtime.dproj
├── TextEditor.Delphi.Alexandria.groupproj
├── TextEditor.Delphi.Athens.Designtime.dpk
├── TextEditor.Delphi.Athens.Designtime.dproj
├── TextEditor.Delphi.Athens.Designtime.dres
├── TextEditor.Delphi.Athens.Designtime.res
├── TextEditor.Delphi.Athens.DesigntimeResource.rc
├── TextEditor.Delphi.Athens.Runtime.dpk
├── TextEditor.Delphi.Athens.Runtime.dproj
├── TextEditor.Delphi.Athens.Runtime.res
├── TextEditor.Delphi.Athens.groupproj
├── TextEditor.Delphi.Sydney.Designtime.dpk
├── TextEditor.Delphi.Sydney.Designtime.dproj
├── TextEditor.Delphi.Sydney.Designtime.dres
├── TextEditor.Delphi.Sydney.Runtime.dpk
├── TextEditor.Delphi.Sydney.Runtime.dproj
└── TextEditor.Delphi.Sydney.groupproj
├── README.md
├── Source
├── TextEditor.ActiveLine.pas
├── TextEditor.Caret.MultiEdit.pas
├── TextEditor.Caret.NonBlinking.pas
├── TextEditor.Caret.Offsets.pas
├── TextEditor.Caret.Styles.pas
├── TextEditor.Caret.pas
├── TextEditor.CodeFolding.GuideLines.pas
├── TextEditor.CodeFolding.Hint.Form.pas
├── TextEditor.CodeFolding.Hint.Indicator.pas
├── TextEditor.CodeFolding.Hint.pas
├── TextEditor.CodeFolding.Ranges.pas
├── TextEditor.CodeFolding.Regions.pas
├── TextEditor.CodeFolding.pas
├── TextEditor.Colors.pas
├── TextEditor.Compare.ScrollBar.pas
├── TextEditor.CompletionProposal.PopupWindow.pas
├── TextEditor.CompletionProposal.Snippets.pas
├── TextEditor.CompletionProposal.Trigger.pas
├── TextEditor.CompletionProposal.pas
├── TextEditor.Consts.pas
├── TextEditor.Defines.inc
├── TextEditor.Encoding.pas
├── TextEditor.Export.HTML.pas
├── TextEditor.Fonts.pas
├── TextEditor.Glyph.pas
├── TextEditor.HighlightLine.pas
├── TextEditor.Highlighter.Attributes.pas
├── TextEditor.Highlighter.Colors.pas
├── TextEditor.Highlighter.Comments.pas
├── TextEditor.Highlighter.Export.JSON.pas
├── TextEditor.Highlighter.Import.JSON.pas
├── TextEditor.Highlighter.Info.pas
├── TextEditor.Highlighter.Rules.pas
├── TextEditor.Highlighter.Token.pas
├── TextEditor.Highlighter.pas
├── TextEditor.InternalImage.pas
├── TextEditor.JSONDataObjects.pas
├── TextEditor.KeyCommands.pas
├── TextEditor.KeyboardHandler.pas
├── TextEditor.Language.pas
├── TextEditor.LeftMargin.Bookmarks.pas
├── TextEditor.LeftMargin.Border.pas
├── TextEditor.LeftMargin.LineNumbers.pas
├── TextEditor.LeftMargin.LineState.pas
├── TextEditor.LeftMargin.Marks.pas
├── TextEditor.LeftMargin.MarksPanel.pas
├── TextEditor.LeftMargin.pas
├── TextEditor.Lines.pas
├── TextEditor.MacroRecorder.pas
├── TextEditor.Marks.pas
├── TextEditor.MatchingPairs.pas
├── TextEditor.Minimap.Indicator.pas
├── TextEditor.Minimap.Shadow.pas
├── TextEditor.Minimap.pas
├── TextEditor.PaintHelper.pas
├── TextEditor.PopupWindow.pas
├── TextEditor.Print.HeaderFooter.pas
├── TextEditor.Print.Margins.pas
├── TextEditor.Print.Preview.pas
├── TextEditor.Print.PrinterInfo.pas
├── TextEditor.Print.pas
├── TextEditor.Register.pas
├── TextEditor.RegisterProperty.pas
├── TextEditor.Replace.pas
├── TextEditor.RightMargin.pas
├── TextEditor.Ruler.pas
├── TextEditor.Scroll.Hint.pas
├── TextEditor.Scroll.Shadow.pas
├── TextEditor.Scroll.pas
├── TextEditor.Search.Base.pas
├── TextEditor.Search.InSelection.pas
├── TextEditor.Search.Map.pas
├── TextEditor.Search.NearOperator.pas
├── TextEditor.Search.Normal.pas
├── TextEditor.Search.RegularExpressions.pas
├── TextEditor.Search.Wildcard.pas
├── TextEditor.Search.pas
├── TextEditor.Selection.pas
├── TextEditor.SkipRegions.pas
├── TextEditor.SpecialChars.LineBreak.pas
├── TextEditor.SpecialChars.Selection.pas
├── TextEditor.SpecialChars.pas
├── TextEditor.SpellCheck.pas
├── TextEditor.Splash.pas
├── TextEditor.StyleHooks.pas
├── TextEditor.SyncEdit.pas
├── TextEditor.Tabs.pas
├── TextEditor.TextFolding.pas
├── TextEditor.Types.pas
├── TextEditor.Undo.Item.pas
├── TextEditor.Undo.List.pas
├── TextEditor.Undo.pas
├── TextEditor.UnknownChars.pas
├── TextEditor.Utils.pas
├── TextEditor.WordWrap.pas
├── TextEditor.pas
└── TextEditor.res
└── Themes
├── Blue.json
├── Classic.json
├── Darcula.json
├── Dark Icon.json
├── Dark.json
├── Darker.json
├── Default.json
├── Dracula.json
├── Fluent Night.json
├── GitHub Dark.json
├── Monokai Distilled.json
├── Monokai.json
├── Oblivion.json
├── Obsidian.json
├── Ocean.json
├── Oceanic.json
├── Okaidia.json
├── Purple.json
├── Twilight.json
├── Visual Studio Dark.json
├── Visual Studio.json
└── Windows 11 Dark.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.dcu
4 | *.obj
5 | *.exe
6 | *.bpl
7 | *.bpi
8 | *.dcp
9 | *.rsm
10 | *.stat
11 | *.map
12 |
13 | # Generated source #
14 | ###################
15 | *.hpp
16 |
17 | # Backup files #
18 | ###################
19 | *.~*
20 |
21 | # IDE Files #
22 | ###################
23 | *.dproj.local
24 | *.groupproj.local
25 | *.identcache
26 | *.dsk
27 | *.tvsconfig
28 | *.otares
29 | *.drc
30 | *.local
31 | *.ficfg
32 |
33 | # Output Folders #
34 | ###################
35 | /Win32
36 | /Win64
37 | /OSX32
38 | /__history
39 | *.bak
40 | *.Patch
41 | *.#00
42 | *.pch
43 | *.skincfg
44 |
--------------------------------------------------------------------------------
/Assetts/TTextEditor_Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Assetts/TTextEditor_Icon.png
--------------------------------------------------------------------------------
/Delphinus.Info.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "{288B726D-55B1-4511-9823-23021D087E21}",
3 | "name": "TTextEditor",
4 | "picture": "Assetts\\TTextEditor_Icon.png",
5 | "license_type": "MIT",
6 | "license_file": "LICENSE",
7 | "platforms": "Win32;Win64",
8 | "first_version": "1.0.0",
9 | "package_compiler_min": 30,
10 | "compiler_min": 30
11 | }
--------------------------------------------------------------------------------
/Delphinus.Install.json:
--------------------------------------------------------------------------------
1 | {
2 | "search_pathes": [
3 | {
4 | "pathes": "Source",
5 | "platforms": "Win32;Win64"
6 | }
7 | ],
8 | "browsing_pathes": [
9 | {
10 | "pathes": "Source",
11 | "platforms": "Win32;Win64"
12 | }
13 | ],
14 | "source_folders": [
15 | {
16 | "folder": "Source",
17 | "base": "",
18 | "recursive": true,
19 | "filter": "*;*.*"
20 | },
21 | {
22 | "folder": "Packages",
23 | "base": "",
24 | "recursive": true,
25 | "filter": "*;*.*"
26 | },
27 | {
28 | "folder": "Highlighters",
29 | "base": "",
30 | "recursive": true,
31 | "filter": "*;*.*"
32 | },
33 | {
34 | "folder": "Themes",
35 | "base": "",
36 | "recursive": true,
37 | "filter": "*;*.*"
38 | }
39 | ],
40 | "projects": [
41 | {
42 | "project": "Packages\\TextEditor.Delphi.groupproj",
43 | "compiler_min": 30
44 | }
45 | ]
46 | }
47 |
--------------------------------------------------------------------------------
/Demos/Simple/TTextEditorDemo.Form.Main.dfm:
--------------------------------------------------------------------------------
1 | object MainForm: TMainForm
2 | Left = 0
3 | Top = 0
4 | Caption = 'TTextEditor Demo'
5 | ClientHeight = 766
6 | ClientWidth = 918
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | Position = poScreenCenter
14 | OnCreate = FormCreate
15 | TextHeight = 13
16 | object SplitterVertical: TSplitter
17 | Left = 207
18 | Top = 0
19 | Height = 744
20 | end
21 | object PanelLeft: TPanel
22 | Left = 0
23 | Top = 0
24 | Width = 207
25 | Height = 744
26 | Align = alLeft
27 | BevelOuter = bvNone
28 | TabOrder = 0
29 | object SplitterHorizontal: TSplitter
30 | Left = 0
31 | Top = 441
32 | Width = 207
33 | Height = 3
34 | Cursor = crVSplit
35 | Align = alBottom
36 | end
37 | object PanelThemes: TPanel
38 | Left = 0
39 | Top = 444
40 | Width = 207
41 | Height = 300
42 | Align = alBottom
43 | BevelOuter = bvNone
44 | TabOrder = 0
45 | object ListBoxThemes: TListBox
46 | AlignWithMargins = True
47 | Left = 3
48 | Top = 23
49 | Width = 204
50 | Height = 274
51 | Margins.Top = 0
52 | Margins.Right = 0
53 | Align = alClient
54 | BevelOuter = bvNone
55 | ItemHeight = 13
56 | TabOrder = 0
57 | OnClick = ListBoxThemesClick
58 | end
59 | object CheckBoxUseDefaultTheme: TCheckBox
60 | AlignWithMargins = True
61 | Left = 3
62 | Top = 3
63 | Width = 201
64 | Height = 17
65 | Action = ActionUseDefaultTheme
66 | Align = alTop
67 | TabOrder = 1
68 | end
69 | end
70 | object ListBoxHighlighters: TListBox
71 | AlignWithMargins = True
72 | Left = 3
73 | Top = 3
74 | Width = 204
75 | Height = 438
76 | Margins.Right = 0
77 | Margins.Bottom = 0
78 | Align = alClient
79 | ItemHeight = 13
80 | TabOrder = 1
81 | OnClick = ListBoxHighlightersClick
82 | end
83 | end
84 | object TextEditor: TTextEditor
85 | AlignWithMargins = True
86 | Left = 210
87 | Top = 3
88 | Width = 705
89 | Height = 738
90 | Margins.Left = 0
91 | Align = alClient
92 | CodeFolding.Visible = True
93 | CodeFolding.Width = 20
94 | HighlightLine.Active = True
95 | LeftMargin.Width = 67
96 | OnCompletionProposalExecute = TextEditorCompletionProposalExecute
97 | OnCreateHighlighterStream = TextEditorCreateHighlighterStream
98 | Selection.Options = [soALTSetsColumnMode, soHighlightSimilarTerms, soTermsCaseSensitive]
99 | TabOrder = 1
100 | end
101 | object StatusBar: TStatusBar
102 | Left = 0
103 | Top = 744
104 | Width = 918
105 | Height = 22
106 | Panels = <
107 | item
108 | Alignment = taCenter
109 | Text = 'Zoom: 100 %'
110 | Width = 100
111 | end>
112 | PopupMenu = PopupMenuZoom
113 | OnClick = StatusBarClick
114 | end
115 | object PopupMenuZoom: TPopupMenu
116 | AutoHotkeys = maManual
117 | Left = 444
118 | Top = 658
119 | object MenuItemZoom100: TMenuItem
120 | Action = ActionZoom100
121 | AutoCheck = True
122 | end
123 | object MenuItemZoom125: TMenuItem
124 | Action = ActionZoom125
125 | AutoCheck = True
126 | end
127 | object MenuItemZoom150: TMenuItem
128 | Action = ActionZoom150
129 | AutoCheck = True
130 | end
131 | object MenuItemZoom200: TMenuItem
132 | Action = ActionZoom200
133 | AutoCheck = True
134 | end
135 | object MenuItemZoom300: TMenuItem
136 | Action = ActionZoom300
137 | AutoCheck = True
138 | end
139 | end
140 | object ActionList: TActionList
141 | Left = 440
142 | Top = 584
143 | object ActionZoom100: TAction
144 | Tag = 100
145 | AutoCheck = True
146 | Caption = '100 %'
147 | Checked = True
148 | GroupIndex = 1
149 | OnExecute = ActionZoomExecute
150 | end
151 | object ActionZoom125: TAction
152 | Tag = 125
153 | AutoCheck = True
154 | Caption = '125 %'
155 | GroupIndex = 1
156 | OnExecute = ActionZoomExecute
157 | end
158 | object ActionZoom150: TAction
159 | Tag = 150
160 | AutoCheck = True
161 | Caption = '150 %'
162 | GroupIndex = 1
163 | OnExecute = ActionZoomExecute
164 | end
165 | object ActionZoom200: TAction
166 | Tag = 200
167 | AutoCheck = True
168 | Caption = '200 %'
169 | GroupIndex = 1
170 | OnExecute = ActionZoomExecute
171 | end
172 | object ActionZoom300: TAction
173 | Tag = 300
174 | AutoCheck = True
175 | Caption = '300 %'
176 | GroupIndex = 1
177 | OnExecute = ActionZoomExecute
178 | end
179 | object ActionUseDefaultTheme: TAction
180 | Caption = ' Use default theme'
181 | OnExecute = ActionUseDefaultThemeExecute
182 | end
183 | end
184 | end
185 |
--------------------------------------------------------------------------------
/Demos/Simple/TTextEditorDemo.dpr:
--------------------------------------------------------------------------------
1 | program TTextEditorDemo;
2 |
3 | uses
4 | Vcl.Forms,
5 | TTextEditorDemo.Form.Main in 'TTextEditorDemo.Form.Main.pas' {MainForm};
6 |
7 | {$R *.res}
8 |
9 | begin
10 | Application.Initialize;
11 | Application.MainFormOnTaskbar := True;
12 | Application.CreateForm(TMainForm, MainForm);
13 | Application.Run;
14 | end.
--------------------------------------------------------------------------------
/Demos/Simple/TTextEditorDemo.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Demos/Simple/TTextEditorDemo.res
--------------------------------------------------------------------------------
/Highlighters/Delphi Form Module.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "object Form1: TForm1\r\n",
5 | " Left = 0\r\n",
6 | " Top = 0\r\n",
7 | " Caption = 'Form1'\r\n",
8 | " object Label1: TLabel\r\n",
9 | " Left = 30\r\n",
10 | " Top = 20\r\n",
11 | " Width = 55\r\n",
12 | " Height = 13\r\n",
13 | " Caption = 'Hello, World!'\r\n",
14 | " end\r\n",
15 | "end"
16 | ],
17 | "MainRules": {
18 | "Attributes": {
19 | "Element": "Editor"
20 | },
21 | "SubRules": {
22 | "Range": [
23 | {
24 | "Type": "BlockComment",
25 | "Attributes": {
26 | "Element": "Comment"
27 | },
28 | "TokenRange": {
29 | "Open": "{",
30 | "Close": "}"
31 | }
32 | },
33 | {
34 | "Type": "String",
35 | "Attributes": {
36 | "Element": "String"
37 | },
38 | "Properties": {
39 | "CloseOnEndOfLine": true
40 | },
41 | "TokenRange": {
42 | "Open": "'",
43 | "Close": "'"
44 | }
45 | },
46 | {
47 | "Type": "HexNumber",
48 | "Attributes": {
49 | "Element": "HexNumber"
50 | },
51 | "AllowedCharacters": "0123456789abcdefABCDEF",
52 | "Properties": {
53 | "CloseOnTerm": true,
54 | "CloseOnEndOfLine": true
55 | },
56 | "TokenRange": {
57 | "Open": "$"
58 | }
59 | },
60 | {
61 | "Type": "Character",
62 | "Attributes": {
63 | "Element": "Number"
64 | },
65 | "Properties": {
66 | "CloseOnTerm": true,
67 | "CloseOnEndOfLine": true
68 | },
69 | "TokenRange": {
70 | "Open": "#",
71 | "Close": " "
72 | }
73 | }
74 | ],
75 | "KeyList": [
76 | {
77 | "Type": "ReservedWord",
78 | "Words": [
79 | "end",
80 | "inherited",
81 | "inline",
82 | "nil",
83 | "object"
84 | ],
85 | "Attributes": {
86 | "Element": "ReservedWord"
87 | }
88 | },
89 | {
90 | "Type": "Symbol",
91 | "Words": [
92 | ":",
93 | "<",
94 | ">",
95 | "=",
96 | "/",
97 | "*",
98 | ".",
99 | ",",
100 | "-",
101 | "+",
102 | "(",
103 | ")",
104 | "[",
105 | "]"
106 | ],
107 | "Attributes": {
108 | "Element": "Symbol"
109 | }
110 | }
111 | ],
112 | "Set": [
113 | {
114 | "Type": "Number",
115 | "Symbols": ".0123456789",
116 | "Attributes": {
117 | "Element": "Number"
118 | }
119 | }
120 | ]
121 | }
122 | }
123 | },
124 | "CodeFolding": {
125 | "Ranges": [
126 | {
127 | "Options": {
128 | "HideGuideLineAtFirstColumn": true
129 | },
130 | "SkipRegion": [
131 | {
132 | "OpenToken": "'",
133 | "CloseToken": "'",
134 | "RegionType": "SingleLineString"
135 | }
136 | ],
137 | "FoldRegion": [
138 | {
139 | "OpenToken": "OBJECT",
140 | "CloseToken": "END",
141 | "Properties": {
142 | "OpenTokenBeginningOfLine": true
143 | }
144 | },
145 | {
146 | "OpenToken": "INLINE",
147 | "CloseToken": "END",
148 | "Properties": {
149 | "OpenTokenBeginningOfLine": true
150 | }
151 | },
152 | {
153 | "OpenToken": "ITEM",
154 | "CloseToken": "END",
155 | "Properties": {
156 | "OpenTokenBeginningOfLine": true
157 | }
158 | },
159 | {
160 | "OpenToken": "INHERITED",
161 | "CloseToken": "END",
162 | "Properties": {
163 | "OpenTokenBeginningOfLine": true
164 | }
165 | }
166 | ]
167 | }
168 | ]
169 | },
170 | "MatchingPair": {
171 | "Pairs": [
172 | {
173 | "OpenToken": "'",
174 | "CloseToken": "'"
175 | },
176 | {
177 | "OpenToken": "\"",
178 | "CloseToken": "\""
179 | },
180 | {
181 | "OpenToken": "object",
182 | "CloseToken": "end"
183 | },
184 | {
185 | "OpenToken": "inline",
186 | "CloseToken": "end"
187 | },
188 | {
189 | "OpenToken": "inherited",
190 | "CloseToken": "end"
191 | },
192 | {
193 | "OpenToken": "(",
194 | "CloseToken": ")"
195 | },
196 | {
197 | "OpenToken": "[",
198 | "CloseToken": "]"
199 | },
200 | {
201 | "OpenToken": "<",
202 | "CloseToken": ">"
203 | }
204 | ]
205 | }
206 | }
--------------------------------------------------------------------------------
/Highlighters/Diff.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "--- /path/to/original timestampr\n",
5 | "+++ /path/to/new timestampr\n",
6 | "@@ -1,4 +1,4 @@r\n",
7 | "Hellor\n",
8 | "-wrldr\n",
9 | "+world!"
10 | ],
11 | "MainRules": {
12 | "Attributes": {
13 | "Element": "Editor"
14 | },
15 | "SubRules": {
16 | "Range": [
17 | {
18 | "Type": "LineComment",
19 | "Attributes": {
20 | "Element": "Comment"
21 | },
22 | "Properties": {
23 | "CloseOnEndOfLine": true,
24 | "OpenBeginningOfLine": true
25 | },
26 | "TokenRange": {
27 | "Open": "---"
28 | }
29 | },
30 | {
31 | "Type": "LineComment",
32 | "Attributes": {
33 | "Element": "Comment"
34 | },
35 | "Properties": {
36 | "CloseOnEndOfLine": true,
37 | "OpenBeginningOfLine": true
38 | },
39 | "TokenRange": {
40 | "Open": "+++"
41 | }
42 | },
43 | {
44 | "Type": "LineComment",
45 | "Attributes": {
46 | "Element": "Comment"
47 | },
48 | "Properties": {
49 | "CloseOnEndOfLine": true,
50 | "OpenBeginningOfLine": true
51 | },
52 | "TokenRange": {
53 | "Open": "@@"
54 | }
55 | },
56 | {
57 | "Type": "LineComment",
58 | "Attributes": {
59 | "Element": "Comment"
60 | },
61 | "Properties": {
62 | "CloseOnEndOfLine": true,
63 | "OpenBeginningOfLine": true
64 | },
65 | "TokenRange": {
66 | "Open": "***"
67 | }
68 | },
69 | {
70 | "Type": "LineComment",
71 | "Attributes": {
72 | "Element": "ReservedWord"
73 | },
74 | "Properties": {
75 | "CloseOnEndOfLine": true,
76 | "OpenBeginningOfLine": true
77 | },
78 | "TokenRange": {
79 | "Open": "-"
80 | }
81 | },
82 | {
83 | "Type": "LineComment",
84 | "Attributes": {
85 | "Element": "Attribute"
86 | },
87 | "Properties": {
88 | "CloseOnEndOfLine": true,
89 | "OpenBeginningOfLine": true
90 | },
91 | "TokenRange": {
92 | "Open": "+"
93 | }
94 | },
95 | {
96 | "Type": "LineComment",
97 | "Attributes": {
98 | "Element": "String"
99 | },
100 | "Properties": {
101 | "CloseOnEndOfLine": true,
102 | "OpenBeginningOfLine": true
103 | },
104 | "TokenRange": {
105 | "Open": "!"
106 | }
107 | }
108 | ]
109 | }
110 | }
111 | }
112 | }
--------------------------------------------------------------------------------
/Highlighters/Git Ignore.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "# Hello, World! in Git Ignore\r\n",
5 | "\r\n",
6 | "*.helloword"
7 | ],
8 | "MainRules": {
9 | "Attributes": {
10 | "Element": "Editor"
11 | },
12 | "SubRules": {
13 | "Range": [
14 | {
15 | "Type": "LineComment",
16 | "Attributes": {
17 | "Element": "Comment"
18 | },
19 | "Properties": {
20 | "CloseOnEndOfLine": true
21 | },
22 | "TokenRange": {
23 | "Open": "#"
24 | }
25 | },
26 | {
27 | "Type": "String",
28 | "Attributes": {
29 | "Element": "String"
30 | },
31 | "Properties": {
32 | "CloseOnEndOfLine": true
33 | },
34 | "TokenRange": {
35 | "Open": "[",
36 | "Close": "]"
37 | }
38 | }
39 | ],
40 | "KeyList": [
41 | {
42 | "Type": "ReservedWord",
43 | "Words": [
44 | "*",
45 | "!",
46 | "~"
47 | ],
48 | "Attributes": {
49 | "Element": "ReservedWord"
50 | }
51 | },
52 | {
53 | "Type": "Symbol",
54 | "Words": [
55 | "/",
56 | "."
57 | ],
58 | "Attributes": {
59 | "Element": "Symbol"
60 | }
61 | }
62 | ],
63 | "Set": [
64 | {
65 | "Type": "Numbers",
66 | "Symbols": ".0123456789",
67 | "Attributes": {
68 | "Element": "Number"
69 | }
70 | }
71 | ]
72 | }
73 | }
74 | },
75 | "MatchingPair": {
76 | "Pairs": [
77 | {
78 | "OpenToken": "[",
79 | "CloseToken": "]"
80 | }
81 | ]
82 | },
83 | "CompletionProposal": {
84 | "SkipRegion": [
85 | {
86 | "OpenToken": "#",
87 | "RegionType": "SingleLine"
88 | }
89 | ]
90 | }
91 | }
--------------------------------------------------------------------------------
/Highlighters/INI.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "; Comment\r\n",
5 | "[Section]\r\n",
6 | "Name=Value"
7 | ],
8 | "MainRules": {
9 | "Attributes": {
10 | "Element": "Editor"
11 | },
12 | "SubRules": {
13 | "Range": [
14 | {
15 | "Type": "LineComment",
16 | "Attributes": {
17 | "Element": "Comment"
18 | },
19 | "Properties": {
20 | "CloseOnEndOfLine": true,
21 | "OpenBeginningOfLine": true
22 | },
23 | "TokenRange": {
24 | "Open": ";"
25 | }
26 | },
27 | {
28 | "Type": "LineComment",
29 | "Attributes": {
30 | "Element": "Comment"
31 | },
32 | "Properties": {
33 | "CloseOnEndOfLine": true,
34 | "OpenBeginningOfLine": true
35 | },
36 | "TokenRange": {
37 | "Open": "#"
38 | }
39 | },
40 | {
41 | "Type": "String",
42 | "Attributes": {
43 | "Element": "ReservedWord"
44 | },
45 | "Properties": {
46 | "CloseOnEndOfLine": true,
47 | "OpenBeginningOfLine": true
48 | },
49 | "TokenRange": {
50 | "Open": "[",
51 | "Close": "]"
52 | }
53 | },
54 | {
55 | "Type": "String",
56 | "Attributes": {
57 | "Element": "String"
58 | },
59 | "Properties": {
60 | "CloseOnEndOfLine": true
61 | },
62 | "TokenRange": {
63 | "Open": "="
64 | }
65 | }
66 | ],
67 | "KeyList": [
68 | {
69 | "Type": "Symbol",
70 | "Words": [
71 | "="
72 | ],
73 | "Attributes": {
74 | "Element": "Symbol"
75 | }
76 | }
77 | ]
78 | }
79 | }
80 | },
81 | "CodeFolding": {
82 | "Ranges": [
83 | {
84 | "Options": {
85 | "MatchingPairHighlight": false,
86 | "HideGuideLineAtFirstColumn": true
87 | },
88 | "SkipRegion": [
89 | {
90 | "OpenToken": ";",
91 | "RegionType": "SingleLine"
92 | }
93 | ],
94 | "FoldRegion": [
95 | {
96 | "OpenToken": "[",
97 | "CloseToken": "[",
98 | "Properties": {
99 | "OpenTokenBeginningOfLine": true,
100 | "CloseTokenBeginningOfLine": true,
101 | "OpenIsClose": true,
102 | "ShowGuideLine": false,
103 | "TokenEndIsPreviousLine": true,
104 | "OpenTokenEnd": "]",
105 | "BreakCharFollows": false
106 | }
107 | }
108 | ]
109 | }
110 | ]
111 | },
112 | "MatchingPair": {
113 | "Pairs": [
114 | {
115 | "OpenToken": "[",
116 | "CloseToken": "]"
117 | }
118 | ]
119 | },
120 | "CompletionProposal": {
121 | "SkipRegion": [
122 | {
123 | "OpenToken": ";",
124 | "RegionType": "SingleLine"
125 | }
126 | ]
127 | }
128 | }
--------------------------------------------------------------------------------
/Highlighters/LaTex.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "\\documentclass{article}\r\n",
5 | "\\usepackage{graphicx}\r\n",
6 | "\r\n",
7 | "\\begin{document}\r\n",
8 | "\r\n",
9 | "\\title{Introduction to \\LaTeX{}}\r\n",
10 | "\\author{Author's Name}\r\n",
11 | "\r\n",
12 | "\\maketitle\r\n",
13 | "\r\n",
14 | "\\begin{abstract}\r\n",
15 | "The abstract text goes here.\r\n",
16 | "\\end{abstract}\r\n",
17 | "\r\n",
18 | "\\section{Introduction}\r\n",
19 | "Here is the text of your introduction.\r\n",
20 | "\r\n",
21 | "\\begin{equation}\r\n",
22 | " \\label{simple_equation}\r\n",
23 | " \\alpha = \\sqrt{ \\beta }\r\n",
24 | "\\end{equation}\r\n",
25 | "\r\n",
26 | "\\subsection{Subsection Heading Here}\r\n",
27 | "Write your subsection text here.\r\n",
28 | "\r\n",
29 | "\\begin{figure}\r\n",
30 | " \\centering\r\n",
31 | " \\includegraphics[width=3.0in]{myfigure}\r\n",
32 | " \\caption{Simulation Results}\r\n",
33 | " \\label{simulationfigure}\r\n",
34 | "\\end{figure}\r\n",
35 | "\r\n",
36 | "\\section{Conclusion}\r\n",
37 | "Write your conclusion here.\r\n",
38 | "\r\n",
39 | "\\end{document}"
40 | ],
41 | "MainRules": {
42 | "Attributes": {
43 | "Element": "Editor"
44 | },
45 | "SubRules": {
46 | "Range": [
47 | {
48 | "Type": "LineComment",
49 | "Attributes": {
50 | "Element": "Comment"
51 | },
52 | "Properties": {
53 | "CloseOnEndOfLine": true
54 | },
55 | "TokenRange": {
56 | "Open": "%"
57 | }
58 | },
59 | {
60 | "Type": "String",
61 | "Attributes": {
62 | "Element": "String"
63 | },
64 | "TokenRange": {
65 | "Open": "{",
66 | "Close": "}"
67 | },
68 | "SubRules": {
69 | "Range": [
70 | {
71 | "Type": "Command",
72 | "Attributes": {
73 | "Element": "Method"
74 | },
75 | "Properties": {
76 | "CloseOnTerm": true
77 | },
78 | "TokenRange": {
79 | "Open": "\\"
80 | }
81 | }
82 | ],
83 | "KeyList": [
84 | {
85 | "Type": "Symbol",
86 | "Words": [
87 | "{",
88 | "}"
89 | ],
90 | "Attributes": {
91 | "Element": "Symbol"
92 | }
93 | }
94 | ]
95 | }
96 | },
97 | {
98 | "Type": "String",
99 | "Attributes": {
100 | "Element": "MethodName"
101 | },
102 | "TokenRange": {
103 | "Open": "[",
104 | "Close": "]"
105 | }
106 | },
107 | {
108 | "Type": "Command",
109 | "Attributes": {
110 | "Element": "Method"
111 | },
112 | "Properties": {
113 | "CloseOnTerm": true
114 | },
115 | "TokenRange": {
116 | "Open": "\\"
117 | }
118 | }
119 | ],
120 | "KeyList": [
121 | {
122 | "Name": "Keywords",
123 | "Type": "ReservedWord",
124 | "Words": [
125 | "\\documentclass",
126 | "\\label",
127 | "\\usepackage"
128 | ],
129 | "Attributes": {
130 | "Element": "ReservedWord"
131 | }
132 | },
133 | {
134 | "Type": "Symbol",
135 | "Words": [
136 | ":",
137 | ";",
138 | "<",
139 | ">",
140 | "=",
141 | "/",
142 | "*",
143 | ".",
144 | ",",
145 | "-",
146 | "+",
147 | "(",
148 | ")",
149 | "[",
150 | "]",
151 | "{",
152 | "}"
153 | ],
154 | "Attributes": {
155 | "Element": "Symbol"
156 | }
157 | }
158 | ],
159 | "Set": [
160 | {
161 | "Type": "Numbers",
162 | "Symbols": ".0123456789",
163 | "Attributes": {
164 | "Element": "Number"
165 | }
166 | }
167 | ]
168 | }
169 | }
170 | },
171 | "MatchingPair": {
172 | "Pairs": [
173 | {
174 | "OpenToken": "(",
175 | "CloseToken": ")"
176 | },
177 | {
178 | "OpenToken": "[",
179 | "CloseToken": "]"
180 | },
181 | {
182 | "OpenToken": "{",
183 | "CloseToken": "}"
184 | }
185 | ]
186 | },
187 | "CompletionProposal": {
188 | "SkipRegion": [
189 | {
190 | "OpenToken": "%",
191 | "RegionType": "SingleLine"
192 | }
193 | ]
194 | }
195 | }
--------------------------------------------------------------------------------
/Highlighters/MIME.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "MIME-Version: 1.0\r\n",
5 | "Content-Type: multipart/mixed; boundary=frontier\r\n",
6 | "\r\n",
7 | "This is a message with multiple parts in MIME format.\r\n",
8 | "--frontier\r\n",
9 | "Content-Type: text/plain\r\n",
10 | "\r\n",
11 | "This is the body of the message.\r\n",
12 | "--frontier\r\n",
13 | "Content-Type: application/octet-stream\r\n",
14 | "Content-Transfer-Encoding: base64\r\n",
15 | "\r\n",
16 | "PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg\r\n",
17 | "Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==\r\n",
18 | "--frontier--"
19 | ],
20 | "MainRules": {
21 | "Attributes": {
22 | "Element": "Editor"
23 | },
24 | "SubRules": {
25 | "Range": [
26 | {
27 | "Type": "LineComment",
28 | "Attributes": {
29 | "Element": "Comment"
30 | },
31 | "Properties": {
32 | "CloseOnEndOfLine": true
33 | },
34 | "TokenRange": {
35 | "Open": "--"
36 | }
37 | },
38 | {
39 | "Type": "String",
40 | "Attributes": {
41 | "Element": "String"
42 | },
43 | "Properties": {
44 | "CloseOnEndOfLine": true
45 | },
46 | "TokenRange": {
47 | "Open": "=?",
48 | "Close": "?="
49 | }
50 | },
51 | {
52 | "Type": "ReservedWord",
53 | "Attributes": {
54 | "Element": "ReservedWord"
55 | },
56 | "Delimiters": " :",
57 | "Properties": {
58 | "CloseOnEndOfLine": true,
59 | "CloseOnTerm": true
60 | },
61 | "TokenRange": {
62 | "Open": "Content-"
63 | }
64 | }
65 | ],
66 | "KeyList": [
67 | {
68 | "Type": "ReservedWord",
69 | "Words": [
70 | "boundary",
71 | "MIME-Version",
72 | "Subject"
73 | ],
74 | "Attributes": {
75 | "Element": "ReservedWord"
76 | }
77 | },
78 | {
79 | "Type": "Symbol",
80 | "Words": [
81 | ":",
82 | ";",
83 | "<",
84 | ">",
85 | "=",
86 | "/",
87 | "*",
88 | ".",
89 | ",",
90 | "-",
91 | "+",
92 | "(",
93 | ")",
94 | "[",
95 | "]",
96 | "{",
97 | "}"
98 | ],
99 | "Attributes": {
100 | "Element": "Symbol"
101 | }
102 | }
103 | ],
104 | "Set": [
105 | {
106 | "Type": "Numbers",
107 | "Symbols": ".0123456789",
108 | "Attributes": {
109 | "Element": "Number"
110 | }
111 | }
112 | ]
113 | }
114 | }
115 | },
116 | "MatchingPair": {
117 | "Pairs": [
118 | {
119 | "OpenToken": "(",
120 | "CloseToken": ")"
121 | },
122 | {
123 | "OpenToken": "[",
124 | "CloseToken": "]"
125 | },
126 | {
127 | "OpenToken": "{",
128 | "CloseToken": "}"
129 | }
130 | ]
131 | }
132 | }
--------------------------------------------------------------------------------
/Highlighters/Text Simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "Simple text file"
5 | ],
6 | "MainRules": {
7 | "Attributes": {
8 | "Element": "Editor"
9 | }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Highlighters/XSL.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "Sample": [
4 | "\r\n",
5 | "\r\n",
6 | " \r\n",
7 | " \r\n",
8 | " \r\n",
9 | " \r\n",
10 | " \r\n",
11 | " \r\n",
12 | " \r\n",
13 | " \r\n",
14 | "
\r\n",
15 | " \r\n",
16 | " \r\n",
17 | " \r\n",
18 | " \r\n",
19 | " \r\n",
20 | " from
\r\n",
21 | " \r\n",
22 | ""
23 | ],
24 | "MainRules": {
25 | "Attributes": {
26 | "Element": "Editor"
27 | },
28 | "SubRules": {
29 | "Range": [
30 | {
31 | "Type": "BlockComment",
32 | "Attributes": {
33 | "Element": "Comment"
34 | },
35 | "TokenRange": {
36 | "Open": ""
38 | }
39 | },
40 | {
41 | "Name": "XML",
42 | "Type": "Tag",
43 | "Attributes": {
44 | "Element": "ReservedWord"
45 | },
46 | "TokenRange": {
47 | "Open": "<",
48 | "Close": ">"
49 | },
50 | "SubRules": {
51 | "Range": [
52 | {
53 | "Type": "BlockComment",
54 | "Attributes": {
55 | "Element": "Comment"
56 | },
57 | "TokenRange": {
58 | "Open": ""
60 | }
61 | },
62 | {
63 | "Type": "String",
64 | "Attributes": {
65 | "Element": "String"
66 | },
67 | "TokenRange": {
68 | "Open": "\"",
69 | "Close": "\""
70 | }
71 | },
72 | {
73 | "Type": "String",
74 | "Attributes": {
75 | "Element": "String"
76 | },
77 | "Properties": {
78 | "CloseOnEndOfLine": true
79 | },
80 | "TokenRange": {
81 | "Open": "'",
82 | "Close": "'"
83 | }
84 | },
85 | {
86 | "Type": "Attribute",
87 | "Attributes": {
88 | "Element": "MethodName"
89 | },
90 | "Properties": {
91 | "AlternativeClose": [
92 | ">",
93 | "<"
94 | ]
95 | },
96 | "TokenRange": {
97 | "Open": " ",
98 | "Close": "="
99 | },
100 | "SubRules": {
101 | "KeyList": [
102 | {
103 | "Type": "Symbol",
104 | "Words": [
105 | "="
106 | ],
107 | "Attributes": {
108 | "Element": "Symbol"
109 | }
110 | }
111 | ]
112 | }
113 | }
114 | ],
115 | "KeyList": [
116 | {
117 | "Type": "Symbol",
118 | "Words": [
119 | ">",
120 | "/",
121 | "=",
122 | "?"
123 | ],
124 | "Attributes": {
125 | "Element": "Symbol"
126 | }
127 | }
128 | ]
129 | }
130 | }
131 | ],
132 | "KeyList": [
133 | {
134 | "Type": "Symbol",
135 | "Words": [
136 | "<"
137 | ],
138 | "Attributes": {
139 | "Element": "Symbol"
140 | }
141 | }
142 | ],
143 | "Set": [
144 | {
145 | "Type": "Number",
146 | "Symbols": ".0123456789",
147 | "Attributes": {
148 | "Element": "Number"
149 | }
150 | }
151 | ]
152 | }
153 | }
154 | },
155 | "MatchingPair": {
156 | "Pairs": [
157 | {
158 | "OpenToken": "'",
159 | "CloseToken": "'"
160 | },
161 | {
162 | "OpenToken": "\"",
163 | "CloseToken": "\""
164 | },
165 | {
166 | "OpenToken": "<",
167 | "CloseToken": ">"
168 | }
169 | ]
170 | },
171 | "CompletionProposal": {
172 | "SkipRegion": [
173 | {
174 | "OpenToken": "'",
175 | "CloseToken": "'",
176 | "RegionType": "SingleLineString"
177 | },
178 | {
179 | "OpenToken": "\"",
180 | "CloseToken": "\"",
181 | "RegionType": "SingleLineString"
182 | },
183 | {
184 | "OpenToken": "",
186 | "RegionType": "MultiLine"
187 | }
188 | ]
189 | }
190 | }
--------------------------------------------------------------------------------
/Highlighters/YAML.json:
--------------------------------------------------------------------------------
1 | {
2 | "Highlighter": {
3 | "YAML": true,
4 | "Sample": [
5 | "# Hello, World! in YAML\r\n",
6 | "\r\n",
7 | "example: Hello, World!"
8 | ],
9 | "MainRules": {
10 | "Attributes": {
11 | "Element": "Editor"
12 | },
13 | "SubRules": {
14 | "Range": [
15 | {
16 | "Type": "LineComment",
17 | "Attributes": {
18 | "Element": "Comment"
19 | },
20 | "Properties": {
21 | "CloseOnEndOfLine": true
22 | },
23 | "TokenRange": {
24 | "Open": "#"
25 | }
26 | },
27 | {
28 | "Type": "String",
29 | "Attributes": {
30 | "Element": "String"
31 | },
32 | "Properties": {
33 | "CloseOnEndOfLine": true
34 | },
35 | "TokenRange": {
36 | "Open": "``",
37 | "Close": "``"
38 | },
39 | "SubRules": {
40 | "Range": [
41 | {
42 | "Type": "String",
43 | "Attributes": {
44 | "Element": "String"
45 | },
46 | "Properties": {
47 | "CloseOnEndOfLine": true,
48 | "CloseOnTerm": true
49 | },
50 | "TokenRange": {
51 | "Open": "\\``",
52 | "Close": ""
53 | }
54 | },
55 | {
56 | "Type": "String",
57 | "Attributes": {
58 | "Element": "String"
59 | },
60 | "Properties": {
61 | "CloseOnEndOfLine": true,
62 | "CloseOnTerm": true
63 | },
64 | "TokenRange": {
65 | "Open": "\\\\",
66 | "Close": ""
67 | }
68 | }
69 | ]
70 | }
71 | },
72 | {
73 | "Type": "String",
74 | "Attributes": {
75 | "Element": "String"
76 | },
77 | "Properties": {
78 | "CloseOnEndOfLine": true
79 | },
80 | "TokenRange": {
81 | "Open": "\"",
82 | "Close": "\""
83 | },
84 | "SubRules": {
85 | "Range": [
86 | {
87 | "Type": "String",
88 | "Attributes": {
89 | "Element": "String"
90 | },
91 | "Properties": {
92 | "CloseOnEndOfLine": true,
93 | "CloseOnTerm": true
94 | },
95 | "TokenRange": {
96 | "Open": "\\\"",
97 | "Close": ""
98 | }
99 | },
100 | {
101 | "Type": "String",
102 | "Attributes": {
103 | "Element": "String"
104 | },
105 | "Properties": {
106 | "CloseOnEndOfLine": true,
107 | "CloseOnTerm": true
108 | },
109 | "TokenRange": {
110 | "Open": "\\\\",
111 | "Close": ""
112 | }
113 | }
114 | ]
115 | }
116 | },
117 | {
118 | "Type": "Number",
119 | "Attributes": {
120 | "Element": "Number"
121 | },
122 | "Properties": {
123 | "CloseOnTerm": true,
124 | "CloseOnEndOfLine": true
125 | },
126 | "TokenRange": {
127 | "Open": "*"
128 | }
129 | },
130 | {
131 | "Type": "Number",
132 | "Attributes": {
133 | "Element": "Number"
134 | },
135 | "Properties": {
136 | "CloseOnTerm": true,
137 | "CloseOnEndOfLine": true
138 | },
139 | "TokenRange": {
140 | "Open": "&"
141 | }
142 | }
143 | ],
144 | "KeyList": [
145 | {
146 | "Type": "Symbol",
147 | "Words": [
148 | ":",
149 | ";",
150 | "<",
151 | ">",
152 | "=",
153 | "/",
154 | "*",
155 | ".",
156 | ",",
157 | "-",
158 | "+",
159 | "(",
160 | ")",
161 | "[",
162 | "]",
163 | "{",
164 | "}",
165 | "|"
166 | ],
167 | "Attributes": {
168 | "Element": "Symbol"
169 | }
170 | }
171 | ],
172 | "Set": [
173 | {
174 | "Type": "Numbers",
175 | "Symbols": ".0123456789",
176 | "Attributes": {
177 | "Element": "Number"
178 | }
179 | }
180 | ]
181 | }
182 | }
183 | },
184 | "MatchingPair": {
185 | "Pairs": [
186 | {
187 | "OpenToken": "(",
188 | "CloseToken": ")"
189 | },
190 | {
191 | "OpenToken": "[",
192 | "CloseToken": "]"
193 | },
194 | {
195 | "OpenToken": "{",
196 | "CloseToken": "}"
197 | }
198 | ]
199 | },
200 | "CompletionProposal": {
201 | "SkipRegion": [
202 | {
203 | "OpenToken": "#",
204 | "RegionType": "SingleLine"
205 | }
206 | ]
207 | }
208 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright 2015-2023 Lasse Markus Rautiainen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Packages/Images/TDBTextEditor.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TDBTextEditor.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditor.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditor.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditorCompareScrollBar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditorCompareScrollBar.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditorMacroRecorder.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditorMacroRecorder.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditorPrint.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditorPrint.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditorPrintPreview.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditorPrintPreview.bmp
--------------------------------------------------------------------------------
/Packages/Images/TTextEditorSpellCheck.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/Images/TTextEditorSpellCheck.bmp
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.Designtime.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #include
4 | #pragma hdrstop
5 | #pragma package(smart_init)
6 | //---------------------------------------------------------------------------
7 |
8 | // Package source.
9 | //---------------------------------------------------------------------------
10 |
11 |
12 | #pragma argsused
13 | extern "C" int _libmain(unsigned long reason)
14 | {
15 | return 1;
16 | }
17 | //---------------------------------------------------------------------------
18 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.DesigntimePCH1.h:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 | #include
3 | #endif
4 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.Designtime_resources.rc:
--------------------------------------------------------------------------------
1 | TDBTextEditor BITMAP "Images\\TDBTextEditor.bmp"
2 | TTextEditor BITMAP "Images\\TTextEditor.bmp"
3 | TTextEditorCompareScrollBar BITMAP "Images\\TTextEditorCompareScrollBar.bmp"
4 | TTextEditorMacroRecorder BITMAP "Images\\TTextEditorMacroRecorder.bmp"
5 | TTextEditorPrint BITMAP "Images\\TTextEditorPrint.bmp"
6 | TTextEditorPrintPreview BITMAP "Images\\TTextEditorPrintPreview.bmp"
7 | TTextEditorSpellCheck BITMAP "Images\\TTextEditorSpellCheck.bmp"
8 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.Runtime.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #include
4 | #pragma hdrstop
5 | #pragma package(smart_init)
6 | //---------------------------------------------------------------------------
7 |
8 | // Package source.
9 | //---------------------------------------------------------------------------
10 |
11 |
12 | #pragma argsused
13 | extern "C" int _libmain(unsigned long reason)
14 | {
15 | return 1;
16 | }
17 | //---------------------------------------------------------------------------
18 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.RuntimePCH1.h:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 | #include
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Alexandria.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {A0056326-3B5E-42A7-B72B-8036D1FF1DF6}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
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 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.Designtime.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #include
4 | #pragma hdrstop
5 | #pragma package(smart_init)
6 | //---------------------------------------------------------------------------
7 |
8 | // Package source.
9 | //---------------------------------------------------------------------------
10 |
11 |
12 | #pragma argsused
13 | extern "C" int _libmain(unsigned long reason)
14 | {
15 | return 1;
16 | }
17 | //---------------------------------------------------------------------------
18 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.DesigntimePCH1.h:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 | #include
3 | #endif
4 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.Designtime_resources.rc:
--------------------------------------------------------------------------------
1 | TDBTextEditor BITMAP "Images\\TDBTextEditor.bmp"
2 | TTextEditor BITMAP "Images\\TTextEditor.bmp"
3 | TTextEditorCompareScrollBar BITMAP "Images\\TTextEditorCompareScrollBar.bmp"
4 | TTextEditorMacroRecorder BITMAP "Images\\TTextEditorMacroRecorder.bmp"
5 | TTextEditorPrint BITMAP "Images\\TTextEditorPrint.bmp"
6 | TTextEditorPrintPreview BITMAP "Images\\TTextEditorPrintPreview.bmp"
7 | TTextEditorSpellCheck BITMAP "Images\\TTextEditorSpellCheck.bmp"
8 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.Runtime.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 |
3 | #include
4 | #pragma hdrstop
5 | #pragma package(smart_init)
6 | //---------------------------------------------------------------------------
7 |
8 | // Package source.
9 | //---------------------------------------------------------------------------
10 |
11 |
12 | #pragma argsused
13 | extern "C" int _libmain(unsigned long reason)
14 | {
15 | return 1;
16 | }
17 | //---------------------------------------------------------------------------
18 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.RuntimePCH1.h:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 | #include
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Packages/TextEditor.CBuilder.Athens.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {A0056326-3B5E-42A7-B72B-8036D1FF1DF6}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
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 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Alexandria.Designtime.dpk:
--------------------------------------------------------------------------------
1 | package TextEditor.Delphi.Alexandria.Designtime;
2 |
3 | {$R *.res}
4 | {$R *.dres}
5 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
6 | {$ALIGN 8}
7 | {$ASSERTIONS ON}
8 | {$BOOLEVAL OFF}
9 | {$DEBUGINFO OFF}
10 | {$EXTENDEDSYNTAX ON}
11 | {$IMPORTEDDATA ON}
12 | {$IOCHECKS ON}
13 | {$LOCALSYMBOLS ON}
14 | {$LONGSTRINGS ON}
15 | {$OPENSTRINGS ON}
16 | {$OPTIMIZATION OFF}
17 | {$OVERFLOWCHECKS OFF}
18 | {$RANGECHECKS OFF}
19 | {$REFERENCEINFO ON}
20 | {$SAFEDIVIDE OFF}
21 | {$STACKFRAMES ON}
22 | {$TYPEDADDRESS OFF}
23 | {$VARSTRINGCHECKS ON}
24 | {$WRITEABLECONST ON}
25 | {$MINENUMSIZE 1}
26 | {$IMAGEBASE $400000}
27 | {$DEFINE DEBUG}
28 | {$DEFINE TEXT_EDITOR_SPELL_CHECK}
29 | {$ENDIF IMPLICITBUILDING}
30 | {$DESCRIPTION 'TTextEditor control package - designtime'}
31 | {$DESIGNONLY}
32 | {$IMPLICITBUILD ON}
33 |
34 | requires
35 | designide,
36 | dbrtl,
37 | vcldb,
38 | TextEditor.Delphi.Alexandria.Runtime;
39 |
40 | contains
41 | TextEditor.Register in '..\Source\TextEditor.Register.pas',
42 | TextEditor.RegisterProperty in '..\Source\TextEditor.RegisterProperty.pas',
43 | TextEditor.Splash in '..\Source\TextEditor.Splash.pas';
44 |
45 | end.
46 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Alexandria.Designtime.dres:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/TextEditor.Delphi.Alexandria.Designtime.dres
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Alexandria.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {8CB1D024-2164-4DE8-94B6-6B3C941FFFC2}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
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 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.Designtime.dpk:
--------------------------------------------------------------------------------
1 | package TextEditor.Delphi.Athens.Designtime;
2 |
3 | {$R *.res}
4 | {$R *.dres}
5 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
6 | {$ALIGN 8}
7 | {$ASSERTIONS ON}
8 | {$BOOLEVAL OFF}
9 | {$DEBUGINFO OFF}
10 | {$EXTENDEDSYNTAX ON}
11 | {$IMPORTEDDATA ON}
12 | {$IOCHECKS ON}
13 | {$LOCALSYMBOLS ON}
14 | {$LONGSTRINGS ON}
15 | {$OPENSTRINGS ON}
16 | {$OPTIMIZATION OFF}
17 | {$OVERFLOWCHECKS OFF}
18 | {$RANGECHECKS OFF}
19 | {$REFERENCEINFO ON}
20 | {$SAFEDIVIDE OFF}
21 | {$STACKFRAMES ON}
22 | {$TYPEDADDRESS OFF}
23 | {$VARSTRINGCHECKS ON}
24 | {$WRITEABLECONST ON}
25 | {$MINENUMSIZE 1}
26 | {$IMAGEBASE $400000}
27 | {$DEFINE DEBUG}
28 | {$DEFINE TEXT_EDITOR_SPELL_CHECK}
29 | {$ENDIF IMPLICITBUILDING}
30 | {$DESCRIPTION 'TTextEditor control package - designtime'}
31 | {$DESIGNONLY}
32 | {$IMPLICITBUILD ON}
33 |
34 | requires
35 | designide,
36 | dbrtl,
37 | vcldb,
38 | TextEditor.Delphi.Athens.Runtime;
39 |
40 | contains
41 | TextEditor.Register in '..\Source\TextEditor.Register.pas',
42 | TextEditor.RegisterProperty in '..\Source\TextEditor.RegisterProperty.pas',
43 | TextEditor.Splash in '..\Source\TextEditor.Splash.pas';
44 |
45 | end.
46 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.Designtime.dres:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/TextEditor.Delphi.Athens.Designtime.dres
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.Designtime.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/TextEditor.Delphi.Athens.Designtime.res
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.DesigntimeResource.rc:
--------------------------------------------------------------------------------
1 | TTextEditor BITMAP "Images\\TTextEditor.bmp"
2 | TDBTextEditor BITMAP "Images\\TDBTextEditor.bmp"
3 | TTextEditorPrint BITMAP "Images\\TTextEditorPrint.bmp"
4 | TTextEditorPrintPreview BITMAP "Images\\TTextEditorPrintPreview.bmp"
5 | TTextEditorMacroRecorder BITMAP "Images\\TTextEditorMacroRecorder.bmp"
6 | TTextEditorSpellCheck BITMAP "Images\\TTextEditorSpellCheck.bmp"
7 | TTextEditorCompareScrollBar BITMAP "Images\\TTextEditorCompareScrollBar.bmp"
8 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.Runtime.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/TextEditor.Delphi.Athens.Runtime.res
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Athens.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {8CB1D024-2164-4DE8-94B6-6B3C941FFFC2}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
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 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Sydney.Designtime.dpk:
--------------------------------------------------------------------------------
1 | package TextEditor.Delphi.Sydney.Designtime;
2 |
3 | {$R *.res}
4 | {$R *.dres}
5 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
6 | {$ALIGN 8}
7 | {$ASSERTIONS ON}
8 | {$BOOLEVAL OFF}
9 | {$DEBUGINFO OFF}
10 | {$EXTENDEDSYNTAX ON}
11 | {$IMPORTEDDATA ON}
12 | {$IOCHECKS ON}
13 | {$LOCALSYMBOLS ON}
14 | {$LONGSTRINGS ON}
15 | {$OPENSTRINGS ON}
16 | {$OPTIMIZATION OFF}
17 | {$OVERFLOWCHECKS OFF}
18 | {$RANGECHECKS OFF}
19 | {$REFERENCEINFO ON}
20 | {$SAFEDIVIDE OFF}
21 | {$STACKFRAMES ON}
22 | {$TYPEDADDRESS OFF}
23 | {$VARSTRINGCHECKS ON}
24 | {$WRITEABLECONST ON}
25 | {$MINENUMSIZE 1}
26 | {$IMAGEBASE $400000}
27 | {$DEFINE DEBUG}
28 | {$DEFINE TEXT_EDITOR_SPELL_CHECK}
29 | {$ENDIF IMPLICITBUILDING}
30 | {$DESCRIPTION 'TTextEditor control package - designtime'}
31 | {$DESIGNONLY}
32 | {$IMPLICITBUILD ON}
33 |
34 | requires
35 | designide,
36 | dbrtl,
37 | vcldb,
38 | TextEditor.Delphi.Sydney.Runtime;
39 |
40 | contains
41 | TextEditor.Register in '..\Source\TextEditor.Register.pas',
42 | TextEditor.RegisterProperty in '..\Source\TextEditor.RegisterProperty.pas',
43 | TextEditor.Splash in '..\Source\TextEditor.Splash.pas';
44 |
45 | end.
46 |
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Sydney.Designtime.dres:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Packages/TextEditor.Delphi.Sydney.Designtime.dres
--------------------------------------------------------------------------------
/Packages/TextEditor.Delphi.Sydney.groupproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {8CB1D024-2164-4DE8-94B6-6B3C941FFFC2}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Default.Personality.12
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TTextEditor [](https://opensource.org/licenses/MIT) [](https://github.com/TextEditorPro/TTextEditor/tree/main/Source) [](https://github.com/TextEditorPro/TTextEditor/tree/main/Source)
2 |
3 | The latest stable release of TTextEditor control for C++ Builder/Delphi.
4 | The development environment is RAD Studio 12 Athens but can work with older versions as well (not tested).
5 | The use of namespaces requires at least XE2.
6 |
7 | ## Updates
8 |
9 | The repository is not actively updated in github - only when deemed necessary.
10 | Development takes place elsewhere.
11 |
12 | ## Features
13 |
14 | - Arabic and Hebrew support
15 | - Code/text folding
16 | - Color themes
17 | - Colors, Fonts, and FontStyles properties
18 | - Theme Load and Save properties
19 | - JSON file/stream import
20 | - Completion proposal
21 | - Snippets
22 | - Data-aware
23 | - Highlight line
24 | - Highlighters
25 | - Highlighter Load property
26 | - JSON file/stream import
27 | - HTML export (clipboard support)
28 | - Large file support
29 | - Left margin
30 | - Bookmarks
31 | - Custom marks
32 | - Line states
33 | - Line numbers
34 | - Macro recorder
35 | - Matching pairs
36 | - Minimap
37 | - Multi edit
38 | - Non-blinking caret
39 | - Printing
40 | - Replace
41 | - Right margin
42 | - Ruler
43 | - Search
44 | - Special chars
45 | - Sync edit
46 | - Undo/redo
47 | - Variable-width font support
48 | - Word wrap
49 |
50 | ## Supports
51 |
52 | - AlphaSkins (native) - https://www.alphaskins.com/
53 | - BaseNcoding - https://github.com/Xor-el/BaseNcodingPascal
54 | - Hunspell - http://hunspell.github.io/
55 |
56 | ## Defines
57 |
58 | [TextEditor.Defines.inc](https://github.com/TextEditorPro/TTextEditor/blob/main/Source/TextEditor.Defines.inc)
59 |
60 | ## License
61 |
62 | [MIT](https://github.com/TextEditorPro/TTextEditor/blob/main/LICENSE)
63 |
64 | ## Connect
65 |
66 | https://www.linkedin.com/in/lassemarkusrautiainen/
67 |
68 | ## Donations
69 |
70 | https://ko-fi.com/texteditorpro
--------------------------------------------------------------------------------
/Source/TextEditor.ActiveLine.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.ActiveLine;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Consts, TextEditor.Glyph;
7 |
8 | type
9 | TTextEditorActiveLine = class(TPersistent)
10 | strict private
11 | FIndicator: TTextEditorGlyph;
12 | FOnChange: TNotifyEvent;
13 | FVisible: Boolean;
14 | function IsIndicatorStored: Boolean;
15 | procedure DoChange(const ASender: TObject);
16 | procedure SetIndicator(const AValue: TTextEditorGlyph);
17 | procedure SetOnChange(const AValue: TNotifyEvent);
18 | procedure SetVisible(const AValue: Boolean);
19 | public
20 | constructor Create;
21 | destructor Destroy; override;
22 | procedure Assign(ASource: TPersistent); override;
23 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
24 | published
25 | property Indicator: TTextEditorGlyph read FIndicator write SetIndicator stored IsIndicatorStored;
26 | property Visible: Boolean read FVisible write SetVisible default True;
27 | end;
28 |
29 | implementation
30 |
31 | constructor TTextEditorActiveLine.Create;
32 | begin
33 | inherited;
34 |
35 | FIndicator := TTextEditorGlyph.Create(HInstance, TResourceBitmap.ActiveLine, TColors.Fuchsia);
36 |
37 | FIndicator.Visible := False;
38 | FVisible := True;
39 | end;
40 |
41 | destructor TTextEditorActiveLine.Destroy;
42 | begin
43 | FIndicator.Free;
44 |
45 | inherited;
46 | end;
47 |
48 | procedure TTextEditorActiveLine.Assign(ASource: TPersistent);
49 | begin
50 | if Assigned(ASource) and (ASource is TTextEditorActiveLine) then
51 | with ASource as TTextEditorActiveLine do
52 | begin
53 | Self.FVisible := FVisible;
54 | Self.FIndicator.Assign(FIndicator);
55 | Self.DoChange(Self);
56 | end
57 | else
58 | inherited Assign(ASource);
59 | end;
60 |
61 | function TTextEditorActiveLine.IsIndicatorStored: Boolean;
62 | begin
63 | Result := FIndicator.Visible or (FIndicator.MaskColor <> TColors.SysNone) or (FIndicator.Left <> 2);
64 | end;
65 |
66 | procedure TTextEditorActiveLine.SetOnChange(const AValue: TNotifyEvent);
67 | begin
68 | FOnChange := AValue;
69 | FIndicator.OnChange := AValue;
70 | end;
71 |
72 | procedure TTextEditorActiveLine.DoChange(const ASender: TObject);
73 | begin
74 | if Assigned(FOnChange) then
75 | FOnChange(ASender);
76 | end;
77 |
78 | procedure TTextEditorActiveLine.SetIndicator(const AValue: TTextEditorGlyph);
79 | begin
80 | FIndicator.Assign(AValue);
81 | end;
82 |
83 | procedure TTextEditorActiveLine.SetVisible(const AValue: Boolean);
84 | begin
85 | if FVisible <> AValue then
86 | begin
87 | FVisible := AValue;
88 |
89 | DoChange(Self);
90 | end;
91 | end;
92 |
93 | end.
94 |
--------------------------------------------------------------------------------
/Source/TextEditor.Caret.MultiEdit.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Caret.MultiEdit;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorCaretMultiEdit = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FOnChange: TNotifyEvent;
13 | FOptions: TTextEditorCaretMultiEditOptions;
14 | FStyle: TTextEditorCaretStyle;
15 | procedure DoChange;
16 | procedure SetActive(const AValue: Boolean);
17 | procedure SetOptions(const AValue: TTextEditorCaretMultiEditOptions);
18 | procedure SetStyle(const AValue: TTextEditorCaretStyle);
19 | public
20 | constructor Create;
21 | procedure Assign(ASource: TPersistent); override;
22 | procedure SetOption(const AOption: TTextEditorCaretMultiEditOption; const AEnabled: Boolean);
23 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
24 | published
25 | property Active: Boolean read FActive write SetActive default True;
26 | property Options: TTextEditorCaretMultiEditOptions read FOptions write SetOptions default TTextEditorDefaultOptions.MultiEdit;
27 | property Style: TTextEditorCaretStyle read FStyle write SetStyle default csThinVerticalLine;
28 | end;
29 |
30 | implementation
31 |
32 | constructor TTextEditorCaretMultiEdit.Create;
33 | begin
34 | inherited;
35 |
36 | FActive := True;
37 | FStyle := csThinVerticalLine;
38 | FOptions := TTextEditorDefaultOptions.MultiEdit;
39 | end;
40 |
41 | procedure TTextEditorCaretMultiEdit.Assign(ASource: TPersistent);
42 | begin
43 | if Assigned(ASource) and (ASource is TTextEditorCaretMultiEdit) then
44 | with ASource as TTextEditorCaretMultiEdit do
45 | begin
46 | Self.FActive := FActive;
47 | Self.FOptions := FOptions;
48 | Self.FStyle := FStyle;
49 |
50 | Self.DoChange;
51 | end
52 | else
53 | inherited Assign(ASource);
54 | end;
55 |
56 | procedure TTextEditorCaretMultiEdit.DoChange;
57 | begin
58 | if Assigned(FOnChange) then
59 | FOnChange(Self);
60 | end;
61 |
62 | procedure TTextEditorCaretMultiEdit.SetActive(const AValue: Boolean);
63 | begin
64 | if FActive <> AValue then
65 | begin
66 | FActive := AValue;
67 |
68 | DoChange;
69 | end;
70 | end;
71 |
72 | procedure TTextEditorCaretMultiEdit.SetStyle(const AValue: TTextEditorCaretStyle);
73 | begin
74 | if FStyle <> AValue then
75 | begin
76 | FStyle := AValue;
77 |
78 | DoChange;
79 | end;
80 | end;
81 |
82 | procedure TTextEditorCaretMultiEdit.SetOptions(const AValue: TTextEditorCaretMultiEditOptions);
83 | begin
84 | if FOptions <> AValue then
85 | begin
86 | FOptions := AValue;
87 |
88 | DoChange;
89 | end;
90 | end;
91 |
92 | procedure TTextEditorCaretMultiEdit.SetOption(const AOption: TTextEditorCaretMultiEditOption; const AEnabled: Boolean);
93 | begin
94 | if AEnabled then
95 | Include(FOptions, AOption)
96 | else
97 | Exclude(FOptions, AOption);
98 | end;
99 |
100 | end.
101 |
--------------------------------------------------------------------------------
/Source/TextEditor.Caret.NonBlinking.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Caret.NonBlinking;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | type
9 | TTextEditorCaretNonBlinking = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FOnChange: TNotifyEvent;
13 | procedure DoChange;
14 | procedure SetActive(const AValue: Boolean);
15 | public
16 | constructor Create;
17 | procedure Assign(ASource: TPersistent); override;
18 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
19 | published
20 | property Active: Boolean read FActive write SetActive default False;
21 | end;
22 |
23 | implementation
24 |
25 | constructor TTextEditorCaretNonBlinking.Create;
26 | begin
27 | inherited;
28 |
29 | FActive := False;
30 | end;
31 |
32 | procedure TTextEditorCaretNonBlinking.Assign(ASource: TPersistent);
33 | begin
34 | if Assigned(ASource) and (ASource is TTextEditorCaretNonBlinking) then
35 | with ASource as TTextEditorCaretNonBlinking do
36 | begin
37 | Self.FActive := FActive;
38 |
39 | Self.DoChange;
40 | end
41 | else
42 | inherited Assign(ASource);
43 | end;
44 |
45 | procedure TTextEditorCaretNonBlinking.DoChange;
46 | begin
47 | if Assigned(FOnChange) then
48 | FOnChange(Self);
49 | end;
50 |
51 | procedure TTextEditorCaretNonBlinking.SetActive(const AValue: Boolean);
52 | begin
53 | if FActive <> AValue then
54 | begin
55 | FActive := AValue;
56 |
57 | DoChange;
58 | end;
59 | end;
60 |
61 | end.
62 |
--------------------------------------------------------------------------------
/Source/TextEditor.Caret.Offsets.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Caret.Offsets;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | type
9 | TTextEditorCaretOffsets = class(TPersistent)
10 | strict private
11 | FLeft: Integer;
12 | FOnChange: TNotifyEvent;
13 | FTop: Integer;
14 | procedure DoChange(const ASender: TObject);
15 | procedure SetLeft(const AValue: Integer);
16 | procedure SetTop(const AValue: Integer);
17 | public
18 | constructor Create;
19 | procedure Assign(ASource: TPersistent); override;
20 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
21 | published
22 | property Left: Integer read FLeft write SetLeft default 0;
23 | property Top: Integer read FTop write SetTop default 0;
24 | end;
25 |
26 | implementation
27 |
28 | constructor TTextEditorCaretOffsets.Create;
29 | begin
30 | inherited;
31 |
32 | FLeft := 0;
33 | FTop := 0;
34 | end;
35 |
36 | procedure TTextEditorCaretOffsets.Assign(ASource: TPersistent);
37 | begin
38 | if Assigned(ASource) and (ASource is TTextEditorCaretOffsets) then
39 | with ASource as TTextEditorCaretOffsets do
40 | begin
41 | Self.FLeft := FLeft;
42 | Self.FTop := FTop;
43 |
44 | Self.DoChange(Self);
45 | end
46 | else
47 | inherited Assign(ASource);
48 | end;
49 |
50 | procedure TTextEditorCaretOffsets.DoChange(const ASender: TObject);
51 | begin
52 | if Assigned(FOnChange) then
53 | FOnChange(ASender);
54 | end;
55 |
56 | procedure TTextEditorCaretOffsets.SetLeft(const AValue: Integer);
57 | begin
58 | if FLeft <> AValue then
59 | begin
60 | FLeft := AValue;
61 |
62 | DoChange(Self);
63 | end;
64 | end;
65 |
66 | procedure TTextEditorCaretOffsets.SetTop(const AValue: Integer);
67 | begin
68 | if FTop <> AValue then
69 | begin
70 | FTop := AValue;
71 |
72 | DoChange(Self);
73 | end;
74 | end;
75 |
76 | end.
77 |
--------------------------------------------------------------------------------
/Source/TextEditor.Caret.Styles.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Caret.Styles;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorCaretStyles = class(TPersistent)
10 | strict private
11 | FInsert: TTextEditorCaretStyle;
12 | FOnChange: TNotifyEvent;
13 | FOverwrite: TTextEditorCaretStyle;
14 | procedure DoChange;
15 | procedure SetInsert(const AValue: TTextEditorCaretStyle);
16 | procedure SetOverwrite(const AValue: TTextEditorCaretStyle);
17 | public
18 | constructor Create;
19 | procedure Assign(ASource: TPersistent); override;
20 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
21 | published
22 | property Insert: TTextEditorCaretStyle read FInsert write SetInsert default csThinVerticalLine;
23 | property Overwrite: TTextEditorCaretStyle read FOverwrite write SetOverwrite default csThinVerticalLine;
24 | end;
25 |
26 | implementation
27 |
28 | constructor TTextEditorCaretStyles.Create;
29 | begin
30 | inherited;
31 |
32 | FInsert := csThinVerticalLine;
33 | FOverwrite := csThinVerticalLine;
34 | end;
35 |
36 | procedure TTextEditorCaretStyles.Assign(ASource: TPersistent);
37 | begin
38 | if Assigned(ASource) and (ASource is TTextEditorCaretStyles) then
39 | with ASource as TTextEditorCaretStyles do
40 | begin
41 | Self.FOverwrite := FOverwrite;
42 | Self.FInsert := FInsert;
43 |
44 | Self.DoChange;
45 | end
46 | else
47 | inherited Assign(ASource);
48 | end;
49 |
50 | procedure TTextEditorCaretStyles.DoChange;
51 | begin
52 | if Assigned(FOnChange) then
53 | FOnChange(Self);
54 | end;
55 |
56 | procedure TTextEditorCaretStyles.SetInsert(const AValue: TTextEditorCaretStyle);
57 | begin
58 | if FInsert <> AValue then
59 | begin
60 | FInsert := AValue;
61 |
62 | DoChange;
63 | end;
64 | end;
65 |
66 | procedure TTextEditorCaretStyles.SetOverwrite(const AValue: TTextEditorCaretStyle);
67 | begin
68 | if FOverwrite <> AValue then
69 | begin
70 | FOverwrite := AValue;
71 |
72 | DoChange;
73 | end;
74 | end;
75 |
76 | end.
77 |
--------------------------------------------------------------------------------
/Source/TextEditor.Caret.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Caret;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Caret.MultiEdit, TextEditor.Caret.NonBlinking, TextEditor.Caret.Offsets,
7 | TextEditor.Caret.Styles, TextEditor.Types;
8 |
9 | type
10 | TTextEditorCaret = class(TPersistent)
11 | strict private
12 | FMultiEdit: TTextEditorCaretMultiEdit;
13 | FNonBlinking: TTextEditorCaretNonBlinking;
14 | FOffsets: TTextEditorCaretOffsets;
15 | FOnChange: TNotifyEvent;
16 | FOptions: TTextEditorCaretOptions;
17 | FStyles: TTextEditorCaretStyles;
18 | FVisible: Boolean;
19 | procedure DoChange(const ASender: TObject);
20 | procedure SetMultiEdit(const AValue: TTextEditorCaretMultiEdit);
21 | procedure SetNonBlinking(const AValue: TTextEditorCaretNonBlinking);
22 | procedure SetOffsets(const AValue: TTextEditorCaretOffsets);
23 | procedure SetOnChange(const AValue: TNotifyEvent);
24 | procedure SetOptions(const AValue: TTextEditorCaretOptions);
25 | procedure SetStyles(const AValue: TTextEditorCaretStyles);
26 | procedure SetVisible(const AValue: Boolean);
27 | public
28 | constructor Create;
29 | destructor Destroy; override;
30 | procedure Assign(ASource: TPersistent); override;
31 | procedure SetOption(const AOption: TTextEditorCaretOption; const AEnabled: Boolean);
32 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
33 | published
34 | property MultiEdit: TTextEditorCaretMultiEdit read FMultiEdit write SetMultiEdit;
35 | property NonBlinking: TTextEditorCaretNonBlinking read FNonBlinking write SetNonBlinking;
36 | property Offsets: TTextEditorCaretOffsets read FOffsets write SetOffsets;
37 | property Options: TTextEditorCaretOptions read FOptions write SetOptions default [];
38 | property Styles: TTextEditorCaretStyles read FStyles write SetStyles;
39 | property Visible: Boolean read FVisible write SetVisible default True;
40 | end;
41 |
42 | implementation
43 |
44 | constructor TTextEditorCaret.Create;
45 | begin
46 | inherited;
47 |
48 | FMultiEdit := TTextEditorCaretMultiEdit.Create;
49 | FNonBlinking := TTextEditorCaretNonBlinking.Create;
50 | FOffsets := TTextEditorCaretOffsets.Create;
51 | FStyles := TTextEditorCaretStyles.Create;
52 | FVisible := True;
53 | FOptions := [];
54 | end;
55 |
56 | destructor TTextEditorCaret.Destroy;
57 | begin
58 | FMultiEdit.Free;
59 | FNonBlinking.Free;
60 | FOffsets.Free;
61 | FStyles.Free;
62 |
63 | inherited;
64 | end;
65 |
66 | procedure TTextEditorCaret.Assign(ASource: TPersistent);
67 | begin
68 | if Assigned(ASource) and (ASource is TTextEditorCaret) then
69 | with ASource as TTextEditorCaret do
70 | begin
71 | Self.FStyles.Assign(FStyles);
72 | Self.FMultiEdit.Assign(FMultiEdit);
73 | Self.FNonBlinking.Assign(FNonBlinking);
74 | Self.FOffsets.Assign(FOffsets);
75 | Self.FOptions := FOptions;
76 | Self.FVisible := FVisible;
77 |
78 | Self.DoChange(Self);
79 | end
80 | else
81 | inherited Assign(ASource);
82 | end;
83 |
84 | procedure TTextEditorCaret.SetOnChange(const AValue: TNotifyEvent);
85 | begin
86 | FOnChange := AValue;
87 | FOffsets.OnChange := AValue;
88 | FStyles.OnChange := AValue;
89 | FMultiEdit.OnChange := AValue;
90 | FNonBlinking.OnChange := AValue;
91 | end;
92 |
93 | procedure TTextEditorCaret.DoChange(const ASender: TObject);
94 | begin
95 | if Assigned(FOnChange) then
96 | FOnChange(ASender);
97 | end;
98 |
99 | procedure TTextEditorCaret.SetStyles(const AValue: TTextEditorCaretStyles);
100 | begin
101 | FStyles.Assign(AValue);
102 | end;
103 |
104 | procedure TTextEditorCaret.SetMultiEdit(const AValue: TTextEditorCaretMultiEdit);
105 | begin
106 | FMultiEdit.Assign(AValue);
107 | end;
108 |
109 | procedure TTextEditorCaret.SetNonBlinking(const AValue: TTextEditorCaretNonBlinking);
110 | begin
111 | FNonBlinking.Assign(AValue);
112 | end;
113 |
114 | procedure TTextEditorCaret.SetVisible(const AValue: Boolean);
115 | begin
116 | if FVisible <> AValue then
117 | begin
118 | FVisible := AValue;
119 |
120 | DoChange(Self);
121 | end;
122 | end;
123 |
124 | procedure TTextEditorCaret.SetOffsets(const AValue: TTextEditorCaretOffsets);
125 | begin
126 | FOffsets.Assign(AValue);
127 | end;
128 |
129 | procedure TTextEditorCaret.SetOption(const AOption: TTextEditorCaretOption; const AEnabled: Boolean);
130 | begin
131 | if AEnabled then
132 | Include(FOptions, AOption)
133 | else
134 | Exclude(FOptions, AOption);
135 | end;
136 |
137 | procedure TTextEditorCaret.SetOptions(const AValue: TTextEditorCaretOptions);
138 | begin
139 | if FOptions <> AValue then
140 | begin
141 | FOptions := AValue;
142 |
143 | DoChange(Self);
144 | end;
145 | end;
146 |
147 | end.
148 |
--------------------------------------------------------------------------------
/Source/TextEditor.CodeFolding.GuideLines.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.CodeFolding.GuideLines;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorCodeFoldingGuideLines = class(TPersistent)
10 | strict private
11 | FHighlightStyle: TTextEditorCodeFoldingGuideLineStyle;
12 | FOptions: TTextEditorCodeFoldingGuideLineOptions;
13 | FPadding: Integer;
14 | FStyle: TTextEditorCodeFoldingGuideLineStyle;
15 | FVisible: Boolean;
16 | public
17 | constructor Create;
18 | procedure Assign(ASource: TPersistent); override;
19 | procedure SetOption(const AOption: TTextEditorCodeFoldingGuideLineOption; const AEnabled: Boolean);
20 | published
21 | property HighlightStyle: TTextEditorCodeFoldingGuideLineStyle read FHighlightStyle write FHighlightStyle default lsDash;
22 | property Options: TTextEditorCodeFoldingGuideLineOptions read FOptions write FOptions default TTextEditorDefaultOptions.CodeFoldingGuideLines;
23 | property Padding: Integer read FPadding write FPadding default 3;
24 | property Style: TTextEditorCodeFoldingGuideLineStyle read FStyle write FStyle default lsDash;
25 | property Visible: Boolean read FVisible write FVisible default True;
26 | end;
27 |
28 | implementation
29 |
30 | constructor TTextEditorCodeFoldingGuideLines.Create;
31 | begin
32 | inherited;
33 |
34 | FHighlightStyle := lsDash;
35 | FOptions := TTextEditorDefaultOptions.CodeFoldingGuideLines;
36 | FPadding := 3;
37 | FStyle := lsDash;
38 | FVisible := True;
39 | end;
40 |
41 | procedure TTextEditorCodeFoldingGuideLines.Assign(ASource: TPersistent);
42 | begin
43 | if Assigned(ASource) and (ASource is TTextEditorCodeFoldingGuideLines) then
44 | with ASource as TTextEditorCodeFoldingGuideLines do
45 | begin
46 | Self.FHighlightStyle := FHighlightStyle;
47 | Self.FOptions := FOptions;
48 | Self.FPadding := FPadding;
49 | Self.FStyle := FStyle;
50 | Self.FVisible := FVisible;
51 | end
52 | else
53 | inherited Assign(ASource);
54 | end;
55 |
56 | procedure TTextEditorCodeFoldingGuideLines.SetOption(const AOption: TTextEditorCodeFoldingGuideLineOption; const AEnabled: Boolean);
57 | begin
58 | if AEnabled then
59 | Include(FOptions, AOption)
60 | else
61 | Exclude(FOptions, AOption);
62 | end;
63 |
64 | end.
65 |
--------------------------------------------------------------------------------
/Source/TextEditor.CodeFolding.Hint.Indicator.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.CodeFolding.Hint.Indicator;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, Vcl.Controls, TextEditor.Glyph, TextEditor.Types;
7 |
8 | type
9 | TTextEditorCodeFoldingHintIndicator = class(TPersistent)
10 | strict private
11 | FGlyph: TTextEditorGlyph;
12 | FMarkStyle: TTextEditorCodeFoldingHintIndicatorMarkStyle;
13 | FOptions: TTextEditorCodeFoldingHintIndicatorOptions;
14 | FPadding: TTextEditorCodeFoldingHintIndicatorPadding;
15 | FVisible: Boolean;
16 | FWidth: Integer;
17 | function IsGlyphStored: Boolean;
18 | procedure SetGlyph(const AValue: TTextEditorGlyph);
19 | public
20 | constructor Create;
21 | destructor Destroy; override;
22 | procedure Assign(ASource: TPersistent); override;
23 | published
24 | property Glyph: TTextEditorGlyph read FGlyph write SetGlyph stored IsGlyphStored;
25 | property MarkStyle: TTextEditorCodeFoldingHintIndicatorMarkStyle read FMarkStyle write FMarkStyle default imsThreeDots;
26 | property Options: TTextEditorCodeFoldingHintIndicatorOptions read FOptions write FOptions default TTextEditorDefaultOptions.CodeFoldingHint;
27 | property Padding: TTextEditorCodeFoldingHintIndicatorPadding read FPadding write FPadding;
28 | property Visible: Boolean read FVisible write FVisible default True;
29 | property Width: Integer read FWidth write FWidth default 26;
30 | end;
31 |
32 | implementation
33 |
34 | uses
35 | System.UITypes;
36 |
37 | constructor TTextEditorCodeFoldingHintIndicator.Create;
38 | begin
39 | inherited;
40 |
41 | FGlyph := TTextEditorGlyph.Create;
42 | FPadding := TTextEditorCodeFoldingHintIndicatorPadding.Create(nil);
43 | FGlyph.Visible := False;
44 | FMarkStyle := imsThreeDots;
45 | FVisible := True;
46 | FOptions := TTextEditorDefaultOptions.CodeFoldingHint;
47 | FWidth := 26;
48 | end;
49 |
50 | destructor TTextEditorCodeFoldingHintIndicator.Destroy;
51 | begin
52 | FGlyph.Free;
53 | FPadding.Free;
54 |
55 | inherited;
56 | end;
57 |
58 | procedure TTextEditorCodeFoldingHintIndicator.Assign(ASource: TPersistent);
59 | begin
60 | if Assigned(ASource) and (ASource is TTextEditorCodeFoldingHintIndicator) then
61 | with ASource as TTextEditorCodeFoldingHintIndicator do
62 | begin
63 | Self.FVisible := FVisible;
64 | Self.FMarkStyle := FMarkStyle;
65 | Self.FWidth := FWidth;
66 | Self.FGlyph.Assign(FGlyph);
67 | Self.FPadding.Assign(FPadding);
68 | end
69 | else
70 | inherited Assign(ASource);
71 | end;
72 |
73 | function TTextEditorCodeFoldingHintIndicator.IsGlyphStored: Boolean;
74 | begin
75 | Result := FGlyph.Visible or (FGlyph.Left <> 2) or (FGlyph.MaskColor <> TColors.SysNone);
76 | end;
77 |
78 | procedure TTextEditorCodeFoldingHintIndicator.SetGlyph(const AValue: TTextEditorGlyph);
79 | begin
80 | FGlyph.Assign(AValue);
81 | end;
82 |
83 | end.
84 |
--------------------------------------------------------------------------------
/Source/TextEditor.CodeFolding.Hint.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.CodeFolding.Hint;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.CodeFolding.Hint.Indicator;
7 |
8 | type
9 | TTextEditorCodeFoldingHint = class(TPersistent)
10 | strict private
11 | FCursor: TCursor;
12 | FIndicator: TTextEditorCodeFoldingHintIndicator;
13 | FRowCount: Integer;
14 | FVisible: Boolean;
15 | public
16 | constructor Create;
17 | destructor Destroy; override;
18 | procedure Assign(ASource: TPersistent); override;
19 | published
20 | property Cursor: TCursor read FCursor write FCursor default crHandPoint;
21 | property Indicator: TTextEditorCodeFoldingHintIndicator read FIndicator write FIndicator;
22 | property RowCount: Integer read FRowCount write FRowCount default 40;
23 | property Visible: Boolean read FVisible write FVisible default True;
24 | end;
25 |
26 | implementation
27 |
28 | uses
29 | System.SysUtils;
30 |
31 | constructor TTextEditorCodeFoldingHint.Create;
32 | begin
33 | inherited;
34 |
35 | FCursor := crHandPoint;
36 | FIndicator := TTextEditorCodeFoldingHintIndicator.Create;
37 | FRowCount := 40;
38 | FVisible := True;
39 | end;
40 |
41 | destructor TTextEditorCodeFoldingHint.Destroy;
42 | begin
43 | FreeAndNil(FIndicator);
44 |
45 | inherited;
46 | end;
47 |
48 | procedure TTextEditorCodeFoldingHint.Assign(ASource: TPersistent);
49 | begin
50 | if Assigned(ASource) and (ASource is TTextEditorCodeFoldingHint) then
51 | with ASource as TTextEditorCodeFoldingHint do
52 | begin
53 | Self.FCursor := FCursor;
54 | Self.FIndicator.Assign(FIndicator);
55 | Self.FRowCount := FRowCount;
56 | Self.FVisible := FVisible;
57 | end
58 | else
59 | inherited Assign(ASource);
60 | end;
61 |
62 | end.
63 |
--------------------------------------------------------------------------------
/Source/TextEditor.CompletionProposal.Trigger.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.CompletionProposal.Trigger;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | const
9 | DEFAULT_INTERVAL = 300;
10 |
11 | type
12 | TTextEditorCompletionProposalTrigger = class(TPersistent)
13 | strict private
14 | FActive: Boolean;
15 | FChars: string;
16 | FInterval: Integer;
17 | function IsCharsStored: Boolean;
18 | public
19 | constructor Create;
20 | procedure Assign(ASource: TPersistent); override;
21 | published
22 | property Active: Boolean read FActive write FActive default False;
23 | property Chars: string read FChars write FChars stored IsCharsStored;
24 | property Interval: Integer read FInterval write FInterval default DEFAULT_INTERVAL;
25 | end;
26 |
27 | implementation
28 |
29 | uses
30 | TextEditor.Consts;
31 |
32 | constructor TTextEditorCompletionProposalTrigger.Create;
33 | begin
34 | inherited;
35 |
36 | FActive := False;
37 | FChars := TCharacters.Dot;
38 | FInterval := DEFAULT_INTERVAL;
39 | end;
40 |
41 | procedure TTextEditorCompletionProposalTrigger.Assign(ASource: TPersistent);
42 | begin
43 | if Assigned(ASource) and (ASource is TTextEditorCompletionProposalTrigger) then
44 | with ASource as TTextEditorCompletionProposalTrigger do
45 | begin
46 | Self.FActive := FActive;
47 | Self.FChars := FChars;
48 | Self.FInterval := FInterval;
49 | end
50 | else
51 | inherited Assign(ASource);
52 | end;
53 |
54 | function TTextEditorCompletionProposalTrigger.IsCharsStored: Boolean;
55 | begin
56 | Result := FChars <> TCharacters.Dot;
57 | end;
58 |
59 | end.
60 |
--------------------------------------------------------------------------------
/Source/TextEditor.CompletionProposal.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.CompletionProposal;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.CompletionProposal.Snippets, TextEditor.CompletionProposal.Trigger, TextEditor.Types;
7 |
8 | type
9 | TTextEditorCompletionProposal = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FCloseChars: string;
13 | FKeywordCase: TTextEditorCompletionProposalKeywordCase;
14 | FMinHeight: Integer;
15 | FMinWidth: Integer;
16 | FOptions: TTextEditorCompletionProposalOptions;
17 | FOwner: TComponent;
18 | FShortCut: TShortCut;
19 | FSnippets: TTextEditorCompletionProposalSnippets;
20 | FTrigger: TTextEditorCompletionProposalTrigger;
21 | FVisible: Boolean;
22 | FVisibleLines: Integer;
23 | FWidth: Integer;
24 | function IsCloseCharsStored: Boolean;
25 | procedure SetSnippets(const AValue: TTextEditorCompletionProposalSnippets);
26 | protected
27 | function GetOwner: TPersistent; override;
28 | public
29 | constructor Create(AOwner: TComponent);
30 | destructor Destroy; override;
31 | procedure Assign(ASource: TPersistent); override;
32 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
33 | procedure SetOption(const AOption: TTextEditorCompletionProposalOption; const AEnabled: Boolean);
34 | property Visible: Boolean read FVisible write FVisible;
35 | published
36 | property Active: Boolean read FActive write FActive default True;
37 | property CloseChars: string read FCloseChars write FCloseChars stored IsCloseCharsStored;
38 | property KeywordCase: TTextEditorCompletionProposalKeywordCase read FKeywordCase write FKeywordCase default kcLowerCase;
39 | property MinHeight: Integer read FMinHeight write FMinHeight default 0;
40 | property MinWidth: Integer read FMinWidth write FMinWidth default 0;
41 | property Options: TTextEditorCompletionProposalOptions read FOptions write FOptions default TTextEditorDefaultOptions.CompletionProposal;
42 | property ShortCut: TShortCut read FShortCut write FShortCut default 16416; // Ctrl+Space
43 | property Snippets: TTextEditorCompletionProposalSnippets read FSnippets write SetSnippets;
44 | property Trigger: TTextEditorCompletionProposalTrigger read FTrigger write FTrigger;
45 | property VisibleLines: Integer read FVisibleLines write FVisibleLines default 8;
46 | property Width: Integer read FWidth write FWidth default 260;
47 | end;
48 |
49 | implementation
50 |
51 | uses
52 | Winapi.Windows, System.SysUtils, Vcl.Menus, TextEditor.Consts;
53 |
54 | constructor TTextEditorCompletionProposal.Create(AOwner: TComponent);
55 | begin
56 | inherited Create;
57 |
58 | FOwner := AOwner;
59 | FActive := True;
60 | FCloseChars := TCharacterSets.DefaultCompletionProposalCloseChars;
61 | FSnippets := TTextEditorCompletionProposalSnippets.Create(Self);
62 | FOptions := TTextEditorDefaultOptions.CompletionProposal;
63 | FShortCut := Vcl.Menus.ShortCut(Ord(' '), [ssCtrl]);
64 | FTrigger := TTextEditorCompletionProposalTrigger.Create;
65 | FVisibleLines := 8;
66 | FMinHeight := 0;
67 | FMinWidth := 0;
68 | FWidth := 260;
69 | FKeywordCase := kcLowerCase;
70 | end;
71 |
72 | destructor TTextEditorCompletionProposal.Destroy;
73 | begin
74 | FSnippets.Free;
75 | FTrigger.Free;
76 |
77 | inherited Destroy;
78 | end;
79 |
80 | procedure TTextEditorCompletionProposal.Assign(ASource: TPersistent);
81 | begin
82 | if Assigned(ASource) and (ASource is TTextEditorCompletionProposal) then
83 | with ASource as TTextEditorCompletionProposal do
84 | begin
85 | Self.FActive := FActive;
86 | Self.FCloseChars := FCloseChars;
87 | Self.FSnippets.Assign(FSnippets);
88 | Self.FOptions := FOptions;
89 | Self.FShortCut := FShortCut;
90 | Self.FTrigger.Assign(FTrigger);
91 | Self.FVisibleLines := FVisibleLines;
92 | Self.FWidth := FWidth;
93 | end
94 | else
95 | inherited Assign(ASource);
96 | end;
97 |
98 | function TTextEditorCompletionProposal.IsCloseCharsStored: Boolean;
99 | begin
100 | Result := FCloseChars <> TCharacterSets.DefaultCompletionProposalCloseChars;
101 | end;
102 |
103 | procedure TTextEditorCompletionProposal.ChangeScale(const AMultiplier, ADivider: Integer);
104 | begin
105 | FWidth := MulDiv(FWidth, AMultiplier, ADivider);
106 | end;
107 |
108 | procedure TTextEditorCompletionProposal.SetOption(const AOption: TTextEditorCompletionProposalOption; const AEnabled: Boolean);
109 | begin
110 | if AEnabled then
111 | Include(FOptions, AOption)
112 | else
113 | Exclude(FOptions, AOption);
114 | end;
115 |
116 | function TTextEditorCompletionProposal.GetOwner: TPersistent;
117 | begin
118 | Result := FOwner;
119 | end;
120 |
121 | procedure TTextEditorCompletionProposal.SetSnippets(const AValue: TTextEditorCompletionProposalSnippets);
122 | begin
123 | FSnippets.Assign(AValue);
124 | end;
125 |
126 | end.
127 |
128 |
--------------------------------------------------------------------------------
/Source/TextEditor.Defines.inc:
--------------------------------------------------------------------------------
1 | // Native AlphaSkins support
2 | {.$DEFINE ALPHASKINS}
3 |
4 | // BaseNcoding support
5 | {.$DEFINE BASENCODING}
6 |
7 | // VCL Styles support
8 | {.$DEFINE VCL_STYLES}
9 |
10 | // Some item list range checks
11 | {.$DEFINE TEXT_EDITOR_RANGE_CHECKS}
--------------------------------------------------------------------------------
/Source/TextEditor.Highlighter.Attributes.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Highlighter.Attributes;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Consts;
7 |
8 | type
9 | TTextEditorHighlighterAttribute = class(TPersistent)
10 | strict private
11 | FBackground: TColor;
12 | FElement: string;
13 | FEscapeChar: Char;
14 | FFontStyles: TFontStyles;
15 | FForeground: TColor;
16 | FName: string;
17 | FParentBackground: Boolean;
18 | FParentForeground: Boolean;
19 | public
20 | constructor Create(const AttributeName: string);
21 | procedure Assign(ASource: TPersistent); override;
22 | public
23 | property Background: TColor read FBackground write FBackground default TColors.SysNone;
24 | property Element: string read FElement write FElement;
25 | property EscapeChar: Char read FEscapeChar write FEscapeChar default TControlCharacters.Null;
26 | property FontStyles: TFontStyles read FFontStyles write FFontStyles;
27 | property Foreground: TColor read FForeground write FForeground default TColors.SysNone;
28 | property Name: string read FName write FName;
29 | property ParentBackground: Boolean read FParentBackground write FParentBackground;
30 | property ParentForeground: Boolean read FParentForeground write FParentForeground;
31 | end;
32 |
33 | implementation
34 |
35 | constructor TTextEditorHighlighterAttribute.Create(const AttributeName: string);
36 | begin
37 | inherited Create;
38 |
39 | FBackground := TColors.SysNone;
40 | FForeground := TColors.SysNone;
41 | FName := AttributeName;
42 | FEscapeChar := TControlCharacters.Null;
43 | end;
44 |
45 | procedure TTextEditorHighlighterAttribute.Assign(ASource: TPersistent);
46 | begin
47 | if Assigned(ASource) and (ASource is TTextEditorHighlighterAttribute) then
48 | with ASource as TTextEditorHighlighterAttribute do
49 | begin
50 | Self.FName := FName;
51 | Self.FBackground := FBackground;
52 | Self.FForeground := FForeground;
53 | Self.FFontStyles := FFontStyles;
54 | Self.FParentForeground := ParentForeground;
55 | Self.FParentBackground := ParentBackground;
56 | end
57 | else
58 | inherited Assign(ASource);
59 | end;
60 |
61 | end.
62 |
--------------------------------------------------------------------------------
/Source/TextEditor.Highlighter.Comments.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Highlighter.Comments;
2 |
3 | interface
4 |
5 | uses
6 | TextEditor.Consts, TextEditor.Types;
7 |
8 | type
9 | TTextEditorHighlighterComments = class(TObject)
10 | strict private
11 | FChars: TTextEditorCharSet;
12 | FBlockComments: TTextEditorArrayOfString;
13 | FBlockCommentsFound: Boolean;
14 | FLineComments: TTextEditorArrayOfString;
15 | FLineCommentsFound: Boolean;
16 | procedure AddChars(const AToken: string);
17 | public
18 | destructor Destroy; override;
19 | procedure AddBlockComment(const AOpenToken: string; const ACloseToken: string);
20 | procedure AddLineComment(const AToken: string);
21 | procedure Clear;
22 | property BlockComments: TTextEditorArrayOfString read FBlockComments;
23 | property BlockCommentsFound: Boolean read FBlockCommentsFound;
24 | property Chars: TTextEditorCharSet read FChars write FChars;
25 | property LineComments: TTextEditorArrayOfString read FLineComments;
26 | property LineCommentsFound: Boolean read FLineCommentsFound;
27 | end;
28 |
29 | implementation
30 |
31 | destructor TTextEditorHighlighterComments.Destroy;
32 | begin
33 | Clear;
34 |
35 | inherited Destroy;
36 | end;
37 |
38 | procedure TTextEditorHighlighterComments.AddChars(const AToken: string);
39 | var
40 | LIndex: Integer;
41 | begin
42 | for LIndex := 1 to Length(AToken) do
43 | FChars := FChars + [AToken[LIndex]];
44 | end;
45 |
46 | procedure TTextEditorHighlighterComments.AddBlockComment(const AOpenToken: string; const ACloseToken: string);
47 | var
48 | LIndex, LLength: Integer;
49 | begin
50 | LLength := Length(FBlockComments);
51 | LIndex := 0;
52 |
53 | while LIndex < LLength do
54 | begin
55 | if (FBlockComments[LIndex] = AOpenToken) and (FBlockComments[LIndex + 1] = ACloseToken) then
56 | Exit;
57 |
58 | Inc(LIndex, 2);
59 | end;
60 |
61 | SetLength(FBlockComments, LLength + 2);
62 | FBlockComments[LLength] := AOpenToken;
63 | FBlockComments[LLength + 1] := ACloseToken;
64 |
65 | FBlockCommentsFound := True;
66 |
67 | AddChars(AOpenToken);
68 | AddChars(ACloseToken);
69 | end;
70 |
71 | procedure TTextEditorHighlighterComments.AddLineComment(const AToken: string);
72 | var
73 | LIndex, LLength: Integer;
74 | begin
75 | LLength := Length(FLineComments);
76 |
77 | for LIndex := 0 to LLength - 1 do
78 | if FLineComments[LIndex] = AToken then
79 | Exit;
80 |
81 | SetLength(FLineComments, LLength + 1);
82 | FLineComments[LLength] := AToken;
83 |
84 | FLineCommentsFound := True;
85 |
86 | AddChars(AToken);
87 | end;
88 |
89 | procedure TTextEditorHighlighterComments.Clear;
90 | begin
91 | FBlockCommentsFound := False;
92 | SetLength(FBlockComments, 0);
93 | FLineCommentsFound := False;
94 | SetLength(FLineComments, 0);
95 | FChars := [];
96 | end;
97 |
98 | end.
99 |
--------------------------------------------------------------------------------
/Source/TextEditor.Highlighter.Export.JSON.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Highlighter.Export.JSON;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor, TextEditor.JSONDataObjects;
7 |
8 | type
9 | TTextEditorHighlighterExportJSON = class(TObject)
10 | strict private
11 | FEditor: TCustomTextEditor;
12 | procedure ExportColorTheme(const AThemeObject: TJSONObject);
13 | public
14 | constructor Create(const AEditor: TCustomTextEditor); overload;
15 | procedure SaveThemeToFile(const AFileName: string);
16 | end;
17 |
18 | implementation
19 |
20 | uses
21 | System.SysUtils, System.TypInfo, Vcl.Graphics;
22 |
23 | type
24 | TPropertyArray = array of PPropInfo;
25 |
26 | constructor TTextEditorHighlighterExportJSON.Create(const AEditor: TCustomTextEditor);
27 | begin
28 | inherited Create;
29 |
30 | FEditor := AEditor;
31 | end;
32 |
33 | procedure TTextEditorHighlighterExportJSON.SaveThemeToFile(const AFileName: string);
34 | const
35 | THEME_FILE_FORMAT = '{ "Theme": { "Colors": {}, "Fonts": {}, "FontSizes": {}, "Styles": [] } }';
36 | var
37 | LJSONObject: TJSONObject;
38 | LStringList: TStringList;
39 | begin
40 | LJSONObject := TJSONObject.Parse(THEME_FILE_FORMAT) as TJSONObject;
41 | try
42 | ExportColorTheme(LJSONObject['Theme']);
43 |
44 | LStringList := TStringList.Create;
45 | try
46 | LStringList.Text := LJSONObject.ToJSON(False);
47 | LStringList.SaveToFile(AFileName);
48 | finally
49 | LStringList.Free;
50 | end;
51 | finally
52 | LJSONObject.Free;
53 | end;
54 | end;
55 |
56 | function IntegerAsString(const ATypeInfo: PTypeInfo; const AValue: Integer): string;
57 | var
58 | LIdent: string;
59 | LIntToIdent: TIntToIdent;
60 | begin
61 | LIntToIdent := FindIntToIdent(ATypeInfo);
62 |
63 | if Assigned(LIntToIdent) and LIntToIdent(AValue, LIdent) then
64 | Result := LIdent
65 | else
66 | Result := '$' + IntToHex(AValue, SizeOf(Integer) * 2);
67 | end;
68 |
69 | function SetAsString(const ATypeInfo: PTypeInfo; const AValue: Integer): string;
70 | var
71 | LIndex: Integer;
72 | LBaseType: PTypeInfo;
73 | begin
74 | Result := '';
75 |
76 | LBaseType := GetTypeData(ATypeInfo)^.CompType^;
77 |
78 | for LIndex := 0 to SizeOf(TIntegerSet) * 8 - 1 do
79 | if LIndex in TIntegerSet(AValue) then
80 | begin
81 | if not Result.IsEmpty then
82 | Result := Result + ';';
83 |
84 | Result := Result + Copy(GetEnumName(LBaseType, LIndex), 3);
85 | end;
86 | end;
87 |
88 | procedure TTextEditorHighlighterExportJSON.ExportColorTheme(const AThemeObject: TJSONObject);
89 | var
90 | LIndex: Integer;
91 | LJSONArray: TJSONArray;
92 | LJSONObject, LJSONObject2: TJSONObject;
93 | LPPropInfo: PPropInfo;
94 | LPropertyArray: TPropertyArray;
95 | LPropertyCount: Integer;
96 | LObject: TObject;
97 | LStyle: string;
98 |
99 | procedure GetPropertyArray(const APTypeInfo: PTypeInfo);
100 | begin
101 | LPropertyCount := GetPropList(APTypeInfo, tkProperties, nil);
102 | SetLength(LPropertyArray, LPropertyCount);
103 | GetPropList(APTypeInfo, tkProperties, PPropList(LPropertyArray));
104 | end;
105 |
106 | procedure ClearPropertyArray;
107 | begin
108 | SetLength(LPropertyArray, 0);
109 | end;
110 |
111 | begin
112 | { Colors }
113 | LJSONObject := AThemeObject['Colors'].ObjectValue;
114 |
115 | GetPropertyArray(FEditor.Colors.ClassInfo);
116 | try
117 | for LIndex := 0 to LPropertyCount - 1 do
118 | begin
119 | LPPropInfo := LPropertyArray[LIndex];
120 | LJSONObject[string(LPPropInfo.Name)] := IntegerAsString(LPPropInfo^.PropType^, GetOrdProp(FEditor.Colors, LPPropInfo));
121 | end;
122 | finally
123 | ClearPropertyArray;
124 | end;
125 | { Fonts and font sizes }
126 | LJSONObject := AThemeObject['Fonts'].ObjectValue;
127 | LJSONObject2 := AThemeObject['FontSizes'].ObjectValue;
128 |
129 | GetPropertyArray(FEditor.Fonts.ClassInfo);
130 | try
131 | for LIndex := 0 to LPropertyCount - 1 do
132 | begin
133 | LPPropInfo := LPropertyArray[LIndex];
134 |
135 | LObject := GetObjectProp(FEditor.Fonts, LPPropInfo);
136 |
137 | LJSONObject[string(LPPropInfo.Name)] := TFont(LObject).Name;
138 | LJSONObject2[string(LPPropInfo.Name)] := TFont(LObject).Size.ToString;
139 | end;
140 | finally
141 | ClearPropertyArray;
142 | end;
143 | { Styles }
144 | LJSONArray := AThemeObject.ValueArray['Styles'];
145 |
146 | GetPropertyArray(FEditor.FontStyles.ClassInfo);
147 | try
148 | for LIndex := 0 to LPropertyCount - 1 do
149 | begin
150 | LPPropInfo := LPropertyArray[LIndex];
151 |
152 | LStyle := SetAsString(LPPropInfo^.PropType^, GetOrdProp(FEditor.FontStyles, LPPropInfo));
153 |
154 | if not LStyle.IsEmpty then
155 | begin
156 | LJSONObject := LJSONArray.AddObject;
157 | LJSONObject['Name'] := string(LPPropInfo.Name);
158 | LJSONObject['Style'] := LStyle;
159 | end;
160 | end;
161 | finally
162 | ClearPropertyArray;
163 | end;
164 | end;
165 |
166 | end.
167 |
--------------------------------------------------------------------------------
/Source/TextEditor.Highlighter.Info.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Highlighter.Info;
2 |
3 | interface
4 |
5 | type
6 | TTextEditorAuthorInfo = record
7 | Name: string;
8 | Email: string;
9 | Comments: string;
10 | end;
11 |
12 | TTextEditorGeneralInfo = record
13 | Version: string;
14 | Date: string;
15 | Sample: string;
16 | end;
17 |
18 | TTextEditorHighlighterInfo = class
19 | public
20 | Author: TTextEditorAuthorInfo;
21 | General: TTextEditorGeneralInfo;
22 | procedure Clear;
23 | end;
24 |
25 | implementation
26 |
27 | procedure TTextEditorHighlighterInfo.Clear;
28 | begin
29 | General.Version := '';
30 | General.Date := '';
31 | General.Sample := '';
32 | Author.Name := '';
33 | Author.Email := '';
34 | Author.Comments := '';
35 | end;
36 |
37 | end.
--------------------------------------------------------------------------------
/Source/TextEditor.Language.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Language;
2 |
3 | {$I TextEditor.Defines.inc}
4 |
5 | interface
6 |
7 | resourcestring
8 | { TextEditor }
9 | STextEditorCannotOpenClipboard = 'Cannot open clipboard:';
10 | STextEditorHighlighterLoadFromFile = 'Load highlighter from file';
11 | STextEditorOutOfResources = 'Out of system resources';
12 | STextEditorRightMarginPosition = 'Position: %d';
13 | STextEditorScrollInfo = '%d - %d';
14 | STextEditorScrollInfoTopLine = 'Top line: %d';
15 | STextEditorSearchEngineNotAssigned = 'Search engine has not been assigned';
16 | STextEditorSearchMatchNotFound = 'Search match not found.%sRestart search from the beginning of the file?';
17 | STextEditorSearchStringNotFound = 'Search string ''%s'' not found';
18 | STextEditorThemeLoadFromFile = 'Load theme from file';
19 | STextEditorThemeSaveToFile = 'Save theme to file';
20 | { TextEditor.CompletionProposal }
21 | STextEditorKeyword = 'Keyword';
22 | STextEditorSnippet = 'Snippet';
23 | STextEditorText = 'Text';
24 | { TextEditor.CompletionProposal.Snippet }
25 | STextEditorCompletionProposalSnippetItemUnnamed = '(unnamed)';
26 | { TextEditor.HighlightLine }
27 | STextEditorHighlightLineItemUnnamed = '(unnamed)';
28 | { TextEditor.KeyCommands }
29 | STextEditorDuplicateShortcut = 'Shortcut already exists';
30 | { TextEditor.MacroRecorder }
31 | STextEditorCannotPause = 'Can only pause when recording';
32 | STextEditorCannotPlay = 'Cannot playback macro; already playing or recording';
33 | STextEditorCannotRecord = 'Cannot record macro; already recording or playing';
34 | STextEditorCannotResume = 'Can only resume when paused';
35 | STextEditorMacroNameUnnamed = 'unnamed';
36 | STextEditorShortcutAlreadyExists = 'Shortcut already exists';
37 | { TextEditor.Lines }
38 | {$IFDEF TEXTEDITOR_RANGE_CHECKS}
39 | STextEditorListIndexOutOfBounds = 'Invalid list index %d';
40 | {$ENDIF}
41 | STextEditorInvalidCapacity = 'List capacity cannot be smaller than count';
42 | { TextEditor.Highlighter.Import.JSON }
43 | STextEditorErrorInHighlighterImport = 'Error in highlighter import: %s';
44 | STextEditorErrorInHighlighterParse = 'JSON parse error on line %d column %d: %s';
45 | { TextEditor.Search }
46 | STextEditorPatternIsEmpty = 'Pattern is empty';
47 | { TextEditor.PaintHelper }
48 | STextEditorValueMustBeSpecified = 'SetBaseFont: ''Value'' must be specified.';
49 | {$IFDEF TEXT_EDITOR_SPELL_CHECK}
50 | { Spell check }
51 | STextEditorContainsInvalidChars = 'Invalid word: ''%s'' contains characters that cannot be represented in the loaded dictionary''s codepage';
52 | STextEditorHunspellHandleNeeded = 'Operation requires a dictionary to be loaded first';
53 | STextEditorSpellCheckEngineCantInitialize = 'Can''t initialize spell check engine.';
54 | STextEditorSpellCheckEngineCantLoadLibrary = 'Can''t load spell check dynamic link library (DLL).' + sLineBreak + sLineBreak +
55 | 'Check the DLL version - 32-bit application can''t work with 64-bit version and vice versa.';
56 | {$ENDIF}
57 | { JSON parser }
58 | STextEditorInvalidJSONPath = 'Invalid JSON path "%s"';
59 | STextEditorJSONPathContainsNullValue = 'JSON path contains null value ("%s")';
60 | STextEditorJSONPathIndexError = 'JSON path index out of bounds (%d) "%s"';
61 | STextEditorTypeCastError = 'Cannot cast %s into %s';
62 | STextEditorUnsupportedFileEncoding = 'File encoding is not supported';
63 | { Bookmark colors }
64 | STextEditorBookmarkBlue = 'Blue';
65 | STextEditorBookmarkGreen = 'Green';
66 | STextEditorBookmarkPurple = 'Purple';
67 | STextEditorBookmarkRed = 'Red';
68 | STextEditorBookmarkYellow = 'Yellow';
69 |
70 | implementation
71 |
72 | end.
73 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.Bookmarks.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.Bookmarks;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, Vcl.ImgList;
7 |
8 | type
9 | TTextEditorLeftMarginBookmarks = class(TPersistent)
10 | strict private
11 | FImages: TCustomImageList;
12 | FLeftMargin: Integer;
13 | FOnChange: TNotifyEvent;
14 | FOwner: TComponent;
15 | FScaled: Boolean;
16 | FShortCuts: Boolean;
17 | FVisible: Boolean;
18 | procedure DoChange;
19 | procedure SetImages(const AValue: TCustomImageList);
20 | procedure SetVisible(const AValue: Boolean);
21 | public
22 | constructor Create(AOwner: TComponent);
23 | procedure Assign(ASource: TPersistent); override;
24 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
25 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
26 | published
27 | property Images: TCustomImageList read FImages write SetImages;
28 | property LeftMargin: Integer read FLeftMargin write FLeftMargin default 2;
29 | property Scaled: Boolean read FScaled write FScaled default True;
30 | property ShortCuts: Boolean read FShortCuts write FShortCuts default True;
31 | property Visible: Boolean read FVisible write SetVisible default True;
32 | end;
33 |
34 | implementation
35 |
36 | uses
37 | Winapi.Windows;
38 |
39 | constructor TTextEditorLeftMarginBookmarks.Create(AOwner: TComponent);
40 | begin
41 | inherited Create;
42 |
43 | FOwner := AOwner;
44 | FLeftMargin := 2;
45 | FScaled := True;
46 | FShortCuts := True;
47 | FVisible := True;
48 | end;
49 |
50 | procedure TTextEditorLeftMarginBookmarks.Assign(ASource: TPersistent);
51 | begin
52 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginBookmarks) then
53 | with ASource as TTextEditorLeftMarginBookmarks do
54 | begin
55 | Self.FImages := FImages;
56 | Self.FLeftMargin := FLeftMargin;
57 | Self.FShortCuts := FShortCuts;
58 | Self.FVisible := FVisible;
59 |
60 | if Assigned(Self.FOnChange) then
61 | Self.FOnChange(Self);
62 | end
63 | else
64 | inherited Assign(ASource);
65 | end;
66 |
67 | procedure TTextEditorLeftMarginBookmarks.ChangeScale(const AMultiplier, ADivider: Integer);
68 | var
69 | LNumerator: Integer;
70 | begin
71 | LNumerator := (AMultiplier div ADivider) * ADivider;
72 | FLeftMargin := MulDiv(FLeftMargin, LNumerator, ADivider);
73 | end;
74 |
75 | procedure TTextEditorLeftMarginBookmarks.DoChange;
76 | begin
77 | if Assigned(FOnChange) then
78 | FOnChange(Self);
79 | end;
80 |
81 | procedure TTextEditorLeftMarginBookmarks.SetImages(const AValue: TCustomImageList);
82 | begin
83 | if FImages <> AValue then
84 | begin
85 | FImages := AValue;
86 |
87 | if Assigned(FImages) then
88 | FImages.FreeNotification(FOwner);
89 |
90 | DoChange;
91 | end;
92 | end;
93 |
94 | procedure TTextEditorLeftMarginBookmarks.SetVisible(const AValue: Boolean);
95 | begin
96 | if FVisible <> AValue then
97 | begin
98 | FVisible := AValue;
99 |
100 | DoChange;
101 | end;
102 | end;
103 |
104 | end.
105 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.Border.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.Border;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorLeftMarginBorder = class(TPersistent)
10 | strict private
11 | FOnChange: TNotifyEvent;
12 | FStyle: TTextEditorLeftMarginBorderStyle;
13 | procedure DoChange;
14 | procedure SetStyle(const AValue: TTextEditorLeftMarginBorderStyle);
15 | public
16 | constructor Create;
17 | procedure Assign(ASource: TPersistent); override;
18 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
19 | published
20 | property Style: TTextEditorLeftMarginBorderStyle read FStyle write SetStyle default mbsNone;
21 | end;
22 |
23 | implementation
24 |
25 | constructor TTextEditorLeftMarginBorder.Create;
26 | begin
27 | inherited;
28 |
29 | FStyle := mbsNone;
30 | end;
31 |
32 | procedure TTextEditorLeftMarginBorder.DoChange;
33 | begin
34 | if Assigned(FOnChange) then
35 | FOnChange(Self);
36 | end;
37 |
38 | procedure TTextEditorLeftMarginBorder.Assign(ASource: TPersistent);
39 | begin
40 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginBorder) then
41 | with ASource as TTextEditorLeftMarginBorder do
42 | begin
43 | Self.FStyle := FStyle;
44 |
45 | Self.DoChange;
46 | end
47 | else
48 | inherited Assign(ASource);
49 | end;
50 |
51 | procedure TTextEditorLeftMarginBorder.SetStyle(const AValue: TTextEditorLeftMarginBorderStyle);
52 | begin
53 | FStyle := AValue;
54 |
55 | DoChange
56 | end;
57 |
58 | end.
59 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.LineNumbers.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.LineNumbers;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorLeftMarginLineNumbers = class(TPersistent)
10 | strict private
11 | FAutosizeDigitCount: Integer;
12 | FDigitCount: Integer;
13 | FOnChange: TNotifyEvent;
14 | FOptions: TTextEditorLeftMarginLineNumberOptions;
15 | FStartFrom: Integer;
16 | FVisible: Boolean;
17 | procedure DoChange;
18 | procedure SetDigitCount(const AValue: Integer);
19 | procedure SetOptions(const AValue: TTextEditorLeftMarginLineNumberOptions);
20 | procedure SetStartFrom(const AValue: Integer);
21 | procedure SetVisible(const AValue: Boolean);
22 | public
23 | constructor Create;
24 | procedure Assign(ASource: TPersistent); override;
25 | procedure SetOption(const AOption: TTextEditorLeftMarginLineNumberOption; const AEnabled: Boolean);
26 | property AutosizeDigitCount: Integer read FAutosizeDigitCount write FAutosizeDigitCount;
27 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
28 | published
29 | property DigitCount: Integer read FDigitCount write SetDigitCount default 4;
30 | property Options: TTextEditorLeftMarginLineNumberOptions read FOptions write SetOptions default [lnoIntens];
31 | property StartFrom: Integer read FStartFrom write SetStartFrom default 1;
32 | property Visible: Boolean read FVisible write SetVisible default True;
33 | end;
34 |
35 | implementation
36 |
37 | uses
38 | System.Math;
39 |
40 | constructor TTextEditorLeftMarginLineNumbers.Create;
41 | begin
42 | inherited;
43 |
44 | FAutosizeDigitCount := 4;
45 | FDigitCount := 4;
46 | FOptions := [lnoIntens];
47 | FStartFrom := 1;
48 | FVisible := True;
49 | end;
50 |
51 | procedure TTextEditorLeftMarginLineNumbers.Assign(ASource: TPersistent);
52 | begin
53 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginLineNumbers) then
54 | with ASource as TTextEditorLeftMarginLineNumbers do
55 | begin
56 | Self.FAutosizeDigitCount := FAutosizeDigitCount;
57 | Self.FDigitCount := FDigitCount;
58 | Self.FOptions := FOptions;
59 | Self.FStartFrom := FStartFrom;
60 | Self.FVisible := FVisible;
61 |
62 | Self.DoChange;
63 | end
64 | else
65 | inherited Assign(ASource);
66 | end;
67 |
68 | procedure TTextEditorLeftMarginLineNumbers.DoChange;
69 | begin
70 | if Assigned(FOnChange) then
71 | FOnChange(Self);
72 | end;
73 |
74 | procedure TTextEditorLeftMarginLineNumbers.SetOption(const AOption: TTextEditorLeftMarginLineNumberOption; const AEnabled: Boolean);
75 | begin
76 | if AEnabled then
77 | Include(FOptions, AOption)
78 | else
79 | Exclude(FOptions, AOption);
80 | end;
81 |
82 | procedure TTextEditorLeftMarginLineNumbers.SetDigitCount(const AValue: Integer);
83 | var
84 | LValue: Integer;
85 | begin
86 | LValue := EnsureRange(AValue, 2, 12);
87 |
88 | if FDigitCount <> LValue then
89 | begin
90 | FDigitCount := LValue;
91 | FAutosizeDigitCount := FDigitCount;
92 |
93 | DoChange
94 | end;
95 | end;
96 |
97 | procedure TTextEditorLeftMarginLineNumbers.SetOptions(const AValue: TTextEditorLeftMarginLineNumberOptions);
98 | begin
99 | if FOptions <> AValue then
100 | begin
101 | FOptions := AValue;
102 |
103 | DoChange
104 | end;
105 | end;
106 |
107 | procedure TTextEditorLeftMarginLineNumbers.SetStartFrom(const AValue: Integer);
108 | begin
109 | if FStartFrom <> AValue then
110 | begin
111 | FStartFrom := AValue;
112 |
113 | if FStartFrom < 0 then
114 | FStartFrom := 0;
115 |
116 | DoChange
117 | end;
118 | end;
119 |
120 | procedure TTextEditorLeftMarginLineNumbers.SetVisible(const AValue: Boolean);
121 | begin
122 | if FVisible <> AValue then
123 | begin
124 | FVisible := AValue;
125 |
126 | DoChange
127 | end;
128 | end;
129 |
130 | end.
131 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.LineState.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.LineState;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorLeftMarginLineState = class(TPersistent)
10 | strict private
11 | FAlign: TTextEditorLeftMarginLineStateAlign;
12 | FOffset: Integer;
13 | FOnChange: TNotifyEvent;
14 | FShowOnlyModified: Boolean;
15 | FVisible: Boolean;
16 | FWidth: Integer;
17 | procedure DoChange;
18 | procedure SetOnChange(const AValue: TNotifyEvent);
19 | procedure SetVisible(const AValue: Boolean);
20 | procedure SetWidth(const AValue: Integer);
21 | public
22 | constructor Create;
23 | procedure Assign(ASource: TPersistent); override;
24 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
25 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
26 | published
27 | property Align: TTextEditorLeftMarginLineStateAlign read FAlign write FAlign default lsLeft;
28 | property Offset: Integer read FOffset write FOffset default 0;
29 | property ShowOnlyModified: Boolean read FShowOnlyModified write FShowOnlyModified default True;
30 | property Visible: Boolean read FVisible write SetVisible default True;
31 | property Width: Integer read FWidth write SetWidth default 2;
32 | end;
33 |
34 | implementation
35 |
36 | uses
37 | Winapi.Windows;
38 |
39 | constructor TTextEditorLeftMarginLineState.Create;
40 | begin
41 | inherited;
42 |
43 | FAlign := lsLeft;
44 | FOffset := 0;
45 | FShowOnlyModified := True;
46 | FVisible := True;
47 | FWidth := 2;
48 | end;
49 |
50 | procedure TTextEditorLeftMarginLineState.Assign(ASource: TPersistent);
51 | begin
52 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginLineState) then
53 | with ASource as TTextEditorLeftMarginLineState do
54 | begin
55 | Self.FAlign := FAlign;
56 | Self.FOffset := FOffset;
57 | Self.FShowOnlyModified := FShowOnlyModified;
58 | Self.FVisible := FVisible;
59 | Self.FWidth := FWidth;
60 |
61 | Self.DoChange;
62 | end
63 | else
64 | inherited Assign(ASource);
65 | end;
66 |
67 | procedure TTextEditorLeftMarginLineState.ChangeScale(const AMultiplier, ADivider: Integer);
68 | begin
69 | FOffset := MulDiv(FOffset, AMultiplier, ADivider);
70 | FWidth := MulDiv(FWidth, AMultiplier, ADivider);
71 | end;
72 |
73 | procedure TTextEditorLeftMarginLineState.SetOnChange(const AValue: TNotifyEvent);
74 | begin
75 | FOnChange := AValue;
76 | end;
77 |
78 | procedure TTextEditorLeftMarginLineState.DoChange;
79 | begin
80 | if Assigned(FOnChange) then
81 | FOnChange(Self);
82 | end;
83 |
84 | procedure TTextEditorLeftMarginLineState.SetVisible(const AValue: Boolean);
85 | begin
86 | if FVisible <> AValue then
87 | begin
88 | FVisible := AValue;
89 |
90 | DoChange
91 | end;
92 | end;
93 |
94 | procedure TTextEditorLeftMarginLineState.SetWidth(const AValue: Integer);
95 | begin
96 | if FWidth <> AValue then
97 | begin
98 | FWidth := AValue;
99 |
100 | DoChange
101 | end;
102 | end;
103 |
104 | end.
105 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.Marks.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.Marks;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, Vcl.ImgList;
7 |
8 | type
9 | TTextEditorLeftMarginMarks = class(TPersistent)
10 | strict private
11 | FDefaultImageIndex: Integer;
12 | FImages: TCustomImageList;
13 | FLeftMargin: Integer;
14 | FOnChange: TNotifyEvent;
15 | FOverlappingOffset: Integer;
16 | FOwner: TComponent;
17 | FShortCuts: Boolean;
18 | FVisible: Boolean;
19 | procedure DoChange;
20 | procedure SetImages(const AValue: TCustomImageList);
21 | procedure SetVisible(const AValue: Boolean);
22 | public
23 | constructor Create(AOwner: TComponent);
24 | procedure Assign(ASource: TPersistent); override;
25 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
26 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
27 | published
28 | property DefaultImageIndex: Integer read FDefaultImageIndex write FDefaultImageIndex default -1;
29 | property Images: TCustomImageList read FImages write SetImages;
30 | property LeftMargin: Integer read FLeftMargin write FLeftMargin default 2;
31 | property OverlappingOffset: Integer read FOverlappingOffset write FOverlappingOffset default 4;
32 | property Visible: Boolean read FVisible write SetVisible default True;
33 | end;
34 |
35 | implementation
36 |
37 | uses
38 | Winapi.Windows;
39 |
40 | constructor TTextEditorLeftMarginMarks.Create(AOwner: TComponent);
41 | begin
42 | inherited Create;
43 |
44 | FOwner := AOwner;
45 | FDefaultImageIndex := -1;
46 | FLeftMargin := 2;
47 | FOverlappingOffset := 4;
48 | FShortCuts := True;
49 | FVisible := True;
50 | end;
51 |
52 | procedure TTextEditorLeftMarginMarks.Assign(ASource: TPersistent);
53 | begin
54 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginMarks) then
55 | with ASource as TTextEditorLeftMarginMarks do
56 | begin
57 | Self.FDefaultImageIndex := FDefaultImageIndex;
58 | Self.FImages := FImages;
59 | Self.FLeftMargin := FLeftMargin;
60 | Self.FOverlappingOffset := FOverlappingOffset;
61 | Self.FShortCuts := FShortCuts;
62 | Self.FVisible := FVisible;
63 |
64 | if Assigned(Self.FOnChange) then
65 | Self.FOnChange(Self);
66 | end
67 | else
68 | inherited Assign(ASource);
69 | end;
70 |
71 | procedure TTextEditorLeftMarginMarks.ChangeScale(const AMultiplier, ADivider: Integer);
72 | var
73 | LNumerator: Integer;
74 | begin
75 | LNumerator := (AMultiplier div ADivider) * ADivider;
76 | FLeftMargin := MulDiv(FLeftMargin, LNumerator, ADivider);
77 | FOverlappingOffset := MulDiv(FOverlappingOffset, LNumerator, ADivider);
78 | end;
79 |
80 | procedure TTextEditorLeftMarginMarks.DoChange;
81 | begin
82 | if Assigned(FOnChange) then
83 | FOnChange(Self);
84 | end;
85 |
86 | procedure TTextEditorLeftMarginMarks.SetImages(const AValue: TCustomImageList);
87 | begin
88 | if FImages <> AValue then
89 | begin
90 | FImages := AValue;
91 |
92 | if Assigned(FImages) then
93 | FImages.FreeNotification(FOwner);
94 |
95 | DoChange;
96 | end;
97 | end;
98 |
99 | procedure TTextEditorLeftMarginMarks.SetVisible(const AValue: Boolean);
100 | begin
101 | if FVisible <> AValue then
102 | begin
103 | FVisible := AValue;
104 |
105 | DoChange;
106 | end;
107 | end;
108 |
109 | end.
110 |
--------------------------------------------------------------------------------
/Source/TextEditor.LeftMargin.MarksPanel.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.LeftMargin.MarksPanel;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorLeftMarginMarksPanel = class(TPersistent)
10 | strict private
11 | FOnChange: TNotifyEvent;
12 | FOptions: TTextEditorLeftMarginBookmarkPanelOptions;
13 | FVisible: Boolean;
14 | FWidth: Integer;
15 | procedure DoChange;
16 | procedure SetWidth(const AValue: Integer);
17 | procedure SetVisible(const AValue: Boolean);
18 | public
19 | constructor Create;
20 | procedure Assign(ASource: TPersistent); override;
21 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
22 | procedure SetOption(const AOption: TTextEditorLeftMarginBookmarkPanelOption; const AEnabled: Boolean);
23 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
24 | published
25 | property Options: TTextEditorLeftMarginBookmarkPanelOptions read FOptions write FOptions default [bpoToggleBookmarkByClick];
26 | property Visible: Boolean read FVisible write SetVisible default True;
27 | property Width: Integer read FWidth write SetWidth default 20;
28 | end;
29 |
30 | implementation
31 |
32 | uses
33 | Winapi.Windows, System.Math;
34 |
35 | constructor TTextEditorLeftMarginMarksPanel.Create;
36 | begin
37 | inherited;
38 |
39 | FWidth := 20;
40 | FOptions := [bpoToggleBookmarkByClick];
41 | FVisible := True;
42 | end;
43 |
44 | procedure TTextEditorLeftMarginMarksPanel.Assign(ASource: TPersistent);
45 | begin
46 | if Assigned(ASource) and (ASource is TTextEditorLeftMarginMarksPanel) then
47 | with ASource as TTextEditorLeftMarginMarksPanel do
48 | begin
49 | Self.FVisible := FVisible;
50 | Self.FWidth := FWidth;
51 |
52 | if Assigned(Self.FOnChange) then
53 | Self.FOnChange(Self);
54 | end
55 | else
56 | inherited Assign(ASource);
57 | end;
58 |
59 | procedure TTextEditorLeftMarginMarksPanel.ChangeScale(const AMultiplier, ADivider: Integer);
60 | begin
61 | FWidth := MulDiv(FWidth, AMultiplier, ADivider);
62 | end;
63 |
64 | procedure TTextEditorLeftMarginMarksPanel.DoChange;
65 | begin
66 | if Assigned(FOnChange) then
67 | FOnChange(Self);
68 | end;
69 |
70 | procedure TTextEditorLeftMarginMarksPanel.SetWidth(const AValue: Integer);
71 | var
72 | LValue: Integer;
73 | begin
74 | LValue := Max(0, AValue);
75 |
76 | if FWidth <> LValue then
77 | begin
78 | FWidth := LValue;
79 |
80 | DoChange
81 | end;
82 | end;
83 |
84 | procedure TTextEditorLeftMarginMarksPanel.SetVisible(const AValue: Boolean);
85 | begin
86 | if FVisible <> AValue then
87 | begin
88 | FVisible := AValue;
89 |
90 | DoChange
91 | end;
92 | end;
93 |
94 | procedure TTextEditorLeftMarginMarksPanel.SetOption(const AOption: TTextEditorLeftMarginBookmarkPanelOption; const AEnabled: Boolean);
95 | begin
96 | if AEnabled then
97 | Include(FOptions, AOption)
98 | else
99 | Exclude(FOptions, AOption);
100 | end;
101 |
102 | end.
103 |
--------------------------------------------------------------------------------
/Source/TextEditor.Marks.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Marks;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.Contnrs, System.UITypes, Vcl.Controls;
7 |
8 | type
9 | TTextEditorMark = class
10 | protected
11 | FBackground: TColor;
12 | FChar: Integer;
13 | FData: Pointer;
14 | FEditor: TCustomControl;
15 | FImageIndex: Integer;
16 | FIndex: Integer;
17 | FLine: Integer;
18 | FVisible: Boolean;
19 | public
20 | constructor Create(AOwner: TCustomControl);
21 | property Background: TColor read FBackground write FBackground default TColors.SysNone;
22 | property Char: Integer read FChar write FChar;
23 | property Data: Pointer read FData write FData;
24 | property ImageIndex: Integer read FImageIndex write FImageIndex;
25 | property &Index: Integer read FIndex write FIndex;
26 | property Line: Integer read FLine write FLine;
27 | property Visible: Boolean read FVisible write FVisible;
28 | end;
29 |
30 | TTextEditorMarkEvent = procedure(ASender: TObject; var AMark: TTextEditorMark) of object;
31 | TTextEditorMarks = array of TTextEditorMark;
32 |
33 | TListItemIndex = {$IF CompilerVersion >= 36}NativeInt{$ELSE}Integer{$IFEND};
34 |
35 | TTextEditorMarkList = class(TObjectList)
36 | protected
37 | FEditor: TCustomControl;
38 | FOnChange: TNotifyEvent;
39 | function GetItem(const AIndex: TListItemIndex): TTextEditorMark;
40 | procedure Notify(Ptr: Pointer; Action: TListNotification); override;
41 | procedure SetItem(const AIndex: TListItemIndex; AItem: TTextEditorMark);
42 | property OwnsObjects;
43 | public
44 | constructor Create(AOwner: TCustomControl);
45 | function Extract(AItem: TTextEditorMark): TTextEditorMark;
46 | function Find(const AIndex: Integer): TTextEditorMark;
47 | function First: TTextEditorMark;
48 | function Last: TTextEditorMark;
49 | procedure ClearLine(const ALine: Integer);
50 | procedure GetMarksForLine(const ALine: Integer; var AMarks: TTextEditorMarks);
51 | procedure Place(AMark: TTextEditorMark);
52 | property Items[const AIndex: TListItemIndex]: TTextEditorMark read GetItem write SetItem; default;
53 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
54 | end;
55 |
56 | implementation
57 |
58 | uses
59 | System.Types, TextEditor;
60 |
61 | constructor TTextEditorMark.Create(AOwner: TCustomControl);
62 | begin
63 | inherited Create;
64 |
65 | FBackground := TColors.SysNone;
66 | FIndex := -1;
67 | FEditor := AOwner;
68 | end;
69 |
70 | { TTextEditorBookmarkList }
71 |
72 | procedure TTextEditorMarkList.Notify(Ptr: Pointer; Action: TListNotification);
73 | begin
74 | inherited;
75 |
76 | if Assigned(FOnChange) then
77 | FOnChange(Self);
78 | end;
79 |
80 | function TTextEditorMarkList.GetItem(const AIndex: TListItemIndex): TTextEditorMark;
81 | begin
82 | Result := TTextEditorMark(inherited GetItem(AIndex));
83 | end;
84 |
85 | procedure TTextEditorMarkList.SetItem(const AIndex:TListItemIndex; AItem: TTextEditorMark);
86 | begin
87 | inherited SetItem(AIndex, AItem);
88 | end;
89 |
90 | constructor TTextEditorMarkList.Create(AOwner: TCustomControl);
91 | begin
92 | inherited Create;
93 |
94 | FEditor := AOwner;
95 | end;
96 |
97 | function TTextEditorMarkList.Find(const AIndex: Integer): TTextEditorMark;
98 | var
99 | LIndex: Integer;
100 | LMark: TTextEditorMark;
101 | begin
102 | Result := nil;
103 |
104 | for LIndex := Count - 1 downto 0 do
105 | begin
106 | LMark := Items[LIndex];
107 |
108 | if LMark.Index = AIndex then
109 | Exit(LMark);
110 | end;
111 | end;
112 |
113 | function TTextEditorMarkList.First: TTextEditorMark;
114 | begin
115 | Result := TTextEditorMark(inherited First);
116 | end;
117 |
118 | function TTextEditorMarkList.Last: TTextEditorMark;
119 | begin
120 | Result := TTextEditorMark(inherited Last);
121 | end;
122 |
123 | function TTextEditorMarkList.Extract(AItem: TTextEditorMark): TTextEditorMark;
124 | begin
125 | Result := TTextEditorMark(inherited Extract(AItem));
126 | end;
127 |
128 | procedure TTextEditorMarkList.ClearLine(const ALine: Integer);
129 | var
130 | LIndex: Integer;
131 | begin
132 | for LIndex := Count - 1 downto 0 do
133 | if Items[LIndex].Line = ALine then
134 | Delete(LIndex);
135 | end;
136 |
137 | procedure TTextEditorMarkList.GetMarksForLine(const ALine: Integer; var AMarks: TTextEditorMarks);
138 | var
139 | LIndex, LIndex2: Integer;
140 | LMark: TTextEditorMark;
141 | begin
142 | SetLength(AMarks, Count);
143 | LIndex2 := 0;
144 |
145 | for LIndex := 0 to Count - 1 do
146 | begin
147 | LMark := Items[LIndex];
148 |
149 | if LMark.Line = ALine then
150 | begin
151 | AMarks[LIndex2] := LMark;
152 | Inc(LIndex2);
153 | end;
154 | end;
155 |
156 | SetLength(AMarks, LIndex2);
157 | end;
158 |
159 | procedure TTextEditorMarkList.Place(AMark: TTextEditorMark);
160 | var
161 | LEditor: TCustomTextEditor;
162 | begin
163 | LEditor := nil;
164 |
165 | if Assigned(FEditor) and (FEditor is TCustomTextEditor) then
166 | LEditor := FEditor as TCustomTextEditor;
167 |
168 | if Assigned(LEditor) then
169 | if Assigned(LEditor.OnBeforeMarkPlaced) then
170 | LEditor.OnBeforeMarkPlaced(FEditor, AMark);
171 |
172 | if Assigned(AMark) then
173 | Add(AMark);
174 |
175 | if Assigned(LEditor) then
176 | if Assigned(LEditor.OnAfterMarkPlaced) then
177 | LEditor.OnAfterMarkPlaced(FEditor);
178 | end;
179 |
180 | end.
181 |
--------------------------------------------------------------------------------
/Source/TextEditor.MatchingPairs.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.MatchingPairs;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorMatchingPairs = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FAutoComplete: Boolean;
13 | FOptions: TTextEditorMatchingPairOptions;
14 | public
15 | constructor Create;
16 | procedure Assign(ASource: TPersistent); override;
17 | procedure SetOption(const AOption: TTextEditorMatchingPairOption; const AEnabled: Boolean);
18 | published
19 | property Active: Boolean read FActive write FActive default True;
20 | property AutoComplete: Boolean read FAutoComplete write FAutoComplete default False;
21 | property Options: TTextEditorMatchingPairOptions read FOptions write FOptions default [mpoUseMatchedColor];
22 | end;
23 |
24 | implementation
25 |
26 | constructor TTextEditorMatchingPairs.Create;
27 | begin
28 | inherited;
29 |
30 | FAutoComplete := False;
31 | FActive := True;
32 | FOptions := [mpoUseMatchedColor];
33 | end;
34 |
35 | procedure TTextEditorMatchingPairs.Assign(ASource: TPersistent);
36 | begin
37 | if Assigned(ASource) and (ASource is TTextEditorMatchingPairs) then
38 | with ASource as TTextEditorMatchingPairs do
39 | begin
40 | Self.FActive := FActive;
41 | Self.FAutoComplete := FAutoComplete;
42 | end
43 | else
44 | inherited Assign(ASource);
45 | end;
46 |
47 | procedure TTextEditorMatchingPairs.SetOption(const AOption: TTextEditorMatchingPairOption; const AEnabled: Boolean);
48 | begin
49 | if AEnabled then
50 | Include(FOptions, AOption)
51 | else
52 | Exclude(FOptions, AOption);
53 | end;
54 |
55 | end.
56 |
--------------------------------------------------------------------------------
/Source/TextEditor.Minimap.Indicator.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Minimap.Indicator;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorMinimapIndicator = class(TPersistent)
10 | strict private
11 | FAlphaBlending: Byte;
12 | FOnChange: TNotifyEvent;
13 | FOptions: TTextEditorMinimapIndicatorOptions;
14 | procedure DoChange;
15 | procedure SetAlphaBlending(const AValue: Byte);
16 | public
17 | constructor Create;
18 | procedure Assign(ASource: TPersistent); override;
19 | procedure SetOption(const AOption: TTextEditorMinimapIndicatorOption; const AEnabled: Boolean);
20 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
21 | published
22 | property AlphaBlending: Byte read FAlphaBlending write SetAlphaBlending default 96;
23 | property Options: TTextEditorMinimapIndicatorOptions read FOptions write FOptions default [];
24 | end;
25 |
26 | implementation
27 |
28 | constructor TTextEditorMinimapIndicator.Create;
29 | begin
30 | inherited;
31 |
32 | FAlphaBlending := 96;
33 | FOptions := [];
34 | end;
35 |
36 | procedure TTextEditorMinimapIndicator.Assign(ASource: TPersistent);
37 | begin
38 | if Assigned(ASource) and (ASource is TTextEditorMinimapIndicator) then
39 | with ASource as TTextEditorMinimapIndicator do
40 | begin
41 | Self.FAlphaBlending := FAlphaBlending;
42 | Self.FOptions := FOptions;
43 |
44 | Self.DoChange;
45 | end
46 | else
47 | inherited Assign(ASource);
48 | end;
49 |
50 | procedure TTextEditorMinimapIndicator.SetOption(const AOption: TTextEditorMinimapIndicatorOption; const AEnabled: Boolean);
51 | begin
52 | if AEnabled then
53 | Include(FOptions, AOption)
54 | else
55 | Exclude(FOptions, AOption);
56 | end;
57 |
58 |
59 | procedure TTextEditorMinimapIndicator.DoChange;
60 | begin
61 | if Assigned(FOnChange) then
62 | FOnChange(Self);
63 | end;
64 |
65 | procedure TTextEditorMinimapIndicator.SetAlphaBlending(const AValue: Byte);
66 | begin
67 | if FAlphaBlending <> AValue then
68 | begin
69 | FAlphaBlending := AValue;
70 |
71 | DoChange;
72 | end;
73 | end;
74 |
75 | end.
76 |
77 |
--------------------------------------------------------------------------------
/Source/TextEditor.Minimap.Shadow.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Minimap.Shadow;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes;
7 |
8 | type
9 | TTextEditorMinimapShadow = class(TPersistent)
10 | strict private
11 | FAlphaBlending: Byte;
12 | FColor: TColor;
13 | FOnChange: TNotifyEvent;
14 | FVisible: Boolean;
15 | FWidth: Integer;
16 | procedure DoChange;
17 | procedure SetAlphaBlending(const AValue: Byte);
18 | procedure SetColor(const AValue: TColor);
19 | procedure SetVisible(const AValue: Boolean);
20 | procedure SetWidth(const AValue: Integer);
21 | public
22 | constructor Create;
23 | procedure Assign(ASource: TPersistent); override;
24 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
25 | published
26 | property AlphaBlending: Byte read FAlphaBlending write SetAlphaBlending default 96;
27 | property Color: TColor read FColor write SetColor default TColors.Black;
28 | property Visible: Boolean read FVisible write SetVisible default False;
29 | property Width: Integer read FWidth write SetWidth default 8;
30 | end;
31 |
32 | implementation
33 |
34 | constructor TTextEditorMinimapShadow.Create;
35 | begin
36 | inherited;
37 |
38 | FAlphaBlending := 96;
39 | FColor := TColors.Black;
40 | FVisible := False;
41 | FWidth := 8;
42 | end;
43 |
44 | procedure TTextEditorMinimapShadow.Assign(ASource: TPersistent);
45 | begin
46 | if Assigned(ASource) and (ASource is TTextEditorMinimapShadow) then
47 | with ASource as TTextEditorMinimapShadow do
48 | begin
49 | Self.FAlphaBlending := FAlphaBlending;
50 | Self.FColor := FColor;
51 | Self.FVisible := FVisible;
52 |
53 | Self.DoChange;
54 | end
55 | else
56 | inherited Assign(ASource);
57 | end;
58 |
59 | procedure TTextEditorMinimapShadow.DoChange;
60 | begin
61 | if Assigned(FOnChange) then
62 | FOnChange(Self);
63 | end;
64 |
65 | procedure TTextEditorMinimapShadow.SetAlphaBlending(const AValue: Byte);
66 | begin
67 | if FAlphaBlending <> AValue then
68 | begin
69 | FAlphaBlending := AValue;
70 |
71 | DoChange;
72 | end;
73 | end;
74 |
75 | procedure TTextEditorMinimapShadow.SetColor(const AValue: TColor);
76 | begin
77 | if FColor <> AValue then
78 | begin
79 | FColor := AValue;
80 |
81 | DoChange;
82 | end;
83 | end;
84 |
85 | procedure TTextEditorMinimapShadow.SetVisible(const AValue: Boolean);
86 | begin
87 | if FVisible <> AValue then
88 | begin
89 | FVisible := AValue;
90 |
91 | DoChange;
92 | end;
93 | end;
94 |
95 | procedure TTextEditorMinimapShadow.SetWidth(const AValue: Integer);
96 | begin
97 | if FWidth <> AValue then
98 | begin
99 | FWidth := AValue;
100 |
101 | DoChange;
102 | end;
103 | end;
104 |
105 | end.
106 |
--------------------------------------------------------------------------------
/Source/TextEditor.Minimap.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Minimap;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Minimap.Indicator, TextEditor.Minimap.Shadow, TextEditor.Types;
7 |
8 | type
9 | TTextEditorMinimap = class(TPersistent)
10 | strict private
11 | FAlign: TTextEditorMinimapAlign;
12 | FCharHeight: Integer;
13 | FClicked: Boolean;
14 | FCursor: TCursor;
15 | FIndicator: TTextEditorMinimapIndicator;
16 | FOnChange: TNotifyEvent;
17 | FOptions: TTextEditorMinimapOptions;
18 | FShadow: TTextEditorMinimapShadow;
19 | FTopLine: Integer;
20 | FVisible: Boolean;
21 | FVisibleLineCount: Integer;
22 | FWidth: Integer;
23 | procedure DoChange;
24 | procedure SetAlign(const AValue: TTextEditorMinimapAlign);
25 | procedure SetOnChange(const AValue: TNotifyEvent);
26 | procedure SetVisible(const AValue: Boolean);
27 | procedure SetWidth(const AValue: Integer);
28 | public
29 | constructor Create;
30 | destructor Destroy; override;
31 | function GetWidth: Integer;
32 | procedure Assign(ASource: TPersistent); override;
33 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
34 | procedure SetOption(const AOption: TTextEditorMinimapOption; const AEnabled: Boolean);
35 | property CharHeight: Integer read FCharHeight write FCharHeight;
36 | property Clicked: Boolean read FClicked write FClicked;
37 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
38 | property TopLine: Integer read FTopLine write FTopLine default 1;
39 | property VisibleLineCount: Integer read FVisibleLineCount write FVisibleLineCount;
40 | published
41 | property Align: TTextEditorMinimapAlign read FAlign write SetAlign default maRight;
42 | property Cursor: TCursor read FCursor write FCursor default crArrow;
43 | property Indicator: TTextEditorMinimapIndicator read FIndicator write FIndicator;
44 | property Options: TTextEditorMinimapOptions read FOptions write FOptions default [];
45 | property Shadow: TTextEditorMinimapShadow read FShadow write FShadow;
46 | property Visible: Boolean read FVisible write SetVisible default False;
47 | property Width: Integer read FWidth write SetWidth default 140;
48 | end;
49 |
50 | implementation
51 |
52 | uses
53 | Winapi.Windows, System.Math;
54 |
55 | constructor TTextEditorMinimap.Create;
56 | begin
57 | inherited;
58 |
59 | FAlign := maRight;
60 | FClicked := False;
61 | FCursor := crArrow;
62 | FOptions := [];
63 | FTopLine := 1;
64 | FVisible := False;
65 | FWidth := 140;
66 |
67 | FIndicator := TTextEditorMinimapIndicator.Create;
68 | FShadow := TTextEditorMinimapShadow.Create;
69 | end;
70 |
71 | destructor TTextEditorMinimap.Destroy;
72 | begin
73 | FIndicator.Free;
74 | FShadow.Free;
75 |
76 | inherited Destroy;
77 | end;
78 |
79 | procedure TTextEditorMinimap.Assign(ASource: TPersistent);
80 | begin
81 | if Assigned(ASource) and (ASource is TTextEditorMinimap) then
82 | with ASource as TTextEditorMinimap do
83 | begin
84 | Self.FAlign := FAlign;
85 | Self.FShadow.Assign(FShadow);
86 | Self.FOptions := FOptions;
87 | Self.FVisible := FVisible;
88 | Self.FWidth := FWidth;
89 | Self.FCursor := FCursor;
90 |
91 | Self.DoChange;
92 | end
93 | else
94 | inherited Assign(ASource);
95 | end;
96 |
97 | procedure TTextEditorMinimap.ChangeScale(const AMultiplier, ADivider: Integer);
98 | begin
99 | FWidth := MulDiv(FWidth, AMultiplier, ADivider);
100 | DoChange;
101 | end;
102 |
103 | procedure TTextEditorMinimap.SetOnChange(const AValue: TNotifyEvent);
104 | begin
105 | FOnChange := AValue;
106 | FIndicator.OnChange := AValue;
107 | FShadow.OnChange := AValue;
108 | end;
109 |
110 | procedure TTextEditorMinimap.DoChange;
111 | begin
112 | if Assigned(FOnChange) then
113 | FOnChange(Self);
114 | end;
115 |
116 | procedure TTextEditorMinimap.SetOption(const AOption: TTextEditorMinimapOption; const AEnabled: Boolean);
117 | begin
118 | if AEnabled then
119 | Include(FOptions, AOption)
120 | else
121 | Exclude(FOptions, AOption);
122 | end;
123 |
124 | procedure TTextEditorMinimap.SetAlign(const AValue: TTextEditorMinimapAlign);
125 | begin
126 | if FAlign <> AValue then
127 | begin
128 | FAlign := AValue;
129 |
130 | DoChange;
131 | end;
132 | end;
133 |
134 | procedure TTextEditorMinimap.SetWidth(const AValue: Integer);
135 | var
136 | LValue: Integer;
137 | begin
138 | LValue := Max(0, AValue);
139 |
140 | if FWidth <> LValue then
141 | begin
142 | FWidth := LValue;
143 |
144 | DoChange;
145 | end;
146 | end;
147 |
148 | function TTextEditorMinimap.GetWidth: Integer;
149 | begin
150 | if FVisible then
151 | Result := FWidth
152 | else
153 | Result := 0;
154 | end;
155 |
156 | procedure TTextEditorMinimap.SetVisible(const AValue: Boolean);
157 | begin
158 | if FVisible <> AValue then
159 | begin
160 | FVisible := AValue;
161 | DoChange;
162 | end;
163 | end;
164 |
165 | end.
166 |
--------------------------------------------------------------------------------
/Source/TextEditor.PopupWindow.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.PopupWindow;
2 |
3 | {$I TextEditor.Defines.inc}
4 |
5 | interface
6 |
7 | uses
8 | Winapi.Messages, System.Classes, System.Types, Vcl.Controls
9 | {$IFDEF ALPHASKINS}
10 | , acSBUtils, sCommonData, sStyleSimply
11 | {$ENDIF};
12 |
13 | type
14 | TTextEditorPopupWindow = class(TCustomControl)
15 | private
16 | {$IFDEF ALPHASKINS}
17 | FScrollWnd: TacScrollWnd;
18 | FSkinData: TsScrollWndData;
19 | {$ENDIF}
20 | procedure WMEraseBkgnd(var AMessage: TWMEraseBkgnd); message WM_ERASEBKGND;
21 | procedure WMMouseActivate(var AMessage: TWMMouseActivate); message WM_MOUSEACTIVATE;
22 | protected
23 | FActiveControl: TWinControl;
24 | procedure CreateParams(var Params: TCreateParams); override;
25 | procedure Hide; virtual;
26 | procedure Show(const AOrigin: TPoint); virtual;
27 | public
28 | constructor Create(AOwner: TComponent); override;
29 | destructor Destroy; override;
30 | procedure CreateWnd; override;
31 | procedure WndProc(var AMessage: TMessage); override;
32 | property ActiveControl: TWinControl read FActiveControl;
33 | {$IFDEF ALPHASKINS}
34 | property SkinData: TsScrollWndData read FSkinData write FSkinData;
35 | {$ENDIF}
36 | end;
37 |
38 | implementation
39 |
40 | uses
41 | Winapi.Windows
42 | {$IFDEF ALPHASKINS}
43 | , System.SysUtils, sConst, sMessages, sSkinProps, sSkinManager
44 | {$ENDIF};
45 |
46 | constructor TTextEditorPopupWindow.Create(AOwner: TComponent);
47 | begin
48 | {$IFDEF ALPHASKINS}
49 | FSkinData := TsScrollWndData.Create(Self, True);
50 | FSkinData.COC := COC_TsListBox;
51 | {$ENDIF}
52 |
53 | inherited Create(AOwner);
54 |
55 | ControlStyle := ControlStyle + [csNoDesignVisible, csReplicatable];
56 |
57 | {$IFDEF ALPHASKINS}
58 | DoubleBuffered := False;
59 | {$ELSE}
60 | DoubleBuffered := True;
61 | {$ENDIF}
62 | Ctl3D := False;
63 | ParentCtl3D := False;
64 | Parent := AOwner as TWinControl;
65 | Visible := False;
66 | end;
67 |
68 | destructor TTextEditorPopupWindow.Destroy;
69 | begin
70 | inherited Destroy;
71 |
72 | {$IFDEF ALPHASKINS}
73 | if Assigned(FScrollWnd) then
74 | FreeAndNil(FScrollWnd);
75 |
76 | if Assigned(FSkinData) then
77 | FreeAndNil(FSkinData);
78 | {$ENDIF}
79 | end;
80 |
81 | procedure TTextEditorPopupWindow.CreateWnd;
82 | {$IFDEF ALPHASKINS}
83 | var
84 | LSkinParams: TacSkinParams;
85 | {$ENDIF}
86 | begin
87 | inherited;
88 | {$IFDEF ALPHASKINS}
89 | FSkinData.Loaded(False);
90 |
91 | if Assigned(FScrollWnd) and FScrollWnd.Destroyed then
92 | FreeAndNil(FScrollWnd);
93 |
94 | if not Assigned(FScrollWnd) then
95 | FScrollWnd := TacEditWnd.Create(Handle, SkinData, SkinData.SkinManager, LSkinParams, False);
96 | {$ENDIF}
97 | end;
98 |
99 | procedure TTextEditorPopupWindow.Hide;
100 | begin
101 | SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOZORDER or SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE or SWP_HIDEWINDOW);
102 | Visible := False;
103 | end;
104 |
105 | procedure TTextEditorPopupWindow.CreateParams(var Params: TCreateParams);
106 | begin
107 | inherited CreateParams(Params);
108 |
109 | Params.Style := WS_POPUP or WS_BORDER;
110 | end;
111 |
112 | procedure TTextEditorPopupWindow.Show(const AOrigin: TPoint);
113 | begin
114 | SetWindowPos(Handle, HWND_TOPMOST, AOrigin.X, AOrigin.Y, Width, Height, SWP_NOSIZE or SWP_NOACTIVATE or SWP_SHOWWINDOW or
115 | SWP_NOSENDCHANGING or SWP_NOOWNERZORDER);
116 |
117 | Visible := True;
118 | end;
119 |
120 | procedure TTextEditorPopupWindow.WMMouseActivate(var AMessage: TWMMouseActivate);
121 | begin
122 | AMessage.Result := MA_NOACTIVATE;
123 | end;
124 |
125 | procedure TTextEditorPopupWindow.WMEraseBkgnd(var AMessage: TWMEraseBkgnd);
126 | begin
127 | AMessage.Result := 1;
128 | end;
129 |
130 | procedure TTextEditorPopupWindow.WndProc(var AMessage: TMessage);
131 | begin
132 | {$IFDEF ALPHASKINS}
133 | if AMessage.Msg = SM_ALPHACMD then
134 | case AMessage.WParamHi of
135 | AC_CTRLHANDLED:
136 | begin
137 | AMessage.Result := 1;
138 | Exit;
139 | end;
140 | AC_GETDEFINDEX:
141 | begin
142 | if Assigned(FSkinData.SkinManager) then
143 | AMessage.Result := FSkinData.SkinManager.SkinCommonInfo.Sections[ssEdit] + 1;
144 |
145 | Exit;
146 | end;
147 | AC_REFRESH:
148 | if RefreshNeeded(SkinData, AMessage) then
149 | begin
150 | RefreshEditScrolls(SkinData, FScrollWnd);
151 | CommonMessage(AMessage, FSkinData);
152 |
153 | if HandleAllocated and Visible then
154 | RedrawWindow(Handle, nil, 0, RDWA_REPAINT);
155 |
156 | Exit;
157 | end;
158 | end;
159 | {$ENDIF}
160 |
161 | inherited;
162 | end;
163 |
164 | end.
165 |
--------------------------------------------------------------------------------
/Source/TextEditor.Register.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Register;
2 |
3 | {$I TextEditor.Defines.inc}
4 |
5 | interface
6 |
7 | uses
8 | System.Classes, TextEditor, TextEditor.Compare.ScrollBar, TextEditor.MacroRecorder, TextEditor.Print,
9 | TextEditor.Print.Preview{$IFDEF TEXT_EDITOR_SPELL_CHECK}, TextEditor.SpellCheck{$ENDIF};
10 |
11 | procedure Register;
12 |
13 | implementation
14 |
15 | procedure Register;
16 | begin
17 | RegisterComponents('TextEditor', [TTextEditor, TDBTextEditor, TTextEditorPrint, TTextEditorPrintPreview,
18 | TTextEditorMacroRecorder{$IFDEF TEXT_EDITOR_SPELL_CHECK}, TTextEditorSpellCheck{$ENDIF}, TTextEditorCompareScrollBar]);
19 | end;
20 |
21 | end.
22 |
--------------------------------------------------------------------------------
/Source/TextEditor.RegisterProperty.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.RegisterProperty;
2 |
3 | interface
4 |
5 | uses
6 | System.SysUtils, DesignEditors, DesignIntf;
7 |
8 | type
9 | TFileNameProperty = class(TStringProperty)
10 | public
11 | function GetAttributes: TPropertyAttributes; override;
12 | procedure Edit; override;
13 | end;
14 |
15 | procedure Register;
16 |
17 | implementation
18 |
19 | uses
20 | System.Classes, Vcl.Dialogs, Vcl.Forms, StrEdit, TextEditor.Language, TextEditor.MacroRecorder, VCLEditors;
21 |
22 | { Register }
23 |
24 | procedure Register;
25 | begin
26 | RegisterPropertyEditor(TypeInfo(Char), nil, '', TCharProperty);
27 | RegisterPropertyEditor(TypeInfo(TStrings), nil, '', TStringListProperty);
28 | RegisterPropertyEditor(TypeInfo(TShortCut), TTextEditorMacroRecorder, '', TShortCutProperty);
29 | RegisterPropertyEditor(TypeInfo(TFileName), nil, '', TFileNameProperty);
30 | end;
31 |
32 | { TFileNameProperty }
33 |
34 | function TFileNameProperty.GetAttributes: TPropertyAttributes;
35 | begin
36 | Result := [paDialog]
37 | end;
38 |
39 | procedure TFileNameProperty.Edit;
40 | begin
41 | if GetName = 'Load' then
42 | with TOpenDialog.Create(Application) do
43 | try
44 | DefaultExt := '.json';
45 | Title := STextEditorThemeLoadFromFile;
46 | Filename := '';
47 | Filter := 'JSON Files (*.json)|*.json';
48 | HelpContext := 0;
49 | Options := Options + [ofShowHelp, ofPathMustExist, ofFileMustExist];
50 |
51 | if Execute then
52 | SetValue(Filename);
53 | finally
54 | Free;
55 | end;
56 |
57 | if GetName = 'Save' then
58 | with TSaveDialog.Create(Application) do
59 | try
60 | DefaultExt := '.json';
61 | Title := STextEditorThemeSaveToFile;
62 | Filename := 'Theme.json';
63 | Filter := 'JSON Files (*.json)|*.json';
64 | HelpContext := 0;
65 |
66 | if Execute then
67 | SetValue(Filename);
68 | finally
69 | Free;
70 | end;
71 | end;
72 |
73 | end.
74 |
--------------------------------------------------------------------------------
/Source/TextEditor.Replace.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Replace;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorReplace = class(TPersistent)
10 | strict private
11 | FAction: TTextEditorReplaceTextAction;
12 | FEngine: TTextEditorSearchEngine;
13 | FOnChange: TTextEditorReplaceChangeEvent;
14 | FOptions: TTextEditorReplaceOptions;
15 | procedure SetEngine(const AValue: TTextEditorSearchEngine);
16 | public
17 | constructor Create;
18 | procedure Assign(ASource: TPersistent); override;
19 | procedure SetOption(const AOption: TTextEditorReplaceOption; const AEnabled: Boolean);
20 | published
21 | property Action: TTextEditorReplaceTextAction read FAction write FAction default rtaReplace;
22 | property Engine: TTextEditorSearchEngine read FEngine write SetEngine default seNormal;
23 | property OnChange: TTextEditorReplaceChangeEvent read FOnChange write FOnChange;
24 | property Options: TTextEditorReplaceOptions read FOptions write FOptions default [roPrompt];
25 | end;
26 |
27 | implementation
28 |
29 | constructor TTextEditorReplace.Create;
30 | begin
31 | inherited;
32 |
33 | FAction := rtaReplace;
34 | FEngine := seNormal;
35 | FOptions := [roPrompt];
36 | end;
37 |
38 | procedure TTextEditorReplace.Assign(ASource: TPersistent);
39 | begin
40 | if Assigned(ASource) and (ASource is TTextEditorReplace) then
41 | with ASource as TTextEditorReplace do
42 | begin
43 | Self.FEngine := Engine;
44 | Self.FOptions := Options;
45 | Self.FAction := Action;
46 | end
47 | else
48 | inherited Assign(ASource);
49 | end;
50 |
51 | procedure TTextEditorReplace.SetOption(const AOption: TTextEditorReplaceOption; const AEnabled: Boolean);
52 | begin
53 | if AEnabled then
54 | Include(FOptions, AOption)
55 | else
56 | Exclude(FOptions, AOption);
57 | end;
58 |
59 | procedure TTextEditorReplace.SetEngine(const AValue: TTextEditorSearchEngine);
60 | begin
61 | if FEngine <> AValue then
62 | begin
63 | FEngine := AValue;
64 |
65 | if Assigned(FOnChange) then
66 | FOnChange(rcEngineUpdate);
67 | end;
68 | end;
69 |
70 | end.
71 |
72 |
--------------------------------------------------------------------------------
/Source/TextEditor.RightMargin.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.RightMargin;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorRightMargin = class(TPersistent)
10 | strict private
11 | FCursor: TCursor;
12 | FMouseOver: Boolean;
13 | FMoving: Boolean;
14 | FOnChange: TNotifyEvent;
15 | FOptions: TTextEditorRightMarginOptions;
16 | FPosition: Integer;
17 | FVisible: Boolean;
18 | procedure DoChange;
19 | procedure SetPosition(const AValue: Integer);
20 | procedure SetVisible(const AValue: Boolean);
21 | public
22 | constructor Create;
23 | procedure Assign(ASource: TPersistent); override;
24 | procedure SetOption(const AOption: TTextEditorRightMarginOption; const AEnabled: Boolean);
25 | property Moving: Boolean read FMoving write FMoving;
26 | property MouseOver: Boolean read FMouseOver write FMouseOver;
27 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
28 | published
29 | property Cursor: TCursor read FCursor write FCursor default crHSplit;
30 | property Options: TTextEditorRightMarginOptions read FOptions write FOptions default [rmoMouseMove, rmoShowMovingHint];
31 | property Position: Integer read FPosition write SetPosition default 80;
32 | property Visible: Boolean read FVisible write SetVisible default True;
33 | end;
34 |
35 | implementation
36 |
37 | constructor TTextEditorRightMargin.Create;
38 | begin
39 | inherited;
40 |
41 | FVisible := True;
42 | FPosition := 80;
43 | FOptions := [rmoMouseMove, rmoShowMovingHint];
44 | FMoving := False;
45 | FMouseOver := False;
46 | FCursor := crHSplit;
47 | end;
48 |
49 | procedure TTextEditorRightMargin.Assign(ASource: TPersistent);
50 | begin
51 | if Assigned(ASource) and (ASource is TTextEditorRightMargin) then
52 | with ASource as TTextEditorRightMargin do
53 | begin
54 | Self.FVisible := FVisible;
55 | Self.FPosition := FPosition;
56 | Self.FOptions := FOptions;
57 | Self.FCursor := FCursor;
58 |
59 | Self.DoChange;
60 | end
61 | else
62 | inherited Assign(ASource);
63 | end;
64 |
65 | procedure TTextEditorRightMargin.SetOption(const AOption: TTextEditorRightMarginOption; const AEnabled: Boolean);
66 | begin
67 | if AEnabled then
68 | Include(FOptions, AOption)
69 | else
70 | Exclude(FOptions, AOption);
71 | end;
72 |
73 | procedure TTextEditorRightMargin.DoChange;
74 | begin
75 | if Assigned(FOnChange) then
76 | FOnChange(Self);
77 | end;
78 |
79 | procedure TTextEditorRightMargin.SetPosition(const AValue: Integer);
80 | begin
81 | if FPosition <> AValue then
82 | begin
83 | FPosition := AValue;
84 |
85 | DoChange
86 | end;
87 | end;
88 |
89 | procedure TTextEditorRightMargin.SetVisible(const AValue: Boolean);
90 | begin
91 | if FVisible <> AValue then
92 | begin
93 | FVisible := AValue;
94 |
95 | DoChange
96 | end;
97 | end;
98 |
99 |
100 | end.
101 |
--------------------------------------------------------------------------------
/Source/TextEditor.Ruler.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Ruler;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Types;
7 |
8 | const
9 | TEXTEDITOR_DEFAULT_RULER_OPTIONS = [roShowGuideLine, roShowSelection];
10 |
11 | type
12 | TTextEditorRuler = class(TPersistent)
13 | strict private
14 | FCursor: TCursor;
15 | FHeight: Integer;
16 | FMoving: Boolean;
17 | FOnChange: TNotifyEvent;
18 | FOptions: TTextEditorRulerOptions;
19 | FVisible: Boolean;
20 | procedure DoChange;
21 | procedure SetHeight(AValue: Integer);
22 | procedure SetOnChange(const AValue: TNotifyEvent);
23 | procedure SetVisible(const AValue: Boolean);
24 | public
25 | constructor Create;
26 | procedure Assign(ASource: TPersistent); override;
27 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
28 | procedure SetOption(const AOption: TTextEditorRulerOption; const AEnabled: Boolean);
29 | property Moving: Boolean read FMoving write FMoving;
30 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
31 | published
32 | property Cursor: TCursor read FCursor write FCursor default crDefault;
33 | property Height: Integer read FHeight write SetHeight default 18;
34 | property Options: TTextEditorRulerOptions read FOptions write FOptions default TEXTEDITOR_DEFAULT_RULER_OPTIONS;
35 | property Visible: Boolean read FVisible write SetVisible default False;
36 | end;
37 |
38 | implementation
39 |
40 | uses
41 | Winapi.Windows;
42 |
43 | constructor TTextEditorRuler.Create;
44 | begin
45 | inherited Create;
46 |
47 | FCursor := crDefault;
48 | FHeight := 18;
49 | FMoving := False;
50 | FVisible := False;
51 | FOptions := TEXTEDITOR_DEFAULT_RULER_OPTIONS;
52 | end;
53 |
54 | procedure TTextEditorRuler.Assign(ASource: TPersistent);
55 | begin
56 | if Assigned(ASource) and (ASource is TTextEditorRuler) then
57 | with ASource as TTextEditorRuler do
58 | begin
59 | Self.FCursor := FCursor;
60 | Self.FHeight := FHeight;
61 | Self.FVisible := FVisible;
62 | Self.FOptions := FOptions;
63 |
64 | Self.DoChange;
65 | end
66 | else
67 | inherited Assign(ASource);
68 | end;
69 |
70 | procedure TTextEditorRuler.ChangeScale(const AMultiplier, ADivider: Integer);
71 | begin
72 | FHeight := MulDiv(FHeight, AMultiplier, ADivider);
73 | DoChange;
74 | end;
75 |
76 | procedure TTextEditorRuler.SetOnChange(const AValue: TNotifyEvent);
77 | begin
78 | FOnChange := AValue;
79 | end;
80 |
81 | procedure TTextEditorRuler.DoChange;
82 | begin
83 | if Assigned(FOnChange) then
84 | FOnChange(Self);
85 | end;
86 |
87 | procedure TTextEditorRuler.SetHeight(AValue: Integer);
88 | begin
89 | if FHeight <> AValue then
90 | begin
91 | FHeight := AValue;
92 |
93 | DoChange
94 | end;
95 | end;
96 |
97 | procedure TTextEditorRuler.SetVisible(const AValue: Boolean);
98 | begin
99 | if FVisible <> AValue then
100 | begin
101 | FVisible := AValue;
102 |
103 | DoChange
104 | end;
105 | end;
106 |
107 | procedure TTextEditorRuler.SetOption(const AOption: TTextEditorRulerOption; const AEnabled: Boolean);
108 | begin
109 | if AEnabled then
110 | Include(FOptions, AOption)
111 | else
112 | Exclude(FOptions, AOption);
113 | end;
114 |
115 | end.
116 |
--------------------------------------------------------------------------------
/Source/TextEditor.Scroll.Hint.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Scroll.Hint;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorScrollHint = class(TPersistent)
10 | strict private
11 | FFormat: TTextEditorScrollHintFormat;
12 | public
13 | constructor Create;
14 | procedure Assign(ASource: TPersistent); override;
15 | published
16 | property Format: TTextEditorScrollHintFormat read FFormat write FFormat default shfTopLineOnly;
17 | end;
18 |
19 | implementation
20 |
21 | constructor TTextEditorScrollHint.Create;
22 | begin
23 | inherited;
24 |
25 | FFormat := shfTopLineOnly;
26 | end;
27 |
28 | procedure TTextEditorScrollHint.Assign(ASource: TPersistent);
29 | begin
30 | if Assigned(ASource) and (ASource is TTextEditorScrollHint) then
31 | with ASource as TTextEditorScrollHint do
32 | Self.FFormat := FFormat
33 | else
34 | inherited Assign(ASource);
35 | end;
36 |
37 | end.
38 |
--------------------------------------------------------------------------------
/Source/TextEditor.Scroll.Shadow.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Scroll.Shadow;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes;
7 |
8 | type
9 | TTextEditorScrollShadow = class(TPersistent)
10 | strict private
11 | FAlphaBlending: Byte;
12 | FColor: TColor;
13 | FOnChange: TNotifyEvent;
14 | FVisible: Boolean;
15 | FWidth: Integer;
16 | procedure DoChange;
17 | procedure SetAlphaBlending(const AValue: Byte);
18 | procedure SetColor(const AValue: TColor);
19 | procedure SetVisible(const AValue: Boolean);
20 | procedure SetWidth(const AValue: Integer);
21 | public
22 | constructor Create;
23 | procedure Assign(ASource: TPersistent); override;
24 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
25 | published
26 | property AlphaBlending: Byte read FAlphaBlending write SetAlphaBlending default 96;
27 | property Color: TColor read FColor write SetColor default TColors.Black;
28 | property Visible: Boolean read FVisible write SetVisible default True;
29 | property Width: Integer read FWidth write SetWidth default 8;
30 | end;
31 |
32 | implementation
33 |
34 | constructor TTextEditorScrollShadow.Create;
35 | begin
36 | inherited;
37 |
38 | FAlphaBlending := 96;
39 | FColor := TColors.Black;
40 | FVisible := True;
41 | FWidth := 8;
42 | end;
43 |
44 | procedure TTextEditorScrollShadow.Assign(ASource: TPersistent);
45 | begin
46 | if Assigned(ASource) and (ASource is TTextEditorScrollShadow) then
47 | with ASource as TTextEditorScrollShadow do
48 | begin
49 | Self.FAlphaBlending := FAlphaBlending;
50 | Self.FColor := FColor;
51 | Self.FVisible := FVisible;
52 |
53 | Self.DoChange;
54 | end
55 | else
56 | inherited Assign(ASource);
57 | end;
58 |
59 | procedure TTextEditorScrollShadow.DoChange;
60 | begin
61 | if Assigned(FOnChange) then
62 | FOnChange(Self);
63 | end;
64 |
65 | procedure TTextEditorScrollShadow.SetAlphaBlending(const AValue: Byte);
66 | begin
67 | if FAlphaBlending <> AValue then
68 | begin
69 | FAlphaBlending := AValue;
70 |
71 | DoChange;
72 | end;
73 | end;
74 |
75 | procedure TTextEditorScrollShadow.SetColor(const AValue: TColor);
76 | begin
77 | if FColor <> AValue then
78 | begin
79 | FColor := AValue;
80 |
81 | DoChange;
82 | end;
83 | end;
84 |
85 | procedure TTextEditorScrollShadow.SetVisible(const AValue: Boolean);
86 | begin
87 | if FVisible <> AValue then
88 | begin
89 | FVisible := AValue;
90 |
91 | DoChange;
92 | end;
93 | end;
94 |
95 | procedure TTextEditorScrollShadow.SetWidth(const AValue: Integer);
96 | begin
97 | if FWidth <> AValue then
98 | begin
99 | FWidth := AValue;
100 |
101 | DoChange;
102 | end;
103 | end;
104 |
105 | end.
106 |
--------------------------------------------------------------------------------
/Source/TextEditor.Scroll.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Scroll;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Glyph, TextEditor.Scroll.Hint, TextEditor.Scroll.Shadow, TextEditor.Types;
7 |
8 | const
9 | TEXTEDITOR_DEFAULT_SCROLL_OPTIONS = [soShowVerticalScrollHint, soWheelClickMove];
10 |
11 | type
12 | TTextEditorScroll = class(TPersistent)
13 | strict private
14 | FBars: System.UITypes.TScrollStyle;
15 | FDragging: Boolean;
16 | FHint: TTextEditorScrollHint;
17 | FIndicator: TTextEditorGlyph;
18 | FOnChange: TNotifyEvent;
19 | FOptions: TTextEditorScrollOptions;
20 | FShadow: TTextEditorScrollShadow;
21 | procedure DoChange;
22 | procedure SetBars(const AValue: System.UITypes.TScrollStyle);
23 | procedure SetHint(const AValue: TTextEditorScrollHint);
24 | procedure SetIndicator(const AValue: TTextEditorGlyph);
25 | procedure SetOnChange(const AValue: TNotifyEvent);
26 | procedure SetOptions(const AValue: TTextEditorScrollOptions);
27 | public
28 | constructor Create;
29 | destructor Destroy; override;
30 | procedure Assign(ASource: TPersistent); override;
31 | procedure SetOption(const AOption: TTextEditorScrollOption; const AEnabled: Boolean);
32 | property Dragging: Boolean read FDragging write FDragging;
33 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
34 | published
35 | property Bars: System.UITypes.TScrollStyle read FBars write SetBars default System.UITypes.TScrollStyle.ssBoth;
36 | property Hint: TTextEditorScrollHint read FHint write SetHint;
37 | property Indicator: TTextEditorGlyph read FIndicator write SetIndicator;
38 | property Options: TTextEditorScrollOptions read FOptions write SetOptions default TEXTEDITOR_DEFAULT_SCROLL_OPTIONS;
39 | property Shadow: TTextEditorScrollShadow read FShadow write FShadow;
40 | end;
41 |
42 | implementation
43 |
44 | uses
45 | TextEditor.Consts;
46 |
47 | constructor TTextEditorScroll.Create;
48 | begin
49 | inherited;
50 |
51 | FDragging := False;
52 | FOptions := TEXTEDITOR_DEFAULT_SCROLL_OPTIONS;
53 | FBars := System.UITypes.TScrollStyle.ssBoth;
54 | FHint := TTextEditorScrollHint.Create;
55 | FIndicator := TTextEditorGlyph.Create(HInstance, TResourceBitmap.MouseMoveScroll, TColors.Fuchsia);
56 | FShadow := TTextEditorScrollShadow.Create;
57 | end;
58 |
59 | destructor TTextEditorScroll.Destroy;
60 | begin
61 | FHint.Free;
62 | FIndicator.Free;
63 | FShadow.Free;
64 |
65 | inherited;
66 | end;
67 |
68 | procedure TTextEditorScroll.SetOnChange(const AValue: TNotifyEvent);
69 | begin
70 | FOnChange := AValue;
71 | FShadow.OnChange := AValue;
72 | end;
73 |
74 | procedure TTextEditorScroll.SetBars(const AValue: System.UITypes.TScrollStyle);
75 | begin
76 | if FBars <> AValue then
77 | begin
78 | FBars := AValue;
79 |
80 | DoChange;
81 | end;
82 | end;
83 |
84 | procedure TTextEditorScroll.DoChange;
85 | begin
86 | if Assigned(FOnChange) then
87 | FOnChange(Self);
88 | end;
89 |
90 | procedure TTextEditorScroll.Assign(ASource: TPersistent);
91 | begin
92 | if Assigned(ASource) and (ASource is TTextEditorScroll) then
93 | with ASource as TTextEditorScroll do
94 | begin
95 | Self.FBars := FBars;
96 | Self.FHint.Assign(FHint);
97 | Self.FIndicator.Assign(FIndicator);
98 | Self.FShadow.Assign(FShadow);
99 | Self.FOptions := FOptions;
100 |
101 | Self.DoChange;
102 | end
103 | else
104 | inherited Assign(ASource);
105 | end;
106 |
107 | procedure TTextEditorScroll.SetOption(const AOption: TTextEditorScrollOption; const AEnabled: Boolean);
108 | begin
109 | if AEnabled then
110 | Include(FOptions, AOption)
111 | else
112 | Exclude(FOptions, AOption);
113 | end;
114 |
115 | procedure TTextEditorScroll.SetOptions(const AValue: TTextEditorScrollOptions);
116 | begin
117 | if FOptions <> AValue then
118 | begin
119 | FOptions := AValue;
120 |
121 | DoChange;
122 | end;
123 | end;
124 |
125 | procedure TTextEditorScroll.SetHint(const AValue: TTextEditorScrollHint);
126 | begin
127 | FHint.Assign(AValue);
128 | end;
129 |
130 | procedure TTextEditorScroll.SetIndicator(const AValue: TTextEditorGlyph);
131 | begin
132 | FIndicator.Assign(AValue);
133 | end;
134 |
135 | end.
136 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.Base.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.Base;
2 |
3 | interface
4 |
5 | uses
6 | System.Generics.Collections, TextEditor.Lines, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSearchBase = class
10 | strict private
11 | FCaseSensitive: Boolean;
12 | FEngine: TTextEditorSearchEngine;
13 | FStatus: string;
14 | FWholeWordsOnly: Boolean;
15 | procedure SetCaseSensitive(const AValue: Boolean);
16 | protected
17 | FPattern: string;
18 | FResults: TList;
19 | function GetLength(const AIndex: Integer): Integer; virtual; abstract;
20 | function GetResult(const AIndex: Integer): Integer; virtual;
21 | function GetResultCount: Integer; virtual;
22 | procedure CaseSensitiveChanged; virtual; abstract;
23 | procedure SetPattern(const AValue: string); virtual;
24 | public
25 | constructor Create;
26 | destructor Destroy; override;
27 | function SearchAll(const ALines: TTextEditorLines): Integer; virtual; abstract;
28 | procedure Clear; virtual;
29 | property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive default False;
30 | property Engine: TTextEditorSearchEngine read FEngine write FEngine;
31 | property Lengths[const AIndex: Integer]: Integer read GetLength;
32 | property Pattern: string read FPattern write SetPattern;
33 | property ResultCount: Integer read GetResultCount;
34 | property Results[const AIndex: Integer]: Integer read GetResult;
35 | property Status: string read FStatus write FStatus;
36 | property WholeWordsOnly: Boolean read FWholeWordsOnly write FWholeWordsOnly default False;
37 | end;
38 |
39 | implementation
40 |
41 | uses
42 | System.SysUtils;
43 |
44 | constructor TTextEditorSearchBase.Create;
45 | begin
46 | inherited;
47 |
48 | FCaseSensitive := False;
49 | FWholeWordsOnly := False;
50 | FPattern := '';
51 | FResults := TList.Create;
52 | end;
53 |
54 | destructor TTextEditorSearchBase.Destroy;
55 | begin
56 | FreeAndNil(FResults);
57 |
58 | inherited Destroy;
59 | end;
60 |
61 | procedure TTextEditorSearchBase.SetCaseSensitive(const AValue: Boolean);
62 | begin
63 | FCaseSensitive := AValue;
64 | CaseSensitiveChanged;
65 | end;
66 |
67 | function TTextEditorSearchBase.GetResult(const AIndex: Integer): Integer;
68 | begin
69 | Result := 0;
70 |
71 | if (AIndex >= 0) and (AIndex < FResults.Count) then
72 | Result := FResults[AIndex];
73 | end;
74 |
75 | function TTextEditorSearchBase.GetResultCount: Integer;
76 | begin
77 | Result := FResults.Count;
78 | end;
79 |
80 | procedure TTextEditorSearchBase.Clear;
81 | begin
82 | FResults.Clear;
83 | end;
84 |
85 | procedure TTextEditorSearchBase.SetPattern(const AValue: string);
86 | begin
87 | FPattern := AValue;
88 | end;
89 |
90 | end.
91 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.InSelection.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.InSelection;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSearchInSelection = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FOnChange: TTextEditorSearchChangeEvent;
13 | FSelectionBeginPosition: TTextEditorTextPosition;
14 | FSelectionEndPosition: TTextEditorTextPosition;
15 | procedure DoChange;
16 | procedure SetActive(const AValue: Boolean);
17 | public
18 | constructor Create;
19 | procedure Assign(ASource: TPersistent); override;
20 | property SelectionBeginPosition: TTextEditorTextPosition read FSelectionBeginPosition write FSelectionBeginPosition;
21 | property SelectionEndPosition: TTextEditorTextPosition read FSelectionEndPosition write FSelectionEndPosition;
22 | published
23 | property Active: Boolean read FActive write SetActive default False;
24 | property OnChange: TTextEditorSearchChangeEvent read FOnChange write FOnChange;
25 | end;
26 |
27 | implementation
28 |
29 | constructor TTextEditorSearchInSelection.Create;
30 | begin
31 | inherited;
32 |
33 | FActive := False;
34 | end;
35 |
36 | procedure TTextEditorSearchInSelection.DoChange;
37 | begin
38 | if Assigned(FOnChange) then
39 | FOnChange(scInSelectionActive);
40 | end;
41 |
42 | procedure TTextEditorSearchInSelection.Assign(ASource: TPersistent);
43 | begin
44 | if Assigned(ASource) and (ASource is TTextEditorSearchInSelection) then
45 | with ASource as TTextEditorSearchInSelection do
46 | begin
47 | Self.FActive := FActive;
48 | Self.FSelectionBeginPosition := FSelectionBeginPosition;
49 | Self.FSelectionEndPosition := FSelectionEndPosition;
50 |
51 | Self.DoChange;
52 | end
53 | else
54 | inherited Assign(ASource);
55 | end;
56 |
57 | procedure TTextEditorSearchInSelection.SetActive(const AValue: Boolean);
58 | begin
59 | if FActive <> AValue then
60 | begin
61 | FActive := AValue;
62 |
63 | DoChange;
64 | end;
65 | end;
66 |
67 | end.
68 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.Map.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.Map;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSearchMap = class(TPersistent)
10 | strict private
11 | FAlign: TTextEditorSearchMapAlign;
12 | FCursor: TCursor;
13 | FOnChange: TTextEditorSearchChangeEvent;
14 | FOptions: TTextEditorSearchMapOptions;
15 | FVisible: Boolean;
16 | FWidth: Integer;
17 | procedure DoChange;
18 | procedure SetAlign(const AValue: TTextEditorSearchMapAlign);
19 | procedure SetOptions(const AValue: TTextEditorSearchMapOptions);
20 | procedure SetVisible(const AValue: Boolean);
21 | procedure SetWidth(const AValue: Integer);
22 | public
23 | constructor Create;
24 | procedure Assign(ASource: TPersistent); override;
25 | procedure ChangeScale(const AMultiplier, ADivider: Integer);
26 | function GetWidth: Integer;
27 | published
28 | property Align: TTextEditorSearchMapAlign read FAlign write SetAlign default saRight;
29 | property Cursor: TCursor read FCursor write FCursor default crArrow;
30 | property OnChange: TTextEditorSearchChangeEvent read FOnChange write FOnChange;
31 | property Options: TTextEditorSearchMapOptions read FOptions write SetOptions default [moShowActiveLine];
32 | property Visible: Boolean read FVisible write SetVisible default False;
33 | property Width: Integer read FWidth write SetWidth default 5;
34 | end;
35 |
36 | implementation
37 |
38 | uses
39 | Winapi.Windows, System.Math;
40 |
41 | constructor TTextEditorSearchMap.Create;
42 | begin
43 | inherited;
44 |
45 | FAlign := saRight;
46 | FOptions := [moShowActiveLine];
47 | FVisible := False;
48 | FWidth := 5;
49 | FCursor := crArrow;
50 | end;
51 |
52 | procedure TTextEditorSearchMap.Assign(ASource: TPersistent);
53 | begin
54 | if Assigned(ASource) and (ASource is TTextEditorSearchMap) then
55 | with ASource as TTextEditorSearchMap do
56 | begin
57 | Self.FAlign := FAlign;
58 | Self.FVisible := FVisible;
59 | Self.FOptions := Options;
60 | Self.FWidth := FWidth;
61 | Self.FCursor := FCursor;
62 |
63 | Self.DoChange;
64 | end
65 | else
66 | inherited Assign(ASource);
67 | end;
68 |
69 | procedure TTextEditorSearchMap.ChangeScale(const AMultiplier, ADivider: Integer);
70 | begin
71 | FWidth := MulDiv(FWidth, AMultiplier, ADivider);
72 |
73 | DoChange;
74 | end;
75 |
76 | procedure TTextEditorSearchMap.SetWidth(const AValue: Integer);
77 | var
78 | LValue: Integer;
79 | begin
80 | LValue := Max(0, AValue);
81 |
82 | if FWidth <> LValue then
83 | FWidth := LValue;
84 |
85 | DoChange;
86 | end;
87 |
88 | procedure TTextEditorSearchMap.DoChange;
89 | begin
90 | if Assigned(FOnChange) then
91 | FOnChange(scSearch);
92 | end;
93 |
94 | procedure TTextEditorSearchMap.SetAlign(const AValue: TTextEditorSearchMapAlign);
95 | begin
96 | if FAlign <> AValue then
97 | begin
98 | FAlign := AValue;
99 |
100 | DoChange;
101 | end;
102 | end;
103 |
104 | procedure TTextEditorSearchMap.SetVisible(const AValue: Boolean);
105 | begin
106 | if FVisible <> AValue then
107 | begin
108 | FVisible := AValue;
109 |
110 | DoChange;
111 | end;
112 | end;
113 |
114 | procedure TTextEditorSearchMap.SetOptions(const AValue: TTextEditorSearchMapOptions);
115 | begin
116 | if FOptions <> AValue then
117 | begin
118 | FOptions := AValue;
119 |
120 | DoChange;
121 | end;
122 | end;
123 |
124 | function TTextEditorSearchMap.GetWidth: Integer;
125 | begin
126 | if FVisible then
127 | Result := FWidth
128 | else
129 | Result := 0;
130 | end;
131 |
132 | end.
133 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.NearOperator.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.NearOperator;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | type
9 | TTextEditorSearchNearOperator = class(TPersistent)
10 | strict private
11 | FEnabled: Boolean;
12 | FMaxDistance: Integer;
13 | FMinDistance: Integer;
14 | public
15 | constructor Create;
16 | procedure Assign(ASource: TPersistent); override;
17 | published
18 | property Enabled: Boolean read FEnabled write FEnabled default False;
19 | property MaxDistance: Integer read FMaxDistance write FMaxDistance default 3;
20 | property MinDistance: Integer read FMinDistance write FMinDistance default 1;
21 | end;
22 |
23 | implementation
24 |
25 | constructor TTextEditorSearchNearOperator.Create;
26 | begin
27 | inherited;
28 |
29 | FEnabled := False;
30 | FMaxDistance := 3;
31 | FMinDistance := 1;
32 | end;
33 |
34 | procedure TTextEditorSearchNearOperator.Assign(ASource: TPersistent);
35 | begin
36 | if Assigned(ASource) and (ASource is TTextEditorSearchNearOperator) then
37 | with ASource as TTextEditorSearchNearOperator do
38 | begin
39 | Self.FEnabled := FEnabled;
40 | Self.FMaxDistance := FMaxDistance;
41 | Self.FMinDistance := FMinDistance;
42 | end
43 | else
44 | inherited Assign(ASource);
45 | end;
46 |
47 | end.
48 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.RegularExpressions.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.RegularExpressions;
2 |
3 | interface
4 |
5 | uses
6 | System.Generics.Collections, System.RegularExpressions, TextEditor.Lines, TextEditor.Search.Base;
7 |
8 | type
9 | TTextEditorRegexSearch = class(TTextEditorSearchBase)
10 | strict private
11 | FLengths: TList;
12 | FOptions: TRegexOptions;
13 | protected
14 | function GetLength(const AIndex: Integer): Integer; override;
15 | procedure CaseSensitiveChanged; override;
16 | public
17 | constructor Create;
18 | destructor Destroy; override;
19 | function SearchAll(const ALines: TTextEditorLines): Integer; override;
20 | procedure Clear; override;
21 | end;
22 |
23 | implementation
24 |
25 | uses
26 | System.SysUtils;
27 |
28 | constructor TTextEditorRegexSearch.Create;
29 | begin
30 | inherited Create;
31 |
32 | FOptions := [roMultiLine, roNotEmpty];
33 | FLengths := TList.Create;
34 | end;
35 |
36 | destructor TTextEditorRegexSearch.Destroy;
37 | begin
38 | FLengths.Free;
39 |
40 | inherited Destroy;
41 | end;
42 |
43 | procedure TTextEditorRegexSearch.CaseSensitiveChanged;
44 | begin
45 | if CaseSensitive then
46 | Exclude(FOptions, roIgnoreCase)
47 | else
48 | Include(FOptions, roIgnoreCase);
49 | end;
50 |
51 | function TTextEditorRegexSearch.SearchAll(const ALines: TTextEditorLines): Integer;
52 |
53 | procedure AddResult(const APos, ALength: Integer);
54 | begin
55 | FResults.Add(APos);
56 | FLengths.Add(ALength);
57 | end;
58 |
59 | var
60 | LRegex: TRegEx;
61 | LMatch: TMatch;
62 | begin
63 | Result := 0;
64 | Clear;
65 | Status := '';
66 | try
67 | LRegex := TRegEx.Create(FPattern, FOptions);
68 | LMatch := LRegex.Match(ALines.Text);
69 |
70 | while LMatch.Success do
71 | begin
72 | AddResult(LMatch.Index, LMatch.Length);
73 | LMatch := LMatch.NextMatch;
74 | Inc(Result);
75 | end;
76 | except
77 | on E: Exception do
78 | Status := E.Message;
79 | end;
80 | end;
81 |
82 | procedure TTextEditorRegexSearch.Clear;
83 | begin
84 | inherited;
85 |
86 | FLengths.Clear;
87 | end;
88 |
89 | function TTextEditorRegexSearch.GetLength(const AIndex: Integer): Integer;
90 | begin
91 | Result := FLengths[AIndex];
92 | end;
93 |
94 | end.
95 |
--------------------------------------------------------------------------------
/Source/TextEditor.Search.Wildcard.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Search.Wildcard;
2 |
3 | interface
4 |
5 | uses
6 | TextEditor.Search.RegularExpressions;
7 |
8 | type
9 | TTextEditorWildcardSearch = class(TTextEditorRegexSearch)
10 | protected
11 | function WildCardToRegExpr(const AWildCard: string): string;
12 | procedure SetPattern(const AValue: string); override;
13 | end;
14 |
15 | implementation
16 |
17 | uses
18 | System.SysUtils;
19 |
20 | procedure TTextEditorWildcardSearch.SetPattern(const AValue: string);
21 | begin
22 | FPattern := WildCardToRegExpr(AValue);
23 | end;
24 |
25 | function TTextEditorWildcardSearch.WildCardToRegExpr(const AWildCard: string): string;
26 | begin
27 | Result := AWildCard;
28 |
29 | Result := StringReplace(Result, '.', '[.]', [rfReplaceAll]);
30 | Result := StringReplace(Result, '*', '.*', [rfReplaceAll]);
31 | Result := StringReplace(Result, '?', '.?', [rfReplaceAll]);
32 | Result := StringReplace(Result, '#', '[0-9]', [rfReplaceAll]);
33 | Result := StringReplace(Result, '\', '\\', [rfReplaceAll]);
34 | Result := StringReplace(Result, '|', '\|', [rfReplaceAll]);
35 | Result := StringReplace(Result, '(', '\(', [rfReplaceAll]);
36 | Result := StringReplace(Result, ')', '\)', [rfReplaceAll]);
37 | Result := StringReplace(Result, '^', '\^', [rfReplaceAll]);
38 | Result := StringReplace(Result, '$', '\$', [rfReplaceAll]);
39 | end;
40 |
41 | end.
42 |
--------------------------------------------------------------------------------
/Source/TextEditor.Selection.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Selection;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Consts, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSelection = class(TPersistent)
10 | strict private
11 | FActiveMode: TTextEditorSelectionMode;
12 | FMode: TTextEditorSelectionMode;
13 | FOnChange: TNotifyEvent;
14 | FOptions: TTextEditorSelectionOptions;
15 | FPrefixCharacters: string;
16 | FVisible: Boolean;
17 | function IsPrefixCharactersStored: Boolean;
18 | procedure DoChange;
19 | procedure SetActiveMode(const AValue: TTextEditorSelectionMode);
20 | procedure SetMode(const AValue: TTextEditorSelectionMode);
21 | procedure SetOptions(const AValue: TTextEditorSelectionOptions);
22 | procedure SetVisible(const AValue: Boolean);
23 | public
24 | constructor Create;
25 | procedure Assign(ASource: TPersistent); override;
26 | procedure SetOption(const AOption: TTextEditorSelectionOption; const AEnabled: Boolean);
27 | property ActiveMode: TTextEditorSelectionMode read FActiveMode write SetActiveMode stored False;
28 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
29 | published
30 | property Mode: TTextEditorSelectionMode read FMode write SetMode default smNormal;
31 | property Options: TTextEditorSelectionOptions read FOptions write SetOptions default [soHighlightSimilarTerms, soTermsCaseSensitive];
32 | property PrefixCharacters: string read FPrefixCharacters write FPrefixCharacters stored IsPrefixCharactersStored;
33 | property Visible: Boolean read FVisible write SetVisible default True;
34 | end;
35 |
36 | implementation
37 |
38 | constructor TTextEditorSelection.Create;
39 | begin
40 | inherited;
41 |
42 | FActiveMode := smNormal;
43 | FMode := smNormal;
44 | FOptions := [soHighlightSimilarTerms, soTermsCaseSensitive];
45 | FPrefixCharacters := TCharacterSets.DefaultSelectionPrefix;
46 | FVisible := True;
47 | end;
48 |
49 | procedure TTextEditorSelection.Assign(ASource: TPersistent);
50 | begin
51 | if Assigned(ASource) and (ASource is TTextEditorSelection) then
52 | with ASource as TTextEditorSelection do
53 | begin
54 | Self.FActiveMode := FActiveMode;
55 | Self.FMode := FMode;
56 | Self.FOptions := FOptions;
57 | Self.FVisible := FVisible;
58 |
59 | if Assigned(Self.FOnChange) then
60 | Self.FOnChange(Self);
61 | end
62 | else
63 | inherited Assign(ASource);
64 | end;
65 |
66 | function TTextEditorSelection.IsPrefixCharactersStored: Boolean;
67 | begin
68 | Result := FPrefixCharacters <> TCharacterSets.DefaultSelectionPrefix;
69 | end;
70 |
71 | procedure TTextEditorSelection.SetOption(const AOption: TTextEditorSelectionOption; const AEnabled: Boolean);
72 | begin
73 | if AEnabled then
74 | Include(FOptions, AOption)
75 | else
76 | Exclude(FOptions, AOption);
77 | end;
78 |
79 | procedure TTextEditorSelection.DoChange;
80 | begin
81 | if Assigned(FOnChange) then
82 | FOnChange(Self);
83 | end;
84 |
85 | procedure TTextEditorSelection.SetMode(const AValue: TTextEditorSelectionMode);
86 | begin
87 | if FMode <> AValue then
88 | begin
89 | FMode := AValue;
90 | ActiveMode := AValue;
91 |
92 | DoChange;
93 | end;
94 | end;
95 |
96 | procedure TTextEditorSelection.SetActiveMode(const AValue: TTextEditorSelectionMode);
97 | begin
98 | if FActiveMode <> AValue then
99 | begin
100 | FActiveMode := AValue;
101 |
102 | DoChange;
103 | end;
104 | end;
105 |
106 | procedure TTextEditorSelection.SetVisible(const AValue: Boolean);
107 | begin
108 | if FVisible <> AValue then
109 | begin
110 | FVisible := AValue;
111 |
112 | DoChange;
113 | end;
114 | end;
115 |
116 | procedure TTextEditorSelection.SetOptions(const AValue: TTextEditorSelectionOptions);
117 | begin
118 | if FOptions <> AValue then
119 | begin
120 | FOptions := AValue;
121 |
122 | DoChange;
123 | end;
124 | end;
125 |
126 | end.
127 |
--------------------------------------------------------------------------------
/Source/TextEditor.SkipRegions.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.SkipRegions;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.SysUtils, TextEditor.Consts;
7 |
8 | type
9 | TTextEditorSkipRegionItemType = (ritUnspecified, ritMultiLineString, ritSingleLineString, ritMultiLineComment, ritSingleLineComment);
10 |
11 | TTextEditorSkipRegionItem = class(TCollectionItem)
12 | strict private
13 | FCloseToken: string;
14 | FOpenToken: string;
15 | FRegionType: TTextEditorSkipRegionItemType;
16 | FSkipEmptyChars: Boolean;
17 | FSkipIfNextCharIsNot: Char;
18 | public
19 | property OpenToken: string read FOpenToken write FOpenToken;
20 | property CloseToken: string read FCloseToken write FCloseToken;
21 | property RegionType: TTextEditorSkipRegionItemType read FRegionType write FRegionType;
22 | property SkipEmptyChars: Boolean read FSkipEmptyChars write FSkipEmptyChars;
23 | property SkipIfNextCharIsNot: Char read FSkipIfNextCharIsNot write FSkipIfNextCharIsNot default TControlCharacters.Null;
24 | end;
25 |
26 | TTextEditorSkipRegions = class(TCollection)
27 | strict private
28 | function GetSkipRegionItem(const AIndex: Integer): TTextEditorSkipRegionItem;
29 | public
30 | function Add(const AOpenToken, ACloseToken: string): TTextEditorSkipRegionItem;
31 | function Contains(const AOpenToken, ACloseToken: string): Boolean;
32 | property SkipRegionItems[const AIndex: Integer]: TTextEditorSkipRegionItem read GetSkipRegionItem; default;
33 | end;
34 |
35 | implementation
36 |
37 | { TTextEditorSkipRegions }
38 |
39 | function TTextEditorSkipRegions.Add(const AOpenToken, ACloseToken: string): TTextEditorSkipRegionItem;
40 | begin
41 | Result := TTextEditorSkipRegionItem(inherited Add);
42 |
43 | with Result do
44 | begin
45 | OpenToken := AOpenToken;
46 | CloseToken := ACloseToken;
47 | end;
48 | end;
49 |
50 | function TTextEditorSkipRegions.Contains(const AOpenToken, ACloseToken: string): Boolean;
51 | var
52 | LIndex: Integer;
53 | LSkipRegion: TTextEditorSkipRegionItem;
54 | begin
55 | Result := False;
56 |
57 | for LIndex := 0 to Count - 1 do
58 | begin
59 | LSkipRegion := SkipRegionItems[LIndex];
60 |
61 | if (LSkipRegion.OpenToken = AOpenToken) and (LSkipRegion.CloseToken = ACloseToken) then
62 | Exit(True);
63 | end;
64 | end;
65 |
66 | function TTextEditorSkipRegions.GetSkipRegionItem(const AIndex: Integer): TTextEditorSkipRegionItem;
67 | begin
68 | Result := TTextEditorSkipRegionItem(inherited Items[AIndex]);
69 | end;
70 |
71 | end.
72 |
--------------------------------------------------------------------------------
/Source/TextEditor.SpecialChars.LineBreak.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.SpecialChars.LineBreak;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSpecialCharsLineBreak = class(TPersistent)
10 | strict private
11 | FColor: TColor;
12 | FOnChange: TNotifyEvent;
13 | FStyle: TTextEditorSpecialCharsLineBreakStyle;
14 | FVisible: Boolean;
15 | procedure DoChange;
16 | procedure SetColor(const AValue: TColor);
17 | procedure SetStyle(const AValue: TTextEditorSpecialCharsLineBreakStyle);
18 | procedure SetVisible(const AValue: Boolean);
19 | public
20 | constructor Create;
21 | procedure Assign(ASource: TPersistent); override;
22 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
23 | published
24 | property Color: TColor read FColor write SetColor default TColors.Black;
25 | property Style: TTextEditorSpecialCharsLineBreakStyle read FStyle write SetStyle default eolArrow;
26 | property Visible: Boolean read FVisible write SetVisible default False;
27 | end;
28 |
29 | implementation
30 |
31 | constructor TTextEditorSpecialCharsLineBreak.Create;
32 | begin
33 | inherited;
34 |
35 | FColor := TColors.Black;
36 | FStyle := eolArrow;
37 | FVisible := False;
38 | end;
39 |
40 | procedure TTextEditorSpecialCharsLineBreak.Assign(ASource: TPersistent);
41 | begin
42 | if Assigned(ASource) and (ASource is TTextEditorSpecialCharsLineBreak) then
43 | with ASource as TTextEditorSpecialCharsLineBreak do
44 | begin
45 | Self.FColor := FColor;
46 | Self.FStyle := FStyle;
47 | Self.FVisible := FVisible;
48 |
49 | Self.DoChange;
50 | end
51 | else
52 | inherited Assign(ASource);
53 | end;
54 |
55 | procedure TTextEditorSpecialCharsLineBreak.DoChange;
56 | begin
57 | if Assigned(FOnChange) then
58 | FOnChange(Self);
59 | end;
60 |
61 | procedure TTextEditorSpecialCharsLineBreak.SetColor(const AValue: TColor);
62 | begin
63 | if FColor <> AValue then
64 | begin
65 | FColor := AValue;
66 |
67 | DoChange;
68 | end;
69 | end;
70 |
71 | procedure TTextEditorSpecialCharsLineBreak.SetStyle(const AValue: TTextEditorSpecialCharsLineBreakStyle);
72 | begin
73 | if FStyle <> AValue then
74 | begin
75 | FStyle := AValue;
76 |
77 | DoChange;
78 | end;
79 | end;
80 |
81 | procedure TTextEditorSpecialCharsLineBreak.SetVisible(const AValue: Boolean);
82 | begin
83 | if FVisible <> AValue then
84 | begin
85 | FVisible := AValue;
86 |
87 | DoChange;
88 | end;
89 | end;
90 |
91 | end.
92 |
--------------------------------------------------------------------------------
/Source/TextEditor.SpecialChars.Selection.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.SpecialChars.Selection;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes;
7 |
8 | type
9 | TTextEditorSpecialCharsSelection = class(TPersistent)
10 | strict private
11 | FColor: TColor;
12 | FOnChange: TNotifyEvent;
13 | FVisible: Boolean;
14 | procedure DoChange;
15 | procedure SetColor(const AValue: TColor);
16 | procedure SetVisible(const AValue: Boolean);
17 | public
18 | constructor Create;
19 | procedure Assign(ASource: TPersistent); override;
20 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
21 | published
22 | property Color: TColor read FColor write SetColor default TColors.Black;
23 | property Visible: Boolean read FVisible write SetVisible default False;
24 | end;
25 |
26 | implementation
27 |
28 | constructor TTextEditorSpecialCharsSelection.Create;
29 | begin
30 | inherited;
31 |
32 | FColor := TColors.Black;
33 | FVisible := False;
34 | end;
35 |
36 | procedure TTextEditorSpecialCharsSelection.Assign(ASource: TPersistent);
37 | begin
38 | if Assigned(ASource) and (ASource is TTextEditorSpecialCharsSelection) then
39 | with ASource as TTextEditorSpecialCharsSelection do
40 | begin
41 | Self.FColor := FColor;
42 | Self.FVisible := FVisible;
43 |
44 | Self.DoChange;
45 | end
46 | else
47 | inherited Assign(ASource);
48 | end;
49 |
50 | procedure TTextEditorSpecialCharsSelection.DoChange;
51 | begin
52 | if Assigned(FOnChange) then
53 | FOnChange(Self);
54 | end;
55 |
56 | procedure TTextEditorSpecialCharsSelection.SetColor(const AValue: TColor);
57 | begin
58 | if FColor <> AValue then
59 | begin
60 | FColor := AValue;
61 |
62 | DoChange;
63 | end;
64 | end;
65 |
66 | procedure TTextEditorSpecialCharsSelection.SetVisible(const AValue: Boolean);
67 | begin
68 | if FVisible <> AValue then
69 | begin
70 | FVisible := AValue;
71 |
72 | DoChange;
73 | end;
74 | end;
75 |
76 | end.
77 |
--------------------------------------------------------------------------------
/Source/TextEditor.SpecialChars.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.SpecialChars;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, System.UITypes, TextEditor.SpecialChars.LineBreak, TextEditor.SpecialChars.Selection, TextEditor.Types;
7 |
8 | type
9 | TTextEditorSpecialChars = class(TPersistent)
10 | strict private
11 | FColor: TColor;
12 | FLineBreak: TTextEditorSpecialCharsLineBreak;
13 | FOnChange: TNotifyEvent;
14 | FOptions: TTextEditorSpecialCharsOptions;
15 | FSelection: TTextEditorSpecialCharsSelection;
16 | FStyle: TTextEditorSpecialCharsStyle;
17 | FVisible: Boolean;
18 | procedure DoChange;
19 | procedure SetColor(const AValue: TColor);
20 | procedure SetLineBreak(const AValue: TTextEditorSpecialCharsLineBreak);
21 | procedure SetOnChange(const AValue: TNotifyEvent);
22 | procedure SetOptions(const AValue: TTextEditorSpecialCharsOptions);
23 | procedure SetSelection(const AValue: TTextEditorSpecialCharsSelection);
24 | procedure SetStyle(const AValue: TTextEditorSpecialCharsStyle);
25 | procedure SetVisible(const AValue: Boolean);
26 | public
27 | constructor Create;
28 | destructor Destroy; override;
29 | procedure Assign(ASource: TPersistent); override;
30 | procedure SetOption(const AOption: TTextEditorSpecialCharsOption; const AEnabled: Boolean);
31 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
32 | published
33 | property Color: TColor read FColor write SetColor default TColors.Black;
34 | property LineBreak: TTextEditorSpecialCharsLineBreak read FLineBreak write SetLineBreak;
35 | property Options: TTextEditorSpecialCharsOptions read FOptions write SetOptions default [scoMiddleColor];
36 | property Selection: TTextEditorSpecialCharsSelection read FSelection write SetSelection;
37 | property Style: TTextEditorSpecialCharsStyle read FStyle write SetStyle default scsDot;
38 | property Visible: Boolean read FVisible write SetVisible default False;
39 | end;
40 |
41 | implementation
42 |
43 | constructor TTextEditorSpecialChars.Create;
44 | begin
45 | inherited;
46 |
47 | FColor := TColors.Black;
48 | FLineBreak := TTextEditorSpecialCharsLineBreak.Create;
49 | FSelection := TTextEditorSpecialCharsSelection.Create;
50 | FVisible := False;
51 | FOptions := [scoMiddleColor];
52 | FStyle := scsDot;
53 | end;
54 |
55 | destructor TTextEditorSpecialChars.Destroy;
56 | begin
57 | FLineBreak.Free;
58 | FSelection.Free;
59 |
60 | inherited Destroy;
61 | end;
62 |
63 | procedure TTextEditorSpecialChars.SetOnChange(const AValue: TNotifyEvent);
64 | begin
65 | FOnChange := AValue;
66 | FLineBreak.OnChange := FOnChange;
67 | FSelection.OnChange := FOnChange;
68 | end;
69 |
70 | procedure TTextEditorSpecialChars.Assign(ASource: TPersistent);
71 | begin
72 | if Assigned(ASource) and (ASource is TTextEditorSpecialChars) then
73 | with ASource as TTextEditorSpecialChars do
74 | begin
75 | Self.FColor := FColor;
76 | Self.FLineBreak.Assign(FLineBreak);
77 | Self.FOptions := FOptions;
78 | Self.FSelection.Assign(FSelection);
79 | Self.FVisible := FVisible;
80 |
81 | Self.DoChange;
82 | end
83 | else
84 | inherited Assign(ASource);
85 | end;
86 |
87 | procedure TTextEditorSpecialChars.SetOption(const AOption: TTextEditorSpecialCharsOption; const AEnabled: Boolean);
88 | begin
89 | if AEnabled then
90 | Include(FOptions, AOption)
91 | else
92 | Exclude(FOptions, AOption);
93 | end;
94 |
95 | procedure TTextEditorSpecialChars.DoChange;
96 | begin
97 | if Assigned(FOnChange) then
98 | FOnChange(Self);
99 | end;
100 |
101 | procedure TTextEditorSpecialChars.SetColor(const AValue: TColor);
102 | begin
103 | if FColor <> AValue then
104 | begin
105 | FColor := AValue;
106 |
107 | DoChange;
108 | end;
109 | end;
110 |
111 | procedure TTextEditorSpecialChars.SetLineBreak(const AValue: TTextEditorSpecialCharsLineBreak);
112 | begin
113 | FLineBreak.Assign(AValue);
114 | end;
115 |
116 | procedure TTextEditorSpecialChars.SetSelection(const AValue: TTextEditorSpecialCharsSelection);
117 | begin
118 | FSelection.Assign(AValue);
119 | end;
120 |
121 | procedure TTextEditorSpecialChars.SetVisible(const AValue: Boolean);
122 | begin
123 | if FVisible <> AValue then
124 | begin
125 | FVisible := AValue;
126 |
127 | DoChange;
128 | end;
129 | end;
130 |
131 | procedure TTextEditorSpecialChars.SetStyle(const AValue: TTextEditorSpecialCharsStyle);
132 | begin
133 | if FStyle <> AValue then
134 | begin
135 | FStyle := AValue;
136 |
137 | DoChange;
138 | end;
139 | end;
140 |
141 | procedure TTextEditorSpecialChars.SetOptions(const AValue: TTextEditorSpecialCharsOptions);
142 | var
143 | LValue: TTextEditorSpecialCharsOptions;
144 | begin
145 | LValue := AValue;
146 |
147 | if FOptions <> LValue then
148 | begin
149 | if scoTextColor in LValue then
150 | Exclude(LValue, scoMiddleColor);
151 |
152 | if scoMiddleColor in LValue then
153 | Exclude(LValue, scoTextColor);
154 |
155 | FOptions := LValue;
156 | DoChange;
157 | end;
158 | end;
159 |
160 | end.
161 |
--------------------------------------------------------------------------------
/Source/TextEditor.Splash.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Splash;
2 |
3 | interface
4 |
5 | implementation
6 |
7 | {$R TextEditor.res}
8 |
9 | uses
10 | Winapi.Windows, ToolsAPI;
11 |
12 | const
13 | TEXT_EDITOR_VERSION = '1.0.0';
14 |
15 | procedure Init;
16 | begin
17 | SplashScreenServices.AddPluginBitmap('Text Editor ' + TEXT_EDITOR_VERSION,
18 | LoadBitmap(FindResourceHInstance(HInstance), 'TTEXTEDITOR'), False, '');
19 | end;
20 |
21 | initialization
22 |
23 | Init;
24 |
25 | finalization
26 |
27 | end.
28 |
--------------------------------------------------------------------------------
/Source/TextEditor.Tabs.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Tabs;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | const
9 | TEXTEDITOR_DEFAULT_TAB_OPTIONS = [toColumns, toSelectedBlockIndent];
10 |
11 | type
12 | TTextEditorTabs = class(TPersistent)
13 | strict private
14 | FOnChange: TNotifyEvent;
15 | FOptions: TTextEditorTabOptions;
16 | FWantTabs: Boolean;
17 | FWidth: Integer;
18 | procedure DoChange;
19 | procedure SetOptions(const AValue: TTextEditorTabOptions);
20 | procedure SetWantTabs(const AValue: Boolean);
21 | procedure SetWidth(const AValue: Integer);
22 | public
23 | constructor Create;
24 | procedure Assign(ASource: TPersistent); override;
25 | procedure SetOption(const AOption: TTextEditorTabOption; const AEnabled: Boolean);
26 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
27 | published
28 | property Options: TTextEditorTabOptions read FOptions write SetOptions default TEXTEDITOR_DEFAULT_TAB_OPTIONS;
29 | property WantTabs: Boolean read FWantTabs write SetWantTabs default True;
30 | property Width: Integer read FWidth write SetWidth default 2;
31 | end;
32 |
33 | implementation
34 |
35 | uses
36 | System.Math;
37 |
38 | constructor TTextEditorTabs.Create;
39 | begin
40 | inherited;
41 |
42 | FOptions := TEXTEDITOR_DEFAULT_TAB_OPTIONS;
43 | FWantTabs := True;
44 | FWidth := 2;
45 | end;
46 |
47 | procedure TTextEditorTabs.DoChange;
48 | begin
49 | if Assigned(FOnChange) then
50 | FOnChange(Self);
51 | end;
52 |
53 | procedure TTextEditorTabs.Assign(ASource: TPersistent);
54 | begin
55 | if Assigned(ASource) and (ASource is TTextEditorTabs) then
56 | with ASource as TTextEditorTabs do
57 | begin
58 | Self.FOptions := FOptions;
59 | Self.FWantTabs := FWantTabs;
60 | Self.FWidth := FWidth;
61 |
62 | Self.DoChange;
63 | end
64 | else
65 | inherited Assign(ASource);
66 | end;
67 |
68 | procedure TTextEditorTabs.SetOption(const AOption: TTextEditorTabOption; const AEnabled: Boolean);
69 | begin
70 | if AEnabled then
71 | Include(FOptions, AOption)
72 | else
73 | Exclude(FOptions, AOption);
74 | end;
75 |
76 | procedure TTextEditorTabs.SetOptions(const AValue: TTextEditorTabOptions);
77 | begin
78 | if FOptions <> AValue then
79 | begin
80 | FOptions := AValue;
81 |
82 | DoChange;
83 | end;
84 | end;
85 |
86 | procedure TTextEditorTabs.SetWidth(const AValue: Integer);
87 | var
88 | LValue: Integer;
89 | begin
90 | LValue := EnsureRange(AValue, 1, 256);
91 |
92 | if FWidth <> LValue then
93 | begin
94 | FWidth := LValue;
95 |
96 | DoChange;
97 | end;
98 | end;
99 |
100 | procedure TTextEditorTabs.SetWantTabs(const AValue: Boolean);
101 | begin
102 | if FWantTabs <> AValue then
103 | begin
104 | FWantTabs := AValue;
105 |
106 | DoChange;
107 | end;
108 | end;
109 |
110 | end.
111 |
--------------------------------------------------------------------------------
/Source/TextEditor.TextFolding.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.TextFolding;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | type
9 | TTextEditorTextFolding = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FOutlinedBySpacesAndTabs: Boolean;
13 | FOutlineCharacter: Char;
14 | public
15 | constructor Create;
16 | procedure Assign(ASource: TPersistent); override;
17 | published
18 | property Active: Boolean read FActive write FActive default False;
19 | property OutlinedBySpacesAndTabs: Boolean read FOutlinedBySpacesAndTabs write FOutlinedBySpacesAndTabs default True;
20 | property OutlineCharacter: Char read FOutlineCharacter write FOutlineCharacter default '.';
21 | end;
22 |
23 | implementation
24 |
25 | constructor TTextEditorTextFolding.Create;
26 | begin
27 | inherited;
28 |
29 | FActive := False;
30 | FOutlinedBySpacesAndTabs := True;
31 | FOutlineCharacter := '.';
32 | end;
33 |
34 | procedure TTextEditorTextFolding.Assign(ASource: TPersistent);
35 | begin
36 | if Assigned(ASource) and (ASource is TTextEditorTextFolding) then
37 | with ASource as TTextEditorTextFolding do
38 | begin
39 | Self.FActive := FActive;
40 | Self.FOutlinedBySpacesAndTabs := FOutlinedBySpacesAndTabs;
41 | Self.FOutlineCharacter := FOutlineCharacter;
42 | end
43 | else
44 | inherited Assign(ASource);
45 | end;
46 |
47 | end.
48 |
--------------------------------------------------------------------------------
/Source/TextEditor.Undo.Item.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Undo.Item;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorUndoItem = class(TPersistent)
10 | protected
11 | FChangeBeginPosition: TTextEditorTextPosition;
12 | FChangeBlockNumber: Integer;
13 | FChangeCaretPosition: TTextEditorTextPosition;
14 | FChangeData: Pointer;
15 | FChangeEndPosition: TTextEditorTextPosition;
16 | FChangeReason: TTextEditorChangeReason;
17 | FChangeSelectionMode: TTextEditorSelectionMode;
18 | FChangeString: string;
19 | public
20 | procedure Assign(ASource: TPersistent); override;
21 | property ChangeBeginPosition: TTextEditorTextPosition read FChangeBeginPosition write FChangeBeginPosition;
22 | property ChangeBlockNumber: Integer read FChangeBlockNumber write FChangeBlockNumber;
23 | property ChangeCaretPosition: TTextEditorTextPosition read FChangeCaretPosition write FChangeCaretPosition;
24 | property ChangeData: Pointer read FChangeData write FChangeData;
25 | property ChangeEndPosition: TTextEditorTextPosition read FChangeEndPosition write FChangeEndPosition;
26 | property ChangeReason: TTextEditorChangeReason read FChangeReason write FChangeReason;
27 | property ChangeSelectionMode: TTextEditorSelectionMode read FChangeSelectionMode write FChangeSelectionMode;
28 | property ChangeString: string read FChangeString write FChangeString;
29 | end;
30 |
31 | implementation
32 |
33 | procedure TTextEditorUndoItem.Assign(ASource: TPersistent);
34 | begin
35 | if Assigned(ASource) and (ASource is TTextEditorUndoItem) then
36 | with ASource as TTextEditorUndoItem do
37 | begin
38 | Self.FChangeBeginPosition := FChangeBeginPosition;
39 | Self.FChangeBlockNumber := FChangeBlockNumber;
40 | Self.FChangeCaretPosition := FChangeCaretPosition;
41 | Self.FChangeData := FChangeData;
42 | Self.FChangeEndPosition := FChangeEndPosition;
43 | Self.FChangeReason := FChangeReason;
44 | Self.FChangeSelectionMode := FChangeSelectionMode;
45 | Self.FChangeString := FChangeString;
46 | end
47 | else
48 | inherited Assign(ASource);
49 | end;
50 |
51 | end.
52 |
--------------------------------------------------------------------------------
/Source/TextEditor.Undo.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.Undo;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, TextEditor.Types;
7 |
8 | type
9 | TTextEditorUndo = class(TPersistent)
10 | strict private
11 | FOptions: TTextEditorUndoOptions;
12 | procedure SetOptions(const AValue: TTextEditorUndoOptions);
13 | public
14 | constructor Create;
15 | procedure Assign(ASource: TPersistent); override;
16 | procedure SetOption(const AOption: TTextEditorUndoOption; const AEnabled: Boolean);
17 | published
18 | property Options: TTextEditorUndoOptions read FOptions write SetOptions default [uoGroupUndo];
19 | end;
20 |
21 | implementation
22 |
23 | constructor TTextEditorUndo.Create;
24 | begin
25 | inherited;
26 |
27 | FOptions := [uoGroupUndo];
28 | end;
29 |
30 | procedure TTextEditorUndo.Assign(ASource: TPersistent);
31 | begin
32 | if Assigned(ASource) and (ASource is TTextEditorUndo) then
33 | with ASource as TTextEditorUndo do
34 | Self.FOptions := FOptions
35 | else
36 | inherited Assign(ASource);
37 | end;
38 |
39 | procedure TTextEditorUndo.SetOption(const AOption: TTextEditorUndoOption; const AEnabled: Boolean);
40 | begin
41 | if AEnabled then
42 | Include(FOptions, AOption)
43 | else
44 | Exclude(FOptions, AOption);
45 | end;
46 |
47 | procedure TTextEditorUndo.SetOptions(const AValue: TTextEditorUndoOptions);
48 | begin
49 | if FOptions <> AValue then
50 | FOptions := AValue;
51 | end;
52 |
53 | end.
--------------------------------------------------------------------------------
/Source/TextEditor.UnknownChars.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.UnknownChars;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes;
7 |
8 | type
9 | TTextEditorUnknownChars = class(TPersistent)
10 | strict private
11 | FOnChange: TNotifyEvent;
12 | FReplaceChar: AnsiChar;
13 | FVisible: Boolean;
14 | procedure DoChange;
15 | procedure SetVisible(const AValue: Boolean);
16 | public
17 | constructor Create;
18 | procedure Assign(ASource: TPersistent); override;
19 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
20 | published
21 | property ReplaceChar: AnsiChar read FReplaceChar write FReplaceChar default '?';
22 | property Visible: Boolean read FVisible write SetVisible default True;
23 | end;
24 |
25 | implementation
26 |
27 | constructor TTextEditorUnknownChars.Create;
28 | begin
29 | inherited;
30 |
31 | FReplaceChar := '?';
32 | FVisible := True;
33 | end;
34 |
35 | procedure TTextEditorUnknownChars.Assign(ASource: TPersistent);
36 | begin
37 | if Assigned(ASource) and (ASource is TTextEditorUnknownChars) then
38 | with ASource as TTextEditorUnknownChars do
39 | begin
40 | Self.FReplaceChar := FReplaceChar;
41 | Self.FVisible := FVisible;
42 | end
43 | else
44 | inherited Assign(ASource);
45 | end;
46 |
47 | procedure TTextEditorUnknownChars.DoChange;
48 | begin
49 | if Assigned(FOnChange) then
50 | FOnChange(Self);
51 | end;
52 |
53 | procedure TTextEditorUnknownChars.SetVisible(const AValue: Boolean);
54 | begin
55 | if FVisible <> AValue then
56 | begin
57 | FVisible := AValue;
58 |
59 | DoChange;
60 | end;
61 | end;
62 |
63 | end.
64 |
--------------------------------------------------------------------------------
/Source/TextEditor.WordWrap.pas:
--------------------------------------------------------------------------------
1 | unit TextEditor.WordWrap;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, Vcl.Graphics, TextEditor.Glyph, TextEditor.Types;
7 |
8 | type
9 | TTextEditorWordWrap = class(TPersistent)
10 | strict private
11 | FActive: Boolean;
12 | FBitmap: Vcl.Graphics.TBitmap;
13 | FIndicator: TTextEditorGlyph;
14 | FOnChange: TNotifyEvent;
15 | FWidth: TTextEditorWordWrapWidth;
16 | procedure DoChange;
17 | procedure SetActive(const AValue: Boolean);
18 | procedure SetIndicator(const AValue: TTextEditorGlyph);
19 | procedure SetOnChange(const AValue: TNotifyEvent);
20 | procedure SetWidth(const AValue: TTextEditorWordWrapWidth);
21 | public
22 | constructor Create;
23 | destructor Destroy; override;
24 | procedure Assign(ASource: TPersistent); override;
25 | procedure CreateIndicatorBitmap(const AArrowColor: TColor; const ALineColor: TColor);
26 | procedure FreeIndicatorBitmap;
27 | property OnChange: TNotifyEvent read FOnChange write SetOnChange;
28 | published
29 | property Active: Boolean read FActive write SetActive default False;
30 | property Indicator: TTextEditorGlyph read FIndicator write SetIndicator;
31 | property Width: TTextEditorWordWrapWidth read FWidth write SetWidth default wwwPage;
32 | end;
33 |
34 | implementation
35 |
36 | uses
37 | System.UITypes;
38 |
39 | constructor TTextEditorWordWrap.Create;
40 | begin
41 | inherited;
42 |
43 | FActive := False;
44 | FIndicator := TTextEditorGlyph.Create(HInstance, '', TColors.Fuchsia);
45 | FWidth := wwwPage;
46 | FBitmap := nil;
47 | end;
48 |
49 | destructor TTextEditorWordWrap.Destroy;
50 | begin
51 | FreeIndicatorBitmap;
52 |
53 | FIndicator.Free;
54 |
55 | inherited;
56 | end;
57 |
58 | procedure TTextEditorWordWrap.Assign(ASource: TPersistent);
59 | begin
60 | if Assigned(ASource) and (ASource is TTextEditorWordWrap) then
61 | with ASource as TTextEditorWordWrap do
62 | begin
63 | Self.FActive := FActive;
64 | Self.FWidth := FWidth;
65 | Self.FIndicator.Assign(FIndicator);
66 |
67 | Self.DoChange;
68 | end
69 | else
70 | inherited Assign(ASource);
71 | end;
72 |
73 | procedure TTextEditorWordWrap.FreeIndicatorBitmap;
74 | begin
75 | if Assigned(FBitmap) then
76 | begin
77 | FBitmap.Free;
78 | FBitmap := nil;
79 | end;
80 | end;
81 |
82 | procedure TTextEditorWordWrap.CreateIndicatorBitmap(const AArrowColor: TColor; const ALineColor: TColor);
83 | begin
84 | if Assigned(FBitmap) then
85 | Exit;
86 |
87 | FBitmap := Vcl.Graphics.TBitmap.Create;
88 |
89 | with FBitmap do
90 | begin
91 | Canvas.Brush.Color := TColors.Fuchsia;
92 | Width := 15;
93 | Height := 14;
94 | Canvas.Pen.Color := AArrowColor;
95 | Canvas.MoveTo(6, 4);
96 | Canvas.LineTo(13, 4);
97 | Canvas.MoveTo(13, 5);
98 | Canvas.LineTo(13, 9);
99 | Canvas.MoveTo(12, 9);
100 | Canvas.LineTo(7, 9);
101 | Canvas.MoveTo(10, 7);
102 | Canvas.LineTo(10, 12);
103 | Canvas.MoveTo(9, 8);
104 | Canvas.LineTo(9, 11);
105 | Canvas.Pen.Color := ALineColor;
106 | Canvas.MoveTo(2, 6);
107 | Canvas.LineTo(7, 6);
108 | Canvas.MoveTo(2, 8);
109 | Canvas.LineTo(5, 8);
110 | Canvas.MoveTo(2, 10);
111 | Canvas.LineTo(5, 10);
112 | Canvas.MoveTo(2, 12);
113 | Canvas.LineTo(7, 12);
114 | end;
115 |
116 | FIndicator.MaskColor := TColors.Fuchsia;
117 | FIndicator.Bitmap.Handle := FBitmap.Handle;
118 | end;
119 |
120 | procedure TTextEditorWordWrap.SetOnChange(const AValue: TNotifyEvent);
121 | begin
122 | FOnChange := AValue;
123 | FIndicator.OnChange := AValue;
124 | end;
125 |
126 | procedure TTextEditorWordWrap.DoChange;
127 | begin
128 | if Assigned(FOnChange) then
129 | FOnChange(Self);
130 | end;
131 |
132 | procedure TTextEditorWordWrap.SetActive(const AValue: Boolean);
133 | begin
134 | if FActive <> AValue then
135 | begin
136 | FActive := AValue;
137 |
138 | DoChange;
139 | end;
140 | end;
141 |
142 | procedure TTextEditorWordWrap.SetIndicator(const AValue: TTextEditorGlyph);
143 | begin
144 | FIndicator.Assign(AValue);
145 | end;
146 |
147 | procedure TTextEditorWordWrap.SetWidth(const AValue: TTextEditorWordWrapWidth);
148 | begin
149 | if FWidth <> AValue then
150 | begin
151 | FWidth := AValue;
152 |
153 | DoChange;
154 | end;
155 | end;
156 |
157 | end.
158 |
--------------------------------------------------------------------------------
/Source/TextEditor.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TextEditorPro/TTextEditor/3f9434abe99bf1f56494451bb0fcc359b9efdd10/Source/TextEditor.res
--------------------------------------------------------------------------------
/Themes/Visual Studio.json:
--------------------------------------------------------------------------------
1 | {
2 | "Theme": {
3 | "Colors": {
4 | "ActiveLineBackground": "$00F0FFFF",
5 | "ActiveLineBackgroundUnfocused": "$00FCFCFC",
6 | "ActiveLineForeground": "clNone",
7 | "ActiveLineForegroundUnfocused": "clNone",
8 | "CaretMultiEditBackground": "clBlack",
9 | "CaretMultiEditForeground": "clWhite",
10 | "CodeFoldingActiveLineBackground": "$00F0FFFF",
11 | "CodeFoldingActiveLineBackgroundUnfocused": "$00FCFCFC",
12 | "CodeFoldingBackground": "clWhite",
13 | "CodeFoldingCollapsedLine": "clGray",
14 | "CodeFoldingFoldingLine": "clGray",
15 | "CodeFoldingFoldingLineHighlight": "clGray",
16 | "CodeFoldingHintBackground": "clWhite",
17 | "CodeFoldingHintBorder": "clGray",
18 | "CodeFoldingHintIndicatorBackground": "clWhite",
19 | "CodeFoldingHintIndicatorBorder": "clGray",
20 | "CodeFoldingHintIndicatorMark": "clGray",
21 | "CodeFoldingHintText": "clNone",
22 | "CodeFoldingIndent": "clGray",
23 | "CodeFoldingIndentHighlight": "clBlack",
24 | "CompletionProposalBackground": "clWhite",
25 | "CompletionProposalForeground": "clBlack",
26 | "CompletionProposalSelectedBackground": "clHighlight",
27 | "CompletionProposalSelectedText": "clHighlightText",
28 | "EditorAssemblerCommentBackground": "clWhite",
29 | "EditorAssemblerCommentForeground": "clGreen",
30 | "EditorAssemblerReservedWordBackground": "clWhite",
31 | "EditorAssemblerReservedWordForeground": "clBlue",
32 | "EditorAttributeBackground": "clWhite",
33 | "EditorAttributeForeground": "clMaroon",
34 | "EditorBackground": "clWhite",
35 | "EditorCharacterBackground": "clWhite",
36 | "EditorCharacterForeground": "clBlue",
37 | "EditorCommentBackground": "clWhite",
38 | "EditorCommentForeground": "clGreen",
39 | "EditorDirectiveBackground": "clWhite",
40 | "EditorDirectiveForeground": "clBlue",
41 | "EditorForeground": "clBlack",
42 | "EditorHexNumberBackground": "clWhite",
43 | "EditorHexNumberForeground": "clBlue",
44 | "EditorHighlightedBlockBackground": "clWhite",
45 | "EditorHighlightedBlockForeground": "clBlack",
46 | "EditorHighlightedBlockSymbolBackground": "clWhite",
47 | "EditorHighlightedBlockSymbolForeground": "clBlack",
48 | "EditorLogicalOperatorBackground": "clWhite",
49 | "EditorLogicalOperatorForeground": "clBlue",
50 | "EditorMethodBackground": "clWhite",
51 | "EditorMethodForeground": "clBlue",
52 | "EditorMethodItalicBackground": "clWhite",
53 | "EditorMethodItalicForeground": "clBlue",
54 | "EditorMethodNameBackground": "clWhite",
55 | "EditorMethodNameForeground": "clBlack",
56 | "EditorNumberBackground": "clWhite",
57 | "EditorNumberForeground": "clBlue",
58 | "EditorReservedWordBackground": "clWhite",
59 | "EditorReservedWordForeground": "clBlue",
60 | "EditorStringBackground": "clWhite",
61 | "EditorStringForeground": "clBlue",
62 | "EditorSymbolBackground": "clWhite",
63 | "EditorSymbolForeground": "clBlack",
64 | "EditorValueBackground": "clWhite",
65 | "EditorValueForeground": "clBlue",
66 | "EditorWebLinkBackground": "clWhite",
67 | "EditorWebLinkForeground": "clBlue",
68 | "LeftMarginActiveLineBackground": "$00F0FFFF",
69 | "LeftMarginActiveLineBackgroundUnfocused": "$00FCFCFC",
70 | "LeftMarginActiveLineNumber": "clGray",
71 | "LeftMarginBackground": "clWhite",
72 | "LeftMarginBookmarkPanelBackground": "clWhite",
73 | "LeftMarginBorder": "clWhite",
74 | "LeftMarginLineNumberLine": "clGray",
75 | "LeftMarginLineNumbers": "clGray",
76 | "LeftMarginLineStateModified": "clYellow",
77 | "LeftMarginLineStateNormal": "clLime",
78 | "MatchingPairMatched": "clAqua",
79 | "MatchingPairUnderline": "clBlack",
80 | "MatchingPairUnmatched": "clYellow",
81 | "MinimapBackground": "clNone",
82 | "MinimapBookmark": "clGreen",
83 | "MinimapVisibleRows": "$00F0FFFF",
84 | "RightMargin": "clGray",
85 | "RightMovingEdge": "clSilver",
86 | "RulerBackground": "clWhite",
87 | "RulerBorder": "clGray",
88 | "RulerLines": "clGray",
89 | "RulerMovingEdge": "clSilver",
90 | "RulerNumbers": "clGray",
91 | "RulerSelection": "$00F0FFFF",
92 | "SearchHighlighterBackground": "clBlack",
93 | "SearchHighlighterBorder": "clNone",
94 | "SearchHighlighterForeground": "clWhite",
95 | "SearchInSelectionBackground": "$00FCFDCD",
96 | "SearchMapActiveLine": "$00FF9933",
97 | "SearchMapBackground": "clNone",
98 | "SearchMapForeground": "clBlack",
99 | "SelectionBackground": "$00FF9933",
100 | "SelectionBackgroundUnfocused": "$00FF9933",
101 | "SelectionForeground": "clWhite",
102 | "SelectionForegroundUnfocused": "clWhite",
103 | "SyncEditBackground": "$00FCFDCD",
104 | "SyncEditEditBorder": "clBlack",
105 | "SyncEditWordBorder": "$00FF9933",
106 | "WordWrapIndicatorArrow": "clBlack",
107 | "WordWrapIndicatorLines": "clBlue"
108 | },
109 | "Fonts": {
110 | "CodeFoldingHint": "Courier New",
111 | "CompletionProposal": "Courier New",
112 | "LineNumbers": "Courier New",
113 | "Minimap": "Courier New",
114 | "Ruler": "Courier New",
115 | "Text": "Courier New"
116 | },
117 | "FontSizes": {
118 | "CodeFoldingHint": "8",
119 | "CompletionProposal": "9",
120 | "LineNumbers": "8",
121 | "Minimap": "1",
122 | "Ruler": "8",
123 | "Text": "9"
124 | },
125 | "Styles": [
126 | {
127 | "Name": "MethodItalic",
128 | "Style": "Italic"
129 | }
130 | ]
131 | }
132 | }
--------------------------------------------------------------------------------