changeset 115:8c94bee4fdfc

- AddHandler simplified - Centralized combat start/stop hooks - WorldState removed
author Nenue
date Tue, 28 Mar 2017 07:02:26 -0400
parents 6748c98a6c6c
children ddfe19d70a34
files Modules/ArtifactPower.lua Modules/BuffFrame.lua Modules/Currency.lua Modules/Currency.xml Modules/FriendsFrame.lua Modules/FriendsFrame.xml Modules/PaperDoll.xml Modules/WorldState.lua Modules/WorldState.xml Templates.lua Veneer.lua
diffstat 11 files changed, 168 insertions(+), 259 deletions(-) [+]
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/ArtifactPower.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -13,7 +13,10 @@
   scanQueue = {},
   ItemButtons = {},
   anchorPoint = 'TOP',
+  anchorPriority = 2,
   anchorFrom = 'TOP',
+  moduleName = 'Artifactor',
+  HideCombat = true
 }
 local defaultSettings = {
   firstUse = true,
@@ -53,7 +56,7 @@
   self:RegisterEvent('PLAYER_REGEN_DISABLED')
   self:RegisterEvent('PLAYER_ENTERING_WORLD')
   self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data
-  Veneer:AddHandler(self, self.anchorPoint, 2)
+  Veneer:AddHandler(self)
   SLASH_VENEER_AP1 = "/vap"
   SLASH_VENEER_AP2 = "/veneerap"
   SlashCmdList.VENEER_AP = function(arg)
--- a/Modules/BuffFrame.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/BuffFrame.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -41,10 +41,10 @@
 
 VeneerBuffFrameMixin = {
   moduleName = 'Buff Frames',
-  defaultCluster = 'TOPRIGHT',
+  anchorPoint = 'TOPRIGHT',
   anchorX = BUFF_FRAMES_X,
   anchorY = BUFF_FRAMES_Y,
-  anchorPoint = 'TOPRIGHT',
+
   Buttons = {},
   DetectedFrames = {},
   AuraCache = {}
@@ -288,12 +288,12 @@
 end
 
 function plugin:OnLoad()
-  Veneer:AddHandler(self, self.defaultCluster)
+  print(self:GetName(), 'OnLoad()')
+  Veneer:AddHandler(self)
 end
 
 function plugin:Setup()
-
-
+  print(self:GetName(), 'Setup()')
   hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end)
   hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end)
   hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end)
--- a/Modules/Currency.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/Currency.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -7,6 +7,7 @@
 --
 
 local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop
+local profileUpdate, needsUpdate
 
 local zoneEvents = {
   "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED"
@@ -31,13 +32,19 @@
     itemID = 124124,
   }
 }
-local items = {}
+local items, currencies = {}, {}
 
 
-VeneerWorldStateCurrencyMixin = { Blocks = {} }
-VeneerWorldStateCurrencyBlockMixin = {}
-local module = VeneerWorldStateCurrencyMixin
-local block = VeneerWorldStateCurrencyBlockMixin
+VeneerCurrencyMixin = {
+  Blocks = {},
+  HideCombat = true,
+  EventList = {'PLAYER_ENTERING_WORLD'},
+  moduleName = 'Currency Watch',
+  anchorPoint = 'TOP',
+}
+VeneerCurrencyBlockMixin = {}
+local module = VeneerCurrencyMixin
+local block = VeneerCurrencyBlockMixin
 
 
 
@@ -49,9 +56,7 @@
 end
 
 function module:OnLoad ()
-  self:RegisterEvent("PLAYER_ENTERING_WORLD");
-  self:RegisterEvent('PLAYER_REGEN_ENABLED')
-  self:RegisterEvent('PLAYER_REGEN_DISABLED')
+  Veneer:AddHandler(self)
 
   for name, info in pairs(blocks) do
     local frame = CreateFrame('Frame', nil, self, 'VeneerCurrencyTemplate')
@@ -138,15 +143,16 @@
       local texture, count = GetContainerItemInfo(i,j)
       if items[itemID] then
         items[itemID].count = items[itemID].count + (count or 1)
