5.20.0
This commit is contained in:
@@ -8,8 +8,8 @@ local pairs, type, error = pairs, type, error
|
||||
local _G = _G
|
||||
|
||||
-- WoW APIs
|
||||
local GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, UnitName
|
||||
= GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, UnitName
|
||||
local GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo
|
||||
= GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo
|
||||
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
||||
@@ -88,6 +88,8 @@ local defaultHeight = 665
|
||||
local minWidth = 750
|
||||
local minHeight = 240
|
||||
|
||||
|
||||
|
||||
function OptionsPrivate.CreateFrame()
|
||||
CreateFrame("Frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
|
||||
local frame
|
||||
@@ -339,7 +341,7 @@ function OptionsPrivate.CreateFrame()
|
||||
tipFrame:Hide()
|
||||
frame.tipFrame = tipFrame
|
||||
|
||||
local tipPopup = CreateFrame("Frame", "WeakAuras_TipPopup", frame)
|
||||
local tipPopup = CreateFrame("Frame", nil, frame)
|
||||
tipPopup:SetFrameStrata("FULLSCREEN")
|
||||
tipPopup:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
@@ -452,13 +454,13 @@ function OptionsPrivate.CreateFrame()
|
||||
local lineLength = 0
|
||||
local currentLine = {}
|
||||
for _, patreon in ipairs(list) do
|
||||
if lineLength + #patreon + 2 * #currentLine > 130 then
|
||||
if lineLength + #patreon + 2 > 130 then
|
||||
tinsert(patreonLines, table.concat(currentLine, ", ") .. ", ")
|
||||
currentLine = {}
|
||||
tinsert(currentLine, patreon)
|
||||
lineLength = #patreon
|
||||
lineLength = #patreon + 2
|
||||
else
|
||||
lineLength = lineLength + #patreon
|
||||
lineLength = lineLength + #patreon + 2
|
||||
tinsert(currentLine, patreon)
|
||||
end
|
||||
end
|
||||
@@ -485,7 +487,6 @@ function OptionsPrivate.CreateFrame()
|
||||
local thanksListCJ = lineWrapDiscordList(OptionsPrivate.Private.DiscordListCJ)
|
||||
local thanksListK = lineWrapDiscordList(OptionsPrivate.Private.DiscordListK)
|
||||
|
||||
|
||||
local discordButton = addFooter(L["Discord"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt",
|
||||
L["Chat with WeakAuras experts on our Discord server."])
|
||||
discordButton:SetParent(tipFrame)
|
||||
@@ -652,7 +653,85 @@ function OptionsPrivate.CreateFrame()
|
||||
-- Toolbar
|
||||
local toolbarContainer = CreateFrame("Frame", nil, buttonsContainer.frame)
|
||||
toolbarContainer:SetParent(buttonsContainer.frame)
|
||||
toolbarContainer:Hide()
|
||||
-- toolbarContainer:Hide()
|
||||
toolbarContainer:SetPoint("TOPLEFT", buttonsContainer.frame, "TOPLEFT", 30, 30)
|
||||
toolbarContainer:SetPoint("BOTTOMRIGHT", buttonsContainer.frame, "TOPRIGHT", 0, 0)
|
||||
|
||||
local undo = AceGUI:Create("WeakAurasToolbarButton")
|
||||
undo:SetText(L["Undo"])
|
||||
undo:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\upleft")
|
||||
undo:SetCallback("OnClick", function()
|
||||
OptionsPrivate.Private.TimeMachine:StepBackward()
|
||||
frame:FillOptions()
|
||||
end)
|
||||
undo.frame:SetParent(toolbarContainer)
|
||||
if OptionsPrivate.Private.Features:Enabled("undo") then
|
||||
undo.frame:Show()
|
||||
else
|
||||
undo.frame:Hide()
|
||||
end
|
||||
undo:SetPoint("LEFT")
|
||||
|
||||
local redo = AceGUI:Create("WeakAurasToolbarButton")
|
||||
redo:SetText(L["Redo"])
|
||||
redo:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\upright")
|
||||
redo:SetCallback("OnClick", function()
|
||||
OptionsPrivate.Private.TimeMachine:StepForward()
|
||||
frame:FillOptions()
|
||||
end)
|
||||
redo.frame:SetParent(toolbarContainer)
|
||||
if OptionsPrivate.Private.Features:Enabled("undo") then
|
||||
redo.frame:Show()
|
||||
else
|
||||
redo.frame:Hide()
|
||||
end
|
||||
redo:SetPoint("LEFT", undo.frame, "RIGHT", 10, 0)
|
||||
if OptionsPrivate.Private.TimeMachine:DescribeNext() ~= nil then
|
||||
redo.frame:Enable()
|
||||
else
|
||||
redo.frame:Disable()
|
||||
end
|
||||
OptionsPrivate.Private.Features:Subscribe("undo",
|
||||
function()
|
||||
undo.frame:Show()
|
||||
redo.frame:Show()
|
||||
end,
|
||||
function()
|
||||
undo.frame:Hide()
|
||||
redo.frame:Hide()
|
||||
end
|
||||
)
|
||||
|
||||
local tmControls = {
|
||||
undo = undo,
|
||||
redo = redo,
|
||||
}
|
||||
|
||||
function tmControls:Step()
|
||||
-- slightly annoying workaround
|
||||
-- Buttons behave in a strange way if they are disabled inside of the OnClick handler
|
||||
-- where the pushed texture refuses to vanish until the button is enabled & user clicks it again
|
||||
-- so, just disable the button after next frame draw, so it's imperceptible to the user but we're not in the OnClick handler
|
||||
WeakAuras.timer:ScheduleTimer(function()
|
||||
self.undo:SetDisabled(OptionsPrivate.Private.TimeMachine:DescribePrevious() == nil)
|
||||
self.redo:SetDisabled(OptionsPrivate.Private.TimeMachine:DescribeNext() == nil)
|
||||
end, 0)
|
||||
end
|
||||
tmControls:Step()
|
||||
OptionsPrivate.Private.TimeMachine.sub:AddSubscriber("Step", tmControls)
|
||||
|
||||
|
||||
local newButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
newButton:SetText(L["New Aura"])
|
||||
newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
|
||||
newButton.frame:SetParent(toolbarContainer)
|
||||
newButton.frame:Show()
|
||||
newButton:SetPoint("LEFT", redo.frame, "RIGHT", 10, 0)
|
||||
frame.toolbarContainer = toolbarContainer
|
||||
|
||||
newButton:SetCallback("OnClick", function()
|
||||
frame:NewAura()
|
||||
end)
|
||||
|
||||
local importButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
importButton:SetText(L["Import"])
|
||||
@@ -660,20 +739,28 @@ function OptionsPrivate.CreateFrame()
|
||||
importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString)
|
||||
importButton.frame:SetParent(toolbarContainer)
|
||||
importButton.frame:Show()
|
||||
importButton:SetPoint("RIGHT", filterInput, "RIGHT")
|
||||
importButton:SetPoint("BOTTOM", frame, "TOP", 0, -55)
|
||||
importButton:SetPoint("LEFT", newButton.frame, "RIGHT", 10, 0)
|
||||
|
||||
local newButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
newButton:SetText(L["New Aura"])
|
||||
newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
|
||||
newButton.frame:SetParent(toolbarContainer)
|
||||
newButton.frame:Show()
|
||||
newButton:SetPoint("RIGHT", importButton.frame, "LEFT", -10, 0)
|
||||
frame.toolbarContainer = toolbarContainer
|
||||
|
||||
newButton:SetCallback("OnClick", function()
|
||||
frame:NewAura()
|
||||
local lockButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
lockButton:SetText(L["Lock Positions"])
|
||||
lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition")
|
||||
lockButton:SetCallback("OnClick", function(self)
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
lockButton:SetStrongHighlight(false)
|
||||
lockButton:UnlockHighlight()
|
||||
WeakAurasOptionsSaved.lockPositions = false
|
||||
else
|
||||
lockButton:SetStrongHighlight(true)
|
||||
lockButton:LockHighlight()
|
||||
WeakAurasOptionsSaved.lockPositions = true
|
||||
end
|
||||
end)
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
lockButton:LockHighlight()
|
||||
end
|
||||
lockButton.frame:SetParent(toolbarContainer)
|
||||
lockButton.frame:Show()
|
||||
lockButton:SetPoint("LEFT", importButton.frame, "RIGHT", 10, 0)
|
||||
|
||||
local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
magnetButton:SetText(L["Magnetically Align"])
|
||||
@@ -695,28 +782,8 @@ function OptionsPrivate.CreateFrame()
|
||||
end
|
||||
magnetButton.frame:SetParent(toolbarContainer)
|
||||
magnetButton.frame:Show()
|
||||
magnetButton:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -17, -55)
|
||||
magnetButton:SetPoint("LEFT", lockButton.frame, "RIGHT", 10, 0)
|
||||
|
||||
local lockButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
lockButton:SetText(L["Lock Positions"])
|
||||
lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition")
|
||||
lockButton:SetCallback("OnClick", function(self)
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
lockButton:SetStrongHighlight(false)
|
||||
lockButton:UnlockHighlight()
|
||||
WeakAurasOptionsSaved.lockPositions = false
|
||||
else
|
||||
lockButton:SetStrongHighlight(true)
|
||||
lockButton:LockHighlight()
|
||||
WeakAurasOptionsSaved.lockPositions = true
|
||||
end
|
||||
end)
|
||||
if WeakAurasOptionsSaved.lockPositions then
|
||||
lockButton:LockHighlight()
|
||||
end
|
||||
lockButton.frame:SetParent(toolbarContainer)
|
||||
lockButton.frame:Show()
|
||||
lockButton:SetPoint("RIGHT", magnetButton.frame, "LEFT", -10, 0)
|
||||
|
||||
local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4)
|
||||
@@ -728,7 +795,6 @@ function OptionsPrivate.CreateFrame()
|
||||
self:UpdateFrameVisible()
|
||||
end
|
||||
|
||||
|
||||
local buttonsScroll = AceGUI:Create("ScrollFrame")
|
||||
buttonsScroll:SetLayout("ButtonsScrollLayout")
|
||||
buttonsScroll.width = "fill"
|
||||
|
||||
Reference in New Issue
Block a user