# HG changeset patch # User Nenue # Date 1459633612 14400 # Node ID 9455693fc29068c31222f3545ba6ceebf0110fc8 # Parent 8238cddaddb1b93e7bbf6c70f665b8597c68e20b Init - recall XML display state on reload ObjectiveFrame - quest coloring by relative level - quest coloring by daily/weekly/complete status - remember starting scroll value between reload - limit anchor points to edges for regions affected by style attributes ObjectiveInfo - AutoQuest outline definitions - Pull Quest title and tag data in addition to WatchInfo ObjectiveStyle - ensure consistent style table - hardcode certain attributes for sanity XML - ensure consistent naming conventions for heading and content elements - ensure hardcore anchors are based on edges - expansion of file structure to deal with complexities of dynamic widgets and style caching ObjectiveUI - determine primary style by block handler when restoring original style - moved framescript to 'ObjectiveWidgets' lua diff -r 8238cddaddb1 -r 9455693fc290 Init.lua --- a/Init.lua Sat Apr 02 05:01:54 2016 -0400 +++ b/Init.lua Sat Apr 02 17:46:52 2016 -0400 @@ -386,6 +386,17 @@ --- Generic handlers for keeping track of XML-defined frames B.OnLoad = function(self) tinsert(checkForConfig, self) + self.Minimize = function(self, forceDown) + if not self:IsVisible() then + return + end + local state = (forceDown and 1 or (B.Conf.FrameState[self:GetName()] == 1 and 2 or 1)) + local stateFunc = (state == 1) and 'Hide' or 'Show' + for i, region in pairs(self.minimizeFrames) do + region[stateFunc](region) + end + B.Conf.FrameState[self:GetName()] = state + end end B.InitXMLFrame = function(self) @@ -395,12 +406,25 @@ if not B.Conf.FramePosition then B.Conf.FramePosition = {} end + if not B.Conf.FrameState then + B.Conf.FrameState = {} + end + if B.Conf.FramePosition[self:GetName()] then print('restoring frame position', unpack(B.Conf.FramePosition[self:GetName()])) self:ClearAllPoints() local anchorTo, relativePoint, x, y = unpack(B.Conf.FramePosition[self:GetName()]) self:SetPoint(anchorTo, UIParent, relativePoint, x, y) end + local state = B.Conf.FrameState[self:GetName()] and B.Conf.FrameState[self:GetName()] or 2 + if state == 0 then + self:Hide() + elseif state == 1 then + self.Minimize(self, true) + elseif state == 2 then + self:Show() + end + B.Conf.FrameState[self:GetName()] = state end B.OnDragStart = function(self) diff -r 8238cddaddb1 -r 9455693fc290 ObjectiveCore.lua --- a/ObjectiveCore.lua Sat Apr 02 05:01:54 2016 -0400 +++ b/ObjectiveCore.lua Sat Apr 02 17:46:52 2016 -0400 @@ -184,6 +184,7 @@ mod.SetEvents() ObjectiveTrackerFrame:UnregisterAllEvents() ObjectiveTrackerFrame:Hide() + end --[[ diff -r 8238cddaddb1 -r 9455693fc290 ObjectiveFrame.lua --- a/ObjectiveFrame.lua Sat Apr 02 05:01:54 2016 -0400 +++ b/ObjectiveFrame.lua Sat Apr 02 17:46:52 2016 -0400 @@ -10,6 +10,7 @@ local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent local CreateFrame = CreateFrame local print = B.print('Objectives') +local unitLevel = 1 -------------------------------------------------------------------- --- Global frame layout -------------------------------------------------------------------- @@ -77,12 +78,17 @@ end local WrapperCloseButton_OnClick = function(self) - if Scroller:IsVisible() then - Scroller:Hide() + Wrapper:Minimize() + if B.Conf.FrameState[Wrapper:GetName()] == 1 then + self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Up]]) + self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Down]]) else - Scroller:Show() + self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Up]]) + self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Down]]) end end +local WrapperCloseButton_OnMouseWheel = function(self, delta) +end mod.InitializeTrackers = function() @@ -112,9 +118,11 @@ Scroller:SetScript('OnShow', Scroller_OnShow) Scroller:SetScript('OnHide', Scroller_OnHide) Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick) + Wrapper.close:SetScript('OnMouseWheel', WrapperCloseButton_OnMouseWheel) Wrapper:SetPoint(unpack(wrapperPosition)) - Scroller_OnShow(Scroller) - + if B.Conf.ObjectiveTrackerMinimized then + Scroller_OnShow(Scroller) + end mod.UpdateWrapperStyle() end @@ -287,6 +295,8 @@ end if info.superTracked then subStyle = 'Super' + elseif info.isDaily then + subStyle = 'Daily' end if info.specialItem and not info.itemButton then @@ -296,9 +306,25 @@ --info.itemButton = nil end + if info.level then + local levelDiff = unitLevel - info.level + if levelDiff > 9 then + t.title:SetTextColor(0.7, 0.7, 0.7, 1) + elseif levelDiff > 1 then + t.title:SetTextColor(0.5, 1, 0.5, 1) + elseif levelDiff < -1 then + t.title:SetTextColor(1, 0.4, 0.25, 1) + elseif levelDiff < -4 then + t.title:SetTextColor(1, 0, 0, 1) + else + t.title:SetTextColor(1,1,1,1) + end + end + + if Devian and Devian.InWorkspace() then t.debugText:Show() - t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName())) + t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (info.level and info.level or '-')) end --- metrics are calculated in SetStyle @@ -440,6 +466,7 @@ local usedButtons = mod.Quest.itemButtons local freeButtons = mod.Quest.freeButtons mod.UpdateWrapper = function() + unitLevel = UnitLevel('player') wrapperWidth = wrapperMaxWidth scrollWidth = wrapperWidth local wrapperBlocks = 0 @@ -498,7 +525,7 @@ mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal') Scroller:SetSize(wrapperWidth, wrapperHeight) - Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, -headerHeight) + Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0) Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT') @@ -507,7 +534,7 @@ Scroll:SetPoint('RIGHT', Scroller, 'RIGHT') --Scroller:UpdateScrollChildRect() - Wrapper:SetSize(wrapperWidth, wrapperHeight + headerHeight) + Wrapper:SetSize(wrapperWidth, wrapperHeight) -- update action buttons print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(), diff -r 8238cddaddb1 -r 9455693fc290 ObjectiveInfo.lua --- a/ObjectiveInfo.lua Sat Apr 02 05:01:54 2016 -0400 +++ b/ObjectiveInfo.lua Sat Apr 02 17:46:52 2016 -0400 @@ -9,6 +9,19 @@ -------------------------------------------------------------------- --- Tracker-specific data retrieval functions -------------------------------------------------------------------- + + +----------------------------- +--- AUTO_QUEST +AutoQuest.name = "Remote Quests" +AutoQuest.GetNumWatched = GetNumAutoQuestPopUps +AutoQuest.GetInfo = function(watchIndex) + return Quest.GetInfo(watchIndex) +end + +----------------------------- +--- QUEST +Quest.name = "Quests" Quest.itemButtons = {} Quest.freeButtons = {} Quest.POI = {} @@ -20,6 +33,10 @@ print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') local questID, title, questIndex, numObjectives, requiredMoney, isComplete, startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) + + local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) + local questTagID, tagName = GetQuestTagInfo(questID); + if not questID then return end @@ -30,6 +47,7 @@ q.type = 'Quest' q.questID = questID q.title = title + q.level = level q.questLogIndex = questIndex q.numObjectives = numObjectives q.requiredMoney = requiredMoney @@ -44,21 +62,16 @@ q.isOnMap = isOnMap q.hasLocalPOI = hasLocalPOI - --- Start QuestLogEntry calls - ----------------------------------------- - SelectQuestLogEntry(questIndex) - q.greenRange = GetQuestGreenRange() - q.isDaily = QuestIsDaily() - q.isWeekly = QuestIsWeekly() - ----------------------------------------- - --- End QuestLogEntry calls - - q.isComplete = IsQuestComplete(questID) - q.isBreadCrumb = IsBreadcrumbQuest(questID) - q.isStoryQuest = IsStoryQuest(questID) + q.isDaily = ( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) + q.isWeekly = ( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) ) + q.isComplete = isComplete + q.isStory = isStory + q.isTask = isTask + --q.isBreadCrumb = isBreadCrumb q.completionText= GetQuestLogCompletionText(questIndex) q.numObjectives = GetNumQuestLeaderBoards(questIndex) q.isWatched = IsQuestWatched(questIndex) + q.isHardWatched = IsQuestHardWatched(questIndex) q.objectives = {} for i = 1, q.numObjectives do local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) @@ -121,10 +134,6 @@ end end -AutoQuest.GetInfo = function(watchIndex) - return Quest.GetInfo(watchIndex) -end - Cheevs.GetNumWatched = function(self) Cheevs.trackedCheevs = {GetTrackedAchievements()} diff -r 8238cddaddb1 -r 9455693fc290 ObjectiveStyle.lua --- a/ObjectiveStyle.lua Sat Apr 02 05:01:54 2016 -0400 +++ b/ObjectiveStyle.lua Sat Apr 02 17:46:52 2016 -0400 @@ -11,12 +11,13 @@ local titleSize, textSize = 15, 15 local titleOutline, textOutline = "OUTLINE", "OUTLINE" local titleSpacing, textSpacing = 4, 3 -local textIndent = 5 +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 + mod.defaults.ObjectiveWrapper = { ObjectiveTrackerFloat = {'BOTTOM', 'RIGHT'}, ObjectiveTrackerParent = 'DebuffButton', @@ -24,7 +25,18 @@ ObjectiveWrapperParent = '', } mod.defaults.Style = { - FontBank = { + Format = { + Frame = { + Width = 270, + }, + title = { + Indent = 0 + }, + status = { + Indent = 5 + } + }, + FontBank = { ['Normal'] = _G.VeneerCriteriaFontNormal, ['Progress'] = _G.VeneerCriteriaFontProgress, ['Complete'] = _G.VeneerCriteriaFontComplete, @@ -106,14 +118,12 @@ }, titlebg = { Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .4}, }, - BackgroundFullWidth = true, }, status = { Font = {textFont, textSize, textOutline}, Spacing = textSpacing, }, statusbg = { - BackgroundFullWidth = true, Gradient = { MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, .2}, }, } }, @@ -123,16 +133,22 @@ }, titlebg = { Gradient = { MinColor = {0, 1, 0, 0.34}, MaxColor = {0, 1, 0, .17}, }, - BackgroundFullWidth = true }, status = { Font = {textFont, textSize, textOutline}, Spacing = textSpacing, }, statusbg = { Gradient = { MinColor = {0, 1, 0, .25}, MaxColor = {0, 1, 0, 0.12}, }, - BackgroundFullWidth = true } }, + Daily = { + titlebg = { + Gradient = { MinColor = {0, .4, 1, 0.34}, MaxColor = {0, 0.4, 1, .17}, }, + }, + statusbg = { + Gradient = { MinColor = {0, .4, 1, 0.25}, MaxColor = {0, 0.4, 1, .12}, }, + }, + }, Cheev = { Normal = { @@ -303,27 +319,18 @@ end style_cache_func[styleName](frame) - - --print("Generated func = function()\n",code, "\nend") - --local cache_func[styleName] = loadstring(code) - - -- todo: remove hardcode and rely on attribute handler - if frame.status then - frame.status:SetWidth(270) - end - if frame.title then - frame.title:SetWidth(270) - end - - + --- 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.width = 270 - + 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) + print('status ', frame.statusHeight, normalSettings.status.Indent, 0) + frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0) frame.status:SetHeight(frame.statusHeight) if frame.statusbg then @@ -333,7 +340,8 @@ end end if frame.title then - print('title ',frame.titleHeight) + print('title ',frame.titleHeight, normalSettings.title.Indent) + frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent) frame.title:SetHeight(frame.titleHeight) if frame.titlebg then print('titlebg',frame.titleHeight) diff -r 8238cddaddb1 -r 9455693fc290 ObjectiveTracker.xml --- a/ObjectiveTracker.xml Sat Apr 02 05:01:54 2016 -0400 +++ b/ObjectiveTracker.xml Sat Apr 02 17:46:52 2016 -0400 @@ -5,6 +5,10 @@ + + + + @@ -93,6 +97,16 @@ + + + @@ -131,14 +145,18 @@ - - + @@ -268,18 +286,23 @@ - + - - - - - - + + + - + + + + + + + + + @@ -297,4 +320,5 @@