Nenue@28
|
1 --- ${PACKAGE_NAME}
|
Nenue@28
|
2 -- @file-author@
|
Nenue@28
|
3 -- @project-revision@ @project-hash@
|
Nenue@28
|
4 -- @file-revision@ @file-hash@
|
Nenue@28
|
5 -- Created: 3/30/2016 12:49 AM
|
Nenue@28
|
6 local B = select(2,...).frame
|
Nenue@30
|
7 local Module = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
|
Nenue@28
|
8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
|
Nenue@28
|
9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
|
Nenue@28
|
10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
|
Nenue@28
|
11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
|
Nenue@28
|
12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent
|
Nenue@30
|
13 local Default, AutoQuest, Quest, Bonus, Cheevs = Module.DefaultHandler, Module.AutoQuest, Module.Quest, Module.Bonus, Module.Cheevs
|
Nenue@28
|
14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame
|
Nenue@29
|
15 local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow
|
Nenue@28
|
16 local print = B.print('Tracker')
|
Nenue@28
|
17 local unitLevel = 1
|
Nenue@28
|
18 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
|
Nenue@28
|
19 local debug = false
|
Nenue@28
|
20
|
Nenue@28
|
21 --- Upvalues
|
Nenue@28
|
22 local Wrapper = _G.VeneerObjectiveWrapper
|
Nenue@28
|
23 local Scroller = Wrapper.scrollArea
|
Nenue@28
|
24 local Scroll = _G.VeneerObjectiveScroll
|
Nenue@30
|
25 local orderedHandlers = Module.orderedHandlers
|
Nenue@30
|
26 local orderedNames = Module.orderedNames
|
Nenue@28
|
27
|
Nenue@28
|
28 --- Temp values set during updates
|
Nenue@28
|
29 local wrapperWidth, wrapperHeight
|
Nenue@28
|
30 local scrollWidth, scrollHeight
|
Nenue@28
|
31 local previousBlock
|
Nenue@28
|
32 local currentBlock
|
Nenue@28
|
33 --- todo: source these from config
|
Nenue@28
|
34 local itemButtonSize, itemButtonSpacing = 36, 1
|
Nenue@28
|
35
|
Nenue@30
|
36 local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2
|
Nenue@28
|
37 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}
|
Nenue@28
|
38 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'
|
Nenue@28
|
39
|
Nenue@31
|
40 local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2}
|
Nenue@31
|
41 local titlebg_daily = {'HORIZONTAL', 0, .7, 1, 0, 0, 1, .7, .2 }
|
Nenue@31
|
42 local titlebg_account = {'HORIZONTAL', 0, .45, 1, 0, 0, .45, 1, .2}
|
Nenue@28
|
43 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'
|
Nenue@28
|
44
|
Nenue@28
|
45 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
|
Nenue@28
|
46 local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
|
Nenue@28
|
47 local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 }
|
Nenue@28
|
48 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'
|
Nenue@28
|
49
|
Nenue@28
|
50
|
Nenue@28
|
51 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
|
Nenue@28
|
52 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
|
Nenue@28
|
53 local titleIndent, textIndent,selectionIndent = 2, 5, 50
|
Nenue@28
|
54
|
Nenue@30
|
55 local lineColors = {
|
Nenue@31
|
56 normal = {
|
Nenue@31
|
57 text = {.5,.75,1},
|
Nenue@31
|
58 },
|
Nenue@31
|
59 completed = {
|
Nenue@31
|
60 text = {1,0,.1}
|
Nenue@31
|
61 },
|
Nenue@31
|
62 failed = {
|
Nenue@31
|
63 text = {1,0,0 }
|
Nenue@31
|
64 },
|
Nenue@31
|
65 autocomplete = {
|
Nenue@31
|
66 text = {0,1,0 }
|
Nenue@31
|
67 },
|
Nenue@31
|
68 object = {
|
Nenue@31
|
69 text = {0,1,1}
|
Nenue@31
|
70 },
|
Nenue@31
|
71 monster = {
|
Nenue@31
|
72 text = {1,1,0}
|
Nenue@31
|
73 },
|
Nenue@31
|
74 item = {
|
Nenue@31
|
75 text = {1,.25,.5}
|
Nenue@31
|
76 }
|
Nenue@30
|
77 }
|
Nenue@30
|
78
|
Nenue@28
|
79 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
|
Nenue@28
|
80 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
|
Nenue@28
|
81 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
|
Nenue@28
|
82 local rewardSize = 32
|
Nenue@28
|
83 local oprint = B.print('Objectives')
|
Nenue@28
|
84 local bprint = B.print('Block')
|
Nenue@28
|
85 local tprint = B.print('Tracker')
|
Nenue@28
|
86 local lprint = B.print('Line')
|
Nenue@28
|
87
|
Nenue@30
|
88 Default.AddBlock = function(self, block, blockIndex)
|
Nenue@30
|
89 local blockIndex = blockIndex or (self.currentBlock + 1)
|
Nenue@28
|
90 local print = bprint
|
Nenue@28
|
91 local tracker = self.frame
|
Nenue@28
|
92 local info = block.info
|
Nenue@30
|
93
|
Nenue@30
|
94 block.index = blockIndex
|
Nenue@30
|
95 block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, block.offset)
|
Nenue@29
|
96 block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
|
Nenue@30
|
97 self.currentBlock = blockIndex
|
Nenue@29
|
98 self.currentAnchor = block
|
Nenue@29
|
99 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height)
|
Nenue@29
|
100 tracker.height = tracker.height + block.height
|
Nenue@30
|
101 self.numBlocks = max(self.numBlocks, blockIndex)
|
Nenue@29
|
102 self.actualBlocks = self.actualBlocks + 1
|
Nenue@28
|
103 end
|
Nenue@28
|
104
|
Nenue@28
|
105 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
|
Nenue@30
|
106 Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative)
|
Nenue@28
|
107 local print = bprint
|
Nenue@30
|
108
|
Nenue@30
|
109 for order, tagName in ipairs(block.info.tagInfo) do
|
Nenue@30
|
110 local tag = block[tagName]
|
Nenue@30
|
111 if block.tagCoords[tagName] and tag then
|
Nenue@30
|
112 tag:SetTexCoord(unpack(block.tagCoords[tagName]))
|
Nenue@30
|
113 tag:Show()
|
Nenue@30
|
114 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
|
Nenue@30
|
115 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
|
Nenue@30
|
116 else
|
Nenue@30
|
117 block[tagName]:Hide()
|
Nenue@30
|
118 end
|
Nenue@28
|
119 end
|
Nenue@30
|
120
|
Nenue@28
|
121 return tagPoint, tagAnchor, tagRelative
|
Nenue@28
|
122 end
|
Nenue@28
|
123
|
Nenue@28
|
124 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call.
|
Nenue@30
|
125 Default.AddLine = function(handler, block, text, attachment, template)
|
Nenue@28
|
126 local print = lprint
|
Nenue@30
|
127 local lineIndex = block.currentLine + 1
|
Nenue@30
|
128 local line = handler:GetLine(block)
|
Nenue@31
|
129 line.index = lineIndex
|
Nenue@28
|
130 line:ClearAllPoints()
|
Nenue@28
|
131 line:SetPoint('LEFT', block, 'LEFT', 0, 0)
|
Nenue@31
|
132 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, 0)
|
Nenue@28
|
133 line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
|
Nenue@28
|
134 line:Show()
|
Nenue@28
|
135
|
Nenue@31
|
136 print(' |cFF0088FFAddLine >>|r', block, '::', block.endPoint:GetName(),'"'.. text .. '"', attachment, template)
|
Nenue@30
|
137 line.status:SetText(text)
|
Nenue@30
|
138 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
|
Nenue@30
|
139 line:SetHeight(line.height)
|
Nenue@31
|
140
|
Nenue@31
|
141 local r, g, b, a = 1, 1, 1, 1
|
Nenue@31
|
142 if lineColors[template] then
|
Nenue@31
|
143 r, g, b = unpack(lineColors[template].text)
|
Nenue@31
|
144 end
|
Nenue@30
|
145 line.status:SetTextColor(r, g, b, a)
|
Nenue@30
|
146
|
Nenue@30
|
147 -- For progressbar and timer lines, status text may be used as the title heading
|
Nenue@30
|
148 if attachment then
|
Nenue@31
|
149 local widgetOffset = 0
|
Nenue@31
|
150 if text and #text >= 1 then
|
Nenue@31
|
151 widgetOffset = line.status:GetHeight() + textSpacing
|
Nenue@31
|
152 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + attachment.height
|
Nenue@31
|
153 print(' |cFFFF0088doing things with captioned widget')
|
Nenue@31
|
154 else
|
Nenue@31
|
155 print(' |cFFFF0088doing things with a widget')
|
Nenue@31
|
156 end
|
Nenue@31
|
157 attachment:SetPoint('TOP', line, 'TOP', 0, -widgetOffset)
|
Nenue@30
|
158 attachment:Show()
|
Nenue@30
|
159 end
|
Nenue@30
|
160
|
Nenue@31
|
161 block.attachmentHeight = block.attachmentHeight + line.height
|
Nenue@30
|
162 print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height,
|
Nenue@28
|
163 "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N'))
|
Nenue@30
|
164 block.currentLine = lineIndex
|
Nenue@31
|
165 block.endPoint = line.statusbg -- edge used for the next block
|
Nenue@31
|
166
|
Nenue@31
|
167 return lineIndex
|
Nenue@28
|
168 end
|
Nenue@28
|
169
|
Nenue@28
|
170 --- Creates or retrieves a complete line data object
|
Nenue@30
|
171 Default.GetLine = function(handler, block, lineIndex)
|
Nenue@28
|
172 local print = lprint
|
Nenue@28
|
173 local blockIndex = block.index
|
Nenue@30
|
174 local lines = block.lines
|
Nenue@30
|
175 if not lineIndex then
|
Nenue@30
|
176 lineIndex = block.currentLine + 1
|
Nenue@31
|
177 print(' fetching the "next" line:', lineIndex)
|
Nenue@30
|
178 else
|
Nenue@31
|
179 print(' fetching explicit offset:', lineIndex)
|
Nenue@28
|
180 end
|
Nenue@30
|
181
|
Nenue@30
|
182 block.numLines = max(block.numLines, lineIndex)
|
Nenue@31
|
183 print(' |cFF00FFFFposition|r', block.currentLine, '|cFF00FFFFof|r|cFFFFFF00' , block.numLines)
|
Nenue@30
|
184
|
Nenue@28
|
185 if not lines[lineIndex] then
|
Nenue@28
|
186 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
|
Nenue@28
|
187 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective')
|
Nenue@28
|
188 local line = lines[lineIndex]
|
Nenue@28
|
189 line.index = lineIndex
|
Nenue@28
|
190 line.height = 0
|
Nenue@28
|
191 line.status:SetSpacing(textSpacing)
|
Nenue@28
|
192 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
|
Nenue@28
|
193 B.SetConfigLayers(line)
|
Nenue@28
|
194
|
Nenue@28
|
195 if lines[lineIndex+1] then
|
Nenue@28
|
196 lines[lineIndex+1]:ClearAllPoints()
|
Nenue@28
|
197 end
|
Nenue@28
|
198
|
Nenue@28
|
199 if debug then
|
Nenue@28
|
200 for _, region in ipairs(lines[lineIndex].debug) do
|
Nenue@28
|
201 region:Show()
|
Nenue@28
|
202 end
|
Nenue@28
|
203 end
|
Nenue@28
|
204
|
Nenue@28
|
205 end
|
Nenue@28
|
206 return lines[lineIndex]
|
Nenue@28
|
207 end
|
Nenue@28
|
208
|
Nenue@29
|
209
|
Nenue@29
|
210
|
Nenue@28
|
211 --- Creates or retrieves a complete block frame object
|
Nenue@30
|
212 Default.GetBlock = function(handler, blockIndex)
|
Nenue@28
|
213 local print = bprint
|
Nenue@28
|
214 local block = handler.usedBlocks[blockIndex]
|
Nenue@28
|
215
|
Nenue@28
|
216 if not handler.usedBlocks[blockIndex] then
|
Nenue@28
|
217 if #handler.freeBlocks >= 1 then
|
Nenue@28
|
218 block = handler.freeBlocks[#handler.freeBlocks]
|
Nenue@28
|
219 handler.freeBlocks[#handler.freeBlocks] = nil
|
Nenue@28
|
220 else
|
Nenue@30
|
221 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock')
|
Nenue@28
|
222
|
Nenue@30
|
223 local c = Module.Conf.Wrapper
|
Nenue@28
|
224 block.index = blockIndex
|
Nenue@30
|
225 block.lines = {}
|
Nenue@30
|
226 block.numLines = 0
|
Nenue@30
|
227 block.currentLine = 0
|
Nenue@28
|
228 block:SetWidth(c.Width)
|
Nenue@28
|
229
|
Nenue@28
|
230 block.title:SetSpacing(c.TitleSpacing)
|
Nenue@28
|
231 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
|
Nenue@28
|
232
|
Nenue@28
|
233 block.titlebg:SetTexture(1,1,1,1)
|
Nenue@31
|
234 block.titlebg:SetGradientAlpha(unpack(titlebg))
|
Nenue@28
|
235 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
|
Nenue@28
|
236 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
|
Nenue@28
|
237
|
Nenue@28
|
238 block.status:SetSpacing(c.TextSpacing)
|
Nenue@28
|
239 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
|
Nenue@28
|
240 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
|
Nenue@28
|
241
|
Nenue@28
|
242 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
|
Nenue@28
|
243 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
|
Nenue@28
|
244 block.statusbg:SetTexture(1,1,1,1)
|
Nenue@31
|
245 block.statusbg:SetGradientAlpha(unpack(textbg))
|
Nenue@28
|
246
|
Nenue@30
|
247 block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg))
|
Nenue@28
|
248 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
|
Nenue@28
|
249 block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
|
Nenue@28
|
250
|
Nenue@28
|
251 block.icon:SetSize(rewardSize, rewardSize)
|
Nenue@28
|
252 block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
|
Nenue@28
|
253
|
Nenue@28
|
254
|
Nenue@28
|
255 --- methods for event handlers
|
Nenue@28
|
256
|
Nenue@28
|
257 block.Select = handler.Select
|
Nenue@28
|
258 block.Open = handler.Open
|
Nenue@28
|
259 block.Remove = handler.Remove
|
Nenue@28
|
260 block.Link = handler.Link
|
Nenue@28
|
261 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end)
|
Nenue@28
|
262 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end)
|
Nenue@28
|
263 block.attachmentHeight = 0
|
Nenue@28
|
264 block:ClearAllPoints()
|
Nenue@28
|
265
|
Nenue@28
|
266 B.SetConfigLayers(block)
|
Nenue@28
|
267
|
Nenue@28
|
268 if debug then
|
Nenue@28
|
269 for _, region in ipairs(block.debug) do
|
Nenue@28
|
270 region:Show()
|
Nenue@28
|
271 end
|
Nenue@28
|
272 end
|
Nenue@28
|
273 end
|
Nenue@28
|
274 handler.usedBlocks[blockIndex] = block
|
Nenue@28
|
275 end
|
Nenue@28
|
276 return handler.usedBlocks[blockIndex]
|
Nenue@28
|
277 end
|
Nenue@28
|
278
|
Nenue@30
|
279 local currentPosition, anchorFrame, anchorPoint
|
Nenue@30
|
280 --- Positioning and stuff
|
Nenue@30
|
281 local tick = 0
|
Nenue@30
|
282 local maxReason = 0
|
Nenue@30
|
283 function Module:Update (reason, ...)
|
Nenue@30
|
284 tick = tick + 1
|
Nenue@30
|
285 -- is this the first time updating?
|
Nenue@30
|
286 if maxReason == 0 then
|
Nenue@30
|
287 reason = OBJECTIVE_TRACKER_UPDATE_ALL
|
Nenue@30
|
288 elseif not reason then
|
Nenue@30
|
289 reason = OBJECTIVE_TRACKER_UPDATE_REASON
|
Nenue@30
|
290 end
|
Nenue@30
|
291
|
Nenue@30
|
292 local print = tprint
|
Nenue@30
|
293 local updateWrapper = 0
|
Nenue@30
|
294 local hasStuff
|
Nenue@30
|
295 local insertingStuff
|
Nenue@30
|
296
|
Nenue@30
|
297 print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...)
|
Nenue@30
|
298 currentPosition = 0
|
Nenue@30
|
299 anchorPoint = 'TOP'
|
Nenue@30
|
300 anchorFrame = Scroll
|
Nenue@30
|
301
|
Nenue@30
|
302 local wrapperHeight = 0
|
Nenue@30
|
303 for id, handler in pairs(Module.orderedHandlers) do
|
Nenue@30
|
304 local frame = handler.frame
|
Nenue@30
|
305
|
Nenue@30
|
306 print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
|
Nenue@30
|
307 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
|
Nenue@30
|
308 handler:UpdateTracker(reason, ...)
|
Nenue@30
|
309 print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
|
Nenue@30
|
310 insertingStuff = true
|
Nenue@30
|
311 else
|
Nenue@30
|
312 print(' |cFFFF0088'..id..'|r', 'no reason to update')
|
Nenue@30
|
313 end
|
Nenue@30
|
314
|
Nenue@30
|
315 if handler.numWatched >= 1 then
|
Nenue@30
|
316 hasStuff = true
|
Nenue@30
|
317 currentPosition = currentPosition + 1
|
Nenue@30
|
318 frame.destinationOffset = -wrapperHeight
|
Nenue@30
|
319 if frame.previousOffset ~= wrapperHeight and frame:IsVisible() then
|
Nenue@30
|
320 print(frame.SlideIn.translation)
|
Nenue@30
|
321 local postFrame, postPoint = anchorFrame, anchorPoint
|
Nenue@30
|
322 local delta = frame.destinationOffset - frame.previousOffset
|
Nenue@30
|
323 local _, _, _, _, offset = frame:GetPoint(1)
|
Nenue@30
|
324 print(' |cFF00BBFFstart slide for', delta, 'pixels, from', frame.previousOffset, '(', offset, ')')
|
Nenue@30
|
325 frame.SlideIn.translation:SetTarget(frame)
|
Nenue@30
|
326 frame.SlideIn.translation:SetOffset(0, delta)
|
Nenue@30
|
327 frame.SlideIn:Play()
|
Nenue@30
|
328 for i, b in ipairs(handler.usedBlocks) do
|
Nenue@30
|
329 b.SlideIn.translation:SetOffset(0, delta)
|
Nenue@30
|
330 b.SlideIn:Play()
|
Nenue@30
|
331 end
|
Nenue@30
|
332 frame.SlideIn:SetScript('OnFinished', function()
|
Nenue@30
|
333 print(' |cFF00BBFFsliding finished:', delta, 'pixels covered')
|
Nenue@30
|
334 frame:SetParent(Scroll)
|
Nenue@30
|
335 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset)
|
Nenue@30
|
336 frame.previousOffset = frame.destinationOffset
|
Nenue@30
|
337 frame.SlideIn:SetScript('OnFinished', nil)
|
Nenue@30
|
338 if Wrapper.destinationHeight then
|
Nenue@30
|
339 Wrapper:SetHeight(Wrapper.destinationHeight)
|
Nenue@30
|
340 Scroller:SetHeight(Wrapper.destinationHeight)
|
Nenue@30
|
341 Scroll:SetHeight(Wrapper.destinationHeight)
|
Nenue@30
|
342 Wrapper.previousHeight = Wrapper.destinationHeight
|
Nenue@30
|
343 Wrapper.destinationHeight = nil
|
Nenue@30
|
344 end
|
Nenue@30
|
345
|
Nenue@30
|
346 end)
|
Nenue@30
|
347 else
|
Nenue@30
|
348 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
|
Nenue@30
|
349 frame:SetParent(Scroll)
|
Nenue@30
|
350 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset)
|
Nenue@30
|
351 end
|
Nenue@30
|
352
|
Nenue@30
|
353 frame:Show()
|
Nenue@30
|
354 anchorFrame = handler.frame
|
Nenue@30
|
355 anchorPoint = 'BOTTOM'
|
Nenue@30
|
356
|
Nenue@30
|
357 print('current frame height:', frame.height)
|
Nenue@30
|
358 wrapperHeight = wrapperHeight + frame.height
|
Nenue@30
|
359 print('|cFFFF0088total height:', wrapperHeight)
|
Nenue@30
|
360 else
|
Nenue@30
|
361 frame:SetPoint('TOP', Scroll, 'TOP', 0, 0)
|
Nenue@30
|
362 frame.destinationOffset = 0
|
Nenue@30
|
363 frame.previousOffset = 0
|
Nenue@30
|
364 handler.frame:Hide()
|
Nenue@30
|
365 end
|
Nenue@30
|
366 end
|
Nenue@30
|
367
|
Nenue@30
|
368
|
Nenue@30
|
369 if hasStuff or insertingStuff then
|
Nenue@30
|
370 print('updating height to', wrapperHeight)
|
Nenue@30
|
371 if wrapperHeight > Wrapper.previousHeight then
|
Nenue@30
|
372 Wrapper:SetHeight(wrapperHeight)
|
Nenue@30
|
373 Scroller:SetHeight(wrapperHeight)
|
Nenue@30
|
374 Scroll:SetHeight(wrapperHeight)
|
Nenue@30
|
375 Wrapper.previousHeight = wrapperHeight
|
Nenue@30
|
376 Wrapper.destinationHeight = wrapperHeight
|
Nenue@30
|
377 end
|
Nenue@30
|
378 Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
|
Nenue@30
|
379 print('|cFFFF8800Wrapper:', Wrapper:GetSize())
|
Nenue@30
|
380 for i = 1, Wrapper:GetNumPoints() do
|
Nenue@30
|
381 print(' ', Wrapper:GetPoint(i))
|
Nenue@30
|
382 end
|
Nenue@30
|
383 print(' |cFF00FFFFScroller:', Scroller:GetSize())
|
Nenue@30
|
384 for i = 1, Scroller:GetNumPoints() do
|
Nenue@30
|
385 print(' ', Scroller:GetPoint(i))
|
Nenue@30
|
386 end
|
Nenue@30
|
387 print(' |cFF00FFFFScroll:', Scroll:GetSize())
|
Nenue@30
|
388 for i = 1, Scroll:GetNumPoints() do
|
Nenue@30
|
389 print(' ', Scroll:GetPoint(i))
|
Nenue@30
|
390 end
|
Nenue@30
|
391
|
Nenue@30
|
392 Wrapper:Show()
|
Nenue@30
|
393 Scroller:Show()
|
Nenue@30
|
394 Scroll:Show()
|
Nenue@30
|
395 end
|
Nenue@30
|
396 Quest.GetClosest()
|
Nenue@30
|
397 --Module.UpdateActionButtons(reason)
|
Nenue@30
|
398 end
|
Nenue@30
|
399
|
Nenue@28
|
400 --- Content generator base
|
Nenue@30
|
401 Default.UpdateTracker = function (handler, reason, id, isNew)
|
Nenue@28
|
402 local print = tprint
|
Nenue@30
|
403 local tracker = handler.frame
|
Nenue@28
|
404 local blockIndex = 0
|
Nenue@28
|
405 tracker.previousHeight = tracker.height
|
Nenue@28
|
406 tracker.height = 0
|
Nenue@28
|
407
|
Nenue@28
|
408 tracker.title:SetFont(headerFont, headerSize, headerOutline)
|
Nenue@28
|
409 tracker.titlebg:SetHeight(headerHeight)
|
Nenue@28
|
410 tracker.title:SetTextColor(unpack(headerColor))
|
Nenue@28
|
411
|
Nenue@30
|
412 handler.updateReason = reason
|
Nenue@30
|
413 handler.numWatched = handler:GetNumWatched()
|
Nenue@30
|
414 handler.currentBlock = 0
|
Nenue@30
|
415 handler.currentAnchor = tracker.titlebg
|
Nenue@30
|
416 local blockPosition = -headerHeight
|
Nenue@30
|
417 for blockIndex = 1, handler.numWatched do
|
Nenue@30
|
418 local currentBlock = handler:UpdateBlock(blockIndex, id, isNew)
|
Nenue@30
|
419 if currentBlock then
|
Nenue@30
|
420 currentBlock.offset = blockPosition
|
Nenue@30
|
421 handler:AddBlock(currentBlock)
|
Nenue@30
|
422 blockPosition = blockPosition - currentBlock.height
|
Nenue@28
|
423 else
|
Nenue@28
|
424 print(' |cFFFF9900END|r @', blockIndex)
|
Nenue@28
|
425 break -- done with quest stuff
|
Nenue@28
|
426 end
|
Nenue@28
|
427 end
|
Nenue@28
|
428
|
Nenue@30
|
429 for i = handler.currentBlock+1, handler.numBlocks do
|
Nenue@30
|
430 local used = handler.usedBlocks
|
Nenue@30
|
431 local free = handler.freeBlocks
|
Nenue@30
|
432 print('clean up dead quest block')
|
Nenue@30
|
433 if used[i] then
|
Nenue@30
|
434 used[i]:Hide()
|
Nenue@30
|
435 used[i]:ClearAllPoints()
|
Nenue@30
|
436 free[#free+1]= used[blockIndex]
|
Nenue@30
|
437 used[i] = nil
|
Nenue@30
|
438 end
|
Nenue@30
|
439 end
|
Nenue@28
|
440
|
Nenue@30
|
441
|
Nenue@30
|
442 if handler.currentBlock >= 1 then
|
Nenue@28
|
443 tracker.height = tracker.height + headerHeight
|
Nenue@28
|
444 tracker:Show()
|
Nenue@28
|
445
|
Nenue@28
|
446 if tracker.wasEmpty then
|
Nenue@28
|
447 tracker.headerFade:Play()
|
Nenue@28
|
448 tracker.wasEmpty = nil
|
Nenue@28
|
449 end
|
Nenue@28
|
450 if tracker.height ~= tracker.previousHeight then
|
Nenue@28
|
451 tracker:SetHeight(tracker.height)
|
Nenue@28
|
452 end
|
Nenue@29
|
453 print(' |cFFFFFF00', tracker.height, tracker:GetWidth())
|
Nenue@28
|
454 else
|
Nenue@28
|
455 tracker:Hide()
|
Nenue@28
|
456 tracker.wasEmpty = true
|
Nenue@28
|
457 end
|
Nenue@28
|
458
|
Nenue@28
|
459 return tracker.numWatched, tracker.numAll
|
Nenue@28
|
460 end
|
Nenue@28
|
461
|
Nenue@28
|
462 --- Updates the selected block frame to display the given info batch
|
Nenue@28
|
463 -- If `previousBlock` is set, it will attempt to anchor to that
|
Nenue@28
|
464 -- @param blockNum the ordered block to be updated, not a watchIndex value
|
Nenue@28
|
465 -- @param info the reference returned by the GetXInfo functions
|
Nenue@28
|
466 -- REMEMBER: t.info and questData[questID] are the same table
|
Nenue@30
|
467 Default.UpdateBlock = function (handler, blockIndex, id, added)
|
Nenue@28
|
468 local print = bprint
|
Nenue@30
|
469 print(' Updating |cFF00FF00'..handler.displayName..'|r|cFF00FFFF'..blockIndex..'|r')
|
Nenue@30
|
470 if not blockIndex then
|
Nenue@30
|
471 return
|
Nenue@30
|
472 end
|
Nenue@30
|
473 local info = handler:GetInfo(blockIndex) -- should match up with whatever the internal watch list has
|
Nenue@30
|
474 if not info then
|
Nenue@28
|
475 return
|
Nenue@28
|
476 end
|
Nenue@28
|
477 local frame = handler.frame
|
Nenue@30
|
478 local block = handler:GetBlock(blockIndex)
|
Nenue@30
|
479
|
Nenue@30
|
480 block.questID = info.questID
|
Nenue@30
|
481 if id == info.questID then
|
Nenue@30
|
482 --block.questFadeIn:Play()
|
Nenue@30
|
483 end
|
Nenue@30
|
484
|
Nenue@28
|
485 block.handler = handler
|
Nenue@28
|
486 block.info = info
|
Nenue@28
|
487 block.mainStyle = info.mainStyle or 'Normal'
|
Nenue@28
|
488 block.subStyle = info.subStyle
|
Nenue@28
|
489
|
Nenue@28
|
490 info.blockIndex = blockIndex
|
Nenue@28
|
491 if info.questID then handler.QuestBlock[info.questID] = block end
|
Nenue@28
|
492 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end
|
Nenue@28
|
493 if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end
|
Nenue@28
|
494 handler.BlockInfo[blockIndex] = info
|
Nenue@28
|
495 handler:UpdateObjectives(block)
|
Nenue@28
|
496
|
Nenue@28
|
497 block.title:SetText(info.title)
|
Nenue@28
|
498 local titleHeight = floor(block.title:GetHeight()+.5)
|
Nenue@28
|
499 local titlebgHeight = titleHeight + titleSpacing*2
|
Nenue@28
|
500 block.titlebg:SetHeight(titlebgHeight)
|
Nenue@28
|
501
|
Nenue@30
|
502 local statusHeight = floor(block.status:GetHeight()+.5)
|
Nenue@30
|
503 local statusbgHeight = statusHeight + textSpacing*2
|
Nenue@30
|
504 local attachmentHeight =floor(block.attachmentHeight + .5)
|
Nenue@28
|
505
|
Nenue@28
|
506 print(' |cFF0088FFanchor to', handler.currentAnchor:GetName())
|
Nenue@30
|
507 print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')')
|
Nenue@30
|
508 --block.titlebg:SetHeight(block.title:GetHeight() + Module.Conf.Wrapper.TitleSpacing)
|
Nenue@30
|
509 block.height = titlebgHeight + attachmentHeight
|
Nenue@28
|
510
|
Nenue@28
|
511 if statusHeight > 1 then
|
Nenue@28
|
512 block.height = block.height + statusbgHeight
|
Nenue@28
|
513 print(' status:', statusbgHeight, '('.. statusHeight..')')
|
Nenue@28
|
514 else
|
Nenue@28
|
515 print(' |cFFFF0088 skipped')
|
Nenue@28
|
516 end
|
Nenue@28
|
517 block:SetHeight(block.height)
|
Nenue@28
|
518
|
Nenue@28
|
519 print(' |cFFFFFF00height|r:', block.height)
|
Nenue@28
|
520 print(' |cFF00FFFF)|r -> ', block, block:GetHeight())
|
Nenue@28
|
521
|
Nenue@28
|
522 block:Show()
|
Nenue@28
|
523
|
Nenue@28
|
524 if info.specialItem and not info.itemButton then
|
Nenue@28
|
525 print(' - |cFF00FFFFgenerating item button for info set')
|
Nenue@30
|
526 info.itemButton = Module.SetItemButton(block, info)
|
Nenue@28
|
527 else
|
Nenue@28
|
528 --info.itemButton = nil
|
Nenue@28
|
529 end
|
Nenue@28
|
530
|
Nenue@28
|
531 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
|
Nenue@28
|
532
|
Nenue@28
|
533 if info.rewardInfo then
|
Nenue@28
|
534 print('has immediate reward')
|
Nenue@28
|
535 if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
|
Nenue@28
|
536 block.icon:Show()
|
Nenue@28
|
537 block.iconLabel:SetText(info.rewardInfo[1].count)
|
Nenue@28
|
538 block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
|
Nenue@28
|
539 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
|
Nenue@28
|
540 block.icon:SetTexture(info.rewardInfo[1].texture)
|
Nenue@28
|
541 end
|
Nenue@28
|
542 else
|
Nenue@28
|
543 block.icon:Hide()
|
Nenue@28
|
544 end
|
Nenue@28
|
545
|
Nenue@28
|
546 if info.selected then
|
Nenue@28
|
547 block.SelectionOverlay:Show()
|
Nenue@28
|
548 else
|
Nenue@28
|
549 block.SelectionOverlay:Hide()
|
Nenue@28
|
550 end
|
Nenue@28
|
551 -- workaround for scrollchild issue where layers fall out of sync: in this case, it's by 1 vertical pixel
|
Nenue@28
|
552 --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1)
|
Nenue@28
|
553 --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1)
|
Nenue@28
|
554
|
Nenue@31
|
555 if info.tagInfo then
|
Nenue@31
|
556 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@31
|
557 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@31
|
558 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@31
|
559 end
|
Nenue@28
|
560 return block
|
Nenue@28
|
561 end
|
Nenue@28
|
562
|
Nenue@28
|
563
|
Nenue@28
|
564
|
Nenue@28
|
565
|
Nenue@28
|
566 --- Does the main iterations for populating block content.
|
Nenue@28
|
567 -- Hooked by corresponding handler functions where additional details need to be sorted.
|
Nenue@28
|
568 Default.UpdateObjectives = function(handler, block)
|
Nenue@28
|
569 local print = lprint
|
Nenue@28
|
570 local info = block.info
|
Nenue@31
|
571 print('|cFF00FF00default.objectives', block:GetName())
|
Nenue@31
|
572 -- reset the starting positions
|
Nenue@30
|
573 block.endPoint = block.titlebg
|
Nenue@30
|
574 block.attachmentHeight = 0
|
Nenue@30
|
575 block.currentLine = 0
|
Nenue@28
|
576
|
Nenue@28
|
577 local displayObjectiveHeader = false
|
Nenue@28
|
578
|
Nenue@31
|
579 block.attachmentHeight = 0
|
Nenue@31
|
580 local text, attachment, template
|
Nenue@31
|
581 if info.statusKey and (Devian and Devian.InWorkspace()) then
|
Nenue@31
|
582 handler:AddLine(block, info.statusKey, nil)
|
Nenue@31
|
583 end
|
Nenue@28
|
584
|
Nenue@28
|
585
|
Nenue@28
|
586 if info.description and #info.description >= 1 then
|
Nenue@28
|
587 print(' |cFF00FFFF header line:|r', info.description)
|
Nenue@30
|
588 text = info.description
|
Nenue@30
|
589 handler:AddLine(block, text, nil)
|
Nenue@28
|
590 end
|
Nenue@28
|
591
|
Nenue@28
|
592 if (info.isComplete or info.numObjectives == 0) and info.completionText then
|
Nenue@28
|
593 print(' overriding line #1 for completion text:', info.completionText)
|
Nenue@30
|
594 text = info.completionText
|
Nenue@31
|
595 handler:AddLine(block, text, nil)
|
Nenue@28
|
596 else
|
Nenue@28
|
597 if info.objectives then
|
Nenue@28
|
598 for i, data in ipairs(info.objectives) do
|
Nenue@30
|
599 local line = handler:GetLine(block)
|
Nenue@28
|
600 displayObjectiveHeader = true
|
Nenue@28
|
601 line.height = 0
|
Nenue@31
|
602 text, attachment, template = handler:UpdateLine(block, line, data)
|
Nenue@30
|
603 print(' |cFF88FF00#', i, data.type, text)
|
Nenue@31
|
604 handler:AddLine(block, text, attachment, template)
|
Nenue@28
|
605
|
Nenue@28
|
606 end
|
Nenue@28
|
607 end
|
Nenue@28
|
608 end
|
Nenue@28
|
609
|
Nenue@30
|
610 for i = block.currentLine + 1, block.numLines do
|
Nenue@30
|
611 print(i, block.numLines)
|
Nenue@30
|
612 print(' - hide |cFFFF0088'..i..'|r', block.lines[i])
|
Nenue@30
|
613 block.lines[i]:ClearAllPoints()
|
Nenue@30
|
614 block.lines[i]:Hide()
|
Nenue@28
|
615 end
|
Nenue@28
|
616
|
Nenue@30
|
617 if block.currentLine > 0 then
|
Nenue@31
|
618 block.attachmentHeight = block.attachmentHeight + textSpacing
|
Nenue@28
|
619 print(' |cFF00FF00attachment:', block.attachmentHeight)
|
Nenue@28
|
620 end
|
Nenue@28
|
621 end
|
Nenue@28
|
622
|
Nenue@28
|
623
|
Nenue@28
|
624 --- Module-specific display variables
|
Nenue@28
|
625 -- * height - height of whatever display widget is involved in conveying the task
|
Nenue@28
|
626 -- * money - boolean that determines listening for money events or not
|
Nenue@28
|
627 -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
|
Nenue@28
|
628
|
Nenue@28
|
629
|
Nenue@31
|
630 Default.UpdateLine = function(handler, block, line, data)
|
Nenue@28
|
631 if line.finished then
|
Nenue@28
|
632 line.progress = 2
|
Nenue@28
|
633 elseif line.quantity > 0 then
|
Nenue@28
|
634 line.progress = 1
|
Nenue@28
|
635 else
|
Nenue@28
|
636 line.progress = 0
|
Nenue@28
|
637 end
|
Nenue@31
|
638 return data.text, line.widget, 'normal'
|
Nenue@28
|
639 end
|
Nenue@28
|
640 ----------
|
Nenue@28
|
641 --- Top level methods
|
Nenue@28
|
642
|
Nenue@28
|
643 --- Queue any active item buttons for update for that frame
|
Nenue@28
|
644 local iprint = B.print('ItemButton')
|
Nenue@30
|
645 Module.UpdateActionButtons = function(updateReason)
|
Nenue@28
|
646 local print = iprint
|
Nenue@28
|
647 Scroller.snap_upper = 0
|
Nenue@28
|
648 Scroller.snap_lower = 0
|
Nenue@28
|
649 local print = B.print('ItemButton')
|
Nenue@28
|
650 if updateReason then
|
Nenue@28
|
651 print = B.print('IB_'..updateReason)
|
Nenue@28
|
652 end
|
Nenue@28
|
653
|
Nenue@28
|
654 local previousItem
|
Nenue@28
|
655 for questID, itemButton in pairs(Quest.itemButtons) do
|
Nenue@30
|
656 local info= Module.Quest.Info[questID]
|
Nenue@28
|
657
|
Nenue@28
|
658 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
|
Nenue@30
|
659 local block = Module.Quest.QuestBlock[questID]
|
Nenue@28
|
660 if block then
|
Nenue@28
|
661 -- Dispatch the probe
|
Nenue@28
|
662 if IsQuestWatched(info.questLogIndex) then
|
Nenue@28
|
663 itemButton.previousItem = previousItem
|
Nenue@28
|
664 print(' |cFFFFFF00probing', block:GetName())
|
Nenue@28
|
665 block:SetScript('OnUpdate', function()
|
Nenue@28
|
666 if block:GetBottom() and not InCombatLockdown() then
|
Nenue@28
|
667 print(' '..block:GetName()..' |cFF00FF00probe hit!')
|
Nenue@30
|
668 Module.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
|
Nenue@28
|
669 block:SetScript('OnUpdate', nil)
|
Nenue@28
|
670
|
Nenue@28
|
671 end
|
Nenue@28
|
672 end)
|
Nenue@28
|
673 previousItem = itemButton
|
Nenue@28
|
674 else
|
Nenue@28
|
675 print('hidden block or unwatched quest')
|
Nenue@28
|
676 itemButton.previousItem = nil
|
Nenue@28
|
677 itemButton:Hide()
|
Nenue@28
|
678 end
|
Nenue@28
|
679 elseif itemButton:IsVisible() then
|
Nenue@28
|
680 print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
|
Nenue@28
|
681 itemButton.previousItem = nil
|
Nenue@28
|
682 itemButton:Hide()
|
Nenue@28
|
683 else
|
Nenue@28
|
684 print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
|
Nenue@28
|
685 end
|
Nenue@28
|
686 end
|
Nenue@28
|
687 end
|
Nenue@28
|
688
|
Nenue@30
|
689 Module.UpdateBlockAction = function (block, itemButton)
|
Nenue@28
|
690 local print = iprint
|
Nenue@28
|
691 print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
|
Nenue@28
|
692 if itemButton.questID ~= block.info.questID then
|
Nenue@28
|
693 print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
|
Nenue@28
|
694 -- something happened between this and last frame, go back and set new probes
|
Nenue@30
|
695 return Module.UpdateActionButtons()
|
Nenue@28
|
696 end
|
Nenue@28
|
697
|
Nenue@28
|
698 local previousItem = itemButton.previousItem
|
Nenue@28
|
699 local upper_bound = Scroller:GetTop() + Scroller.snap_upper
|
Nenue@28
|
700 local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
|
Nenue@28
|
701 local point, anchor, relative
|
Nenue@28
|
702
|
Nenue@28
|
703 if block:GetBottom() < lower_bound then
|
Nenue@28
|
704 print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
|
Nenue@28
|
705 if previousItem then
|
Nenue@28
|
706 print('adjusting', previousItem:GetName())
|
Nenue@28
|
707 previousItem:ClearAllPoints()
|
Nenue@28
|
708 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
|
Nenue@28
|
709 end
|
Nenue@28
|
710 itemButton:ClearAllPoints()
|
Nenue@28
|
711 itemButton.x = Wrapper:GetLeft() -4
|
Nenue@28
|
712 itemButton.y = Wrapper:GetBottom()
|
Nenue@28
|
713 point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@28
|
714 Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
|
Nenue@28
|
715
|
Nenue@28
|
716 elseif block:GetTop() > upper_bound then
|
Nenue@28
|
717 print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
|
Nenue@28
|
718 itemButton:ClearAllPoints()
|
Nenue@28
|
719 if previousItem then
|
Nenue@28
|
720 print('latch onto another piece')
|
Nenue@28
|
721 point, anchor, relative ='TOP', previousItem, 'BOTTOM'
|
Nenue@28
|
722 itemButton.x = 0
|
Nenue@28
|
723 itemButton.y = -itemButtonSpacing
|
Nenue@28
|
724 else
|
Nenue@28
|
725 print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
|
Nenue@28
|
726 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@28
|
727 itemButton.x = Scroller:GetLeft() -4
|
Nenue@28
|
728 itemButton.y = Scroller:GetTop()
|
Nenue@28
|
729 end
|
Nenue@28
|
730 itemButton:Show()
|
Nenue@28
|
731 Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
|
Nenue@28
|
732 else
|
Nenue@28
|
733 print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
|
Nenue@28
|
734 itemButton:ClearAllPoints()
|
Nenue@28
|
735 itemButton.x = block:GetLeft() - itemButtonSpacing
|
Nenue@28
|
736 itemButton.y = block:GetTop()
|
Nenue@28
|
737 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@28
|
738 end
|
Nenue@28
|
739
|
Nenue@28
|
740 itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
|
Nenue@28
|
741 itemButton:Show()
|
Nenue@28
|
742 end
|
Nenue@28
|
743
|
Nenue@30
|
744 Module.UpdateItemButtonCooldown = function(button)
|
Nenue@28
|
745
|
Nenue@28
|
746 end
|
Nenue@28
|
747
|
Nenue@29
|
748 Default.Select = function(handler, block)
|
Nenue@30
|
749 Module:Update(handler.watchReasonModule)
|
Nenue@28
|
750 end
|
Nenue@29
|
751 Default.Open = function(handler, block)
|
Nenue@30
|
752 Module:Update(handler.watchReasonModule)
|
Nenue@28
|
753 end
|
Nenue@29
|
754 Default.Remove = function(handler, block)
|
Nenue@30
|
755 Module:Update(handler.watchReasonModule)
|
Nenue@28
|
756 end
|
Nenue@29
|
757 Default.Report = function(handler, block)
|
Nenue@29
|
758 print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.')
|
Nenue@28
|
759 end
|
Nenue@28
|
760
|
Nenue@28
|
761 Default.OnMouseUp = function(self, button)
|
Nenue@28
|
762 print(self.handler.name, self.mainStyle, self.subStyle)
|
Nenue@28
|
763 if button == 'LeftButton' then
|
Nenue@28
|
764 if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
|
Nenue@29
|
765 self.Link(self.handler, self)
|
Nenue@28
|
766 elseif IsModifiedClick("QUESTWATCHTOGGLE") then
|
Nenue@29
|
767 self.Remove(self.handler, self)
|
Nenue@28
|
768 else
|
Nenue@29
|
769 self.Select(self.handler, self)
|
Nenue@28
|
770 end
|
Nenue@28
|
771 elseif button == 'RightButton' then
|
Nenue@29
|
772 self.Open(self.handler, self)
|
Nenue@28
|
773 end
|
Nenue@28
|
774 self.initialButton = nil
|
Nenue@28
|
775 self.modChatLink = nil
|
Nenue@28
|
776 self.modQuestWatch = nil
|
Nenue@30
|
777 Module:Update(self.handler.updateReasonModule)
|
Nenue@28
|
778 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
|
Nenue@28
|
779 end
|
Nenue@28
|
780 Default.OnMouseDown = function(self, button)
|
Nenue@28
|
781 print(self.info.title)
|
Nenue@28
|
782 end
|