diff Veneer.lua @ 122:ea2c616a3b4f

Standardize anchor variables - anchorGroup sets general position, defers to anchorPoint - anchorPoint and anchorFrom are used in SetPoint, deferring to anchorGroup and its inverse Artifact Power: - scan and update triggers trimmed down BuffFrame: - extra values can be right clicked to hide for particular auras LFG: - Desolate Host link placed above Sisters when searching for best cheevos TalkingHead - Re-enable TalkingHeadFrame click behaviour
author Nenue
date Mon, 21 Aug 2017 22:15:46 -0400
parents 1f68c46bc4de
children b3c0258b419d
line wrap: on
line diff
--- a/Veneer.lua	Mon Jul 17 11:51:31 2017 -0400
+++ b/Veneer.lua	Mon Aug 21 22:15:46 2017 -0400
@@ -4,7 +4,7 @@
 -- 3. Setup() where (not self.initialized)
 -- 4. Update()
 -- 5. Reanchor()
-local ADDON, Veneer = ...
+local ADDON, addon = ...
 local VENEER_VERSION = 703
 local LE_FREE_FRAMES_GROUP = 1
 local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select
@@ -12,18 +12,22 @@
 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop
 local eprint = DEVIAN_WORKSPACE and function(...) _G.print('VeneerEvent', ...) end or nop
 local wipe = table.wipe
+VeneerCore = {}
+local Veneer = VeneerCore
 
 SLASH_VENEER1 = "/veneer"
 SLASH_VENEER2 = "/vn"
 SlashCmdList.VENEER = function(cmd)
-  if Veneer.ConfigMode then
-    Veneer.ConfigMode = false
+  _G.Veneer:print(_G.Veneer.ConfigMode)
+  if _G.Veneer.ConfigMode == true then
+    _G.Veneer.ConfigMode = false
   else
-    Veneer.ConfigMode = true
+    _G.Veneer.ConfigMode = true
   end
-  Veneer:UpdateConfigLayers()
+  _G.Veneer:UpdateConfigLayers()
 end
 
+
 Veneer.modules = {}
 Veneer.Frames = {}
 Veneer.ConfigLayers = {}
@@ -176,8 +180,8 @@
 
 function Veneer:Setup ()
   print('|cFFFF0088Setup()|r')
-  local resetConfig = (not VeneerData)
   if (not VeneerData) then
+    print('|cFF00FFFFresetting defaults|r')
     VeneerData = defaults
     VeneerData.version = VENEER_VERSION
   end
@@ -185,6 +189,7 @@
   self:ExecuteOnClusters(nil, VeneerModule_Setup)
 
   self.ConfigMode = VeneerData.ConfigMode
+  print('|cFF00FF88configMode =', self.ConfigMode)
   self:UpdateConfigLayers()
   self:Reanchor()
   self:Update()
@@ -192,11 +197,10 @@
 
 function Veneer:UpdateConfigLayers()
   if VeneerData then
-
     VeneerData.ConfigMode = self.ConfigMode
   end
 
-  self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'.')
+  self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'. ', tostring(self.ConfigMode))
   self:ExecuteOnClusters(nil, function(frame)
     if frame.UpdateConfigLayers then
       frame:UpdateConfigLayers(self.ConfigMode)
@@ -246,10 +250,12 @@
 
   if not handler.anchorFrame then
 
-    local primaryAnchor = handler.anchorPoint or 'CENTER'
+    local clusterAnchor = handler.anchorGroup or handler.anchorPoint or 'CENTER'
     local clusterPriority = handler.anchorPriority
-    self.FrameClusters[primaryAnchor] = self.FrameClusters[primaryAnchor] or {}
-    local clusterTable = self.FrameClusters[primaryAnchor]
+    print('panel group =', clusterAnchor)
+
+    self.FrameClusters[clusterAnchor] = self.FrameClusters[clusterAnchor] or {}
+    local clusterTable = self.FrameClusters[clusterAnchor]
     local clusterIndex
 
     if clusterPriority then
@@ -275,7 +281,7 @@
 
 
     tinsert(clusterTable, clusterIndex, handler)
-    print(' cluster', (clusterDepth or 1) .. '.' .. primaryAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex)
+    print(' cluster', clusterAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex)
 
     handler.anchorCluster = clusterTable
     handler.anchorIndex = clusterIndex
@@ -337,8 +343,9 @@
   parent = parent or self
   local print = eprint
   print('|cFF88FF00DynamicReanchor()')
-  for anchorPoint, cluster in pairs(parent.FrameClusters) do
-    if anchorPoint ~= LE_FREE_FRAMES_GROUP then
+  for clusterPoint, cluster in pairs(parent.FrameClusters) do
+    print(clusterPoint)
+    if clusterPoint ~= LE_FREE_FRAMES_GROUP then
       local lastFrame
       for index, frame in ipairs(cluster) do
         print('  |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent'))
@@ -349,15 +356,16 @@
             frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY)
             print('anchored to', frame.anchorFrame,frame:GetTop(), frame:GetRight())
           else
-            anchorPoint = frame.anchorPoint or anchorPoint
+            local anchorPoint = frame.anchorPoint or clusterPoint
+            local anchorFrom = frame.anchorFrom or ANCHOR_OFFSET_POINT[clusterPoint]
             frame:ClearAllPoints()
             if lastFrame then
-              frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
+              frame:SetPoint(anchorPoint, lastFrame, anchorFrom, 0, 0)
 
-              print('moved after', lastFrame,frame:GetTop(), frame:GetRight())
+              print('  fixing to', lastFrame, anchorPoint, anchorFrom, frame:GetTop(), frame:GetRight())
             else
-              frame:SetPoint(anchorPoint, UIParent, anchorPoint, frame.anchorX, frame.anchorY)
-              print('stub', anchorPoint, frame.anchorX, frame.anchorY)
+              frame:SetPoint(anchorPoint, UIParent, clusterPoint, frame.anchorX, frame.anchorY)
+              print('NEW', clusterPoint, anchorPoint, anchorFrom, frame.anchorX, frame.anchorY)
             end
             lastFrame = frame
           end
@@ -507,5 +515,3 @@
   end
   return veneer
 end
-
-VeneerCore = Veneer
\ No newline at end of file