changeset 59:07ef62fe201f

Re-write of BuffFrame module: - uses secure hooks on blizzard BuffFrame.lua functions to determine needed action - make use of built-in table behavior to reduce unnecessary frame updates
author Nenue
date Thu, 28 Jul 2016 18:27:56 -0400
parents f253baf6022d
children 2a636b00c31e
files BuffFrame/BuffButton.lua BuffFrame/BuffFrame.lua BuffFrame/Constants.lua BuffFrame/RaidBuffTray.lua Config/Config.lua Modules/BuffFrame.lua ObjectiveTracker/ExperienceBar.lua ObjectiveTracker/Layout.lua ObjectiveTracker/ObjectiveStyle.lua ObjectiveTracker/ObjectiveTracker.xml TimeManager/TimeManager.lua TimeManager/TimeManager.xml Veneer.lua Veneer.toc Veneer.xml
diffstat 15 files changed, 364 insertions(+), 575 deletions(-) [+]
line wrap: on
line diff
--- a/BuffFrame/BuffButton.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/BuffFrame/BuffButton.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -131,9 +131,9 @@
     guide.info = {} -- UnitAura cache
 
     if i == consolidatedPosition then
-      guide.legend:SetTexture(1,1,0,0.5)
+      guide.legend:SetColorTexture(1,1,0,0.5)
     else
-      guide.legend:SetTexture(legend.r, legend.g, legend.b, legend.a)
+      guide.legend:SetColorTexture(legend.r, legend.g, legend.b, legend.a)
     end
 
     guide.idText:SetText(i) -- needs to reflect the current position
@@ -274,18 +274,18 @@
           end
 
           if debuffBorder then
-            deco.background:SetTexture(debuffBorder:GetVertexColor())
+            deco.background:SetColorTexture(debuffBorder:GetVertexColor())
             debuffBorder:Hide()
           else
             if guide.info.caster == 'player' then
               print(guide.info.caster)
-              deco.background:SetTexture(unpack(c.PlayerColor))
+              deco.background:SetColorTexture(unpack(c.PlayerColor))
             elseif buffData.isBossDebuff then
               print(guide.info.isBossDebuff)
-              deco.background:SetTexture(unpack(c.BossColor))
+              deco.background:SetColorTexture(unpack(c.BossColor))
             else
               print(guide.info.caster)
-              deco.background:SetTexture(unpack(c.Color))
+              deco.background:SetColorTexture(unpack(c.Color))
             end
           end
 
--- a/BuffFrame/BuffFrame.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/BuffFrame/BuffFrame.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -43,7 +43,7 @@
   Aura:RegisterEvent("GROUP_ROSTER_UPDATE")
   Aura:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
   hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", Aura.PostBuffAnchors)
-  hooksecurefunc("RaidBuffTray_Update", Aura.UpdateRaidBuffs)
+  --hooksecurefunc("RaidBuffTray_Update", Aura.UpdateRaidBuffs)
 end
 
 function Aura:OnUpdate ()
--- a/BuffFrame/Constants.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/BuffFrame/Constants.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -43,16 +43,6 @@
   drawCount = {},
   anchorTemplate = 'VeneerAnchorTemplate',
 }
-Aura.displays.ConsolidatedBuff = {
-  legendColor = {0.5, 0.5, 0.5, legendAlpha},
-  maxIcons = 9,
-  actualIcons = function() return select(2, GetRaidBuffInfo()) end,
-  buffName = 'ConsolidatedBuff',
-  anchorTemplate = 'VeneerConsolidatedBuffsAnchor',
-  buffTemplate = 'VeneerRaidBuffTemplate',
-  drawCount = {},
-  filters = 'HELPFUL',
-}
 
 -----------------------
 -- RaidBuff visual args
--- a/BuffFrame/RaidBuffTray.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/BuffFrame/RaidBuffTray.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -41,7 +41,7 @@
   local styleset = Aura.BuffStyles[style]
   if not path or path == '' then
     print('path is nil/empty')
-    icon:SetTexture(1, 1, 1, 1)
+    icon:SetColorTexture(1, 1, 1, 1)
     icon:SetVertexColor(unpack(styleset.Color))
   else
     icon:SetTexture(path or icon:GetTexture())
@@ -203,6 +203,8 @@
 local missingTypes = {}
 local raidBuffsInitialized
 Aura.UpdateRaidBuffs = function()
+  --[[
+
 
   local c = Aura.displays.ConsolidatedBuff.conf
   local anchor = _G[c.Parent..'Anchor']
@@ -327,6 +329,8 @@
       missingBuffs[i]:Hide()
     end
   end
+
+  ]]
 end
 
 vn.UpdateMissingBuffs = function()
--- a/Config/Config.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/Config/Config.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -397,9 +397,9 @@
 vn.ToggleGuides = function(_, self)
   vn.Conf.GuidesMode = (not vn.Conf.GuidesMode)
   if vn.Conf.GuidesMode then
-    self:GetNormalTexture():SetTexture(0.94, 0.21, 0.21, 1)
+    self:GetNormalTexture():SetColorTexture(0.94, 0.21, 0.21, 1)
   else
