annotate Veneer.lua @ 52:5db587de8feb

really fixing raidbuffs position
author Nenue
date Fri, 29 Apr 2016 11:04:42 -0400
parents 16465f3fd919
children ed74c5cabe98
rev   line source
Nenue@0 1 --- Modulizer framework
Nenue@0 2 -- OnInitialize
Nenue@0 3 -- OnUpdate
Nenue@0 4 -- OnEnable -- run when GetSpecialization() returns true
Nenue@0 5
Nenue@0 6 local ADDON, A = ...
Nenue@0 7 Veneer = Veneer or CreateFrame('Frame', 'Veneer', UIParent)
Nenue@0 8 local B = Veneer
Nenue@3 9 local wipe, min, max, random, tinsert, tremove = table.wipe, math.min, math.max, math.random, table.insert, table.remove
Nenue@0 10 local pairs, ipairs, select, unpack, _G = pairs, ipairs, select, unpack, _G
Nenue@0 11 local type, tostring, format = type, tostring, string.format
Nenue@0 12 A.frame = B
Nenue@0 13
Nenue@0 14 --- Cache tables
Nenue@0 15 local initOnced
Nenue@0 16 local modules = {}
Nenue@0 17 local queuedModules = {}
Nenue@3 18 local checkForConfig = {}
Nenue@0 19 local moduleStack = {
Nenue@0 20 }
Nenue@0 21
Nenue@37 22 --- Utilities
Nenue@37 23 B.wipeall = function (...)
Nenue@37 24 for i = 1, select('#', ...) do
Nenue@37 25 wipe(select(i, ...))
Nenue@37 26 end
Nenue@37 27 end
Nenue@37 28
Nenue@0 29 --- Various region categories
Nenue@0 30 B.displays = {}
Nenue@0 31 B.configLayers = {}
Nenue@0 32 B.configLayersRef = {}
Nenue@0 33
Nenue@37 34
Nenue@0 35 --@debug@
Nenue@0 36 --- Generates a print handler pointing to a static channel signature
Nenue@0 37 -- @usage func = B.print(sig)
Nenue@0 38 -- @param sig channel name or number
Nenue@0 39 local printfuncs = {}
Nenue@0 40 B.print = function(pref, ...)
Nenue@0 41 if Devian and Devian.InWorkspace() then
Nenue@0 42 printfuncs[pref] = printfuncs[pref] or function(...) print(pref, ...) end
Nenue@0 43
Nenue@0 44 return printfuncs[pref]
Nenue@0 45 else
Nenue@0 46 return function () end
Nenue@0 47 end
Nenue@0 48 end
Nenue@0 49
Nenue@0 50 local rgb = {}
Nenue@0 51 local getcolor = function()
Nenue@0 52 local n, p = 0, 4
Nenue@0 53 for i = 1, 3 do
Nenue@0 54 rgb[i] = min(random(n,p) * 64, 255)
Nenue@0 55 if rgb[i] == 255 then
Nenue@0 56 p = 4
Nenue@0 57 elseif rgb[i] > 0 then
Nenue@0 58 n = 2
Nenue@0 59 end
Nenue@0 60 end
Nenue@0 61 return unpack(rgb)
Nenue@0 62 end
Nenue@0 63
Nenue@0 64 local color = {}
Nenue@0 65 local fprints = {}
Nenue@0 66 B.fprint = function()
Nenue@0 67 if not (Devian and Devian.InWorkspace()) then
Nenue@0 68 return function() end
Nenue@0 69 end
Nenue@0 70
Nenue@0 71
Nenue@0 72 local sig = debugstack(2,1)
Nenue@0 73 if fprints[sig] then
Nenue@0 74 return fprints[sig]
Nenue@0 75 end
Nenue@0 76
Nenue@0 77 local func = sig:match("%`(%a+)%'")
Nenue@0 78 if not func then
Nenue@0 79 func = sig:match("<(.-)>")
Nenue@0 80 end
Nenue@0 81 func = func:gsub('(%l+)(%u)', function(a, b) return a:sub(0,2) .. b end, 1)
Nenue@0 82 func = func:gsub('^.+%\\', '')
Nenue@0 83 if not func then
Nenue@0 84 func = 'noname'
Nenue@0 85 end
Nenue@0 86
Nenue@0 87 local r, g, b = getcolor()
Nenue@0 88 color[sig] = color[sig] or format('|cFF%02X%02X%02X%s|r', r, g, b, func)
Nenue@0 89
Nenue@0 90 --print(color[func] .. ' ( ' .. table.concat(args, ', ')..' )' )
Nenue@0 91 func = B.print(func)
Nenue@0 92 fprints[sig] = func
Nenue@0 93 return func
Nenue@0 94 end
Nenue@0 95
Nenue@0 96 --@end-debug@
Nenue@0 97 --[=[@non-debug@
Nenue@0 98 B.print = function() end
Nenue@0 99 --@end-non-debug@]=]
Nenue@0 100
Nenue@0 101 -- for the Mikk script
Nenue@0 102 -- GLOBALS: NUM_LE_RAID_BUFF_TYPES
Nenue@0 103 -- GLOBALS: BUFF_FLASH_TIME_ON, BUFF_FLASH_TIME_OFF, BUFF_MIN_ALPHA, BUFF_WARNING_TIME, BUFF_DURATION_WARNING_TIME
Nenue@0 104 -- GLOBALS: BUFFS_PER_ROW, BUFF_MAX_DISPLAY, BUFF_ACTUAL_DISPLAY, DEBUFF_MAX_DISPLAY, DEBUFF_ACTUAL_DISPLAY, BUFF_ROW_SPACING
Nenue@0 105 -- GLOBALS: CONSOLIDATED_BUFFS_PER_ROW, CONSOLIDATED_BUFF_ROW_HEIGHT, NUM_TEMP_ENCHANT_FRAMES
Nenue@0 106 -- GLOBALS: BUFF_BUTTON_HEIGHT, BUFF_FRAME_BASE_EXTENT, BUFF_HORIZ_SPACING
Nenue@0 107
Nenue@0 108 local print = B.print('Bfl')
Nenue@0 109
Nenue@0 110 --- Template for making perpendicular traversals of the displays structure; also makes sure the table is there
Nenue@0 111 B.Abstract = function(dest, key, table)
Nenue@0 112 if table then
Nenue@0 113 for _, v in pairs(dest) do
Nenue@0 114 v[key] = {}
Nenue@0 115 end
Nenue@0 116 end
Nenue@0 117 B[key] = setmetatable({}, {
Nenue@0 118 __index = function(t, k)
Nenue@0 119 return dest[k][key]
Nenue@0 120 end,
Nenue@0 121 __newindex = function(_, k, v)
Nenue@0 122 print('abstract write ('..key..'):', k)
Nenue@0 123 dest[k][key] = v
Nenue@0 124 end,
Nenue@0 125 __tostring = function() return 'Abstract:'..key..'' end
Nenue@0 126 })
Nenue@0 127
Nenue@0 128
Nenue@0 129 return B[key]
Nenue@0 130 end
Nenue@0 131
Nenue@0 132
Nenue@0 133 --- localize for speed
Nenue@0 134
Nenue@24 135 local ModulesCall = function(func, flag)
Nenue@0 136
Nenue@0 137 local n = 0
Nenue@0 138 for i = 1, #moduleStack do
Nenue@0 139 print('calling level '..i)
Nenue@0 140 local stackset = moduleStack[i]
Nenue@0 141
Nenue@0 142 for name, module in pairs(stackset) do
Nenue@0 143 n = n + 1
Nenue@0 144
Nenue@0 145
Nenue@0 146 if module[func] then
Nenue@24 147 -- nil = pass
Nenue@24 148 if not flag or module.Conf[flag] then
Nenue@24 149 if (flag) then
Nenue@24 150 print(' check', flag, '=', module.Conf[flag])
Nenue@24 151 end
Nenue@24 152
Nenue@24 153 print(' ',n..' '..name..'.'..func..'()')
Nenue@24 154 module[func](module, module.Conf)
Nenue@24 155 end
Nenue@24 156
Nenue@0 157 end
Nenue@0 158 end
Nenue@0 159 end
Nenue@0 160 end
Nenue@0 161
Nenue@0 162
Nenue@0 163 local Enable = function()
Nenue@0 164 end
Nenue@0 165
Nenue@0 166 --- The things that happen repeatedly
Nenue@0 167 local Init = function ()
Nenue@0 168 end
Nenue@0 169
Nenue@0 170
Nenue@48 171 local layers, refs, displays = B.configLayers, B.configLayersRef, B.displays
Nenue@0 172 --- Things that happen immediately upon entering world
Nenue@0 173 local InitOnce = function()
Nenue@0 174 print('entering world first time')
Nenue@48 175 local defaults = {}
Nenue@0 176 print('|cFFFFFF00Veneer|r')
Nenue@0 177 if not VeneerData then
Nenue@0 178 VeneerData = {}
Nenue@0 179 for k,v in pairs(defaults) do
Nenue@0 180 VeneerData[k] = v
Nenue@0 181 end
Nenue@0 182 print('Veneer defaults being used.')
Nenue@0 183 end
Nenue@0 184 B.Conf = setmetatable(VeneerData, {__index = function(_, k) return defaults[k] end})
Nenue@0 185
Nenue@0 186 -- To ensure that modules are run in controlled order, walk the dependency list; if the dep shows up
Nenue@0 187 -- in the loaded manifest, remove the value. If the dep list isn't empty, move that module to the next
Nenue@0 188 -- layer.
Nenue@0 189 local loaded = {}
Nenue@0 190 local stackLevels = #moduleStack
Nenue@0 191 local i = 1
Nenue@0 192 moduleStack[1] = modules
Nenue@0 193 repeat
Nenue@0 194 print('setting init level '.. i)
Nenue@0 195 local queue = moduleStack[i]
Nenue@0 196 for name, module in pairs(queue) do
Nenue@0 197
Nenue@0 198 if queuedModules[name] and #queuedModules[name] > 0 then
Nenue@0 199 local p = #queuedModules[name]
Nenue@0 200 for j = 1, p do
Nenue@0 201 local dep = queuedModules[name][j]
Nenue@0 202
Nenue@0 203 if loaded[dep] then
Nenue@0 204 print( ' ' .. dep .. ' OK')
Nenue@0 205 queuedModules[name][j] = nil
Nenue@0 206 for k = j, p do
Nenue@0 207 print(' shift ' .. (k+1) .. ' ('..tostring(queuedModules[name][k+1])..') to ' .. k ..'')
Nenue@0 208 queuedModules[name][k] = queuedModules[name][k+1]
Nenue@0 209 end
Nenue@0 210 end
Nenue@0 211 end
Nenue@0 212
Nenue@0 213 if #queuedModules[name] == 0 then
Nenue@0 214 queuedModules[name] = nil
Nenue@0 215 print(' |cFF00FFFF'.. name ..'|r deps OK')
Nenue@0 216 loaded[name] = true
Nenue@0 217 else
Nenue@0 218
Nenue@0 219 print(' |cFFFF8800' .. name ..'|r pending')
Nenue@0 220 local next = i+1
Nenue@0 221 if not moduleStack[next] then
Nenue@0 222 moduleStack[next] = {}
Nenue@0 223 end
Nenue@0 224 stackLevels = next
Nenue@0 225 moduleStack[next][name] = module
Nenue@0 226 queue[name] = nil
Nenue@0 227 end
Nenue@0 228
Nenue@0 229 else
Nenue@0 230 print(' |cFF00FF00'.. name ..'|r no deps')
Nenue@0 231 loaded[name] = true
Nenue@0 232 end
Nenue@0 233 end
Nenue@0 234 i = i + 1
Nenue@0 235 until i > stackLevels
Nenue@0 236
Nenue@0 237 for level, batch in ipairs(moduleStack) do
Nenue@0 238 print('config level', level)
Nenue@0 239 for name, module in pairs(batch) do
Nenue@24 240 if not VeneerData[name] then
Nenue@24 241 VeneerData[name] = {}
Nenue@24 242 end
Nenue@24 243
Nenue@14 244 if module.defaults then
Nenue@14 245 print('setting defaults for module', name)
Nenue@14 246 --[===[@non-debug@
Nenue@14 247 if not VeneerData[name] then
Nenue@14 248 --@end-non-debug@]===]
Nenue@14 249 VeneerData[name] = {}
Nenue@14 250 --[===[@non-debug@
Nenue@14 251 end
Nenue@14 252 --@end-non-debug@]===]
Nenue@14 253 for k,v in pairs(module.defaults) do
Nenue@14 254 VeneerData[name][k] = v
Nenue@14 255 end
Nenue@14 256 module.Conf = VeneerData[name]
Nenue@14 257 end
Nenue@0 258
Nenue@24 259 if VeneerData[name].enabled == nil then
Nenue@24 260 VeneerData[name].enabled = true
Nenue@24 261 end
Nenue@24 262
Nenue@0 263 end
Nenue@0 264 end
Nenue@3 265
Nenue@48 266 --- Pull in any XML templates
Nenue@3 267 if #checkForConfig >= 1 then
Nenue@3 268 local queuedFrame = tremove(checkForConfig)
Nenue@3 269 while queuedFrame do
Nenue@3 270 B.SetConfigLayers(queuedFrame)
Nenue@38 271 B.UpdateXMLFrame(queuedFrame)
Nenue@3 272 queuedFrame = tremove(checkForConfig)
Nenue@3 273 end
Nenue@3 274 end
Nenue@0 275 end
Nenue@0 276
Nenue@0 277 --- Fires an update to all modules
Nenue@0 278 local lastUpdate
Nenue@0 279 function B.UpdateAll(...)
Nenue@0 280 lastUpdate = GetTime()
Nenue@24 281 ModulesCall('OnUpdate')
Nenue@0 282 end
Nenue@0 283
Nenue@0 284 B:RegisterEvent('PLAYER_ENTERING_WORLD')
Nenue@0 285 B:SetScript('OnEvent', function(self, event)
Nenue@0 286 if event == 'PLAYER_ENTERING_WORLD' then
Nenue@0 287 if not initOnced then
Nenue@0 288 InitOnce()
Nenue@0 289 ModulesCall('OnInitialize')
Nenue@0 290 initOnced = true
Nenue@0 291 C_Timer.After(1, function()
Nenue@0 292 if GetSpecialization() then
Nenue@0 293 print(GetSpecialization(), 'enabling')
Nenue@24 294
Nenue@24 295 ModulesCall('OnEnable', 'enabled')
Nenue@0 296 B:SetScript('OnUpdate', nil)
Nenue@0 297 end
Nenue@0 298 end)
Nenue@0 299 end
Nenue@0 300 end
Nenue@0 301
Nenue@0 302 B.UpdateAll()
Nenue@24 303
Nenue@24 304 if event == 'PLAYER_ENTERING_WORLD' then
Nenue@24 305 B.UpdateConfigLayers()
Nenue@24 306 end
Nenue@24 307
Nenue@0 308 end)
Nenue@0 309
Nenue@0 310 --- Modulizer method
Nenue@0 311 --
Nenue@0 312 function B:RegisterModule (name, module, ...)
Nenue@0 313 if modules[name] then
Nenue@0 314 print('pulling modules[|cFFFF8800'.. tostring(name) ..'|r]')
Nenue@0 315 return modules[name]
Nenue@0 316 end
Nenue@0 317
Nenue@0 318 print('new module |cFF00BBFF'.. tostring(name) ..'|r')
Nenue@0 319 if module then
Nenue@0 320 if modules[name] then
Nenue@0 321 error("Module table for '"..tostring(name).."' already exists.")
Nenue@0 322 end
Nenue@0 323 else
Nenue@0 324 module = CreateFrame('Frame', 'Veneer' .. tostring(name) .. 'Handler', B, 'VeneerHandlerTemplate')
Nenue@0 325 end
Nenue@0 326 modules[name] = module
Nenue@3 327 B[name] = module
Nenue@0 328 if select('#', ...) >= 1 then
Nenue@0 329 local numDeps = select('#', ...)
Nenue@0 330 print(' '..numDeps..' deps detected')
Nenue@0 331 for i = 1, numDeps do
Nenue@0 332 local dep = select(i, ...)
Nenue@0 333 -- means that init/enable funcs are ordered to run after deps do their things
Nenue@0 334 queuedModules[name] = queuedModules[name] or {}
Nenue@0 335 tinsert(queuedModules[name], dep)
Nenue@0 336 print(' needs '..dep)
Nenue@0 337 end
Nenue@0 338 end
Nenue@0 339 return module
Nenue@0 340 end
Nenue@0 341
Nenue@0 342
Nenue@0 343 B.SetConfigLayers = function(frame)
Nenue@0 344 local print = B.fprint()
Nenue@0 345 if not frame.config then
Nenue@24 346 --print(frame:GetName(), 'has no config layers')
Nenue@0 347 return
Nenue@0 348 end
Nenue@24 349 --print('Registering config layers from', frame:GetName())
Nenue@0 350
Nenue@0 351 for i, subframe in ipairs(frame.config) do
Nenue@0 352 -- make sure there are no duplicates
Nenue@0 353 if not refs[subframe] then
Nenue@0 354 local key = #layers+1
Nenue@0 355 layers[key] = subframe
Nenue@0 356 refs[subframe] = key
Nenue@0 357 end
Nenue@24 358 --print(' ', i, subframe:GetName())
Nenue@0 359 end
Nenue@0 360 end
Nenue@0 361
Nenue@0 362 B.RemoveConfigLayers = function(frame)
Nenue@3 363
Nenue@0 364 local print = B.fprint()
Nenue@0 365 print('|cFFFF0000RemoveConfigLayers', frame:GetName())
Nenue@0 366 for i, subframe in pairs(layers) do
Nenue@0 367 if subframe:GetParent() == frame then
Nenue@0 368 print('|cFFFF8800 ', subframe:GetParent():GetName(), '|cFFFFFF00', subframe:GetName())
Nenue@0 369 layers[i]:Hide()
Nenue@0 370 layers[i] = nil
Nenue@0 371 refs[subframe] = nil
Nenue@0 372 end
Nenue@0 373 end
Nenue@0 374 end
Nenue@0 375
Nenue@48 376 B.ToggleGuideLayers = function()
Nenue@0 377 local print = B.fprint()
Nenue@0 378 local func = B.Conf.GuidesMode and 'Show' or 'Hide'
Nenue@0 379 local numAnchors = 0
Nenue@0 380
Nenue@0 381 for id, region in pairs(layers) do
Nenue@44 382 --print(id, region:GetName(), func)
Nenue@0 383 region[func](region)
Nenue@0 384 end
Nenue@0 385
Nenue@44 386 --print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames')
Nenue@3 387 end
Nenue@48 388 B.UpdateConfigLayers = function()
Nenue@48 389 print('|cFFFF0000', debugstack())
Nenue@48 390 B.ToggleGuideLayers()
Nenue@48 391 end
Nenue@3 392
Nenue@38 393 local XMLFrame_Enable = function(self, value)
Nenue@24 394 local name = self:GetName()
Nenue@44 395 local print = B.print('XML')
Nenue@24 396
Nenue@24 397 if not B.Conf[name] then
Nenue@24 398 B.Conf[name] = {
Nenue@24 399 enabled = true
Nenue@24 400 }
Nenue@24 401 end
Nenue@24 402
Nenue@24 403 print()
Nenue@24 404 local enabled
Nenue@24 405 if value == nil then
Nenue@24 406 if B.Conf[name].enabled == nil then
Nenue@24 407 print('toggle based on visibility')
Nenue@24 408 enabled = (not self:IsVisible()) and true or false
Nenue@24 409 else
Nenue@24 410 print('toggle a config value =', B.Conf[name].enabled)
Nenue@24 411 enabled = B.Conf[name].enabled
Nenue@24 412 end
Nenue@24 413
Nenue@24 414 enabled = (enabled ~= true) and true or false
Nenue@24 415 else
Nenue@24 416 print('use argument value', value)
Nenue@24 417 enabled = value
Nenue@24 418 end
Nenue@24 419
Nenue@24 420 print('arg =', value, 'conf =', B.Conf[name].enabled, 'result=', enabled)
Nenue@24 421
Nenue@24 422 B.Conf[name].enabled = enabled
Nenue@24 423
Nenue@24 424 local stateFunc = enabled and 'Show' or 'Hide'
Nenue@24 425 local eventFunc = enabled and 'OnToggle' or 'OnToggle'
Nenue@47 426 --- taggled layers
Nenue@47 427 if self.toggled then
Nenue@47 428 for i, region in pairs(self.toggled) do
Nenue@47 429 region[stateFunc](region)
Nenue@47 430 end
Nenue@24 431 end
Nenue@47 432 --- toggle action
Nenue@24 433 if self.OnToggle then
Nenue@24 434 self:OnToggle(B.Conf[name].enabled)
Nenue@24 435 end
Nenue@47 436 --- do enable
Nenue@24 437 if B.Conf[name].enabled then
Nenue@24 438 if self.OnEnable then
Nenue@24 439 self:OnEnable()
Nenue@24 440 end
Nenue@24 441 else
Nenue@24 442 if self.OnDisable then
Nenue@24 443 self:OnDisable()
Nenue@24 444 end
Nenue@24 445 end
Nenue@24 446 end
Nenue@3 447 --- Generic handlers for keeping track of XML-defined frames
Nenue@44 448 local print = B.print('XML')
Nenue@47 449 B.prototypes = {}
Nenue@47 450 B.prototypes.OnDragStart = function(self)
Nenue@44 451 local print = B.print('XML')
Nenue@3 452 self.xA = self:GetLeft()
Nenue@3 453 self.yA = self:GetBottom()
Nenue@3 454 self.anchorTo, self.relativeTo, self.relativePoint, self.x, self.y = self:GetPoint(1)
Nenue@3 455 print('acquire anchor', self:GetPoint(1))
Nenue@3 456 print(self:GetName(), 'start moving ('..self.x..', '..self.y..')')
Nenue@3 457 self:StartMoving()
Nenue@3 458 end
Nenue@3 459
Nenue@47 460 B.prototypes.OnDragStop = function(self)
Nenue@44 461 local print = B.print('XML')
Nenue@24 462 local name = self:GetName()
Nenue@24 463 print(name, 'stop moving ('..self:GetLeft()..', '..self:GetBottom()..')')
Nenue@3 464 local xB = self:GetLeft() - self.xA
Nenue@3 465 local yB = self:GetBottom() - self.yA
Nenue@3 466 print('storing anchor point', self.anchorTo, self.relativePoint, self.x + xB, self.y + yB)
Nenue@3 467
Nenue@3 468 self:StopMovingOrSizing()
Nenue@24 469 B.Conf[name].position = {self.anchorTo, self.relativePoint, self.x + xB, self.y + yB}
Nenue@38 470 B.UpdateXMLFrame(self)
Nenue@38 471 end
Nenue@38 472
Nenue@47 473
Nenue@38 474 B.RegisterModuleFrame = function(self, moduleName)
Nenue@44 475 local print = B.print('XML')
Nenue@47 476 local name = self:GetName()
Nenue@38 477 tinsert(checkForConfig, self)
Nenue@38 478 self.Enable = XMLFrame_Enable
Nenue@38 479 self.moduleName = moduleName
Nenue@44 480 print('|cFF00FF00XML stuff related to '.. tostring(moduleName) .. ':', self:GetName())
Nenue@47 481 ------------------------------------------------------------------------------------------
Nenue@47 482 if not B[name] then
Nenue@47 483 return
Nenue@47 484 end
Nenue@47 485
Nenue@47 486 local scriptTypes = {'OnUpdate', 'OnEvent', 'OnDragStart', 'OnDragStop'}
Nenue@47 487 for script in next(scriptTypes) do
Nenue@47 488 if B[name][script] then
Nenue@47 489 self:SetScript(script, B[name][script])
Nenue@47 490 end
Nenue@47 491 end
Nenue@47 492
Nenue@38 493 end
Nenue@49 494 local XMLFrame_OnDragStart = function() end
Nenue@49 495 local XMLFrame_OnDragStop = function() end
Nenue@38 496
Nenue@38 497 B.UpdateXMLFrame = function(self)
Nenue@44 498 local print = B.print('XML')
Nenue@38 499
Nenue@38 500 local name = self:GetName()
Nenue@38 501
Nenue@38 502
Nenue@38 503 if self.drag then
Nenue@38 504 self:RegisterForDrag('LeftButton')
Nenue@38 505 self:SetScript('OnDragStart', XMLFrame_OnDragStart)
Nenue@38 506 if self.OnDragStop then
Nenue@38 507 self:SetScript('OnDragStop', function(self, ...)
Nenue@44 508 print('|cFFFF0088end of dragging')
Nenue@38 509 self:OnDragStop(self, ...)
Nenue@38 510 XMLFrame_OnDragStop(self, ...)
Nenue@38 511 end)
Nenue@38 512 else
Nenue@38 513 self:SetScript('OnDragStop', XMLFrame_OnDragStop)
Nenue@38 514 end
Nenue@38 515 else
Nenue@38 516 self:EnableMouse(false)
Nenue@38 517 end
Nenue@38 518
Nenue@38 519 if not B.Conf[name] then
Nenue@38 520 B.Conf[name] = {
Nenue@38 521 enabled = self.enabled,
Nenue@38 522 }
Nenue@38 523 end
Nenue@38 524 local c = B.Conf[name]
Nenue@38 525
Nenue@38 526 if not c.position then
Nenue@47 527 local anchor, _, point, x, y = self:GetPoint(1)
Nenue@47 528 print('seeding default position', anchor, point, x, y)
Nenue@47 529 c.position = {anchor, point, x, y}
Nenue@38 530 else
Nenue@38 531
Nenue@38 532 print('restoring frame position', unpack(c.position))
Nenue@38 533 self:ClearAllPoints()
Nenue@38 534 local anchorTo, relativePoint, x, y = unpack(c.position)
Nenue@38 535 self:SetPoint(anchorTo, UIParent, relativePoint, x, y)
Nenue@38 536 end
Nenue@38 537 self:Enable(c.enabled)
Nenue@38 538
Nenue@38 539
Nenue@38 540 end