Mercurial > wow > buffalo2
diff ObjectiveFrame.lua @ 7:5301c68f28d8
TrackerBlock
- use IsModifiedClick function to determine appropriate OnClick actions
- handle 'CHATLINK' modifier
- handle 'TOGGLEQUESTWATCH' modifier
TrackerBlockObjectives
- use a generic framework to manage frame creation for various criteria tracker types:
- ProgressBar when Blizzard flag data indicates so
- skip when Blizzard flag data indicates so
- DynamicText otherwise
- events related to the criteria are registered in the criteria frame, and unregistered when the frame is hidden, either by destruction of its parent or completion
author | Nenue |
---|---|
date | Fri, 01 Apr 2016 12:27:05 -0400 |
parents | 589de8ea05b9 |
children | 7923243ae972 |
line wrap: on
line diff
--- a/ObjectiveFrame.lua Fri Apr 01 01:30:42 2016 -0400 +++ b/ObjectiveFrame.lua Fri Apr 01 12:27:05 2016 -0400 @@ -83,13 +83,13 @@ }, Active = { Title = { - Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, }, + Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .4}, }, Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, BackgroundFullWidth = true }, Text = { - Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, }, + Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .2}, }, Font = {textFont, textSize, textOutline}, Spacing = textSpacing, BackgroundFullWidth = true @@ -107,6 +107,28 @@ BackgroundFullWidth = true } }, + CheevNormal = { + + Title = { + Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}}, + Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, + }, + Text = { + Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}}, + Font = {textFont, textSize, textOutline}, Spacing = textSpacing, + }, + }, + CheevComplete = { + + Title = { + Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}}, + Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, + }, + Text = { + Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}}, + Font = {textFont, textSize, textOutline}, Spacing = textSpacing, + }, + } } } @@ -137,7 +159,8 @@ local Scroller_OnMouseWheel = function(self, delta) local r = Scroll:GetHeight() - Scroller:GetHeight() - local s = self:GetVerticalScroll() - delta * floor(r/5+.5) + local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5) + local from = self:GetVerticalScroll() if r == 0 then return end if s >= r then s = r @@ -145,7 +168,8 @@ s = 0 end self:SetVerticalScroll(s) - print(s, r, self:GetVerticalScroll()) + B.Conf.ObjectiveScroll = s + print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll()) mod.UpdateActionButtons('SCROLLING') end @@ -322,7 +346,7 @@ block.objectives:SetSpacing(textSpacing) block.objectives:SetWordWrap(true) - local titleHeight, textHeight = block.title:GetStringHeight(), block.objectives:GetStringHeight() + local titleHeight, textHeight = block.title:GetStringHeight(), block.objectives:GetStringHeight() + block.attachmentHeight local blockHeight = titleHeight + titleSpacing2 + textHeight + textSpacing2 local blockWidth = wrapperMaxWidth @@ -387,6 +411,7 @@ info.blockIndex = blockIndex handler.BlockInfo[blockIndex] = info + t.Select = handler.Select t.Open = handler.Open t.Remove = handler.Remove @@ -395,18 +420,16 @@ t:SetScript('OnMouseDown', handler.OnMouseDown) t.title:SetText(info.title) + t.attachmentHeight = 0 if info.isComplete then t.objectives:Show() t.objectives:SetText(info.completionText) elseif info.numObjectives >= 1 then + t.attachmentHeight = textSpacing t.objectives:Show() print(' - objective lines:', info.numObjectives, 'can wrap:', t.objectives:CanWordWrap()) local text = '' - if info.description then - print(' -- has description text:', select('#', info.description), info.description) - text = info.description - end --- todo: implement objective displays -- in an accumulator loop, call upon handler for the appropriate display frame, each defining: @@ -454,7 +477,11 @@ end mod.UpdateObjectives = function(block, info, text) - local attachmentHeight = 0 + local attachmentHeight = block.attachmentHeight + if info.description then + print(' -- has description text:', select('#', info.description), info.description) + text = info.description + end for o, obj in ipairs(info.objectives) do --- achievement criteria if obj.flags then @@ -462,7 +489,6 @@ if bit.band(obj.flags, 0x00000001) > 0 then obj.type = 'ProgressBar' - obj.widget = mod.SetWidget(obj, info) elseif bit.band(obj.flags, 0x00000002) then obj.type = 'Hidden' obj.widget = nil @@ -472,7 +498,9 @@ text = text .. ((text == '') and "" or "\n") .. obj.text end - print(obj.type, obj.text, obj.quantityString) + print('obj.type =', obj.type) + print(' ** qtyStr:', obj.quantityString, 'qty:', obj.quantity, 'assetID:', obj.assetID) + obj.widget = mod.SetWidget(obj, info) --- none of the above (most quests) else local line = obj.text @@ -490,6 +518,10 @@ end if obj.widget then + + obj.widget:Show() + obj.widget:SetPoint('TOPLEFT', block.objectives, 'BOTTOMLEFT', 0, -attachmentHeight) + print('have a widget, height is', obj.widget.height) attachmentHeight = attachmentHeight + obj.widget.height end @@ -620,8 +652,9 @@ Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, -headerHeight) Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT') + Scroll:SetSize(scrollWidth, scrollHeight) - Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, 0) + Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0) Scroll:SetPoint('RIGHT', Scroller, 'RIGHT') --Scroller:UpdateScrollChildRect()