Update general layout of WeakAurasOptions (#8)

* from retail

* (fix) improve pixel snapping by reapplying borders

* update spinbox texture

* add icons, loaded, standby, unloaded behavior from retail

* further use of ported inputbox and cleanup to ported frames

* move templates into WeakAuras and upversion
This commit is contained in:
NoM0Re
2025-01-04 19:33:14 +01:00
committed by GitHub
parent a62d8f352e
commit 86e98d6bcf
47 changed files with 1582 additions and 679 deletions
+220 -274
View File
@@ -11,8 +11,8 @@ local GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsA
= GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsAddOnLoaded, LoadAddOn, UnitName
local AceGUI = LibStub("AceGUI-3.0")
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local WeakAuras = WeakAuras
local L = WeakAuras.L
@@ -22,71 +22,26 @@ local regionOptions = WeakAuras.regionOptions
local tempGroup = OptionsPrivate.tempGroup
local aceOptions = {}
local function CreateDecoration(frame)
local deco = CreateFrame("Frame", nil, frame)
deco:SetSize(17, 40)
local bg1 = deco:CreateTexture(nil, "BACKGROUND")
bg1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg1:SetTexCoord(0.31, 0.67, 0, 0.63)
bg1:SetAllPoints(deco)
local bg2 = deco:CreateTexture(nil, "BACKGROUND")
bg2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg2:SetTexCoord(0.235, 0.275, 0, 0.63)
bg2:SetPoint("RIGHT", bg1, "LEFT")
bg2:SetSize(10, 40)
local bg3 = deco:CreateTexture(nil, "BACKGROUND")
bg3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg3:SetTexCoord(0.72, 0.76, 0, 0.63)
bg3:SetPoint("LEFT", bg1, "RIGHT")
bg3:SetSize(10, 40)
return deco
end
local function CreateDecorationWide(frame, width)
local deco1 = frame:CreateTexture(nil, "OVERLAY")
deco1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco1:SetTexCoord(0.31, 0.67, 0, 0.63)
deco1:SetSize(width, 40)
local deco2 = frame:CreateTexture(nil, "OVERLAY")
deco2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco2:SetTexCoord(0.21, 0.31, 0, 0.63)
deco2:SetPoint("RIGHT", deco1, "LEFT")
deco2:SetSize(30, 40)
local deco3 = frame:CreateTexture(nil, "OVERLAY")
deco3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco3:SetTexCoord(0.67, 0.77, 0, 0.63)
deco3:SetPoint("LEFT", deco1, "RIGHT")
deco3:SetSize(30, 40)
return deco1
end
local function CreateFrameSizer(frame, callback, position)
callback = callback or (function() end)
local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2
if position == "BOTTOMLEFT" then
left, right, top, bottom = 1, 0, 0, 1
xOffset1, yOffset1 = 6, 6
xOffset1, yOffset1 = 1, 1
xOffset2, yOffset2 = 0, 0
elseif position == "BOTTOMRIGHT" then
left, right, top, bottom = 0, 1, 0, 1
xOffset1, yOffset1 = 0, 6
xOffset2, yOffset2 = -6, 0
xOffset1, yOffset1 = 0, 1
xOffset2, yOffset2 = -1, 0
elseif position == "TOPLEFT" then
left, right, top, bottom = 1, 0, 1, 0
xOffset1, yOffset1 = 6, 0
xOffset2, yOffset2 = 0, -6
xOffset1, yOffset1 = 1, 0
xOffset2, yOffset2 = 0, -1
elseif position == "TOPRIGHT" then
left, right, top, bottom = 0, 1, 1, 0
xOffset1, yOffset1 = 0, 0
xOffset2, yOffset2 = -6, -6
xOffset2, yOffset2 = -1, -1
end
local handle = CreateFrame("BUTTON", nil, frame)
@@ -133,45 +88,52 @@ local minWidth = 750
local minHeight = 240
function OptionsPrivate.CreateFrame()
local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
local frame
local db = OptionsPrivate.savedVars.db
local odb = OptionsPrivate.savedVars.odb
-------- Mostly Copied from AceGUIContainer-Frame--------
frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent)
frame = CreateFrame("Frame", "WeakAurasOptions", UIParent, "WA_PortraitFrameTemplate")
function OptionsPrivate.SetTitle(title)
local text = "WeakAuras " .. WeakAuras.versionString
if title and title ~= "" then
text = ("%s - %s"):format(text, title)
end
WeakAurasOptionsTitleText:SetText(text)
end
tinsert(UISpecialFrames, frame:GetName())
frame:SetBackdrop({
bgFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
frame:SetBackdropColor(0.1, 0.1, 0.1, 0.85)
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetResizable(true)
frame:SetMinResize(minWidth, minHeight)
frame:SetFrameStrata("DIALOG")
frame.PortraitContainer.portrait:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\logo_256_round.tga]])
frame.window = "default"
local xOffset, yOffset
if db.frame then
xOffset, yOffset = db.frame.xOffset, db.frame.yOffset
-- Convert from old settings to new
odb.frame = db.frame
if odb.frame.xOffset and odb.frame.yOffset then
odb.frame.xOffset = odb.frame.xOffset + GetScreenWidth() - (odb.frame.width or defaultWidth) / 2
odb.frame.yOffset = odb.frame.yOffset + GetScreenHeight()
end
db.frame = nil
end
if not (xOffset and yOffset) then
xOffset = (defaultWidth - GetScreenWidth()) / 2
yOffset = (defaultHeight - GetScreenHeight()) / 2
xOffset = GetScreenWidth() / 2
yOffset = GetScreenHeight() - defaultHeight / 2
end
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset)
frame:SetPoint("TOP", UIParent, "BOTTOMLEFT", xOffset, yOffset)
frame:Hide()
frame:SetScript("OnHide", function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
OptionsPrivate.Private.ClearFakeStates()
@@ -187,7 +149,7 @@ function OptionsPrivate.CreateFrame()
end
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.Private.Resume()
if OptionsPrivate.Private.mouseFrame then
@@ -201,8 +163,8 @@ function OptionsPrivate.CreateFrame()
local width, height
if db.frame then
width, height = db.frame.width, db.frame.height
if odb.frame then
width, height = odb.frame.width, odb.frame.height
end
if not (width and height) then
@@ -214,65 +176,34 @@ function OptionsPrivate.CreateFrame()
frame:SetWidth(width)
frame:SetHeight(height)
local close = CreateDecoration(frame)
close:SetPoint("TOPRIGHT", -30, 12)
local closebutton = CreateFrame("BUTTON", nil, close, "UIPanelCloseButton")
closebutton:SetPoint("CENTER", close, "CENTER", 1, -1)
closebutton:SetScript("OnClick", WeakAuras.HideOptions)
local title = CreateFrame("Frame", nil, frame)
local titleText = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titleText:SetText("WeakAuras " .. WeakAuras.versionString)
local titleBG = CreateDecorationWide(frame, max(120, titleText:GetWidth()))
titleBG:SetPoint("TOP", 0, 24)
titleText:SetPoint("TOP", titleBG, "TOP", 0, -14)
OptionsPrivate.SetTitle()
local function commitWindowChanges()
local xOffset = frame:GetRight() - GetScreenWidth()
local yOffset = frame:GetTop() - GetScreenHeight()
if title:GetRight() > GetScreenWidth() then
xOffset = xOffset + (GetScreenWidth() - title:GetRight())
elseif title:GetLeft() < 0 then
xOffset = xOffset + (0 - title:GetLeft())
end
if title:GetTop() > GetScreenHeight() then
yOffset = yOffset + (GetScreenHeight() - title:GetTop())
elseif title:GetBottom() < 0 then
yOffset = yOffset + (0 - title:GetBottom())
end
db.frame = db.frame or {}
db.frame.xOffset = xOffset
db.frame.yOffset = yOffset
if not frame.minimized then
db.frame.width = frame:GetWidth()
db.frame.height = frame:GetHeight()
local xOffset = frame:GetRight()-(frame:GetWidth()/2)
local yOffset = frame:GetTop()
odb.frame = odb.frame or {}
odb.frame.xOffset = xOffset
odb.frame.yOffset = yOffset
odb.frame.width = frame:GetWidth()
odb.frame.height = frame:GetHeight()
end
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset)
end
title:EnableMouse(true)
title:SetScript("OnMouseDown", function() frame:StartMoving() end)
title:SetScript("OnMouseUp", function()
frame:SetScript("OnMouseDown", function()
frame:StartMoving()
end)
frame:SetScript("OnMouseUp", function()
frame:StopMovingOrSizing()
commitWindowChanges()
end)
title:SetPoint("BOTTOMLEFT", titleBG, "BOTTOMLEFT", -25, 0)
title:SetPoint("TOPRIGHT", titleBG, "TOPRIGHT", 25, 0)
frame.bottomLeftResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMLEFT")
frame.bottomRightResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT")
local minimize = CreateDecoration(frame)
minimize:SetPoint("TOPRIGHT", -65, 12)
frame.UpdateFrameVisible = function(self)
self.tipPopup:Hide()
if self.minimized then
WeakAurasOptionsTitleText:Hide()
self.buttonsContainer.frame:Hide()
self.texturePicker.frame:Hide()
self.iconPicker.frame:Hide()
@@ -287,64 +218,68 @@ function OptionsPrivate.CreateFrame()
self.container.frame:Hide()
self.loadProgress:Hide()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
self.tipFrame.frame:Hide()
self.bottomLeftResizer:Hide()
self.tipFrame:Hide()
self:HideTip()
self.bottomRightResizer:Hide()
else
self.bottomLeftResizer:Show()
WeakAurasOptionsTitleText:Show()
self.bottomRightResizer:Show()
if self.window == "default" then
OptionsPrivate.SetTitle()
self.buttonsContainer.frame:Show()
self.container.frame:Show()
if self.tipFrameIsVisible then
self.tipFrame.frame:Show()
else
self.tipFrame.frame:Hide()
end
self:ShowTip()
else
self.buttonsContainer.frame:Hide()
self.container.frame:Hide()
self.tipFrame.frame:Hide()
self:HideTip()
end
if self.window == "texture" then
OptionsPrivate.SetTitle(L["Texture Picker"])
self.texturePicker.frame:Show()
else
self.texturePicker.frame:Hide()
end
if self.window == "icon" then
OptionsPrivate.SetTitle(L["Icon Picker"])
self.iconPicker.frame:Show()
else
self.iconPicker.frame:Hide()
end
if self.window == "model" then
OptionsPrivate.SetTitle(L["Model Picker"])
self.modelPicker.frame:Show()
else
self.modelPicker.frame:Hide()
end
if self.window == "importexport" then
OptionsPrivate.SetTitle(L["Import / Export"])
self.importexport.frame:Show()
else
self.importexport.frame:Hide()
end
if self.window == "texteditor" then
OptionsPrivate.SetTitle(L["Code Editor"])
self.texteditor.frame:Show()
else
self.texteditor.frame:Hide()
end
if self.window == "codereview" then
OptionsPrivate.SetTitle(L["Custom Code Viewer"])
self.codereview.frame:Show()
else
self.codereview.frame:Hide()
end
if self.window == "newView" then
OptionsPrivate.SetTitle(L["New Template"])
self.newView.frame:Show()
else
if self.newView then
@@ -352,6 +287,7 @@ function OptionsPrivate.CreateFrame()
end
end
if self.window == "update" then
OptionsPrivate.SetTitle(L["Update"])
self.update.frame:Show()
else
self.update.frame:Hide()
@@ -359,60 +295,52 @@ function OptionsPrivate.CreateFrame()
if self.window == "default" then
if self.loadProgessVisible then
self.loadProgress:Show()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
else
self.loadProgress:Hide()
self.toolbarContainer.frame:Show()
self.toolbarContainer:Show()
self.filterInput:Show();
--self.filterInputClear:Show();
end
else
self.loadProgress:Hide()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
end
end
end
local minimizebutton = CreateFrame("BUTTON", nil, minimize)
minimizebutton:SetWidth(30)
minimizebutton:SetHeight(30)
minimizebutton:SetPoint("CENTER", minimize, "CENTER", 1, -1)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp")
minimizebutton:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp")
minimizebutton:SetScript("OnClick", function()
if frame.minimized then
frame.minimized = nil
if db.frame then
if not db.frame.height or db.frame.height < 240 then
db.frame.height = 500
end
end
frame:SetHeight(db.frame and db.frame.height or 500)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp")
frame.buttonsScroll:DoLayout()
else
frame.minimized = true
frame:SetHeight(40)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Down.blp")
end
local minimizebutton = CreateFrame("Button", nil, frame, "WA_MaximizeMinimizeButtonFrameTemplate")
minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0)
minimizebutton:SetOnMaximizedCallback(function()
frame.minimized = false
local right, top = frame:GetRight(), frame:GetTop()
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
frame:SetHeight(odb.frame and odb.frame.height or defaultHeight)
frame:SetWidth(odb.frame and odb.frame.width or defaultWidth)
frame.buttonsScroll:DoLayout()
frame:UpdateFrameVisible()
end)
minimizebutton:SetOnMinimizedCallback(function()
commitWindowChanges()
frame.minimized = true
local right, top = frame:GetRight(), frame:GetTop()
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
frame:SetHeight(75)
frame:SetWidth(160)
frame:UpdateFrameVisible()
end)
local tipFrame = AceGUI:Create("SimpleGroup")
tipFrame.frame:SetParent(frame)
tipFrame:SetLayout("Flow")
tipFrame.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 22, 15)
tipFrame.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 15)
tipFrame.frame:Hide()
local tipFrame = CreateFrame("Frame", nil, frame)
tipFrame:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 17, 30)
tipFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
tipFrame:Hide()
frame.tipFrame = tipFrame
local tipPopup = CreateFrame("Frame", nil, frame)
local tipPopup = CreateFrame("Frame", "WeakAuras_TipPopup", frame)
tipPopup:SetFrameStrata("FULLSCREEN")
tipPopup:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
@@ -425,6 +353,7 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetBackdropColor(0, 0, 0, 0.8)
--tipPopup:SetHeight(100)
tipPopup:Hide()
frame.tipPopup = tipPopup
local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge")
tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10)
@@ -438,7 +367,7 @@ function OptionsPrivate.CreateFrame()
tipPopupLabel:SetJustifyH("LEFT")
tipPopupLabel:SetJustifyV("TOP")
local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "InputBoxTemplate")
local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "WA_InputBoxTemplate")
urlWidget:SetFont(STANDARD_TEXT_FONT, 12)
urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0)
urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0)
@@ -454,7 +383,7 @@ function OptionsPrivate.CreateFrame()
tipPopupCtrlC:SetJustifyV("TOP")
tipPopupCtrlC:SetText(L["Press Ctrl+C to copy the URL"])
local function ToggleTip(referenceWidget, url, title, description)
local function ToggleTip(referenceWidget, url, title, description, rightAligned)
if tipPopup:IsVisible() and urlWidget.text == url then
tipPopup:Hide()
return
@@ -468,60 +397,71 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetWidth(400)
tipPopup:SetHeight(26 + tipPopupTitle:GetHeight() + tipPopupLabel:GetHeight() + urlWidget:GetHeight() + tipPopupCtrlC:GetHeight())
tipPopup:SetPoint("BOTTOMLEFT", referenceWidget.frame, "TOPLEFT", -6, 4)
tipPopup:ClearAllPoints();
if rightAligned then
tipPopup:SetPoint("BOTTOMRIGHT", referenceWidget, "TOPRIGHT", 6, 4)
else
tipPopup:SetPoint("BOTTOMLEFT", referenceWidget, "TOPLEFT", -6, 4)
end
tipPopup:Show()
end
OptionsPrivate.ToggleTip = ToggleTip
local addFooter = function(title, texture, url, description)
local addFooter = function(title, texture, url, description, rightAligned)
local button = AceGUI:Create("WeakAurasToolbarButton")
button:SetText(title)
button:SetTexture(texture)
button:SetCallback("OnClick", function()
ToggleTip(button, url, title, description)
ToggleTip(button.frame, url, title, description, rightAligned)
end)
tipFrame:AddChild(button)
button.frame:Show()
return button.frame
end
addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt",
local discordButton = addFooter(L["Join Discord"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt",
L["Chat with WeakAuras experts on our Discord server."])
discordButton:SetParent(tipFrame)
discordButton:SetPoint("LEFT", tipFrame, "LEFT")
addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki",
local documentationButton = addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki",
L["Check out our wiki for a large collection of examples and snippets."])
documentationButton:SetParent(tipFrame)
documentationButton:SetPoint("LEFT", discordButton, "RIGHT", 10, 0)
local awesomeWotlkButton
if not WeakAuras.isAwesomeEnabled() then
addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk",
awesomeWotlkButton = addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk",
L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"])
awesomeWotlkButton:SetParent(tipFrame)
awesomeWotlkButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0)
end
addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."])
local reportbugButton = addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
L["Report bugs on our issue tracker."], true)
reportbugButton:SetParent(tipFrame)
reportbugButton:SetPoint("RIGHT", tipFrame, "RIGHT")
local wagoButton = addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wago.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."], true)
wagoButton:SetParent(tipFrame)
wagoButton:SetPoint("RIGHT", reportbugButton, "LEFT", -10, 0)
local companionButton
if not OptionsPrivate.Private.CompanionData.slugs then
addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf",
companionButton = addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf",
L["Keep your Wago imports up to date with the Companion App."])
companionButton:SetParent(tipFrame)
companionButton:SetPoint("RIGHT", wagoButton, "LEFT", -10, 0)
end
addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
L["Report bugs on our issue tracker."])
-- Disable for now
--local closeTipButton = CreateFrame("Button", nil, tipFrame.frame, "UIPanelCloseButton")
--closeTipButton:SetScript("OnClick", function()
-- frame:HideTip()
--end)
--closeTipButton:SetPoint("TOPRIGHT", tipFrame.frame, "TOPRIGHT", 0, 6)
--closeTipButton:Show()
frame.ShowTip = function(self)
self.tipFrameIsVisible = true
self.tipFrame.frame:Show()
self.tipFrame:Show()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30)
self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28)
end
frame.HideTip = function(self)
self.tipFrameIsVisible = false
self.tipFrame.frame:Hide()
self.tipFrame:Hide()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
end
@@ -530,12 +470,12 @@ function OptionsPrivate.CreateFrame()
local container = AceGUI:Create("InlineGroup")
container.frame:SetParent(frame)
container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0)
container.frame:Show()
container.titletext:Hide()
-- Hide the border
container.content:GetParent():SetBackdrop(nil)
container.content:SetPoint("TOPLEFT", 0, 0)
container.content:SetPoint("TOPLEFT", 0, -28)
container.content:SetPoint("BOTTOMRIGHT", 0, 0)
frame.container = container
@@ -550,7 +490,7 @@ function OptionsPrivate.CreateFrame()
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
-- filter line
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate")
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "WA_InputBoxTemplate")
filterInput:SetAutoFocus(false)
filterInput:SetTextInsets(16, 20, 0, 0)
@@ -613,9 +553,9 @@ function OptionsPrivate.CreateFrame()
OptionsPrivate.SortDisplayButtons(filterInput:GetText())
end)
filterInput:SetHeight(15)
filterInput:SetPoint("TOP", frame, "TOP", 0, -44)
filterInput:SetPoint("TOP", frame, "TOP", 0, -65)
filterInput:SetPoint("LEFT", frame, "LEFT", 24, 0)
filterInput:SetPoint("RIGHT", container.frame, "LEFT", -5, 0)
filterInput:SetPoint("RIGHT", container.frame, "LEFT", -2, 0)
filterInput:SetFont(STANDARD_TEXT_FONT, 10)
frame.filterInput = filterInput
filterInput:Hide()
@@ -625,53 +565,36 @@ function OptionsPrivate.CreateFrame()
buttonsContainer:SetWidth(170)
buttonsContainer.frame:SetParent(frame)
buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -46)
buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -67)
buttonsContainer.frame:SetPoint("RIGHT", container.frame, "LEFT", -17)
buttonsContainer.frame:Show()
frame.buttonsContainer = buttonsContainer
-- Toolbar
local toolbarContainer = AceGUI:Create("SimpleGroup")
toolbarContainer.frame:SetParent(buttonsContainer.frame)
toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -16)
toolbarContainer.frame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -17, -16)
toolbarContainer.frame:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 20, -38)
toolbarContainer:SetLayout("Flow")
local newButton = AceGUI:Create("WeakAurasToolbarButton")
newButton:SetText(L["New Aura"])
newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
toolbarContainer:AddChild(newButton)
frame.toolbarContainer = toolbarContainer
newButton:SetCallback("OnClick", function()
frame:NewAura()
end)
local toolbarContainer = CreateFrame("Frame", nil, buttonsContainer.frame)
toolbarContainer:SetParent(buttonsContainer.frame)
toolbarContainer:Hide()
local importButton = AceGUI:Create("WeakAurasToolbarButton")
importButton:SetText(L["Import"])
importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall")
importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString)
toolbarContainer:AddChild(importButton)
importButton.frame:SetParent(toolbarContainer)
importButton.frame:Show()
importButton:SetPoint("RIGHT", filterInput, "RIGHT")
importButton:SetPoint("BOTTOM", frame, "TOP", 0, -55)
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
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()
end)
if WeakAurasOptionsSaved.lockPositions then
lockButton:LockHighlight()
end
toolbarContainer:AddChild(lockButton)
local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
magnetButton:SetText(L["Magnetically Align"])
@@ -691,7 +614,30 @@ function OptionsPrivate.CreateFrame()
if WeakAurasOptionsSaved.magnetAlign then
magnetButton:LockHighlight()
end
toolbarContainer:AddChild(magnetButton)
magnetButton.frame:SetParent(toolbarContainer)
magnetButton.frame:Show()
magnetButton:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -17, -55)
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)
@@ -703,7 +649,6 @@ function OptionsPrivate.CreateFrame()
self:UpdateFrameVisible()
end
local buttonsScroll = AceGUI:Create("ScrollFrame")
buttonsScroll:SetLayout("ButtonsScrollLayout")
buttonsScroll.width = "fill"
@@ -806,7 +751,7 @@ function OptionsPrivate.CreateFrame()
-- Loaded section
local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
loadedButton:SetText(L["Loaded"])
loadedButton:SetText(L["Loaded/Standby"])
loadedButton:Disable()
loadedButton:EnableExpand()
if odb.loadedCollapse then
@@ -825,34 +770,33 @@ function OptionsPrivate.CreateFrame()
loadedButton:SetExpandDescription(L["Expand all loaded displays"])
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
loadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if loadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
for _, child in ipairs(loadedButton.childButtons) do
if child:IsLoaded() then
child:PriorityHide(2)
end
end
loadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
for _, child in ipairs(loadedButton.childButtons) do
if child:IsLoaded() then
child:PriorityShow(2)
end
end
loadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end)
loadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
for _, child in ipairs(loadedButton.childButtons) do
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
end
local newVisibility
@@ -869,6 +813,7 @@ function OptionsPrivate.CreateFrame()
end
end
loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"])
loadedButton.childButtons = {}
frame.loadedButton = loadedButton
-- Not Loaded section
@@ -892,34 +837,28 @@ function OptionsPrivate.CreateFrame()
unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"])
unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"])
unloadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if unloadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityHide(2)
end
for _, child in ipairs(unloadedButton.childButtons) do
child:PriorityHide(2)
end
unloadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityShow(2)
end
for _, child in ipairs(unloadedButton.childButtons) do
child:PriorityShow(2)
end
unloadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end)
unloadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
for _, child in ipairs(unloadedButton.childButtons) do
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
end
local newVisibility
@@ -936,6 +875,7 @@ function OptionsPrivate.CreateFrame()
end
end
unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"])
unloadedButton.childButtons = {}
frame.unloadedButton = unloadedButton
@@ -998,7 +938,7 @@ function OptionsPrivate.CreateFrame()
local optionTable = self:EnsureOptions(data, self.selectedTab)
if optionTable then
AceConfig:RegisterOptionsTable("WeakAuras", optionTable)
AceConfigRegistry:RegisterOptionsTable("WeakAuras", optionTable, true)
end
end
@@ -1049,7 +989,7 @@ function OptionsPrivate.CreateFrame()
local tabsWidget
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -10)
container:ReleaseChildren()
container:SetLayout("Fill")
tabsWidget = AceGUI:Create("TabGroup")
@@ -1122,12 +1062,18 @@ function OptionsPrivate.CreateFrame()
end
frame.ClearPicks = function(self, noHide)
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do
button:ClearPick(true)
if not noHide then
button:PriorityHide(1)
button:SetVisibilityDirectly(0)
end
end
if not noHide then
for id, button in pairs(displayButtons) do
if button.data.controlledChildren then
button:RecheckVisibility()
end
end
end
@@ -1139,7 +1085,7 @@ function OptionsPrivate.CreateFrame()
container:ReleaseChildren()
self.moversizer:Hide()
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
-- Clear trigger expand state
OptionsPrivate.ClearTriggerExpandState()
@@ -1185,7 +1131,7 @@ function OptionsPrivate.CreateFrame()
self.pickedOption = "New"
container:ReleaseChildren()
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -8)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0)
container:SetLayout("fill")
local border = AceGUI:Create("InlineGroup")
border:SetLayout("Fill")
@@ -1349,11 +1295,11 @@ function OptionsPrivate.CreateFrame()
end
end
if self.pickedDisplay == id then
if self.pickedDisplay == id and (self.pickedDisplay == tab or tab == nil) then
return
end
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
self:ClearPicks(noHide)
@@ -1380,7 +1326,7 @@ function OptionsPrivate.CreateFrame()
end
displayButtons[data.id]:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end
frame.CenterOnPicked = function(self)