comparison ObjectiveStyle.lua @ 16:880828018bf4

ObjectiveEvents - trim down the number of events that fire full updates - begin the general outline for determining which trackers need to refresh - handlers for accepting and completing auto-popup quests ObjectiveFrame - correct variables for money reward calculation - make sure everythign is scaling to the font strings and that the font strings aren't being pinned by SetSize ObjectiveInfo - implementation of autoquest popups - discern between internal and client bonus objective indexes - acquire the correct data set from bonus objective query ObjectiveStyle - look for a style table under the previously interpreted set before deferring standard options - horizontal/vertical options in gradient - remove height-fixing for font strings
author Nenue
date Tue, 05 Apr 2016 00:39:12 -0400
parents ed642234f017
children c33497b116d6
comparison
equal deleted inserted replaced
15:f660f1c1e0aa 16:880828018bf4
83 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing, 83 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
84 Indent = 2, 84 Indent = 2,
85 TextColor = {1, .9, .2, 1}, 85 TextColor = {1, .9, .2, 1},
86 }, 86 },
87 titlebg = { 87 titlebg = {
88 Gradient = {MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}}, 88 Gradient = {'VERTICAL', MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
89 } 89 }
90 } 90 }
91 }, 91 },
92 TrackerBlock = { 92 TrackerBlock = {
93 Normal = { 93 Normal = {
94 titlebg = { 94 titlebg = {
95 Indent = 2, 95 Indent = 2,
96 Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}}, 96 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}},
97 }, 97 },
98 title = { 98 title = {
99 TextColor = {1,1,1,0.5}, 99 TextColor = {1,1,1,0.5},
100 Font = {titleFont, titleSize, titleOutline}, 100 Font = {titleFont, titleSize, titleOutline},
101 Spacing = titleSpacing, 101 Spacing = titleSpacing,
104 TextColor = {1,1,1,0.5}, 104 TextColor = {1,1,1,0.5},
105 Font = {textFont, textSize, textOutline}, 105 Font = {textFont, textSize, textOutline},
106 Spacing = textSpacing, 106 Spacing = textSpacing,
107 }, 107 },
108 statusbg = { 108 statusbg = {
109 Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}}, 109 Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
110 } 110 }
111 }, 111 },
112 Super = { 112 Super = {
113 title = { 113 title = {
114 TextColor = {1,1,1,1}, 114 TextColor = {1,1,1,1},
115 Font = {titleFont, titleSize, titleOutline}, 115 Font = {titleFont, titleSize, titleOutline},
116 Spacing = titleSpacing, BackgroundFullWidth = true 116 Spacing = titleSpacing, BackgroundFullWidth = true
117 }, 117 },
118 titlebg = { 118 titlebg = {
119 Gradient = { MinColor = {0, .7, .6, .45}, MaxColor = {0, .7, .6, 0.23}}, 119 Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 0}, MaxColor = {0, .7, .6, 0.23}},
120 }, 120 },
121 status = { 121 status = {
122 TextColor = {1,1,1,1}, 122 TextColor = {1,1,1,1},
123 Font = {textFont, textSize, textOutline}, 123 Font = {textFont, textSize, textOutline},
124 Spacing = textSpacing, 124 Spacing = textSpacing,
125 }, 125 },
126 statusbg = { 126 statusbg = {
127 Gradient = { MinColor = {0, .7, .6, 0.40}, MaxColor = {0, .7, .6, 0.23} }, 127 Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 0}, MaxColor = {0, .7, .6, 0.23} },
128 }, 128 },
129 }, 129 },
130 MouseDown = { 130 MouseDown = {
131 title = { 131 title = {
132 Font = {titleFont, titleSize, titleOutline}, 132 Font = {titleFont, titleSize, titleOutline},
133 Spacing = titleSpacing, 133 Spacing = titleSpacing,
134 }, 134 },
135 titlebg = { 135 titlebg = {
136 Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .4}, }, 136 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .4}, },
137 }, 137 },
138 status = { 138 status = {
139 Font = {textFont, textSize, textOutline}, 139 Font = {textFont, textSize, textOutline},
140 Spacing = textSpacing, 140 Spacing = textSpacing,
141 }, 141 },
142 statusbg = { 142 statusbg = {
143 Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .2}, }, 143 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .2}, },
144 } 144 }
145 }, 145 },
146 Complete = { 146 Complete = {
147 title = { 147 title = {
148 TextColor = {1,1,1,0.5}, 148 TextColor = {1,1,1,0.5},
149 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, 149 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
150 }, 150 },
151 titlebg = { 151 titlebg = {
152 Gradient = { MinColor = {0, 1, 0, 0.34}, MaxColor = {0, 1, 0, .17}, }, 152 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 0}, MaxColor = {0, 1, 0, 0.34}, },
153 }, 153 },
154 status = { 154 status = {
155 TextColor = {1,1,1,0.5}, 155 TextColor = {1,1,1,0.5},
156 Font = {textFont, textSize, textOutline}, Spacing = textSpacing, 156 Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
157 }, 157 },
158 statusbg = { 158 statusbg = {
159 Gradient = { MinColor = {0, 1, 0, .25}, MaxColor = {0, 1, 0, 0.12}, }, 159 Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 0}, MaxColor = {0, 1, 0, .25}, },
160 } 160 }
161 }, 161 },
162 Daily = { 162 Daily = {
163 titlebg = { 163 titlebg = {
164 Gradient = { MinColor = {0, .4, 1, 0.34}, MaxColor = {0, 0.4, 1, .17}, }, 164 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.34}, MaxColor = {0, 0.4, 1, .17}, },
165 }, 165 },
166 statusbg = { 166 statusbg = {
167 Gradient = { MinColor = {0, .4, 1, 0.25}, MaxColor = {0, 0.4, 1, .12}, }, 167 Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 0.25}, MaxColor = {0, 0.4, 1, .12}, },
168 }, 168 },
169 }, 169 },
170 Cheev = { 170 AutoQuest = {
171 Normal = {
172 titlebg = {
173 Indent = 2,
174 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}},
175 },
176 title = {
177 TextColor = {1,1,1,1},
178 Font = {titleFont, titleSize, titleOutline},
179 Spacing = titleSpacing,
180 },
181 status = {
182 TextColor = {0,1,0,1},
183 Font = {textFont, textSize, textOutline},
184 Spacing = textSpacing,
185 },
186 statusbg = {
187 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
188 }
189 },
190 },
191 Cheevs = {
171 Normal = { 192 Normal = {
172 193
173 title = { 194 title = {
174 Font = {titleFont, titleSize, titleOutline}, 195 Font = {titleFont, titleSize, titleOutline},
175 Spacing = titleSpacing, 196 Spacing = titleSpacing,
176 }, 197 },
177 titlebg = { 198 titlebg = {
178 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}}, 199 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}},
179 200
180 }, 201 },
181 status = { 202 status = {
182 Font = {textFont, textSize, textOutline}, 203 Font = {textFont, textSize, textOutline},
183 Spacing = textSpacing, 204 Spacing = textSpacing,
184 }, 205 },
185 statusbg = { 206 statusbg = {
186 Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}}, 207 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}},
187 }, 208 },
188 }, 209 },
189 Complete = { 210 Complete = {
190 title = { 211 title = {
191 Font = {titleFont, titleSize, titleOutline}, 212 Font = {titleFont, titleSize, titleOutline},
192 Spacing = titleSpacing, 213 Spacing = titleSpacing,
193 }, 214 },
194 titlebg = { 215 titlebg = {
195 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}}, 216 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}},
196 }, 217 },
197 status = { 218 status = {
198 Font = {textFont, textSize, textOutline}, 219 Font = {textFont, textSize, textOutline},
199 Spacing = textSpacing, 220 Spacing = textSpacing,
200 }, 221 },
201 statusbg = { 222 statusbg = {
202 Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}}, 223 Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}},
203 }, 224 },
204 }, 225 },
205 } 226 }
206 } 227 }
207 } 228 }
219 local style_cache = mod.BlockStyleCache 240 local style_cache = mod.BlockStyleCache
220 mod.regions = {} 241 mod.regions = {}
221 mod.regionStyles = {} 242 mod.regionStyles = {}
222 mod.SetBlockStyle = function(frame, frameType, ...) 243 mod.SetBlockStyle = function(frame, frameType, ...)
223 -- var names intended to reflect argument order 244 -- var names intended to reflect argument order
224 print('|cFFFFFF00'..frame:GetName()..'|r') 245 print('|cFFFFFF00'..frame:GetName()..'|r', frameType, ...)
225 --@debug@ 246 --@debug@
226 local c = mod.defaults.Normal 247 local c = mod.defaults.Normal
227 local style_list = {... } 248 local style_list = {... }
228 local styleName = frameType .. '-' .. table.concat(style_list,'') 249 local styleName = frameType .. '-' .. table.concat(style_list,'')
250 local previousClass = mod.Conf.Style[frameType]
229 251
230 if not style_cache[styleName] then 252 if not style_cache[styleName] then
231 local style = {} 253 local style = {}
232 254
233 if mod.defaults.Style[frameType] then 255 if mod.defaults.Style[frameType] then
236 print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)') 258 print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)')
237 end 259 end
238 local normal = mod.defaults.Style.Normal 260 local normal = mod.defaults.Style.Normal
239 local root = mod.defaults.Style[frameType] or normal 261 local root = mod.defaults.Style[frameType] or normal
240 for i, className in ipairs(style_list) do 262 for i, className in ipairs(style_list) do
241 local class = root[className] or normal[className] or root 263 local class = normal
242 if root[className] then 264 if previousClass and previousClass[className] then
243 265 class = previousClass[className]
266 print(' ChildClass |cFFFF0088'.. className .. '|r')
267 elseif root[className] then
268 class = root[className]
244 print(' SubClass |cFF0088FF'.. className .. '|r') 269 print(' SubClass |cFF0088FF'.. className .. '|r')
245 elseif normal[className] then 270 elseif normal[className] then
271 class = normal[className]
246 print(' SubClass Normal.|cFFFF0088'..className..'|r') 272 print(' SubClass Normal.|cFFFF0088'..className..'|r')
247 else 273 else
248 print(' SubClass Normal') 274 print(' SubClass not found '..className..'')
249 end 275 end
276 previousClass = class
277
250 for elementName, element in pairs(class) do 278 for elementName, element in pairs(class) do
251 if not elementName:match('^%u') then 279 if not elementName:match('^%u') then
252 print(' scanning Element |cFF8800FF'.. elementName ..'|r') 280 print(' scanning Element |cFF8800FF'.. elementName ..'|r')
253 if not style[elementName] then 281 if not style[elementName] then
254 style[elementName] = {} 282 style[elementName] = {}
261 289
262 end 290 end
263 end 291 end
264 292
265 end 293 end
266
267 end 294 end
268 295
269 for k, elements in pairs(mod.defaults.Style.Normal) do 296 for k, elements in pairs(mod.defaults.Style.Normal) do
270 if not style[k] and type(elements) ~= 'table' then 297 if not style[k] and type(elements) ~= 'table' then
271 style[k] = elements 298 style[k] = elements
275 302
276 print('result for: ', frame:GetName()) 303 print('result for: ', frame:GetName())
277 for k,v in pairs(style) do 304 for k,v in pairs(style) do
278 if type(v) == 'table' and not k:match('^%u') then 305 if type(v) == 'table' and not k:match('^%u') then
279 for kk, vv in pairs(v) do 306 for kk, vv in pairs(v) do
280 print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', tostring(vv)) 307 print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', (type(vv) == 'table' and ('{'..table.concat(vv,', ')..'}') or tostring(vv)))
281 end 308 end
282 else 309 else
283 print(' |cFFFFFFFF' .. k ..'|r =', tostring(v)) 310 print(' |cFFFFFFFF' .. k ..'|r =', tostring(v))
284 end 311 end
285 end 312 end
299 code = code .. 326 code = code ..
300 "\n if frame['"..elementName.."'] then" 327 "\n if frame['"..elementName.."'] then"
301 328
302 for attributeName, value in pairs(styleset) do 329 for attributeName, value in pairs(styleset) do
303 if mod.SetBlockAttribute[attributeName] then 330 if mod.SetBlockAttribute[attributeName] then
304 print(' '..elementName..':'.. attributeName ..'(', value, ')') 331 print(' add function '..elementName..':'.. attributeName ..'(', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)), ')')
305 332
306 333
307 --mod.SetBlockAttribute[attributeName](region, value) 334 --mod.SetBlockAttribute[attributeName](region, value)
308 code = code 335 code = code
309 --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])" 336 --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
341 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0) 368 frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
342 frame.width = normalSettings.Frame.Width 369 frame.width = normalSettings.Frame.Width
343 frame.statusWidth = frame.width - normalSettings.status.Indent 370 frame.statusWidth = frame.width - normalSettings.status.Indent
344 frame.titleWidth = frame.width - normalSettings.title.Indent 371 frame.titleWidth = frame.width - normalSettings.title.Indent
345 372
373 print((frame.status and frame.status:GetText()))
374 print((frame.status and frame.status:GetWidth()))
375 print(frame.status and frame.title:GetStringHeight())
376 print(frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0)
377 print(frame.status and frame.status:GetStringHeight())
378 print(frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0)
346 if frame.status then 379 if frame.status then
347 print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight) 380 print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight)
381 frame.status:SetWidth(frame.width)
348 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0) 382 frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
349 frame.status:SetHeight(frame.statusHeight) 383 --frame.status:SetHeight(frame.statusHeight)
350 if frame.statusbg then 384 if frame.statusbg then
351 385 frame.statusbg:SetHeight(frame.statusHeight)
352 frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
353 frame.statusbg:SetWidth(frame.width) 386 frame.statusbg:SetWidth(frame.width)
354 end 387 end
355 end 388 end
356 if frame.title then 389 if frame.title then
357 print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight) 390 print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight)
358 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent) 391 frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
359 frame.title:SetHeight(frame.titleHeight) 392 frame.title:SetWidth(frame.width)
360 if frame.titlebg then 393 if frame.titlebg then
361 frame.titlebg:SetHeight(frame.titleHeight) 394 frame.titlebg:SetHeight(frame.titleHeight)
362 frame.titlebg:SetWidth(frame.width) 395 frame.titlebg:SetWidth(frame.width)
363 end 396 end
364 end 397 end
441 mod.SetBlockAttribute = {} 474 mod.SetBlockAttribute = {}
442 local sb = mod.SetBlockAttribute 475 local sb = mod.SetBlockAttribute
443 local print = B.print('Attribute') 476 local print = B.print('Attribute')
444 sb.Gradient = function(region, value) 477 sb.Gradient = function(region, value)
445 print('|cFF8844FFGradient|r', region:GetName(), unpack(value)) 478 print('|cFF8844FFGradient|r', region:GetName(), unpack(value))
446 o = 'HORIZONTAL' 479 o = value[1]
447 a1, a2, a3, a4 = unpack(value.MinColor) 480 a1, a2, a3, a4 = unpack(value.MinColor)
448 b1, b2, b3, b4 = unpack(value.MaxColor) 481 b1, b2, b3, b4 = unpack(value.MaxColor)
449 region:SetVertexColor(1,1,1) 482 region:SetVertexColor(1,1,1)
450 region:SetTexture(1,1,1,1) 483 region:SetTexture(1,1,1,1)
451 region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4) 484 region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)