Mercurial > wow > buffalo2
diff ObjectiveTracker/Widgets.lua @ 34:9856ebc63fa4
- half solution to Update being fired multiple times during load
- change securefunc handlers to dispense a reason code; catch that reason code in the enclosure passed to hooksecurefunc, and decide whether to update or not from there.
author | Nenue |
---|---|
date | Sun, 17 Apr 2016 00:21:45 -0400 |
parents | 64f2a9bbea79 |
children | 69d03f8e293e |
line wrap: on
line diff
--- a/ObjectiveTracker/Widgets.lua Fri Apr 15 17:01:06 2016 -0400 +++ b/ObjectiveTracker/Widgets.lua Sun Apr 17 00:21:45 2016 -0400 @@ -102,6 +102,10 @@ local OnClick = {} OnClick.CloseButton = function(self) T:SetEnabled() + if T.Conf.enabled then + T:Update() + end + UpdatePanelButton(self, T.Conf.enabled) end @@ -177,7 +181,7 @@ itemButton:SetAttribute("item", itemInfo.link) itemButton.questID = info.questID - itemButton.questLogIndex = info.questLogIndex + itemButton.logIndex = info.logIndex itemButton.charges = itemInfo.charges itemButton.rangeTimer = -1 itemButton.block = block @@ -214,14 +218,14 @@ if (rangeTimer) then rangeTimer = rangeTimer - elapsed if (rangeTimer <= 0) then - local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex) + local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.logIndex) if ((not charges) or (charges ~= self.charges)) then T:Update() return end local count = self.HotKey - local valid = IsQuestLogSpecialItemInRange(self.questLogIndex) + local valid = IsQuestLogSpecialItemInRange(self.logIndex) if (valid == 0) then count:Show() count:SetVertexColor(1.0, 0.1, 0.1) @@ -239,7 +243,7 @@ end function Veneer_QuestObjectiveItem_UpdateCooldown (itemButton) - local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.questLogIndex) + local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.logIndex) if (start) then CooldownFrame_SetTimer(itemButton.Cooldown, start, duration, enable) if (duration > 0 and enable == 0) then @@ -320,6 +324,7 @@ frame:SetWidth(wrapperWidth - textIndent * 2) frame:SetScript('OnEvent', T.UpdateWidget[frame.widgetType]) + frame:RegisterEvent('QUEST_LOG_UPDATE') frame:RegisterEvent('TRACKED_ACHIEVEMENT_UPDATE') frame:RegisterEvent('TRACKED_ACHIEVEMENT_LIST_CHANGED') frame:RegisterEvent('CRITERIA_UPDATE') @@ -387,19 +392,18 @@ } -local progressHeight = 16 +local progressHeight = 8 local progressBorder = 1 -local progressIndent = 3 local progressFont = _G.VeneerCriteriaFontNormal - +local lprint = B.print('Line') T.InitializeWidget.ProgressBar = function(self) + local print = lprint local c = T.Conf.Wrapper self.height = progressHeight + c.TextSpacing self.width = c.Width - c.TextSpacing - self.indent = progressIndent - self.value = 1 - self.maxValue = 1 + self.value = self.value or 1 + self.maxValue = self.maxValue or 1 self:SetHeight(progressHeight) self.bg:SetHeight(progressHeight) @@ -407,6 +411,7 @@ self.fg:ClearAllPoints() self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder) self.fg:SetHeight(progressHeight - progressBorder * 2) + self.status:SetFontObject(progressFont) self.status:SetText(self.objective.quantityString) end @@ -418,10 +423,6 @@ print(k, v) end - if self.line.format then - self.status:SetFormattedText(self.line.format, quantity, requiredQuantity) - end - local progress = (quantity / requiredQuantity) if progress >= 1 then self.fg:Show()