diff FilterBar.lua @ 41:79e5e96e5f18 v1.0-rc10

- Clear Garrison minimap button pulse when shown
author Nenue
date Sun, 25 Dec 2016 15:17:35 -0500
parents 589c444d4837
children 77c2ffb5c7f5
line wrap: on
line diff
--- a/FilterBar.lua	Sun Dec 25 13:04:57 2016 -0500
+++ b/FilterBar.lua	Sun Dec 25 15:17:35 2016 -0500
@@ -64,14 +64,16 @@
 local defaults = {}
 
 WorldPlanSummaryMixin = WorldPlanSummaryMixin or {}
-WorldPlanSummaryMixin.selectedBountyIndex = {}
-WorldPlanSummaryMixin.bounties = {}
-WorldPlanSummaryMixin.filterList = {}
-WorldPlanSummaryMixin.buttons = {}
-WorldPlanSummaryMixin.cvarFiltersDirty = false
+local Module = WorldPlanSummaryMixin
+Module.selectedBountyIndex = {}
+Module.bounties = {}
+Module.filterList = {}
+Module.buttons = {}
+Module.cvarFiltersDirty = false
 WorldPlanFilterPinMixin = {}
+local Pin = WorldPlanFilterPinMixin
 
-function WorldPlanSummaryMixin:OnLoad()
+function Module:OnLoad()
   self:SetParent(WorldMapFrame)
   WorldPlan:AddHandler(self)
   for index, info in ipairs(db.DefaultFilters) do
@@ -84,7 +86,7 @@
 end
 
 
-function WorldPlanSummaryMixin:OnEvent(event)
+function Module:OnEvent(event)
   print('|cFF00FF88'..self:GetName()..':OnEvent()', event)
   self.isStale = true
 end
@@ -92,26 +94,36 @@
 local bountyIndex
 local debug_headers = {}
 
-function WorldPlanSummaryMixin:Setup()
+function Module:Setup()
   print('|cFF00FF88'..self:GetName()..':Setup()')
 end
 
 
-function WorldPlanSummaryMixin:OnUpdate()
+function Module:OnUpdate()
   if self.isStale then
     wprint('|cFF00FF00pushing update')
     self:Refresh()
   end
 end
 
-function WorldPlanSummaryMixin:OnShow()
+function Module:OnMapInfo(isBrokenIsle, mapAreaID)
+  if not isBrokenIsle then
+    self:SetShown(false)
+  else
+    self:SetShown(true)
+    self:Refresh()
+  end
+end
+
+function Module:OnShow()
   print('|cFF00FF88'..self:GetName()..':OnShow()')
   if self.isStale then
     self:Refresh()
   end
 end
 
-function WorldPlanSummaryMixin:GetFilters()
+local tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID = tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID
+function Module:GetFilters()
 
   print('|cFF00FFFF'..self:GetName()..':GetFilters()')
 
@@ -142,12 +154,12 @@
   end
 end
 
-function WorldPlanSummaryMixin:Reset()
+function Module:Reset()
   self.pinLayout = self:GetTypeInfo(255)
   self:GetFilters()
 end
 
-function WorldPlanSummaryMixin:Refresh()
+function Module:Refresh()
   self:GetFilters()
   self:Update()
 end
@@ -156,7 +168,7 @@
 local filterMask = "Interface\\Minimap\\UI-Minimap-Background"
 
 local questResults = {{}}
-function WorldPlanSummaryMixin:Update()
+function Module:Update()
   local blocks = self.buttons
 
   local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton
@@ -250,23 +262,16 @@
   end
 
 
-  if firstCvar and lastCvar then
-    self.CVarsHighlight:ClearAllPoints()
-    self.CVarsHighlight:SetPoint('TOPLEFT', firstCvar, 'TOPLEFT', -1, 1)
-    self.CVarsHighlight:SetPoint('BOTTOMRIGHT', lastCvar, 'BOTTOMRIGHT', 1, -1)
-  end
-  self.CVarsHighlight:SetShown(self.cvarFiltersDirty or false)
-
 
   self.isStale = nil
 end
 
-function WorldPlanSummaryMixin:Cleanup()
+function Module:Cleanup()
   -- hide trailing buttons
 end
 
 local rgbWhite = {r = 1, g= 1, b= 1, hex = '|cFFFFFFFF'}
-function WorldPlanFilterPinMixin:OnEnter()
+function Pin:OnEnter()
   if #self.questList >= 1 then
     GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
     GameTooltip:AddLine(self.info.label)
@@ -279,13 +284,13 @@
   end
 end
 
-function WorldPlanFilterPinMixin:OnLeave()
+function Pin:OnLeave()
   if GameTooltip:IsOwned(self) then
     GameTooltip:Hide()
   end
 end
 
-function WorldPlanFilterPinMixin:Refresh()
+function Pin:Refresh()
   local info = self.info
   self.filterKey = info.filterKey
   self.filterValue = info.filterValue
@@ -317,18 +322,18 @@
     if self.cVar then
       if GetCVarBool(self.cVar) then
         self.count:SetTextColor(1,1,1)
-        r,g,b = 0, 1, 0
+        r,g,b,a = 0, 0, 0, 1
       else
         self:GetParent().cvarFiltersDirty = true
         self.count:SetTextColor(1,0,0)
         self.icon:SetDesaturated(true)
-        r,g,b = 1, 0, 0
+        r,g,b,a = 1, 0, 0, 0.5
       end
     else
       if db.UsedFilters[self.filterKey] then
         if db.UsedFilters[self.filterKey] == self.filterValue then
           self.count:SetTextColor(0,1,0)
-          r,g,b = 0, 1, 0
+          r, g, b = 0, 1, 0
         else
           self.count:SetTextColor(1,0,0)
           r, g, b = 1, 0, 0
@@ -344,20 +349,22 @@
       end
     end
   end
-  self.RewardBorder:SetColorTexture(r, g, b, a)
+  self.RewardBorder:SetColorTexture(r, g, b)
+  self:SetAlpha(a)
 
   --self:UpdateSize()
 end
 
-function WorldPlanFilterPinMixin:OnLoad()
+function Pin:OnLoad()
   self:RegisterForClicks('AnyUp')
   self:SetFrameStrata('HIGH')
   self:SetFrameLevel(151)
   self:SetScript('OnUpdate', nil)
   self.questList = {}
+  -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level
 end
 
-function WorldPlanFilterPinMixin:OnUpdate ()
+function Pin:OnUpdate ()
 end
 
 -- shift-click: reset filter
@@ -366,7 +373,7 @@
 local RESET_FILTER = "|cFFFFFFFF+%s|r"
 local FILTER_EXCLUDE_TYPE = '|cFFFF0000-%s|r'
 local FILTER_INCLUDE_TYPE = '|cFF00FF00+%s|r'
-function WorldPlanFilterPinMixin:OnClick (button)
+function Pin:OnClick (button)
 
   local filterKey = self.filterKey
   local filterValue = self.filterValue