diff --git a/SVUI_!Core/system/api.lua b/SVUI_!Core/system/api.lua index 24248a0..117d751 100644 --- a/SVUI_!Core/system/api.lua +++ b/SVUI_!Core/system/api.lua @@ -77,6 +77,7 @@ MOD.Templates = { ["Default"] = "SVUI_CoreStyle_Default", ["Transparent"] = "SVUI_CoreStyle_Transparent", ["Button"] = "SVUI_CoreStyle_Button", + ["EditBox"] = "SVUI_CoreStyle_EditBox", ["CheckButton"] = "SVUI_CoreStyle_CheckButton", ["DockButton"] = "SVUI_CoreStyle_DockButton", ["ActionSlot"] = "SVUI_CoreStyle_ActionSlot", @@ -402,6 +403,9 @@ local HookPanelBorderColor = function(self,r,g,b,a) self.BorderTop:SetVertexColor(r,g,b,a) self.BorderBottom:SetVertexColor(r,g,b,a) end + if self.InnerGlow then + self.InnerGlow:SetBackdropColor(r*0.25,g*0.25,b*0.25,0.5) + end if self.Shadow then local alpha = self.Shadow:GetAttribute("shadowAlpha") or 0.5 self.Shadow:SetBackdropBorderColor(r,g,b,alpha) @@ -1054,8 +1058,10 @@ MOD.Methods["Editbox"] = function(self, frame, inverse, x, y) if frame.Middle then frame.Middle:Die() end local underlay = (not inverse) - self:APPLY(frame, "Inset", underlay, 1, x, y) - + self:APPLY(frame, "EditBox", underlay, 1, x, y) + if(frame.Panel.InnerGlow) then + frame.Panel.InnerGlow:SetFrameLevel(0) + end local globalName = frame:GetName(); if globalName then if _G[globalName.."Left"] then _G[globalName.."Left"]:Die() end diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua index 045bf2f..fff2c1e 100644 --- a/SVUI_!Core/system/dock.lua +++ b/SVUI_!Core/system/dock.lua @@ -290,7 +290,7 @@ end local function SetBasicBackdrop(frame) local backdrop = CreateFrame("Frame", nil, frame) - backdrop:SetAllPoints(frame) + backdrop:InsetPoints(frame,4,4) backdrop:SetFrameStrata("BACKGROUND") local underlay = backdrop:CreateTexture(nil, "BORDER") @@ -381,7 +381,7 @@ function MOD.SetThemedBackdrop(frame, forceTop) local left = backdrop:CreateTexture(nil, "BORDER") left:SetTexture(1, 1, 1, 1) - left:SetPoint("TOPLEFT", 1, -1) + left:SetPoint("TOPLEFT", -1, 1) left:SetPoint("BOTTOMLEFT", -1, -1) left:SetWidth(2) @@ -389,21 +389,23 @@ function MOD.SetThemedBackdrop(frame, forceTop) local right = backdrop:CreateTexture(nil, "BORDER") right:SetTexture(1, 1, 1, 1) - right:SetPoint("TOPRIGHT", -1, -1) - right:SetPoint("BOTTOMRIGHT", -1, -1) + right:SetPoint("TOPRIGHT", 1, 1) + right:SetPoint("BOTTOMRIGHT", 1, -1) right:SetWidth(2) backdrop.right = right; local bottom = backdrop:CreateTexture(nil, "BORDER") - bottom:SetPoint("BOTTOMLEFT", 1, -1) - bottom:SetPoint("BOTTOMRIGHT", -1, -1) + bottom:SetPoint("BOTTOMLEFT", -1, -1) + bottom:SetPoint("BOTTOMRIGHT", 1, -1) + bottom:SetHeight(2) backdrop.bottom = bottom; local top = backdrop:CreateTexture(nil, "BORDER") - top:SetPoint("TOPLEFT", 1, -1) - top:SetPoint("TOPRIGHT", -1, 1) + top:SetPoint("TOPLEFT", -1, 1) + top:SetPoint("TOPRIGHT", 1, 1) + top:SetHeight(2) backdrop.top = top; @@ -825,7 +827,7 @@ end local DockBar_SetDefault = function(self, button) local location = self.Data.Location; - + self.Parent.Alert:Deactivate() if(button) then local name = button:GetName() local lookup = MOD.private.Locations[name]; @@ -1485,25 +1487,15 @@ DOCKS MOD.TopCenter = _G["SVUI_DockTopCenter"]; MOD.BottomCenter = _G["SVUI_DockBottomCenter"]; --- local DockBar_OnEvent = function(self, event) --- if(event == 'PLAYER_REGEN_ENABLED') then --- self:UnregisterEvent("PLAYER_REGEN_ENABLED") --- DockBar_SetDefault(self) --- end --- end - -local DockAlert_Activate = function(self, child) - if(not self.backdrop) then return end - local size = SV.db.Dock.buttonSize or 22; +local DockAlert_Activate = function(self, child, newHeight) + local fallbackHeight = SV.db.Dock.buttonSize or 22; + local size = newHeight or fallbackHeight; self:SetHeight(size) - self.backdrop:Show() child:ClearAllPoints() child:SetAllPoints(self) end local DockAlert_Deactivate = function(self) - if(not self.backdrop) then return end - self.backdrop:Hide() self:SetHeight(1) end @@ -1820,20 +1812,7 @@ local CornerButton2_OnClick = function(self, button) end end --- function MOD:UpdateLocals() --- DOCK_WIDTH = SV.db.Dock.dockWidth; --- DOCK_HEIGHT = SV.db.Dock.dockHeight; --- DOCK_ALPHA = SV.db.Dock.dockOpacity; --- end - function MOD:UpdateDockBackdrops() - if(DOCK_CHECK) then - MOD.BottomRight.Alert.backdrop:ClearAllPoints() - MOD.BottomRight.Alert.backdrop:WrapPoints(MOD.BottomRight.Alert, 4, 4) - MOD.BottomLeft.Alert.backdrop:ClearAllPoints() - MOD.BottomLeft.Alert.backdrop:WrapPoints(MOD.BottomLeft.Alert, 4, 4) - end - for name,frame in pairs(DOCK_REGISTRY) do if(frame.backdrop and frame.UpdateBackdrop) then frame:UpdateBackdrop() @@ -2036,8 +2015,6 @@ function MOD:Load() MOD.private.Order[location] = {} end - --dock.Bar.Data.Order = MOD.private.Order[location]; - dock.Bar.ToolBar:ClearAllPoints() if(dock.Bar.Button) then @@ -2107,9 +2084,6 @@ function MOD:Load() dock.Window:SetSize(width, height) dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4) - dock.Alert.backdrop = SetBasicBackdrop(dock.Alert) - dock.Alert.backdrop:Hide() - SV:NewAnchor(dock.Bar, location .. " Dock ToolBar"); SV:SetAnchorResizing(dock.Bar, dockBarPostSizeFunc, 10, 500, 10, 80); SV:NewAnchor(dock, location .. " Dock Window"); diff --git a/SVUI_!Core/xml/styles.xml b/SVUI_!Core/xml/styles.xml index 2ba52b3..1dcf00d 100644 --- a/SVUI_!Core/xml/styles.xml +++ b/SVUI_!Core/xml/styles.xml @@ -254,6 +254,39 @@ </Backdrop> </Frame> + <Frame name="SVUI_CoreStyle_EditBox" virtual="true"> + <Attributes> + <Attribute name="panelID" type="string" value="editbox" /> + <Attribute name="panelPadding" type="number" value="1" /> + <Attribute name="panelColor" type="string" value="transparent" /> + <Attribute name="panelGradient" type="boolean" value="false" /> + <Attribute name="panelTexUpdate" type="boolean" value="false" /> + <Attribute name="panelSkipUpdate" type="boolean" value="true" /> + </Attributes> + <Backdrop bgFile="Interface\AddOns\SVUI_!Core\assets\backgrounds\EMPTY" tile="true" edgeFile="Interface\BUTTONS\WHITE8X8"> + <EdgeSize val="1" /> + <TileSize val="20" /> + <BackgroundInsets left="0" right="0" top="0" bottom="0" /> + <BorderColor r="0" g="0" b="0" a="1" /> + <Color r="0" g="0" b="0" a="0" /> + </Backdrop> + <Frames> + <Frame parentKey="InnerGlow"> + <Anchors> + <Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="1" y="-1" /> + <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="-1" y="1" /> + </Anchors> + <Backdrop bgFile="Interface\AddOns\SVUI_!Core\assets\backgrounds\DEFAULT" edgeFile="Interface\AddOns\SVUI_!Core\assets\borders\INSET" tile="false"> + <EdgeSize val="12" /> + <TileSize val="0" /> + <BackgroundInsets left="0" right="0" top="0" bottom="0" /> + <Color r="0" g="0" b="0" a="0.25" /> + <BorderColor r="0" g="0" b="0" a="1" /> + </Backdrop> + </Frame> + </Frames> + </Frame> + <Frame name="SVUI_CoreStyle_Lite" virtual="true"> <Attributes> <Attribute name="panelID" type="string" value="lite" /> diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua index e32ec27..a404389 100644 --- a/SVUI_Chat/SVUI_Chat.lua +++ b/SVUI_Chat/SVUI_Chat.lua @@ -831,9 +831,9 @@ do _G[editBoxName.."FocusLeft"]:Die() _G[editBoxName.."FocusMid"]:Die() _G[editBoxName.."FocusRight"]:Die() - editBox:SetStyle("Frame", "Lite", true, 2, -2, -3) editBox:SetAltArrowKeyMode(false) editBox:SetAllPoints(chat.Dock.Parent.Alert) + SV.API:Set("!_EditBox", editBox, false, false, -2, -1) editBox:HookScript("OnEditFocusGained", EditBox_OnEditFocusGained) editBox:HookScript("OnEditFocusLost", EditBox_OnEditFocusLost) editBox:HookScript("OnTextChanged", EditBox_OnTextChanged) diff --git a/SVUI_QuestTracker/SVUI_QuestTracker.lua b/SVUI_QuestTracker/SVUI_QuestTracker.lua index f5b984d..85ff683 100644 --- a/SVUI_QuestTracker/SVUI_QuestTracker.lua +++ b/SVUI_QuestTracker/SVUI_QuestTracker.lua @@ -361,13 +361,17 @@ function MOD:UpdateDimensions() local scrollWidth = MOD.Docklet.ScrollFrame:GetWidth(); for headerName, headerFrame in pairs(MOD.Headers) do - totalHeight = totalHeight + headerFrame:GetHeight() + if(headerName == 'Active') then + totalHeight = totalHeight - headerFrame:GetHeight() + elseif(headerName ~= 'Popups') then + totalHeight = totalHeight + headerFrame:GetHeight() + end headerFrame:SetWidth(scrollWidth) end MOD.Docklet.ScrollFrame.MaxVal = totalHeight; MOD.Docklet.ScrollFrame.ScrollBar:SetMinMaxValues(1, totalHeight); - MOD.Docklet.ScrollFrame.ScrollBar:SetHeight(scrollHeight); + --MOD.Docklet.ScrollFrame.ScrollBar:SetHeight(scrollHeight); MOD.Docklet.ScrollFrame.ScrollChild:SetWidth(scrollWidth); MOD.Docklet.ScrollFrame.ScrollChild:SetHeight(totalHeight); end @@ -406,18 +410,22 @@ function MOD:ReLoad() end function MOD:Load() + self.Headers = {} self.Docklet = SV.Dock:NewDocklet("BottomRight", "SVUI_QuestTracker", "Quest Tracker", MOD.media.dockIcon); + self:InitializeActive() + local scrollFrame = CreateFrame("ScrollFrame", "SVUI_QuestTrackerScrollFrame", self.Docklet); - scrollFrame:SetPoint("TOPLEFT", self.Docklet, "TOPLEFT", 4, -2); + scrollFrame:SetPoint("TOPLEFT", self.Headers["Active"], "BOTTOMLEFT", 4, -2); scrollFrame:SetPoint("BOTTOMRIGHT", self.Docklet, "BOTTOMRIGHT", -30, 2); scrollFrame:EnableMouseWheel(true); scrollFrame.MaxVal = 420; local scrollBar = CreateFrame("Slider", "SVUI_QuestTrackerScrollFrameScrollBar", scrollFrame); - scrollBar:SetHeight(scrollFrame:GetHeight()); + --scrollBar:SetHeight(scrollFrame:GetHeight()); scrollBar:SetWidth(18); - scrollBar:SetPoint("TOPRIGHT", self.Docklet, "TOPRIGHT", -4, -2); + scrollBar:SetPoint("TOPRIGHT", self.Headers["Active"], "BOTTOMRIGHT", -4, 2); + scrollBar:SetPoint("BOTTOMRIGHT", self.Docklet, "BOTTOMRIGHT", -4, 2); scrollBar:SetFrameLevel(6) scrollBar:SetOrientation("VERTICAL"); scrollBar:SetValueStep(5); @@ -432,7 +440,7 @@ function MOD:Load() scrollChild:SetWidth(scrollFrame:GetWidth()); scrollChild:SetClampedToScreen(false) scrollChild:SetHeight(500) - scrollChild:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -2, 0) + scrollChild:SetPoint("BOTTOMRIGHT", scrollFrame, "BOTTOMRIGHT", -2, 0) scrollChild:SetFrameLevel(scrollFrame:GetFrameLevel() + 1) scrollFrame:SetScrollChild(scrollChild); @@ -456,10 +464,8 @@ function MOD:Load() self.ClosestQuest = 0; self.CurrentQuest = 0; - self.Headers = {} self:InitializePopups() - self:InitializeActive() self:InitializeScenarios() --self:InitializeQuestItem() self:InitializeBonuses() diff --git a/SVUI_QuestTracker/components/active.lua b/SVUI_QuestTracker/components/active.lua index 1823f06..6a6ae0b 100644 --- a/SVUI_QuestTracker/components/active.lua +++ b/SVUI_QuestTracker/components/active.lua @@ -99,7 +99,7 @@ local ActiveButton_OnClick = function() end local ViewButton_OnClick = function(self, button) - local questIndex = self:GetID(); + local questIndex = self.LogID; if(questIndex and (questIndex ~= 0)) then local questID = select(8, GetQuestLogTitle(questIndex)); if(IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow()) then @@ -145,14 +145,14 @@ local UnsetActiveData = function(self, bypass) block.Header.Text:SetText(''); block.Header.Level:SetText(''); block.Badge.Icon:SetTexture(""); - block.Button:SetID(0); + block.Button.LogID = 0; self.ActiveQuestID = 0; MOD.ActiveQuestID = self.ActiveQuestID; MOD.CurrentQuest = 0; block.Objectives:Reset(); - self:SetHeight(1); block:SetAlpha(0); self:SetAlpha(0); + self:SetHeight(1); -- if(MOD.QuestItem and MOD.QuestItem:IsShown()) then -- MOD.QuestItem.CurrentQuest = 0; -- MOD.QuestItem.Artwork:SetTexture(""); @@ -166,7 +166,7 @@ local UnsetActiveData = function(self, bypass) end end -local SetActiveData = function(self, title, level, icon, questID, questLogIndex, numObjectives, duration, elapsed, isComplete) +local SetActiveData = function(self, title, level, icon, questID, questLogIndex, numObjectives, duration, elapsed, isComplete, itemLink) if(not questID) then return end self.ActiveQuestID = questID; MOD.ActiveQuestID = self.ActiveQuestID; @@ -181,7 +181,8 @@ local SetActiveData = function(self, title, level, icon, questID, questLogIndex, block.Header.Level:SetTextColor(color.r, color.g, color.b); block.Header.Level:SetText(level); block.Header.Text:SetText(title); - block.Button:SetID(questLogIndex); + + block.Button.LogID = questLogIndex; MOD.CurrentQuest = questLogIndex; @@ -202,7 +203,7 @@ local SetActiveData = function(self, title, level, icon, questID, questLogIndex, if(objective_rows > 0) then objective_block:SetHeight(fill_height); objective_block:FadeIn(); - fill_height = fill_height + ((INNER_HEIGHT + 4) + (LARGE_INNER_HEIGHT)); + fill_height = fill_height + (LARGE_INNER_HEIGHT + 2); else fill_height = fill_height + LARGE_INNER_HEIGHT + 12; end @@ -217,6 +218,15 @@ local SetActiveData = function(self, title, level, icon, questID, questLogIndex, icon = icon or MOD.media.incompleteIcon; end block.Badge.Icon:SetTexture(icon); + -- if(itemLink) then + -- local iName, _, _, _ = GetItemInfo(itemLink); + -- block.Badge.Button.macrotext = '/use '..iName; + -- if(InCombatLockdown()) then + -- block.Badge.Button:RegisterEvent('PLAYER_REGEN_ENABLED') + -- else + -- block.Badge.Button:SetAttribute('item', block.Badge.Button.macrotext) + -- end + -- end if(block.Badge.StartTracking) then block.Badge:StartTracking(questID) @@ -231,7 +241,8 @@ local RefreshActiveHeight = function(self) else self:FadeIn(); self.Block:FadeIn(); - self:SetHeight(self.Block:GetHeight()) + local height = self.Block:GetHeight() + self:SetHeight(height) end end @@ -272,6 +283,13 @@ local RefreshActiveObjective = function(self, event, ...) end end end + +local MacroButton_OnEvent = function(self, event) + if(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('macrotext', self.macrotext) + self:UnregisterEvent(event) + end +end --[[ ########################################################## CORE FUNCTIONS @@ -303,12 +321,9 @@ local function UpdateActiveLocals(...) end function MOD:InitializeActive() - local scrollChild = self.Docklet.ScrollFrame.ScrollChild; - - local active = CreateFrame("Frame", nil, scrollChild) - active:SetWidth(ROW_WIDTH); - active:SetHeight(1); - active:SetPoint("TOPLEFT", self.Headers["Popups"], "BOTTOMLEFT", 0, 0); + local active = CreateFrame("Frame", nil, self.Docklet) + active:SetPoint("TOPLEFT", self.Docklet, "TOPLEFT"); + active:SetPoint("TOPRIGHT", self.Docklet, "TOPRIGHT"); local block = CreateFrame("Frame", nil, active) block:SetPoint("TOPLEFT", active, "TOPLEFT", 2, -4); @@ -319,8 +334,8 @@ function MOD:InitializeActive() block.Button:SetPoint("TOPLEFT", block, "TOPLEFT", 0, 0); block.Button:SetPoint("BOTTOMRIGHT", block, "BOTTOMRIGHT", 0, 8); block.Button:SetStyle("DockButton", "Transparent") - block.Button:SetBackdropBorderColor(0, 0.9, 0, 0.5) - block.Button:SetID(0) + --block.Button:SetBackdropBorderColor(0, 0.9, 0, 0.5) + block.Button.LogID = 0 block.Button.Parent = active; block.Button:SetScript("OnClick", ViewButton_OnClick) block.Button:SetScript("OnEnter", ActiveButton_OnEnter) @@ -331,8 +346,8 @@ function MOD:InitializeActive() block.CloseButton:SetStyle("Button", -7, -7, "red") block.CloseButton:SetFrameLevel(block.Button:GetFrameLevel() + 4) block.CloseButton:SetNormalTexture(SV.media.icon.close) - block.CloseButton:HookScript("OnEnter", CloseButton_OnEnter) - block.CloseButton:HookScript("OnLeave", CloseButton_OnLeave) + block.CloseButton:HookScript("OnEnter", CloseButton_OnEnter) + block.CloseButton:HookScript("OnLeave", CloseButton_OnLeave) block.CloseButton:SetPoint("TOPRIGHT", block.Button, "TOPRIGHT", 4, 4); block.CloseButton:RegisterForClicks("LeftButtonUp", "RightButtonUp") block.CloseButton.Parent = active; @@ -348,6 +363,16 @@ function MOD:InitializeActive() block.Badge.Icon:SetTexture(MOD.media.incompleteIcon) block.Badge.Icon:SetTexCoord(unpack(_G.SVUI_ICON_COORDS)) + -- block.Badge.Button = CreateFrame("Button", nil, UIParent, "SecureActionButtonTemplate") + -- local bX,bY = block.Badge:GetCenter() + -- block.Badge.Button:SetPoint("CENTER", UIParent, "CENTER", bX,bY); + -- block.Badge.Button:SetStyle("LiteButton") + -- block.Badge.Button.LogID = 0 + -- block.Badge.Button:SetFrameLevel(999); + -- block.Badge.Button.Icon = block.Badge.Icon; + -- block.Badge.Button:SetAttribute("type", "macro") + -- block.Badge.Button:SetScript('OnEvent', MacroButton_OnEvent); + block.Header = CreateFrame("Frame", nil, block) block.Header:SetPoint("TOPLEFT", block.Badge, "TOPRIGHT", 4, 0); block.Header:SetPoint("TOPRIGHT", block.Button, "TOPRIGHT", -24, -4); diff --git a/SVUI_QuestTracker/components/popups.lua b/SVUI_QuestTracker/components/popups.lua index 92ef9a8..43b713b 100644 --- a/SVUI_QuestTracker/components/popups.lua +++ b/SVUI_QuestTracker/components/popups.lua @@ -76,8 +76,8 @@ local GetPopUpRow = function(self, index) row.Button = CreateFrame("Button", nil, row) row.Button:SetPoint("TOPLEFT", row, "TOPLEFT", 0, 0); row.Button:SetPoint("BOTTOMRIGHT", row, "BOTTOMRIGHT", 0, 0); - row.Button:SetStyle("LiteButton") - row.Button:SetPanelColor("yellow") + row.Button:SetStyle("Button") + row.Button:SetPanelColor('yellow') row.Button:SetID(0) row.Button.PopUpType = nil; row.Button:SetScript("OnClick", PopUpButton_OnClick) @@ -146,10 +146,10 @@ local RefreshPopupObjective = function(self) end if(rows == 0 or (fill_height <= 1)) then - self:SetHeight(1); + self.CurrentHeight = 1; self:SetAlpha(0); else - self:SetHeight(fill_height + 2); + self.CurrentHeight = (fill_height + 2); self:FadeIn(); end end @@ -181,6 +181,7 @@ local AddAutoPopUp = function(self, questID, popUpType, noCheck) self:Refresh(); MOD:UpdateDimensions(); PlaySound("UI_AutoQuestComplete"); + MOD.Docklet.Parent.Alert:Activate(self,self.CurrentHeight) end end @@ -191,6 +192,7 @@ local RemoveAutoPopUp = function(self, questID, noRemove) self:Reset(); self:Refresh(); MOD:UpdateDimensions(); + MOD.Docklet.Parent.Alert:Deactivate(); end local _hook_AddAutoPopUpQuests = function(questID, popUpType) @@ -205,6 +207,15 @@ end CORE FUNCTIONS ########################################################## ]]-- +-- /script TEST_AUTOPOPUPS() +-- function TEST_AUTOPOPUPS() +-- local self = MOD.Headers["Popups"]; +-- self:SetPopup(0, 'Testing', 'TEST', 1, 1); +-- PlaySound("UI_AutoQuestComplete"); +-- MOD.Docklet.Parent.Alert:Activate(self,50) +-- self:FadeIn(); +-- end + function MOD:UpdatePopupQuests(event, ...) local questID = ...; self.Headers["Popups"]:AddPopup(questID, "COMPLETE"); @@ -215,12 +226,8 @@ local function UpdatePopupLocals(...) end function MOD:InitializePopups() - local scrollChild = self.Docklet.ScrollFrame.ScrollChild; - - local popups = CreateFrame("Frame", nil, scrollChild) - popups:SetPoint("TOPLEFT", scrollChild, "TOPLEFT", 0, 0); - popups:SetPoint("TOPRIGHT", scrollChild, "TOPRIGHT", 0, 0); - popups:SetHeight(1); + local popups = CreateFrame("Frame", nil, self.Docklet) + popups:SetAllPoints(self.Docklet.Parent.Alert); popups.Rows = {}; popups.GetPopup = GetPopUpRow; diff --git a/SVUI_QuestTracker/components/quests.lua b/SVUI_QuestTracker/components/quests.lua index 0744e9a..2ef320b 100644 --- a/SVUI_QuestTracker/components/quests.lua +++ b/SVUI_QuestTracker/components/quests.lua @@ -157,7 +157,7 @@ do end if(InCombatLockdown()) then - self.attribute = self.itemName + self.attribute = self.itemName self:RegisterEvent('PLAYER_REGEN_ENABLED') else self:SetAttribute('item', self.itemName) @@ -168,7 +168,7 @@ do end local Button_ClearItem = function(self) - self.attribute = nil; + self.attribute = nil; if(InCombatLockdown()) then self:RegisterEvent('PLAYER_REGEN_ENABLED'); else @@ -177,111 +177,111 @@ do end local Button_UpdateItem = function(self) - local numItems = 0 - local shortestDistance = 62500 - local closestQuestLink, closestQuestTexture - local activeQuestLink, activeQuestTexture - - for index = 1, GetNumQuestWatches() do - local questID, _, questIndex, _, _, isComplete = GetQuestWatchInfo(index) - if(questID and QuestHasPOIInfo(questID)) then - local link, texture, _, showCompleted = GetQuestLogSpecialItemInfo(questIndex) - if(link) then - local areaID = QuestInZone[questID] - if questIndex == MOD.CurrentQuest then - activeQuestLink = link - activeQuestTexture = texture - end - if(areaID and areaID == GetCurrentMapAreaID()) then + local numItems = 0 + local shortestDistance = 62500 + local closestQuestLink, closestQuestTexture + local activeQuestLink, activeQuestTexture + + for index = 1, GetNumQuestWatches() do + local questID, _, questIndex, _, _, isComplete = GetQuestWatchInfo(index) + if(questID and QuestHasPOIInfo(questID)) then + local link, texture, _, showCompleted = GetQuestLogSpecialItemInfo(questIndex) + if(link) then + local areaID = QuestInZone[questID] + if questIndex == MOD.CurrentQuest then + activeQuestLink = link + activeQuestTexture = texture + end + if(areaID and areaID == GetCurrentMapAreaID()) then + closestQuestLink = link + closestQuestTexture = texture + elseif(not isComplete or (isComplete and showCompleted)) then + local distanceSq, onContinent = GetDistanceSqToQuest(questIndex) + if(onContinent and distanceSq < shortestDistance) then + shortestDistance = distanceSq closestQuestLink = link closestQuestTexture = texture - elseif(not isComplete or (isComplete and showCompleted)) then - local distanceSq, onContinent = GetDistanceSqToQuest(questIndex) - if(onContinent and distanceSq < shortestDistance) then - shortestDistance = distanceSq - closestQuestLink = link - closestQuestTexture = texture - end end - - numItems = numItems + 1 end + + numItems = numItems + 1 end end + end - if(closestQuestLink) then - self:SetUsage(closestQuestLink, closestQuestTexture); - elseif(activeQuestLink) then - self:SetUsage(activeQuestLink, activeQuestTexture); - end + if(closestQuestLink) then + self:SetUsage(closestQuestLink, closestQuestTexture); + elseif(activeQuestLink) then + self:SetUsage(activeQuestLink, activeQuestTexture); + end - local name = self:GetName(); - if(numItems > 0 and not TICKERS[name]) then - TICKERS[name] = C_Timer.NewTicker(30, function() - self:Update() - end) - elseif(numItems == 0 and TICKERS[name]) then - TICKERS[name]:Cancel() - TICKERS[name] = nil - end + local name = self:GetName(); + if(numItems > 0 and not TICKERS[name]) then + TICKERS[name] = C_Timer.NewTicker(30, function() + self:Update() + end) + elseif(numItems == 0 and TICKERS[name]) then + TICKERS[name]:Cancel() + TICKERS[name] = nil end + end --[[ METHOD ]]-- CreateQuestItemButton = function(index) local buttonName = "SVUI_QuestButton" .. index - local itembutton = CreateFrame('Button', buttonName, UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate'); - itembutton:SetAlpha(0); - itembutton:SetStyle("!_ActionSlot"); + local itembutton = CreateFrame('Button', buttonName, UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate'); + itembutton:SetAlpha(0); + itembutton:SetStyle("!_ActionSlot"); --itembutton:SetBackdropBorderColor(0.1, 0.1, 0.1) - itembutton:SetSize(ITEM_BUTTON_SIZE, ITEM_BUTTON_SIZE); - itembutton:SetID(index); - itembutton.___overflow = false; - itembutton.SetUsage = Button_SetItem; - itembutton.ClearUsage = Button_ClearItem; - itembutton.Update = Button_UpdateItem; - itembutton.UpdateCooldown = Button_UpdateCooldown; - - local Icon = itembutton:CreateTexture('$parentIcon', 'BACKGROUND') - Icon:SetTexCoord(unpack(_G.SVUI_ICON_COORDS)) - Icon:SetAllPoints() - itembutton.Icon = Icon - - local Cooldown = CreateFrame('Cooldown', '$parentCooldown', itembutton, 'CooldownFrameTemplate') - Cooldown:ClearAllPoints() - Cooldown:SetPoint('TOPRIGHT', -2, -3) - Cooldown:SetPoint('BOTTOMLEFT', 2, 1) - Cooldown:Hide() - itembutton.Cooldown = Cooldown - - --RegisterStateDriver(itembutton, 'visible', '[petbattle] hide; show') - itembutton:SetAttribute('type', 'item'); - itembutton:SetAttribute('_onattributechanged', [[ - if(name == 'item') then - if(value and not self:IsShown()) then - self:Show() - self:SetAlpha(1) - elseif(not value) then - self:SetAlpha(0) - self:Hide() - end - end - ]]); - - itembutton:SetScript('OnEnter', Button_OnEnter); - itembutton:SetScript('OnLeave', Button_OnLeave); - - itembutton:RegisterEvent('UPDATE_EXTRA_ACTIONBAR'); - itembutton:RegisterEvent('BAG_UPDATE_COOLDOWN'); - itembutton:RegisterEvent('BAG_UPDATE_DELAYED'); - itembutton:RegisterEvent('WORLD_MAP_UPDATE'); - itembutton:RegisterEvent('QUEST_LOG_UPDATE'); - itembutton:RegisterEvent('QUEST_POI_UPDATE'); - itembutton:SetScript('OnEvent', Button_OnEvent); - - SV:ManageVisibility(itembutton) - - return itembutton + itembutton:SetSize(ITEM_BUTTON_SIZE, ITEM_BUTTON_SIZE); + itembutton:SetID(index); + itembutton.___overflow = false; + itembutton.SetUsage = Button_SetItem; + itembutton.ClearUsage = Button_ClearItem; + itembutton.Update = Button_UpdateItem; + itembutton.UpdateCooldown = Button_UpdateCooldown; + + local Icon = itembutton:CreateTexture('$parentIcon', 'BACKGROUND') + Icon:SetTexCoord(unpack(_G.SVUI_ICON_COORDS)) + Icon:SetAllPoints() + itembutton.Icon = Icon + + local Cooldown = CreateFrame('Cooldown', '$parentCooldown', itembutton, 'CooldownFrameTemplate') + Cooldown:ClearAllPoints() + Cooldown:SetPoint('TOPRIGHT', -2, -3) + Cooldown:SetPoint('BOTTOMLEFT', 2, 1) + Cooldown:Hide() + itembutton.Cooldown = Cooldown + + --RegisterStateDriver(itembutton, 'visible', '[petbattle] hide; show') + itembutton:SetAttribute('type', 'item'); + itembutton:SetAttribute('_onattributechanged', [[ + if(name == 'item') then + if(value and not self:IsShown()) then + self:Show() + self:SetAlpha(1) + elseif(not value) then + self:SetAlpha(0) + self:Hide() + end + end + ]]); + + itembutton:SetScript('OnEnter', Button_OnEnter); + itembutton:SetScript('OnLeave', Button_OnLeave); + itembutton:SetScript('OnEvent', Button_OnEvent); + + itembutton:RegisterEvent('UPDATE_EXTRA_ACTIONBAR'); + itembutton:RegisterEvent('BAG_UPDATE_COOLDOWN'); + itembutton:RegisterEvent('BAG_UPDATE_DELAYED'); + itembutton:RegisterEvent('WORLD_MAP_UPDATE'); + itembutton:RegisterEvent('QUEST_LOG_UPDATE'); + itembutton:RegisterEvent('QUEST_POI_UPDATE'); + + SV:ManageVisibility(itembutton) + + return itembutton end function ItemBar:SetQuestItem(itemLink, texture, completed) @@ -290,19 +290,19 @@ do if(savedIndex and self.Buttons[savedIndex]) then self.Buttons[savedIndex]:SetUsage(itemLink, texture, completed) else - local maxIndex = #self.Buttons; - for i = 1, maxIndex do - if(not self.Buttons[i]:GetAttribute('item')) then - self.Buttons[i]:SetUsage(itemLink, texture, completed) - return - end - end + local maxIndex = #self.Buttons; + for i = 1, maxIndex do + if(not self.Buttons[i]:GetAttribute('item')) then + self.Buttons[i]:SetUsage(itemLink, texture, completed) + return + end + end - local index = maxIndex + 1 - self.Buttons[index] = CreateQuestItemButton(index) - self.Buttons[index]:SetUsage(itemLink, texture, completed) - end + local index = maxIndex + 1 + self.Buttons[index] = CreateQuestItemButton(index) + self.Buttons[index]:SetUsage(itemLink, texture, completed) end + end end function ItemBar:Reset() @@ -653,8 +653,9 @@ local ActiveButton_OnClick = function(self, button) if(questID) then local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questLogIndex) local icon = self.Icon:GetTexture() + local itemLink, texture, _, showCompleted = GetQuestLogSpecialItemInfo(questLogIndex) SetSuperTrackedQuestID(questID); - MOD.Headers["Active"]:Set(title, level, icon, questID, questLogIndex, numObjectives, duration, elapsed, isComplete); + MOD.Headers["Active"]:Set(title, level, icon, questID, questLogIndex, numObjectives, duration, elapsed, isComplete, itemLink); end end end @@ -744,7 +745,7 @@ local GetQuestRow = function(self, index) row.Badge = CreateFrame("Frame", nil, row) row.Badge:SetPoint("TOPLEFT", row, "TOPLEFT", 0, 0); row.Badge:SetSize(QUEST_ROW_HEIGHT, QUEST_ROW_HEIGHT); - row.Badge:SetStyle("Frame", "Lite") + --row.Badge:SetStyle("Frame", "Lite") row.Badge.Icon = row.Badge:CreateTexture(nil,"OVERLAY") row.Badge.Icon:SetAllPoints(row.Badge); diff --git a/SVUI_QuestTracker/components/scenario.lua b/SVUI_QuestTracker/components/scenario.lua index 79fe7b1..47f89e8 100644 --- a/SVUI_QuestTracker/components/scenario.lua +++ b/SVUI_QuestTracker/components/scenario.lua @@ -357,9 +357,9 @@ function MOD:InitializeScenarios() local scrollChild = self.Docklet.ScrollFrame.ScrollChild; local scenario = CreateFrame("Frame", nil, scrollChild) - scenario:SetWidth(ROW_WIDTH); scenario:SetHeight(ROW_HEIGHT); - scenario:SetPoint("TOPLEFT", self.Headers["Active"], "BOTTOMLEFT", 0, -6); + scenario:SetPoint("TOPLEFT", scrollChild, "TOPLEFT", 0, 0); + scenario:SetPoint("TOPRIGHT", scrollChild, "TOPRIGHT", 0, 0); scenario.Set = SetScenarioData; scenario.Unset = UnsetScenarioData;