comparison Veneer.lua @ 97:5476337198ec

- apply default anchors when docking modules - Arifact Power tracker: totals AP items in bags and bank, and forecasts progress on each weapon. Requires user to shift-click each weapon at least once to get initial XP data.
author Nenue
date Mon, 16 Jan 2017 20:24:12 -0500
parents df10cd0ae949
children dadddb8a551f
comparison
equal deleted inserted replaced
96:bb38bc0e787f 97:5476337198ec
109 end 109 end
110 110
111 local select, IsAddOnLoaded, IsLoggedIn = select, IsAddOnLoaded, IsLoggedIn 111 local select, IsAddOnLoaded, IsLoggedIn = select, IsAddOnLoaded, IsLoggedIn
112 112
113 function VeneerCore:OnEvent(event, ...) 113 function VeneerCore:OnEvent(event, ...)
114 print(event, ...) 114 print('|cFFFF0088OnEvent()|r',event, ...)
115 if event == 'ADDON_LOADED' or event == 'PLAYER_LOGIN' then 115 if event == 'PLAYER_LOGIN' then
116 print(IsLoggedIn(), self.initialized) 116 print(IsLoggedIn(), self.initialized)
117 if IsLoggedIn() and not self.intialized then 117 if IsLoggedIn() and not self.intialized then
118 self:Setup() 118 self:Setup()
119 self.intialized = true 119 self.intialized = true
120 print('popping init sequence', self.intialized) 120 print('popping init sequence', self.intialized)
149 function VeneerCore:OnDragStop() 149 function VeneerCore:OnDragStop()
150 self:StopMovingOrSizing() 150 self:StopMovingOrSizing()
151 end 151 end
152 152
153 local VeneerModule_Setup = function(frame) 153 local VeneerModule_Setup = function(frame)
154 if (not frame.addonTrigger) or select(2,IsAddOnLoaded(frame.addonTrigger)) then 154 if not frame.initialized then
155 if not frame.initialized then 155 local doSetup = (not frame.addonTrigger) or select(2, IsAddOnLoaded(frame.addonTrigger))
156 print(' '..frame:GetName()..'.doSetup =', doSetup)
157 if doSetup then
156 frame:Setup() 158 frame:Setup()
157 frame.initialized = true 159 frame.initialized = true
158 end 160 end
161
159 end 162 end
160 end 163 end
161 164
162 function VeneerCore:Setup () 165 function VeneerCore:Setup ()
166 print('|cFFFF0088Setup()|r')
163 local resetConfig = (not VeneerData) 167 local resetConfig = (not VeneerData)
164 if (not VeneerData) then 168 if (not VeneerData) then
165 VeneerData = defaults 169 VeneerData = defaults
166 VeneerData.version = VENEER_VERSION 170 VeneerData.version = VENEER_VERSION
167 end 171 end
226 elseif argType == 'boolean' then 230 elseif argType == 'boolean' then
227 insertPosition = 1 231 insertPosition = 1
228 end 232 end
229 end 233 end
230 if not primaryAnchor then 234 if not primaryAnchor then
231 primaryAnchor = 'TOPLEFT' 235 primaryAnchor = 'CENTER'
236 clusterTable[primaryAnchor] = clusterTable[primaryAnchor] or {}
237 clusterTable = clusterTable[primaryAnchor]
232 end 238 end
233 if not insertPosition then 239 if not insertPosition then
234 insertPosition = #clusterTable + 1 240 insertPosition = #clusterTable + 1
235 end 241 end
236 return primaryAnchor, clusterTable, insertPosition 242 return primaryAnchor, clusterTable, insertPosition
237 end 243 end
238 244
239 function VeneerCore:AddHandler(handler, ...) 245 function VeneerCore:AddHandler(handler, ...)
240 print('*** Adding handler:', handler.moduleName or handler:GetName()) 246 print('|cFFFFFF00*** Adding handler:', handler.moduleName or handler:GetName())
241 247
242 248
243 local anchorGroup, clusterTable, clusterIndex = self:GetClusterFromArgs(...) 249 local anchorGroup, clusterTable, clusterIndex = self:GetClusterFromArgs(...)
244 if clusterIndex == 1 then 250 if clusterIndex == 1 then
245 for i, frame in ipairs(clusterTable) do 251 for i, frame in ipairs(clusterTable) do
246 frame.clusterIndex = i + 1 252 frame.clusterIndex = i + 1
247 end 253 end
248 end 254 end
249 tinsert(clusterTable, clusterIndex, handler) 255 tinsert(clusterTable, clusterIndex, handler)
250 256
251 print('cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex) 257 print(' cluster', anchorGroup, 'table', clusterTable, 'position', clusterIndex)
252 258
253 handler.anchorCluster = clusterTable 259 handler.anchorCluster = clusterTable
254 handler.anchorIndex = clusterIndex 260 handler.anchorIndex = clusterIndex
255 for k,v in pairs(VeneerHandlerMixin) do 261 for k,v in pairs(VeneerHandlerMixin) do
256 if not handler[k] then 262 if not handler[k] then
312 for index, frame in ipairs(cluster) do 318 for index, frame in ipairs(cluster) do
313 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) 319 print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent'))
314 if frame:IsVisible() then 320 if frame:IsVisible() then
315 321
316 if frame.anchorFrame then 322 if frame.anchorFrame then
323 print(frame.anchorPoint)
317 frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY) 324 frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY)
318 print(frame:GetTop(), frame:GetRight()) 325 print(frame:GetTop(), frame:GetRight())
319 else 326 else
320 anchorPoint = frame.anchorPoint 327 anchorPoint = frame.anchorPoint or anchorPoint
321 frame:ClearAllPoints() 328 frame:ClearAllPoints()
322 if lastFrame then 329 if lastFrame then
323 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0) 330 frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0)
324 else 331 else
325 frame:SetPoint(anchorPoint, UIParent, anchorPoint, frame.anchorX, frame.anchorY) 332 frame:SetPoint(anchorPoint, UIParent, anchorPoint, frame.anchorX, frame.anchorY)
407 if self.parserDepth > 1 then 414 if self.parserDepth > 1 then
408 tinsert(self.pendingCalls, method) 415 tinsert(self.pendingCalls, method)
409 print('delaying walk for', method) 416 print('delaying walk for', method)
410 return 417 return
411 end 418 end
412 print('|cFF00FF00Veneer:ExecuteOnClusters|r('..tostring(layer)..', '..tostring(method)..')') 419 print('|cFF00FF00ExecuteOnClusters|r('..tostring(layer)..', '..tostring(method)..')')
413 else 420 else
414 print(' Level '..self.parserDepth) 421 print(' Level '..self.parserDepth)
415 end 422 end
416 423
417 layer = layer or self.FrameClusters 424 layer = layer or self.FrameClusters