annotate Veneer.lua @ 108:a41f6b74709a

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