changeset 14:54adb0d4938b v1.0-rc3

WorldQuests: - Filter interface reverted: - Left-click to single out a category value, right-click to exclude. Hold shift to set multiple inclusion rules. - Filters operate inclusively. If any of the criteria is green, that pin will appear.
author Nenue
date Mon, 24 Oct 2016 05:49:55 -0400
parents 06c9a30d48da
children ecf6f005ce38
files WorldPlan.lua
diffstat 1 files changed, 28 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/WorldPlan.lua	Mon Oct 24 04:37:07 2016 -0400
+++ b/WorldPlan.lua	Mon Oct 24 05:49:55 2016 -0400
@@ -186,6 +186,7 @@
 WorldPlanCore.FilterStyle = POI_FILTER_STYLE
 
 WorldPlanCore.FilterOptions = {}
+WorldPlanCore.UsedFilters = {}
 
 
 -- operating flags
@@ -951,21 +952,23 @@
   local qType = self.worldQuestType
   local rType = self.rewardType
   self.filtered = nil
-  self.whiteListed = nil
   self.used = true
 
-  local whiteListed, blackListed
-  for filterKey, includes in pairs(FilterInclusions) do
+  print('  |cFFFF4400IsShowable()|r', self.title)
+
+  local isIncluded
+  for filterKey, filterValues in pairs(WorldPlan.UsedFilters) do
     local controlValue = self[filterKey]
     if controlValue then
-      if includes[controlValue] == nil then
-        includes[controlValue] = true
-      elseif includes[controlValue] == false then
-        self.filtered = true
-        break
+      local filterType = filterValues[controlValue]
+      if filterType == true then
+        isIncluded = true
+        print('   include? ', filterKey, controlValue, filterType)
       end
     end
   end
+  self.filtered = (not isIncluded)
+
 
   if not TQ_IsActive(self.questID) then
     self.used = nil
@@ -975,7 +978,6 @@
       self.used = nil
     end
   end
-  print('  |cFFFF4400IsShowable()|r', self.used, self.filtered, self.title)
   return self.used, self.filtered
 end
 
@@ -1158,7 +1160,6 @@
       button.relativeFrame = relativeFrame
       button:Refresh(info, (numHeaders == 1), numQuests)
       button:Show()
-      print('  using', button.label:GetText())
       relativeFrame = button
     end
 
@@ -1210,15 +1211,11 @@
   print('anchor to', self.relativeFrame:GetName())
 
   local r, g, b, a = 1,1,1,1
-  if self.filterKey then
-    if FilterInclusions[self.filterKey][self.filterValue] == nil then
-      FilterInclusions[self.filterKey][self.filterValue] = true
-    end
-
-
-    if FilterInclusions[self.filterKey][self.filterValue] == true then
+  local used = WorldPlan.UsedFilters[self.filterKey]
+  if used and self.filterKey then
+    if used[self.filterValue] == true then
       r, g, b = 0, 1, 0
-    elseif FilterInclusions[self.filterKey][self.filterValue] == false then
+    elseif used[self.filterValue] == false then
       r, g, b = 1, 0, 0
     end
   end
@@ -1257,18 +1254,25 @@
 
   if not filterKey then
     -- resetting
-    for k,v in pairs(FilterInclusions) do
+    for k,v in pairs(WorldPlan.UsedFilters) do
       wipe(v)
     end
+  elseif IsShiftKeyDown() then
+    WorldPlan.UsedFilters[filterKey] = nil
   else
-    FilterInclusions[filterKey][filterValue] = setInclude
-    if (not IsShiftKeyDown()) then
-      for k, info  in ipairs(WorldPlan.FilterOptions) do
-        if (info.filterKey == filterKey) and (info.filterValue ~= filterValue) then
-          FilterInclusions[info.filterKey][info.filterValue] = (not setInclude)
+    WorldPlan.UsedFilters[filterKey] = WorldPlan.UsedFilters[filterKey] or {}
+    WorldPlan.UsedFilters[filterKey][filterValue] = setInclude
+    print(filterKey, filterValue, '=', setInclude)
+
+    for index, info in ipairs(WorldPlan.FilterOptions) do
+      if info.filterKey == filterKey then
+        if (not IsControlKeyDown()) and (filterValue ~= info.filterValue) then
+          WorldPlan.UsedFilters[filterKey][info.filterValue] = (not setInclude)
+          print(filterKey, info.filterValue, '=', WorldPlan.UsedFilters[filterKey][info.filterValue])
         end
       end
     end
+
   end
   print('|cFF00FF88Filter Update:', filterKey, filterValue, operation)
   WorldPlan:RefreshAll()