comparison ObjectiveUI.lua @ 9:2698173edd40

ObjectiveUI & ObjectiveEvents - securehook to API calls for compatibility with addons that work with the objective tracking interface - let the API hooks invoke ObjectiveUI functions when possible - ObjectiveUI framescript handlers should use the corresponding API call if possible, so that addon space can be fully aware of our actions - Sanity check cached data when possible during 'Remove' hooks ObjectiveInfo - Add cheevID to criteria info ObjectiveCore - Index quest tracker blocks by their watch offset, and use that to verify whether the given block frame should be released into pool ObjectiveFrame - Differentiate between visible and non-visible unused buttons, and only release when their quest has been dropped - Reset 'actualBlocks' count during full updates - Reset scroll Position when the wrapper size shrinks
author Nenue
date Fri, 01 Apr 2016 14:54:01 -0400
parents 7923243ae972
children f03c75f63566
comparison
equal deleted inserted replaced
8:7923243ae972 9:2698173edd40
20 Tracker.Report = function(self) 20 Tracker.Report = function(self)
21 print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') 21 print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.')
22 end 22 end
23 23
24 Tracker.OnMouseUp = function(self, button) 24 Tracker.OnMouseUp = function(self, button)
25 if self.initialButton == 'LeftButton' then 25 if button == 'LeftButton' then
26 if self.modChatLink and ChatEdit_GetActiveWindow() then 26 if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
27 self:Link() 27 self:Link()
28 elseif self.modQuestWatch then 28 elseif IsModifiedClick("QUESTWATCHTOGGLE") then
29 self:Remove() 29 self:Remove()
30 else 30 else
31 self:Select() 31 self:Select()
32 end 32 end
33 elseif button == 'RightButton' then 33 elseif button == 'RightButton' then
34 self:Open() 34 self:Open()
35 end 35 end
36 self.initialButton = nil 36 self.initialButton = nil
37 self.modChatLink = nil 37 self.modChatLink = nil
38 self.modQuestWatch = nil 38 self.modQuestWatch = nil
39 print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
40 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') 39 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
41 end 40 end
42 41
43 Tracker.OnMouseDown = function(self, button) 42 Tracker.OnMouseDown = function(self, button)
44 self.initialButton = button
45 self.modChatLink = IsModifiedClick("CHATLINK")
46 self.modQuestWatch = IsModifiedClick("QUESTWATCHTOGGLE")
47 self:SetStyle('Active') 43 self:SetStyle('Active')
48 print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) 44 print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
49 print(self.info.title) 45 print(self.info.title)
50 end 46 end
51 47
82 Cheevs.Select = function(self) 78 Cheevs.Select = function(self)
83 end 79 end
84 Cheevs.Remove = function(self) 80 Cheevs.Remove = function(self)
85 RemoveTrackedAchievement(self.info.cheevID) 81 RemoveTrackedAchievement(self.info.cheevID)
86 end 82 end
87 Cheevs.OnMouseUp = function(self) 83 Cheevs.OnMouseUp = function(self, button)
88 Tracker.OnMouseUp(self) 84 Tracker.OnMouseUp(self, button)
89 self:SetStyle('CheevNormal') 85 self:SetStyle('CheevNormal')
90 end 86 end
91 Cheevs.Link = function(self) 87 Cheevs.Link = function(self)
92 local achievementLink = GetAchievementLink(self.info.cheevID); 88 local achievementLink = GetAchievementLink(self.info.cheevID);
93 if ( achievementLink ) then 89 if ( achievementLink ) then
366 local print = B.print('ObjectiveWidgets') 362 local print = B.print('ObjectiveWidgets')
367 local params = mod.WidgetParams[self.widgetType] 363 local params = mod.WidgetParams[self.widgetType]
368 self.height = params.height 364 self.height = params.height
369 self:SetHeight(20) 365 self:SetHeight(20)
370 self.bg:SetHeight(20) 366 self.bg:SetHeight(20)
367 self.fg:ClearAllPoints()
368 self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 2, 2)
371 self.fg:SetHeight(16) 369 self.fg:SetHeight(16)
372 self.fg:SetPoint('BOTTOMLEFT', self.bg, 'BOTTOMLEFT', 1, 1)
373 self.quantityString:SetFontObject(params.quantityString.SetFontObject) 370 self.quantityString:SetFontObject(params.quantityString.SetFontObject)
374 self.quantityString:SetText(self.info.quantityString) 371 self.quantityString:SetText(self.info.quantityString)
375 end 372 end
376 373
377 mod.UpdateWidget.ProgressBar = function (self) 374 mod.UpdateWidget.ProgressBar = function (self)
378 local print = B.print('ObjectiveWidgets') 375 local print = B.print('ObjectiveWidgets')
379 local quantity, requiredQuantity = self.info.quantity, self.info.requiredQuantity 376 local quantity, requiredQuantity = self.info.quantity, self.info.requiredQuantity
380 377
381 if self.info.finished then 378 if self.info.finished then
382 self.fg:SetWidth(self.bg:GetWidth() - 2) 379 self.fg:SetWidth(self.bg:GetWidth() - 4)
383 elseif quantity == 0 then 380 elseif quantity == 0 then
384 self.fg:Hide() 381 self.fg:Hide()
385 else 382 else
386 self.fg:Show() 383 self.fg:Show()
387 self.fg:SetWidth((self:GetWidth()-2) * (quantity / requiredQuantity)) 384 self.fg:SetWidth((self.bg:GetWidth()-4) * (quantity / requiredQuantity))
388 end 385 end
389 end 386 end