annotate ObjectiveTracker/ObjectiveStyle.lua @ 25:4b3da1b221de v1.0-beta

- distinction between all possible types of values for the 'isComplete' field - style polish applied to title headers - clickable regions altered to somewhat match those of the blizzard objectives tracker, for more world frame space and quicker user familiarity
author Nenue
date Wed, 13 Apr 2016 11:20:09 -0400
parents e837384ac363
children 07ef62fe201f
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@18 11 local titleSpacing, textSpacing = 3, 3
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@10 18 mod.defaults.Style = {
Nenue@13 19 Format = {
Nenue@13 20 Frame = {
Nenue@13 21 Width = 270,
Nenue@13 22 },
Nenue@13 23 title = {
Nenue@14 24 Indent = 0,
Nenue@14 25 Spacing = 0,
Nenue@13 26 },
Nenue@13 27 status = {
Nenue@14 28 Indent = 5,
Nenue@14 29 Spacing = 0,
Nenue@13 30 }
Nenue@13 31 },
Nenue@13 32 FontBank = {
Nenue@10 33 ['Normal'] = _G.VeneerCriteriaFontNormal,
Nenue@10 34 ['Progress'] = _G.VeneerCriteriaFontProgress,
Nenue@10 35 ['Complete'] = _G.VeneerCriteriaFontComplete,
Nenue@10 36 ['Failed'] = _G.VeneerCriteriaFontFailed,
Nenue@10 37 },
Nenue@10 38 Normal = {
Nenue@10 39 title = {
Nenue@10 40 TextColor = {1, 1, 1, 1},
Nenue@10 41 Width = 270,
Nenue@14 42 Spacing = 0,
Nenue@14 43 Indent = 2,
Nenue@10 44 },
Nenue@10 45 titlebg = {
Nenue@10 46 },
Nenue@10 47 status = {
Nenue@10 48 Width = 270,
Nenue@14 49 Spacing = 0,
Nenue@10 50 },
Nenue@10 51 statusbg = {
Nenue@10 52 },
Nenue@10 53 Frame = {
Nenue@10 54 }
Nenue@10 55 },
Nenue@10 56 Tracker = {
Nenue@10 57 Normal = {
Nenue@10 58 title = {
Nenue@10 59 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
Nenue@14 60 Indent = 2,
Nenue@14 61 TextColor = {1, .9, .2, 1},
Nenue@10 62 },
Nenue@10 63 titlebg = {
Nenue@16 64 Gradient = {'VERTICAL', MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
Nenue@10 65 }
Nenue@10 66 }
Nenue@10 67 },
Nenue@10 68 TrackerBlock = {
Nenue@10 69 Normal = {
Nenue@10 70 titlebg = {
Nenue@14 71 Indent = 2,
Nenue@21 72 Gradient = { 'HORIZONTAL', MinColor = {0.7, 0, 0.9, 1}, MaxColor = {.7, 0, 0.9, .1}},
Nenue@10 73 },
Nenue@10 74 title = {
Nenue@19 75 TextColor = {1,1,1,1},
Nenue@18 76 Font = {titleFont, titleSize, titleOutline},
Nenue@18 77 Spacing = titleSpacing,
Nenue@18 78 },
Nenue@18 79 status = {
Nenue@19 80 TextColor = {1,1,1,1},
Nenue@18 81 Font = {textFont, textSize, textOutline},
Nenue@18 82 Spacing = textSpacing,
Nenue@18 83 },
Nenue@18 84 statusbg = {
Nenue@21 85 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, .1}},
Nenue@18 86 }
Nenue@18 87 },
Nenue@18 88 Daily = {
Nenue@18 89 titlebg = {
Nenue@21 90 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.4, 1, .1}, },
Nenue@18 91 },
Nenue@18 92 statusbg = {
Nenue@21 93 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.35, .90, .1}, },
Nenue@18 94 },
Nenue@18 95 title = {
Nenue@18 96 TextColor = {0.7,1,1,1},
Nenue@10 97 Font = {titleFont, titleSize, titleOutline},
Nenue@10 98 Spacing = titleSpacing,
Nenue@10 99 },
Nenue@10 100 status = {
Nenue@19 101 TextColor = {1,1,1,1},
Nenue@14 102 Font = {textFont, textSize, textOutline},
Nenue@14 103 Spacing = textSpacing,
Nenue@10 104 },
Nenue@10 105 },
Nenue@10 106 Super = {
Nenue@10 107 title = {
Nenue@14 108 TextColor = {1,1,1,1},
Nenue@10 109 Font = {titleFont, titleSize, titleOutline},
Nenue@10 110 Spacing = titleSpacing, BackgroundFullWidth = true
Nenue@10 111 },
Nenue@10 112 titlebg = {
Nenue@21 113 Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1}},
Nenue@10 114 },
Nenue@10 115 status = {
Nenue@14 116 TextColor = {1,1,1,1},
Nenue@14 117 Font = {textFont, textSize, textOutline},
Nenue@14 118 Spacing = textSpacing,
Nenue@10 119 },
Nenue@10 120 statusbg = {
Nenue@21 121 Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1} },
Nenue@10 122 },
Nenue@10 123 },
Nenue@10 124 MouseDown = {
Nenue@10 125 title = {
Nenue@10 126 Font = {titleFont, titleSize, titleOutline},
Nenue@10 127 Spacing = titleSpacing,
Nenue@10 128 },
Nenue@10 129 titlebg = {
Nenue@21 130 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
Nenue@10 131 },
Nenue@10 132 status = {
Nenue@10 133 Font = {textFont, textSize, textOutline},
Nenue@10 134 Spacing = textSpacing,
Nenue@10 135 },
Nenue@10 136 statusbg = {
Nenue@21 137 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
Nenue@10 138 }
Nenue@10 139 },
Nenue@10 140 Complete = {
Nenue@10 141 title = {
Nenue@19 142 TextColor = {1,1,1,1},
Nenue@10 143 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
Nenue@10 144 },
Nenue@10 145 titlebg = {
Nenue@21 146 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
Nenue@10 147 },
Nenue@10 148 status = {
Nenue@19 149 TextColor = {1,1,1,1},
Nenue@10 150 Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
Nenue@10 151 },
Nenue@10 152 statusbg = {
Nenue@21 153 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
Nenue@10 154 }
Nenue@10 155 },
Nenue@16 156 AutoQuest = {
Nenue@16 157 Normal = {
Nenue@16 158 titlebg = {
Nenue@16 159 Indent = 2,
Nenue@21 160 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@16 161 },
Nenue@16 162 title = {
Nenue@16 163 TextColor = {1,1,1,1},
Nenue@16 164 Font = {titleFont, titleSize, titleOutline},
Nenue@16 165 Spacing = titleSpacing,
Nenue@16 166 },
Nenue@16 167 status = {
Nenue@16 168 TextColor = {0,1,0,1},
Nenue@16 169 Font = {textFont, textSize, textOutline},
Nenue@16 170 Spacing = textSpacing,
Nenue@16 171 },
Nenue@16 172 statusbg = {
Nenue@21 173 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@16 174 }
Nenue@16 175 },
Nenue@16 176 },
Nenue@16 177 Cheevs = {
Nenue@10 178 Normal = {
Nenue@10 179
Nenue@10 180 title = {
Nenue@10 181 Font = {titleFont, titleSize, titleOutline},
Nenue@10 182 Spacing = titleSpacing,
Nenue@10 183 },
Nenue@10 184 titlebg = {
Nenue@21 185 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@10 186
Nenue@10 187 },
Nenue@10 188 status = {
Nenue@10 189 Font = {textFont, textSize, textOutline},
Nenue@10 190 Spacing = textSpacing,
Nenue@10 191 },
Nenue@10 192 statusbg = {
Nenue@21 193 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@10 194 },
Nenue@10 195 },
Nenue@10 196 Complete = {
Nenue@10 197 title = {
Nenue@10 198 Font = {titleFont, titleSize, titleOutline},
Nenue@10 199 Spacing = titleSpacing,
Nenue@10 200 },
Nenue@10 201 titlebg = {
Nenue@21 202 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@10 203 },
Nenue@10 204 status = {
Nenue@10 205 Font = {textFont, textSize, textOutline},
Nenue@10 206 Spacing = textSpacing,
Nenue@10 207 },
Nenue@10 208 statusbg = {
Nenue@21 209 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
Nenue@10 210 },
Nenue@10 211 },
Nenue@10 212 }
Nenue@10 213 }
Nenue@10 214 }
Nenue@10 215
Nenue@10 216 local style_cache_func = {}
Nenue@10 217 local block_vars = {
Nenue@10 218 ['titleSize'] = {'titleWidth', 'titleHeight'},
Nenue@10 219 ['FrameSize'] = {'width', 'height'}
Nenue@10 220 }
Nenue@10 221 local attrib_vars = {
Nenue@10 222 ['Font'] = {'height'},
Nenue@10 223 }
Nenue@10 224
Nenue@10 225 mod.BlockStyleCache = {}
Nenue@10 226 local style_cache = mod.BlockStyleCache
Nenue@10 227 mod.regions = {}
Nenue@10 228 mod.regionStyles = {}
Nenue@10 229 mod.SetBlockStyle = function(frame, frameType, ...)
Nenue@10 230 -- var names intended to reflect argument order
Nenue@16 231 print('|cFFFFFF00'..frame:GetName()..'|r', frameType, ...)
Nenue@10 232 --@debug@
Nenue@10 233 local c = mod.defaults.Normal
Nenue@10 234 local style_list = {... }
Nenue@10 235 local styleName = frameType .. '-' .. table.concat(style_list,'')
Nenue@19 236 local previousClass = {mod.Conf.Style[frameType] }
Nenue@19 237 local previousClassString = {'frame' }
Nenue@19 238 local parentName
Nenue@10 239
Nenue@10 240 if not style_cache[styleName] then
Nenue@10 241 local style = {}
Nenue@10 242
Nenue@19 243 --[[
Nenue@10 244 if mod.defaults.Style[frameType] then
Nenue@10 245 print(' setting style class |cFF00FFFF'..frameType)
Nenue@10 246 else
Nenue@10 247 print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)')
Nenue@10 248 end
Nenue@19 249 --]]
Nenue@10 250 local normal = mod.defaults.Style.Normal
Nenue@10 251 local root = mod.defaults.Style[frameType] or normal
Nenue@10 252 for i, className in ipairs(style_list) do
Nenue@19 253 print('|cFF00FF00'..i..'|r', className)
Nenue@16 254 local class = normal
Nenue@19 255 local childClass
Nenue@19 256 if previousClass then
Nenue@19 257 for i = #previousClass, 1, -1 do
Nenue@19 258 print('checking if '..className..' child of '.. previousClassString[i])
Nenue@19 259 if previousClass[i][className] then
Nenue@19 260 print(' it is!')
Nenue@19 261 childClass = previousClass[i][className]
Nenue@19 262 parentName = previousClassString[i]
Nenue@19 263 break
Nenue@19 264 end
Nenue@19 265 end
Nenue@19 266 end
Nenue@19 267 if childClass then
Nenue@19 268 class = childClass
Nenue@19 269 print(' ChildClass '..parentName..'.|cFFFF0088'.. className .. '|r')
Nenue@16 270 elseif root[className] then
Nenue@16 271 class = root[className]
Nenue@10 272 print(' SubClass |cFF0088FF'.. className .. '|r')
Nenue@10 273 elseif normal[className] then
Nenue@16 274 class = normal[className]
Nenue@10 275 print(' SubClass Normal.|cFFFF0088'..className..'|r')
Nenue@10 276 else
Nenue@19 277 --print(' SubClass not found '..className..'')
Nenue@10 278 end
Nenue@19 279 tinsert(previousClass, class)
Nenue@19 280 tinsert(previousClassString, className)
Nenue@16 281
Nenue@10 282 for elementName, element in pairs(class) do
Nenue@10 283 if not elementName:match('^%u') then
Nenue@19 284 --print(' scanning Element |cFF8800FF'.. elementName ..'|r')
Nenue@10 285 if not style[elementName] then
Nenue@10 286 style[elementName] = {}
Nenue@10 287 end
Nenue@10 288 for key, value in pairs(element) do
Nenue@10 289 if mod.SetBlockAttribute[key] then
Nenue@19 290 --print(' |cFF00FF00'..elementName..'|r.|cFF00FFFF'..key..' =', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)))
Nenue@10 291 style[elementName][key] = value
Nenue@10 292 end
Nenue@10 293
Nenue@10 294 end
Nenue@10 295 end
Nenue@10 296
Nenue@10 297 end
Nenue@10 298 end
Nenue@10 299
Nenue@10 300 for k, elements in pairs(mod.defaults.Style.Normal) do
Nenue@10 301 if not style[k] and type(elements) ~= 'table' then
Nenue@10 302 style[k] = elements
Nenue@10 303 end
Nenue@10 304 end
Nenue@10 305
Nenue@10 306
Nenue@19 307 --[[print('result for: ', frame:GetName())
Nenue@10 308 for k,v in pairs(style) do
Nenue@10 309 if type(v) == 'table' and not k:match('^%u') then
Nenue@10 310 for kk, vv in pairs(v) do
Nenue@19 311 --print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', (type(vv) == 'table' and ('{'..table.concat(vv,', ')..'}') or tostring(vv)))
Nenue@10 312 end
Nenue@10 313 else
Nenue@19 314 --print(' |cFFFFFFFF' .. k ..'|r =', tostring(v))
Nenue@10 315 end
Nenue@10 316 end
Nenue@19 317 --]]
Nenue@19 318 print('saving |cFFFFFF00'..styleName)
Nenue@10 319 style_cache[styleName] = style
Nenue@19 320 else
Nenue@19 321
Nenue@19 322 print('using |cFFFF00FF'..styleName)
Nenue@10 323 end
Nenue@10 324
Nenue@10 325 local style = style_cache[styleName]
Nenue@10 326
Nenue@10 327 if not style_cache_func[styleName] then
Nenue@10 328 local code =
Nenue@10 329 "return function (frame)\n"..
Nenue@10 330 " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n"..
Nenue@11 331 " local cache = Veneer.ObjectiveTracker.BlockStyleCache"
Nenue@11 332 --.. " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) "
Nenue@10 333
Nenue@10 334 for elementName, styleset in pairs(style) do
Nenue@10 335 code = code ..
Nenue@10 336 "\n if frame['"..elementName.."'] then"
Nenue@10 337
Nenue@10 338 for attributeName, value in pairs(styleset) do
Nenue@10 339 if mod.SetBlockAttribute[attributeName] then
Nenue@19 340 --print(' add function '..elementName..':'.. attributeName ..'(', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)), ')')
Nenue@10 341
Nenue@10 342
Nenue@10 343 --mod.SetBlockAttribute[attributeName](region, value)
Nenue@11 344 code = code
Nenue@11 345 --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
Nenue@11 346 .. "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],"..
Nenue@10 347 " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
Nenue@10 348
Nenue@10 349 --- Set any frame.blah variables used in Updates
Nenue@10 350 if block_vars[elementName .. attributeName] then
Nenue@19 351 --print('|cFF008800BVar|r', elementName..attributeName)
Nenue@10 352 for i, blockKey in ipairs(block_vars[elementName .. attributeName]) do
Nenue@19 353 --print(' assigning |cFF008800'..blockKey..'|r')
Nenue@10 354 frame[blockKey] = (type(value) == 'table') and value[i] or value
Nenue@10 355 end
Nenue@10 356 end
Nenue@10 357
Nenue@10 358 end
Nenue@10 359 end
Nenue@10 360 code = code ..
Nenue@10 361 "\n else"..
Nenue@11 362 --"\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')"..
Nenue@10 363 "\n end"
Nenue@10 364 end
Nenue@10 365 code = code .. "\nend"
Nenue@10 366 local result = assert(loadstring(code))
Nenue@19 367 --print('storing style func', styleName, result())
Nenue@10 368 style_cache_func[styleName] = result()
Nenue@10 369
Nenue@10 370 end
Nenue@10 371 style_cache_func[styleName](frame)
Nenue@10 372
Nenue@13 373 --- Hardcoding the sizing vars for sanity
Nenue@19 374 local defaultWidth = mod.Conf.Wrapper.Width
Nenue@13 375 local normalSettings = mod.defaults.Style.Format
Nenue@19 376 frame.width = defaultWidth
Nenue@19 377 frame.statusWidth = defaultWidth - normalSettings.status.Indent
Nenue@19 378 frame.titleWidth = defaultWidth - normalSettings.title.Indent
Nenue@21 379 frame.attachmentHeight = frame.attachmentHeight or 0
Nenue@10 380
Nenue@10 381 if frame.title then
Nenue@19 382 frame.titleHeight = frame.title and frame.title:GetStringHeight() or 0
Nenue@19 383 if frame.titleHeight > 0 then
Nenue@21 384 print('add spacing to', frame.titleHeight)
Nenue@19 385 frame.titleHeight = frame.titleHeight + (frame.title.spacing or 0)*2
Nenue@19 386 end
Nenue@19 387
Nenue@18 388 frame.title.spacing = frame.title.spacing or frame.title:GetSpacing()
Nenue@13 389 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
Nenue@17 390 frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing)
Nenue@16 391 frame.title:SetWidth(frame.width)
Nenue@10 392 if frame.titlebg then
Nenue@18 393 frame.titlebg:SetHeight(frame.titleHeight)
Nenue@10 394 frame.titlebg:SetWidth(frame.width)
Nenue@10 395 end
Nenue@19 396 print(' titleHeight', frame.titleHeight, 'indent', normalSettings.title.Indent, 'spacing', frame.title.spacing)
Nenue@21 397 print(' -- text:', frame.title:GetSize())
Nenue@21 398 print(' -- bg:', frame.titlebg:GetSize())
Nenue@21 399
Nenue@18 400 else
Nenue@18 401 frame.titleHeight = 0
Nenue@10 402 end
Nenue@18 403
Nenue@21 404
Nenue@21 405 if frame.status and (frame.status:GetText() or frame.attachmentHeight > 0) then
Nenue@19 406 frame.statusHeight = frame.status and frame.status:GetStringHeight() or 0
Nenue@19 407 if frame.statusHeight > 0 then
Nenue@19 408 frame.statusHeight = frame.statusHeight + (frame.status.spacing or 0)*2
Nenue@19 409 end
Nenue@19 410
Nenue@18 411 frame.status.spacing = frame.status.spacing or frame.status:GetSpacing()
Nenue@21 412
Nenue@18 413 frame.status:SetWidth(frame.width)
Nenue@18 414 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
Nenue@19 415 frame.status:SetPoint('TOP', frame.titlebg, 'BOTTOM', 0, 0)
Nenue@21 416 --frame.status:SetHeight(frame.statusHeight)
Nenue@18 417 if frame.statusbg then
Nenue@18 418
Nenue@21 419 --frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
Nenue@21 420 --frame.statusbg:SetPoint('BOTTOM', frame, 'BOTTOM', 0, 0)
Nenue@18 421 frame.statusbg:SetWidth(frame.width)
Nenue@18 422 end
Nenue@19 423 print(' status tHeight', frame.statusHeight, 'indent', normalSettings.status.Indent, 'spacing', frame.status.spacing)
Nenue@18 424 else
Nenue@21 425 if frame.status then
Nenue@21 426 frame.status:Hide()
Nenue@21 427 end
Nenue@21 428 if frame.statusbg then
Nenue@21 429 frame.statusbg:Hide()
Nenue@21 430 end
Nenue@18 431 frame.statusHeight = 0
Nenue@18 432 end
Nenue@18 433
Nenue@18 434 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
Nenue@14 435 frame:SetSize(frame.width, frame.height)
Nenue@19 436 print(' |cFF0088FFsizing frame', frame.width, frame.height)
Nenue@14 437 end
Nenue@14 438
Nenue@10 439 --- Argument containers
Nenue@14 440 local o -- text flag
Nenue@14 441 local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2
Nenue@14 442 local f1, f2, f3 -- font
Nenue@14 443 local w1, w2 -- size
Nenue@14 444 local p1, p2, p3, x, y -- path/point args
Nenue@10 445 mod.SetBlockAttribute = {}
Nenue@10 446 local sb = mod.SetBlockAttribute
Nenue@10 447 local print = B.print('Attribute')
Nenue@10 448 sb.Gradient = function(region, value)
Nenue@10 449 print('|cFF8844FFGradient|r', region:GetName(), unpack(value))
Nenue@16 450 o = value[1]
Nenue@10 451 a1, a2, a3, a4 = unpack(value.MinColor)
Nenue@10 452 b1, b2, b3, b4 = unpack(value.MaxColor)
Nenue@10 453 region:SetVertexColor(1,1,1)
Nenue@10 454 region:SetTexture(1,1,1,1)
Nenue@10 455 region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)
Nenue@10 456 end
Nenue@10 457
Nenue@10 458 sb.Background = function(region, value)
Nenue@10 459 print('|cFF0088FFBackground|r', unpack(value))
Nenue@10 460 region:SetVertexColor(1,1,1) -- reset
Nenue@10 461 region:SetTexture(unpack(value))
Nenue@10 462 end
Nenue@10 463 sb.BackgroundComplex = function (region, value)
Nenue@10 464 local left, tile, right = value.Left, value.Tile, value.Right
Nenue@10 465
Nenue@10 466 end
Nenue@10 467 sb.Font = function(region, value)
Nenue@10 468 f1, f2, f3 = unpack(value)
Nenue@10 469 print('|cFFFFFF00Font|r', f1, f2, f3)
Nenue@10 470 region:SetFont(f1, f2, f3)
Nenue@10 471 end
Nenue@10 472
Nenue@10 473 sb.Spacing = function(region, value)
Nenue@14 474 print('FontSpacing', region:GetName(), value)
Nenue@10 475 region:SetSpacing(value)
Nenue@10 476 region.spacing = value
Nenue@10 477 end
Nenue@10 478
Nenue@10 479 sb.TextColor = function(region, value)
Nenue@10 480 a1, a2, a3, a4 = unpack(value)
Nenue@10 481 print('TextColor', a1, a2, a3, a4)
Nenue@10 482 region:SetTextColor(a1, a2, a3, a4)
Nenue@10 483 end
Nenue@10 484 sb.Texture = function(region, value)
Nenue@10 485
Nenue@10 486 p1, a1, a2, a3, a4 = unpack(value)
Nenue@10 487 print('Texture', p1, a1, a2, a3, a4)
Nenue@10 488 region:SetTexture(p1)
Nenue@10 489 if a1 then
Nenue@10 490 region:SetTexCoord(a1, a2, a3, a4)
Nenue@10 491 end
Nenue@10 492 end
Nenue@10 493 sb.Width = function(region, value)
Nenue@10 494 w1 = value
Nenue@10 495 region:SetWidth(w1)
Nenue@10 496 end
Nenue@10 497
Nenue@10 498 sb.Height = function(region, value)
Nenue@10 499 w2 = value
Nenue@10 500 region:SetHeight(w2)
Nenue@10 501 end
Nenue@10 502 sb.Size = function(region, value)
Nenue@10 503 w1, w2 = unpack(value)
Nenue@10 504 region:SetSize(w1, w2)
Nenue@14 505 end
Nenue@14 506