-        items[itemID].texture = texture
-        print('tracked currency tally', items[itemID].count, '|T'..texture..':16:16|t')
-        items[itemID].frame.Icon:SetTexture(texture)
+        if not items[itemID].texture then
+          items[itemID].texture = texture
+          print('tracked currency tally', items[itemID].count, '|T'..texture..':16:16|t')
+          items[itemID].frame.Icon:SetTexture(texture)
+        end
       end
     end
   end
 
-  for itemID, info in pairs(items) do
-  end
+
 
   local lastBlock
   local totalWidth = 0
@@ -170,21 +176,36 @@
       totalWidth = totalWidth + block:GetWidth()
     end
     print(block:IsShown(), '|cFF0088FF'..block.name..'|r', block:GetSize())
-
   end
 
+  self:UpdateProfile()
   self:SetWidth(totalWidth)
 
-  self.needsUpdate = nil
+  needsUpdate = nil
   print(self:IsShown(), '|cFF00FF88'..self:GetName()..'|r', self:GetSize())
   self:SetShown(canShow)
-  VeneerWorldState:Reanchor(true)
+  Veneer:DynamicReanchor()
+end
+
+function module:UpdateProfile()
+  if not self.profile then
+    profileUpdate = true
+    return
+  end
+
+  for itemID, info in pairs(items) do
+    self.profile.Items = self.profile.Items or {}
+    self.profile.Items[itemID] = info
+  end
 end
 
 function module:OnUpdate()
-  if self.needsUpdate then
+  if needsUpdate then
     self:Update()
+  elseif profileUpdate then
+    self:UpdateProfile()
   end
+
 end
 
 function block:OnEnter()
--- a/Modules/Currency.xml	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/Currency.xml	Tue Mar 28 07:02:26 2017 -0400
@@ -2,7 +2,7 @@
 ..\FrameXML\UI.xsd">
 
     <Script file="Currency.lua" />
-    <Frame virtual="true" name="VeneerCurrencyTemplate" parentArray="Blocks" mixin="VeneerWorldStateCurrencyBlockMixin" hidden="true">
+    <Frame virtual="true" name="VeneerCurrencyTemplate" parentArray="Blocks" mixin="VeneerCurrencyBlockMixin" hidden="true">
         <Scripts>
             <OnLoad method="OnLoad" />
             <OnEvent method="OnEvent" />
@@ -36,7 +36,7 @@
         </Layers>
     </Frame>
 
-    <Frame parent="VeneerWorldState" name="$parentZoneCurrency" parentArray="modules" mixin="VeneerWorldStateCurrencyMixin" hidden="true" inherits="VeneerMixinScripts, VeneerAnimations">
+    <Frame parent="UIParent" name="VeneerCurrency" parentArray="modules" mixin="VeneerCurrencyMixin" hidden="true" inherits="VeneerMixinScripts, VeneerAnimations">
         <Size x="240" y="24" />
         <Anchors>
             <Anchor point="TOP" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/FriendsFrame.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -0,0 +1,6 @@
