annotate ObjectiveStyle.lua @ 14:ed642234f017

ObjectiveFrame - implement proper tracker name text - expanded tracker prototypes to cover "objective lines" formatting and accommodation of widget variables - implement the progress bars for bonus objectives ObjectiveStyle - moved `UpdateWrapperStyle` over and renamed it to fit semantics - change the formula for block.`height` to measure non-widget content only - allows widgets to position relative to text - size FontString `status` to match block.`height` - full block height is acquired by adding block.`height` and block.`attachmentHeight` which is calculated during objective parsing ObjectiveWidgets - use string keys for generated widgets to deal with multiple objectives under the same questID, and maybe dungeon objectives - wrapper buttons use a common code path - specialized handlers for wheel scrolling moved over to fit semantics
author Nenue
date Mon, 04 Apr 2016 03:16:22 -0400
parents 9455693fc290
children 880828018bf4
rev   line source
Nenue@10 1 local B = select(2,...).frame
Nenue@10 2 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@10 3 local print = B.print('SetStyle')
Nenue@10 4 -------------------------------------------------------------
Nenue@10 5 --- Deals with swapping between different color palettes
Nenue@10 6 ---
Nenue@10 7
Nenue@10 8 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
Nenue@14 9 local titleSize, textSize = 16, 15
Nenue@10 10 local titleOutline, textOutline = "OUTLINE", "OUTLINE"
Nenue@14 11 local titleSpacing, textSpacing = 3, 1
Nenue@13 12 local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat
Nenue@10 13 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
Nenue@14 14 local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24
Nenue@14 15 local headerOutline, headerSpacing = 'OUTLINE', 2
Nenue@10 16
Nenue@13 17
Nenue@14 18 mod.defaults.Wrapper = {
Nenue@14 19 WrapperPoint = 'TOPRIGHT',
Nenue@14 20 WrapperFloatX = -25,
Nenue@14 21 WrapperFloatV = 'TOP',
Nenue@14 22 WrapperFloatY = -200,
Nenue@14 23
Nenue@14 24 WrapperWidth = 270,
Nenue@14 25 WrapperHeight = 600,
Nenue@10 26 }
Nenue@14 27 mod.defaults.Tracker = {
Nenue@14 28 HeaderHeight = 24,
Nenue@14 29 }
Nenue@14 30
Nenue@10 31 mod.defaults.Style = {
Nenue@13 32 Format = {
Nenue@13 33 Frame = {
Nenue@13 34 Width = 270,
Nenue@13 35 },
Nenue@13 36 title = {
Nenue@14 37 Indent = 0,
Nenue@14 38 Spacing = 0,
Nenue@13 39 },
Nenue@13 40 status = {
Nenue@14 41 Indent = 5,
Nenue@14 42 Spacing = 0,
Nenue@13 43 }
Nenue@13 44 },
Nenue@13 45 FontBank = {
Nenue@10 46 ['Normal'] = _G.VeneerCriteriaFontNormal,
Nenue@10 47 ['Progress'] = _G.VeneerCriteriaFontProgress,
Nenue@10 48 ['Complete'] = _G.VeneerCriteriaFontComplete,
Nenue@10 49 ['Failed'] = _G.VeneerCriteriaFontFailed,
Nenue@10 50 },
Nenue@10 51 Normal = {
Nenue@10 52 title = {
Nenue@10 53 TextColor = {1, 1, 1, 1},
Nenue@10 54 Width = 270,
Nenue@14 55 Spacing = 0,
Nenue@14 56 Indent = 2,
Nenue@10 57 },
Nenue@10 58 titlebg = {
Nenue@10 59 Background = {0, 0, 0, 1},
Nenue@10 60 Width = 270,
Nenue@10 61 },
Nenue@10 62 status = {
Nenue@10 63 Width = 270,
Nenue@14 64 Spacing = 0,
Nenue@10 65 },
Nenue@10 66 statusbg = {
Nenue@10 67 Width = 270,
Nenue@10 68 },
Nenue@10 69 Frame = {
Nenue@10 70 Width = 270,
Nenue@10 71 }
Nenue@10 72 },
Nenue@10 73 Wrapper = {
Nenue@10 74 Frame = {
Nenue@10 75 BackgroundComplex = {Left = {'', 0, 0.4, 0,1, 100}, Right={'', 0.6,1,0,1}, Tile = {'', 0.4,.6,0,1, 100}}, },
Nenue@10 76 title = {
Nenue@10 77 Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline},
Nenue@10 78 Spacing = 4,}
Nenue@10 79 },
Nenue@10 80 Tracker = {
Nenue@10 81 Normal = {
Nenue@10 82 title = {
Nenue@10 83 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
Nenue@14 84 Indent = 2,
Nenue@14 85 TextColor = {1, .9, .2, 1},
Nenue@10 86 },
Nenue@10 87 titlebg = {
Nenue@14 88 Gradient = {MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
Nenue@10 89 }
Nenue@10 90 }
Nenue@10 91 },
Nenue@10 92 TrackerBlock = {
Nenue@10 93 Normal = {
Nenue@10 94 titlebg = {
Nenue@14 95 Indent = 2,
Nenue@14 96 Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}},
Nenue@10 97 },
Nenue@10 98 title = {
Nenue@14 99 TextColor = {1,1,1,0.5},
Nenue@10 100 Font = {titleFont, titleSize, titleOutline},
Nenue@10 101 Spacing = titleSpacing,
Nenue@10 102 },
Nenue@10 103 status = {
Nenue@14 104 TextColor = {1,1,1,0.5},
Nenue@14 105 Font = {textFont, textSize, textOutline},
Nenue@14 106 Spacing = textSpacing,
Nenue@10 107 },
Nenue@10 108 statusbg = {
Nenue@14 109 Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
Nenue@10 110 }
Nenue@10 111 },
Nenue@10 112 Super = {
Nenue@10 113 title = {
Nenue@14 114 TextColor = {1,1,1,1},
Nenue@10 115 Font = {titleFont, titleSize, titleOutline},
Nenue@10 116 Spacing = titleSpacing, BackgroundFullWidth = true
Nenue@10 117 },
Nenue@10 118 titlebg = {
Nenue@14 119 Gradient = { MinColor = {0, .7, .6, .45}, MaxColor = {0, .7, .6, 0.23}},
Nenue@10 120 },
Nenue@10 121 status = {
Nenue@14 122 TextColor = {1,1,1,1},
Nenue@14 123 Font = {textFont, textSize, textOutline},
Nenue@14 124 Spacing = textSpacing,
Nenue@10 125 },
Nenue@10 126 statusbg = {
Nenue@14 127 Gradient = { MinColor = {0, .7, .6, 0.40}, MaxColor = {0, .7, .6, 0.23} },
Nenue@10 128 },
Nenue@10 129 },
Nenue@10 130 MouseDown = {
Nenue@10 131 title = {
Nenue@10 132 Font = {titleFont, titleSize, titleOutline},
Nenue@10 133 Spacing = titleSpacing,
Nenue@10 134 },
Nenue@10 135 titlebg = {
Nenue@10 136 Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .4}, },
Nenue@10 137 },
Nenue@10 138 status = {
Nenue@10 139 Font = {textFont, textSize, textOutline},
Nenue@10 140 Spacing = textSpacing,
Nenue@10 141 },
Nenue@10 142 statusbg = {
Nenue@10 143 Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .2}, },
Nenue@10 144 }
Nenue@10 145 },
Nenue@10 146 Complete = {
Nenue@10 147 title = {
Nenue@14 148 TextColor = {1,1,1,0.5},
Nenue@10 149 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
Nenue@10 150 },
Nenue@10 151 titlebg = {
Nenue@10 152 Gradient = { MinColor = {0, 1, 0, 0.34}, MaxColor = {0, 1, 0, .17}, },
Nenue@10 153 },
Nenue@10 154 status = {
Nenue@14 155 TextColor = {1,1,1,0.5},
Nenue@10 156 Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
Nenue@10 157 },
Nenue@10 158 statusbg = {
Nenue@10 159 Gradient = { MinColor = {0, 1, 0, .25}, MaxColor = {0, 1, 0, 0.12}, },
Nenue@10 160 }
Nenue@10 161 },
Nenue@13 162 Daily = {
Nenue@13 163 titlebg = {
Nenue@13 164 Gradient = { MinColor = {0, .4, 1, 0.34}, MaxColor = {0, 0.4, 1, .17}, },
Nenue@13 165 },
Nenue@13 166 statusbg = {
Nenue@13 167 Gradient = { MinColor = {0, .4, 1, 0.25}, MaxColor = {0, 0.4, 1, .12}, },
Nenue@13 168 },
Nenue@13 169 },
Nenue@10 170 Cheev = {
Nenue@10 171 Normal = {
Nenue@10 172
Nenue@10 173 title = {
Nenue@10 174 Font = {titleFont, titleSize, titleOutline},
Nenue@10 175 Spacing = titleSpacing,
Nenue@10 176 },
Nenue@10 177 titlebg = {
Nenue@10 178 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}},
Nenue@10 179
Nenue@10 180 },
Nenue@10 181 status = {
Nenue@10 182 Font = {textFont, textSize, textOutline},
Nenue@10 183 Spacing = textSpacing,
Nenue@10 184 },
Nenue@10 185 statusbg = {
Nenue@10 186 Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}},
Nenue@10 187 },
Nenue@10 188 },
Nenue@10 189 Complete = {
Nenue@10 190 title = {
Nenue@10 191 Font = {titleFont, titleSize, titleOutline},
Nenue@10 192 Spacing = titleSpacing,
Nenue@10 193 },
Nenue@10 194 titlebg = {
Nenue@10 195 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}},
Nenue@10 196 },
Nenue@10 197 status = {
Nenue@10 198 Font = {textFont, textSize, textOutline},
Nenue@10 199 Spacing = textSpacing,
Nenue@10 200 },
Nenue@10 201 statusbg = {
Nenue@10 202 Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}},
Nenue@10 203 },
Nenue@10 204 },
Nenue@10 205 }
Nenue@10 206 }
Nenue@10 207 }
Nenue@10 208
Nenue@10 209 local style_cache_func = {}
Nenue@10 210 local block_vars = {
Nenue@10 211 ['titleSize'] = {'titleWidth', 'titleHeight'},
Nenue@10 212 ['FrameSize'] = {'width', 'height'}
Nenue@10 213 }
Nenue@10 214 local attrib_vars = {
Nenue@10 215 ['Font'] = {'height'},
Nenue@10 216 }
Nenue@10 217
Nenue@10 218 mod.BlockStyleCache = {}
Nenue@10 219 local style_cache = mod.BlockStyleCache
Nenue@10 220 mod.regions = {}
Nenue@10 221 mod.regionStyles = {}
Nenue@10 222 mod.SetBlockStyle = function(frame, frameType, ...)
Nenue@10 223 -- var names intended to reflect argument order
Nenue@14 224 print('|cFFFFFF00'..frame:GetName()..'|r')
Nenue@10 225 --@debug@
Nenue@10 226 local c = mod.defaults.Normal
Nenue@10 227 local style_list = {... }
Nenue@10 228 local styleName = frameType .. '-' .. table.concat(style_list,'')
Nenue@10 229
Nenue@10 230 if not style_cache[styleName] then
Nenue@10 231 local style = {}
Nenue@10 232
Nenue@10 233 if mod.defaults.Style[frameType] then
Nenue@10 234 print(' setting style class |cFF00FFFF'..frameType)
Nenue@10 235 else
Nenue@10 236 print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)')
Nenue@10 237 end
Nenue@10 238 local normal = mod.defaults.Style.Normal
Nenue@10 239 local root = mod.defaults.Style[frameType] or normal
Nenue@10 240 for i, className in ipairs(style_list) do
Nenue@10 241 local class = root[className] or normal[className] or root
Nenue@10 242 if root[className] then
Nenue@10 243
Nenue@10 244 print(' SubClass |cFF0088FF'.. className .. '|r')
Nenue@10 245 elseif normal[className] then
Nenue@10 246 print(' SubClass Normal.|cFFFF0088'..className..'|r')
Nenue@10 247 else
Nenue@10 248 print(' SubClass Normal')
Nenue@10 249 end
Nenue@10 250 for elementName, element in pairs(class) do
Nenue@10 251 if not elementName:match('^%u') then
Nenue@10 252 print(' scanning Element |cFF8800FF'.. elementName ..'|r')
Nenue@10 253 if not style[elementName] then
Nenue@10 254 style[elementName] = {}
Nenue@10 255 end
Nenue@10 256 for key, value in pairs(element) do
Nenue@10 257 if mod.SetBlockAttribute[key] then
Nenue@10 258 print(' |cFF00FF00'..elementName..'|r.|cFF00FFFF'..key..' =', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)))
Nenue@10 259 style[elementName][key] = value
Nenue@10 260 end
Nenue@10 261
Nenue@10 262 end
Nenue@10 263 end
Nenue@10 264
Nenue@10 265 end
Nenue@10 266
Nenue@10 267 end
Nenue@10 268
Nenue@10 269 for k, elements in pairs(mod.defaults.Style.Normal) do
Nenue@10 270 if not style[k] and type(elements) ~= 'table' then
Nenue@10 271 style[k] = elements
Nenue@10 272 end
Nenue@10 273 end
Nenue@10 274
Nenue@10 275
Nenue@10 276 print('result for: ', frame:GetName())
Nenue@10 277 for k,v in pairs(style) do
Nenue@10 278 if type(v) == 'table' and not k:match('^%u') then
Nenue@10 279 for kk, vv in pairs(v) do
Nenue@10 280 print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', tostring(vv))
Nenue@10 281 end
Nenue@10 282 else
Nenue@10 283 print(' |cFFFFFFFF' .. k ..'|r =', tostring(v))
Nenue@10 284 end
Nenue@10 285 end
Nenue@10 286 style_cache[styleName] = style
Nenue@10 287 end
Nenue@10 288
Nenue@10 289 local style = style_cache[styleName]
Nenue@10 290
Nenue@10 291 if not style_cache_func[styleName] then
Nenue@10 292 local code =
Nenue@10 293 "return function (frame)\n"..
Nenue@10 294 " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n"..
Nenue@11 295 " local cache = Veneer.ObjectiveTracker.BlockStyleCache"
Nenue@11 296 --.. " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) "
Nenue@10 297
Nenue@10 298 for elementName, styleset in pairs(style) do
Nenue@10 299 code = code ..
Nenue@10 300 "\n if frame['"..elementName.."'] then"
Nenue@10 301
Nenue@10 302 for attributeName, value in pairs(styleset) do
Nenue@10 303 if mod.SetBlockAttribute[attributeName] then
Nenue@10 304 print(' '..elementName..':'.. attributeName ..'(', value, ')')
Nenue@10 305
Nenue@10 306
Nenue@10 307 --mod.SetBlockAttribute[attributeName](region, value)
Nenue@11 308 code = code
Nenue@11 309 --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
Nenue@11 310 .. "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],"..
Nenue@10 311 " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
Nenue@10 312
Nenue@10 313 --- Set any frame.blah variables used in Updates
Nenue@10 314 if block_vars[elementName .. attributeName] then
Nenue@10 315 print('|cFF008800BVar|r', elementName..attributeName)
Nenue@10 316 for i, blockKey in ipairs(block_vars[elementName .. attributeName]) do
Nenue@10 317 print(' assigning |cFF008800'..blockKey..'|r')
Nenue@10 318 frame[blockKey] = (type(value) == 'table') and value[i] or value
Nenue@10 319 end
Nenue@10 320 end
Nenue@10 321
Nenue@10 322 end
Nenue@10 323 end
Nenue@10 324 code = code ..
Nenue@10 325 "\n else"..
Nenue@11 326 --"\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')"..
Nenue@10 327 "\n end"
Nenue@10 328 end
Nenue@10 329 code = code .. "\nend"
Nenue@10 330 local result = assert(loadstring(code))
Nenue@10 331 print('storing style func', styleName, result())
Nenue@10 332 style_cache_func[styleName] = result()
Nenue@10 333
Nenue@10 334 end
Nenue@10 335 style_cache_func[styleName](frame)
Nenue@10 336
Nenue@13 337 --- Hardcoding the sizing vars for sanity
Nenue@13 338 local normalSettings = mod.defaults.Style.Format
Nenue@14 339 frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0
Nenue@14 340 frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0
Nenue@14 341 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
Nenue@13 342 frame.width = normalSettings.Frame.Width
Nenue@13 343 frame.statusWidth = frame.width - normalSettings.status.Indent
Nenue@13 344 frame.titleWidth = frame.width - normalSettings.title.Indent
Nenue@10 345
Nenue@10 346 if frame.status then
Nenue@14 347 print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight)
Nenue@13 348 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
Nenue@10 349 frame.status:SetHeight(frame.statusHeight)
Nenue@10 350 if frame.statusbg then
Nenue@10 351
Nenue@14 352 frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
Nenue@10 353 frame.statusbg:SetWidth(frame.width)
Nenue@10 354 end
Nenue@10 355 end
Nenue@10 356 if frame.title then
Nenue@14 357 print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight)
Nenue@13 358 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
Nenue@10 359 frame.title:SetHeight(frame.titleHeight)
Nenue@10 360 if frame.titlebg then
Nenue@10 361 frame.titlebg:SetHeight(frame.titleHeight)
Nenue@10 362 frame.titlebg:SetWidth(frame.width)
Nenue@10 363 end
Nenue@10 364 end
Nenue@14 365 frame:SetSize(frame.width, frame.height)
Nenue@10 366 print('sizing frame', frame.width, frame.height)
Nenue@10 367 --[[
Nenue@10 368 local titleSpacing, titleSpacing2 = c.Title.Spacing, (c.Title.Spacing * 2)
Nenue@10 369 local textSpacing, textSpacing2 = c.Text.Spacing, (c.Text.Spacing * 2)
Nenue@10 370
Nenue@10 371 block.title:SetSpacing(titleSpacing)
Nenue@10 372 block.objectives:SetSpacing(textSpacing)
Nenue@10 373 block.objectives:SetWordWrap(true)
Nenue@10 374
Nenue@10 375 local titleHeight, textHeight = block.title:GetStringHeight(), block.objectives:GetStringHeight() + block.attachmentHeight
Nenue@10 376 local blockHeight = titleHeight + titleSpacing2 + textHeight + textSpacing2
Nenue@10 377 local blockWidth = wrapperMaxWidth
Nenue@10 378
Nenue@10 379 block.titlebg:SetSize(min(w1, w2), titleHeight + titleSpacing2)
Nenue@10 380 block.bg:SetSize(w1, textHeight + textSpacing2)
Nenue@10 381 block:SetSize(blockWidth, blockHeight)
Nenue@10 382
Nenue@10 383 block.title:SetPoint('TOPLEFT', block.titlebg, 'TOPLEFT', 0, -titleSpacing)
Nenue@10 384 block.objectives:SetPoint('TOPLEFT', block.titlebg, 'BOTTOMLEFT', textIndent, -textSpacing)
Nenue@10 385
Nenue@10 386 -- store
Nenue@10 387 block.titleHeight = titleHeight
Nenue@10 388 block.textHeight = textHeight
Nenue@10 389 block.width = blockWidth
Nenue@10 390 block.height = blockHeight
Nenue@10 391 --]]
Nenue@10 392 --print(' |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')')
Nenue@10 393 end
Nenue@14 394 local segments = {'Left', 'Right', 'Tile' }
Nenue@14 395 local Wrapper = _G.VeneerObjectiveWrapper
Nenue@14 396 mod.UpdateWrapperStyle = function()
Nenue@14 397 local c = mod.Conf.Wrapper
Nenue@14 398 --Wrapper:ClearAllPoints()
Nenue@14 399 --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY)
Nenue@14 400 end
Nenue@14 401
Nenue@14 402 mod.Tracker.SetBlockTags = function(block, info)
Nenue@14 403 if info.isComplete then
Nenue@14 404 block.mainStyle = 'Complete'
Nenue@14 405 end
Nenue@14 406 if info.superTracked then
Nenue@14 407 block.subStyle = 'Super'
Nenue@14 408 elseif info.isDaily then
Nenue@14 409 block.subStyle = 'Daily'
Nenue@14 410 end
Nenue@14 411 end
Nenue@14 412 local unitLevel = UnitLevel('player')
Nenue@14 413 mod.Quest.SetBlockTags = function(block, info)
Nenue@14 414
Nenue@14 415 mod.Tracker.SetBlockTags(block, info)
Nenue@14 416 if info.level then
Nenue@14 417 local levelDiff = unitLevel - info.level
Nenue@14 418 if levelDiff > 9 then
Nenue@14 419 block.title:SetTextColor(0.7, 0.7, 0.7, 1)
Nenue@14 420 elseif levelDiff > 1 then
Nenue@14 421 block.title:SetTextColor(0.5, 1, 0.5, 1)
Nenue@14 422 elseif levelDiff < -1 then
Nenue@14 423 block.title:SetTextColor(1, 0.4, 0.25, 1)
Nenue@14 424 elseif levelDiff < -4 then
Nenue@14 425 block.title:SetTextColor(1, 0, 0, 1)
Nenue@14 426 else
Nenue@14 427 block.title:SetTextColor(1,1,1,1)
Nenue@14 428 end
Nenue@14 429 end
Nenue@14 430 end
Nenue@14 431 mod.Cheevs.SetBlockTags = function(block, info)
Nenue@14 432 mod.Tracker.SetBlockTags(block, info)
Nenue@14 433 end
Nenue@10 434
Nenue@10 435 --- Argument containers
Nenue@14 436 local o -- text flag
Nenue@14 437 local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2
Nenue@14 438 local f1, f2, f3 -- font
Nenue@14 439 local w1, w2 -- size
Nenue@14 440 local p1, p2, p3, x, y -- path/point args
Nenue@10 441 mod.SetBlockAttribute = {}
Nenue@10 442 local sb = mod.SetBlockAttribute
Nenue@10 443 local print = B.print('Attribute')
Nenue@10 444 sb.Gradient = function(region, value)
Nenue@10 445 print('|cFF8844FFGradient|r', region:GetName(), unpack(value))
Nenue@10 446 o = 'HORIZONTAL'
Nenue@10 447 a1, a2, a3, a4 = unpack(value.MinColor)
Nenue@10 448 b1, b2, b3, b4 = unpack(value.MaxColor)
Nenue@10 449 region:SetVertexColor(1,1,1)
Nenue@10 450 region:SetTexture(1,1,1,1)
Nenue@10 451 region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)
Nenue@10 452 end
Nenue@10 453
Nenue@10 454 sb.Background = function(region, value)
Nenue@10 455 print('|cFF0088FFBackground|r', unpack(value))
Nenue@10 456 region:SetVertexColor(1,1,1) -- reset
Nenue@10 457 region:SetTexture(unpack(value))
Nenue@10 458 end
Nenue@10 459 sb.BackgroundComplex = function (region, value)
Nenue@10 460 local left, tile, right = value.Left, value.Tile, value.Right
Nenue@10 461
Nenue@10 462 end
Nenue@10 463 sb.Font = function(region, value)
Nenue@10 464 f1, f2, f3 = unpack(value)
Nenue@10 465 print('|cFFFFFF00Font|r', f1, f2, f3)
Nenue@10 466 region:SetFont(f1, f2, f3)
Nenue@10 467 end
Nenue@10 468
Nenue@10 469 sb.Spacing = function(region, value)
Nenue@14 470 print('FontSpacing', region:GetName(), value)
Nenue@10 471 region:SetSpacing(value)
Nenue@10 472 region.spacing = value
Nenue@10 473 end
Nenue@10 474
Nenue@10 475 sb.TextColor = function(region, value)
Nenue@10 476 a1, a2, a3, a4 = unpack(value)
Nenue@10 477 print('TextColor', a1, a2, a3, a4)
Nenue@10 478 region:SetTextColor(a1, a2, a3, a4)
Nenue@10 479 end
Nenue@10 480 sb.Texture = function(region, value)
Nenue@10 481
Nenue@10 482 p1, a1, a2, a3, a4 = unpack(value)
Nenue@10 483 print('Texture', p1, a1, a2, a3, a4)
Nenue@10 484 region:SetTexture(p1)
Nenue@10 485 if a1 then
Nenue@10 486 region:SetTexCoord(a1, a2, a3, a4)
Nenue@10 487 end
Nenue@10 488 end
Nenue@10 489 sb.Width = function(region, value)
Nenue@10 490 w1 = value
Nenue@10 491 region:SetWidth(w1)
Nenue@10 492 end
Nenue@10 493
Nenue@10 494 sb.Height = function(region, value)
Nenue@10 495 w2 = value
Nenue@10 496 region:SetHeight(w2)
Nenue@10 497 end
Nenue@10 498 sb.Size = function(region, value)
Nenue@10 499 w1, w2 = unpack(value)
Nenue@10 500 region:SetSize(w1, w2)
Nenue@14 501 end
Nenue@14 502