diff Veneer.lua @ 48:9837069e366a

move BuffFrame-specific things out of Veneer.lua straighten out table hierarchy for BuffFrame module
author Nenue
date Thu, 28 Apr 2016 06:58:13 -0400
parents 1a322b92dbfa
children 16465f3fd919
line wrap: on
line diff
--- a/Veneer.lua	Thu Apr 28 05:54:21 2016 -0400
+++ b/Veneer.lua	Thu Apr 28 06:58:13 2016 -0400
@@ -131,7 +131,6 @@
 
 
 --- localize for speed
-local layers, refs, displays = B.configLayers, B.configLayersRef, B.displays
 
 local ModulesCall = function(func, flag)
 
@@ -169,38 +168,21 @@
 end
 
 
+local layers, refs, displays = B.configLayers, B.configLayersRef, B.displays
 --- Things that happen immediately upon entering world
 local InitOnce = function()
   print('entering world first time')
-  local defaults = B.ConfDefaults
+  local defaults = {}
   print('|cFFFFFF00Veneer|r')
   if not VeneerData then
     VeneerData = {}
     for k,v in pairs(defaults) do
-
-
       VeneerData[k] = v
     end
     print('Veneer defaults being used.')
   end
-
   B.Conf = setmetatable(VeneerData, {__index = function(_, k) return defaults[k] end})
 
-
-
-  -- suffix tables
-  for name, display in pairs(displays) do
-    display.conf = setmetatable({}, {
-      __index = function(_, k)
-        --print('config check '.. name .. k)
-        return B.Conf[name .. k] or B.Conf['BuffButton' .. k]
-      end,
-      __newindex = function(_, k , v)
-        B.Conf[name..k] = v
-      end,
-    })
-  end
-
   -- To ensure that modules are run in controlled order, walk the dependency list; if the dep shows up
   -- in the loaded manifest, remove the value. If the dep list isn't empty, move that module to the next
   -- layer.
@@ -252,7 +234,6 @@
     i = i + 1
   until i > stackLevels
 
-
   for level, batch in ipairs(moduleStack) do
     print('config level', level)
     for name, module in pairs(batch) do
@@ -282,7 +263,7 @@
     end
   end
 
-
+  --- Pull in any XML templates
   if #checkForConfig >= 1 then
     local queuedFrame = tremove(checkForConfig)
     while queuedFrame do
@@ -291,7 +272,6 @@
       queuedFrame = tremove(checkForConfig)
     end
   end
-  -- remove from existing
 end
 
 --- Fires an update to all modules
@@ -393,26 +373,11 @@
   end
 end
 
-B.UpdateConfigLayers = function()
+B.ToggleGuideLayers = function()
   local print = B.fprint()
   local func = B.Conf.GuidesMode and 'Show' or 'Hide'
   local numAnchors = 0
-  for name, display in pairs(displays) do
-    numAnchors = numAnchors + 1
-    display.anchor:EnableMouse(B.Conf.GuidesMode)
-    if B.Conf.GuidesMode then
-      display.anchor:SetScript('OnUpdate', display.anchor.OnUpdate)
-    else
-      display.anchor:SetScript('OnUpdate', nil)
 
-      for i, anchorButton in ipairs(display.anchor.anchorButton) do
-        anchorButton:Hide()
-      end
-
-    end
-    --print(B.Conf.ConfigMode)
-    display.anchor:EnableMouse(B.Conf.ConfigMode)
-  end
   for id, region in pairs(layers) do
     --print(id, region:GetName(), func)
     region[func](region)
@@ -420,6 +385,10 @@
 
   --print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames')
 end
+B.UpdateConfigLayers = function()
+  print('|cFFFF0000', debugstack())
+  B.ToggleGuideLayers()
+end
 
 local XMLFrame_Enable = function(self, value)
   local name = self:GetName()