-    self:GetNormalTexture():SetTexture(0, 0, 0, 1)
+    self:GetNormalTexture():SetColorTexture(0, 0, 0, 1)
   end
 
   vn.UpdateConfigLayers()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/BuffFrame.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -0,0 +1,315 @@
+-- Veneer
+-- BuffFrame.lua
+-- Created: 7/27/2016 8:08 PM
+-- %file-revision%
+--
+local PLUGIN_NAME = 'BuffFrame'
+local plugin = {}
+local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
+
+
+
+local buttons = {}
+local buffTypes = {
+  {
+    name = 'buff',
+    pattern = 'BuffButton(%d)',
+    filters = 'HELPFUL',
+  },
+  {
+    name = 'debuff',
+    pattern = 'DebuffButton(%d)',
+    filters = 'HARMFUL',
+  },
+  {
+    name = 'tempenchant',
+    pattern = 'TempEnchant(%d)',
+    filters = 'TEMPENCHANT'
+  }
+}
+
+local textureMapping = {
+  [1] = 16,	--Main hand
+  [2] = 17,	--Off-hand
+  [3] = 18,	--Ranged
+}
+
+local tickCounter = {}
+local aurasCache = {}
+local skinnedFrames = {}
+local pendingFrames = {}
+local anchors = {}
+local expirationCache = {}
+
+local VeneerButton_OnHide = function(self)
+  self:SetScript('OnDragStart', self.StartMoving)
+  self:SetScript('OnDragStop', self.StopMovingOrSizing)
+  self:SetMovable(true)
+  self:EnableMouse(true)
+  self:RegisterForDrag('LeftButton')
+end
+local VeneerButton_OnShow = function(self)
+  self:SetScript('OnDragStart', self.StartMoving)
+  self:SetScript('OnDragStop', self.StopMovingOrSizing)
+  self:SetMovable(true)
+  self:EnableMouse(true)
+  self:RegisterForDrag('LeftButton')
+end
+
+
+local GetVeneer = function(frame)
+  local name = frame:GetName()
+  if not _G[name..'Veneer'] then
+
+    local veneer = CreateFrame('Frame', name..'Veneer', UIParent)
+    veneer:SetAllPoints(frame)
+    veneer.bg = veneer:CreateTexture()
+    veneer.bg:SetColorTexture(0,1,0,0.5)
+    veneer.bg:SetAllPoints(veneer)
+    veneer.bg:Hide()
+    veneer:Hide()
+
+    veneer:SetScript('OnShow', VeneerButton_OnShow)
+    veneer:SetScript('OnHide', VeneerButton_OnHide)
+
+    local position = tonumber(name:match("%d"))
+    if position == 1 then
+      veneer:Show()
+    end
+
+    veneer.progress = CreateFrame('Frame', name .. 'VeneerProgress', veneer)
+    veneer.progress:Hide()
+    veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 3, -6)
+    veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', -3, -1)
+
+    veneer.progress.bg = veneer.progress:CreateTexture(nil, 'BACKGROUND')
+    veneer.progress.bg:SetColorTexture(0,0,0,0.5)
+    veneer.progress.bg:SetAllPoints(veneer.progress)
+
+    veneer.progress.fg = veneer.progress:CreateTexture(nil, 'ARTWORK')
+    veneer.progress.fg:SetColorTexture(0,1,0,1)
+    veneer.progress.fg:SetPoint('BOTTOMLEFT', 1,1)
+    veneer.progress.fg:SetPoint('TOP', 0, -1)
+
+    veneer.progress.status = veneer.progress:CreateFontString()
+    veneer.progress.status:SetFontObject(VeneerNumberFont)
+    veneer.progress.status:SetPoint('TOP')
+
+  end
+
+
+  return _G[name..'Veneer']
+end
+
+local UpdateVeneer = function (frame, duration, expires)
+  local veneer = GetVeneer(frame)
+
+  if expires and duration then
+    veneer.progress:Show()
+
+    local startTime = (expires - duration)
+    local endTime = expires or 0
+    print('|cFF0088FF'..frame:GetName()..'|r', 'has expiration', startTime, 'to', endTime, 'over', duration, 'frame', veneer.progress:GetWidth())
+    veneer.progress:SetScript('OnUpdate', function(self)
+      local w = floor(veneer.progress:GetWidth()+.5)
+      local t = GetTime()
+      local progress = (t - startTime) / duration
+      if t >= endTime or not frame:IsVisible() then
+        veneer.startTime = nil
+        self:SetScript('OnUpdate', nil)
+        self:Hide()
+      else
+        self.fg:SetWidth(w - ceil(w * progress) - 2)
+      end
+    end)
+  end
+
+
+
+  veneer:Show()
+end
+
+
+-- Associates skinning elements with said button
+local SkinFrame = function(name)
+  local frame = _G[name ]
+  if skinnedFrames[frame] then
+    print('|cFFFF4400Attempting to skin a frame that already went through.|r')
+    return
+  end
+
+  local icon = _G[name .. 'Icon']
+  local border = _G[name .. 'Border']
+  local duration = _G[name .. 'Duration']
+  local slot = frame:GetID() or 0
+
+  tickCounter[frame] = (tickCounter[frame] or 0) + 1
+
+
+  print(tickCounter[frame], frame:GetName(), '|cFFFFFF00'..slot..'|r')
+  skinnedFrames[frame] = frame
+  frame:SetSize(48,48)
+  icon:SetTexCoord(0,1,0,1)
+  if border then
+    border:SetSize(50,50)
+  end
+  if duration then
+    duration:ClearAllPoints()
+    duration:SetPoint('BOTTOM')
+    duration:SetFontObject(VeneerNumberFont)
+    duration:SetDrawLayer('OVERLAY')
+
+  end
+
+  GetVeneer(frame)
+
+  anchors[frame] = veneer
+  print('Initializing', name)
+end
+
+
+--- Provides the number of changed indices for use in deciding between partial and full veneer updates
+local CacheCheck = function(frame, ...)
+  aurasCache[frame] = aurasCache[frame] or {}
+  local hasChange = 0
+  local numVals = select('#',...)
+  for i = 1,   numVals do
+    local arg = select(i, ...)
+    if aurasCache[frame][i] ~= arg then
+      hasChange = hasChange + 1
+    end
+    aurasCache[frame][i] = arg
+  end
+  return hasChange
+end
+
+local AuraButton_Update = function(name, index, filter)
+  local bName = name..index
+  local frame = _G[bName]
+  if frame and frame:IsVisible() then
+    tickCounter[frame] = (tickCounter[frame] or 0) + 1
+    local cacheDiff = CacheCheck(frame, UnitAura(frame.unit, frame:GetID(), frame.filter))
+    -- did something change?
+    if (cacheDiff >= 1) or not skinnedFrames[frame] then
+      print(frame:GetName(), 'diff:', cacheDiff)
+      tinsert(pendingFrames, frame)
+    end
+
+
+    if frame.expirationTime ~= expirationCache[name] then
+      print('|cFFBBFF00expirationTime|r', name, frame.expirationTime)
+      expirationCache[name] = frame.expirationTime
+      print(unpack(aurasCache[frame]))
+      UpdateVeneer(frame, aurasCache[frame][6], aurasCache[frame][7])
+    end
+
+    -- is it a new button?
+    if not skinnedFrames[frame] then
+      SkinFrame(bName)
+    end
+  end
+end
+
+local BuffFrame_UpdateAllBuffAnchors = function()
+  local todo = {}
+  if #pendingFrames >= 1 then
+
+    print('|cFFBBFF00AllBuffAnchors|r', #pendingFrames)
+    while pendingFrames[1] do
+      local frame = tremove(pendingFrames)
+      tinsert(todo, frame:GetName())
+
+      UpdateVeneer(frame)
+
+
+    end
+    print(table.concat(todo, ', '))
+  end
+  --BuffButton1
+  --DebuffButton1
+  TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0)
+end
+
+local AuraButton_UpdateDuration = function(frame, timeLeft)
+  local ts = ''
+  if timeLeft > 3600 then
+    ts = ts .. floor(timeLeft/3600) .. ':'
+    timeLeft = mod(timeLeft, 3600)
+  end
+  if timeLeft > 60 then
+    ts = ts .. floor(timeLeft/60) .. '\''
+    timeLeft = mod(timeLeft, 60)
+  end
+  ts = ts .. floor(timeLeft)..'"'
+
+  frame.duration:SetText(ts)
+  frame.duration:SetVertexColor(1,1,1)
+
+end
+
+local visibility = {}
+local TempEnchantButton_OnHide = function(self)
+  local isVisible = self:IsVisible()
+  if isVisible ~= visibility[self] then
+    print('|cFFFFFF00HIDE|r', self:GetName())
+    visibility[self] = isVisible
+  end
+end
+
+-- Obtains the first instance of Tenchant use
+
+local TemporaryEnchantFrame_Update = function(...)
+  local numVals = select('#', ...)
+  local numItems = numVals / 4
+  if numItems >= 1 then
+    for itemIndex = numItems, 1, -1 do
+      local frame = _G['TempEnchant'..itemIndex]
+      local hasEnchant, timeRemaining, enchantCharges = select((4 * (itemIndex -1)) + 1, ...)
+
+
+      if hasEnchant then
+        local endTime = floor(GetTime()*1000) + timeRemaining
+
+
+        --print(endTime)
+        if endTime ~= expirationCache[frame] then
+          if expirationCache[frame] then
+            print(endTime, expirationCache[frame], endTime - expirationCache[frame])
+          end
+          expirationCache[frame] = endTime
+          print('push tempenchant timer update', timeRemaining / 1000, GetTime()+(timeRemaining/1000))
+          UpdateVeneer(frame, timeRemaining/1000, GetTime()+(timeRemaining/1000))
+        end
+      else
+        GetVeneer(frame):Hide()
+      end
+
+    end
+
+  end
+
+end
+
+local BuffFrame_Update = function(...)
+  --print('Time for udpate!', ...)
+end
+
+
+hooksecurefunc("BuffFrame_Update", BuffFrame_Update)
+hooksecurefunc("AuraButton_UpdateDuration", AuraButton_UpdateDuration)
+hooksecurefunc("AuraButton_Update", AuraButton_Update)
+hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", BuffFrame_UpdateAllBuffAnchors)
+hooksecurefunc("TemporaryEnchantFrame_Update", TemporaryEnchantFrame_Update)
+
+-- The TempEnchant frames are hardcoded in the base FrameXML, so get them now
+for i = 1, 3 do
+
+  SkinFrame('TempEnchant'..i)
+  hooksecurefunc(_G['TempEnchant'..i], "Hide", TempEnchantButton_OnHide)
+
+
+end
+
+plugin.init = function ()
+  plugin.db = vn.db[PLUGIN_NAME]
+end
\ No newline at end of file
--- a/ObjectiveTracker/ExperienceBar.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/ObjectiveTracker/ExperienceBar.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -38,7 +38,7 @@
   self:RegisterEvent('PLAYER_XP_UPDATE')
   self:RegisterEvent('PLAYER_LEVEL_UP')
   self:RegisterEvent('PLAYER_UPDATE_RESTING')
