lycheedev 1.0.0 → 1.0.1
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 +21 -6
- package/package.json +1 -1
- package/vendor/addon/Core/Bootstrap.lua +131 -131
- package/vendor/addon/Core/Clients/Mainline.lua +9 -9
- package/vendor/addon/Core/Clients/Mists.lua +9 -9
- package/vendor/addon/Core/Clients/Titan.lua +9 -9
- package/vendor/addon/Core/Compatibility.lua +43 -43
- package/vendor/addon/Core/Database.lua +859 -859
- package/vendor/addon/Core/Inspector.lua +647 -647
- package/vendor/addon/Core/Locale.lua +307 -307
- package/vendor/addon/Core/Locale_enUS.lua +318 -318
- package/vendor/addon/Core/Safety.lua +42 -42
- package/vendor/addon/Core/Serializer.lua +324 -324
- package/vendor/addon/Libs/AutomationQR.lua +1176 -1176
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -43
- package/vendor/addon/Lychee Dev_Mists.toc +43 -43
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -43
- package/vendor/addon/Modules/Automation/Controller.lua +757 -757
- package/vendor/addon/Modules/Automation/Report.lua +409 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -12
- package/vendor/addon/Modules/Diagnostics.lua +238 -238
- package/vendor/addon/Modules/Events/Catalog.lua +184 -184
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -1788
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -1489
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -1492
- package/vendor/addon/Modules/Events/Monitor.lua +181 -181
- package/vendor/addon/Modules/FunctionTrace.lua +85 -85
- package/vendor/addon/Modules/ObjectInspector.lua +329 -329
- package/vendor/addon/UI/AutomationOverlay.lua +183 -183
- package/vendor/addon/UI/Export.lua +140 -140
- package/vendor/addon/UI/Features.lua +890 -890
- package/vendor/addon/UI/MainWindow.lua +1145 -1145
- package/vendor/addon/UI/Pages/About.lua +223 -223
- package/vendor/addon/UI/Pages/Automation.lua +417 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -289
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -387
- package/vendor/addon/UI/Pages/Object.lua +573 -573
- package/vendor/addon/UI/Pages/Trace.lua +165 -165
- package/vendor/skill/SKILL.md +94 -94
- package/vendor/skill/agents/openai.yaml +4 -4
- package/vendor/skill/references/automation.md +327 -327
- package/vendor/skill/references/runtime-investigations.md +97 -97
- package/vendor/skill/scripts/automation/__init__.py +1 -1
- package/vendor/skill/scripts/automation/registry.py +516 -516
- package/vendor/skill/scripts/automation/saved_variables.py +438 -438
- package/vendor/skill/scripts/automation/session.py +207 -207
- package/vendor/skill/scripts/automation/windows.py +573 -573
- package/vendor/skill/scripts/automation.py +865 -865
- package/vendor/skill/scripts/requirements.txt +13 -13
- package/vendor/skill/scripts/selftest_offline.py +981 -981
|
@@ -1,890 +1,890 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
local TREE_ROW_HEIGHT = 22
|
|
5
|
-
local TREE_ROW_POOL_SIZE = 32
|
|
6
|
-
local EVENT_ROW_HEIGHT = 36
|
|
7
|
-
local EVENT_LIST_WIDTH = 540
|
|
8
|
-
local EVENT_VISIBLE_ROWS = 18
|
|
9
|
-
local SEARCH_RESULT_LIMIT = 8
|
|
10
|
-
local SEARCH_ROW_HEIGHT = 38
|
|
11
|
-
local SELECTED_ROW_HEIGHT = 28
|
|
12
|
-
local SELECTED_VISIBLE_ROWS = 3
|
|
13
|
-
|
|
14
|
-
local function SetReadOnlyText(panel, text)
|
|
15
|
-
text = text or ""
|
|
16
|
-
local editBox = panel.editBox
|
|
17
|
-
editBox.savedText = text
|
|
18
|
-
editBox.updatingText = true
|
|
19
|
-
editBox:SetText(text)
|
|
20
|
-
editBox.updatingText = nil
|
|
21
|
-
editBox:SetCursorPosition(0)
|
|
22
|
-
panel.scroll:SetVerticalScroll(0)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
local function ValueColor(kind)
|
|
26
|
-
if kind == "string" then
|
|
27
|
-
return 0.62, 0.78, 0.64
|
|
28
|
-
elseif kind == "number" then
|
|
29
|
-
return 0.65, 0.74, 0.91
|
|
30
|
-
elseif kind == "boolean" then
|
|
31
|
-
return 0.90, 0.63, 0.42
|
|
32
|
-
elseif kind == "table" then
|
|
33
|
-
return 0.62, 0.67, 0.72
|
|
34
|
-
elseif kind == "load_more" then
|
|
35
|
-
return 0.86, 0.47, 0.55
|
|
36
|
-
elseif kind == "marker" then
|
|
37
|
-
return 0.85, 0.42, 0.48
|
|
38
|
-
end
|
|
39
|
-
return 0.70, 0.73, 0.76
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
function ns.CreateTreeView(parent, ui)
|
|
43
|
-
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
44
|
-
local scroll = ui.CreateScrollArea(panel, 8, 8, 7, 8)
|
|
45
|
-
local content = CreateFrame("Frame", nil, scroll)
|
|
46
|
-
content:SetWidth(ui.contentWidth)
|
|
47
|
-
content:SetHeight(1)
|
|
48
|
-
scroll:SetScrollChild(content)
|
|
49
|
-
|
|
50
|
-
local empty = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
51
|
-
empty:SetPoint("TOP", 0, -24)
|
|
52
|
-
empty:SetText(L.TREE_EMPTY)
|
|
53
|
-
empty:SetTextColor(1, 1, 1, 0.32)
|
|
54
|
-
|
|
55
|
-
local rows = {}
|
|
56
|
-
local visibleNodes = {}
|
|
57
|
-
local tree
|
|
58
|
-
local selectedNode
|
|
59
|
-
local selectionChanged
|
|
60
|
-
local nodeContext
|
|
61
|
-
local view = { panel = panel }
|
|
62
|
-
|
|
63
|
-
local function FlattenNodes(nodes, depth, visible)
|
|
64
|
-
for index = 1, #nodes do
|
|
65
|
-
local node = nodes[index]
|
|
66
|
-
visible[#visible + 1] = { node = node, depth = depth }
|
|
67
|
-
if node.kind == "table" and node.expanded and node.children then
|
|
68
|
-
FlattenNodes(node.children, depth + 1, visible)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
local function ApplyRowStyle(row)
|
|
74
|
-
if row.node == selectedNode then
|
|
75
|
-
row.hover:SetColorTexture(ui.accentR, ui.accentG, ui.accentB, 0.16)
|
|
76
|
-
elseif row.isHovered then
|
|
77
|
-
row.hover:SetColorTexture(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.72)
|
|
78
|
-
else
|
|
79
|
-
row.hover:SetColorTexture(0, 0, 0, 0)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
local function CreateRow(index)
|
|
84
|
-
local row = CreateFrame("Button", nil, content)
|
|
85
|
-
row:SetSize(ui.contentWidth, TREE_ROW_HEIGHT)
|
|
86
|
-
row:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
|
87
|
-
|
|
88
|
-
local hover = row:CreateTexture(nil, "BACKGROUND")
|
|
89
|
-
hover:SetAllPoints()
|
|
90
|
-
hover:SetColorTexture(0, 0, 0, 0)
|
|
91
|
-
row.hover = hover
|
|
92
|
-
|
|
93
|
-
local toggle = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
94
|
-
toggle:SetJustifyH("CENTER")
|
|
95
|
-
toggle:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.95)
|
|
96
|
-
row.toggle = toggle
|
|
97
|
-
|
|
98
|
-
local key = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
99
|
-
key:SetJustifyH("LEFT")
|
|
100
|
-
key:SetTextColor(0.91, 0.93, 0.95, 0.92)
|
|
101
|
-
row.key = key
|
|
102
|
-
|
|
103
|
-
local value = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
104
|
-
value:SetPoint("LEFT", 250, 0)
|
|
105
|
-
value:SetPoint("RIGHT", -8, 0)
|
|
106
|
-
value:SetJustifyH("LEFT")
|
|
107
|
-
value:SetWordWrap(false)
|
|
108
|
-
row.value = value
|
|
109
|
-
|
|
110
|
-
row:SetScript("OnEnter", function(self)
|
|
111
|
-
self.isHovered = true
|
|
112
|
-
ApplyRowStyle(self)
|
|
113
|
-
end)
|
|
114
|
-
row:SetScript("OnLeave", function(self)
|
|
115
|
-
self.isHovered = nil
|
|
116
|
-
ApplyRowStyle(self)
|
|
117
|
-
end)
|
|
118
|
-
row:SetScript("OnClick", function(self, mouseButton)
|
|
119
|
-
local node = self.node
|
|
120
|
-
if not node then
|
|
121
|
-
return
|
|
122
|
-
elseif mouseButton ~= "RightButton" and node.kind == "load_more" and node.owner then
|
|
123
|
-
ns.LoadMoreValueTreeNode(node.owner)
|
|
124
|
-
view:Refresh()
|
|
125
|
-
return
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
if node.exportable then
|
|
129
|
-
selectedNode = node
|
|
130
|
-
if selectionChanged then
|
|
131
|
-
selectionChanged(node)
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
if mouseButton == "RightButton" then
|
|
135
|
-
if node.exportable and nodeContext then
|
|
136
|
-
nodeContext(node)
|
|
137
|
-
end
|
|
138
|
-
view:Refresh()
|
|
139
|
-
return
|
|
140
|
-
end
|
|
141
|
-
if node.kind == "table" then
|
|
142
|
-
if node.expanded then
|
|
143
|
-
node.expanded = false
|
|
144
|
-
else
|
|
145
|
-
if not node.loaded then
|
|
146
|
-
ns.LoadMoreValueTreeNode(node)
|
|
147
|
-
end
|
|
148
|
-
node.expanded = true
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
view:Refresh()
|
|
152
|
-
end)
|
|
153
|
-
|
|
154
|
-
rows[index] = row
|
|
155
|
-
return row
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
function view:HasTree()
|
|
159
|
-
return tree and tree.roots and #tree.roots > 0
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
function view:GetSelectedNode()
|
|
163
|
-
return selectedNode
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
function view:SetOnSelectionChanged(callback)
|
|
167
|
-
selectionChanged = type(callback) == "function" and callback or nil
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
function view:SetOnNodeContext(callback)
|
|
171
|
-
nodeContext = type(callback) == "function" and callback or nil
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
function view:SetTree(newTree)
|
|
175
|
-
tree = newTree
|
|
176
|
-
selectedNode = tree and tree.roots and tree.roots[1] and tree.roots[1].exportable
|
|
177
|
-
and tree.roots[1] or nil
|
|
178
|
-
scroll:SetVerticalScroll(0)
|
|
179
|
-
self:Refresh()
|
|
180
|
-
if selectionChanged then
|
|
181
|
-
selectionChanged(selectedNode)
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
function view:RenderRows()
|
|
186
|
-
for index = 1, #rows do
|
|
187
|
-
rows[index]:Hide()
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
local offset = scroll:GetVerticalScroll() or 0
|
|
191
|
-
if issecretvalue and issecretvalue(offset) then
|
|
192
|
-
return
|
|
193
|
-
end
|
|
194
|
-
local firstIndex = math.floor(math.max(0, offset) / TREE_ROW_HEIGHT) + 1
|
|
195
|
-
local lastIndex = math.min(#visibleNodes, firstIndex + TREE_ROW_POOL_SIZE - 1)
|
|
196
|
-
|
|
197
|
-
for visibleIndex = firstIndex, lastIndex do
|
|
198
|
-
local poolIndex = visibleIndex - firstIndex + 1
|
|
199
|
-
local item = visibleNodes[visibleIndex]
|
|
200
|
-
local node = item.node
|
|
201
|
-
local row = rows[poolIndex] or CreateRow(poolIndex)
|
|
202
|
-
local indent = item.depth * 15
|
|
203
|
-
row.node = node
|
|
204
|
-
row:ClearAllPoints()
|
|
205
|
-
row:SetPoint("TOPLEFT", 0, -((visibleIndex - 1) * TREE_ROW_HEIGHT))
|
|
206
|
-
|
|
207
|
-
row.toggle:ClearAllPoints()
|
|
208
|
-
row.toggle:SetPoint("LEFT", 6 + indent, 0)
|
|
209
|
-
row.toggle:SetSize(14, TREE_ROW_HEIGHT)
|
|
210
|
-
if node.kind == "table" and (not node.loaded or #node.children > 0) then
|
|
211
|
-
row.toggle:SetText(node.expanded and "-" or "+")
|
|
212
|
-
elseif node.kind == "load_more" then
|
|
213
|
-
row.toggle:SetText("+")
|
|
214
|
-
else
|
|
215
|
-
row.toggle:SetText("")
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
row.key:ClearAllPoints()
|
|
219
|
-
row.key:SetPoint("LEFT", 24 + indent, 0)
|
|
220
|
-
row.key:SetWidth(math.max(70, 218 - indent))
|
|
221
|
-
row.key:SetText(node.label or "")
|
|
222
|
-
|
|
223
|
-
local r, g, b = ValueColor(node.kind)
|
|
224
|
-
row.value:SetTextColor(r, g, b, 0.92)
|
|
225
|
-
row.value:SetText(node.value or "")
|
|
226
|
-
ApplyRowStyle(row)
|
|
227
|
-
row:Show()
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
function view:Refresh()
|
|
232
|
-
wipe(visibleNodes)
|
|
233
|
-
if tree and tree.roots then
|
|
234
|
-
FlattenNodes(tree.roots, 0, visibleNodes)
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
content:SetHeight(math.max(1, #visibleNodes * TREE_ROW_HEIGHT))
|
|
238
|
-
scroll:UpdateScrollChildRect()
|
|
239
|
-
empty:SetShown(#visibleNodes == 0)
|
|
240
|
-
self:RenderRows()
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
scroll.onVerticalScrollChanged = function()
|
|
244
|
-
view:RenderRows()
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
view.content = content
|
|
248
|
-
view.rows = rows
|
|
249
|
-
view.scroll = scroll
|
|
250
|
-
return view
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
local function CreateLineInput(parent, ui)
|
|
254
|
-
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
255
|
-
local editBox = CreateFrame("EditBox", nil, panel)
|
|
256
|
-
editBox:SetAutoFocus(false)
|
|
257
|
-
editBox:SetFontObject(ChatFontNormal)
|
|
258
|
-
editBox:SetTextColor(0.94, 0.95, 0.96)
|
|
259
|
-
editBox:SetTextInsets(9, 9, 0, 0)
|
|
260
|
-
editBox:SetPoint("TOPLEFT", 1, -1)
|
|
261
|
-
editBox:SetPoint("BOTTOMRIGHT", -1, 1)
|
|
262
|
-
editBox:SetScript("OnEscapePressed", function(self)
|
|
263
|
-
self:ClearFocus()
|
|
264
|
-
end)
|
|
265
|
-
editBox:SetScript("OnEditFocusGained", function()
|
|
266
|
-
ui.SetBorderColor(panel, true, 0.75)
|
|
267
|
-
end)
|
|
268
|
-
editBox:SetScript("OnEditFocusLost", function()
|
|
269
|
-
ui.SetBorderColor(panel, false)
|
|
270
|
-
end)
|
|
271
|
-
panel.editBox = editBox
|
|
272
|
-
return panel
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
local function CreateRemoveButton(parent, ui)
|
|
276
|
-
local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
|
|
277
|
-
button:SetSize(22, 22)
|
|
278
|
-
button:SetBackdrop(ui.backdrop)
|
|
279
|
-
|
|
280
|
-
local firstLine = button:CreateTexture(nil, "ARTWORK")
|
|
281
|
-
firstLine:SetSize(9, 1)
|
|
282
|
-
firstLine:SetPoint("CENTER")
|
|
283
|
-
firstLine:SetRotation(0.785398)
|
|
284
|
-
|
|
285
|
-
local secondLine = button:CreateTexture(nil, "ARTWORK")
|
|
286
|
-
secondLine:SetSize(9, 1)
|
|
287
|
-
secondLine:SetPoint("CENTER")
|
|
288
|
-
secondLine:SetRotation(-0.785398)
|
|
289
|
-
|
|
290
|
-
local function ApplyState(hovered, pressed)
|
|
291
|
-
if pressed then
|
|
292
|
-
button:SetBackdropColor(ui.accentR * 0.72, ui.accentG * 0.72, ui.accentB * 0.72, 0.92)
|
|
293
|
-
button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.9)
|
|
294
|
-
elseif hovered then
|
|
295
|
-
button:SetBackdropColor(ui.accentR, ui.accentG, ui.accentB, 0.74)
|
|
296
|
-
button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
297
|
-
else
|
|
298
|
-
button:SetBackdropColor(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.58)
|
|
299
|
-
ui.SetBorderColor(button, false, 0.24)
|
|
300
|
-
end
|
|
301
|
-
local alpha = hovered and 0.95 or 0.48
|
|
302
|
-
firstLine:SetColorTexture(1, 1, 1, alpha)
|
|
303
|
-
secondLine:SetColorTexture(1, 1, 1, alpha)
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
button:SetScript("OnEnter", function(self)
|
|
307
|
-
self.isHovered = true
|
|
308
|
-
ApplyState(true, false)
|
|
309
|
-
end)
|
|
310
|
-
button:SetScript("OnLeave", function(self)
|
|
311
|
-
self.isHovered = nil
|
|
312
|
-
ApplyState(false, false)
|
|
313
|
-
end)
|
|
314
|
-
button:SetScript("OnMouseDown", function()
|
|
315
|
-
ApplyState(true, true)
|
|
316
|
-
end)
|
|
317
|
-
button:SetScript("OnMouseUp", function(self)
|
|
318
|
-
ApplyState(self.isHovered, false)
|
|
319
|
-
end)
|
|
320
|
-
ApplyState(false, false)
|
|
321
|
-
return button
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
function ns.CreateEventsPage(parent, ui)
|
|
325
|
-
local page = CreateFrame("Frame", nil, parent)
|
|
326
|
-
page:SetAllPoints(parent)
|
|
327
|
-
|
|
328
|
-
local inputLabel = ui.CreateSectionLabel(page, L.FIND_EVENT)
|
|
329
|
-
inputLabel:SetPoint("TOPLEFT", 17, -84)
|
|
330
|
-
|
|
331
|
-
local catalogCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
332
|
-
catalogCount:SetPoint("LEFT", inputLabel, "RIGHT", 9, 0)
|
|
333
|
-
catalogCount:SetText(string.format(L.CATALOG_COUNT, ns.EventCatalog.GetCount()))
|
|
334
|
-
catalogCount:SetTextColor(1, 1, 1, 0.34)
|
|
335
|
-
|
|
336
|
-
local inputPanel = CreateLineInput(page, ui)
|
|
337
|
-
inputPanel:SetPoint("TOPLEFT", 14, -104)
|
|
338
|
-
inputPanel:SetPoint("TOPRIGHT", -278, -104)
|
|
339
|
-
inputPanel:SetHeight(30)
|
|
340
|
-
page.inputPanel = inputPanel
|
|
341
|
-
|
|
342
|
-
local inputHint = inputPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
343
|
-
inputHint:SetPoint("LEFT", 10, 0)
|
|
344
|
-
inputHint:SetText(L.EVENT_SEARCH_HINT)
|
|
345
|
-
inputHint:SetTextColor(1, 1, 1, 0.30)
|
|
346
|
-
page.inputHint = inputHint
|
|
347
|
-
|
|
348
|
-
local monitorButton = ui.CreateButton(page, 140, L.START_MONITORING, true)
|
|
349
|
-
monitorButton:SetPoint("TOPRIGHT", -14, -104)
|
|
350
|
-
|
|
351
|
-
local clearButton = ui.CreateButton(page, 100, L.CLEAR_LOG, false)
|
|
352
|
-
clearButton:SetPoint("RIGHT", monitorButton, "LEFT", -8, 0)
|
|
353
|
-
page.monitorButton = monitorButton
|
|
354
|
-
page.clearButton = clearButton
|
|
355
|
-
|
|
356
|
-
local statusDot = page:CreateTexture(nil, "ARTWORK")
|
|
357
|
-
statusDot:SetSize(5, 5)
|
|
358
|
-
statusDot:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 2, -15)
|
|
359
|
-
|
|
360
|
-
local status = page:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
361
|
-
status:SetPoint("LEFT", statusDot, "RIGHT", 7, 0)
|
|
362
|
-
|
|
363
|
-
local function SetStatus(text, r, g, b)
|
|
364
|
-
status:SetText(text)
|
|
365
|
-
status:SetTextColor(r, g, b, 0.92)
|
|
366
|
-
statusDot:SetColorTexture(r, g, b, 0.92)
|
|
367
|
-
end
|
|
368
|
-
|
|
369
|
-
local selection = ns.EventCatalog.CreateSelection()
|
|
370
|
-
local SyncMonitorControls
|
|
371
|
-
local function SetSelectionStatus()
|
|
372
|
-
local count = selection:GetCount()
|
|
373
|
-
if count > 0 then
|
|
374
|
-
SetStatus(string.format(L.EVENTS_SELECTED_STATUS, count), 0.55, 0.60, 0.65)
|
|
375
|
-
else
|
|
376
|
-
SetStatus(L.EVENT_READY, 0.55, 0.60, 0.65)
|
|
377
|
-
end
|
|
378
|
-
end
|
|
379
|
-
|
|
380
|
-
local selectedLabel = ui.CreateSectionLabel(page, L.SELECTED_EVENTS)
|
|
381
|
-
selectedLabel:SetPoint("TOPLEFT", 17, -169)
|
|
382
|
-
|
|
383
|
-
local selectedCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
384
|
-
selectedCount:SetPoint("LEFT", selectedLabel, "RIGHT", 9, 0)
|
|
385
|
-
selectedCount:SetTextColor(1, 1, 1, 0.34)
|
|
386
|
-
|
|
387
|
-
local selectedPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
388
|
-
selectedPanel:SetPoint("TOPLEFT", 14, -189)
|
|
389
|
-
selectedPanel:SetPoint("TOPRIGHT", -14, -189)
|
|
390
|
-
selectedPanel:SetHeight(42)
|
|
391
|
-
page.selectedPanel = selectedPanel
|
|
392
|
-
|
|
393
|
-
local selectedScroll = ui.CreateScrollArea(selectedPanel, 7, 7, 7, 7)
|
|
394
|
-
local selectedContent = CreateFrame("Frame", nil, selectedScroll)
|
|
395
|
-
selectedContent:SetWidth(ui.windowWidth - 56)
|
|
396
|
-
selectedContent:SetHeight(1)
|
|
397
|
-
selectedScroll:SetScrollChild(selectedContent)
|
|
398
|
-
|
|
399
|
-
local selectedEmpty = selectedPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
400
|
-
selectedEmpty:SetPoint("CENTER")
|
|
401
|
-
selectedEmpty:SetText(L.NO_EVENTS_SELECTED)
|
|
402
|
-
selectedEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
403
|
-
|
|
404
|
-
local logLabel = ui.CreateSectionLabel(page, L.CAPTURED_EVENTS)
|
|
405
|
-
logLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 3, -22)
|
|
406
|
-
|
|
407
|
-
local detailLabel = ui.CreateSectionLabel(page, L.PAYLOAD)
|
|
408
|
-
detailLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 15, -22)
|
|
409
|
-
|
|
410
|
-
local logPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
411
|
-
logPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 0, -42)
|
|
412
|
-
logPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
413
|
-
logPanel:SetWidth(EVENT_LIST_WIDTH)
|
|
414
|
-
|
|
415
|
-
local logScroll = ui.CreateScrollArea(logPanel, 8, 8, 7, 8)
|
|
416
|
-
local logContent = CreateFrame("Frame", nil, logScroll)
|
|
417
|
-
logContent:SetWidth(EVENT_LIST_WIDTH - 26)
|
|
418
|
-
logContent:SetHeight(1)
|
|
419
|
-
logScroll:SetScrollChild(logContent)
|
|
420
|
-
|
|
421
|
-
local empty = logPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
422
|
-
empty:SetPoint("TOP", 0, -24)
|
|
423
|
-
empty:SetText(L.NO_EVENTS_CAPTURED)
|
|
424
|
-
empty:SetTextColor(1, 1, 1, 0.32)
|
|
425
|
-
|
|
426
|
-
local selectedRecord
|
|
427
|
-
local FormatDetails
|
|
428
|
-
local detailPanel = ui.CreateTextArea(page, true)
|
|
429
|
-
detailPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 12, -42)
|
|
430
|
-
detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
431
|
-
detailPanel.editBox:SetWidth(ui.windowWidth - EVENT_LIST_WIDTH - 78)
|
|
432
|
-
SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
|
|
433
|
-
|
|
434
|
-
local exportDetail = ui.CreateButton(page, 92, L.SAVE_TO_DISK, false)
|
|
435
|
-
exportDetail:SetPoint("BOTTOMRIGHT", -14, 14)
|
|
436
|
-
exportDetail:SetScript("OnClick", function()
|
|
437
|
-
local recordCount = ns.EventMonitor.GetCount()
|
|
438
|
-
if recordCount > 0 then
|
|
439
|
-
ui.ExportText("event_log", L.CAPTURED_EVENTS, function()
|
|
440
|
-
local records = {}
|
|
441
|
-
for index = 1, recordCount do
|
|
442
|
-
records[index] = ns.EventMonitor.GetRecord(index)
|
|
443
|
-
end
|
|
444
|
-
return ns.SerializeForExport(records)
|
|
445
|
-
end, { recordCount = recordCount })
|
|
446
|
-
end
|
|
447
|
-
end)
|
|
448
|
-
page.exportDetail = exportDetail
|
|
449
|
-
|
|
450
|
-
local rows = {}
|
|
451
|
-
local selectedRows = {}
|
|
452
|
-
local searchRows = {}
|
|
453
|
-
local searchResults = {}
|
|
454
|
-
local highlightedSearchIndex = 1
|
|
455
|
-
local refreshQueued
|
|
456
|
-
local dirty
|
|
457
|
-
|
|
458
|
-
local searchPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.99)
|
|
459
|
-
searchPanel:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -4)
|
|
460
|
-
searchPanel:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -4)
|
|
461
|
-
searchPanel:SetFrameLevel(page:GetFrameLevel() + 30)
|
|
462
|
-
searchPanel:Hide()
|
|
463
|
-
|
|
464
|
-
SyncMonitorControls = function()
|
|
465
|
-
local running = ns.EventMonitor.IsRunning()
|
|
466
|
-
ui.SetButtonText(monitorButton, running and L.STOP_MONITORING or L.START_MONITORING)
|
|
467
|
-
ui.SetButtonVariant(monitorButton, running and "danger" or "primary")
|
|
468
|
-
ui.SetButtonEnabled(monitorButton, running or selection:GetCount() > 0)
|
|
469
|
-
inputPanel.editBox:SetEnabled(not running)
|
|
470
|
-
inputPanel.editBox:SetTextColor(0.94, 0.95, 0.96, running and 0.38 or 1)
|
|
471
|
-
inputHint:SetAlpha(running and 0.22 or 1)
|
|
472
|
-
if running then
|
|
473
|
-
inputPanel.editBox:ClearFocus()
|
|
474
|
-
searchPanel:Hide()
|
|
475
|
-
end
|
|
476
|
-
for index = 1, #selectedRows do
|
|
477
|
-
local removeButton = selectedRows[index].removeButton
|
|
478
|
-
removeButton:SetEnabled(not running)
|
|
479
|
-
removeButton:SetAlpha(running and 0.24 or 1)
|
|
480
|
-
end
|
|
481
|
-
end
|
|
482
|
-
|
|
483
|
-
local function FormatCatalogPayload(eventName, signature)
|
|
484
|
-
if eventName == "ALL" then
|
|
485
|
-
return L.ALL_EVENTS
|
|
486
|
-
end
|
|
487
|
-
return signature ~= "" and (L.PAYLOAD_PREFIX .. signature) or L.NO_PAYLOAD
|
|
488
|
-
end
|
|
489
|
-
|
|
490
|
-
local function ApplySearchRowStyle(row)
|
|
491
|
-
ui.SetListRowState(row, row.resultIndex == highlightedSearchIndex, row.isHovered)
|
|
492
|
-
if row.resultIndex == highlightedSearchIndex then
|
|
493
|
-
row.name:SetTextColor(1, 1, 1, 0.96)
|
|
494
|
-
elseif row.isHovered then
|
|
495
|
-
row.name:SetTextColor(1, 1, 1, 0.9)
|
|
496
|
-
else
|
|
497
|
-
row.name:SetTextColor(1, 1, 1, 0.72)
|
|
498
|
-
end
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
local RefreshSelected
|
|
502
|
-
local function AddSearchResult(resultIndex)
|
|
503
|
-
if ns.EventMonitor.IsRunning() then
|
|
504
|
-
return
|
|
505
|
-
end
|
|
506
|
-
local catalogIndex = searchResults[resultIndex]
|
|
507
|
-
if not catalogIndex then
|
|
508
|
-
return
|
|
509
|
-
end
|
|
510
|
-
|
|
511
|
-
local succeeded, errorMessage = selection:Add(catalogIndex)
|
|
512
|
-
if succeeded then
|
|
513
|
-
inputPanel.editBox:SetText("")
|
|
514
|
-
inputHint:Show()
|
|
515
|
-
searchPanel:Hide()
|
|
516
|
-
RefreshSelected()
|
|
517
|
-
SetSelectionStatus()
|
|
518
|
-
else
|
|
519
|
-
SetStatus(errorMessage or L.COULD_NOT_SELECT_EVENT, ui.accentR, ui.accentG, ui.accentB)
|
|
520
|
-
end
|
|
521
|
-
end
|
|
522
|
-
|
|
523
|
-
local function CreateSearchRow(index)
|
|
524
|
-
local row = ui.CreateListRow(searchPanel, SEARCH_ROW_HEIGHT)
|
|
525
|
-
row:SetPoint("TOPLEFT", 3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
|
|
526
|
-
row:SetPoint("TOPRIGHT", -3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
|
|
527
|
-
row.resultIndex = index
|
|
528
|
-
|
|
529
|
-
local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
530
|
-
name:SetPoint("TOPLEFT", 9, -5)
|
|
531
|
-
name:SetPoint("TOPRIGHT", -9, -5)
|
|
532
|
-
name:SetJustifyH("LEFT")
|
|
533
|
-
name:SetWordWrap(false)
|
|
534
|
-
row.name = name
|
|
535
|
-
|
|
536
|
-
local payload = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
537
|
-
payload:SetPoint("BOTTOMLEFT", 9, 5)
|
|
538
|
-
payload:SetPoint("BOTTOMRIGHT", -9, 5)
|
|
539
|
-
payload:SetJustifyH("LEFT")
|
|
540
|
-
payload:SetWordWrap(false)
|
|
541
|
-
payload:SetTextColor(1, 1, 1, 0.38)
|
|
542
|
-
row.payload = payload
|
|
543
|
-
|
|
544
|
-
row:SetScript("OnEnter", function(self)
|
|
545
|
-
searchPanel.isHovered = true
|
|
546
|
-
self.isHovered = true
|
|
547
|
-
highlightedSearchIndex = self.resultIndex
|
|
548
|
-
for rowIndex = 1, #searchRows do
|
|
549
|
-
ApplySearchRowStyle(searchRows[rowIndex])
|
|
550
|
-
end
|
|
551
|
-
end)
|
|
552
|
-
row:SetScript("OnLeave", function(self)
|
|
553
|
-
searchPanel.isHovered = nil
|
|
554
|
-
self.isHovered = nil
|
|
555
|
-
ApplySearchRowStyle(self)
|
|
556
|
-
end)
|
|
557
|
-
row:SetScript("OnClick", function(self)
|
|
558
|
-
AddSearchResult(self.resultIndex)
|
|
559
|
-
end)
|
|
560
|
-
|
|
561
|
-
searchRows[index] = row
|
|
562
|
-
return row
|
|
563
|
-
end
|
|
564
|
-
|
|
565
|
-
local function RefreshSearch()
|
|
566
|
-
local query = inputPanel.editBox:GetText()
|
|
567
|
-
wipe(searchResults)
|
|
568
|
-
if not ns.EventMonitor.IsRunning() and query ~= "" then
|
|
569
|
-
ns.EventCatalog.Search(query, SEARCH_RESULT_LIMIT, searchResults)
|
|
570
|
-
end
|
|
571
|
-
highlightedSearchIndex = math.min(math.max(highlightedSearchIndex, 1), math.max(#searchResults, 1))
|
|
572
|
-
|
|
573
|
-
for index = 1, #searchRows do
|
|
574
|
-
searchRows[index]:Hide()
|
|
575
|
-
end
|
|
576
|
-
for index = 1, #searchResults do
|
|
577
|
-
local row = searchRows[index] or CreateSearchRow(index)
|
|
578
|
-
local eventName, signature = ns.EventCatalog.Get(searchResults[index])
|
|
579
|
-
row.name:SetText(eventName)
|
|
580
|
-
row.payload:SetText(FormatCatalogPayload(eventName, signature))
|
|
581
|
-
ApplySearchRowStyle(row)
|
|
582
|
-
row:Show()
|
|
583
|
-
end
|
|
584
|
-
|
|
585
|
-
searchPanel:SetHeight(math.max(1, #searchResults * SEARCH_ROW_HEIGHT + 6))
|
|
586
|
-
searchPanel:SetShown(#searchResults > 0 and inputPanel.editBox:HasFocus())
|
|
587
|
-
end
|
|
588
|
-
|
|
589
|
-
local function ApplySelectedRowStyle(row)
|
|
590
|
-
ui.SetListRowState(row, false, row.isHovered)
|
|
591
|
-
end
|
|
592
|
-
|
|
593
|
-
local function CreateSelectedRow(index)
|
|
594
|
-
local row = ui.CreateListRow(selectedContent, SELECTED_ROW_HEIGHT)
|
|
595
|
-
row:SetWidth(ui.windowWidth - 56)
|
|
596
|
-
row:EnableMouse(true)
|
|
597
|
-
|
|
598
|
-
local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
599
|
-
name:SetPoint("LEFT", 9, 0)
|
|
600
|
-
name:SetWidth(330)
|
|
601
|
-
name:SetJustifyH("LEFT")
|
|
602
|
-
name:SetWordWrap(false)
|
|
603
|
-
name:SetTextColor(0.93, 0.94, 0.96, 0.9)
|
|
604
|
-
row.name = name
|
|
605
|
-
|
|
606
|
-
local payload = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
607
|
-
payload:SetPoint("LEFT", 348, 0)
|
|
608
|
-
payload:SetPoint("RIGHT", -35, 0)
|
|
609
|
-
payload:SetJustifyH("LEFT")
|
|
610
|
-
payload:SetWordWrap(false)
|
|
611
|
-
payload:SetTextColor(1, 1, 1, 0.36)
|
|
612
|
-
row.payload = payload
|
|
613
|
-
|
|
614
|
-
local removeButton = CreateRemoveButton(row, ui)
|
|
615
|
-
removeButton:SetPoint("RIGHT", -3, 0)
|
|
616
|
-
removeButton:SetScript("OnClick", function()
|
|
617
|
-
if not ns.EventMonitor.IsRunning() and row.eventName and selection:Remove(row.eventName) then
|
|
618
|
-
RefreshSelected()
|
|
619
|
-
SetSelectionStatus()
|
|
620
|
-
end
|
|
621
|
-
end)
|
|
622
|
-
row.removeButton = removeButton
|
|
623
|
-
|
|
624
|
-
row:SetScript("OnEnter", function(self)
|
|
625
|
-
self.isHovered = true
|
|
626
|
-
ApplySelectedRowStyle(self)
|
|
627
|
-
end)
|
|
628
|
-
row:SetScript("OnLeave", function(self)
|
|
629
|
-
self.isHovered = nil
|
|
630
|
-
ApplySelectedRowStyle(self)
|
|
631
|
-
end)
|
|
632
|
-
|
|
633
|
-
selectedRows[index] = row
|
|
634
|
-
return row
|
|
635
|
-
end
|
|
636
|
-
|
|
637
|
-
RefreshSelected = function()
|
|
638
|
-
for index = 1, #selectedRows do
|
|
639
|
-
selectedRows[index]:Hide()
|
|
640
|
-
end
|
|
641
|
-
|
|
642
|
-
local selectionCount = selection:GetCount()
|
|
643
|
-
local scrollOffset = selectedScroll:GetVerticalScroll()
|
|
644
|
-
if issecretvalue and issecretvalue(scrollOffset) then
|
|
645
|
-
scrollOffset = 0
|
|
646
|
-
end
|
|
647
|
-
local firstIndex = math.floor((scrollOffset or 0) / SELECTED_ROW_HEIGHT) + 1
|
|
648
|
-
local lastIndex = math.min(selectionCount, firstIndex + SELECTED_VISIBLE_ROWS - 1)
|
|
649
|
-
local poolIndex = 0
|
|
650
|
-
for selectionIndex = firstIndex, lastIndex do
|
|
651
|
-
poolIndex = poolIndex + 1
|
|
652
|
-
local row = selectedRows[poolIndex] or CreateSelectedRow(poolIndex)
|
|
653
|
-
local eventName, signature = selection:Get(selectionIndex)
|
|
654
|
-
row.eventName = eventName
|
|
655
|
-
row:ClearAllPoints()
|
|
656
|
-
row:SetPoint("TOPLEFT", 0, -((selectionIndex - 1) * SELECTED_ROW_HEIGHT))
|
|
657
|
-
row.name:SetText(eventName)
|
|
658
|
-
row.payload:SetText(FormatCatalogPayload(eventName, signature))
|
|
659
|
-
ApplySelectedRowStyle(row)
|
|
660
|
-
row:Show()
|
|
661
|
-
end
|
|
662
|
-
|
|
663
|
-
selectedCount:SetText(string.format(L.SELECTED_COUNT, selectionCount))
|
|
664
|
-
selectedPanel:SetHeight(math.max(42,
|
|
665
|
-
math.min(selectionCount, SELECTED_VISIBLE_ROWS) * SELECTED_ROW_HEIGHT + 14))
|
|
666
|
-
selectedContent:SetHeight(math.max(1, selectionCount * SELECTED_ROW_HEIGHT))
|
|
667
|
-
selectedScroll:UpdateScrollChildRect()
|
|
668
|
-
selectedEmpty:SetShown(selectionCount == 0)
|
|
669
|
-
SyncMonitorControls()
|
|
670
|
-
end
|
|
671
|
-
|
|
672
|
-
selectedScroll.onVerticalScrollChanged = RefreshSelected
|
|
673
|
-
|
|
674
|
-
inputPanel.editBox:SetScript("OnTextChanged", function(self)
|
|
675
|
-
inputHint:SetShown(self:GetText() == "")
|
|
676
|
-
highlightedSearchIndex = 1
|
|
677
|
-
RefreshSearch()
|
|
678
|
-
end)
|
|
679
|
-
inputPanel.editBox:SetScript("OnEditFocusGained", function()
|
|
680
|
-
ui.SetBorderColor(inputPanel, true, 0.75)
|
|
681
|
-
RefreshSearch()
|
|
682
|
-
end)
|
|
683
|
-
inputPanel.editBox:SetScript("OnEditFocusLost", function()
|
|
684
|
-
ui.SetBorderColor(inputPanel, false)
|
|
685
|
-
if not searchPanel.isHovered then
|
|
686
|
-
searchPanel:Hide()
|
|
687
|
-
end
|
|
688
|
-
end)
|
|
689
|
-
inputPanel.editBox:SetScript("OnArrowPressed", function(_, key)
|
|
690
|
-
if not searchPanel:IsShown() or #searchResults == 0 then
|
|
691
|
-
return
|
|
692
|
-
end
|
|
693
|
-
if key == "UP" then
|
|
694
|
-
highlightedSearchIndex = highlightedSearchIndex > 1 and highlightedSearchIndex - 1 or #searchResults
|
|
695
|
-
elseif key == "DOWN" then
|
|
696
|
-
highlightedSearchIndex = highlightedSearchIndex < #searchResults and highlightedSearchIndex + 1 or 1
|
|
697
|
-
end
|
|
698
|
-
for index = 1, #searchRows do
|
|
699
|
-
ApplySearchRowStyle(searchRows[index])
|
|
700
|
-
end
|
|
701
|
-
end)
|
|
702
|
-
inputPanel.editBox:SetScript("OnEnterPressed", function()
|
|
703
|
-
AddSearchResult(highlightedSearchIndex)
|
|
704
|
-
end)
|
|
705
|
-
inputPanel.editBox:SetScript("OnEscapePressed", function(self)
|
|
706
|
-
if searchPanel:IsShown() then
|
|
707
|
-
searchPanel:Hide()
|
|
708
|
-
else
|
|
709
|
-
self:ClearFocus()
|
|
710
|
-
end
|
|
711
|
-
end)
|
|
712
|
-
|
|
713
|
-
FormatDetails = function(record)
|
|
714
|
-
if not record then
|
|
715
|
-
return L.SELECT_EVENT_DETAIL
|
|
716
|
-
end
|
|
717
|
-
|
|
718
|
-
local lines = {
|
|
719
|
-
string.format(L.EVENT_DETAIL, record.event),
|
|
720
|
-
string.format(L.ELAPSED_DETAIL, record.elapsed),
|
|
721
|
-
"",
|
|
722
|
-
}
|
|
723
|
-
if #record.arguments == 0 then
|
|
724
|
-
lines[#lines + 1] = L.EVENT_HAS_NO_PAYLOAD
|
|
725
|
-
else
|
|
726
|
-
for index = 1, #record.arguments do
|
|
727
|
-
lines[#lines + 1] = "[" .. index .. "] = " .. record.arguments[index]
|
|
728
|
-
end
|
|
729
|
-
end
|
|
730
|
-
return table.concat(lines, "\n")
|
|
731
|
-
end
|
|
732
|
-
|
|
733
|
-
local function ApplyEventRowStyle(row)
|
|
734
|
-
ui.SetListRowState(row, row.record == selectedRecord, row.isHovered)
|
|
735
|
-
end
|
|
736
|
-
|
|
737
|
-
local function CreateEventRow(index)
|
|
738
|
-
local row = ui.CreateListRow(logContent, EVENT_ROW_HEIGHT)
|
|
739
|
-
row:SetWidth(EVENT_LIST_WIDTH - 26)
|
|
740
|
-
|
|
741
|
-
local timeLabel = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
742
|
-
timeLabel:SetPoint("LEFT", 8, 0)
|
|
743
|
-
timeLabel:SetWidth(62)
|
|
744
|
-
timeLabel:SetJustifyH("LEFT")
|
|
745
|
-
timeLabel:SetTextColor(1, 1, 1, 0.38)
|
|
746
|
-
row.timeLabel = timeLabel
|
|
747
|
-
|
|
748
|
-
local eventLabel = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
749
|
-
eventLabel:SetPoint("LEFT", 72, 7)
|
|
750
|
-
eventLabel:SetPoint("RIGHT", -8, 7)
|
|
751
|
-
eventLabel:SetJustifyH("LEFT")
|
|
752
|
-
eventLabel:SetWordWrap(false)
|
|
753
|
-
eventLabel:SetTextColor(0.93, 0.94, 0.96, 0.9)
|
|
754
|
-
row.eventLabel = eventLabel
|
|
755
|
-
|
|
756
|
-
local summary = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
757
|
-
summary:SetPoint("LEFT", 72, -8)
|
|
758
|
-
summary:SetPoint("RIGHT", -8, -8)
|
|
759
|
-
summary:SetJustifyH("LEFT")
|
|
760
|
-
summary:SetWordWrap(false)
|
|
761
|
-
summary:SetTextColor(1, 1, 1, 0.38)
|
|
762
|
-
row.summary = summary
|
|
763
|
-
|
|
764
|
-
row:SetScript("OnEnter", function(self)
|
|
765
|
-
self.isHovered = true
|
|
766
|
-
ApplyEventRowStyle(self)
|
|
767
|
-
end)
|
|
768
|
-
row:SetScript("OnLeave", function(self)
|
|
769
|
-
self.isHovered = nil
|
|
770
|
-
ApplyEventRowStyle(self)
|
|
771
|
-
end)
|
|
772
|
-
row:SetScript("OnClick", function(self)
|
|
773
|
-
selectedRecord = self.record
|
|
774
|
-
SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
|
|
775
|
-
page:Refresh()
|
|
776
|
-
end)
|
|
777
|
-
|
|
778
|
-
rows[index] = row
|
|
779
|
-
return row
|
|
780
|
-
end
|
|
781
|
-
|
|
782
|
-
function page:Refresh()
|
|
783
|
-
dirty = nil
|
|
784
|
-
local recordCount = ns.EventMonitor.GetCount()
|
|
785
|
-
ui.SetButtonEnabled(clearButton, recordCount > 0)
|
|
786
|
-
ui.SetButtonEnabled(exportDetail, recordCount > 0)
|
|
787
|
-
for index = 1, #rows do
|
|
788
|
-
rows[index]:Hide()
|
|
789
|
-
end
|
|
790
|
-
|
|
791
|
-
local scrollOffset = logScroll:GetVerticalScroll()
|
|
792
|
-
if issecretvalue and issecretvalue(scrollOffset) then
|
|
793
|
-
scrollOffset = 0
|
|
794
|
-
end
|
|
795
|
-
local firstIndex = math.floor((scrollOffset or 0) / EVENT_ROW_HEIGHT) + 1
|
|
796
|
-
local lastIndex = math.min(recordCount, firstIndex + EVENT_VISIBLE_ROWS - 1)
|
|
797
|
-
local poolIndex = 0
|
|
798
|
-
for recordIndex = firstIndex, lastIndex do
|
|
799
|
-
poolIndex = poolIndex + 1
|
|
800
|
-
local record = ns.EventMonitor.GetRecord(recordIndex)
|
|
801
|
-
local row = rows[poolIndex] or CreateEventRow(poolIndex)
|
|
802
|
-
row.record = record
|
|
803
|
-
row:ClearAllPoints()
|
|
804
|
-
row:SetPoint("TOPLEFT", 0, -((recordIndex - 1) * EVENT_ROW_HEIGHT))
|
|
805
|
-
row.timeLabel:SetText(string.format("+%.2fs", record.elapsed))
|
|
806
|
-
row.eventLabel:SetText(record.event)
|
|
807
|
-
row.summary:SetText(record.summary ~= "" and record.summary or L.NO_PAYLOAD)
|
|
808
|
-
ApplyEventRowStyle(row)
|
|
809
|
-
row:Show()
|
|
810
|
-
end
|
|
811
|
-
|
|
812
|
-
logContent:SetHeight(math.max(1, recordCount * EVENT_ROW_HEIGHT))
|
|
813
|
-
logScroll:UpdateScrollChildRect()
|
|
814
|
-
empty:SetShown(recordCount == 0)
|
|
815
|
-
if selectedRecord then
|
|
816
|
-
SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
|
|
817
|
-
end
|
|
818
|
-
end
|
|
819
|
-
|
|
820
|
-
logScroll.onVerticalScrollChanged = function()
|
|
821
|
-
page:Refresh()
|
|
822
|
-
end
|
|
823
|
-
|
|
824
|
-
local function FlushRefresh()
|
|
825
|
-
refreshQueued = nil
|
|
826
|
-
if page:IsShown() then
|
|
827
|
-
page:Refresh()
|
|
828
|
-
else
|
|
829
|
-
dirty = true
|
|
830
|
-
end
|
|
831
|
-
end
|
|
832
|
-
|
|
833
|
-
local function QueueRefresh()
|
|
834
|
-
if refreshQueued then
|
|
835
|
-
return
|
|
836
|
-
end
|
|
837
|
-
refreshQueued = true
|
|
838
|
-
C_Timer.After(0, FlushRefresh)
|
|
839
|
-
end
|
|
840
|
-
|
|
841
|
-
monitorButton:SetScript("OnClick", function()
|
|
842
|
-
if ns.EventMonitor.IsRunning() then
|
|
843
|
-
ns.EventMonitor.Stop()
|
|
844
|
-
SetStatus(L.STOPPED, 0.55, 0.60, 0.65)
|
|
845
|
-
SyncMonitorControls()
|
|
846
|
-
return
|
|
847
|
-
end
|
|
848
|
-
|
|
849
|
-
local succeeded, errorMessage = ns.EventMonitor.Start(selection:GetNames(), QueueRefresh)
|
|
850
|
-
if succeeded then
|
|
851
|
-
local listeningText = ns.EventMonitor.IsMonitoringAllEvents()
|
|
852
|
-
and L.MONITORING_ALL_EVENTS
|
|
853
|
-
or string.format(L.MONITORING_EVENTS, ns.EventMonitor.GetActiveEventCount())
|
|
854
|
-
SetStatus(listeningText, 0.42, 0.76, 0.43)
|
|
855
|
-
inputPanel.editBox:ClearFocus()
|
|
856
|
-
searchPanel:Hide()
|
|
857
|
-
else
|
|
858
|
-
SetStatus(errorMessage or L.COULD_NOT_START, ui.accentR, ui.accentG, ui.accentB)
|
|
859
|
-
end
|
|
860
|
-
SyncMonitorControls()
|
|
861
|
-
end)
|
|
862
|
-
|
|
863
|
-
clearButton:SetScript("OnClick", function()
|
|
864
|
-
ns.EventMonitor.Clear()
|
|
865
|
-
selectedRecord = nil
|
|
866
|
-
SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
|
|
867
|
-
page:Refresh()
|
|
868
|
-
end)
|
|
869
|
-
|
|
870
|
-
function page:FocusInput()
|
|
871
|
-
inputPanel.editBox:SetFocus()
|
|
872
|
-
end
|
|
873
|
-
|
|
874
|
-
function page:StopMonitor()
|
|
875
|
-
ns.EventMonitor.Stop()
|
|
876
|
-
SetSelectionStatus()
|
|
877
|
-
SyncMonitorControls()
|
|
878
|
-
end
|
|
879
|
-
|
|
880
|
-
function page:RefreshIfDirty()
|
|
881
|
-
if dirty then
|
|
882
|
-
self:Refresh()
|
|
883
|
-
end
|
|
884
|
-
end
|
|
885
|
-
|
|
886
|
-
SetSelectionStatus()
|
|
887
|
-
RefreshSelected()
|
|
888
|
-
page:Refresh()
|
|
889
|
-
return page
|
|
890
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local TREE_ROW_HEIGHT = 22
|
|
5
|
+
local TREE_ROW_POOL_SIZE = 32
|
|
6
|
+
local EVENT_ROW_HEIGHT = 36
|
|
7
|
+
local EVENT_LIST_WIDTH = 540
|
|
8
|
+
local EVENT_VISIBLE_ROWS = 18
|
|
9
|
+
local SEARCH_RESULT_LIMIT = 8
|
|
10
|
+
local SEARCH_ROW_HEIGHT = 38
|
|
11
|
+
local SELECTED_ROW_HEIGHT = 28
|
|
12
|
+
local SELECTED_VISIBLE_ROWS = 3
|
|
13
|
+
|
|
14
|
+
local function SetReadOnlyText(panel, text)
|
|
15
|
+
text = text or ""
|
|
16
|
+
local editBox = panel.editBox
|
|
17
|
+
editBox.savedText = text
|
|
18
|
+
editBox.updatingText = true
|
|
19
|
+
editBox:SetText(text)
|
|
20
|
+
editBox.updatingText = nil
|
|
21
|
+
editBox:SetCursorPosition(0)
|
|
22
|
+
panel.scroll:SetVerticalScroll(0)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
local function ValueColor(kind)
|
|
26
|
+
if kind == "string" then
|
|
27
|
+
return 0.62, 0.78, 0.64
|
|
28
|
+
elseif kind == "number" then
|
|
29
|
+
return 0.65, 0.74, 0.91
|
|
30
|
+
elseif kind == "boolean" then
|
|
31
|
+
return 0.90, 0.63, 0.42
|
|
32
|
+
elseif kind == "table" then
|
|
33
|
+
return 0.62, 0.67, 0.72
|
|
34
|
+
elseif kind == "load_more" then
|
|
35
|
+
return 0.86, 0.47, 0.55
|
|
36
|
+
elseif kind == "marker" then
|
|
37
|
+
return 0.85, 0.42, 0.48
|
|
38
|
+
end
|
|
39
|
+
return 0.70, 0.73, 0.76
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function ns.CreateTreeView(parent, ui)
|
|
43
|
+
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
44
|
+
local scroll = ui.CreateScrollArea(panel, 8, 8, 7, 8)
|
|
45
|
+
local content = CreateFrame("Frame", nil, scroll)
|
|
46
|
+
content:SetWidth(ui.contentWidth)
|
|
47
|
+
content:SetHeight(1)
|
|
48
|
+
scroll:SetScrollChild(content)
|
|
49
|
+
|
|
50
|
+
local empty = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
51
|
+
empty:SetPoint("TOP", 0, -24)
|
|
52
|
+
empty:SetText(L.TREE_EMPTY)
|
|
53
|
+
empty:SetTextColor(1, 1, 1, 0.32)
|
|
54
|
+
|
|
55
|
+
local rows = {}
|
|
56
|
+
local visibleNodes = {}
|
|
57
|
+
local tree
|
|
58
|
+
local selectedNode
|
|
59
|
+
local selectionChanged
|
|
60
|
+
local nodeContext
|
|
61
|
+
local view = { panel = panel }
|
|
62
|
+
|
|
63
|
+
local function FlattenNodes(nodes, depth, visible)
|
|
64
|
+
for index = 1, #nodes do
|
|
65
|
+
local node = nodes[index]
|
|
66
|
+
visible[#visible + 1] = { node = node, depth = depth }
|
|
67
|
+
if node.kind == "table" and node.expanded and node.children then
|
|
68
|
+
FlattenNodes(node.children, depth + 1, visible)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local function ApplyRowStyle(row)
|
|
74
|
+
if row.node == selectedNode then
|
|
75
|
+
row.hover:SetColorTexture(ui.accentR, ui.accentG, ui.accentB, 0.16)
|
|
76
|
+
elseif row.isHovered then
|
|
77
|
+
row.hover:SetColorTexture(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.72)
|
|
78
|
+
else
|
|
79
|
+
row.hover:SetColorTexture(0, 0, 0, 0)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
local function CreateRow(index)
|
|
84
|
+
local row = CreateFrame("Button", nil, content)
|
|
85
|
+
row:SetSize(ui.contentWidth, TREE_ROW_HEIGHT)
|
|
86
|
+
row:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
|
87
|
+
|
|
88
|
+
local hover = row:CreateTexture(nil, "BACKGROUND")
|
|
89
|
+
hover:SetAllPoints()
|
|
90
|
+
hover:SetColorTexture(0, 0, 0, 0)
|
|
91
|
+
row.hover = hover
|
|
92
|
+
|
|
93
|
+
local toggle = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
94
|
+
toggle:SetJustifyH("CENTER")
|
|
95
|
+
toggle:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.95)
|
|
96
|
+
row.toggle = toggle
|
|
97
|
+
|
|
98
|
+
local key = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
99
|
+
key:SetJustifyH("LEFT")
|
|
100
|
+
key:SetTextColor(0.91, 0.93, 0.95, 0.92)
|
|
101
|
+
row.key = key
|
|
102
|
+
|
|
103
|
+
local value = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
104
|
+
value:SetPoint("LEFT", 250, 0)
|
|
105
|
+
value:SetPoint("RIGHT", -8, 0)
|
|
106
|
+
value:SetJustifyH("LEFT")
|
|
107
|
+
value:SetWordWrap(false)
|
|
108
|
+
row.value = value
|
|
109
|
+
|
|
110
|
+
row:SetScript("OnEnter", function(self)
|
|
111
|
+
self.isHovered = true
|
|
112
|
+
ApplyRowStyle(self)
|
|
113
|
+
end)
|
|
114
|
+
row:SetScript("OnLeave", function(self)
|
|
115
|
+
self.isHovered = nil
|
|
116
|
+
ApplyRowStyle(self)
|
|
117
|
+
end)
|
|
118
|
+
row:SetScript("OnClick", function(self, mouseButton)
|
|
119
|
+
local node = self.node
|
|
120
|
+
if not node then
|
|
121
|
+
return
|
|
122
|
+
elseif mouseButton ~= "RightButton" and node.kind == "load_more" and node.owner then
|
|
123
|
+
ns.LoadMoreValueTreeNode(node.owner)
|
|
124
|
+
view:Refresh()
|
|
125
|
+
return
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if node.exportable then
|
|
129
|
+
selectedNode = node
|
|
130
|
+
if selectionChanged then
|
|
131
|
+
selectionChanged(node)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
if mouseButton == "RightButton" then
|
|
135
|
+
if node.exportable and nodeContext then
|
|
136
|
+
nodeContext(node)
|
|
137
|
+
end
|
|
138
|
+
view:Refresh()
|
|
139
|
+
return
|
|
140
|
+
end
|
|
141
|
+
if node.kind == "table" then
|
|
142
|
+
if node.expanded then
|
|
143
|
+
node.expanded = false
|
|
144
|
+
else
|
|
145
|
+
if not node.loaded then
|
|
146
|
+
ns.LoadMoreValueTreeNode(node)
|
|
147
|
+
end
|
|
148
|
+
node.expanded = true
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
view:Refresh()
|
|
152
|
+
end)
|
|
153
|
+
|
|
154
|
+
rows[index] = row
|
|
155
|
+
return row
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
function view:HasTree()
|
|
159
|
+
return tree and tree.roots and #tree.roots > 0
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
function view:GetSelectedNode()
|
|
163
|
+
return selectedNode
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
function view:SetOnSelectionChanged(callback)
|
|
167
|
+
selectionChanged = type(callback) == "function" and callback or nil
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
function view:SetOnNodeContext(callback)
|
|
171
|
+
nodeContext = type(callback) == "function" and callback or nil
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
function view:SetTree(newTree)
|
|
175
|
+
tree = newTree
|
|
176
|
+
selectedNode = tree and tree.roots and tree.roots[1] and tree.roots[1].exportable
|
|
177
|
+
and tree.roots[1] or nil
|
|
178
|
+
scroll:SetVerticalScroll(0)
|
|
179
|
+
self:Refresh()
|
|
180
|
+
if selectionChanged then
|
|
181
|
+
selectionChanged(selectedNode)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
function view:RenderRows()
|
|
186
|
+
for index = 1, #rows do
|
|
187
|
+
rows[index]:Hide()
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
local offset = scroll:GetVerticalScroll() or 0
|
|
191
|
+
if issecretvalue and issecretvalue(offset) then
|
|
192
|
+
return
|
|
193
|
+
end
|
|
194
|
+
local firstIndex = math.floor(math.max(0, offset) / TREE_ROW_HEIGHT) + 1
|
|
195
|
+
local lastIndex = math.min(#visibleNodes, firstIndex + TREE_ROW_POOL_SIZE - 1)
|
|
196
|
+
|
|
197
|
+
for visibleIndex = firstIndex, lastIndex do
|
|
198
|
+
local poolIndex = visibleIndex - firstIndex + 1
|
|
199
|
+
local item = visibleNodes[visibleIndex]
|
|
200
|
+
local node = item.node
|
|
201
|
+
local row = rows[poolIndex] or CreateRow(poolIndex)
|
|
202
|
+
local indent = item.depth * 15
|
|
203
|
+
row.node = node
|
|
204
|
+
row:ClearAllPoints()
|
|
205
|
+
row:SetPoint("TOPLEFT", 0, -((visibleIndex - 1) * TREE_ROW_HEIGHT))
|
|
206
|
+
|
|
207
|
+
row.toggle:ClearAllPoints()
|
|
208
|
+
row.toggle:SetPoint("LEFT", 6 + indent, 0)
|
|
209
|
+
row.toggle:SetSize(14, TREE_ROW_HEIGHT)
|
|
210
|
+
if node.kind == "table" and (not node.loaded or #node.children > 0) then
|
|
211
|
+
row.toggle:SetText(node.expanded and "-" or "+")
|
|
212
|
+
elseif node.kind == "load_more" then
|
|
213
|
+
row.toggle:SetText("+")
|
|
214
|
+
else
|
|
215
|
+
row.toggle:SetText("")
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
row.key:ClearAllPoints()
|
|
219
|
+
row.key:SetPoint("LEFT", 24 + indent, 0)
|
|
220
|
+
row.key:SetWidth(math.max(70, 218 - indent))
|
|
221
|
+
row.key:SetText(node.label or "")
|
|
222
|
+
|
|
223
|
+
local r, g, b = ValueColor(node.kind)
|
|
224
|
+
row.value:SetTextColor(r, g, b, 0.92)
|
|
225
|
+
row.value:SetText(node.value or "")
|
|
226
|
+
ApplyRowStyle(row)
|
|
227
|
+
row:Show()
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
function view:Refresh()
|
|
232
|
+
wipe(visibleNodes)
|
|
233
|
+
if tree and tree.roots then
|
|
234
|
+
FlattenNodes(tree.roots, 0, visibleNodes)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
content:SetHeight(math.max(1, #visibleNodes * TREE_ROW_HEIGHT))
|
|
238
|
+
scroll:UpdateScrollChildRect()
|
|
239
|
+
empty:SetShown(#visibleNodes == 0)
|
|
240
|
+
self:RenderRows()
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
scroll.onVerticalScrollChanged = function()
|
|
244
|
+
view:RenderRows()
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
view.content = content
|
|
248
|
+
view.rows = rows
|
|
249
|
+
view.scroll = scroll
|
|
250
|
+
return view
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
local function CreateLineInput(parent, ui)
|
|
254
|
+
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
255
|
+
local editBox = CreateFrame("EditBox", nil, panel)
|
|
256
|
+
editBox:SetAutoFocus(false)
|
|
257
|
+
editBox:SetFontObject(ChatFontNormal)
|
|
258
|
+
editBox:SetTextColor(0.94, 0.95, 0.96)
|
|
259
|
+
editBox:SetTextInsets(9, 9, 0, 0)
|
|
260
|
+
editBox:SetPoint("TOPLEFT", 1, -1)
|
|
261
|
+
editBox:SetPoint("BOTTOMRIGHT", -1, 1)
|
|
262
|
+
editBox:SetScript("OnEscapePressed", function(self)
|
|
263
|
+
self:ClearFocus()
|
|
264
|
+
end)
|
|
265
|
+
editBox:SetScript("OnEditFocusGained", function()
|
|
266
|
+
ui.SetBorderColor(panel, true, 0.75)
|
|
267
|
+
end)
|
|
268
|
+
editBox:SetScript("OnEditFocusLost", function()
|
|
269
|
+
ui.SetBorderColor(panel, false)
|
|
270
|
+
end)
|
|
271
|
+
panel.editBox = editBox
|
|
272
|
+
return panel
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
local function CreateRemoveButton(parent, ui)
|
|
276
|
+
local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
|
|
277
|
+
button:SetSize(22, 22)
|
|
278
|
+
button:SetBackdrop(ui.backdrop)
|
|
279
|
+
|
|
280
|
+
local firstLine = button:CreateTexture(nil, "ARTWORK")
|
|
281
|
+
firstLine:SetSize(9, 1)
|
|
282
|
+
firstLine:SetPoint("CENTER")
|
|
283
|
+
firstLine:SetRotation(0.785398)
|
|
284
|
+
|
|
285
|
+
local secondLine = button:CreateTexture(nil, "ARTWORK")
|
|
286
|
+
secondLine:SetSize(9, 1)
|
|
287
|
+
secondLine:SetPoint("CENTER")
|
|
288
|
+
secondLine:SetRotation(-0.785398)
|
|
289
|
+
|
|
290
|
+
local function ApplyState(hovered, pressed)
|
|
291
|
+
if pressed then
|
|
292
|
+
button:SetBackdropColor(ui.accentR * 0.72, ui.accentG * 0.72, ui.accentB * 0.72, 0.92)
|
|
293
|
+
button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.9)
|
|
294
|
+
elseif hovered then
|
|
295
|
+
button:SetBackdropColor(ui.accentR, ui.accentG, ui.accentB, 0.74)
|
|
296
|
+
button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
297
|
+
else
|
|
298
|
+
button:SetBackdropColor(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.58)
|
|
299
|
+
ui.SetBorderColor(button, false, 0.24)
|
|
300
|
+
end
|
|
301
|
+
local alpha = hovered and 0.95 or 0.48
|
|
302
|
+
firstLine:SetColorTexture(1, 1, 1, alpha)
|
|
303
|
+
secondLine:SetColorTexture(1, 1, 1, alpha)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
button:SetScript("OnEnter", function(self)
|
|
307
|
+
self.isHovered = true
|
|
308
|
+
ApplyState(true, false)
|
|
309
|
+
end)
|
|
310
|
+
button:SetScript("OnLeave", function(self)
|
|
311
|
+
self.isHovered = nil
|
|
312
|
+
ApplyState(false, false)
|
|
313
|
+
end)
|
|
314
|
+
button:SetScript("OnMouseDown", function()
|
|
315
|
+
ApplyState(true, true)
|
|
316
|
+
end)
|
|
317
|
+
button:SetScript("OnMouseUp", function(self)
|
|
318
|
+
ApplyState(self.isHovered, false)
|
|
319
|
+
end)
|
|
320
|
+
ApplyState(false, false)
|
|
321
|
+
return button
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
function ns.CreateEventsPage(parent, ui)
|
|
325
|
+
local page = CreateFrame("Frame", nil, parent)
|
|
326
|
+
page:SetAllPoints(parent)
|
|
327
|
+
|
|
328
|
+
local inputLabel = ui.CreateSectionLabel(page, L.FIND_EVENT)
|
|
329
|
+
inputLabel:SetPoint("TOPLEFT", 17, -84)
|
|
330
|
+
|
|
331
|
+
local catalogCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
332
|
+
catalogCount:SetPoint("LEFT", inputLabel, "RIGHT", 9, 0)
|
|
333
|
+
catalogCount:SetText(string.format(L.CATALOG_COUNT, ns.EventCatalog.GetCount()))
|
|
334
|
+
catalogCount:SetTextColor(1, 1, 1, 0.34)
|
|
335
|
+
|
|
336
|
+
local inputPanel = CreateLineInput(page, ui)
|
|
337
|
+
inputPanel:SetPoint("TOPLEFT", 14, -104)
|
|
338
|
+
inputPanel:SetPoint("TOPRIGHT", -278, -104)
|
|
339
|
+
inputPanel:SetHeight(30)
|
|
340
|
+
page.inputPanel = inputPanel
|
|
341
|
+
|
|
342
|
+
local inputHint = inputPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
343
|
+
inputHint:SetPoint("LEFT", 10, 0)
|
|
344
|
+
inputHint:SetText(L.EVENT_SEARCH_HINT)
|
|
345
|
+
inputHint:SetTextColor(1, 1, 1, 0.30)
|
|
346
|
+
page.inputHint = inputHint
|
|
347
|
+
|
|
348
|
+
local monitorButton = ui.CreateButton(page, 140, L.START_MONITORING, true)
|
|
349
|
+
monitorButton:SetPoint("TOPRIGHT", -14, -104)
|
|
350
|
+
|
|
351
|
+
local clearButton = ui.CreateButton(page, 100, L.CLEAR_LOG, false)
|
|
352
|
+
clearButton:SetPoint("RIGHT", monitorButton, "LEFT", -8, 0)
|
|
353
|
+
page.monitorButton = monitorButton
|
|
354
|
+
page.clearButton = clearButton
|
|
355
|
+
|
|
356
|
+
local statusDot = page:CreateTexture(nil, "ARTWORK")
|
|
357
|
+
statusDot:SetSize(5, 5)
|
|
358
|
+
statusDot:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 2, -15)
|
|
359
|
+
|
|
360
|
+
local status = page:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
361
|
+
status:SetPoint("LEFT", statusDot, "RIGHT", 7, 0)
|
|
362
|
+
|
|
363
|
+
local function SetStatus(text, r, g, b)
|
|
364
|
+
status:SetText(text)
|
|
365
|
+
status:SetTextColor(r, g, b, 0.92)
|
|
366
|
+
statusDot:SetColorTexture(r, g, b, 0.92)
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
local selection = ns.EventCatalog.CreateSelection()
|
|
370
|
+
local SyncMonitorControls
|
|
371
|
+
local function SetSelectionStatus()
|
|
372
|
+
local count = selection:GetCount()
|
|
373
|
+
if count > 0 then
|
|
374
|
+
SetStatus(string.format(L.EVENTS_SELECTED_STATUS, count), 0.55, 0.60, 0.65)
|
|
375
|
+
else
|
|
376
|
+
SetStatus(L.EVENT_READY, 0.55, 0.60, 0.65)
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
local selectedLabel = ui.CreateSectionLabel(page, L.SELECTED_EVENTS)
|
|
381
|
+
selectedLabel:SetPoint("TOPLEFT", 17, -169)
|
|
382
|
+
|
|
383
|
+
local selectedCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
384
|
+
selectedCount:SetPoint("LEFT", selectedLabel, "RIGHT", 9, 0)
|
|
385
|
+
selectedCount:SetTextColor(1, 1, 1, 0.34)
|
|
386
|
+
|
|
387
|
+
local selectedPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
388
|
+
selectedPanel:SetPoint("TOPLEFT", 14, -189)
|
|
389
|
+
selectedPanel:SetPoint("TOPRIGHT", -14, -189)
|
|
390
|
+
selectedPanel:SetHeight(42)
|
|
391
|
+
page.selectedPanel = selectedPanel
|
|
392
|
+
|
|
393
|
+
local selectedScroll = ui.CreateScrollArea(selectedPanel, 7, 7, 7, 7)
|
|
394
|
+
local selectedContent = CreateFrame("Frame", nil, selectedScroll)
|
|
395
|
+
selectedContent:SetWidth(ui.windowWidth - 56)
|
|
396
|
+
selectedContent:SetHeight(1)
|
|
397
|
+
selectedScroll:SetScrollChild(selectedContent)
|
|
398
|
+
|
|
399
|
+
local selectedEmpty = selectedPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
400
|
+
selectedEmpty:SetPoint("CENTER")
|
|
401
|
+
selectedEmpty:SetText(L.NO_EVENTS_SELECTED)
|
|
402
|
+
selectedEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
403
|
+
|
|
404
|
+
local logLabel = ui.CreateSectionLabel(page, L.CAPTURED_EVENTS)
|
|
405
|
+
logLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 3, -22)
|
|
406
|
+
|
|
407
|
+
local detailLabel = ui.CreateSectionLabel(page, L.PAYLOAD)
|
|
408
|
+
detailLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 15, -22)
|
|
409
|
+
|
|
410
|
+
local logPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
411
|
+
logPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 0, -42)
|
|
412
|
+
logPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
413
|
+
logPanel:SetWidth(EVENT_LIST_WIDTH)
|
|
414
|
+
|
|
415
|
+
local logScroll = ui.CreateScrollArea(logPanel, 8, 8, 7, 8)
|
|
416
|
+
local logContent = CreateFrame("Frame", nil, logScroll)
|
|
417
|
+
logContent:SetWidth(EVENT_LIST_WIDTH - 26)
|
|
418
|
+
logContent:SetHeight(1)
|
|
419
|
+
logScroll:SetScrollChild(logContent)
|
|
420
|
+
|
|
421
|
+
local empty = logPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
422
|
+
empty:SetPoint("TOP", 0, -24)
|
|
423
|
+
empty:SetText(L.NO_EVENTS_CAPTURED)
|
|
424
|
+
empty:SetTextColor(1, 1, 1, 0.32)
|
|
425
|
+
|
|
426
|
+
local selectedRecord
|
|
427
|
+
local FormatDetails
|
|
428
|
+
local detailPanel = ui.CreateTextArea(page, true)
|
|
429
|
+
detailPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 12, -42)
|
|
430
|
+
detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
431
|
+
detailPanel.editBox:SetWidth(ui.windowWidth - EVENT_LIST_WIDTH - 78)
|
|
432
|
+
SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
|
|
433
|
+
|
|
434
|
+
local exportDetail = ui.CreateButton(page, 92, L.SAVE_TO_DISK, false)
|
|
435
|
+
exportDetail:SetPoint("BOTTOMRIGHT", -14, 14)
|
|
436
|
+
exportDetail:SetScript("OnClick", function()
|
|
437
|
+
local recordCount = ns.EventMonitor.GetCount()
|
|
438
|
+
if recordCount > 0 then
|
|
439
|
+
ui.ExportText("event_log", L.CAPTURED_EVENTS, function()
|
|
440
|
+
local records = {}
|
|
441
|
+
for index = 1, recordCount do
|
|
442
|
+
records[index] = ns.EventMonitor.GetRecord(index)
|
|
443
|
+
end
|
|
444
|
+
return ns.SerializeForExport(records)
|
|
445
|
+
end, { recordCount = recordCount })
|
|
446
|
+
end
|
|
447
|
+
end)
|
|
448
|
+
page.exportDetail = exportDetail
|
|
449
|
+
|
|
450
|
+
local rows = {}
|
|
451
|
+
local selectedRows = {}
|
|
452
|
+
local searchRows = {}
|
|
453
|
+
local searchResults = {}
|
|
454
|
+
local highlightedSearchIndex = 1
|
|
455
|
+
local refreshQueued
|
|
456
|
+
local dirty
|
|
457
|
+
|
|
458
|
+
local searchPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.99)
|
|
459
|
+
searchPanel:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -4)
|
|
460
|
+
searchPanel:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -4)
|
|
461
|
+
searchPanel:SetFrameLevel(page:GetFrameLevel() + 30)
|
|
462
|
+
searchPanel:Hide()
|
|
463
|
+
|
|
464
|
+
SyncMonitorControls = function()
|
|
465
|
+
local running = ns.EventMonitor.IsRunning()
|
|
466
|
+
ui.SetButtonText(monitorButton, running and L.STOP_MONITORING or L.START_MONITORING)
|
|
467
|
+
ui.SetButtonVariant(monitorButton, running and "danger" or "primary")
|
|
468
|
+
ui.SetButtonEnabled(monitorButton, running or selection:GetCount() > 0)
|
|
469
|
+
inputPanel.editBox:SetEnabled(not running)
|
|
470
|
+
inputPanel.editBox:SetTextColor(0.94, 0.95, 0.96, running and 0.38 or 1)
|
|
471
|
+
inputHint:SetAlpha(running and 0.22 or 1)
|
|
472
|
+
if running then
|
|
473
|
+
inputPanel.editBox:ClearFocus()
|
|
474
|
+
searchPanel:Hide()
|
|
475
|
+
end
|
|
476
|
+
for index = 1, #selectedRows do
|
|
477
|
+
local removeButton = selectedRows[index].removeButton
|
|
478
|
+
removeButton:SetEnabled(not running)
|
|
479
|
+
removeButton:SetAlpha(running and 0.24 or 1)
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
local function FormatCatalogPayload(eventName, signature)
|
|
484
|
+
if eventName == "ALL" then
|
|
485
|
+
return L.ALL_EVENTS
|
|
486
|
+
end
|
|
487
|
+
return signature ~= "" and (L.PAYLOAD_PREFIX .. signature) or L.NO_PAYLOAD
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
local function ApplySearchRowStyle(row)
|
|
491
|
+
ui.SetListRowState(row, row.resultIndex == highlightedSearchIndex, row.isHovered)
|
|
492
|
+
if row.resultIndex == highlightedSearchIndex then
|
|
493
|
+
row.name:SetTextColor(1, 1, 1, 0.96)
|
|
494
|
+
elseif row.isHovered then
|
|
495
|
+
row.name:SetTextColor(1, 1, 1, 0.9)
|
|
496
|
+
else
|
|
497
|
+
row.name:SetTextColor(1, 1, 1, 0.72)
|
|
498
|
+
end
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
local RefreshSelected
|
|
502
|
+
local function AddSearchResult(resultIndex)
|
|
503
|
+
if ns.EventMonitor.IsRunning() then
|
|
504
|
+
return
|
|
505
|
+
end
|
|
506
|
+
local catalogIndex = searchResults[resultIndex]
|
|
507
|
+
if not catalogIndex then
|
|
508
|
+
return
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
local succeeded, errorMessage = selection:Add(catalogIndex)
|
|
512
|
+
if succeeded then
|
|
513
|
+
inputPanel.editBox:SetText("")
|
|
514
|
+
inputHint:Show()
|
|
515
|
+
searchPanel:Hide()
|
|
516
|
+
RefreshSelected()
|
|
517
|
+
SetSelectionStatus()
|
|
518
|
+
else
|
|
519
|
+
SetStatus(errorMessage or L.COULD_NOT_SELECT_EVENT, ui.accentR, ui.accentG, ui.accentB)
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
local function CreateSearchRow(index)
|
|
524
|
+
local row = ui.CreateListRow(searchPanel, SEARCH_ROW_HEIGHT)
|
|
525
|
+
row:SetPoint("TOPLEFT", 3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
|
|
526
|
+
row:SetPoint("TOPRIGHT", -3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
|
|
527
|
+
row.resultIndex = index
|
|
528
|
+
|
|
529
|
+
local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
530
|
+
name:SetPoint("TOPLEFT", 9, -5)
|
|
531
|
+
name:SetPoint("TOPRIGHT", -9, -5)
|
|
532
|
+
name:SetJustifyH("LEFT")
|
|
533
|
+
name:SetWordWrap(false)
|
|
534
|
+
row.name = name
|
|
535
|
+
|
|
536
|
+
local payload = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
537
|
+
payload:SetPoint("BOTTOMLEFT", 9, 5)
|
|
538
|
+
payload:SetPoint("BOTTOMRIGHT", -9, 5)
|
|
539
|
+
payload:SetJustifyH("LEFT")
|
|
540
|
+
payload:SetWordWrap(false)
|
|
541
|
+
payload:SetTextColor(1, 1, 1, 0.38)
|
|
542
|
+
row.payload = payload
|
|
543
|
+
|
|
544
|
+
row:SetScript("OnEnter", function(self)
|
|
545
|
+
searchPanel.isHovered = true
|
|
546
|
+
self.isHovered = true
|
|
547
|
+
highlightedSearchIndex = self.resultIndex
|
|
548
|
+
for rowIndex = 1, #searchRows do
|
|
549
|
+
ApplySearchRowStyle(searchRows[rowIndex])
|
|
550
|
+
end
|
|
551
|
+
end)
|
|
552
|
+
row:SetScript("OnLeave", function(self)
|
|
553
|
+
searchPanel.isHovered = nil
|
|
554
|
+
self.isHovered = nil
|
|
555
|
+
ApplySearchRowStyle(self)
|
|
556
|
+
end)
|
|
557
|
+
row:SetScript("OnClick", function(self)
|
|
558
|
+
AddSearchResult(self.resultIndex)
|
|
559
|
+
end)
|
|
560
|
+
|
|
561
|
+
searchRows[index] = row
|
|
562
|
+
return row
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
local function RefreshSearch()
|
|
566
|
+
local query = inputPanel.editBox:GetText()
|
|
567
|
+
wipe(searchResults)
|
|
568
|
+
if not ns.EventMonitor.IsRunning() and query ~= "" then
|
|
569
|
+
ns.EventCatalog.Search(query, SEARCH_RESULT_LIMIT, searchResults)
|
|
570
|
+
end
|
|
571
|
+
highlightedSearchIndex = math.min(math.max(highlightedSearchIndex, 1), math.max(#searchResults, 1))
|
|
572
|
+
|
|
573
|
+
for index = 1, #searchRows do
|
|
574
|
+
searchRows[index]:Hide()
|
|
575
|
+
end
|
|
576
|
+
for index = 1, #searchResults do
|
|
577
|
+
local row = searchRows[index] or CreateSearchRow(index)
|
|
578
|
+
local eventName, signature = ns.EventCatalog.Get(searchResults[index])
|
|
579
|
+
row.name:SetText(eventName)
|
|
580
|
+
row.payload:SetText(FormatCatalogPayload(eventName, signature))
|
|
581
|
+
ApplySearchRowStyle(row)
|
|
582
|
+
row:Show()
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
searchPanel:SetHeight(math.max(1, #searchResults * SEARCH_ROW_HEIGHT + 6))
|
|
586
|
+
searchPanel:SetShown(#searchResults > 0 and inputPanel.editBox:HasFocus())
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
local function ApplySelectedRowStyle(row)
|
|
590
|
+
ui.SetListRowState(row, false, row.isHovered)
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
local function CreateSelectedRow(index)
|
|
594
|
+
local row = ui.CreateListRow(selectedContent, SELECTED_ROW_HEIGHT)
|
|
595
|
+
row:SetWidth(ui.windowWidth - 56)
|
|
596
|
+
row:EnableMouse(true)
|
|
597
|
+
|
|
598
|
+
local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
599
|
+
name:SetPoint("LEFT", 9, 0)
|
|
600
|
+
name:SetWidth(330)
|
|
601
|
+
name:SetJustifyH("LEFT")
|
|
602
|
+
name:SetWordWrap(false)
|
|
603
|
+
name:SetTextColor(0.93, 0.94, 0.96, 0.9)
|
|
604
|
+
row.name = name
|
|
605
|
+
|
|
606
|
+
local payload = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
607
|
+
payload:SetPoint("LEFT", 348, 0)
|
|
608
|
+
payload:SetPoint("RIGHT", -35, 0)
|
|
609
|
+
payload:SetJustifyH("LEFT")
|
|
610
|
+
payload:SetWordWrap(false)
|
|
611
|
+
payload:SetTextColor(1, 1, 1, 0.36)
|
|
612
|
+
row.payload = payload
|
|
613
|
+
|
|
614
|
+
local removeButton = CreateRemoveButton(row, ui)
|
|
615
|
+
removeButton:SetPoint("RIGHT", -3, 0)
|
|
616
|
+
removeButton:SetScript("OnClick", function()
|
|
617
|
+
if not ns.EventMonitor.IsRunning() and row.eventName and selection:Remove(row.eventName) then
|
|
618
|
+
RefreshSelected()
|
|
619
|
+
SetSelectionStatus()
|
|
620
|
+
end
|
|
621
|
+
end)
|
|
622
|
+
row.removeButton = removeButton
|
|
623
|
+
|
|
624
|
+
row:SetScript("OnEnter", function(self)
|
|
625
|
+
self.isHovered = true
|
|
626
|
+
ApplySelectedRowStyle(self)
|
|
627
|
+
end)
|
|
628
|
+
row:SetScript("OnLeave", function(self)
|
|
629
|
+
self.isHovered = nil
|
|
630
|
+
ApplySelectedRowStyle(self)
|
|
631
|
+
end)
|
|
632
|
+
|
|
633
|
+
selectedRows[index] = row
|
|
634
|
+
return row
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
RefreshSelected = function()
|
|
638
|
+
for index = 1, #selectedRows do
|
|
639
|
+
selectedRows[index]:Hide()
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
local selectionCount = selection:GetCount()
|
|
643
|
+
local scrollOffset = selectedScroll:GetVerticalScroll()
|
|
644
|
+
if issecretvalue and issecretvalue(scrollOffset) then
|
|
645
|
+
scrollOffset = 0
|
|
646
|
+
end
|
|
647
|
+
local firstIndex = math.floor((scrollOffset or 0) / SELECTED_ROW_HEIGHT) + 1
|
|
648
|
+
local lastIndex = math.min(selectionCount, firstIndex + SELECTED_VISIBLE_ROWS - 1)
|
|
649
|
+
local poolIndex = 0
|
|
650
|
+
for selectionIndex = firstIndex, lastIndex do
|
|
651
|
+
poolIndex = poolIndex + 1
|
|
652
|
+
local row = selectedRows[poolIndex] or CreateSelectedRow(poolIndex)
|
|
653
|
+
local eventName, signature = selection:Get(selectionIndex)
|
|
654
|
+
row.eventName = eventName
|
|
655
|
+
row:ClearAllPoints()
|
|
656
|
+
row:SetPoint("TOPLEFT", 0, -((selectionIndex - 1) * SELECTED_ROW_HEIGHT))
|
|
657
|
+
row.name:SetText(eventName)
|
|
658
|
+
row.payload:SetText(FormatCatalogPayload(eventName, signature))
|
|
659
|
+
ApplySelectedRowStyle(row)
|
|
660
|
+
row:Show()
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
selectedCount:SetText(string.format(L.SELECTED_COUNT, selectionCount))
|
|
664
|
+
selectedPanel:SetHeight(math.max(42,
|
|
665
|
+
math.min(selectionCount, SELECTED_VISIBLE_ROWS) * SELECTED_ROW_HEIGHT + 14))
|
|
666
|
+
selectedContent:SetHeight(math.max(1, selectionCount * SELECTED_ROW_HEIGHT))
|
|
667
|
+
selectedScroll:UpdateScrollChildRect()
|
|
668
|
+
selectedEmpty:SetShown(selectionCount == 0)
|
|
669
|
+
SyncMonitorControls()
|
|
670
|
+
end
|
|
671
|
+
|
|
672
|
+
selectedScroll.onVerticalScrollChanged = RefreshSelected
|
|
673
|
+
|
|
674
|
+
inputPanel.editBox:SetScript("OnTextChanged", function(self)
|
|
675
|
+
inputHint:SetShown(self:GetText() == "")
|
|
676
|
+
highlightedSearchIndex = 1
|
|
677
|
+
RefreshSearch()
|
|
678
|
+
end)
|
|
679
|
+
inputPanel.editBox:SetScript("OnEditFocusGained", function()
|
|
680
|
+
ui.SetBorderColor(inputPanel, true, 0.75)
|
|
681
|
+
RefreshSearch()
|
|
682
|
+
end)
|
|
683
|
+
inputPanel.editBox:SetScript("OnEditFocusLost", function()
|
|
684
|
+
ui.SetBorderColor(inputPanel, false)
|
|
685
|
+
if not searchPanel.isHovered then
|
|
686
|
+
searchPanel:Hide()
|
|
687
|
+
end
|
|
688
|
+
end)
|
|
689
|
+
inputPanel.editBox:SetScript("OnArrowPressed", function(_, key)
|
|
690
|
+
if not searchPanel:IsShown() or #searchResults == 0 then
|
|
691
|
+
return
|
|
692
|
+
end
|
|
693
|
+
if key == "UP" then
|
|
694
|
+
highlightedSearchIndex = highlightedSearchIndex > 1 and highlightedSearchIndex - 1 or #searchResults
|
|
695
|
+
elseif key == "DOWN" then
|
|
696
|
+
highlightedSearchIndex = highlightedSearchIndex < #searchResults and highlightedSearchIndex + 1 or 1
|
|
697
|
+
end
|
|
698
|
+
for index = 1, #searchRows do
|
|
699
|
+
ApplySearchRowStyle(searchRows[index])
|
|
700
|
+
end
|
|
701
|
+
end)
|
|
702
|
+
inputPanel.editBox:SetScript("OnEnterPressed", function()
|
|
703
|
+
AddSearchResult(highlightedSearchIndex)
|
|
704
|
+
end)
|
|
705
|
+
inputPanel.editBox:SetScript("OnEscapePressed", function(self)
|
|
706
|
+
if searchPanel:IsShown() then
|
|
707
|
+
searchPanel:Hide()
|
|
708
|
+
else
|
|
709
|
+
self:ClearFocus()
|
|
710
|
+
end
|
|
711
|
+
end)
|
|
712
|
+
|
|
713
|
+
FormatDetails = function(record)
|
|
714
|
+
if not record then
|
|
715
|
+
return L.SELECT_EVENT_DETAIL
|
|
716
|
+
end
|
|
717
|
+
|
|
718
|
+
local lines = {
|
|
719
|
+
string.format(L.EVENT_DETAIL, record.event),
|
|
720
|
+
string.format(L.ELAPSED_DETAIL, record.elapsed),
|
|
721
|
+
"",
|
|
722
|
+
}
|
|
723
|
+
if #record.arguments == 0 then
|
|
724
|
+
lines[#lines + 1] = L.EVENT_HAS_NO_PAYLOAD
|
|
725
|
+
else
|
|
726
|
+
for index = 1, #record.arguments do
|
|
727
|
+
lines[#lines + 1] = "[" .. index .. "] = " .. record.arguments[index]
|
|
728
|
+
end
|
|
729
|
+
end
|
|
730
|
+
return table.concat(lines, "\n")
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
local function ApplyEventRowStyle(row)
|
|
734
|
+
ui.SetListRowState(row, row.record == selectedRecord, row.isHovered)
|
|
735
|
+
end
|
|
736
|
+
|
|
737
|
+
local function CreateEventRow(index)
|
|
738
|
+
local row = ui.CreateListRow(logContent, EVENT_ROW_HEIGHT)
|
|
739
|
+
row:SetWidth(EVENT_LIST_WIDTH - 26)
|
|
740
|
+
|
|
741
|
+
local timeLabel = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
742
|
+
timeLabel:SetPoint("LEFT", 8, 0)
|
|
743
|
+
timeLabel:SetWidth(62)
|
|
744
|
+
timeLabel:SetJustifyH("LEFT")
|
|
745
|
+
timeLabel:SetTextColor(1, 1, 1, 0.38)
|
|
746
|
+
row.timeLabel = timeLabel
|
|
747
|
+
|
|
748
|
+
local eventLabel = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
749
|
+
eventLabel:SetPoint("LEFT", 72, 7)
|
|
750
|
+
eventLabel:SetPoint("RIGHT", -8, 7)
|
|
751
|
+
eventLabel:SetJustifyH("LEFT")
|
|
752
|
+
eventLabel:SetWordWrap(false)
|
|
753
|
+
eventLabel:SetTextColor(0.93, 0.94, 0.96, 0.9)
|
|
754
|
+
row.eventLabel = eventLabel
|
|
755
|
+
|
|
756
|
+
local summary = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
757
|
+
summary:SetPoint("LEFT", 72, -8)
|
|
758
|
+
summary:SetPoint("RIGHT", -8, -8)
|
|
759
|
+
summary:SetJustifyH("LEFT")
|
|
760
|
+
summary:SetWordWrap(false)
|
|
761
|
+
summary:SetTextColor(1, 1, 1, 0.38)
|
|
762
|
+
row.summary = summary
|
|
763
|
+
|
|
764
|
+
row:SetScript("OnEnter", function(self)
|
|
765
|
+
self.isHovered = true
|
|
766
|
+
ApplyEventRowStyle(self)
|
|
767
|
+
end)
|
|
768
|
+
row:SetScript("OnLeave", function(self)
|
|
769
|
+
self.isHovered = nil
|
|
770
|
+
ApplyEventRowStyle(self)
|
|
771
|
+
end)
|
|
772
|
+
row:SetScript("OnClick", function(self)
|
|
773
|
+
selectedRecord = self.record
|
|
774
|
+
SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
|
|
775
|
+
page:Refresh()
|
|
776
|
+
end)
|
|
777
|
+
|
|
778
|
+
rows[index] = row
|
|
779
|
+
return row
|
|
780
|
+
end
|
|
781
|
+
|
|
782
|
+
function page:Refresh()
|
|
783
|
+
dirty = nil
|
|
784
|
+
local recordCount = ns.EventMonitor.GetCount()
|
|
785
|
+
ui.SetButtonEnabled(clearButton, recordCount > 0)
|
|
786
|
+
ui.SetButtonEnabled(exportDetail, recordCount > 0)
|
|
787
|
+
for index = 1, #rows do
|
|
788
|
+
rows[index]:Hide()
|
|
789
|
+
end
|
|
790
|
+
|
|
791
|
+
local scrollOffset = logScroll:GetVerticalScroll()
|
|
792
|
+
if issecretvalue and issecretvalue(scrollOffset) then
|
|
793
|
+
scrollOffset = 0
|
|
794
|
+
end
|
|
795
|
+
local firstIndex = math.floor((scrollOffset or 0) / EVENT_ROW_HEIGHT) + 1
|
|
796
|
+
local lastIndex = math.min(recordCount, firstIndex + EVENT_VISIBLE_ROWS - 1)
|
|
797
|
+
local poolIndex = 0
|
|
798
|
+
for recordIndex = firstIndex, lastIndex do
|
|
799
|
+
poolIndex = poolIndex + 1
|
|
800
|
+
local record = ns.EventMonitor.GetRecord(recordIndex)
|
|
801
|
+
local row = rows[poolIndex] or CreateEventRow(poolIndex)
|
|
802
|
+
row.record = record
|
|
803
|
+
row:ClearAllPoints()
|
|
804
|
+
row:SetPoint("TOPLEFT", 0, -((recordIndex - 1) * EVENT_ROW_HEIGHT))
|
|
805
|
+
row.timeLabel:SetText(string.format("+%.2fs", record.elapsed))
|
|
806
|
+
row.eventLabel:SetText(record.event)
|
|
807
|
+
row.summary:SetText(record.summary ~= "" and record.summary or L.NO_PAYLOAD)
|
|
808
|
+
ApplyEventRowStyle(row)
|
|
809
|
+
row:Show()
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
logContent:SetHeight(math.max(1, recordCount * EVENT_ROW_HEIGHT))
|
|
813
|
+
logScroll:UpdateScrollChildRect()
|
|
814
|
+
empty:SetShown(recordCount == 0)
|
|
815
|
+
if selectedRecord then
|
|
816
|
+
SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
|
|
817
|
+
end
|
|
818
|
+
end
|
|
819
|
+
|
|
820
|
+
logScroll.onVerticalScrollChanged = function()
|
|
821
|
+
page:Refresh()
|
|
822
|
+
end
|
|
823
|
+
|
|
824
|
+
local function FlushRefresh()
|
|
825
|
+
refreshQueued = nil
|
|
826
|
+
if page:IsShown() then
|
|
827
|
+
page:Refresh()
|
|
828
|
+
else
|
|
829
|
+
dirty = true
|
|
830
|
+
end
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
local function QueueRefresh()
|
|
834
|
+
if refreshQueued then
|
|
835
|
+
return
|
|
836
|
+
end
|
|
837
|
+
refreshQueued = true
|
|
838
|
+
C_Timer.After(0, FlushRefresh)
|
|
839
|
+
end
|
|
840
|
+
|
|
841
|
+
monitorButton:SetScript("OnClick", function()
|
|
842
|
+
if ns.EventMonitor.IsRunning() then
|
|
843
|
+
ns.EventMonitor.Stop()
|
|
844
|
+
SetStatus(L.STOPPED, 0.55, 0.60, 0.65)
|
|
845
|
+
SyncMonitorControls()
|
|
846
|
+
return
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
local succeeded, errorMessage = ns.EventMonitor.Start(selection:GetNames(), QueueRefresh)
|
|
850
|
+
if succeeded then
|
|
851
|
+
local listeningText = ns.EventMonitor.IsMonitoringAllEvents()
|
|
852
|
+
and L.MONITORING_ALL_EVENTS
|
|
853
|
+
or string.format(L.MONITORING_EVENTS, ns.EventMonitor.GetActiveEventCount())
|
|
854
|
+
SetStatus(listeningText, 0.42, 0.76, 0.43)
|
|
855
|
+
inputPanel.editBox:ClearFocus()
|
|
856
|
+
searchPanel:Hide()
|
|
857
|
+
else
|
|
858
|
+
SetStatus(errorMessage or L.COULD_NOT_START, ui.accentR, ui.accentG, ui.accentB)
|
|
859
|
+
end
|
|
860
|
+
SyncMonitorControls()
|
|
861
|
+
end)
|
|
862
|
+
|
|
863
|
+
clearButton:SetScript("OnClick", function()
|
|
864
|
+
ns.EventMonitor.Clear()
|
|
865
|
+
selectedRecord = nil
|
|
866
|
+
SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
|
|
867
|
+
page:Refresh()
|
|
868
|
+
end)
|
|
869
|
+
|
|
870
|
+
function page:FocusInput()
|
|
871
|
+
inputPanel.editBox:SetFocus()
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
function page:StopMonitor()
|
|
875
|
+
ns.EventMonitor.Stop()
|
|
876
|
+
SetSelectionStatus()
|
|
877
|
+
SyncMonitorControls()
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
function page:RefreshIfDirty()
|
|
881
|
+
if dirty then
|
|
882
|
+
self:Refresh()
|
|
883
|
+
end
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
SetSelectionStatus()
|
|
887
|
+
RefreshSelected()
|
|
888
|
+
page:Refresh()
|
|
889
|
+
return page
|
|
890
|
+
end
|