annotate Veneer.lua @ 133:86621c60512b v7.3.2-20171222

- Fixed AP calc tooltip appearing while hidden - Fixed PaperDoll relic tooltips missing nether crucible info
author Nenue
date Fri, 22 Dec 2017 20:36:40 -0500
parents 3f4794dca91b
children 414e37af1b1b
rev   line source
Nenue@88 1 -- Veneer Custom Interface Framework
Nenue@88 2 -- 1. vn OnLoad
Nenue@88 3 -- 2. OnEvent where IsLoggedIn() == true
Nenue@88 4 -- 3. Setup() where (not self.initialized)
Nenue@88 5 -- 4. Update()
Nenue@88 6 -- 5. Reanchor()
Nenue@122 7 local ADDON, addon = ...
Nenue@90 8 local VENEER_VERSION = 703
Nenue@103 9 local LE_FREE_FRAMES_GROUP = 1
Nenue@93 10 local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select
Nenue@93 11 local pairs, tremove = pairs, tremove
Nick@109 12 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop
Nick@113 13 local eprint = DEVIAN_WORKSPACE and function(...) _G.print('VeneerEvent', ...) end or nop
Nick@109 14 local wipe = table.wipe
Nenue@122 15 VeneerCore = {}
Nenue@122 16 local Veneer = VeneerCore
Nenue@84 17
Nenue@125 18
Nick@109 19 SLASH_VENEER1 = "/veneer"
Nick@109 20 SLASH_VENEER2 = "/vn"
Nenue@84 21 SlashCmdList.VENEER = function(cmd)
Nenue@125 22 _G.Veneer:print(addon.ConfigMode)
Nenue@125 23 if addon.ConfigMode == true then
Nenue@125 24 addon.ConfigMode = false
Nenue@90 25 else
Nenue@125 26 addon.ConfigMode = true
Nenue@90 27 end
Nenue@122 28 _G.Veneer:UpdateConfigLayers()
Nenue@84 29 end
Nenue@88 30
Nenue@125 31 addon.L = setmetatable({}, {
Nenue@125 32 __index = function(k) return k end
Nenue@125 33 })
Nenue@122 34
Nenue@115 35 Veneer.modules = {}
Nick@109 36 Veneer.Frames = {}
Nick@109 37 Veneer.ConfigLayers = {}
Nick@109 38 Veneer.FrameClusters = {
Nick@109 39 [LE_FREE_FRAMES_GROUP] = {}
Nick@109 40 }
Nick@109 41 Veneer.parserDepth = 0
Nick@109 42 Veneer.pendingCalls = {}
Nick@109 43 Veneer.AddOnCheck = {}
Nenue@0 44
Nenue@59 45 local defaults = {
Nenue@59 46 enableAll = true,
Nenue@90 47 ConfigMode = true
Nenue@59 48 }
Nenue@84 49
Nenue@71 50 local configMode
Nenue@79 51 local anonID = 0
Nenue@79 52 local IsFrameHandle = IsFrameHandle
Nenue@79 53 local GetAnonymousName = function(key)
Nenue@79 54 if not key then
Nenue@71 55 anonID = anonID + 1
Nenue@79 56 key = anonID
Nenue@71 57 end
Nenue@79 58 return 'VN' .. key
Nenue@71 59 end
Nenue@79 60 local GetTableName = function(table)
Nenue@79 61 return (IsFrameHandle(table) and table:GetName()) or tostring(table)
Nenue@79 62 end
Nenue@79 63
Nenue@87 64 local OFFSET_PARALLELS = {
Nenue@87 65 TOP = {'LEFT', 'RIGHT', 'SetHeight'},
Nenue@87 66 BOTTOM = {'LEFT', 'RIGHT', 'SetHeight'},
Nenue@87 67 LEFT = {'TOP', 'BOTTOM', 'SetWidth'},
Nenue@87 68 RIGHT = {'TOP', 'BOTTOM', 'SetWidth'},
Nenue@87 69 }
Nenue@87 70 local ANCHOR_OFFSET_POINT = {
Nenue@87 71 TOP = 'BOTTOM',
Nenue@87 72 TOPLEFT = 'BOTTOMRIGHT',
Nenue@87 73 TOPRIGHT = 'BOTTOMLEFT',
Nenue@87 74 LEFT = 'RIGHT',
Nenue@87 75 RIGHT = 'LEFT',
Nenue@87 76 CENTER = 'CENTER',
Nenue@87 77 BOTTOM = 'TOP',
Nenue@87 78 BOTTOMRIGHT = 'TOPLEFT',
Nenue@87 79 BOTTOMLEFT = 'TOPRIGHT',
Nenue@87 80 }
Nenue@87 81 local ANCHOR_INSET_DELTA = {
Nenue@87 82 TOP = {0, -1},
Nenue@87 83 TOPLEFT = {1, -1},
Nenue@87 84 TOPRIGHT = {-1,-1},
Nenue@87 85 LEFT = {1, 0},
Nenue@87 86 BOTTOMLEFT = {1, 1},
Nenue@87 87 BOTTOM = {0, 1},
Nenue@87 88 BOTTOMRIGHT = {-1, 1},
Nenue@87 89 RIGHT = {-1, 0},
Nenue@87 90 CENTER = {0, 0},
Nenue@72 91 }
Nenue@72 92
Nick@109 93 function Veneer:print(...)
Nenue@84 94 local txt = '|cFFFFFF00Veneer|r:'
Nenue@84 95 for i = 1, select('#', ...) do
Nenue@84 96 txt = txt .. ' '.. tostring(select(i, ...))
Nenue@84 97 end
Nenue@84 98
Nenue@84 99 DEFAULT_CHAT_FRAME:AddMessage(txt)
Nenue@84 100 end
Nenue@84 101
Nick@109 102 function Veneer:OnLoad()
Nenue@84 103 print('|cFFFFFF00Veneer!|r')
Nenue@84 104 self:RegisterEvent('ADDON_LOADED')
Nenue@84 105 self:RegisterEvent('PLAYER_LOGIN')
Nenue@115 106 self:RegisterEvent('PLAYER_REGEN_ENABLED')
Nenue@115 107 self:RegisterEvent('PLAYER_REGEN_DISABLED')
Nenue@84 108
Nenue@84 109 self.DEVIAN_PNAME = 'Veneer'
Nenue@84 110 self:RegisterForDrag('LeftButton')
Nenue@88 111
Nenue@88 112
Nenue@84 113 end
Nenue@84 114
Nenue@90 115 local select, IsAddOnLoaded, IsLoggedIn = select, IsAddOnLoaded, IsLoggedIn
Nenue@90 116
Nick@109 117 function Veneer:OnEvent(event, ...)
Nick@113 118 local print = eprint
Nenue@97 119 print('|cFFFF0088OnEvent()|r',event, ...)
Nenue@98 120 if (event == 'PLAYER_LOGIN') or (event == 'ADDON_LOADED') then
Nenue@90 121 print(IsLoggedIn(), self.initialized)
Nenue@84 122 if IsLoggedIn() and not self.intialized then
Nenue@84 123 self:Setup()
Nenue@90 124 self.intialized = true
Nenue@90 125 print('popping init sequence', self.intialized)
Nenue@90 126 end
Nenue@90 127
Nenue@90 128
Nenue@90 129 if self.intialized then
Nenue@90 130 local addon = ...
Nenue@90 131 if self.AddOnCheck[addon] then
Nenue@90 132 print(' - setting up '..addon..' dependent modules:')
Nenue@90 133 local keepChecking = false
Nenue@90 134 for index, handler in ipairs(self.AddOnCheck[addon]) do
Nenue@90 135 print(' -', handler:GetName(), (not handler.initialized) and (handler.addonFrame and not _G[handler.addonFrame]))
Nenue@90 136 if not handler.initialized then
Nenue@90 137 print(' '..handler:GetName()..':Setup()')
Nenue@90 138 handler:Setup()
Nenue@90 139 handler.initialized = true
Nenue@90 140 end
Nenue@90 141 end
Nenue@90 142 if not keepChecking then
Nenue@90 143 self.AddOnCheck[addon] = nil
Nenue@90 144 end
Nenue@90 145 end
Nenue@84 146 end
Nenue@115 147 elseif event == 'PLAYER_REGEN_ENABLED' then
Nenue@115 148 for _, module in pairs(self.modules) do
Nenue@115 149 if module:IsShown() and module.hideCombat then
Nenue@115 150 module:Hide()
Nenue@115 151 end
Nenue@115 152 end
Nenue@115 153
Nenue@115 154 elseif event == 'PLAYER_REGEN_DISABLED' then
Nenue@115 155 for _, module in pairs(self.modules) do
Nenue@115 156 if module:IsShown() and module.hideCombat then
Nenue@115 157 module:Show()
Nenue@115 158 end
Nenue@115 159 end
Nenue@84 160 end
Nenue@84 161 end
Nenue@84 162
Nick@109 163 function Veneer:OnDragStart()
Nenue@84 164 self:StartMoving()
Nenue@84 165 end
Nenue@84 166
Nick@109 167 function Veneer:OnDragStop()
Nenue@84 168 self:StopMovingOrSizing()
Nenue@84 169 end
Nenue@84 170
Nenue@93 171 local VeneerModule_Setup = function(frame)
Nenue@97 172 if not frame.initialized then
Nenue@97 173 local doSetup = (not frame.addonTrigger) or select(2, IsAddOnLoaded(frame.addonTrigger))
Nenue@97 174 print(' '..frame:GetName()..'.doSetup =', doSetup)
Nenue@97 175 if doSetup then
Nenue@93 176 frame:Setup()
Nenue@93 177 frame.initialized = true
Nenue@98 178 else
Nick@109 179 frame:RegisterEvent('ADDON_LOADED')
Nenue@93 180 end
Nenue@97 181
Nenue@93 182 end
Nenue@93 183 end
Nenue@93 184
Nick@109 185 function Veneer:Setup ()
Nenue@97 186 print('|cFFFF0088Setup()|r')
Nenue@90 187 if (not VeneerData) then
Nenue@122 188 print('|cFF00FFFFresetting defaults|r')
Nenue@84 189 VeneerData = defaults
Nenue@90 190 VeneerData.version = VENEER_VERSION
Nenue@84 191 end
Nenue@84 192 self.data = VeneerData
Nenue@93 193 self:ExecuteOnClusters(nil, VeneerModule_Setup)
Nenue@90 194
Nenue@125 195 addon.ConfigMode = VeneerData.ConfigMode
Nenue@125 196 print('|cFF00FF88configMode =', addon.ConfigMode)
Nenue@90 197 self:UpdateConfigLayers()
Nenue@90 198 self:Reanchor()
Nenue@90 199 self:Update()
Nenue@87 200 end
Nenue@84 201
Nick@109 202 function Veneer:UpdateConfigLayers()
Nenue@90 203 if VeneerData then
Nenue@125 204 VeneerData.ConfigMode = addon.ConfigMode
Nenue@90 205 end
Nenue@90 206
Nenue@125 207 self:print('Config mode '..(addon.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'. ', tostring(addon.ConfigMode))
Nenue@90 208 self:ExecuteOnClusters(nil, function(frame)
Nenue@90 209 if frame.UpdateConfigLayers then
Nenue@125 210 frame:UpdateConfigLayers(addon.ConfigMode)
Nenue@90 211 end
Nenue@90 212
Nenue@90 213
Nenue@90 214 if type(frame.ConfigLayer) == 'table' then
Nenue@90 215 for index, region in ipairs(frame.ConfigLayer) do
Nenue@125 216 print('setting', frame:GetName() .. '['.. index..']', 'to', addon.ConfigMode)
Nenue@90 217
Nenue@125 218 region:SetShown(addon.ConfigMode)
Nenue@90 219 end
Nenue@90 220 end
Nenue@90 221
Nenue@90 222 self.ConfigLayers[frame] = frame:IsShown()
Nenue@125 223 if addon.ConfigMode then
Nenue@90 224 print(frame:GetName(), self.ConfigLayers[frame])
Nenue@125 225 frame:SetShown(addon.ConfigMode)
Nenue@90 226 else
Nenue@90 227 frame:SetShown(self.ConfigLayers[frame])
Nenue@90 228 end
Nenue@90 229 end)
Nenue@90 230 end
Nenue@84 231
Nenue@93 232
Nick@109 233 function Veneer:GetClusterFromArgs (...)
Nenue@87 234 return primaryAnchor, clusterTable, insertPosition
Nenue@84 235 end
Nenue@84 236
Nick@108 237 -- args: frame object, list of anchor groups, true for forced top, number for priority layer
Nenue@115 238 local mixins = {}
Nick@109 239 function Veneer:AddHandler(handler, ...)
Nenue@115 240 print('|cFFFFFF00'..handler:GetName()..':|r', handler.moduleName, ...)
Nenue@87 241
Nenue@115 242 wipe(mixins)
Nick@108 243 for k,v in pairs(VeneerHandlerMixin) do
Nick@108 244 if not handler[k] then
Nenue@115 245 tinsert(mixins, k)
Nick@108 246 handler[k] = v
Nick@108 247 end
Nick@108 248 end
Nenue@115 249 if #mixins >= 1 then
Nenue@115 250 print('* Mixins:|cFF00FF88', table.concat(mixins, ', '))
Nenue@115 251 end
Nenue@115 252
Nenue@115 253 self.modules[handler] = handler
Nick@108 254
Nenue@102 255 if not handler.anchorFrame then
Nick@113 256
Nenue@122 257 local clusterAnchor = handler.anchorGroup or handler.anchorPoint or 'CENTER'
Nenue@115 258 local clusterPriority = handler.anchorPriority
Nenue@122 259 print('panel group =', clusterAnchor)
Nenue@122 260
Nenue@122 261 self.FrameClusters[clusterAnchor] = self.FrameClusters[clusterAnchor] or {}
Nenue@122 262 local clusterTable = self.FrameClusters[clusterAnchor]
Nick@113 263 local clusterIndex
Nick@113 264
Nick@113 265 if clusterPriority then
Nick@113 266 for i = 1, #clusterTable do
Nenue@115 267
Nick@113 268 if clusterTable[i].anchorPriority and (clusterTable[i].anchorPriority > clusterPriority) then
Nenue@115 269 clusterIndex = i
Nick@113 270 print('|cFF00BB00insert position:', clusterPriority, clusterIndex)
Nick@113 271 break
Nick@113 272 else
Nenue@115 273 print('pass', clusterTable[i])
Nenue@115 274 clusterIndex = i+1
Nick@113 275 end
Nick@113 276 end
Nick@113 277 else
Nick@113 278 print('|cFF00BB00inserting at front')
Nenue@115 279 clusterIndex = #clusterTable + 1
Nick@113 280 end
Nick@113 281
Nick@113 282 if not clusterIndex then
Nick@113 283 clusterIndex = #clusterTable + 1
Nick@113 284 end
Nick@113 285
Nick@113 286
Nenue@90 287 tinsert(clusterTable, clusterIndex, handler)
Nenue@122 288 print(' cluster', clusterAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex)
Nenue@90 289
Nenue@102 290 handler.anchorCluster = clusterTable
Nenue@102 291 handler.anchorIndex = clusterIndex
Nenue@102 292 else
Nenue@103 293 local clusterTable = self.FrameClusters[LE_FREE_FRAMES_GROUP]
Nenue@103 294 handler.anchorCluster = clusterTable
Nenue@103 295 handler.anchorIndex = #clusterTable+1
Nenue@103 296 tinsert(clusterTable, handler.anchorIndex, handler)
Nenue@102 297 print(' free frame')
Nenue@102 298 end
Nenue@87 299
Nenue@90 300 if handler.addonTrigger and not IsAddOnLoaded(handler.addonTrigger) then
Nenue@90 301 print('|cFFFF4400 -- dependency:', handler.addonTrigger)
Nenue@90 302 self.AddOnCheck[handler.addonTrigger] = self.AddOnCheck[handler.addonTrigger] or {}
Nenue@90 303 tinsert(self.AddOnCheck[handler.addonTrigger], handler)
Nenue@90 304 end
Nenue@90 305
Nenue@115 306
Nenue@87 307 if self.initialized then
Nenue@90 308 print(' -- initialization check')
Nenue@90 309 if handler.Setup then
Nenue@90 310 local doInit = (not handler.initialized)
Nenue@90 311 if handler.addonTrigger and not IsAddOnLoaded(handler.addonTrigger) then
Nenue@90 312 doInit = false
Nenue@90 313 end
Nenue@90 314 -- room to add other checks
Nenue@90 315
Nenue@90 316 if doInit then
Nenue@90 317 handler:Setup()
Nenue@90 318 handler.initialized = true
Nenue@90 319 self:InternalReanchor(handler)
Nenue@90 320 end
Nenue@87 321 end
Nenue@87 322 end
Nenue@87 323 end
Nenue@87 324
Nick@109 325 function Veneer:Reanchor()
Nenue@123 326 --self:ExecuteOnClusters(nil, 'Reanchor')
Nenue@123 327 self:EvaluateAnchors()
Nenue@87 328 end
Nenue@87 329
Nick@109 330 function Veneer:Update()
Nenue@90 331 self:ExecuteOnClusters(nil, function(frame)
Nenue@90 332 if frame.initialized and frame.Update then
Nenue@90 333 frame:Update()
Nenue@90 334 end
Nenue@90 335 end)
Nenue@88 336 self:Reanchor()
Nenue@87 337 end
Nenue@87 338
Nenue@87 339 -- updates anchor relations to and from the target handler
Nick@109 340 function Veneer:GetAnchor(...)
Nenue@87 341
Nenue@87 342 end
Nenue@87 343
Nenue@121 344
Nick@113 345 -- Recursives updates frame group anchors
Nick@113 346 function Veneer:EvaluateAnchors(parent)
Nenue@88 347 parent = parent or self
Nick@113 348 local print = eprint
Nenue@88 349 print('|cFF88FF00DynamicReanchor()')
Nenue@122 350 for clusterPoint, cluster in pairs(parent.FrameClusters) do
Nenue@122 351 print(clusterPoint)
Nenue@122 352 if clusterPoint ~= LE_FREE_FRAMES_GROUP then
Nenue@103 353 local lastFrame
Nenue@103 354 for index, frame in ipairs(cluster) do
Nick@108 355 print(' |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent'))
Nick@108 356 if frame:IsShown() then
Nenue@90 357
Nenue@103 358 if frame.anchorFrame then
Nenue@103 359 print(frame.anchorPoint)
Nenue@103 360 frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY)
Nick@112 361 print('anchored to', frame.anchorFrame,frame:GetTop(), frame:GetRight())
Nenue@90 362 else
Nenue@122 363 local anchorPoint = frame.anchorPoint or clusterPoint
Nenue@122 364 local anchorFrom = frame.anchorFrom or ANCHOR_OFFSET_POINT[clusterPoint]
Nenue@103 365 frame:ClearAllPoints()
Nenue@103 366 if lastFrame then
Nenue@122 367 frame:SetPoint(anchorPoint, lastFrame, anchorFrom, 0, 0)
Nick@112 368
Nenue@122 369 print(' fixing to', lastFrame, anchorPoint, anchorFrom, frame:GetTop(), frame:GetRight())
Nenue@103 370 else
Nenue@122 371 frame:SetPoint(anchorPoint, UIParent, clusterPoint, frame.anchorX, frame.anchorY)
Nenue@122 372 print('NEW', clusterPoint, anchorPoint, anchorFrom, frame.anchorX, frame.anchorY)
Nenue@103 373 end
Nenue@103 374 lastFrame = frame
Nenue@90 375 end
Nenue@103 376
Nenue@88 377 end
Nenue@90 378
Nenue@88 379 end
Nenue@103 380 end
Nenue@88 381
Nenue@88 382 end
Nenue@88 383 end
Nenue@88 384
Nick@113 385 Veneer.DynamicReanchor = Veneer.EvaluateAnchors
Nick@113 386
Nenue@88 387 -- Evaluates the current visibility state and re-anchors adjacent blocks accordingly
Nick@109 388 function Veneer:InternalReanchor(handler, printFunc)
Nick@113 389 local print = eprint
Nenue@87 390 print('|cFF00FFFFVeneer:InternalReanchor('..handler:GetName()..')')
Nenue@90 391 if handler.anchorFrame then
Nenue@90 392 handler:SetPoint(handler.anchorPoint, handler.anchorFrame, handler.anchorFrom, handler.anchorX, handler.anchorY)
Nenue@90 393 return
Nenue@90 394 end
Nenue@90 395
Nenue@90 396
Nenue@87 397 local anchorPoint = handler.anchorPath or handler.anchorPoint
Nenue@87 398 local anchorParent, anchorTo = UIParent, anchorPoint
Nenue@88 399 local subPoint, subTo
Nenue@88 400 local nextFrame
Nenue@88 401 for index, frame in ipairs(handler.anchorCluster) do
Nenue@88 402 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible())
Nick@108 403 if frame:IsShown() then
Nenue@88 404 if frame ~= handler then
Nenue@88 405 anchorParent = frame
Nenue@88 406 anchorTo = ANCHOR_OFFSET_POINT[anchorPoint]
Nenue@87 407
Nenue@88 408 else
Nenue@88 409 nextFrame = handler.anchorCluster[index+1]
Nenue@88 410 if nextFrame then
Nenue@88 411
Nenue@88 412 subPoint = nextFrame.anchorPath or nextFrame.anchorPoint
Nenue@88 413 subTo = ANCHOR_OFFSET_POINT[subPoint]
Nenue@88 414 nextFrame:ClearAllPoints()
Nenue@88 415 nextFrame:SetPoint(subPoint, handler, subTo, 0, 0)
Nenue@88 416 print(' -- pushing '..nextFrame:GetName()..' down the anchor chain', subPoint, subTo)
Nenue@88 417 end
Nenue@88 418 break
Nenue@87 419 end
Nenue@87 420 end
Nenue@87 421 end
Nenue@87 422
Nick@108 423 if handler:IsShown() then
Nenue@88 424 handler:SetPoint(anchorPoint, anchorParent, anchorTo, 0, 0)
Nenue@88 425 else
Nenue@88 426 if anchorParent and nextFrame then
Nenue@88 427 nextFrame:SetPoint(subPoint, handler, subTo, 0, 0)
Nenue@88 428 end
Nenue@88 429 end
Nenue@88 430
Nenue@87 431
Nenue@87 432 print(handler.anchorPoint, anchorParent, anchorTo)
Nenue@87 433 if printFunc then
Nenue@87 434 printFunc('|cFF88FF00'..handler:GetName()..':SetPoint(', handler.anchorPoint, anchorParent, anchorTo)
Nenue@87 435 end
Nenue@88 436 end
Nenue@87 437
Nick@109 438 function Veneer:SlideBlock(frame, ...)
Nick@113 439 local print = eprint
Nenue@89 440 local aX, aY = frame:GetLeft(), frame:GetTop()
Nenue@88 441
Nenue@89 442 frame:SetPoint('TOPLEFT', frame, 'BOTTOMLEFT', aX, aY)
Nenue@89 443 frame.animation = frame.animation or {}
Nenue@89 444 frame.animation.startX = aX
Nenue@89 445 frame.animation.startY = aY
Nenue@88 446
Nenue@89 447 local targetPoint, targetParent, targetAnchor, offsetX, offsetY = ...
Nenue@89 448 frame.BlockSlide:SetScript('OnFinished', function()
Nenue@89 449 frame:SetPoint(targetPoint, targetParent, targetAnchor, offsetX, offsetY)
Nenue@89 450 VeneerAnimationMixin.OnFinished(frame)
Nenue@89 451 end)
Nenue@88 452
Nenue@84 453 end
Nenue@84 454
Nenue@115 455 -- execute a function on all clusters in display order
Nick@109 456 function Veneer:ExecuteOnClusters(layer, method)
Nick@113 457 local print = eprint
Nenue@84 458 self.parserDepth = self.parserDepth + 1
Nenue@84 459 if not layer then
Nenue@87 460 if self.parserDepth > 1 then
Nenue@84 461 tinsert(self.pendingCalls, method)
Nenue@84 462 print('delaying walk for', method)
Nenue@84 463 return
Nenue@84 464 end
Nenue@97 465 print('|cFF00FF00ExecuteOnClusters|r('..tostring(layer)..', '..tostring(method)..')')
Nenue@84 466 else
Nenue@87 467 print(' Level '..self.parserDepth)
Nenue@84 468 end
Nenue@87 469
Nenue@87 470 layer = layer or self.FrameClusters
Nenue@84 471 for anchor, cluster in pairs(layer) do
Nenue@84 472 for index, frame in ipairs(cluster) do
Nenue@87 473 print(' '..anchor..'.'..index..' = '..frame:GetName())
Nenue@90 474 if type(method) == 'function' then
Nenue@90 475 method(frame, true)
Nenue@90 476 elseif frame[method] then
Nenue@87 477 print(' |cFF00FF00'..frame:GetName())
Nenue@87 478 frame[method](frame, true)
Nenue@84 479 end
Nenue@84 480 end
Nenue@84 481 if cluster.FrameClusters then
Nenue@84 482 self:ExecuteOnClusters(cluster.FrameClusters, method)
Nenue@84 483 end
Nenue@84 484 end
Nenue@84 485 self.parserDepth = self.parserDepth - 1
Nenue@84 486
Nenue@84 487 if (self.parserDepth == 0) and (#self.pendingCalls >= 1) then
Nenue@84 488 local delayedMethod = tremove(self.pendingCalls, 1)
Nenue@84 489 print('starting delayed walk for', delayedMethod)
Nenue@84 490 self:ExecuteOnClusters(nil, delayedMethod)
Nenue@84 491 end
Nenue@84 492 end
Nenue@84 493
Nenue@72 494
Nenue@71 495
Nenue@88 496 -- Takes frame handle and assigns a block to it
Nick@109 497 function Veneer:Acquire (frame, template)
Nick@113 498 local print = eprint
Nenue@71 499 if not frame then
Nenue@71 500 print('|cFFFF4400Unable to acquire frame...|r')
Nenue@71 501 return
Nenue@71 502 end
Nenue@84 503 local veneer = self.Frames[frame]
Nenue@84 504 if not veneer then
Nenue@94 505 local name = GetAnonymousName()
Nenue@94 506 veneer = CreateFrame('Frame', name, frame, template)
Nenue@90 507 print(self:GetName()..':Acquire()', frame:GetName(), template)
Nenue@71 508
Nenue@84 509 veneer:SetAllPoints(frame)
Nenue@84 510 veneer:SetParent(frame)
Nenue@84 511 veneer.label:SetText(name)
Nenue@84 512 veneer.bg:SetColorTexture(0,0,0,0)
Nenue@84 513 veneer:Hide()
Nenue@84 514 veneer:EnableMouse(false)
Nenue@84 515 -- find current X/Y
Nenue@84 516 veneer.currentLeft = frame:GetLeft()
Nenue@84 517 veneer.currentTop = frame:GetTop()
Nenue@84 518 self.Frames[frame] = veneer
Nenue@71 519 end
Nenue@84 520 return veneer
Nick@109 521 end