-  self.statusbg:SetTexture(0,0,0,.25)
+  self.statusbg::SetColorTexture(0,0,0,.25)
   self:Show()
 end
 
@@ -46,7 +46,7 @@
   self:UnregisterEvent('PLAYER_XP_UPDATE')
   self:UnregisterEvent('PLAYER_LEVEL_UP')
   self:UnregisterEvent('PLAYER_UPDATE_RESTING')
-  self.statusbg:SetTexture(0.5,0.5,0.5,0.5)
+  self.statusbg::SetColorTexture(0.5,0.5,0.5,0.5)
   self:Hide()
 end
 
@@ -83,9 +83,9 @@
     end
 
     if IsResting() then
-      self.statusbg:SetTexture(.2,.8,.2,.5)
+      self.statusbg::SetColorTexture(.2,.8,.2,.5)
     else
-      self.statusbg:SetTexture(0,0,0,.25)
+      self.statusbg::SetColorTexture(0,0,0,.25)
     end
     self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or ''))
   end
--- a/ObjectiveTracker/Layout.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/ObjectiveTracker/Layout.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -255,7 +255,7 @@
   block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
   block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0)
   block.title:SetTextColor(unpack(titleColor))
-  block.titlebg:SetTexture(1,1,1,1)
+  block.titlebg:SetColorTexture(1,1,1,1)
   block.titlebg:SetGradientAlpha(unpack(titlebg))
   block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
   block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
