diff ObjectiveFrame.lua @ 13:9455693fc290

Init - recall XML display state on reload ObjectiveFrame - quest coloring by relative level - quest coloring by daily/weekly/complete status - remember starting scroll value between reload - limit anchor points to edges for regions affected by style attributes ObjectiveInfo - AutoQuest outline definitions - Pull Quest title and tag data in addition to WatchInfo ObjectiveStyle - ensure consistent style table - hardcode certain attributes for sanity XML - ensure consistent naming conventions for heading and content elements - ensure hardcore anchors are based on edges - expansion of file structure to deal with complexities of dynamic widgets and style caching ObjectiveUI - determine primary style by block handler when restoring original style - moved framescript to 'ObjectiveWidgets' lua
author Nenue
date Sat, 02 Apr 2016 17:46:52 -0400
parents 8238cddaddb1
children ed642234f017
line wrap: on
line diff
--- a/ObjectiveFrame.lua	Sat Apr 02 05:01:54 2016 -0400
+++ b/ObjectiveFrame.lua	Sat Apr 02 17:46:52 2016 -0400
@@ -10,6 +10,7 @@
 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
 local CreateFrame = CreateFrame
 local print = B.print('Objectives')
+local unitLevel = 1
 --------------------------------------------------------------------
 --- Global frame layout
 --------------------------------------------------------------------
@@ -77,12 +78,17 @@
 end
 
 local WrapperCloseButton_OnClick = function(self)
-  if Scroller:IsVisible() then
-    Scroller:Hide()
+  Wrapper:Minimize()
+  if B.Conf.FrameState[Wrapper:GetName()] == 1 then
+    self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Up]])
+    self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Down]])
   else
-    Scroller:Show()
+    self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Up]])
+    self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Down]])
   end
 end
+local WrapperCloseButton_OnMouseWheel = function(self, delta)
+end
 
 mod.InitializeTrackers = function()
 
@@ -112,9 +118,11 @@
   Scroller:SetScript('OnShow', Scroller_OnShow)
   Scroller:SetScript('OnHide', Scroller_OnHide)
   Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick)
+  Wrapper.close:SetScript('OnMouseWheel', WrapperCloseButton_OnMouseWheel)
   Wrapper:SetPoint(unpack(wrapperPosition))
-  Scroller_OnShow(Scroller)
-
+  if B.Conf.ObjectiveTrackerMinimized then
+    Scroller_OnShow(Scroller)
+  end
   mod.UpdateWrapperStyle()
 end
 
@@ -287,6 +295,8 @@
   end
   if info.superTracked then
     subStyle = 'Super'
+  elseif info.isDaily then
+    subStyle = 'Daily'
   end
 
   if info.specialItem and not info.itemButton then
@@ -296,9 +306,25 @@
     --info.itemButton = nil
   end
 
+  if info.level then
+    local levelDiff = unitLevel - info.level
+    if  levelDiff > 9 then
+      t.title:SetTextColor(0.7, 0.7, 0.7, 1)
+    elseif levelDiff > 1 then
+      t.title:SetTextColor(0.5, 1, 0.5, 1)
+    elseif levelDiff < -1 then
+      t.title:SetTextColor(1, 0.4, 0.25, 1)
+    elseif levelDiff < -4 then
+      t.title:SetTextColor(1, 0, 0, 1)
+    else
+      t.title:SetTextColor(1,1,1,1)
+    end
+  end
+
+
   if Devian and Devian.InWorkspace() then
     t.debugText:Show()
-    t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()))
+    t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (info.level and info.level or '-'))
   end
 
   --- metrics are calculated in SetStyle
@@ -440,6 +466,7 @@
 local usedButtons = mod.Quest.itemButtons
 local freeButtons = mod.Quest.freeButtons
 mod.UpdateWrapper = function()
+  unitLevel = UnitLevel('player')
   wrapperWidth = wrapperMaxWidth
   scrollWidth = wrapperWidth
   local wrapperBlocks = 0
@@ -498,7 +525,7 @@
   mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal')
 
   Scroller:SetSize(wrapperWidth, wrapperHeight)
-  Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, -headerHeight)
+  Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
   Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
 
 
@@ -507,7 +534,7 @@
   Scroll:SetPoint('RIGHT', Scroller, 'RIGHT')
 
   --Scroller:UpdateScrollChildRect()
-  Wrapper:SetSize(wrapperWidth, wrapperHeight + headerHeight)
+  Wrapper:SetSize(wrapperWidth, wrapperHeight)
 
   -- update action buttons
   print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),