Mercurial > wow > buffalo2
comparison ObjectiveTracker/Layout.lua @ 44:756e8aeb040b
- Default.lua
- simplified the response to SuperTrackedQuestID changes
- tag icons work again
| author | Nenue |
|---|---|
| date | Mon, 25 Apr 2016 19:37:13 -0400 |
| parents | 9480bd904f4c |
| children | dd1ae565f559 |
comparison
equal
deleted
inserted
replaced
| 43:9480bd904f4c | 44:756e8aeb040b |
|---|---|
| 238 local print = bprint | 238 local print = bprint |
| 239 local tracker = self.frame | 239 local tracker = self.frame |
| 240 local info = block.info | 240 local info = block.info |
| 241 | 241 |
| 242 block.index = blockIndex | 242 block.index = blockIndex |
| 243 -- if animating, skip this segment | 243 print('blockschema', blockSchema, block.schema) |
| 244 if not block.isAnimating then | 244 if blockSchema ~= block.schema then |
| 245 print('blockschema', blockSchema, block.schema) | 245 T.UpdateSchema('block', block.schema) |
| 246 if blockSchema ~= block.schema then | 246 print(' ### activating block schema:|cFF0088FF', block.schema) |
| 247 T.UpdateSchema('block', block.schema) | 247 end |
| 248 print(' ### activating block schema:|cFF0088FF', block.schema) | 248 |
| 249 end | 249 block:SetWidth(T.Conf.Wrapper.Width) |
| 250 | 250 block.title:SetSpacing(titleSpacing) |
| 251 block:SetWidth(T.Conf.Wrapper.Width) | 251 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) |
| 252 block.title:SetSpacing(titleSpacing) | 252 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) |
| 253 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) | 253 block.title:SetTextColor(unpack(titleColor)) |
| 254 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) | 254 block.titlebg:SetTexture(1,1,1,1) |
| 255 block.title:SetTextColor(unpack(titleColor)) | 255 block.titlebg:SetGradientAlpha(unpack(titlebg)) |
| 256 block.titlebg:SetTexture(1,1,1,1) | 256 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) |
| 257 block.titlebg:SetGradientAlpha(unpack(titlebg)) | 257 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) |
| 258 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) | 258 block.status:SetSpacing(textSpacing) |
| 259 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) | 259 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) |
| 260 block.status:SetSpacing(textSpacing) | 260 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) |
| 261 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) | 261 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) |
| 262 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) | 262 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) |
| 263 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) | 263 block.statusbg:SetTexture(1,1,1,1) |
| 264 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) | 264 block.statusbg:SetGradientAlpha(unpack(textbg)) |
| 265 block.statusbg:SetTexture(1,1,1,1) | 265 block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) |
| 266 block.statusbg:SetGradientAlpha(unpack(textbg)) | 266 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) |
| 267 block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) | 267 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') |
| 268 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) | 268 |
| 269 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') | 269 |
| 270 | 270 local titleHeight = floor(block.title:GetHeight()+.5) |
| 271 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 | 271 local titlebgHeight = titleHeight + titleSpacing*2 |
| 272 for i, tile in ipairs(block.rewardTile) do | 272 block.titlebg:SetHeight(titlebgHeight) |
| 273 --print(rewardSize) | 273 |
| 274 tile:SetSize(rewardSize, rewardSize) | 274 local statusHeight = floor(block.status:GetHeight()+.5) |
| 275 tile:ClearAllPoints() | 275 local statusbgHeight = statusHeight + textSpacing*2 |
| 276 tile:SetPoint(anchor, target, point, x, y) | 276 local attachmentHeight =floor(block.attachmentHeight + .5) |
| 277 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) | 277 |
| 278 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 | 278 if attachmentHeight > 0 then |
| 279 end | 279 attachmentHeight = attachmentHeight + textSpacing |
| 280 | 280 end |
| 281 | 281 |
| 282 local titleHeight = floor(block.title:GetHeight()+.5) | 282 block.height = titlebgHeight + attachmentHeight |
| 283 local titlebgHeight = titleHeight + titleSpacing*2 | 283 block:SetHeight(block.height) |
| 284 block.titlebg:SetHeight(titlebgHeight) | 284 |
| 285 | 285 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 |
| 286 local statusHeight = floor(block.status:GetHeight()+.5) | 286 for i, tile in ipairs(block.rewardTile) do |
| 287 local statusbgHeight = statusHeight + textSpacing*2 | 287 --print(rewardSize) |
| 288 local attachmentHeight =floor(block.attachmentHeight + .5) | 288 tile:SetSize(rewardSize, rewardSize) |
| 289 | 289 tile:ClearAllPoints() |
| 290 self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName()) | 290 tile:SetPoint(anchor, target, point, x, y) |
| 291 self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')') | 291 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) |
| 292 if attachmentHeight > 0 then | 292 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 |
| 293 attachmentHeight = attachmentHeight + textSpacing | 293 end |
| 294 end | 294 |
| 295 | 295 self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName()) |
| 296 block.height = titlebgHeight + attachmentHeight | 296 self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')') |
| 297 block:SetHeight(block.height) | |
| 298 end | |
| 299 | |
| 300 if block.debug then | 297 if block.debug then |
| 301 local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide' | 298 local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide' |
| 302 for _, region in ipairs(block.debug) do | 299 for _, region in ipairs(block.debug) do |
| 303 region[func]() | 300 region[func]() |
| 304 end | 301 end |
| 327 block:Show() | 324 block:Show() |
| 328 | 325 |
| 329 | 326 |
| 330 if Devian and Devian.InWorkspace() then | 327 if Devian and Devian.InWorkspace() then |
| 331 block.DebugTab:SetParent(UIParent) | 328 block.DebugTab:SetParent(UIParent) |
| 332 block.DebugTab:SetPoint('TOPRIGHT', block, 'TOPLEFT', 0, 0) | 329 block.DebugTab:SetPoint('RIGHT', block.titlebg, 'LEFT', 0, 0) |
| 333 block.DebugTab.status:SetText(tostring(block.schema) .. ' @|cFF00FF00' .. tostring(block.posIndex) .. '|r #|cFFFFFF00'.. tostring(info.logIndex or info.id) .. '|r'.. | 330 block.DebugTab.status:SetText(tostring(block.schema) .. ' @|cFF00FF00' .. tostring(block.posIndex) .. '|r #|cFFFFFF00'.. tostring(info.logIndex or info.id) .. '|r'.. |
| 334 ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r') | 331 ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r ' .. (info.statusKey or '')) |
| 335 block.DebugTab:Show() | 332 block.DebugTab:Show() |
| 336 end | 333 end |
| 337 end | 334 end |
| 338 | 335 |
| 336 | |
| 337 local tagOrder = {'completion', 'frequency', 'type'} | |
| 339 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) | 338 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) |
| 340 Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) | 339 Default.AddTags = function (handler, block, tagInfo, tagCoords) |
| 341 local print = bprint | 340 local print = bprint |
| 342 | 341 |
| 343 for order, tagName in ipairs(block.info.tagInfo) do | 342 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT' |
| 344 local tag = block[tagName] | 343 handler.print('AddTag', block:GetName(), tagInfo, tagCoords) |
| 345 if block.tagCoords[tagName] and tag then | 344 for order, key in ipairs(tagOrder) do |
| 346 tag:SetTexCoord(unpack(block.tagCoords[tagName])) | 345 local tag = block[key .. 'Tag'] |
| 346 if tag and tagInfo[key] then | |
| 347 tag:SetTexCoord(unpack(tagInfo[key])) | |
| 347 tag:Show() | 348 tag:Show() |
| 348 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) | 349 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) |
| 349 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' | 350 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' |
| 350 else | 351 else |
| 351 block[tagName]:Hide() | 352 block[key .. 'Tag']:Hide() |
| 352 end | 353 end |
| 353 end | 354 end |
| 354 | 355 |
| 355 return tagPoint, tagAnchor, tagRelative | 356 return tagPoint, tagAnchor, tagRelative |
| 356 end | 357 end |