@@ -265,7 +265,7 @@
   block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
   block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
   block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
-  block.statusbg:SetTexture(1,1,1,1)
+  block.statusbg:SetColorTexture(1,1,1,1)
   block.statusbg:SetGradientAlpha(unpack(textbg))
   block.statusbg:SetBlendMode(textBlend)
   block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg))
--- a/ObjectiveTracker/ObjectiveStyle.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/ObjectiveTracker/ObjectiveStyle.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -451,14 +451,14 @@
   a1, a2, a3, a4 = unpack(value.MinColor)
   b1, b2, b3, b4 = unpack(value.MaxColor)
   region:SetVertexColor(1,1,1)
-  region:SetTexture(1,1,1,1)
+  region::SetColorTexture(1,1,1,1)
   region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)
 end
 
 sb.Background = function(region, value)
   print('|cFF0088FFBackground|r', unpack(value))
   region:SetVertexColor(1,1,1) -- reset
-  region:SetTexture(unpack(value))
+  region::SetColorTexture(unpack(value))
 end
 sb.BackgroundComplex = function (region, value)
   local left, tile, right = value.Left, value.Tile, value.Right
--- a/ObjectiveTracker/ObjectiveTracker.xml	Fri Jul 08 18:01:49 2016 -0400
+++ b/ObjectiveTracker/ObjectiveTracker.xml	Thu Jul 28 18:27:56 2016 -0400
@@ -324,21 +324,6 @@
         </FontString>
       </Layer>
     </Layers>
-    <Frames>
-      <Button name="$parentRefreshBtn" parentArray="debug" parentKey="refresh">
-        <Anchors>
-          <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" x="0" y="-20" />
-        </Anchors>
-        <Size x="30" y="20" />
-        <ButtonText inherits="GameFontNormal" text="GetNumWatched" />
-        <NormalTexture setAllPoints="true">
-          <Color a="1" r="0" g="0" b="0" />
-        </NormalTexture>
-        <PushedTexture setAllPoints="true">
-          <Color r="1" g="1" b="1" a="1" />
-        </PushedTexture>
-      </Button>
-    </Frames>
   </Frame>
 
 
--- a/TimeManager/TimeManager.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/TimeManager/TimeManager.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -56,7 +56,6 @@
 -- runs once per ui load
 clock.OnEnable = function(self)
   self:SetParent(_G.UIParent)
-  self:SetPoint('TOPRIGHT', _G.UIParent, 'TOPRIGHT', -100, -2)
   self:SetScript('OnUpdate', clock.OnUpdate)
   self:Show()
   self.time:SetText('Clock stuff')
--- a/TimeManager/TimeManager.xml	Fri Jul 08 18:01:49 2016 -0400
+++ b/TimeManager/TimeManager.xml	Thu Jul 28 18:27:56 2016 -0400
@@ -2,9 +2,10 @@
 ..\FrameXML\UI.xsd">
 
 