+-- Veneer
+-- FriendsFrame.lua
+-- Created: 10/27/2016 8:50 PM
+-- %file-revision%
+--
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/FriendsFrame.xml	Tue Mar 28 07:02:26 2017 -0400
@@ -0,0 +1,9 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+..\FrameXML\UI.xsd">
+  <Script file="FriendsFrame.lua" />
+
+  <Frame name="VeneerFriendsFrameHandler" parent="UIParent" mixin="VeneerFriendsFrameMixin" inherits="VeneerHandlerTemplate">
+
+  </Frame>
+
+  </Ui>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/PaperDoll.xml	Tue Mar 28 07:02:26 2017 -0400
@@ -0,0 +1,54 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+..\FrameXML\UI.xsd">
+  <Script file="PaperDoll.lua" />
+  <Frame name="VeneerPaperDoll" mixin="VeneerPaperDollMixin" inherits="VeneerHandlerTemplate">
+    <Size x="570" y="155"/>
+    <Frames>
+      <GameTooltip inherits="GameTooltipTemplate" name="$parentTooltip" />
+    </Frames>
+  </Frame>
+
+  <Frame name="VeneerPaperDollSlotInfoTemplate" virtual="true" mixin="VeneerPaperDollSlotMixin">
+    <Layers>
+      <!--
+      <Layer level="BACKGROUND">
+        <Texture setAllPoints="true">
+          <Color a="0.5" r="1" g="0" b="0" />
+        </Texture>
+      </Layer>
+      -->
+      <Layer level="OVERLAY">
+        <FontString name="$parentNumeralLine" inherits="VeneerNumberFont" parentKey="ItemLevel" parentArray="StatsLeft" />
+
+      </Layer>
+    </Layers>
+    <Frames>
+      <Frame name="$parentSocketsLine" parentArray="StatsLeft" parentKey="Sockets">
+        <Size y="16" x="68" />
+        <Layers>
+          <!--
+          <Layer level="BACKGROUND">
+            <Texture setAllPoints="true">
+              <Color a="0.5" r="0" g="1" b="0" />
+            </Texture>
+          </Layer>
+          -->
+          <Layer level="OVERLAY">
+            <Texture name="$parentSocketIcon1" parentArray="SocketIcon" />
+            <Texture name="$parentSocketIcon2" parentArray="SocketIcon" />
+            <Texture  name="$parentSocketIcon3" parentArray="SocketIcon" />
+            <FontString name="$parentSocketLabel1" parentArray="SocketLabel" />
+            <FontString name="$parentSocketLabel2" parentArray="SocketLabel" />
+            <FontString name="$parentSocketLabel3" parentArray="SocketLabel" />
+          </Layer>
+        </Layers>
+      </Frame>
+    </Frames>
+    <Scripts>
+      <OnLoad method="OnLoad" />
+      <OnShow method="OnShow" />
+      <OnUpdate method="OnUpdate" />
+    </Scripts>
+  </Frame>
+
+</Ui>
\ No newline at end of file
--- a/Modules/WorldState.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/WorldState.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -5,7 +5,7 @@
 -- An extensible panel group for HUD values
 
 local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop
-local WorldStateBlockMixin = {}
+
 VeneerOrderHallMixin = {
   anchorPoint = 'TOP',
   anchorFrom = 'TOP',
@@ -15,138 +15,6 @@
   addonTrigger = 'Blizzard_OrderHallUI',
   addonFrame = 'OrderHallCommandBar',
 }
