Mercurial > wow > buffalo2
diff ObjectiveTracker/Frame.lua @ 29:adcd7c328d07
code collation cleaning
author | Nenue |
---|---|
date | Wed, 13 Apr 2016 21:53:24 -0400 |
parents | c33c17dd97e7 |
children | 7583684becf4 |
line wrap: on
line diff
--- a/ObjectiveTracker/Frame.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/Frame.lua Wed Apr 13 21:53:24 2016 -0400 @@ -12,6 +12,7 @@ local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame +local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow local print = B.print('Tracker') local unitLevel = 1 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON @@ -142,13 +143,13 @@ local print = bprint local tracker = self.frame local info = block.info - currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) - currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) - self.currentAnchor = currentBlock - print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, tracker.height) - tracker.height = tracker.height + currentBlock.height - tracker.numBlocks = max(tracker.numBlocks, info.blockIndex) - tracker.actualBlocks = tracker.actualBlocks + 1 + block:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) + block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) + self.currentAnchor = block + print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) + tracker.height = tracker.height + block.height + self.numBlocks = max(self.numBlocks, info.blockIndex) + self.actualBlocks = self.actualBlocks + 1 end --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) @@ -216,6 +217,8 @@ return lines[lineIndex] end + + --- Creates or retrieves a complete block frame object T.GetBlock = function(handler, blockIndex) local print = bprint @@ -232,7 +235,6 @@ local c = T.Conf.Wrapper block.index = blockIndex - block.SetStyle = T.SetBlockStyle block:SetWidth(c.Width) block.title:SetSpacing(c.TitleSpacing) @@ -297,20 +299,19 @@ tracker.title:SetTextColor(unpack(headerColor)) self.currentAnchor = tracker.titlebg - local numWatched = self:GetNumWatched() - local numBlocks = self.numBlocks - local actualBlocks = 0 + self.numWatched = self:GetNumWatched() + self.actualBlocks = 0 for watchIndex = 1, 25 do blockIndex = blockIndex + 1 - if watchIndex <= numWatched then + if watchIndex <= self.numWatched then local info = self:GetInfo(watchIndex) if info then local currentBlock = self:UpdateBlock(blockIndex, info) - T.AddBlock(currentBlock) + T.AddBlock(self, currentBlock) else print(' |cFFFF0000bad GetInfo data for #'..watchIndex) end - elseif watchIndex <= numBlocks then + elseif watchIndex <= self.actualBlocks then local used = self.usedBlocks local free = self.freeBlocks print('clean up dead quest block') @@ -326,11 +327,8 @@ end end - self.numWatched = numWatched - self.numBlocks = numBlocks - self.actualBlocks = actualBlocks - if numBlocks >= 1 then + if self.actualBlocks >= 1 then tracker.height = tracker.height + headerHeight tracker:Show() @@ -341,6 +339,7 @@ if tracker.height ~= tracker.previousHeight then tracker:SetHeight(tracker.height) end + print(' |cFFFFFF00', tracker.height, tracker:GetWidth()) else tracker:Hide() tracker.wasEmpty = true @@ -696,42 +695,38 @@ end -Default.Select = function(self) - T:Update(self.watchReasonModule) +Default.Select = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Open = function(self) - T:Update(self.watchReasonModule) +Default.Open = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Remove = function(self) - T:Update(self.watchReasonModule) +Default.Remove = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Report = function(self) - print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') +Default.Report = function(handler, block) + print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') end Default.OnMouseUp = function(self, button) - print(self.handler.name, self.mainStyle, self.subStyle) if button == 'LeftButton' then if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then - self:Link() + self.Link(self.handler, self) elseif IsModifiedClick("QUESTWATCHTOGGLE") then - self:Remove() + self.Remove(self.handler, self) else - self:Select() + self.Select(self.handler, self) end elseif button == 'RightButton' then - self:Open() + self.Open(self.handler, self) end self.initialButton = nil self.modChatLink = nil self.modQuestWatch = nil - mod:Update(self.handler.updateReasonModule) + T:Update(self.handler.updateReasonModule) print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') end - Default.OnMouseDown = function(self, button) - - print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) print(self.info.title) end