-  <Frame name="VeneerClock" parent="UIParent" hidden="false">
+  <Frame name="VeneerClock" parent="UIParent" hidden="false" clampedToScreen="true">
     <Scripts>
       <OnLoad>
+        self.drag = true
         self.toggle = true
         Veneer.RegisterModuleFrame(self, 'Clock')
       </OnLoad>
@@ -34,10 +35,6 @@
         </FontString>
       </Layer>
     </Layers>
-    <Scripts>
-      <OnUpdate>
-      </OnUpdate>
-    </Scripts>
   </Frame>
 
   <Script file="TimeManager.lua" />
--- a/Veneer.lua	Fri Jul 08 18:01:49 2016 -0400
+++ b/Veneer.lua	Thu Jul 28 18:27:56 2016 -0400
@@ -1,546 +1,32 @@
---------------------------------------------
 -- Veneer
--- Core
--- author: Krakyn
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 4/27/2016 1:02 AM
---------------------------------------------
---- Implemented methods
--- OnInitialize
--- OnUpdate
--- OnEnable     -- runs as soon as GetSpecialization() returns valid data
+-- Customization tool for the small bits and pieces
 
-local ADDON, A = ...
-local wipe, min, max, random, tinsert, tremove = table.wipe, math.min, math.max, math.random, table.insert, table.remove
-local pairs, ipairs, select, unpack, _G = pairs, ipairs, select, unpack, _G
-local type, tostring, format = type, tostring, string.format
+-- BuffFrame
+-- Provides mechanisms for positioning and alter buff button parameters.
+-- Mostly re-configures the blizzard UI frames due to limitations of SecureTemplate.
 
---- Establish presence
-Veneer = Veneer or CreateFrame('Frame', 'Veneer', UIParent)
-local V = Veneer
-A.frame = V
+local vn, print = LibStub("LibKraken").register(VeneerController)
 
---- Work variables
-local modules = {}        -- module collector
-local queuedModules = {}  -- indicates modules that were encountered out of dependency order
-local checkForConfig = {} -- indicates frames created from XML that use their own namespace for position control
-local moduleStack = {}    -- dictates the order in which module methods are fired
-local initOnced           -- internal check for doing bottom-up SV retrieval
 
---- Utilities
-V.wipeall = function (...)
-  for i = 1, select('#', ...) do
-    wipe(select(i, ...))
-  end
-end
+local defaults = {
+  enableAll = true,
+  enableModule = {
+    BuffFrame = true,
+  },
+  BuffFrame = {
+    width = 48,
+    height = 48,
 
---- Various region categories
-V.displays = {}
-V.configLayers = {}
-V.configLayersRef = {}
+  }
+}
 
-
---- Returns a debug hook for adding generic module information to each message
--- @usage func = V.print(sig)
--- @param sig channel name or number
-local debugstack = _G.debugstack
-local Devian = _G.Devian
-local printfuncs = {}
-V.print = function(pref, ...)
-  if Devian and Devian.InWorkspace() then
-      printfuncs[pref] = printfuncs[pref] or function(...) print(pref,  ...) end
-
-    return printfuncs[pref]
-  else
-   return function () end
-  end
-end
-
---@debug@
-local rgb = {}
-local getcolor = function()
-  local n, p = 0, 4
-  for i = 1, 3 do
-    rgb[i] = min(random(n,p) * 64, 255)
-    if rgb[i] == 255 then
-      p = 4
-    elseif rgb[i] > 0 then
-      n = 2
-    end
-  end
-  return unpack(rgb)
-end
-
-local color = {}
-local fprints = {}
---- Attempts to generate a debug printer based on the local scope. Results vary by where the originator was invoked.
-V.fprint = function()
-  if not (Devian and Devian.InWorkspace()) then
-    return function() end
+vn.init = function()
+  if (not VeneerData) or (not VeneerData.version) then
+    VeneerData = defaults
   end
 
-  local sig = debugstack(2,1)
-  if fprints[sig] then
-    return fprints[sig]
-  end
 
-  local func = sig:match("%`(%a+)%'")
-  if not func then
-    func = sig:match("<(.-)>")
-  end
-  func = func:gsub('(%l+)(%u)', function(a, b) return a:sub(0,2) .. b  end, 1)
-  func = func:gsub('^.+%\\', '')
-  if not func then
-    func = 'noname'
-  end
 
-  local r, g, b = getcolor()
-  color[sig] = color[sig] or format('|cFF%02X%02X%02X%s|r', r, g, b, func)
 
