lycheedev 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lycheedev.js +257 -0
- package/package.json +42 -0
- package/src/addon.js +87 -0
- package/src/config.js +64 -0
- package/src/doctor.js +100 -0
- package/src/install.js +131 -0
- package/src/paths.js +93 -0
- package/src/python.js +107 -0
- package/src/skill.js +48 -0
- package/src/wow.js +110 -0
- package/vendor/addon/Core/Bootstrap.lua +131 -0
- package/vendor/addon/Core/Clients/Mainline.lua +9 -0
- package/vendor/addon/Core/Clients/Mists.lua +9 -0
- package/vendor/addon/Core/Clients/Titan.lua +9 -0
- package/vendor/addon/Core/Compatibility.lua +43 -0
- package/vendor/addon/Core/Database.lua +859 -0
- package/vendor/addon/Core/Inspector.lua +647 -0
- package/vendor/addon/Core/Locale.lua +307 -0
- package/vendor/addon/Core/Locale_enUS.lua +318 -0
- package/vendor/addon/Core/Safety.lua +42 -0
- package/vendor/addon/Core/Serializer.lua +324 -0
- package/vendor/addon/Libs/AutomationQR.lua +1176 -0
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -0
- package/vendor/addon/Lychee Dev_Mists.toc +43 -0
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -0
- package/vendor/addon/Media/GitHub.png +0 -0
- package/vendor/addon/Media/Logo.png +0 -0
- package/vendor/addon/Modules/Automation/Controller.lua +757 -0
- package/vendor/addon/Modules/Automation/Report.lua +409 -0
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -0
- package/vendor/addon/Modules/Diagnostics.lua +238 -0
- package/vendor/addon/Modules/Events/Catalog.lua +184 -0
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -0
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -0
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -0
- package/vendor/addon/Modules/Events/Monitor.lua +181 -0
- package/vendor/addon/Modules/FunctionTrace.lua +85 -0
- package/vendor/addon/Modules/ObjectInspector.lua +329 -0
- package/vendor/addon/UI/AutomationOverlay.lua +183 -0
- package/vendor/addon/UI/Export.lua +140 -0
- package/vendor/addon/UI/Features.lua +890 -0
- package/vendor/addon/UI/MainWindow.lua +1145 -0
- package/vendor/addon/UI/Pages/About.lua +223 -0
- package/vendor/addon/UI/Pages/Automation.lua +417 -0
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -0
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -0
- package/vendor/addon/UI/Pages/Object.lua +573 -0
- package/vendor/addon/UI/Pages/Trace.lua +165 -0
- package/vendor/skill/SKILL.md +94 -0
- package/vendor/skill/agents/openai.yaml +4 -0
- package/vendor/skill/references/automation.md +327 -0
- package/vendor/skill/references/runtime-investigations.md +97 -0
- package/vendor/skill/scripts/automation/__init__.py +1 -0
- package/vendor/skill/scripts/automation/registry.py +516 -0
- package/vendor/skill/scripts/automation/saved_variables.py +438 -0
- package/vendor/skill/scripts/automation/session.py +207 -0
- package/vendor/skill/scripts/automation/windows.py +573 -0
- package/vendor/skill/scripts/automation.py +865 -0
- package/vendor/skill/scripts/requirements.txt +13 -0
- package/vendor/skill/scripts/selftest_offline.py +981 -0
|
@@ -0,0 +1,1145 @@
|
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local WINDOW_WIDTH = 1040
|
|
5
|
+
local WINDOW_HEIGHT = 720
|
|
6
|
+
local HISTORY_WIDTH = 232
|
|
7
|
+
local MAIN_LEFT = HISTORY_WIDTH + 36
|
|
8
|
+
|
|
9
|
+
local ACCENT_R, ACCENT_G, ACCENT_B = 0.847, 0.231, 0.306
|
|
10
|
+
local PANEL_R, PANEL_G, PANEL_B = 0.050, 0.070, 0.090
|
|
11
|
+
local SURFACE_R, SURFACE_G, SURFACE_B = 0.061, 0.095, 0.120
|
|
12
|
+
local EDITOR_R, EDITOR_G, EDITOR_B = 0.027, 0.035, 0.043
|
|
13
|
+
local BORDER_R, BORDER_G, BORDER_B = 0.34, 0.39, 0.44
|
|
14
|
+
local LOGO_TEXTURE = "Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png"
|
|
15
|
+
|
|
16
|
+
local BACKDROP = {
|
|
17
|
+
bgFile = "Interface\\Buttons\\WHITE8X8",
|
|
18
|
+
edgeFile = "Interface\\Buttons\\WHITE8X8",
|
|
19
|
+
edgeSize = 1,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
local window
|
|
23
|
+
local selectedHistoryIndex
|
|
24
|
+
local historyButtons = {}
|
|
25
|
+
local activePage = "runner"
|
|
26
|
+
local resultMode = "text"
|
|
27
|
+
local historyTrees = setmetatable({}, { __mode = "k" })
|
|
28
|
+
|
|
29
|
+
local PAGE_DEFINITIONS = {
|
|
30
|
+
{ key = "runner", label = L.TAB_RUNNER },
|
|
31
|
+
{ key = "objects", label = L.TAB_OBJECTS },
|
|
32
|
+
{ key = "events", label = L.TAB_EVENTS },
|
|
33
|
+
{ key = "trace", label = L.TAB_TRACE },
|
|
34
|
+
{ key = "diagnostics", label = L.TAB_DIAGNOSTICS },
|
|
35
|
+
{ key = "exports", label = L.TAB_EXPORTS },
|
|
36
|
+
{ key = "automation", label = L.TAB_AUTOMATION },
|
|
37
|
+
{ key = "about", label = L.TAB_ABOUT },
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
local function SetBorderColor(frame, accent, alpha)
|
|
41
|
+
if accent then
|
|
42
|
+
frame:SetBackdropBorderColor(ACCENT_R, ACCENT_G, ACCENT_B, alpha or 0.8)
|
|
43
|
+
else
|
|
44
|
+
frame:SetBackdropBorderColor(BORDER_R, BORDER_G, BORDER_B, alpha or 0.35)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
local function CreatePanel(parent, r, g, b, a)
|
|
49
|
+
local panel = CreateFrame("Frame", nil, parent, "BackdropTemplate")
|
|
50
|
+
panel:SetBackdrop(BACKDROP)
|
|
51
|
+
panel:SetBackdropColor(r, g, b, a)
|
|
52
|
+
SetBorderColor(panel, false, 0.26)
|
|
53
|
+
|
|
54
|
+
local innerHighlight = panel:CreateTexture(nil, "ARTWORK")
|
|
55
|
+
innerHighlight:SetColorTexture(1, 1, 1, 0.026)
|
|
56
|
+
innerHighlight:SetPoint("TOPLEFT", 1, -1)
|
|
57
|
+
innerHighlight:SetPoint("TOPRIGHT", -1, -1)
|
|
58
|
+
innerHighlight:SetHeight(1)
|
|
59
|
+
return panel
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
local function Clamp(value, minimum, maximum)
|
|
63
|
+
return math.max(minimum, math.min(maximum, value))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
local function CreateScrollArea(parent, leftInset, topInset, rightInset, bottomInset, useNativeScrollFrame)
|
|
67
|
+
local scroll = CreateFrame(useNativeScrollFrame and "ScrollFrame" or "Frame", nil, parent)
|
|
68
|
+
scroll:SetPoint("TOPLEFT", leftInset, -topInset)
|
|
69
|
+
scroll:SetPoint("BOTTOMRIGHT", -(rightInset + 11), bottomInset)
|
|
70
|
+
scroll:SetClipsChildren(true)
|
|
71
|
+
scroll:EnableMouseWheel(true)
|
|
72
|
+
scroll.verticalOffset = 0
|
|
73
|
+
scroll.verticalRange = 0
|
|
74
|
+
|
|
75
|
+
local scrollbar = CreateFrame("Slider", nil, parent)
|
|
76
|
+
scrollbar:SetOrientation("VERTICAL")
|
|
77
|
+
scrollbar:SetPoint("TOPRIGHT", -rightInset, -topInset)
|
|
78
|
+
scrollbar:SetPoint("BOTTOMRIGHT", -rightInset, bottomInset)
|
|
79
|
+
scrollbar:SetWidth(7)
|
|
80
|
+
scrollbar:SetMinMaxValues(0, 0)
|
|
81
|
+
scrollbar:SetValue(0)
|
|
82
|
+
scrollbar:SetValueStep(1)
|
|
83
|
+
scrollbar:SetObeyStepOnDrag(false)
|
|
84
|
+
scrollbar:SetHitRectInsets(-4, -4, 0, 0)
|
|
85
|
+
scrollbar.syncing = false
|
|
86
|
+
|
|
87
|
+
local track = scrollbar:CreateTexture(nil, "BACKGROUND")
|
|
88
|
+
track:SetColorTexture(1, 1, 1, 0.07)
|
|
89
|
+
track:SetPoint("TOP", 0, 0)
|
|
90
|
+
track:SetPoint("BOTTOM", 0, 0)
|
|
91
|
+
track:SetWidth(2)
|
|
92
|
+
|
|
93
|
+
local thumb = scrollbar:CreateTexture(nil, "ARTWORK")
|
|
94
|
+
thumb:SetColorTexture(0.50, 0.56, 0.61, 0.72)
|
|
95
|
+
thumb:SetSize(7, 32)
|
|
96
|
+
scrollbar:SetThumbTexture(thumb)
|
|
97
|
+
scrollbar.thumb = thumb
|
|
98
|
+
|
|
99
|
+
scrollbar:SetScript("OnEnter", function(self)
|
|
100
|
+
self.thumb:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 0.95)
|
|
101
|
+
end)
|
|
102
|
+
scrollbar:SetScript("OnLeave", function(self)
|
|
103
|
+
self.thumb:SetColorTexture(0.50, 0.56, 0.61, 0.72)
|
|
104
|
+
end)
|
|
105
|
+
scrollbar:SetScript("OnValueChanged", function(self, value)
|
|
106
|
+
if not self.syncing then
|
|
107
|
+
scroll:SetVerticalScroll(value)
|
|
108
|
+
if useNativeScrollFrame then
|
|
109
|
+
scroll:SyncVerticalOffset(value)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end)
|
|
113
|
+
|
|
114
|
+
function scroll:SyncVerticalOffset(offset)
|
|
115
|
+
if issecretvalue and issecretvalue(offset) then
|
|
116
|
+
return
|
|
117
|
+
end
|
|
118
|
+
offset = Clamp(tonumber(offset) or 0, 0, self.verticalRange or 0)
|
|
119
|
+
local changed = offset ~= self.verticalOffset
|
|
120
|
+
self.verticalOffset = offset
|
|
121
|
+
scrollbar.syncing = true
|
|
122
|
+
scrollbar:SetValue(offset)
|
|
123
|
+
scrollbar.syncing = false
|
|
124
|
+
if changed and self.onVerticalScrollChanged then
|
|
125
|
+
self.onVerticalScrollChanged(offset)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if useNativeScrollFrame then
|
|
130
|
+
scroll:SetScript("OnVerticalScroll", function(self, offset)
|
|
131
|
+
self:SyncVerticalOffset(offset)
|
|
132
|
+
end)
|
|
133
|
+
scroll:SetScript("OnScrollRangeChanged", function(self, _, verticalRange)
|
|
134
|
+
self:UpdateScrollChildRect(verticalRange)
|
|
135
|
+
end)
|
|
136
|
+
else
|
|
137
|
+
function scroll:GetVerticalScroll()
|
|
138
|
+
return self.verticalOffset or 0
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
function scroll:SetVerticalScroll(offset)
|
|
142
|
+
self:SyncVerticalOffset(offset)
|
|
143
|
+
if self.scrollChild then
|
|
144
|
+
self.scrollChild:ClearAllPoints()
|
|
145
|
+
self.scrollChild:SetPoint("TOPLEFT", self, "TOPLEFT", 0, self.verticalOffset or 0)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
function scroll:UpdateScrollChildRect(nativeVerticalRange)
|
|
151
|
+
local child = useNativeScrollFrame and self:GetScrollChild() or self.scrollChild
|
|
152
|
+
local childHeight = child and child:GetHeight() or 0
|
|
153
|
+
local viewHeight = self:GetHeight() or 0
|
|
154
|
+
local nativeRangeIsSecret = nativeVerticalRange ~= nil
|
|
155
|
+
and issecretvalue and issecretvalue(nativeVerticalRange)
|
|
156
|
+
if issecretvalue and (issecretvalue(childHeight) or issecretvalue(viewHeight)
|
|
157
|
+
or nativeRangeIsSecret) then
|
|
158
|
+
scrollbar:Hide()
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
local range
|
|
163
|
+
if useNativeScrollFrame then
|
|
164
|
+
range = nativeVerticalRange
|
|
165
|
+
if range == nil then
|
|
166
|
+
range = self:GetVerticalScrollRange()
|
|
167
|
+
end
|
|
168
|
+
else
|
|
169
|
+
range = (childHeight or 0) - (viewHeight or 0)
|
|
170
|
+
end
|
|
171
|
+
if issecretvalue and issecretvalue(range) then
|
|
172
|
+
scrollbar:Hide()
|
|
173
|
+
return
|
|
174
|
+
end
|
|
175
|
+
range = math.max(0, tonumber(range) or 0)
|
|
176
|
+
self.verticalRange = range
|
|
177
|
+
scrollbar:SetMinMaxValues(0, range)
|
|
178
|
+
local offset = useNativeScrollFrame and self:GetVerticalScroll() or self.verticalOffset
|
|
179
|
+
if issecretvalue and issecretvalue(offset) then
|
|
180
|
+
scrollbar:Hide()
|
|
181
|
+
return
|
|
182
|
+
end
|
|
183
|
+
offset = Clamp(offset or 0, 0, range)
|
|
184
|
+
self:SetVerticalScroll(offset)
|
|
185
|
+
if useNativeScrollFrame then
|
|
186
|
+
self:SyncVerticalOffset(offset)
|
|
187
|
+
end
|
|
188
|
+
if range <= 0 then
|
|
189
|
+
scrollbar:Hide()
|
|
190
|
+
return
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
local trackHeight = scrollbar:GetHeight()
|
|
194
|
+
if not (issecretvalue and issecretvalue(trackHeight))
|
|
195
|
+
and trackHeight and trackHeight > 0 and viewHeight > 0 then
|
|
196
|
+
local contentHeight = math.max(viewHeight, viewHeight + range)
|
|
197
|
+
scrollbar.thumb:SetHeight(math.max(28, math.floor(trackHeight * viewHeight / contentHeight + 0.5)))
|
|
198
|
+
end
|
|
199
|
+
scrollbar:Show()
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if not useNativeScrollFrame then
|
|
203
|
+
function scroll:SetScrollChild(child)
|
|
204
|
+
self.scrollChild = child
|
|
205
|
+
child:ClearAllPoints()
|
|
206
|
+
child:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
|
207
|
+
self:UpdateScrollChildRect()
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
local function HandleMouseWheel(_, delta)
|
|
212
|
+
if issecretvalue and issecretvalue(delta) then
|
|
213
|
+
return
|
|
214
|
+
end
|
|
215
|
+
local target = Clamp((scroll.verticalOffset or 0) - delta * 36, 0, scroll.verticalRange or 0)
|
|
216
|
+
scroll:SetVerticalScroll(target)
|
|
217
|
+
if useNativeScrollFrame then
|
|
218
|
+
scroll:SyncVerticalOffset(target)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
scroll:SetScript("OnMouseWheel", HandleMouseWheel)
|
|
222
|
+
scroll.onMouseWheel = HandleMouseWheel
|
|
223
|
+
scrollbar:EnableMouseWheel(true)
|
|
224
|
+
scrollbar:SetScript("OnMouseWheel", HandleMouseWheel)
|
|
225
|
+
scroll:SetScript("OnSizeChanged", function(self)
|
|
226
|
+
self:UpdateScrollChildRect()
|
|
227
|
+
end)
|
|
228
|
+
|
|
229
|
+
scrollbar:Hide()
|
|
230
|
+
scroll.scrollbar = scrollbar
|
|
231
|
+
return scroll
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
local function CreateCloseButton(parent)
|
|
235
|
+
local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
|
|
236
|
+
button:SetSize(28, 28)
|
|
237
|
+
button:SetBackdrop(BACKDROP)
|
|
238
|
+
|
|
239
|
+
local firstLine = button:CreateTexture(nil, "ARTWORK")
|
|
240
|
+
firstLine:SetColorTexture(1, 1, 1, 0.72)
|
|
241
|
+
firstLine:SetSize(13, 2)
|
|
242
|
+
firstLine:SetPoint("CENTER")
|
|
243
|
+
firstLine:SetRotation(0.785398)
|
|
244
|
+
|
|
245
|
+
local secondLine = button:CreateTexture(nil, "ARTWORK")
|
|
246
|
+
secondLine:SetColorTexture(1, 1, 1, 0.72)
|
|
247
|
+
secondLine:SetSize(13, 2)
|
|
248
|
+
secondLine:SetPoint("CENTER")
|
|
249
|
+
secondLine:SetRotation(-0.785398)
|
|
250
|
+
|
|
251
|
+
local function SetState(hovered, pressed)
|
|
252
|
+
if pressed then
|
|
253
|
+
button:SetBackdropColor(ACCENT_R * 0.72, ACCENT_G * 0.72, ACCENT_B * 0.72, 0.95)
|
|
254
|
+
button:SetBackdropBorderColor(ACCENT_R, ACCENT_G, ACCENT_B, 1)
|
|
255
|
+
elseif hovered then
|
|
256
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 0.88)
|
|
257
|
+
button:SetBackdropBorderColor(ACCENT_R, ACCENT_G, ACCENT_B, 1)
|
|
258
|
+
else
|
|
259
|
+
button:SetBackdropColor(SURFACE_R, SURFACE_G, SURFACE_B, 0.78)
|
|
260
|
+
button:SetBackdropBorderColor(BORDER_R, BORDER_G, BORDER_B, 0.38)
|
|
261
|
+
end
|
|
262
|
+
local alpha = hovered and 1 or 0.72
|
|
263
|
+
firstLine:SetColorTexture(1, 1, 1, alpha)
|
|
264
|
+
secondLine:SetColorTexture(1, 1, 1, alpha)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
button:SetScript("OnEnter", function(self)
|
|
268
|
+
self.isHovered = true
|
|
269
|
+
SetState(true, false)
|
|
270
|
+
end)
|
|
271
|
+
button:SetScript("OnLeave", function(self)
|
|
272
|
+
self.isHovered = nil
|
|
273
|
+
SetState(false, false)
|
|
274
|
+
end)
|
|
275
|
+
button:SetScript("OnMouseDown", function()
|
|
276
|
+
SetState(true, true)
|
|
277
|
+
end)
|
|
278
|
+
button:SetScript("OnMouseUp", function(self)
|
|
279
|
+
SetState(self.isHovered, false)
|
|
280
|
+
end)
|
|
281
|
+
|
|
282
|
+
SetState(false, false)
|
|
283
|
+
return button
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
local function SetButtonLabelOffset(button, y)
|
|
287
|
+
button.label:ClearAllPoints()
|
|
288
|
+
button.label:SetPoint("CENTER", 0, y)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
local function ApplyButtonState(button, state)
|
|
292
|
+
local enabled = button:IsEnabled()
|
|
293
|
+
local variant = button.variant or (button.primary and "primary" or "secondary")
|
|
294
|
+
|
|
295
|
+
if not enabled then
|
|
296
|
+
if variant == "ghost" then
|
|
297
|
+
button:SetBackdropColor(0, 0, 0, 0)
|
|
298
|
+
SetBorderColor(button, false, 0)
|
|
299
|
+
else
|
|
300
|
+
button:SetBackdropColor(SURFACE_R, SURFACE_G, SURFACE_B, 0.34)
|
|
301
|
+
SetBorderColor(button, false, 0.18)
|
|
302
|
+
end
|
|
303
|
+
button.label:SetTextColor(1, 1, 1, 0.28)
|
|
304
|
+
SetButtonLabelOffset(button, 0)
|
|
305
|
+
return
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
local emphasized = variant == "primary" or variant == "danger"
|
|
309
|
+
if state == "pressed" then
|
|
310
|
+
if emphasized then
|
|
311
|
+
button:SetBackdropColor(ACCENT_R * 0.78, ACCENT_G * 0.78, ACCENT_B * 0.78, 1)
|
|
312
|
+
elseif variant == "selected" then
|
|
313
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 0.22)
|
|
314
|
+
elseif variant == "ghost" then
|
|
315
|
+
button:SetBackdropColor(SURFACE_R, SURFACE_G, SURFACE_B, 0.72)
|
|
316
|
+
else
|
|
317
|
+
button:SetBackdropColor(SURFACE_R * 0.82, SURFACE_G * 0.82, SURFACE_B * 0.82, 0.86)
|
|
318
|
+
end
|
|
319
|
+
SetBorderColor(button, emphasized or variant == "selected",
|
|
320
|
+
variant == "ghost" and 0.28 or (emphasized and 1 or 0.64))
|
|
321
|
+
elseif state == "hover" then
|
|
322
|
+
if emphasized then
|
|
323
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 1)
|
|
324
|
+
elseif variant == "selected" then
|
|
325
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 0.18)
|
|
326
|
+
elseif variant == "ghost" then
|
|
327
|
+
button:SetBackdropColor(SURFACE_R, SURFACE_G, SURFACE_B, 0.48)
|
|
328
|
+
else
|
|
329
|
+
button:SetBackdropColor(SURFACE_R * 1.22, SURFACE_G * 1.22, SURFACE_B * 1.22, 0.82)
|
|
330
|
+
end
|
|
331
|
+
SetBorderColor(button, emphasized or variant == "selected",
|
|
332
|
+
variant == "ghost" and 0.20 or (emphasized and 1 or 0.7))
|
|
333
|
+
else
|
|
334
|
+
if emphasized then
|
|
335
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 0.88)
|
|
336
|
+
elseif variant == "selected" then
|
|
337
|
+
button:SetBackdropColor(ACCENT_R, ACCENT_G, ACCENT_B, 0.12)
|
|
338
|
+
elseif variant == "ghost" then
|
|
339
|
+
button:SetBackdropColor(0, 0, 0, 0)
|
|
340
|
+
else
|
|
341
|
+
button:SetBackdropColor(SURFACE_R, SURFACE_G, SURFACE_B, 0.42)
|
|
342
|
+
end
|
|
343
|
+
SetBorderColor(button, emphasized or variant == "selected",
|
|
344
|
+
variant == "ghost" and 0
|
|
345
|
+
or (emphasized and 0.85 or (variant == "selected" and 0.52 or 0.30)))
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
local labelAlpha = 0.76
|
|
349
|
+
if emphasized then
|
|
350
|
+
labelAlpha = 1
|
|
351
|
+
elseif variant == "selected" then
|
|
352
|
+
labelAlpha = 0.94
|
|
353
|
+
elseif variant == "ghost" then
|
|
354
|
+
labelAlpha = state == "normal" and 0.68 or 0.92
|
|
355
|
+
end
|
|
356
|
+
button.label:SetTextColor(1, 1, 1, labelAlpha)
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
local function CreateButton(parent, width, text, primary)
|
|
360
|
+
local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
|
|
361
|
+
button:SetBackdrop(BACKDROP)
|
|
362
|
+
button.variant = type(primary) == "string" and primary or (primary and "primary" or "secondary")
|
|
363
|
+
button.primary = button.variant == "primary"
|
|
364
|
+
|
|
365
|
+
local label = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
366
|
+
label:SetPoint("CENTER")
|
|
367
|
+
label:SetText(text)
|
|
368
|
+
button.label = label
|
|
369
|
+
button:SetSize(math.max(width, math.ceil(label:GetStringWidth()) + 24), 30)
|
|
370
|
+
|
|
371
|
+
button:SetScript("OnEnter", function(self)
|
|
372
|
+
self.isHovered = true
|
|
373
|
+
ApplyButtonState(self, "hover")
|
|
374
|
+
end)
|
|
375
|
+
button:SetScript("OnLeave", function(self)
|
|
376
|
+
self.isHovered = nil
|
|
377
|
+
ApplyButtonState(self, "normal")
|
|
378
|
+
SetButtonLabelOffset(self, 0)
|
|
379
|
+
end)
|
|
380
|
+
button:SetScript("OnMouseDown", function(self)
|
|
381
|
+
ApplyButtonState(self, "pressed")
|
|
382
|
+
SetButtonLabelOffset(self, -1)
|
|
383
|
+
end)
|
|
384
|
+
button:SetScript("OnMouseUp", function(self)
|
|
385
|
+
ApplyButtonState(self, self.isHovered and "hover" or "normal")
|
|
386
|
+
SetButtonLabelOffset(self, 0)
|
|
387
|
+
end)
|
|
388
|
+
|
|
389
|
+
ApplyButtonState(button, "normal")
|
|
390
|
+
return button
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
local function SetButtonVariant(button, variant)
|
|
394
|
+
button.variant = variant or "secondary"
|
|
395
|
+
button.primary = button.variant == "primary"
|
|
396
|
+
ApplyButtonState(button, "normal")
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
local function SetButtonPrimary(button, primary)
|
|
400
|
+
SetButtonVariant(button, primary and "primary" or "secondary")
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
local function SetButtonEnabled(button, enabled)
|
|
404
|
+
button:SetEnabled(enabled and true or false)
|
|
405
|
+
if not enabled then
|
|
406
|
+
button.isHovered = nil
|
|
407
|
+
end
|
|
408
|
+
if button.RefreshEnabledState then
|
|
409
|
+
button:RefreshEnabledState()
|
|
410
|
+
else
|
|
411
|
+
ApplyButtonState(button, "normal")
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
local function SetButtonText(button, text)
|
|
416
|
+
button.label:SetText(text or "")
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
local function CreateSectionLabel(parent, text)
|
|
420
|
+
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
421
|
+
label:SetText(text)
|
|
422
|
+
label:SetTextColor(0.70, 0.75, 0.79, 0.92)
|
|
423
|
+
return label
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
local function CreateListRow(parent, height)
|
|
427
|
+
local row = CreateFrame("Button", nil, parent)
|
|
428
|
+
row:SetHeight(height)
|
|
429
|
+
|
|
430
|
+
local background = row:CreateTexture(nil, "BACKGROUND")
|
|
431
|
+
background:SetAllPoints()
|
|
432
|
+
background:SetColorTexture(0, 0, 0, 0)
|
|
433
|
+
row.background = background
|
|
434
|
+
|
|
435
|
+
local accent = row:CreateTexture(nil, "ARTWORK")
|
|
436
|
+
accent:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 1)
|
|
437
|
+
accent:SetPoint("TOPLEFT", 0, 0)
|
|
438
|
+
accent:SetPoint("BOTTOMLEFT", 0, 0)
|
|
439
|
+
accent:SetWidth(2)
|
|
440
|
+
accent:Hide()
|
|
441
|
+
row.accent = accent
|
|
442
|
+
|
|
443
|
+
local divider = row:CreateTexture(nil, "ARTWORK")
|
|
444
|
+
divider:SetColorTexture(1, 1, 1, 0.055)
|
|
445
|
+
divider:SetPoint("BOTTOMLEFT", 0, 0)
|
|
446
|
+
divider:SetPoint("BOTTOMRIGHT", 0, 0)
|
|
447
|
+
divider:SetHeight(1)
|
|
448
|
+
row.divider = divider
|
|
449
|
+
return row
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
local function SetListRowState(row, selected, hovered)
|
|
453
|
+
if selected then
|
|
454
|
+
row.background:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 0.095)
|
|
455
|
+
row.accent:Show()
|
|
456
|
+
row.divider:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 0.28)
|
|
457
|
+
elseif hovered then
|
|
458
|
+
row.background:SetColorTexture(SURFACE_R, SURFACE_G, SURFACE_B, 0.68)
|
|
459
|
+
row.accent:Hide()
|
|
460
|
+
row.divider:SetColorTexture(1, 1, 1, 0.08)
|
|
461
|
+
else
|
|
462
|
+
row.background:SetColorTexture(0, 0, 0, 0)
|
|
463
|
+
row.accent:Hide()
|
|
464
|
+
row.divider:SetColorTexture(1, 1, 1, 0.055)
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
local function CreateNavTab(parent, text)
|
|
469
|
+
local button = CreateFrame("Button", nil, parent)
|
|
470
|
+
button:SetSize(82, 32)
|
|
471
|
+
|
|
472
|
+
local label = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
473
|
+
label:SetPoint("CENTER", 0, 1)
|
|
474
|
+
label:SetText(text)
|
|
475
|
+
button.label = label
|
|
476
|
+
|
|
477
|
+
local underline = button:CreateTexture(nil, "ARTWORK")
|
|
478
|
+
underline:SetPoint("BOTTOMLEFT", 7, 0)
|
|
479
|
+
underline:SetPoint("BOTTOMRIGHT", -7, 0)
|
|
480
|
+
underline:SetHeight(2)
|
|
481
|
+
button.underline = underline
|
|
482
|
+
|
|
483
|
+
local function ApplyState(self)
|
|
484
|
+
if not self:IsEnabled() then
|
|
485
|
+
self.label:SetTextColor(1, 1, 1, 0.24)
|
|
486
|
+
self.underline:SetColorTexture(0, 0, 0, 0)
|
|
487
|
+
elseif self.active then
|
|
488
|
+
self.label:SetTextColor(1, 1, 1, 1)
|
|
489
|
+
self.underline:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 1)
|
|
490
|
+
elseif self.isHovered then
|
|
491
|
+
self.label:SetTextColor(1, 1, 1, 0.86)
|
|
492
|
+
self.underline:SetColorTexture(ACCENT_R, ACCENT_G, ACCENT_B, 0.35)
|
|
493
|
+
else
|
|
494
|
+
self.label:SetTextColor(1, 1, 1, 0.46)
|
|
495
|
+
self.underline:SetColorTexture(0, 0, 0, 0)
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
button.RefreshEnabledState = ApplyState
|
|
500
|
+
button.SetActive = function(self, active)
|
|
501
|
+
self.active = active and true or false
|
|
502
|
+
ApplyState(self)
|
|
503
|
+
end
|
|
504
|
+
button:SetScript("OnEnter", function(self)
|
|
505
|
+
self.isHovered = true
|
|
506
|
+
ApplyState(self)
|
|
507
|
+
end)
|
|
508
|
+
button:SetScript("OnLeave", function(self)
|
|
509
|
+
self.isHovered = nil
|
|
510
|
+
ApplyState(self)
|
|
511
|
+
end)
|
|
512
|
+
button:SetActive(false)
|
|
513
|
+
return button
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
local function FitNavTab(button, minimumWidth, height)
|
|
517
|
+
button:SetSize(math.max(minimumWidth or 48,
|
|
518
|
+
math.ceil(button.label:GetStringWidth()) + 22), height or 30)
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
local function CreateTextArea(parent, readOnly)
|
|
522
|
+
local panel = CreatePanel(parent, EDITOR_R, EDITOR_G, EDITOR_B, 1)
|
|
523
|
+
|
|
524
|
+
local scroll = CreateScrollArea(panel, 10, 10, 8, 10, true)
|
|
525
|
+
panel:EnableMouseWheel(true)
|
|
526
|
+
panel:SetScript("OnMouseWheel", function(_, delta)
|
|
527
|
+
scroll.onMouseWheel(scroll, delta)
|
|
528
|
+
end)
|
|
529
|
+
|
|
530
|
+
local editBox = CreateFrame("EditBox", nil, scroll)
|
|
531
|
+
editBox:SetPoint("TOPLEFT", scroll, "TOPLEFT", 0, 0)
|
|
532
|
+
editBox:SetMultiLine(true)
|
|
533
|
+
editBox:SetAutoFocus(false)
|
|
534
|
+
editBox:SetCountInvisibleLetters(true)
|
|
535
|
+
editBox:EnableMouseWheel(true)
|
|
536
|
+
editBox:SetScript("OnMouseWheel", function(_, delta)
|
|
537
|
+
scroll.onMouseWheel(scroll, delta)
|
|
538
|
+
end)
|
|
539
|
+
editBox:SetFontObject(ChatFontNormal)
|
|
540
|
+
editBox:SetTextInsets(4, 4, 4, 4)
|
|
541
|
+
editBox:SetWidth(500)
|
|
542
|
+
editBox:SetHeight(1)
|
|
543
|
+
editBox.savedText = readOnly and "" or nil
|
|
544
|
+
|
|
545
|
+
editBox:SetScript("OnEscapePressed", function(self)
|
|
546
|
+
self:ClearFocus()
|
|
547
|
+
end)
|
|
548
|
+
editBox:SetScript("OnEditFocusGained", function()
|
|
549
|
+
SetBorderColor(panel, true, 0.75)
|
|
550
|
+
end)
|
|
551
|
+
editBox:SetScript("OnEditFocusLost", function()
|
|
552
|
+
SetBorderColor(panel, false)
|
|
553
|
+
end)
|
|
554
|
+
editBox:SetScript("OnTextChanged", function(self)
|
|
555
|
+
if readOnly and not self.updatingText and self:GetText() ~= self.savedText then
|
|
556
|
+
self.updatingText = true
|
|
557
|
+
self:SetText(self.savedText)
|
|
558
|
+
self.updatingText = nil
|
|
559
|
+
self:HighlightText()
|
|
560
|
+
return
|
|
561
|
+
end
|
|
562
|
+
scroll:UpdateScrollChildRect()
|
|
563
|
+
end)
|
|
564
|
+
|
|
565
|
+
local function ScrollCursorIntoView()
|
|
566
|
+
editBox.cursorScrollQueued = false
|
|
567
|
+
scroll:UpdateScrollChildRect()
|
|
568
|
+
local offset = scroll:GetVerticalScroll()
|
|
569
|
+
local scrollHeight = scroll:GetHeight()
|
|
570
|
+
local y = editBox.cursorOffset or 0
|
|
571
|
+
local height = editBox.cursorHeight or 0
|
|
572
|
+
if issecretvalue and (issecretvalue(offset) or issecretvalue(scrollHeight)
|
|
573
|
+
or issecretvalue(y) or issecretvalue(height)) then
|
|
574
|
+
return
|
|
575
|
+
end
|
|
576
|
+
if -y < offset then
|
|
577
|
+
scroll:SetVerticalScroll(-y)
|
|
578
|
+
elseif -y + height > offset + scrollHeight then
|
|
579
|
+
scroll:SetVerticalScroll(-y + height - scrollHeight)
|
|
580
|
+
end
|
|
581
|
+
end
|
|
582
|
+
editBox:SetScript("OnCursorChanged", function(self, _, y, _, height)
|
|
583
|
+
self.cursorOffset = y
|
|
584
|
+
self.cursorHeight = height
|
|
585
|
+
if self.cursorScrollQueued then
|
|
586
|
+
return
|
|
587
|
+
end
|
|
588
|
+
self.cursorScrollQueued = true
|
|
589
|
+
C_Timer.After(0, ScrollCursorIntoView)
|
|
590
|
+
end)
|
|
591
|
+
scroll:SetScrollChild(editBox)
|
|
592
|
+
scroll:UpdateScrollChildRect()
|
|
593
|
+
scroll:EnableMouse(true)
|
|
594
|
+
scroll:SetScript("OnMouseDown", function()
|
|
595
|
+
editBox:SetFocus()
|
|
596
|
+
end)
|
|
597
|
+
|
|
598
|
+
if readOnly then
|
|
599
|
+
editBox:SetTextColor(0.79, 0.83, 0.87)
|
|
600
|
+
else
|
|
601
|
+
editBox:SetTextColor(0.94, 0.95, 0.96)
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
panel.scroll = scroll
|
|
605
|
+
panel.editBox = editBox
|
|
606
|
+
panel.SelectAll = function(self)
|
|
607
|
+
self.editBox:SetFocus()
|
|
608
|
+
self.editBox:HighlightText()
|
|
609
|
+
end
|
|
610
|
+
return panel
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
local function SetReadOnlyText(panel, text)
|
|
614
|
+
text = text or ""
|
|
615
|
+
local editBox = panel.editBox
|
|
616
|
+
editBox.savedText = text
|
|
617
|
+
editBox.updatingText = true
|
|
618
|
+
editBox:SetText(text)
|
|
619
|
+
editBox.updatingText = nil
|
|
620
|
+
editBox:SetCursorPosition(0)
|
|
621
|
+
panel.scroll:SetVerticalScroll(0)
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
local function AppendReadOnlyText(panel, text)
|
|
625
|
+
if not text or text == "" then
|
|
626
|
+
return
|
|
627
|
+
end
|
|
628
|
+
local editBox = panel.editBox
|
|
629
|
+
local offset = panel.scroll:GetVerticalScroll()
|
|
630
|
+
editBox.savedText = (editBox.savedText or "") .. text
|
|
631
|
+
editBox.updatingText = true
|
|
632
|
+
editBox:SetText(editBox.savedText)
|
|
633
|
+
editBox.updatingText = nil
|
|
634
|
+
panel.scroll:UpdateScrollChildRect()
|
|
635
|
+
panel.scroll:SetVerticalScroll(offset)
|
|
636
|
+
end
|
|
637
|
+
|
|
638
|
+
local function SelectAllText(target)
|
|
639
|
+
if target.SelectAll then
|
|
640
|
+
target:SelectAll()
|
|
641
|
+
return
|
|
642
|
+
end
|
|
643
|
+
target:SetFocus()
|
|
644
|
+
target:HighlightText()
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
local function SetResult(text)
|
|
648
|
+
window.currentResultText = text or ""
|
|
649
|
+
SetReadOnlyText(window.resultPanel, text)
|
|
650
|
+
if window.exportResultButton then
|
|
651
|
+
SetButtonEnabled(window.exportResultButton, text ~= nil and text ~= "")
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
local function SetStatus(text, r, g, b)
|
|
656
|
+
window.status:SetText(text)
|
|
657
|
+
window.status:SetTextColor(r, g, b, 0.92)
|
|
658
|
+
window.statusDot:SetColorTexture(r, g, b, 0.92)
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
local function SetResultMode(mode)
|
|
662
|
+
if not window then
|
|
663
|
+
return
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
resultMode = mode
|
|
667
|
+
window.resultPanel:SetShown(mode == "text")
|
|
668
|
+
window.treeView.panel:SetShown(mode == "tree")
|
|
669
|
+
window.selectButton:Show()
|
|
670
|
+
window.resultTextTab:SetActive(mode == "text")
|
|
671
|
+
window.resultTreeTab:SetActive(mode == "tree")
|
|
672
|
+
window.resultTreeTab:SetEnabled(true)
|
|
673
|
+
window.resultTreeTab:SetAlpha(1)
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
local function SetActivePage(pageName)
|
|
677
|
+
if not window or not window.pages then
|
|
678
|
+
return
|
|
679
|
+
end
|
|
680
|
+
if not window.pages[pageName] then
|
|
681
|
+
pageName = "runner"
|
|
682
|
+
end
|
|
683
|
+
activePage = pageName
|
|
684
|
+
|
|
685
|
+
for key, page in pairs(window.pages) do
|
|
686
|
+
page:SetShown(key == pageName)
|
|
687
|
+
window.pageTabs[key]:SetActive(key == pageName)
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
local page = window.pages[pageName]
|
|
691
|
+
if pageName == "runner" then
|
|
692
|
+
window.inputPanel.editBox:SetFocus()
|
|
693
|
+
elseif pageName == "events" then
|
|
694
|
+
page:RefreshIfDirty()
|
|
695
|
+
page:FocusInput()
|
|
696
|
+
elseif page.Activate then
|
|
697
|
+
page:Activate()
|
|
698
|
+
end
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
local function StopRuntimeTools()
|
|
702
|
+
if window and window.objectPage then
|
|
703
|
+
window.objectPage:Stop()
|
|
704
|
+
end
|
|
705
|
+
|
|
706
|
+
if window and window.eventsPage then
|
|
707
|
+
window.eventsPage:StopMonitor()
|
|
708
|
+
elseif ns.EventMonitor then
|
|
709
|
+
ns.EventMonitor.Stop()
|
|
710
|
+
end
|
|
711
|
+
|
|
712
|
+
if window and window.tracePage then
|
|
713
|
+
window.tracePage:Stop()
|
|
714
|
+
elseif ns.FunctionTrace then
|
|
715
|
+
ns.FunctionTrace.Stop()
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
local function FormatHistoryEntry(entry)
|
|
720
|
+
local stamp = entry.timestamp and date("%m-%d %H:%M", entry.timestamp) or L.UNKNOWN_TIME
|
|
721
|
+
local firstLine = (entry.code or ""):match("([^\r\n]+)") or L.EMPTY_INPUT
|
|
722
|
+
if #firstLine > 22 then
|
|
723
|
+
firstLine = firstLine:sub(1, 22) .. "..."
|
|
724
|
+
end
|
|
725
|
+
return stamp, firstLine
|
|
726
|
+
end
|
|
727
|
+
|
|
728
|
+
local function ApplyHistoryButtonStyle(button)
|
|
729
|
+
local selected = button.entryIndex == selectedHistoryIndex
|
|
730
|
+
SetListRowState(button, selected, button.isHovered)
|
|
731
|
+
if selected then
|
|
732
|
+
button.time:SetTextColor(1, 1, 1, 0.96)
|
|
733
|
+
button.preview:SetTextColor(1, 1, 1, 0.68)
|
|
734
|
+
elseif button.isHovered then
|
|
735
|
+
button.time:SetTextColor(1, 1, 1, 0.90)
|
|
736
|
+
button.preview:SetTextColor(1, 1, 1, 0.58)
|
|
737
|
+
else
|
|
738
|
+
button.time:SetTextColor(1, 1, 1, 0.68)
|
|
739
|
+
button.preview:SetTextColor(1, 1, 1, 0.42)
|
|
740
|
+
end
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
local function CreateHistoryButton(index)
|
|
744
|
+
local button = CreateListRow(window.historyContent, 52)
|
|
745
|
+
button:SetWidth(HISTORY_WIDTH - 26)
|
|
746
|
+
button.entryIndex = index
|
|
747
|
+
|
|
748
|
+
local timeLabel = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
749
|
+
timeLabel:SetPoint("TOPLEFT", 12, -9)
|
|
750
|
+
timeLabel:SetPoint("TOPRIGHT", -9, -9)
|
|
751
|
+
timeLabel:SetJustifyH("LEFT")
|
|
752
|
+
timeLabel:SetWordWrap(false)
|
|
753
|
+
button.time = timeLabel
|
|
754
|
+
|
|
755
|
+
local preview = button:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
756
|
+
preview:SetPoint("BOTTOMLEFT", 12, 8)
|
|
757
|
+
preview:SetPoint("BOTTOMRIGHT", -9, 8)
|
|
758
|
+
preview:SetJustifyH("LEFT")
|
|
759
|
+
preview:SetWordWrap(false)
|
|
760
|
+
button.preview = preview
|
|
761
|
+
|
|
762
|
+
button:SetScript("OnEnter", function(self)
|
|
763
|
+
self.isHovered = true
|
|
764
|
+
ApplyHistoryButtonStyle(self)
|
|
765
|
+
end)
|
|
766
|
+
button:SetScript("OnLeave", function(self)
|
|
767
|
+
self.isHovered = nil
|
|
768
|
+
ApplyHistoryButtonStyle(self)
|
|
769
|
+
end)
|
|
770
|
+
button:SetScript("OnClick", function(self)
|
|
771
|
+
selectedHistoryIndex = self.entryIndex
|
|
772
|
+
local entry = (ns.GetHistory() or {})[selectedHistoryIndex]
|
|
773
|
+
if entry then
|
|
774
|
+
window.inputPanel.editBox:SetText(entry.code or "")
|
|
775
|
+
SetResult(entry.result or "")
|
|
776
|
+
local valueTree = historyTrees[entry] or entry.tree
|
|
777
|
+
window.treeView:SetTree(valueTree)
|
|
778
|
+
SetResultMode(valueTree and "tree" or "text")
|
|
779
|
+
SetStatus(entry.succeeded and L.COMPLETED or L.FAILED,
|
|
780
|
+
entry.succeeded and 0.42 or ACCENT_R,
|
|
781
|
+
entry.succeeded and 0.76 or ACCENT_G,
|
|
782
|
+
entry.succeeded and 0.43 or ACCENT_B)
|
|
783
|
+
end
|
|
784
|
+
for historyIndex = 1, #historyButtons do
|
|
785
|
+
ApplyHistoryButtonStyle(historyButtons[historyIndex])
|
|
786
|
+
end
|
|
787
|
+
end)
|
|
788
|
+
|
|
789
|
+
historyButtons[index] = button
|
|
790
|
+
return button
|
|
791
|
+
end
|
|
792
|
+
|
|
793
|
+
local function RefreshHistory()
|
|
794
|
+
local history = ns.GetHistory() or {}
|
|
795
|
+
|
|
796
|
+
for index = 1, #historyButtons do
|
|
797
|
+
historyButtons[index]:Hide()
|
|
798
|
+
end
|
|
799
|
+
|
|
800
|
+
for index = 1, #history do
|
|
801
|
+
local button = historyButtons[index] or CreateHistoryButton(index)
|
|
802
|
+
button.entryIndex = index
|
|
803
|
+
button:ClearAllPoints()
|
|
804
|
+
button:SetPoint("TOPLEFT", 0, -((index - 1) * 52))
|
|
805
|
+
local stamp, preview = FormatHistoryEntry(history[index])
|
|
806
|
+
button.time:SetText(stamp)
|
|
807
|
+
button.preview:SetText(preview)
|
|
808
|
+
ApplyHistoryButtonStyle(button)
|
|
809
|
+
button:Show()
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
window.historyContent:SetHeight(math.max(1, #history * 52))
|
|
813
|
+
window.historyScroll:UpdateScrollChildRect()
|
|
814
|
+
window.historyEmpty:SetShown(#history == 0)
|
|
815
|
+
end
|
|
816
|
+
|
|
817
|
+
local function RunInput()
|
|
818
|
+
local succeeded, result, normalizedCode, valueTree, storedTree = ns.Execute(window.inputPanel.editBox:GetText())
|
|
819
|
+
SetResult(result)
|
|
820
|
+
window.treeView:SetTree(valueTree)
|
|
821
|
+
SetResultMode(valueTree and "tree" or "text")
|
|
822
|
+
local historyEntry = ns.AddHistory(normalizedCode, result, succeeded, storedTree)
|
|
823
|
+
if historyEntry and valueTree then
|
|
824
|
+
historyTrees[historyEntry] = valueTree
|
|
825
|
+
end
|
|
826
|
+
selectedHistoryIndex = 1
|
|
827
|
+
RefreshHistory()
|
|
828
|
+
|
|
829
|
+
if succeeded then
|
|
830
|
+
SetStatus(L.COMPLETED, 0.42, 0.76, 0.43)
|
|
831
|
+
else
|
|
832
|
+
SetStatus(L.FAILED, ACCENT_R, ACCENT_G, ACCENT_B)
|
|
833
|
+
end
|
|
834
|
+
end
|
|
835
|
+
|
|
836
|
+
local function CreateWindow()
|
|
837
|
+
local frame = CreateFrame("Frame", "LycheeDevWindow", UIParent, "BackdropTemplate")
|
|
838
|
+
frame:SetSize(WINDOW_WIDTH, WINDOW_HEIGHT)
|
|
839
|
+
frame:SetPoint("CENTER")
|
|
840
|
+
frame:SetFrameStrata("DIALOG")
|
|
841
|
+
frame:SetClampedToScreen(true)
|
|
842
|
+
frame:SetMovable(true)
|
|
843
|
+
frame:EnableMouse(true)
|
|
844
|
+
frame:RegisterForDrag("LeftButton")
|
|
845
|
+
frame:SetScript("OnDragStart", function(self)
|
|
846
|
+
self:StartMoving()
|
|
847
|
+
end)
|
|
848
|
+
frame:SetScript("OnDragStop", function(self)
|
|
849
|
+
self:StopMovingOrSizing()
|
|
850
|
+
end)
|
|
851
|
+
frame:SetBackdrop(BACKDROP)
|
|
852
|
+
frame:SetBackdropColor(PANEL_R, PANEL_G, PANEL_B, 0.985)
|
|
853
|
+
frame:SetBackdropBorderColor(0.46, 0.51, 0.56, 0.48)
|
|
854
|
+
frame:Hide()
|
|
855
|
+
tinsert(UISpecialFrames, frame:GetName())
|
|
856
|
+
|
|
857
|
+
local header = frame:CreateTexture(nil, "BACKGROUND")
|
|
858
|
+
header:SetColorTexture(SURFACE_R, SURFACE_G, SURFACE_B, 0.52)
|
|
859
|
+
header:SetPoint("TOPLEFT", 1, -1)
|
|
860
|
+
header:SetPoint("TOPRIGHT", -1, -1)
|
|
861
|
+
header:SetHeight(66)
|
|
862
|
+
|
|
863
|
+
local logo = frame:CreateTexture(nil, "ARTWORK")
|
|
864
|
+
logo:SetTexture(LOGO_TEXTURE)
|
|
865
|
+
logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
|
|
866
|
+
logo:SetSize(46, 46)
|
|
867
|
+
logo:SetPoint("TOPLEFT", 14, -10)
|
|
868
|
+
|
|
869
|
+
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
|
|
870
|
+
title:SetPoint("LEFT", logo, "RIGHT", 10, 0)
|
|
871
|
+
title:SetText(L.ADDON_TITLE)
|
|
872
|
+
title:SetTextColor(1, 1, 1, 1)
|
|
873
|
+
|
|
874
|
+
local closeButton = CreateCloseButton(frame)
|
|
875
|
+
closeButton:SetPoint("TOPRIGHT", -14, -14)
|
|
876
|
+
closeButton:SetScript("OnClick", function()
|
|
877
|
+
frame:Hide()
|
|
878
|
+
end)
|
|
879
|
+
|
|
880
|
+
frame.pageTabs = {}
|
|
881
|
+
local previousTab
|
|
882
|
+
for index = 1, #PAGE_DEFINITIONS do
|
|
883
|
+
local definition = PAGE_DEFINITIONS[index]
|
|
884
|
+
local tab = CreateNavTab(frame, definition.label)
|
|
885
|
+
FitNavTab(tab, 48, 32)
|
|
886
|
+
if previousTab then
|
|
887
|
+
tab:SetPoint("LEFT", previousTab, "RIGHT", 8, 0)
|
|
888
|
+
else
|
|
889
|
+
tab:SetPoint("BOTTOMLEFT", header, "BOTTOMLEFT", 300, 8)
|
|
890
|
+
end
|
|
891
|
+
tab:SetScript("OnClick", function()
|
|
892
|
+
SetActivePage(definition.key)
|
|
893
|
+
end)
|
|
894
|
+
frame.pageTabs[definition.key] = tab
|
|
895
|
+
previousTab = tab
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
local runnerPage = CreateFrame("Frame", nil, frame)
|
|
899
|
+
runnerPage:SetAllPoints(frame)
|
|
900
|
+
frame.runnerPage = runnerPage
|
|
901
|
+
|
|
902
|
+
local historyLabel = CreateSectionLabel(runnerPage, L.HISTORY)
|
|
903
|
+
historyLabel:SetPoint("TOPLEFT", 17, -84)
|
|
904
|
+
|
|
905
|
+
local historyPanel = CreatePanel(runnerPage, EDITOR_R, EDITOR_G, EDITOR_B, 0.78)
|
|
906
|
+
historyPanel:SetPoint("TOPLEFT", 14, -104)
|
|
907
|
+
historyPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
908
|
+
historyPanel:SetWidth(HISTORY_WIDTH)
|
|
909
|
+
|
|
910
|
+
local historyScroll = CreateScrollArea(historyPanel, 8, 8, 7, 8)
|
|
911
|
+
|
|
912
|
+
local historyContent = CreateFrame("Frame", nil, historyScroll)
|
|
913
|
+
historyContent:SetWidth(HISTORY_WIDTH - 26)
|
|
914
|
+
historyContent:SetHeight(1)
|
|
915
|
+
historyScroll:SetScrollChild(historyContent)
|
|
916
|
+
frame.historyContent = historyContent
|
|
917
|
+
frame.historyScroll = historyScroll
|
|
918
|
+
|
|
919
|
+
local historyEmpty = historyPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
920
|
+
historyEmpty:SetPoint("TOP", 0, -24)
|
|
921
|
+
historyEmpty:SetText(L.NO_HISTORY)
|
|
922
|
+
historyEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
923
|
+
frame.historyEmpty = historyEmpty
|
|
924
|
+
|
|
925
|
+
local inputLabel = CreateSectionLabel(runnerPage, L.LUA_INPUT)
|
|
926
|
+
inputLabel:SetPoint("TOPLEFT", MAIN_LEFT, -84)
|
|
927
|
+
|
|
928
|
+
local inputPanel = CreateTextArea(runnerPage, false)
|
|
929
|
+
inputPanel:SetPoint("TOPLEFT", MAIN_LEFT, -104)
|
|
930
|
+
inputPanel:SetPoint("TOPRIGHT", -14, -104)
|
|
931
|
+
inputPanel:SetHeight(210)
|
|
932
|
+
inputPanel.editBox:SetWidth(WINDOW_WIDTH - MAIN_LEFT - 58)
|
|
933
|
+
frame.inputPanel = inputPanel
|
|
934
|
+
|
|
935
|
+
local actionRow = CreateFrame("Frame", nil, runnerPage)
|
|
936
|
+
actionRow:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -8)
|
|
937
|
+
actionRow:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -8)
|
|
938
|
+
actionRow:SetHeight(30)
|
|
939
|
+
|
|
940
|
+
local runButton = CreateButton(actionRow, 96, L.RUN, true)
|
|
941
|
+
runButton:SetPoint("RIGHT", actionRow, "RIGHT", 0, 0)
|
|
942
|
+
runButton:SetScript("OnClick", RunInput)
|
|
943
|
+
frame.runButton = runButton
|
|
944
|
+
|
|
945
|
+
local clearInputButton = CreateButton(actionRow, 108, L.CLEAR_INPUT, false)
|
|
946
|
+
clearInputButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
|
|
947
|
+
clearInputButton:SetScript("OnClick", function()
|
|
948
|
+
frame.inputPanel.editBox:SetText("")
|
|
949
|
+
frame.inputPanel.editBox:SetFocus()
|
|
950
|
+
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
951
|
+
end)
|
|
952
|
+
|
|
953
|
+
local statusDot = actionRow:CreateTexture(nil, "ARTWORK")
|
|
954
|
+
statusDot:SetSize(5, 5)
|
|
955
|
+
statusDot:SetPoint("LEFT", actionRow, "LEFT", 2, 0)
|
|
956
|
+
frame.statusDot = statusDot
|
|
957
|
+
|
|
958
|
+
local status = actionRow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
959
|
+
status:SetPoint("LEFT", statusDot, "RIGHT", 7, 0)
|
|
960
|
+
frame.status = status
|
|
961
|
+
|
|
962
|
+
local resultLabel = CreateSectionLabel(runnerPage, L.RESULT)
|
|
963
|
+
resultLabel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -13)
|
|
964
|
+
|
|
965
|
+
local resultTextTab = CreateNavTab(runnerPage, L.TEXT)
|
|
966
|
+
FitNavTab(resultTextTab, 58, 28)
|
|
967
|
+
resultTextTab:SetPoint("TOPRIGHT", actionRow, "BOTTOMRIGHT", 0, -4)
|
|
968
|
+
frame.resultTextTab = resultTextTab
|
|
969
|
+
|
|
970
|
+
local resultTreeTab = CreateNavTab(runnerPage, L.TREE)
|
|
971
|
+
FitNavTab(resultTreeTab, 58, 28)
|
|
972
|
+
resultTreeTab:SetPoint("RIGHT", resultTextTab, "LEFT", -2, 0)
|
|
973
|
+
frame.resultTreeTab = resultTreeTab
|
|
974
|
+
|
|
975
|
+
local resultPanel = CreateTextArea(runnerPage, true)
|
|
976
|
+
resultPanel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
977
|
+
resultPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
978
|
+
resultPanel.editBox:SetWidth(WINDOW_WIDTH - MAIN_LEFT - 58)
|
|
979
|
+
resultPanel.editBox:SetScript("OnMouseUp", function(self) self:SetFocus() end)
|
|
980
|
+
frame.resultPanel = resultPanel
|
|
981
|
+
|
|
982
|
+
local treeView = ns.CreateTreeView(runnerPage, {
|
|
983
|
+
CreatePanel = CreatePanel,
|
|
984
|
+
CreateScrollArea = CreateScrollArea,
|
|
985
|
+
editorR = EDITOR_R,
|
|
986
|
+
editorG = EDITOR_G,
|
|
987
|
+
editorB = EDITOR_B,
|
|
988
|
+
surfaceR = SURFACE_R,
|
|
989
|
+
surfaceG = SURFACE_G,
|
|
990
|
+
surfaceB = SURFACE_B,
|
|
991
|
+
accentR = ACCENT_R,
|
|
992
|
+
accentG = ACCENT_G,
|
|
993
|
+
accentB = ACCENT_B,
|
|
994
|
+
contentWidth = WINDOW_WIDTH - MAIN_LEFT - 28,
|
|
995
|
+
})
|
|
996
|
+
treeView.panel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
997
|
+
treeView.panel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
998
|
+
frame.treeView = treeView
|
|
999
|
+
|
|
1000
|
+
local selectButton = CreateButton(runnerPage, 118, L.SELECT_RESULT, false)
|
|
1001
|
+
selectButton:SetPoint("BOTTOMRIGHT", -14, 14)
|
|
1002
|
+
selectButton:SetScript("OnClick", function()
|
|
1003
|
+
SetResultMode("text")
|
|
1004
|
+
SelectAllText(frame.resultPanel)
|
|
1005
|
+
end)
|
|
1006
|
+
frame.selectButton = selectButton
|
|
1007
|
+
|
|
1008
|
+
local clearHistoryButton = CreateButton(runnerPage, HISTORY_WIDTH, L.CLEAR_HISTORY, false)
|
|
1009
|
+
clearHistoryButton:SetPoint("BOTTOMLEFT", 14, 14)
|
|
1010
|
+
clearHistoryButton:SetScript("OnClick", function()
|
|
1011
|
+
ns.ClearHistory()
|
|
1012
|
+
wipe(historyTrees)
|
|
1013
|
+
selectedHistoryIndex = nil
|
|
1014
|
+
SetResult("")
|
|
1015
|
+
frame.treeView:SetTree(nil)
|
|
1016
|
+
SetResultMode("text")
|
|
1017
|
+
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
1018
|
+
RefreshHistory()
|
|
1019
|
+
end)
|
|
1020
|
+
frame.clearHistoryButton = clearHistoryButton
|
|
1021
|
+
|
|
1022
|
+
inputPanel.editBox:SetScript("OnTabPressed", function(self)
|
|
1023
|
+
self:Insert(" ")
|
|
1024
|
+
end)
|
|
1025
|
+
|
|
1026
|
+
window = frame
|
|
1027
|
+
local featureUI = {
|
|
1028
|
+
CreatePanel = CreatePanel,
|
|
1029
|
+
CreateScrollArea = CreateScrollArea,
|
|
1030
|
+
CreateTextArea = CreateTextArea,
|
|
1031
|
+
CreateButton = CreateButton,
|
|
1032
|
+
CreateListRow = CreateListRow,
|
|
1033
|
+
CreateViewTab = CreateNavTab,
|
|
1034
|
+
FitViewTab = FitNavTab,
|
|
1035
|
+
CreateSectionLabel = CreateSectionLabel,
|
|
1036
|
+
SetBorderColor = SetBorderColor,
|
|
1037
|
+
SetButtonEnabled = SetButtonEnabled,
|
|
1038
|
+
SetButtonPrimary = SetButtonPrimary,
|
|
1039
|
+
SetButtonText = SetButtonText,
|
|
1040
|
+
SetButtonVariant = SetButtonVariant,
|
|
1041
|
+
SetListRowState = SetListRowState,
|
|
1042
|
+
AppendReadOnlyText = AppendReadOnlyText,
|
|
1043
|
+
SetReadOnlyText = SetReadOnlyText,
|
|
1044
|
+
SelectAllText = SelectAllText,
|
|
1045
|
+
backdrop = BACKDROP,
|
|
1046
|
+
editorR = EDITOR_R,
|
|
1047
|
+
editorG = EDITOR_G,
|
|
1048
|
+
editorB = EDITOR_B,
|
|
1049
|
+
surfaceR = SURFACE_R,
|
|
1050
|
+
surfaceG = SURFACE_G,
|
|
1051
|
+
surfaceB = SURFACE_B,
|
|
1052
|
+
accentR = ACCENT_R,
|
|
1053
|
+
accentG = ACCENT_G,
|
|
1054
|
+
accentB = ACCENT_B,
|
|
1055
|
+
windowWidth = WINDOW_WIDTH,
|
|
1056
|
+
}
|
|
1057
|
+
local exportController = ns.CreateExportController(frame, featureUI)
|
|
1058
|
+
featureUI.ExportText = function(kind, title, content, metadata)
|
|
1059
|
+
return exportController:Save(kind, title, content, metadata)
|
|
1060
|
+
end
|
|
1061
|
+
frame.exportController = exportController
|
|
1062
|
+
|
|
1063
|
+
featureUI.OpenPage = SetActivePage
|
|
1064
|
+
|
|
1065
|
+
local exportResultButton = CreateButton(runnerPage, 92, L.SAVE_TO_DISK, false)
|
|
1066
|
+
exportResultButton:SetPoint("RIGHT", selectButton, "LEFT", -8, 0)
|
|
1067
|
+
exportResultButton:SetScript("OnClick", function()
|
|
1068
|
+
featureUI.ExportText("run_result", L.RESULT, frame.currentResultText, {
|
|
1069
|
+
code = frame.inputPanel.editBox:GetText(),
|
|
1070
|
+
})
|
|
1071
|
+
end)
|
|
1072
|
+
SetButtonEnabled(exportResultButton, false)
|
|
1073
|
+
frame.exportResultButton = exportResultButton
|
|
1074
|
+
|
|
1075
|
+
frame.objectPage = ns.CreateObjectPage(frame, featureUI)
|
|
1076
|
+
featureUI.GetObjectSelection = function()
|
|
1077
|
+
return frame.objectPage:GetSelection()
|
|
1078
|
+
end
|
|
1079
|
+
frame.eventsPage = ns.CreateEventsPage(frame, featureUI)
|
|
1080
|
+
frame.tracePage = ns.CreateTracePage(frame, featureUI)
|
|
1081
|
+
frame.diagnosticsPage = ns.CreateDiagnosticsPage(frame, featureUI)
|
|
1082
|
+
frame.exportRecordsPage = ns.CreateExportRecordsPage(frame, featureUI)
|
|
1083
|
+
frame.automationPage = ns.CreateAutomationPage(frame, featureUI)
|
|
1084
|
+
frame.aboutPage = ns.CreateAboutPage(frame, featureUI)
|
|
1085
|
+
frame.historyButtons = historyButtons
|
|
1086
|
+
frame.pages = {
|
|
1087
|
+
runner = runnerPage,
|
|
1088
|
+
objects = frame.objectPage,
|
|
1089
|
+
events = frame.eventsPage,
|
|
1090
|
+
trace = frame.tracePage,
|
|
1091
|
+
diagnostics = frame.diagnosticsPage,
|
|
1092
|
+
exports = frame.exportRecordsPage,
|
|
1093
|
+
automation = frame.automationPage,
|
|
1094
|
+
about = frame.aboutPage,
|
|
1095
|
+
}
|
|
1096
|
+
for key, page in pairs(frame.pages) do
|
|
1097
|
+
if key ~= "runner" then
|
|
1098
|
+
page:Hide()
|
|
1099
|
+
end
|
|
1100
|
+
end
|
|
1101
|
+
|
|
1102
|
+
frame:SetScript("OnHide", function()
|
|
1103
|
+
StopRuntimeTools()
|
|
1104
|
+
end)
|
|
1105
|
+
frame:HookScript("OnHide", function() exportController:Hide() end)
|
|
1106
|
+
resultTextTab:SetScript("OnClick", function()
|
|
1107
|
+
SetResultMode("text")
|
|
1108
|
+
end)
|
|
1109
|
+
resultTreeTab:SetScript("OnClick", function()
|
|
1110
|
+
SetResultMode("tree")
|
|
1111
|
+
end)
|
|
1112
|
+
|
|
1113
|
+
SetResult("")
|
|
1114
|
+
treeView:SetTree(nil)
|
|
1115
|
+
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
1116
|
+
RefreshHistory()
|
|
1117
|
+
SetResultMode("text")
|
|
1118
|
+
SetActivePage("runner")
|
|
1119
|
+
return frame
|
|
1120
|
+
end
|
|
1121
|
+
|
|
1122
|
+
function ns.ToggleWindow()
|
|
1123
|
+
if ns.IsCombatBlocked() then
|
|
1124
|
+
ns.PrintCombatBlocked()
|
|
1125
|
+
return
|
|
1126
|
+
end
|
|
1127
|
+
local frame = window or CreateWindow()
|
|
1128
|
+
if not frame or not frame.pages then
|
|
1129
|
+
return
|
|
1130
|
+
end
|
|
1131
|
+
if frame:IsShown() then
|
|
1132
|
+
frame:Hide()
|
|
1133
|
+
else
|
|
1134
|
+
frame:Show()
|
|
1135
|
+
SetActivePage(activePage)
|
|
1136
|
+
end
|
|
1137
|
+
end
|
|
1138
|
+
|
|
1139
|
+
ns.RegisterCombatShutdown(function()
|
|
1140
|
+
if window and window:IsShown() then
|
|
1141
|
+
window:Hide()
|
|
1142
|
+
else
|
|
1143
|
+
StopRuntimeTools()
|
|
1144
|
+
end
|
|
1145
|
+
end)
|