-
-VeneerWorldStateMixin = {
-  maxHeight = 0,
-  detectedFrames = {},
-  anchorPoint = 'TOP',
-  modules = {}
-}
-
-function VeneerWorldStateMixin:Reset()
-  for i, frame in ipairs(self.modules) do
-    if frame.Reset then
-      frame:Reset()
-    end
-  end
-  self:Update()
-end
-
-function VeneerWorldStateMixin:Setup()
-  --DEFAULT_CHAT_FRAME:AddMessage('Loaded')
-  print('|cFFFFFF00'..self:GetName()..'|r:Setup()')
-
-  for i, frame in ipairs(self.modules) do
-    print('--'.. frame:GetName()..' exists')
-    if frame.Setup then
-      print('--'.. frame:GetName()..':Setup()')
-      frame:Setup()
-    end
-
-
-    for k,v in pairs(WorldStateBlockMixin) do
-      if not frame[k] then
-        frame[k] = v
-        if k:match('^On') then
-          frame:SetScript(k, v)
-        end
-      end
-    end
-
-  end
-  self:UnregisterEvent('PLAYER_LOGIN')
-end
-
-function VeneerWorldStateMixin:SetOrderHallUIMods()
-  print('|cFFFF4400remove me', debugstack())
-end
-
-
-function VeneerWorldStateMixin:OnLoad ()
-  self.modules = {self:GetChildren()}
-  print('|cFFFFFF00'..self:GetName()..'|r!')
-  self:RegisterEvent('PLAYER_ENTERING_WORLD')
-  self:RegisterEvent('PLAYER_REGEN_ENABLED')
-  self:RegisterEvent('PLAYER_REGEN_DISABLED')
-  Veneer:AddHandler(self, self.anchorPoint, self.anchorPriority)
-  SLASH_VENEERWORLDSTATE1 = "/vws"
-  SLASH_VENEERWORLDSTATE2 = "/worldstate"
-  SlashCmdList.VENEERWORLDSTATE = function()
-    self:Reset()
-  end
-end
-
-function VeneerWorldStateMixin:OnEvent(event, arg)
-  print(event, arg)
-  if event == 'PLAYER_ENTERING_WORLD' then
-    self:Update()
-  elseif event == 'PLAYER_REGEN_ENABLED' then
-    self:Update(true)
-  elseif event == 'PLAYER_REGEN_DISABLED' then
-    self:Update(true)
-  end
-end
-
-function VeneerWorldStateMixin:Update(isBatchUpdate)
-  print('|cFFFFFF00All:Update()|r')
-  local canShow = false
-  for index, frame in ipairs(self.modules) do
-    if frame.Update then
-      print('  '..index..' |cFFFF00FFUpdate:|r '.. frame:GetName())
-      frame:Update(isBatchUpdate)
-      print('    ', frame:IsVisible(), frame:IsShown())
-      if frame:IsShown() then
-        canShow = true
-      end
-
-    end
-  end
-  self:SetShown(canShow)
-end
-
-function VeneerWorldStateMixin:OnShow()
-  print('OnShow()', debugstack())
-end
-
-function VeneerWorldStateMixin:Reanchor(isUpdate)
-  print('  |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks')
-  self.maxHeight = 0
-  local lastFrame
-  for i, frame in ipairs(self.modules) do
-    print('  '..frame:GetName()..':',frame:IsShown(), frame:GetHeight())
-    if frame:IsShown() then
-      if lastFrame then
-        frame:SetPoint('TOP', lastFrame, 'BOTTOM')
-      else
-        frame:SetPoint('TOP', self, 'TOP')
-      end
-
-      self.maxHeight = self.maxHeight + frame:GetHeight()
-      lastFrame = frame
-    end
-  end
-  if (self.maxHeight == 0) or InCombatLockdown() then
-    print ('  hiding; combat =', InCombatLockdown())
-    self:SetShown(false)
-  else
-    print ('  height update:', self.maxHeight)
-    self:SetHeight(self.maxHeight)
-    self:SetShown(true)
-  end
-
-  if not isUpdate then
-    Veneer:InternalReanchor(self, print)
-  end
-
-  WorldStateAlwaysUpFrame:ClearAllPoints()
-  WorldStateAlwaysUpFrame:SetPoint('TOP', self, 'BOTTOM', 0, 0)
-end
-
-
-
-function VeneerWorldStateMixin:OnMouseDown()
-end
-
 --- Order Hall mod
 local requiresUpdate
 local ocb
@@ -200,7 +68,7 @@
 end
 
 function VeneerOrderHallMixin:OnLoad()
-  Veneer:AddHandler(self, 'TOP', 1)
+  Veneer:AddHandler(self)
   self:EnableMouse(false)
 end
 
@@ -248,47 +116,4 @@
 
 
 
-do
-  function WorldStateBlockMixin:ShowPanel()
-    print('|cFF0088FF'..self:GetName()..':ShowPanel()')
-    self:SetShown(true)
-    self:SetAlpha(1)
-    VeneerWorldState:Show()
-  end
-  function WorldStateBlockMixin:HidePanel()
-    print('|cFF0088FF'..self:GetName()..':HidePanel()')
-    self:SetShown(false)
-    VeneerWorldState:Reanchor()
-  end
 
