diff ObjectiveStyle.lua @ 18:d1812fb10ae6

ObjectiveStyle - move tag/template logic into the corresponding GetInfo
author Nenue
date Tue, 05 Apr 2016 02:38:01 -0400
parents c33497b116d6
children 605e8f0e46db
line wrap: on
line diff
--- a/ObjectiveStyle.lua	Tue Apr 05 00:44:25 2016 -0400
+++ b/ObjectiveStyle.lua	Tue Apr 05 02:38:01 2016 -0400
@@ -8,7 +8,7 @@
 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
 local titleSize, textSize = 16, 15
 local titleOutline, textOutline = "OUTLINE", "OUTLINE"
-local titleSpacing, textSpacing = 3, 1
+local titleSpacing, textSpacing = 3, 3
 local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat
 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
 local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24
@@ -93,10 +93,31 @@
     Normal = {
       titlebg = {
         Indent = 2,
-        Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}},
+        Gradient = { 'HORIZONTAL', MinColor = {0.7, 0, 0.9, 0}, MaxColor = {.7, 0, 0.9, .25}},
       },
       title = {
-        TextColor = {1,1,1,0.5},
+        TextColor = {1,1,1,0.8},
+        Font = {titleFont, titleSize, titleOutline},
+        Spacing = titleSpacing,
+      },
+      status = {
+        TextColor = {1,1,1,0.8},
+        Font = {textFont, textSize, textOutline},
+        Spacing = textSpacing,
+      },
+      statusbg = {
+        Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
+      }
+    },
+    Daily = {
+      titlebg = {
+        Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0},          MaxColor = {0, 0.4, 1, .35},        },
+      },
+      statusbg = {
+        Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0},          MaxColor = {0, 0.35, .90, .31},        },
+      },
+      title = {
+        TextColor = {0.7,1,1,1},
         Font = {titleFont, titleSize, titleOutline},
         Spacing = titleSpacing,
       },
@@ -105,9 +126,6 @@
         Font = {textFont, textSize, textOutline},
         Spacing = textSpacing,
       },
-      statusbg = {
-        Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
-      }
     },
     Super = {
       title = {
@@ -159,14 +177,6 @@
         Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 0},          MaxColor = {0, 1, 0, .25},        },
       }
     },
