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