-  --print(color[func] .. ' ( ' .. table.concat(args, ', ')..' )' )
-  func = V.print(func)
-  fprints[sig] = func
-  return func
-end
-
---@end-debug@
---[=[@non-debug@
-V.print = function() end
---@end-non-debug@]=]
-
--- for the Mikk script
--- GLOBALS: NUM_LE_RAID_BUFF_TYPES
--- GLOBALS: BUFF_FLASH_TIME_ON, BUFF_FLASH_TIME_OFF, BUFF_MIN_ALPHA, BUFF_WARNING_TIME, BUFF_DURATION_WARNING_TIME
--- GLOBALS: BUFFS_PER_ROW, BUFF_MAX_DISPLAY, BUFF_ACTUAL_DISPLAY, DEBUFF_MAX_DISPLAY, DEBUFF_ACTUAL_DISPLAY, BUFF_ROW_SPACING
--- GLOBALS: CONSOLIDATED_BUFFS_PER_ROW, CONSOLIDATED_BUFF_ROW_HEIGHT, NUM_TEMP_ENCHANT_FRAMES
--- GLOBALS: BUFF_BUTTON_HEIGHT, BUFF_FRAME_BASE_EXTENT, BUFF_HORIZ_SPACING
-
-local print = V.print('Bfl')
-
---- Template for making perpendicular traversals of the displays structure; also makes sure the table is there
-local setmetatable = setmetatable
-V.Abstract = function(dest, key, table)
-  if table then
-    for _, v in pairs(dest) do
-      v[key] = {}
-    end
-  end
-  V[key] = setmetatable({}, {
-    __index = function(t, k)
-      return dest[k][key]
-    end,
-    __newindex = function(_, k, v)
-      print('abstract write ('..key..'):', k)
-      dest[k][key] = v
-    end,
-    __tostring = function() return 'Abstract:'..key..'' end
-  })
-
-
-  return V[key]
-end
-
-
---- internal
-local ModulesCall = function(func, flag)
-  local n = 0
-  for i = 1, #moduleStack do
-    print('calling level '..i)
-    local stackset = moduleStack[i]
-    for name, module in pairs(stackset) do
-      n = n + 1
-      if module[func] then
-        -- nil = pass
-        if not flag or (module.Conf and module.Conf[flag]) then
-          if (flag) then
-            print('  check', flag, '=', module.Conf[flag])
-          end
-
-          print(' ',n..'  '..name..'.'..func..'()')
-          module[func](module, module.Conf)
-        end
-      end
-    end
-  end
-end
-
-
-local Enable = function()
-end
-
---- The things that happen repeatedly
-local Init = function ()
-end
-
-
-local layers, refs, displays = V.configLayers, V.configLayersRef, V.displays
---- Things that happen immediately upon entering world
-local InitOnce = function()
-  print('entering world first time')
-  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
-  V.Conf = setmetatable(VeneerData, {__index = function(_, k) return defaults[k] 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.
-  local loaded = {}
-  local stackLevels = #moduleStack
-  local i = 1
-  moduleStack[1] = modules
-  repeat
-    print('setting init level '.. i)
-    local queue = moduleStack[i]
-    for name, module in pairs(queue) do
-
-      if queuedModules[name] and #queuedModules[name] > 0 then
-        local p = #queuedModules[name]
-        for j = 1, p do
-          local dep = queuedModules[name][j]
-
-          if loaded[dep] then
-            print( '    ' .. dep .. ' OK')
-            queuedModules[name][j] = nil
-            for k = j, p do
-              print('   shift ' .. (k+1)  .. ' ('..tostring(queuedModules[name][k+1])..') to ' .. k ..'')
-              queuedModules[name][k] = queuedModules[name][k+1]
-            end
-          end
-        end
-
-        if #queuedModules[name] == 0 then
-          queuedModules[name] = nil
-          print('  |cFF00FFFF'.. name ..'|r deps OK')
-          loaded[name] = true
-        else
-
-          print('  |cFFFF8800' .. name ..'|r pending')
-          local next = i+1
-          if not  moduleStack[next] then
-            moduleStack[next] = {}
-          end
-          stackLevels = next
-          moduleStack[next][name] = module
-          queue[name] = nil
-        end
-
-      else
-        print('  |cFF00FF00'.. name ..'|r no deps')
-        loaded[name] = true
-      end
-   end
-    i = i + 1
-  until i > stackLevels
-
-  for level, batch in ipairs(moduleStack) do
-    print('config level', level)
-    for name, module in pairs(batch) do
-      if not VeneerData[name] then
-        VeneerData[name] = {}
-      end
-
-      if module.defaults then
-        print('setting defaults for module', name)
-        --[===[@non-debug@
-        if not VeneerData[name] then
-        --@end-non-debug@]===]
-          VeneerData[name] = {}
-        --[===[@non-debug@
-        end
-        --@end-non-debug@]===]
-        for k,v in pairs(module.defaults) do
-          VeneerData[name][k] = v
-        end
-        module.Conf = VeneerData[name]
-      end
-
-      if VeneerData[name].enabled == nil then
-        VeneerData[name].enabled = true
-      end
-
-    end
-  end
-
-  --- Pull in any XML templates
-  if #checkForConfig >= 1 then
-    local queuedFrame = tremove(checkForConfig)
-    while queuedFrame do
-      V.SetConfigLayers(queuedFrame)
-      V.UpdateXMLFrame(queuedFrame)
-      queuedFrame = tremove(checkForConfig)
-    end
-  end
-end
-
---- Fires an update to all modules
-local lastUpdate
-function V.UpdateAll(...)
-  lastUpdate = GetTime()
-  ModulesCall('OnUpdate')
-end
-
-V:RegisterEvent('PLAYER_ENTERING_WORLD')
-V:SetScript('OnEvent', function(self, event)
-  if event == 'PLAYER_ENTERING_WORLD' then
-    if not initOnced then
-      InitOnce()
-      ModulesCall('OnInitialize')
-      initOnced = true
-      C_Timer.After(1, function()
-        if GetSpecialization() then
-          print(GetSpecialization(), 'enabling')
-
-          ModulesCall('OnEnable', 'enabled')
-          V:SetScript('OnUpdate', nil)
-        end
-      end)
-    end
-  end
-
-  V.UpdateAll()
-
-  if event == 'PLAYER_ENTERING_WORLD' then
-    V.UpdateConfigLayers()
-  end
-
-end)
-
---- Modulizer method
---
-function V:RegisterModule (name, module, ...)
-  if modules[name] then
-    print('pulling modules[|cFFFF8800'.. tostring(name) ..'|r]')
-    return modules[name]
-  end
-
-  print('new module |cFF00BBFF'.. tostring(name) ..'|r')
-  if module then
-    if modules[name] then
-      error("Module table for '"..tostring(name).."' already exists.")
-    end
-  else
-    module = CreateFrame('Frame', 'Veneer' .. tostring(name) .. 'Handler', V, 'VeneerHandlerTemplate')
-  end
-  modules[name] = module
-  V[name] = module
-  if select('#', ...) >= 1 then
-    local numDeps = select('#', ...)
-    print('  '..numDeps..' deps detected')
-    for i = 1, numDeps do
-      local dep = select(i, ...)
-        -- means that init/enable funcs are ordered to run after deps do their things
-      queuedModules[name] = queuedModules[name]  or {}
-      tinsert(queuedModules[name], dep)
-      print('  needs '..dep)
-    end
-  end
-  return module
-end
-
-
-V.SetConfigLayers =  function(frame)
-  local print = V.fprint()
-  if not frame.config then
-    --print(frame:GetName(), 'has no config layers')
-    return
-  end
-  --print('Registering config layers from', frame:GetName())
-
-  for i, subframe in ipairs(frame.config) do
-    -- make sure there are no duplicates
-    if not refs[subframe] then
-      local key = #layers+1
-      layers[key] = subframe
-      refs[subframe] = key
-    end
-    --print(' ', i, subframe:GetName())
-  end
-end
-
-V.RemoveConfigLayers = function(frame)
-
-  local print = V.fprint()
-  print('|cFFFF0000RemoveConfigLayers', frame:GetName())
-  for i, subframe in pairs(layers) do
-    if subframe:GetParent() == frame then
-      print('|cFFFF8800  ', subframe:GetParent():GetName(), '|cFFFFFF00', subframe:GetName())
-      layers[i]:Hide()
-      layers[i] = nil
-      refs[subframe] = nil
-    end
-  end
-end
-
-V.ToggleGuideLayers = function()
-  local print = V.fprint()
-  local func = V.Conf.GuidesMode and 'Show' or 'Hide'
-  local numAnchors = 0
-
-  for id, region in pairs(layers) do
-    --print(id, region:GetName(), func)
-    region[func](region)
-  end
-
-  --print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames')
-end
-V.UpdateConfigLayers = function()
-  print('|cFFFF0000', debugstack())
-  V.ToggleGuideLayers()
-end
-
-local XMLFrame_Enable = function(self, value)
-  local name = self:GetName()
-  local print = V.print('XML')
-
-  if not V.Conf[name] then
-    V.Conf[name] = {
-      enabled = true
-    }
-  end
-
-  print()
-  local enabled
-  if value == nil then
-    if V.Conf[name].enabled == nil then
-      print('toggle based on visibility')
-      enabled = (not self:IsVisible()) and true or false
-    else
-      print('toggle a config value =', V.Conf[name].enabled)
-      enabled = V.Conf[name].enabled
-    end
-
-    enabled = (enabled ~= true) and true or false
-  else
-      print('use argument value', value)
-      enabled = value
-  end
-
-  print('arg =', value, 'conf =', V.Conf[name].enabled, 'result=', enabled)
-
-  V.Conf[name].enabled = enabled
-
-  local stateFunc = enabled and 'Show' or 'Hide'
-  local eventFunc = enabled and 'OnToggle' or 'OnToggle'
-  --- taggled layers
-  if self.toggled then
-    for i, region in pairs(self.toggled) do
-      region[stateFunc](region)
-    end
-  end
-  --- toggle action
-  if self.OnToggle then
-    self:OnToggle(V.Conf[name].enabled)
-  end
-  --- do enable
-  if V.Conf[name].enabled then
-    if self.OnEnable then
-      self:OnEnable()
-    end
-  else
-    if self.OnDisable then
-      self:OnDisable()
-    end
-  end
-end
---- Generic handlers for keeping track of XML-defined frames
-local print = V.print('XML')
-local prototypes = {}
-prototypes.OnDragStart = function(self)
-  self.xA = self:GetLeft()
-  self.yA = self:GetBottom()
-  self.anchorTo, self.relativeTo, self.relativePoint, self.x, self.y = self:GetPoint(1)
-  print('acquire anchor', self:GetPoint(1))
-  print(self:GetName(), 'start moving ('..self.x..', '..self.y..')')
-  self:StartMoving()
-end
-
-prototypes.OnDragStop = function(self)
-  local name = self:GetName()
-  print(name, 'stop moving ('..self:GetLeft()..', '..self:GetBottom()..')')
-  local xB = self:GetLeft() - self.xA
-  local yB = self:GetBottom() - self.yA
-  print('storing anchor point', self.anchorTo, self.relativePoint, self.x + xB, self.y + yB)
-  self:StopMovingOrSizing()
-  V.Conf[name].position = {self.anchorTo, self.relativePoint, self.x + xB, self.y + yB}
-  V.UpdateXMLFrame(self)
-end
-
-
-V.RegisterModuleFrame = function(self, moduleName)
-  local name = self:GetName()
-  tinsert(checkForConfig, self)
-  self.Enable = XMLFrame_Enable
-  self.moduleName = moduleName
-  print('|cFF00FF00XML stuff related to '.. tostring(moduleName) .. ':', self:GetName())
-  ------------------------------------------------------------------------------------------
-  if not V[name] then
-    return
-  end
-
-  local scriptTypes = {'OnUpdate', 'OnEvent', 'OnDragStart', 'OnDragStop'}
-  for script in next(scriptTypes) do
-    if V[name][script] then
-      self:SetScript(script, V[name][script])
-    end
-  end
-
-end
-local XMLFrame_OnDragStart = function() end
-local XMLFrame_OnDragStop = function() end
-
-V.UpdateXMLFrame = function(self)
-  local print = V.print('XML')
-
-  local name = self:GetName()
-
-
-
-  if self.drag then
-    self:RegisterForDrag('LeftButton')
-    self:SetScript('OnDragStart', prototypes.OnDragStart)
-    if self.OnDragStop then
-      self:SetScript('OnDragStop', function(self, ...)
-        print('|cFFFF0088end of dragging').
-        self:OnDragStop(self, ...)
-        prototypes.OnDragStop(self, ...)
-      end)
-    else
-      self:SetScript('OnDragStop', prototypes.OnDragStop)
-    end
-  else
-    self:EnableMouse(false)
-  end
-
-  -- establish internal storage
-  if not V.Conf[name] then
-    V.Conf[name] = {
-      enabled = self.enabled,
-    }
-  end
-  local c = V.Conf[name]
-
-  -- establish position data; if undefined, round the API values
-  if not c.position then
-    local anchor, _, point, x, y = self:GetPoint(1)
-    x = floor(x+.5)
-    y = floor(y+.5)
-    print('obtained frame position', name, anchor, point, x, y)
-    c.position = {anchor, point, x, y}
-  else
-    print('restoring frame position', name, unpack(c.position))
-    self:ClearAllPoints()
-    local anchorTo, relativePoint, x, y = unpack(c.position)
-    self:SetPoint(anchorTo, UIParent, relativePoint, x, y)
-  end
-  self:Enable(c.enabled)
-
-
-end
+  vn.db = VeneerData
+end
\ No newline at end of file
--- a/Veneer.toc	Fri Jul 08 18:01:49 2016 -0400
+++ b/Veneer.toc	Thu Jul 28 18:27:56 2016 -0400
@@ -1,4 +1,4 @@
-## Interface: 60200
+## Interface: 70000
 ## Title: Veneer
 ## Notes: Buff button management
 ## Author: Krakyn
@@ -10,7 +10,4 @@
 ## OptionalDeps: Devian
 
 Veneer.xml
-Config\Config.xml
-BuffFrame\BuffFrame.xml
-ObjectiveTracker\ObjectiveTracker.xml
-TimeManager\TimeManager.xml
\ No newline at end of file
+Modules\BuffFrame.lua
\ No newline at end of file
--- a/Veneer.xml	Fri Jul 08 18:01:49 2016 -0400
+++ b/Veneer.xml	Thu Jul 28 18:27:56 2016 -0400
@@ -25,10 +25,10 @@
       <Color r="1" g="1" b="1" a="1" />
   </Font>
 
-  <Font name="VeneerNumberFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="13" >
+  <Font name="VeneerNumberFont" virtual="true" font="Interface\Addons\Veneer\Font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="14" >
     <Color r="1" g="1" b="1" a="1" />
   </Font>
-  <Font name="VeneerNumberFontSmall" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="12" >
+  <Font name="VeneerNumberFontSmall" virtual="true" font="Interface\Addons\Veneer\Font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="12" >
     <Color r="1" g="1" b="1" a="1" />
   </Font>
   <Font name="VeneerTitleFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="15" >
@@ -55,7 +55,7 @@
 
   <Frame name="VeneerHandlerTemplate" parent="UIParent" virtual="true" />
 
-  <Frame name="Veneer" hidden="true" enableMouse="true" movable="true" parent="UIParent" frameStrata="DIALOG">
+  <Frame name="VeneerController" hidden="true" enableMouse="true" movable="true" parent="UIParent" frameStrata="DIALOG">
     <Size x="400" y="400" />
     <Anchors>
       <Anchor point="CENTER" relativePoint="CENTER" x="0" y="0" />