-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtigen.go
513 lines (449 loc) · 26.3 KB
/
gtigen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
// Code generated by "goki generate"; DO NOT EDIT.
package texteditor
import (
"goki.dev/colors"
"goki.dev/gi/v2/gi"
"goki.dev/gi/v2/texteditor/textbuf"
"goki.dev/girl/paint"
"goki.dev/girl/units"
"goki.dev/goosi/events"
"goki.dev/gti"
"goki.dev/ki/v2"
"goki.dev/mat32/v2"
"goki.dev/ordmap"
)
// DiffViewType is the [gti.Type] for [DiffView]
var DiffViewType = gti.AddType(>i.Type{
Name: "goki.dev/gi/v2/texteditor.DiffView",
ShortName: "texteditor.DiffView",
IDName: "diff-view",
Doc: "DiffView presents two side-by-side TextEditor windows showing the differences\nbetween two files (represented as lines of strings).",
Directives: gti.Directives{},
Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"FileA", >i.Field{Name: "FileA", Type: "string", LocalType: "string", Doc: "first file name being compared", Directives: gti.Directives{}, Tag: ""}},
{"FileB", >i.Field{Name: "FileB", Type: "string", LocalType: "string", Doc: "second file name being compared", Directives: gti.Directives{}, Tag: ""}},
{"RevA", >i.Field{Name: "RevA", Type: "string", LocalType: "string", Doc: "revision for first file, if relevant", Directives: gti.Directives{}, Tag: ""}},
{"RevB", >i.Field{Name: "RevB", Type: "string", LocalType: "string", Doc: "revision for second file, if relevant", Directives: gti.Directives{}, Tag: ""}},
{"BufA", >i.Field{Name: "BufA", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for A showing the aligned edit view", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}},
{"BufB", >i.Field{Name: "BufB", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for B showing the aligned edit view", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}},
{"AlignD", >i.Field{Name: "AlignD", Type: "goki.dev/gi/v2/texteditor/textbuf.Diffs", LocalType: "textbuf.Diffs", Doc: "aligned diffs records diff for aligned lines", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" set:\"-\""}},
{"Diffs", >i.Field{Name: "Diffs", Type: "goki.dev/gi/v2/texteditor/textbuf.DiffSelected", LocalType: "textbuf.DiffSelected", Doc: "Diffs applied", Directives: gti.Directives{}, Tag: ""}},
}),
Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Frame", >i.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}),
Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
{"SaveFileA", >i.Method{Name: "SaveFileA", Doc: "SaveFileA saves the current state of file A to given filename", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"fname", >i.Field{Name: "fname", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
{"SaveFileB", >i.Method{Name: "SaveFileB", Doc: "SaveFileB saves the current state of file B to given filename", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"fname", >i.Field{Name: "fname", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
}),
Instance: &DiffView{},
})
// NewDiffView adds a new [DiffView] with the given name
// to the given parent. If the name is unspecified, it defaults
// to the ID (kebab-case) name of the type, plus the
// [ki.Ki.NumLifetimeChildren] of the given parent.
func NewDiffView(par ki.Ki, name ...string) *DiffView {
return par.NewChild(DiffViewType, name...).(*DiffView)
}
// KiType returns the [*gti.Type] of [DiffView]
func (t *DiffView) KiType() *gti.Type {
return DiffViewType
}
// New returns a new [*DiffView] value
func (t *DiffView) New() ki.Ki {
return &DiffView{}
}
// SetFileA sets the [DiffView.FileA]:
// first file name being compared
func (t *DiffView) SetFileA(v string) *DiffView {
t.FileA = v
return t
}
// SetFileB sets the [DiffView.FileB]:
// second file name being compared
func (t *DiffView) SetFileB(v string) *DiffView {
t.FileB = v
return t
}
// SetRevA sets the [DiffView.RevA]:
// revision for first file, if relevant
func (t *DiffView) SetRevA(v string) *DiffView {
t.RevA = v
return t
}
// SetRevB sets the [DiffView.RevB]:
// revision for second file, if relevant
func (t *DiffView) SetRevB(v string) *DiffView {
t.RevB = v
return t
}
// SetDiffs sets the [DiffView.Diffs]:
// Diffs applied
func (t *DiffView) SetDiffs(v textbuf.DiffSelected) *DiffView {
t.Diffs = v
return t
}
// SetTooltip sets the [DiffView.Tooltip]
func (t *DiffView) SetTooltip(v string) *DiffView {
t.Tooltip = v
return t
}
// SetClass sets the [DiffView.Class]
func (t *DiffView) SetClass(v string) *DiffView {
t.Class = v
return t
}
// SetPriorityEvents sets the [DiffView.PriorityEvents]
func (t *DiffView) SetPriorityEvents(v []events.Types) *DiffView {
t.PriorityEvents = v
return t
}
// SetCustomContextMenu sets the [DiffView.CustomContextMenu]
func (t *DiffView) SetCustomContextMenu(v func(m *gi.Scene)) *DiffView {
t.CustomContextMenu = v
return t
}
// SetStackTop sets the [DiffView.StackTop]
func (t *DiffView) SetStackTop(v int) *DiffView {
t.StackTop = v
return t
}
// SetStripes sets the [DiffView.Stripes]
func (t *DiffView) SetStripes(v gi.Stripes) *DiffView {
t.Stripes = v
return t
}
// DiffTextEditorType is the [gti.Type] for [DiffTextEditor]
var DiffTextEditorType = gti.AddType(>i.Type{
Name: "goki.dev/gi/v2/texteditor.DiffTextEditor",
ShortName: "texteditor.DiffTextEditor",
IDName: "diff-text-editor",
Doc: "DiffTextEditor supports double-click based application of edits from one\nbuffer to the other.",
Directives: gti.Directives{},
Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}),
Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Editor", >i.Field{Name: "Editor", Type: "goki.dev/gi/v2/texteditor.Editor", LocalType: "Editor", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}),
Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
Instance: &DiffTextEditor{},
})
// NewDiffTextEditor adds a new [DiffTextEditor] with the given name
// to the given parent. If the name is unspecified, it defaults
// to the ID (kebab-case) name of the type, plus the
// [ki.Ki.NumLifetimeChildren] of the given parent.
func NewDiffTextEditor(par ki.Ki, name ...string) *DiffTextEditor {
return par.NewChild(DiffTextEditorType, name...).(*DiffTextEditor)
}
// KiType returns the [*gti.Type] of [DiffTextEditor]
func (t *DiffTextEditor) KiType() *gti.Type {
return DiffTextEditorType
}
// New returns a new [*DiffTextEditor] value
func (t *DiffTextEditor) New() ki.Ki {
return &DiffTextEditor{}
}
// SetTooltip sets the [DiffTextEditor.Tooltip]
func (t *DiffTextEditor) SetTooltip(v string) *DiffTextEditor {
t.Tooltip = v
return t
}
// SetClass sets the [DiffTextEditor.Class]
func (t *DiffTextEditor) SetClass(v string) *DiffTextEditor {
t.Class = v
return t
}
// SetPriorityEvents sets the [DiffTextEditor.PriorityEvents]
func (t *DiffTextEditor) SetPriorityEvents(v []events.Types) *DiffTextEditor {
t.PriorityEvents = v
return t
}
// SetCustomContextMenu sets the [DiffTextEditor.CustomContextMenu]
func (t *DiffTextEditor) SetCustomContextMenu(v func(m *gi.Scene)) *DiffTextEditor {
t.CustomContextMenu = v
return t
}
// SetStackTop sets the [DiffTextEditor.StackTop]
func (t *DiffTextEditor) SetStackTop(v int) *DiffTextEditor {
t.StackTop = v
return t
}
// SetPlaceholder sets the [DiffTextEditor.Placeholder]
func (t *DiffTextEditor) SetPlaceholder(v string) *DiffTextEditor {
t.Placeholder = v
return t
}
// SetCursorWidth sets the [DiffTextEditor.CursorWidth]
func (t *DiffTextEditor) SetCursorWidth(v units.Value) *DiffTextEditor {
t.CursorWidth = v
return t
}
// SetLineNumberColor sets the [DiffTextEditor.LineNumberColor]
func (t *DiffTextEditor) SetLineNumberColor(v colors.Full) *DiffTextEditor {
t.LineNumberColor = v
return t
}
// SetSelectColor sets the [DiffTextEditor.SelectColor]
func (t *DiffTextEditor) SetSelectColor(v colors.Full) *DiffTextEditor {
t.SelectColor = v
return t
}
// SetHighlightColor sets the [DiffTextEditor.HighlightColor]
func (t *DiffTextEditor) SetHighlightColor(v colors.Full) *DiffTextEditor {
t.HighlightColor = v
return t
}
// SetCursorColor sets the [DiffTextEditor.CursorColor]
func (t *DiffTextEditor) SetCursorColor(v colors.Full) *DiffTextEditor {
t.CursorColor = v
return t
}
// SetLinkHandler sets the [DiffTextEditor.LinkHandler]
func (t *DiffTextEditor) SetLinkHandler(v func(tl *paint.TextLink)) *DiffTextEditor {
t.LinkHandler = v
return t
}
// EditorType is the [gti.Type] for [Editor]
var EditorType = gti.AddType(>i.Type{
Name: "goki.dev/gi/v2/texteditor.Editor",
ShortName: "texteditor.Editor",
IDName: "editor",
Doc: "Editor is a widget for editing multiple lines of text (as compared to\n[gi.TextField] for a single line). The Editor is driven by a [Buf]\nbuffer which contains all the text, and manages all the edits,\nsending update signals out to the views.\n\nUse SetNeedsRender to drive an render update for any change that does\nnot change the line-level layout of the text.\nUse SetNeedsLayout whenever there are changes across lines that require\nre-layout of the text. This sets the Widget NeedsRender flag and triggers\nlayout during that render.\n\nMultiple views can be attached to a given buffer. All updating in the\nEditor should be within a single goroutine, as it would require\nextensive protections throughout code otherwise.",
Directives: gti.Directives{
>i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}},
},
Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Buf", >i.Field{Name: "Buf", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*Buf", Doc: "the text buffer that we're editing", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}},
{"Placeholder", >i.Field{Name: "Placeholder", Type: "string", LocalType: "string", Doc: "text that is displayed when the field is empty, in a lower-contrast manner", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"placeholder\""}},
{"CursorWidth", >i.Field{Name: "CursorWidth", Type: "goki.dev/girl/units.Value", LocalType: "units.Value", Doc: "width of cursor -- set from cursor-width property (inherited)", Directives: gti.Directives{}, Tag: "xml:\"cursor-width\""}},
{"LineNumberColor", >i.Field{Name: "LineNumberColor", Type: "goki.dev/colors.Full", LocalType: "colors.Full", Doc: "the color used for the side bar containing the line numbers; this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}},
{"SelectColor", >i.Field{Name: "SelectColor", Type: "goki.dev/colors.Full", LocalType: "colors.Full", Doc: "the color used for the user text selection background color; this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}},
{"HighlightColor", >i.Field{Name: "HighlightColor", Type: "goki.dev/colors.Full", LocalType: "colors.Full", Doc: "the color used for the text highlight background color (like in find); this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}},
{"CursorColor", >i.Field{Name: "CursorColor", Type: "goki.dev/colors.Full", LocalType: "colors.Full", Doc: "the color used for the text field cursor (caret); this should be set in Stylers like all other style properties", Directives: gti.Directives{}, Tag: ""}},
{"NLines", >i.Field{Name: "NLines", Type: "int", LocalType: "int", Doc: "number of lines in the view -- sync'd with the Buf after edits, but always reflects storage size of Renders etc", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
{"Renders", >i.Field{Name: "Renders", Type: "[]goki.dev/girl/paint.Text", LocalType: "[]paint.Text", Doc: "renders of the text lines, with one render per line (each line could visibly wrap-around, so these are logical lines, not display lines)", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\""}},
{"Offs", >i.Field{Name: "Offs", Type: "[]float32", LocalType: "[]float32", Doc: "starting render offsets for top of each line", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
{"LineNoDigs", >i.Field{Name: "LineNoDigs", Type: "int", LocalType: "int", Doc: "number of line number digits needed", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
{"LineNoOff", >i.Field{Name: "LineNoOff", Type: "float32", LocalType: "float32", Doc: "horizontal offset for start of text after line numbers", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
{"LineNoRender", >i.Field{Name: "LineNoRender", Type: "goki.dev/girl/paint.Text", LocalType: "paint.Text", Doc: "render for line numbers", Directives: gti.Directives{}, Tag: "set:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
{"CursorPos", >i.Field{Name: "CursorPos", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "current cursor position", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"CursorTarg", >i.Field{Name: "CursorTarg", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "target cursor position for externally-set targets: ensures that it is visible", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"CursorCol", >i.Field{Name: "CursorCol", Type: "int", LocalType: "int", Doc: "desired cursor column -- where the cursor was last when moved using left / right arrows -- used when doing up / down to not always go to short line columns", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"PosHistIdx", >i.Field{Name: "PosHistIdx", Type: "int", LocalType: "int", Doc: "current index within PosHistory", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"SelectStart", >i.Field{Name: "SelectStart", Type: "goki.dev/pi/v2/lex.Pos", LocalType: "lex.Pos", Doc: "starting point for selection -- will either be the start or end of selected region depending on subsequent selection.", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"SelectReg", >i.Field{Name: "SelectReg", Type: "goki.dev/gi/v2/texteditor/textbuf.Region", LocalType: "textbuf.Region", Doc: "current selection region", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"PrevSelectReg", >i.Field{Name: "PrevSelectReg", Type: "goki.dev/gi/v2/texteditor/textbuf.Region", LocalType: "textbuf.Region", Doc: "previous selection region, that was actually rendered -- needed to update render", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"Highlights", >i.Field{Name: "Highlights", Type: "[]goki.dev/gi/v2/texteditor/textbuf.Region", LocalType: "[]textbuf.Region", Doc: "highlighted regions, e.g., for search results", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"Scopelights", >i.Field{Name: "Scopelights", Type: "[]goki.dev/gi/v2/texteditor/textbuf.Region", LocalType: "[]textbuf.Region", Doc: "highlighted regions, specific to scope markers", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"SelectMode", >i.Field{Name: "SelectMode", Type: "bool", LocalType: "bool", Doc: "if true, select text as cursor moves", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"ForceComplete", >i.Field{Name: "ForceComplete", Type: "bool", LocalType: "bool", Doc: "if true, complete regardless of any disqualifying reasons", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"ISearch", >i.Field{Name: "ISearch", Type: "goki.dev/gi/v2/texteditor.ISearch", LocalType: "ISearch", Doc: "interactive search data", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"QReplace", >i.Field{Name: "QReplace", Type: "goki.dev/gi/v2/texteditor.QReplace", LocalType: "QReplace", Doc: "query replace data", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"FontHeight", >i.Field{Name: "FontHeight", Type: "float32", LocalType: "float32", Doc: "font height, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"LineHeight", >i.Field{Name: "LineHeight", Type: "float32", LocalType: "float32", Doc: "line height, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"FontAscent", >i.Field{Name: "FontAscent", Type: "float32", LocalType: "float32", Doc: "font ascent, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"FontDescent", >i.Field{Name: "FontDescent", Type: "float32", LocalType: "float32", Doc: "font descent, cached during styling", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"NLinesChars", >i.Field{Name: "NLinesChars", Type: "image.Point", LocalType: "image.Point", Doc: "height in lines and width in chars of the visible area", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"LinesSize", >i.Field{Name: "LinesSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "total size of all lines as rendered", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"TotalSize", >i.Field{Name: "TotalSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "TotalSize = LinesSize plus extra space and line numbers etc", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"LineLayoutSize", >i.Field{Name: "LineLayoutSize", Type: "goki.dev/mat32/v2.Vec2", LocalType: "mat32.Vec2", Doc: "LineLayoutSize is Geom.Size.Actual.Total subtracting\nextra space and line numbers -- this is what\nLayoutStdLR sees for laying out each line", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"BlinkOn", >i.Field{Name: "BlinkOn", Type: "bool", LocalType: "bool", Doc: "oscillates between on and off for blinking", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"CursorMu", >i.Field{Name: "CursorMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "mutex protecting cursor rendering -- shared between blink and main code", Directives: gti.Directives{}, Tag: "set:\"-\" json:\"-\" xml:\"-\" view:\"-\""}},
{"HasLinks", >i.Field{Name: "HasLinks", Type: "bool", LocalType: "bool", Doc: "at least one of the renders has links -- determines if we set the cursor for hand movements", Directives: gti.Directives{}, Tag: "set:\"-\" edit:\"-\" json:\"-\" xml:\"-\""}},
{"LinkHandler", >i.Field{Name: "LinkHandler", Type: "func(tl *goki.dev/girl/paint.TextLink)", LocalType: "func(tl *paint.TextLink)", Doc: "handles link clicks -- if nil, they are sent to the standard web URL handler", Directives: gti.Directives{}, Tag: ""}},
{"lastRecenter", >i.Field{Name: "lastRecenter", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}},
{"lastAutoInsert", >i.Field{Name: "lastAutoInsert", Type: "rune", LocalType: "rune", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}},
{"lastFilename", >i.Field{Name: "lastFilename", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "", Directives: gti.Directives{}, Tag: "set:\"-\""}},
}),
Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}),
Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{
{"Lookup", >i.Method{Name: "Lookup", Doc: "Lookup attempts to lookup symbol at current location, popping up a window\nif something is found", Directives: gti.Directives{
>i.Directive{Tool: "gti", Directive: "add", Args: []string{}},
}, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}},
}),
Instance: &Editor{},
})
// NewEditor adds a new [Editor] with the given name
// to the given parent. If the name is unspecified, it defaults
// to the ID (kebab-case) name of the type, plus the
// [ki.Ki.NumLifetimeChildren] of the given parent.
func NewEditor(par ki.Ki, name ...string) *Editor {
return par.NewChild(EditorType, name...).(*Editor)
}
// KiType returns the [*gti.Type] of [Editor]
func (t *Editor) KiType() *gti.Type {
return EditorType
}
// New returns a new [*Editor] value
func (t *Editor) New() ki.Ki {
return &Editor{}
}
// EditorEmbedder is an interface that all types that embed Editor satisfy
type EditorEmbedder interface {
AsEditor() *Editor
}
// AsEditor returns the given value as a value of type Editor if the type
// of the given value embeds Editor, or nil otherwise
func AsEditor(k ki.Ki) *Editor {
if k == nil || k.This() == nil {
return nil
}
if t, ok := k.(EditorEmbedder); ok {
return t.AsEditor()
}
return nil
}
// AsEditor satisfies the [EditorEmbedder] interface
func (t *Editor) AsEditor() *Editor {
return t
}
// SetPlaceholder sets the [Editor.Placeholder]:
// text that is displayed when the field is empty, in a lower-contrast manner
func (t *Editor) SetPlaceholder(v string) *Editor {
t.Placeholder = v
return t
}
// SetCursorWidth sets the [Editor.CursorWidth]:
// width of cursor -- set from cursor-width property (inherited)
func (t *Editor) SetCursorWidth(v units.Value) *Editor {
t.CursorWidth = v
return t
}
// SetLineNumberColor sets the [Editor.LineNumberColor]:
// the color used for the side bar containing the line numbers; this should be set in Stylers like all other style properties
func (t *Editor) SetLineNumberColor(v colors.Full) *Editor {
t.LineNumberColor = v
return t
}
// SetSelectColor sets the [Editor.SelectColor]:
// the color used for the user text selection background color; this should be set in Stylers like all other style properties
func (t *Editor) SetSelectColor(v colors.Full) *Editor {
t.SelectColor = v
return t
}
// SetHighlightColor sets the [Editor.HighlightColor]:
// the color used for the text highlight background color (like in find); this should be set in Stylers like all other style properties
func (t *Editor) SetHighlightColor(v colors.Full) *Editor {
t.HighlightColor = v
return t
}
// SetCursorColor sets the [Editor.CursorColor]:
// the color used for the text field cursor (caret); this should be set in Stylers like all other style properties
func (t *Editor) SetCursorColor(v colors.Full) *Editor {
t.CursorColor = v
return t
}
// SetLinkHandler sets the [Editor.LinkHandler]:
// handles link clicks -- if nil, they are sent to the standard web URL handler
func (t *Editor) SetLinkHandler(v func(tl *paint.TextLink)) *Editor {
t.LinkHandler = v
return t
}
// SetTooltip sets the [Editor.Tooltip]
func (t *Editor) SetTooltip(v string) *Editor {
t.Tooltip = v
return t
}
// SetClass sets the [Editor.Class]
func (t *Editor) SetClass(v string) *Editor {
t.Class = v
return t
}
// SetPriorityEvents sets the [Editor.PriorityEvents]
func (t *Editor) SetPriorityEvents(v []events.Types) *Editor {
t.PriorityEvents = v
return t
}
// SetCustomContextMenu sets the [Editor.CustomContextMenu]
func (t *Editor) SetCustomContextMenu(v func(m *gi.Scene)) *Editor {
t.CustomContextMenu = v
return t
}
// SetStackTop sets the [Editor.StackTop]
func (t *Editor) SetStackTop(v int) *Editor {
t.StackTop = v
return t
}
// TwinEditorsType is the [gti.Type] for [TwinEditors]
var TwinEditorsType = gti.AddType(>i.Type{
Name: "goki.dev/gi/v2/texteditor.TwinEditors",
ShortName: "texteditor.TwinEditors",
IDName: "twin-editors",
Doc: "TwinEditors presents two side-by-side [Editor]s in [gi.Splits]\nthat scroll in sync with each other.",
Directives: gti.Directives{},
Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"BufA", >i.Field{Name: "BufA", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for A", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
{"BufB", >i.Field{Name: "BufB", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*Buf", Doc: "textbuf for B", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\""}},
}),
Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
{"Splits", >i.Field{Name: "Splits", Type: "goki.dev/gi/v2/gi.Splits", LocalType: "gi.Splits", Doc: "", Directives: gti.Directives{}, Tag: ""}},
}),
Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
Instance: &TwinEditors{},
})
// NewTwinEditors adds a new [TwinEditors] with the given name
// to the given parent. If the name is unspecified, it defaults
// to the ID (kebab-case) name of the type, plus the
// [ki.Ki.NumLifetimeChildren] of the given parent.
func NewTwinEditors(par ki.Ki, name ...string) *TwinEditors {
return par.NewChild(TwinEditorsType, name...).(*TwinEditors)
}
// KiType returns the [*gti.Type] of [TwinEditors]
func (t *TwinEditors) KiType() *gti.Type {
return TwinEditorsType
}
// New returns a new [*TwinEditors] value
func (t *TwinEditors) New() ki.Ki {
return &TwinEditors{}
}
// SetBufA sets the [TwinEditors.BufA]:
// textbuf for A
func (t *TwinEditors) SetBufA(v *Buf) *TwinEditors {
t.BufA = v
return t
}
// SetBufB sets the [TwinEditors.BufB]:
// textbuf for B
func (t *TwinEditors) SetBufB(v *Buf) *TwinEditors {
t.BufB = v
return t
}
// SetTooltip sets the [TwinEditors.Tooltip]
func (t *TwinEditors) SetTooltip(v string) *TwinEditors {
t.Tooltip = v
return t
}
// SetClass sets the [TwinEditors.Class]
func (t *TwinEditors) SetClass(v string) *TwinEditors {
t.Class = v
return t
}
// SetPriorityEvents sets the [TwinEditors.PriorityEvents]
func (t *TwinEditors) SetPriorityEvents(v []events.Types) *TwinEditors {
t.PriorityEvents = v
return t
}
// SetCustomContextMenu sets the [TwinEditors.CustomContextMenu]
func (t *TwinEditors) SetCustomContextMenu(v func(m *gi.Scene)) *TwinEditors {
t.CustomContextMenu = v
return t
}
// SetStackTop sets the [TwinEditors.StackTop]
func (t *TwinEditors) SetStackTop(v int) *TwinEditors {
t.StackTop = v
return t
}
// SetDim sets the [TwinEditors.Dim]
func (t *TwinEditors) SetDim(v mat32.Dims) *TwinEditors {
t.Dim = v
return t
}