diff ObjectiveTracker/Layout.lua @ 44:756e8aeb040b

- Default.lua - simplified the response to SuperTrackedQuestID changes - tag icons work again
author Nenue
date Mon, 25 Apr 2016 19:37:13 -0400
parents 9480bd904f4c
children dd1ae565f559
line wrap: on
line diff
--- a/ObjectiveTracker/Layout.lua	Mon Apr 25 13:51:58 2016 -0400
+++ b/ObjectiveTracker/Layout.lua	Mon Apr 25 19:37:13 2016 -0400
@@ -240,63 +240,60 @@
   local info = block.info
 
   block.index = blockIndex
-  -- if animating, skip this segment
-  if not block.isAnimating then
-    print('blockschema', blockSchema, block.schema)
-    if blockSchema ~= block.schema then
-      T.UpdateSchema('block', block.schema)
-      print('  ### activating block schema:|cFF0088FF', block.schema)
-    end
-
-    block:SetWidth(T.Conf.Wrapper.Width)
-    block.title:SetSpacing(titleSpacing)
-    block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
-    block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0)
-    block.title:SetTextColor(unpack(titleColor))
-    block.titlebg:SetTexture(1,1,1,1)
-    block.titlebg:SetGradientAlpha(unpack(titlebg))
-    block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
-    block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
-    block.status:SetSpacing(textSpacing)
-    block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
-    block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
-    block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
-    block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
-    block.statusbg:SetTexture(1,1,1,1)
-    block.statusbg:SetGradientAlpha(unpack(textbg))
-    block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg))
-    block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
-    block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
-
-    local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2
-    for i, tile in ipairs(block.rewardTile)  do
-      --print(rewardSize)
-      tile:SetSize(rewardSize, rewardSize)
-      tile:ClearAllPoints()
-      tile:SetPoint(anchor, target, point, x, y)
-      block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0)
-      anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0
-    end
-
-
-    local titleHeight = floor(block.title:GetHeight()+.5)
-    local titlebgHeight = titleHeight + titleSpacing*2
-    block.titlebg:SetHeight(titlebgHeight)
-
-    local statusHeight = floor(block.status:GetHeight()+.5)
-    local statusbgHeight = statusHeight + textSpacing*2
-    local attachmentHeight =floor(block.attachmentHeight + .5)
-
-    self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName())
-    self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')')
-    if attachmentHeight > 0 then
-      attachmentHeight = attachmentHeight + textSpacing
-    end
-
-    block.height = titlebgHeight + attachmentHeight
-    block:SetHeight(block.height)
+  print('blockschema', blockSchema, block.schema)
+  if blockSchema ~= block.schema then
+    T.UpdateSchema('block', block.schema)
+    print('  ### activating block schema:|cFF0088FF', block.schema)
   end
 
+  block:SetWidth(T.Conf.Wrapper.Width)
+  block.title:SetSpacing(titleSpacing)
+  block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
+  block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0)
+  block.title:SetTextColor(unpack(titleColor))
+  block.titlebg:SetTexture(1,1,1,1)
+  block.titlebg:SetGradientAlpha(unpack(titlebg))
+  block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
+  block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
+  block.status:SetSpacing(textSpacing)
+  block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
+  block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
+  block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
+  block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
+  block.statusbg:SetTexture(1,1,1,1)
+  block.statusbg:SetGradientAlpha(unpack(textbg))
+  block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg))
+  block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
+  block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
+
+
+  local titleHeight = floor(block.title:GetHeight()+.5)
+  local titlebgHeight = titleHeight + titleSpacing*2
+  block.titlebg:SetHeight(titlebgHeight)
+
+  local statusHeight = floor(block.status:GetHeight()+.5)
+  local statusbgHeight = statusHeight + textSpacing*2
+  local attachmentHeight =floor(block.attachmentHeight + .5)
+
+  if attachmentHeight > 0 then
+    attachmentHeight = attachmentHeight + textSpacing
+  end
+
+  block.height = titlebgHeight + attachmentHeight
+  block:SetHeight(block.height)
+
+  local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2
+  for i, tile in ipairs(block.rewardTile)  do
+    --print(rewardSize)
+    tile:SetSize(rewardSize, rewardSize)
+    tile:ClearAllPoints()
+    tile:SetPoint(anchor, target, point, x, y)
+    block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0)
+    anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0
+  end
+
+  self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName())
+  self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')')
   if block.debug then
     local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide'
     for _, region in ipairs(block.debug) do
@@ -329,26 +326,30 @@
 
   if Devian and Devian.InWorkspace() then
     block.DebugTab:SetParent(UIParent)
-    block.DebugTab:SetPoint('TOPRIGHT', block, 'TOPLEFT', 0, 0)
+    block.DebugTab:SetPoint('RIGHT', block.titlebg, 'LEFT', 0, 0)
     block.DebugTab.status:SetText(tostring(block.schema) .. ' @|cFF00FF00' .. tostring(block.posIndex) .. '|r #|cFFFFFF00'.. tostring(info.logIndex or info.id) .. '|r'..
-        ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r')
+        ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r ' .. (info.statusKey or ''))
     block.DebugTab:Show()
   end
 end
 
+
+local tagOrder = {'completion', 'frequency', 'type'}
 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
-Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative)
+Default.AddTags = function (handler, block, tagInfo, tagCoords)
   local print = bprint
 
-  for order, tagName in ipairs(block.info.tagInfo) do
-    local tag = block[tagName]
-    if block.tagCoords[tagName] and tag then
-      tag:SetTexCoord(unpack(block.tagCoords[tagName]))
+  local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
+  handler.print('AddTag', block:GetName(), tagInfo, tagCoords)
+  for order, key in ipairs(tagOrder) do
+    local tag = block[key .. 'Tag']
+    if tag and tagInfo[key] then
+      tag:SetTexCoord(unpack(tagInfo[key]))
       tag:Show()
       tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
       tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
     else
-      block[tagName]:Hide()
+      block[key .. 'Tag']:Hide()
     end
   end