Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
121:1f68c46bc4de | 122:ea2c616a3b4f |
---|---|
2 -- 1. vn OnLoad | 2 -- 1. vn OnLoad |
3 -- 2. OnEvent where IsLoggedIn() == true | 3 -- 2. OnEvent where IsLoggedIn() == true |
4 -- 3. Setup() where (not self.initialized) | 4 -- 3. Setup() where (not self.initialized) |
5 -- 4. Update() | 5 -- 4. Update() |
6 -- 5. Reanchor() | 6 -- 5. Reanchor() |
7 local ADDON, Veneer = ... | 7 local ADDON, addon = ... |
8 local VENEER_VERSION = 703 | 8 local VENEER_VERSION = 703 |
9 local LE_FREE_FRAMES_GROUP = 1 | 9 local LE_FREE_FRAMES_GROUP = 1 |
10 local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select | 10 local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select |
11 local pairs, tremove = pairs, tremove | 11 local pairs, tremove = pairs, tremove |
12 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop | 12 local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop |
13 local eprint = DEVIAN_WORKSPACE and function(...) _G.print('VeneerEvent', ...) end or nop | 13 local eprint = DEVIAN_WORKSPACE and function(...) _G.print('VeneerEvent', ...) end or nop |
14 local wipe = table.wipe | 14 local wipe = table.wipe |
15 VeneerCore = {} | |
16 local Veneer = VeneerCore | |
15 | 17 |
16 SLASH_VENEER1 = "/veneer" | 18 SLASH_VENEER1 = "/veneer" |
17 SLASH_VENEER2 = "/vn" | 19 SLASH_VENEER2 = "/vn" |
18 SlashCmdList.VENEER = function(cmd) | 20 SlashCmdList.VENEER = function(cmd) |
19 if Veneer.ConfigMode then | 21 _G.Veneer:print(_G.Veneer.ConfigMode) |
20 Veneer.ConfigMode = false | 22 if _G.Veneer.ConfigMode == true then |
23 _G.Veneer.ConfigMode = false | |
21 else | 24 else |
22 Veneer.ConfigMode = true | 25 _G.Veneer.ConfigMode = true |
23 end | 26 end |
24 Veneer:UpdateConfigLayers() | 27 _G.Veneer:UpdateConfigLayers() |
25 end | 28 end |
29 | |
26 | 30 |
27 Veneer.modules = {} | 31 Veneer.modules = {} |
28 Veneer.Frames = {} | 32 Veneer.Frames = {} |
29 Veneer.ConfigLayers = {} | 33 Veneer.ConfigLayers = {} |
30 Veneer.FrameClusters = { | 34 Veneer.FrameClusters = { |
174 end | 178 end |
175 end | 179 end |
176 | 180 |
177 function Veneer:Setup () | 181 function Veneer:Setup () |
178 print('|cFFFF0088Setup()|r') | 182 print('|cFFFF0088Setup()|r') |
179 local resetConfig = (not VeneerData) | |
180 if (not VeneerData) then | 183 if (not VeneerData) then |
184 print('|cFF00FFFFresetting defaults|r') | |
181 VeneerData = defaults | 185 VeneerData = defaults |
182 VeneerData.version = VENEER_VERSION | 186 VeneerData.version = VENEER_VERSION |
183 end | 187 end |
184 self.data = VeneerData | 188 self.data = VeneerData |
185 self:ExecuteOnClusters(nil, VeneerModule_Setup) | 189 self:ExecuteOnClusters(nil, VeneerModule_Setup) |
186 | 190 |
187 self.ConfigMode = VeneerData.ConfigMode | 191 self.ConfigMode = VeneerData.ConfigMode |
192 print('|cFF00FF88configMode =', self.ConfigMode) | |
188 self:UpdateConfigLayers() | 193 self:UpdateConfigLayers() |
189 self:Reanchor() | 194 self:Reanchor() |
190 self:Update() | 195 self:Update() |
191 end | 196 end |
192 | 197 |
193 function Veneer:UpdateConfigLayers() | 198 function Veneer:UpdateConfigLayers() |
194 if VeneerData then | 199 if VeneerData then |
195 | |
196 VeneerData.ConfigMode = self.ConfigMode | 200 VeneerData.ConfigMode = self.ConfigMode |
197 end | 201 end |
198 | 202 |
199 self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'.') | 203 self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'. ', tostring(self.ConfigMode)) |
200 self:ExecuteOnClusters(nil, function(frame) | 204 self:ExecuteOnClusters(nil, function(frame) |
201 if frame.UpdateConfigLayers then | 205 if frame.UpdateConfigLayers then |
202 frame:UpdateConfigLayers(self.ConfigMode) | 206 frame:UpdateConfigLayers(self.ConfigMode) |
203 end | 207 end |
204 | 208 |
244 | 248 |
245 self.modules[handler] = handler | 249 self.modules[handler] = handler |
246 | 250 |
247 if not handler.anchorFrame then | 251 if not handler.anchorFrame then |
248 | 252 |
249 local primaryAnchor = handler.anchorPoint or 'CENTER' | 253 local clusterAnchor = handler.anchorGroup or handler.anchorPoint or 'CENTER' |
250 local clusterPriority = handler.anchorPriority | 254 local clusterPriority = handler.anchorPriority |
251 self.FrameClusters[primaryAnchor] = self.FrameClusters[primaryAnchor] or {} | 255 print('panel group =', clusterAnchor) |
252 local clusterTable = self.FrameClusters[primaryAnchor] | 256 |
257 self.FrameClusters[clusterAnchor] = self.FrameClusters[clusterAnchor] or {} | |
258 local clusterTable = self.FrameClusters[clusterAnchor] | |
253 local clusterIndex | 259 local clusterIndex |
254 | 260 |
255 if clusterPriority then | 261 if clusterPriority then |
256 for i = 1, #clusterTable do | 262 for i = 1, #clusterTable do |
257 | 263 |
273 clusterIndex = #clusterTable + 1 | 279 clusterIndex = #clusterTable + 1 |
274 end | 280 end |
275 | 281 |
276 | 282 |
277 tinsert(clusterTable, clusterIndex, handler) | 283 tinsert(clusterTable, clusterIndex, handler) |
278 print(' cluster', (clusterDepth or 1) .. '.' .. primaryAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex) | 284 print(' cluster', clusterAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex) |
279 | 285 |
280 handler.anchorCluster = clusterTable | 286 handler.anchorCluster = clusterTable |
281 handler.anchorIndex = clusterIndex | 287 handler.anchorIndex = clusterIndex |
282 else | 288 else |
283 local clusterTable = self.FrameClusters[LE_FREE_FRAMES_GROUP] | 289 local clusterTable = self.FrameClusters[LE_FREE_FRAMES_GROUP] |
335 -- Recursives updates frame group anchors | 341 -- Recursives updates frame group anchors |
336 function Veneer:EvaluateAnchors(parent) | 342 function Veneer:EvaluateAnchors(parent) |
337 parent = parent or self | 343 parent = parent or self |
338 local print = eprint | 344 local print = eprint |
339 print('|cFF88FF00DynamicReanchor()') | 345 print('|cFF88FF00DynamicReanchor()') |
340 for anchorPoint, cluster in pairs(parent.FrameClusters) do | 346 for clusterPoint, cluster in pairs(parent.FrameClusters) do |
341 if anchorPoint ~= LE_FREE_FRAMES_GROUP then | 347 print(clusterPoint) |
348 if clusterPoint ~= LE_FREE_FRAMES_GROUP then | |
342 local lastFrame | 349 local lastFrame |
343 for index, frame in ipairs(cluster) do | 350 for index, frame in ipairs(cluster) do |
344 print(' |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) | 351 print(' |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) |
345 if frame:IsShown() then | 352 if frame:IsShown() then |
346 | 353 |
347 if frame.anchorFrame then | 354 if frame.anchorFrame then |
348 print(frame.anchorPoint) | 355 print(frame.anchorPoint) |
349 frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY) | 356 frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY) |
350 print('anchored to', frame.anchorFrame,frame:GetTop(), frame:GetRight()) | 357 print('anchored to', frame.anchorFrame,frame:GetTop(), frame:GetRight()) |
351 else | 358 else |
352 anchorPoint = frame.anchorPoint or anchorPoint | 359 local anchorPoint = frame.anchorPoint or clusterPoint |
360 local anchorFrom = frame.anchorFrom or ANCHOR_OFFSET_POINT[clusterPoint] | |
353 frame:ClearAllPoints() | 361 frame:ClearAllPoints() |
354 if lastFrame then | 362 if lastFrame then |
355 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0) | 363 frame:SetPoint(anchorPoint, lastFrame, anchorFrom, 0, 0) |
356 | 364 |
357 print('moved after', lastFrame,frame:GetTop(), frame:GetRight()) | 365 print(' fixing to', lastFrame, anchorPoint, anchorFrom, frame:GetTop(), frame:GetRight()) |
358 else | 366 else |
359 frame:SetPoint(anchorPoint, UIParent, anchorPoint, frame.anchorX, frame.anchorY) | 367 frame:SetPoint(anchorPoint, UIParent, clusterPoint, frame.anchorX, frame.anchorY) |
360 print('stub', anchorPoint, frame.anchorX, frame.anchorY) | 368 print('NEW', clusterPoint, anchorPoint, anchorFrom, frame.anchorX, frame.anchorY) |
361 end | 369 end |
362 lastFrame = frame | 370 lastFrame = frame |
363 end | 371 end |
364 | 372 |
365 end | 373 end |
505 veneer.currentTop = frame:GetTop() | 513 veneer.currentTop = frame:GetTop() |
506 self.Frames[frame] = veneer | 514 self.Frames[frame] = veneer |
507 end | 515 end |
508 return veneer | 516 return veneer |
509 end | 517 end |
510 | |
511 VeneerCore = Veneer |