-    Daily = {
-      titlebg = {
-        Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.34},          MaxColor = {0, 0.4, 1, .17},        },
-      },
-      statusbg = {
-        Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.25},          MaxColor = {0, 0.4, 1, .12},        },
-      },
-    },
     AutoQuest = {
       Normal = {
         titlebg = {
@@ -363,111 +373,52 @@
 
   --- Hardcoding the sizing vars for sanity
   local normalSettings = mod.defaults.Style.Format
-  frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0
-  frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2)  or 0
-  frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
   frame.width = normalSettings.Frame.Width
   frame.statusWidth = frame.width - normalSettings.status.Indent
   frame.titleWidth = frame.width - normalSettings.title.Indent
 
-  print((frame.status and frame.status:GetText()))
-  print((frame.status and frame.status:GetWidth()))
-  print(frame.status and frame.title:GetStringHeight())
-  print(frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0)
-  print(frame.status and frame.status:GetStringHeight())
-  print(frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2)  or 0)
-  if frame.status then
-    print('status  ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight)
-    frame.status:SetWidth(frame.width)
-    frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
-    frame.status:SetPoint('TOP', frame, 'TOP', 0, -frame.status.spacing)
-    --frame.status:SetHeight(frame.statusHeight)
-    if frame.statusbg then
-
-      frame.statusbg:SetHeight(frame.statusHeight + frame.status.spacing * 2)
-      frame.statusbg:SetWidth(frame.width)
-    end
-  end
   if frame.title then
-    print('title  ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight)
+    frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0
+    frame.title.spacing = frame.title.spacing or frame.title:GetSpacing()
     frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
     frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing)
     frame.title:SetWidth(frame.width)
     if frame.titlebg then
-      frame.titlebg:SetHeight(frame.titleHeight + frame.title.spacing * 2)
+      frame.titlebg:SetHeight(frame.titleHeight)
       frame.titlebg:SetWidth(frame.width)
     end
+    print('  title, textHeight', frame.titleHeight, 'indent', normalSettings.title.Indent, 'spacing', frame.title.spacing)
+  else
+    frame.titleHeight = 0
   end
+
+  if frame.status then
+    frame.statusHeight   = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2)  or 0
+    frame.status.spacing = frame.status.spacing or frame.status:GetSpacing()
+    frame.status:SetWidth(frame.width)
+    frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
+    frame.status:SetPoint('TOPLEFT', frame.titlebg, 'BOTTOMLEFT', normalSettings.status.Indent, -frame.status.spacing)
+    --frame.status:SetHeight(frame.statusHeight)
+    if frame.statusbg then
+
+      frame.statusbg:SetHeight(frame.statusHeight)
+      frame.statusbg:SetWidth(frame.width)
+    end
+    print('  status, textHeight', frame.statusHeight, 'indent', normalSettings.status.Indent, 'spacing', frame.status.spacing)
+  else
+    frame.statusHeight = 0
+  end
+
+  frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
   frame:SetSize(frame.width, frame.height)
-  print('sizing frame', frame.width, frame.height)
-    --[[
-      local titleSpacing, titleSpacing2 = c.Title.Spacing, (c.Title.Spacing * 2)
-      local textSpacing, textSpacing2 = c.Text.Spacing, (c.Text.Spacing * 2)
-
-      block.title:SetSpacing(titleSpacing)
-      block.objectives:SetSpacing(textSpacing)
-      block.objectives:SetWordWrap(true)
-
-      local titleHeight, textHeight = block.title:GetStringHeight(), block.objectives:GetStringHeight() + block.attachmentHeight
-      local blockHeight = titleHeight + titleSpacing2 + textHeight + textSpacing2
-      local blockWidth = wrapperMaxWidth
-
-      block.titlebg:SetSize(min(w1, w2), titleHeight + titleSpacing2)
-      block.bg:SetSize(w1, textHeight + textSpacing2)
-      block:SetSize(blockWidth, blockHeight)
-
-      block.title:SetPoint('TOPLEFT', block.titlebg, 'TOPLEFT', 0, -titleSpacing)
-      block.objectives:SetPoint('TOPLEFT', block.titlebg, 'BOTTOMLEFT', textIndent, -textSpacing)
-
-      -- store
-      block.titleHeight = titleHeight
-      block.textHeight = textHeight
-      block.width = blockWidth
-      block.height = blockHeight
-    --]]
-  --print('    |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')')
+  print('    sizing frame', frame.width, frame.height)
 end
-local segments = {'Left', 'Right', 'Tile' }
-local Wrapper = _G.VeneerObjectiveWrapper
 mod.UpdateWrapperStyle = function()
   local  c = mod.Conf.Wrapper
   --Wrapper:ClearAllPoints()
   --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY)
 end
 
-mod.Tracker.SetBlockTags = function(block, info)
-  if info.isComplete then
-    block.mainStyle = 'Complete'
-  end
-  if info.superTracked then
-    block.subStyle = 'Super'
-  elseif info.isDaily then
-    block.subStyle = 'Daily'
-  end
-end
-local unitLevel = UnitLevel('player')
-mod.Quest.SetBlockTags = function(block, info)
-
-  mod.Tracker.SetBlockTags(block, info)
-  if info.level then
-    local levelDiff = unitLevel - info.level
-    if  levelDiff > 9 then
-      block.title:SetTextColor(0.7, 0.7, 0.7, 1)
-    elseif levelDiff > 1 then
-      block.title:SetTextColor(0.5, 1, 0.5, 1)
-    elseif levelDiff < -1 then
-      block.title:SetTextColor(1, 0.4, 0.25, 1)
-    elseif levelDiff < -4 then
-      block.title:SetTextColor(1, 0, 0, 1)
-    else
-      block.title:SetTextColor(1,1,1,1)
-    end
-  end
-end
-mod.Cheevs.SetBlockTags = function(block, info)
-  mod.Tracker.SetBlockTags(block, info)
-end
-
 --- Argument containers
 local o -- text flag
 local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2