-  function WorldStateBlockMixin:OnSizeChanged ()
-    local h = self:GetHeight()
-    if h > VeneerWorldState.maxHeight then
-      VeneerWorldState.maxHeight = h
-      VeneerWorldState:SetHeight(h)
-      print('updating max height:', h)
-    elseif h < VeneerWorldState.maxHeight then
-      VeneerWorldState:Reanchor()
-    end
-  end
-  function WorldStateBlockMixin:OnHide ()
-    print('|cFF0088FF'..self:GetName()..':OnHide()')
-    VeneerWorldState:Reanchor()
-  end
-  function WorldStateBlockMixin:OnShow ()
-    self.timeLived = 0
-    print('|cFF0088FF'..self:GetName()..':OnShow()')
-    VeneerWorldState:Reanchor()
-  end
-  function WorldStateBlockMixin:Setup()
-    print('|cFF0088FF'..self:GetName()..':Setup()|r -- nop')
-    self:Update()
-  end
-  function WorldStateBlockMixin:Reset()
-    print('|cFF0088FF'..self:GetName()..':Reset()')
-    self.keepOpen = true
-    self:Setup()
-  end
-end
-
-
--- a/Modules/WorldState.xml	Mon Mar 27 00:39:29 2017 -0400
+++ b/Modules/WorldState.xml	Tue Mar 28 07:02:26 2017 -0400
@@ -3,14 +3,6 @@
 
   <Script file="WorldState.lua" />
 
-  <Frame name="VeneerWorldState" mixin="VeneerWorldStateMixin" parent="UIParent" inherits="VeneerMixinScripts">
-    <Size x="600" y="24" />
-    <Anchors>
-      <Anchor point="TOP" />
-    </Anchors>
-    <Frames>
-    </Frames>
-  </Frame>
   <Frame name="VeneerOrderHallHandler" hidden="true" parent="UIParent" mixin="VeneerOrderHallMixin" inherits="VeneerMixinScripts" />
 
 </Ui>
\ No newline at end of file
--- a/Templates.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Templates.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -5,7 +5,7 @@
 --
 -- Mover Widget base
 local ADDON, Veneer = ...
-local print = DEVIAN_WORKSPACE and function(...) _G.print('VnTemplate', ...) end or nop
+local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop
 local PlaySoundKitID = DEVIAN_WORKSPACE and PlaySoundKitID or nop
 local ipairs, pairs = ipairs, pairs
 local pack, unpack = pack, unpack
@@ -30,6 +30,7 @@
   for i, region in ipairs(handler.ConfigLayers) do
     region:SetShown(Veneer.ConfigMode)
   end
+
 end
 
 function ConfigLayer:OnUpdate()
@@ -71,6 +72,7 @@
 
 -- Replace if module needs to do more than reconcile SavedVariables pointers
 function Handler:Setup()
+  print(self:GetName(), '|cFF00FF88Setup()')
   local configName = self:GetName():gsub('^Veneer', '')
   VeneerData[configName] = VeneerData[configName] or self.defaultSettings or {}
 
@@ -80,6 +82,14 @@
       VeneerData[configName][k] = v
     end
   end
+
+  if self.EventList then
+    for _, event in ipairs(self.EventList) do
+      print(self:GetName(), event, 'registered')
+      self:RegisterEvent(event)
+    end
+  end
+
   local guid = UnitGUID('player')
   self.data = VeneerData[configName]
   self.data[guid] = self.data[guid] or {}
--- a/Veneer.lua	Mon Mar 27 00:39:29 2017 -0400
+++ b/Veneer.lua	Tue Mar 28 07:02:26 2017 -0400
@@ -24,6 +24,7 @@
   Veneer:UpdateConfigLayers()
 end
 
