Mercurial > wow > buffalo2
diff 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 |
line wrap: on
line diff
--- a/ObjectiveStyle.lua Sat Apr 02 17:46:52 2016 -0400 +++ b/ObjectiveStyle.lua Mon Apr 04 03:16:22 2016 -0400 @@ -5,35 +5,41 @@ --- Deals with swapping between different color palettes --- -local itemButtonSize, itemButtonSpacing = 36, 1 -local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0} local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] -local titleSize, textSize = 15, 15 +local titleSize, textSize = 16, 15 local titleOutline, textOutline = "OUTLINE", "OUTLINE" -local titleSpacing, textSpacing = 4, 3 +local titleSpacing, textSpacing = 3, 1 local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat -local wrapperMaxWidth, wrapperMaxHeight = 280, 490 -- these are the hard bounds, actual *Height variables are changed local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' -local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 -local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 +local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24 +local headerOutline, headerSpacing = 'OUTLINE', 2 -mod.defaults.ObjectiveWrapper = { - ObjectiveTrackerFloat = {'BOTTOM', 'RIGHT'}, - ObjectiveTrackerParent = 'DebuffButton', - ObjectiveTrackerSize = {250, 600}, - ObjectiveWrapperParent = '', +mod.defaults.Wrapper = { + WrapperPoint = 'TOPRIGHT', + WrapperFloatX = -25, + WrapperFloatV = 'TOP', + WrapperFloatY = -200, + + WrapperWidth = 270, + WrapperHeight = 600, } +mod.defaults.Tracker = { + HeaderHeight = 24, +} + mod.defaults.Style = { Format = { Frame = { Width = 270, }, title = { - Indent = 0 + Indent = 0, + Spacing = 0, }, status = { - Indent = 5 + Indent = 5, + Spacing = 0, } }, FontBank = { @@ -46,6 +52,8 @@ title = { TextColor = {1, 1, 1, 1}, Width = 270, + Spacing = 0, + Indent = 2, }, titlebg = { Background = {0, 0, 0, 1}, @@ -53,6 +61,7 @@ }, status = { Width = 270, + Spacing = 0, }, statusbg = { Width = 270, @@ -63,8 +72,6 @@ }, Wrapper = { Frame = { - Point = {wrapperPosition}, - MaxSize = {wrapperMaxWidth, wrapperMaxHeight}, BackgroundComplex = {Left = {'', 0, 0.4, 0,1, 100}, Right={'', 0.6,1,0,1}, Tile = {'', 0.4,.6,0,1, 100}}, }, title = { Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline}, @@ -74,41 +81,50 @@ Normal = { title = { Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing, + Indent = 2, + TextColor = {1, .9, .2, 1}, }, titlebg = { - Gradient = {MinColor = {0,0,0,0.7}, MaxColor = {0,0,0,.35}}, + Gradient = {MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}}, } } }, TrackerBlock = { Normal = { titlebg = { - Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}}, + Indent = 2, + Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}}, }, title = { + TextColor = {1,1,1,0.5}, Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, }, status = { - Font = {textFont, textSize, textOutline}, Spacing = textSpacing, + TextColor = {1,1,1,0.5}, + Font = {textFont, textSize, textOutline}, + Spacing = textSpacing, }, statusbg = { - Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}}, + Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}}, } }, Super = { title = { + TextColor = {1,1,1,1}, Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, BackgroundFullWidth = true }, titlebg = { - Gradient = { MinColor = {0, .7, .6, .8}, MaxColor = {0, .7, .6, 0.2}}, + Gradient = { MinColor = {0, .7, .6, .45}, MaxColor = {0, .7, .6, 0.23}}, }, status = { - Font = {textFont, textSize, textOutline}, Spacing = textSpacing, + TextColor = {1,1,1,1}, + Font = {textFont, textSize, textOutline}, + Spacing = textSpacing, }, statusbg = { - Gradient = { MinColor = {0, .7, .6, 0.5}, MaxColor = {0, .7, .6, 0.1} }, + Gradient = { MinColor = {0, .7, .6, 0.40}, MaxColor = {0, .7, .6, 0.23} }, }, }, MouseDown = { @@ -129,12 +145,14 @@ }, Complete = { title = { + TextColor = {1,1,1,0.5}, Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, }, titlebg = { Gradient = { MinColor = {0, 1, 0, 0.34}, MaxColor = {0, 1, 0, .17}, }, }, status = { + TextColor = {1,1,1,0.5}, Font = {textFont, textSize, textOutline}, Spacing = textSpacing, }, statusbg = { @@ -203,6 +221,7 @@ mod.regionStyles = {} mod.SetBlockStyle = function(frame, frameType, ...) -- var names intended to reflect argument order + print('|cFFFFFF00'..frame:GetName()..'|r') --@debug@ local c = mod.defaults.Normal local style_list = {... } @@ -265,8 +284,6 @@ end end style_cache[styleName] = style - else - print('Cache hit: ', styleName) end local style = style_cache[styleName] @@ -314,44 +331,39 @@ print('storing style func', styleName, result()) style_cache_func[styleName] = result() - else - print('Cache function hit:', styleName) end style_cache_func[styleName](frame) --- Hardcoding the sizing vars for sanity local normalSettings = mod.defaults.Style.Format - frame.titleHeight = frame.title and (frame.title:GetStringHeight() + frame.title.spacing*2) or 0 - frame.statusHeight = frame.status and (frame.status:GetStringHeight() + frame.status.spacing*2 + frame.attachmentHeight) or 0 - frame.height = frame.titleHeight + frame.statusHeight + frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0 + frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0 + frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0) frame.width = normalSettings.Frame.Width frame.statusWidth = frame.width - normalSettings.status.Indent frame.titleWidth = frame.width - normalSettings.title.Indent if frame.status then - print('status ', frame.statusHeight, normalSettings.status.Indent, 0) + print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight) frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0) frame.status:SetHeight(frame.statusHeight) if frame.statusbg then - print('statusbg', frame.statusHeight) - frame.statusbg:SetHeight(frame.statusHeight) + frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0)) frame.statusbg:SetWidth(frame.width) end end if frame.title then - print('title ',frame.titleHeight, normalSettings.title.Indent) + print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight) frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent) frame.title:SetHeight(frame.titleHeight) if frame.titlebg then - print('titlebg',frame.titleHeight) frame.titlebg:SetHeight(frame.titleHeight) frame.titlebg:SetWidth(frame.width) end end + frame:SetSize(frame.width, frame.height) print('sizing frame', frame.width, frame.height) - frame:SetSize(frame.width, frame.height) - print(frame:GetSize()) --[[ local titleSpacing, titleSpacing2 = c.Title.Spacing, (c.Title.Spacing * 2) local textSpacing, textSpacing2 = c.Text.Spacing, (c.Text.Spacing * 2) @@ -379,13 +391,53 @@ --]] --print(' |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')') end +local segments = {'Left', 'Right', 'Tile' } +local Wrapper = _G.VeneerObjectiveWrapper +mod.UpdateWrapperStyle = function() + local c = mod.Conf.Wrapper + --Wrapper:ClearAllPoints() + --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY) +end + +mod.Tracker.SetBlockTags = function(block, info) + if info.isComplete then + block.mainStyle = 'Complete' + end + if info.superTracked then + block.subStyle = 'Super' + elseif info.isDaily then + block.subStyle = 'Daily' + end +end +local unitLevel = UnitLevel('player') +mod.Quest.SetBlockTags = function(block, info) + + mod.Tracker.SetBlockTags(block, info) + if info.level then + local levelDiff = unitLevel - info.level + if levelDiff > 9 then + block.title:SetTextColor(0.7, 0.7, 0.7, 1) + elseif levelDiff > 1 then + block.title:SetTextColor(0.5, 1, 0.5, 1) + elseif levelDiff < -1 then + block.title:SetTextColor(1, 0.4, 0.25, 1) + elseif levelDiff < -4 then + block.title:SetTextColor(1, 0, 0, 1) + else + block.title:SetTextColor(1,1,1,1) + end + end +end +mod.Cheevs.SetBlockTags = function(block, info) + mod.Tracker.SetBlockTags(block, info) +end --- Argument containers -local o = "" -- text flag -local a1, a2, a3, a4, b1, b2, b3, b4 = 0,0,0,1, 0,0,0,1 -- color1, color2 -local f1, f2, f3 = "", 0, "" -- font -local w1, w2 = 0, 0 -- size -local p1, p2, p3, x, y = "", "", "", 0, 0 -- path/point args +local o -- text flag +local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2 +local f1, f2, f3 -- font +local w1, w2 -- size +local p1, p2, p3, x, y -- path/point args mod.SetBlockAttribute = {} local sb = mod.SetBlockAttribute local print = B.print('Attribute') @@ -415,7 +467,7 @@ end sb.Spacing = function(region, value) - print('FontSpacing', value) + print('FontSpacing', region:GetName(), value) region:SetSpacing(value) region.spacing = value end @@ -446,4 +498,5 @@ sb.Size = function(region, value) w1, w2 = unpack(value) region:SetSize(w1, w2) -end \ No newline at end of file +end +