diff Veneer.lua @ 97:5476337198ec

- apply default anchors when docking modules - Arifact Power tracker: totals AP items in bags and bank, and forecasts progress on each weapon. Requires user to shift-click each weapon at least once to get initial XP data.
author Nenue
date Mon, 16 Jan 2017 20:24:12 -0500
parents df10cd0ae949
children dadddb8a551f
line wrap: on
line diff
--- a/Veneer.lua	Tue Jan 03 14:06:41 2017 -0500
+++ b/Veneer.lua	Mon Jan 16 20:24:12 2017 -0500
@@ -111,8 +111,8 @@
 local select, IsAddOnLoaded, IsLoggedIn = select, IsAddOnLoaded, IsLoggedIn
 
 function VeneerCore:OnEvent(event, ...)
-  print(event, ...)
-  if event == 'ADDON_LOADED' or event == 'PLAYER_LOGIN' then
+  print('|cFFFF0088OnEvent()|r',event, ...)
+  if event == 'PLAYER_LOGIN' then
     print(IsLoggedIn(), self.initialized)
     if IsLoggedIn() and not self.intialized then
       self:Setup()
@@ -151,15 +151,19 @@
 end
 
 local VeneerModule_Setup = function(frame)
-  if (not frame.addonTrigger) or select(2,IsAddOnLoaded(frame.addonTrigger)) then
-    if not frame.initialized then
+  if not frame.initialized then
+    local doSetup = (not frame.addonTrigger) or select(2, IsAddOnLoaded(frame.addonTrigger))
+    print('  '..frame:GetName()..'.doSetup =', doSetup)
+    if doSetup then
       frame:Setup()
       frame.initialized = true
     end
+
   end
 end
 
 function VeneerCore:Setup ()
+  print('|cFFFF0088Setup()|r')
   local resetConfig = (not VeneerData)
   if (not VeneerData) then
     VeneerData = defaults
@@ -228,7 +232,9 @@
     end
   end
   if not primaryAnchor then
-    primaryAnchor = 'TOPLEFT'
+    primaryAnchor = 'CENTER'
+    clusterTable[primaryAnchor] = clusterTable[primaryAnchor] or {}
+    clusterTable = clusterTable[primaryAnchor]
   end
   if not insertPosition then
     insertPosition = #clusterTable + 1
@@ -237,7 +243,7 @@
 end
 
 function VeneerCore:AddHandler(handler, ...)
-  print('*** Adding handler:', handler.moduleName or handler:GetName())
+  print('|cFFFFFF00*** Adding handler:', handler.moduleName or handler:GetName())
 
 
     local anchorGroup, clusterTable, clusterIndex = self:GetClusterFromArgs(...)
@@ -248,7 +254,7 @@
     end
     tinsert(clusterTable, clusterIndex, handler)
 
-  print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
+  print(' cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
 
   handler.anchorCluster = clusterTable
   handler.anchorIndex = clusterIndex
@@ -314,10 +320,11 @@
       if frame:IsVisible() then
 
         if frame.anchorFrame then
+          print(frame.anchorPoint)
           frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY)
           print(frame:GetTop(), frame:GetRight())
         else
-          anchorPoint = frame.anchorPoint
+          anchorPoint = frame.anchorPoint or anchorPoint
           frame:ClearAllPoints()
           if lastFrame then
             frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
@@ -409,7 +416,7 @@
       print('delaying walk for', method)
       return
     end
-    print('|cFF00FF00Veneer:ExecuteOnClusters|r('..tostring(layer)..', '..tostring(method)..')')
+    print('|cFF00FF00ExecuteOnClusters|r('..tostring(layer)..', '..tostring(method)..')')
   else
     print(' Level '..self.parserDepth)
   end