+Veneer.modules = {}
 Veneer.Frames = {}
 Veneer.ConfigLayers = {}
 Veneer.FrameClusters = {
@@ -94,6 +95,8 @@
   print('|cFFFFFF00Veneer!|r')
   self:RegisterEvent('ADDON_LOADED')
   self:RegisterEvent('PLAYER_LOGIN')
+  self:RegisterEvent('PLAYER_REGEN_ENABLED')
+  self:RegisterEvent('PLAYER_REGEN_DISABLED')
 
   self.DEVIAN_PNAME = 'Veneer'
   self:RegisterForDrag('LeftButton')
@@ -133,6 +136,19 @@
         end
       end
     end
+  elseif event == 'PLAYER_REGEN_ENABLED' then
+    for _, module in pairs(self.modules) do
+      if module:IsShown() and module.hideCombat then
+        module:Hide()
+      end
+    end
+
+  elseif event == 'PLAYER_REGEN_DISABLED' then
+    for _, module in pairs(self.modules) do
+      if module:IsShown() and module.hideCombat then
+        module:Show()
+      end
+    end
   end
 end
 
@@ -211,83 +227,55 @@
 end
 
 -- args: frame object, list of anchor groups, true for forced top, number for priority layer
+local mixins = {}
 function Veneer:AddHandler(handler, ...)
-  print('|cFFFFFF00*** Adding handler:', handler.moduleName or handler:GetName())
+  print('|cFFFFFF00'..handler:GetName()..':|r', handler.moduleName, ...)
 
-
+  wipe(mixins)
   for k,v in pairs(VeneerHandlerMixin) do
     if not handler[k] then
-      print(' * from mixin:', k)
+      tinsert(mixins, k)
       handler[k] = v
     end
   end
+  if #mixins >= 1 then
+    print('* Mixins:|cFF00FF88', table.concat(mixins, ', '))
+  end
+
+  self.modules[handler] = handler
 
   if not handler.anchorFrame then
 
-    local primaryAnchor
+    local primaryAnchor = handler.anchorPoint or 'CENTER'
+    local clusterPriority = handler.anchorPriority
+    self.FrameClusters[primaryAnchor] = self.FrameClusters[primaryAnchor] or {}
+    local clusterTable = self.FrameClusters[primaryAnchor]
     local clusterIndex
-    local clusterPriority = handler.anchorPriority
-    local clusterDepth = 0
-
-    local clusterTable = self.FrameClusters
-    for i = 1, select('#', ...) do
-      local arg = select(i, ...)
-      local argType = type(arg)
-      if argType == 'string' then
-
-        if not primaryAnchor then
-          primaryAnchor = arg
-        end
-        clusterDepth = clusterDepth + 1
-        clusterTable[arg] = clusterTable[arg] or {}
-        clusterTable = clusterTable[arg]
-        print('clusterGroup =', clusterDepth ..'.'.. arg)
-      elseif argType == 'boolean' then
-        if arg == true then
-          print('anchorFirst =', arg)
-          clusterPriority = nil
-        end
-      elseif argType == 'number' then
-        if arg ~= clusterPriority then
-          print('anchorPriority =', arg)
-          clusterPriority = arg
-        end
-
-      end
-    end
 
     if clusterPriority then
       for i = 1, #clusterTable do
-        clusterIndex = i
+
         if clusterTable[i].anchorPriority and (clusterTable[i].anchorPriority > clusterPriority) then
+          clusterIndex = i
           print('|cFF00BB00insert position:', clusterPriority, clusterIndex)
           break
         else
-          print('passing lower priority frame:', clusterTable[i]:GetName())
+          print('pass', clusterTable[i])
+          clusterIndex = i+1
         end
       end
     else
       print('|cFF00BB00inserting at front')
-      clusterIndex = 1
+      clusterIndex = #clusterTable + 1
     end
 
-
-    if not primaryAnchor then
-      primaryAnchor = 'CENTER'
-      clusterTable[primaryAnchor] = clusterTable[primaryAnchor] or {}
-      clusterTable = clusterTable[primaryAnchor]
-    end
-
-    if not clusterPriority then
-      clusterIndex = #clusterTable + 1
-    end
     if not clusterIndex then
       clusterIndex = #clusterTable + 1
     end
 
 
     tinsert(clusterTable, clusterIndex, handler)
-    print(' cluster', primaryAnchor, 'table', clusterTable, 'priority', clusterPriority, 'position', clusterIndex)
+    print(' cluster', (clusterDepth or 1) .. '.' .. primaryAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex)
 
     handler.anchorCluster = clusterTable
     handler.anchorIndex = clusterIndex
@@ -305,6 +293,7 @@
     tinsert(self.AddOnCheck[handler.addonTrigger], handler)
   end
 
+
   if self.initialized then
     print('  -- initialization check')
     if handler.Setup then
@@ -450,7 +439,7 @@
 
 end
 
-
+-- execute a function on all clusters in display order
 function Veneer:ExecuteOnClusters(layer, method)
   local print = eprint
   self.parserDepth = self.parserDepth + 1