Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #14

Merged
merged 6 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -3234,6 +3234,7 @@ globals = {
"ProcessQuestLogRewardFactions",
"PromoteToAssistant",
"PromoteToLeader",
"ProfessionsFrame",
"PurchaseSlot",
"PutItemInBackpack",
"PutItemInBag",
Expand Down Expand Up @@ -4162,6 +4163,7 @@ globals = {
"OpenFriendsFrame",
"OpenGlyphFrame",
"OpenStackSplitFrame",
"OpenProfessionUIToSkillLine",
"PaperDollBgDesaturate",
"PaperDollFormatStat",
"PaperDollStatTooltip",
Expand Down
4 changes: 2 additions & 2 deletions Core/Functions/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ end
function F.CreateInnerNoise(frame)
local edgeSize = E.twoPixelsPlease and 2 or 1

local innerNoise = frame.txInnerNoise or frame:CreateTexture(nil, "BACKGROUND")
local innerNoise = frame.txInnerNoise or frame:CreateTexture(nil, "BACKGROUND", nil, 2)
innerNoise:SetInside(frame, edgeSize, edgeSize)
innerNoise:SetTexture(I.Media.Themes.NoiseInner, "REPEAT", "REPEAT")
innerNoise:SetHorizTile(true)
Expand All @@ -668,7 +668,7 @@ end
function F.CreateInnerShadow(frame, smallVersion)
local edgeSize = E.twoPixelsPlease and 2 or 1

local innerShadow = frame.txInnerShadow or frame:CreateTexture(nil, "BACKGROUND")
local innerShadow = frame.txInnerShadow or frame:CreateTexture(nil, "BACKGROUND", nil, 1)
innerShadow:SetInside(frame, edgeSize, edgeSize)
innerShadow:SetTexture(smallVersion and I.Media.Themes.ShadowInnerSmall or I.Media.Themes.ShadowInner)
innerShadow:SetVertexColor(1, 1, 1, 0.5)
Expand Down
2 changes: 1 addition & 1 deletion Modules/AddOns/Deconstruct.lua
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ end

function DC:CreateElements()
local hoverButton = self.hoverButton or CreateFrame("Button", "TXDeconstructHoverButton", E.UIParent, "SecureActionButtonTemplate")
hoverButton:RegisterForClicks("AnyUp")
hoverButton:RegisterForClicks("AnyDown")
hoverButton:SetFrameStrata("TOOLTIP")

hoverButton.TipLines = {}
Expand Down
178 changes: 90 additions & 88 deletions Modules/AddOns/Theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local CreateFrame = CreateFrame
local EnumerateFrames = EnumerateFrames
local getmetatable = getmetatable
local pairs = pairs
-- local tinsert = table.insert
local tinsert = table.insert
local unpack = unpack

T.onEnabledCallbacks = {}
Expand Down Expand Up @@ -75,73 +75,75 @@ function T:SetTemplateAS(_, frame, template, _)
self:SetTemplate(frame, template)
end

-- function T:HandleButton(_, button)
-- if not button or not (button.template or button.backdrop) then return end

-- local parent = button.backdrop or button
-- if parent.txBackground then return end

-- parent.SetBackdropColor = E.noop -- TODO: needs to be reversed on disable
-- parent.SetBackdropBorderColor = E.noop -- TODO: needs to be reversed on disable

-- -- TODO: this needs to be smarter
-- -- local text = button.Text or button.GetName and button:GetName() and _G[button:GetName() .. "Text"]
-- -- if text and text.GetTextColor then F.SetFontColorFromDB(nil, nil, text) end

-- local bg = parent:CreateTexture()
-- bg:SetInside(parent, 1, 1)
-- bg:SetTexture(E.Libs.LSM:Fetch("statusbar", "TX WorldState Score")) -- TODO: needs to be cached
-- bg:SetVertexColor(1, 1, 1, 1)

-- parent.txBackground = bg

-- local gr = F.Table.HexToRGB(I.Strings.Colors[I.Enum.Colors.TXUI]) -- TODO: this needs to be cached
-- F.Color.SetGradientRGB(bg, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0, gr.r, gr.g, gr.b, 0)

-- if parent.Center then
-- local layer, subLayer = parent.Center:GetDrawLayer()
-- subLayer = subLayer and subLayer + 1 or 0
-- bg:SetDrawLayer(layer, subLayer)
-- end

-- local function onEnter() -- TODO: don't use local func
-- F.Color.SetGradientRGB(bg, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0.4, gr.r, gr.g, gr.b, 0)
-- end

-- local function onLeave() -- TODO: don't use local func
-- F.Color.SetGradientRGB(bg, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0, gr.r, gr.g, gr.b, 0)
-- end

-- -- TODO: vv see above, needs a closure outside
-- self:SecureHookScript(button, "OnEnter", onEnter)
-- self:SecureHookScript(button, "OnLeave", onLeave)

-- -- TODO: vv this needs to be handled by a function cause will be used for other stuff
-- self:SecureHook(button, "SetScript", function(frame, scriptType)
-- if scriptType == "OnEnter" then
-- self:Unhook(frame, "OnEnter")
-- self:SecureHookScript(frame, "OnEnter", button.windAnimation and button.windAnimation.onEnter or nil)
-- elseif scriptType == "OnLeave" then
-- self:Unhook(frame, "OnLeave")
-- self:SecureHookScript(frame, "OnLeave", button.windAnimation and button.windAnimation.onLeave or nil)
-- end
-- end)
-- end

-- function T:HandleButtonColor(_, button)
-- if not button or not button.SetBackdropColor then return end
-- local parent = button.backdrop or button
-- if not parent.txBackground then return end

-- local gr = F.Table.HexToRGB(I.Strings.Colors[I.Enum.Colors.TXUI]) -- TODO: cache this

-- -- TODO: should use animations
-- if button:IsEnabled() then
-- F.Color.SetGradientRGB(parent.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0, gr.r, gr.g, gr.b, 0)
-- else
-- F.Color.SetGradientRGB(parent.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0.8, gr.r, gr.g, gr.b, 0)
-- end
-- end
function T:SetHoverHandlers(obj, onEnter, onLeave)
self:SecureHookScript(obj, "OnEnter", onEnter)
self:SecureHookScript(obj, "OnLeave", onLeave)

self:SecureHook(obj, "SetScript", function(frame, scriptType)
if scriptType == "OnEnter" then
self:Unhook(frame, "OnEnter")
self:SecureHookScript(frame, "OnEnter", onEnter)
elseif scriptType == "OnLeave" then
self:Unhook(frame, "OnLeave")
self:SecureHookScript(frame, "OnLeave", onLeave)
end
end)
end

function T:HandleButtonHover(obj)
local gr = F.Table.HexToRGB(I.Strings.Colors[I.Enum.Colors.TXUI]) -- TODO: needs to be cached
F.Color.SetGradientRGB(obj.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0.4, gr.r, gr.g, gr.b, 0)
end

function T:HandleButtonLeave(obj)
local gr = F.Table.HexToRGB(I.Strings.Colors[I.Enum.Colors.TXUI]) -- TODO: needs to be cached
F.Color.SetGradientRGB(obj.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0, gr.r, gr.g, gr.b, 0)
end

function T:HandleButton(_, button)
if not button or not (button.template or button.backdrop) then return end

local parent = button.backdrop or button
if parent.txBackground then return end

parent.SetBackdropColor = E.noop -- TODO: needs to be reversed on disable
parent.SetBackdropBorderColor = E.noop -- TODO: needs to be reversed on disable

-- TODO: this needs to be smarter
-- local text = button.Text or button.GetName and button:GetName() and _G[button:GetName() .. "Text"]
-- if text and text.GetTextColor then F.SetFontColorFromDB(nil, nil, text) end

local bg = parent:CreateTexture()
bg:SetInside(parent, 1, 1)
bg:SetTexture(E.Libs.LSM:Fetch("statusbar", "TX WorldState Score"))
bg:SetVertexColor(1, 1, 1, 1)

parent.txBackground = bg

if parent.Center then
local layer, subLayer = parent.Center:GetDrawLayer()
subLayer = subLayer and subLayer + 1 or 0
bg:SetDrawLayer(layer, subLayer)
end

self:HandleButtonLeave(parent)
self:SetHoverHandlers(button, F.Event.GenerateClosure(T.HandleButtonHover, self, parent), F.Event.GenerateClosure(T.HandleButtonLeave, self, parent))
end

function T:HandleButtonColor(_, button)
if not button or not button.SetBackdropColor then return end
local parent = button.backdrop or button
if not parent.txBackground then return end

local gr = F.Table.HexToRGB(I.Strings.Colors[I.Enum.Colors.TXUI]) -- TODO: cache this

-- TODO: should use animations
if button:IsEnabled() then
F.Color.SetGradientRGB(parent.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0, gr.r, gr.g, gr.b, 0)
else
F.Color.SetGradientRGB(parent.txBackground, I.Enum.GradientMode.Mode[I.Enum.GradientMode.Mode.VERTICAL], gr.r, gr.g, gr.b, 0.8, gr.r, gr.g, gr.b, 0)
end
end

function T:HandleWidget(_, widget)
local widgetType = widget.type
Expand Down Expand Up @@ -232,10 +234,10 @@ function T:Disable()
-- Unhook all
self:UnhookAll()

-- -- Re-Hook "watchers" if the skin gets enabled again we need those
-- self:SecureHook(E.Skins, "HandleButton", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButton))
-- self:SecureHook(E.Skins, "Ace3_RegisterAsWidget", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleWidget))
-- self:SecureHook(E, "Config_SetButtonColor", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButtonColor))
-- Re-Hook "watchers" if the skin gets enabled again we need those
self:SecureHook(E.Skins, "HandleButton", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButton))
self:SecureHook(E.Skins, "Ace3_RegisterAsWidget", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleWidget))
self:SecureHook(E, "Config_SetButtonColor", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButtonColor))
end

function T:Enable()
Expand Down Expand Up @@ -274,11 +276,11 @@ function T:Enable()
-- Scan all MetaTables
self:MetatableScan()

-- -- Handle buttons created before we Initialized
-- for _, funs in pairs(self.onEnabledCallbacks) do
-- local func, args = unpack(funs)
-- func(self, unpack(args))
-- end
-- Handle buttons created before we Initialized
for _, funs in pairs(self.onEnabledCallbacks) do
local func, args = unpack(funs)
func(self, unpack(args))
end

-- Force Refresh
self:ForceRefresh()
Expand Down Expand Up @@ -316,17 +318,17 @@ function T:DatabaseUpdate()
end)
end

-- function T:OnEnabledProxy(func, ...)
-- if not self.Initialized or not self.isEnabled then
-- tinsert(self.onEnabledCallbacks, { func, { ... } })
-- else
-- func(T, ...)
-- end
-- end
function T:OnEnabledProxy(func, ...)
if not self.Initialized or not self.isEnabled then
tinsert(self.onEnabledCallbacks, { func, { ... } })
else
func(T, ...)
end
end

-- T:SecureHook(E.Skins, "HandleButton", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButton))
-- T:SecureHook(E.Skins, "Ace3_RegisterAsWidget", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleWidget))
-- T:SecureHook(E, "Config_SetButtonColor", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButtonColor))
T:SecureHook(E.Skins, "HandleButton", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButton))
T:SecureHook(E.Skins, "Ace3_RegisterAsWidget", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleWidget))
T:SecureHook(E, "Config_SetButtonColor", F.Event.GenerateClosure(T.OnEnabledProxy, T, T.HandleButtonColor))

function T:Initialize()
-- Don't init second time
Expand All @@ -343,7 +345,7 @@ function T:Initialize()

-- Keep track of frames for fast updates
self.shadowCache = {}
-- self.buttonCache = {}
self.buttonCache = {}

-- We are done, hooray!
self.Initialized = true
Expand Down
3 changes: 2 additions & 1 deletion Modules/Misc/WeakAuraAnchor.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
local TXUI, F, E, I, V, P, G = unpack(select(2, ...))
local M = TXUI:GetModule("Misc")

local _G = _G
local CreateFrame = CreateFrame

function M:WeakAuraAnchorLoad()
local frame = CreateFrame("Frame", "ToxiUIWAAnchor", E.UIParent, "BackdropTemplate")
frame:SetParent(_G.ElvUF_Player)
frame:SetParent(_G["ElvUF_Player"])
frame:SetPoint("CENTER", E.UIParent, "CENTER", F.Dpi(0), F.Dpi(-200))
frame:SetFrameStrata("BACKGROUND")
frame:SetSize(F.Dpi(300), F.Dpi(100))
Expand Down
19 changes: 11 additions & 8 deletions Modules/Plugins/BlizzardFonts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ local FadingFrame_Show = FadingFrame_Show

function BF:UpdateFont(name, font, multi)
local obj = _G[name]
if not obj then return end
if obj == nil then return self:LogDebug("UpdateFont > obj is nil: " .. name) end

F.SetFontFromDB(E.db.TXUI.blizzardFonts, font, obj, false)

if multi ~= nil then
local fontPath, fontSize, fontOutline = obj:GetFont()
obj:SetFont(fontPath, fontSize * multi, fontOutline or "")
obj:SetFont(fontPath, fontSize * multi, fontOutline or "NONE")
end
end

Expand All @@ -34,12 +33,16 @@ function BF:SettingsUpdate()
self:UpdateFont("PVPInfoTextString", "pvpZone")

-- Mail Text
if TXUI.IsRetail then self:UpdateFont("SendMailBodyEditBox", "mail") end
if TXUI.IsWrath then self:UpdateFont("MailTextFontNormal", "mail") end

self:UpdateFont("InvoiceFont_Med", "mail", medium)
self:UpdateFont("InvoiceFont_Small", "mail", small)
self:UpdateFont("MailFont_Large", "mail", large)
self:UpdateFont("MailTextFontNormal", "mail")

if TXUI.IsRetail then
self:UpdateFont("InvoiceTextFontNormal", "mail")
else
self:UpdateFont("OpenMailBodyText", "mail")
self:UpdateFont("InvoiceFont_Med", "mail", medium)
self:UpdateFont("InvoiceFont_Small", "mail", small)
self:UpdateFont("MailFont_Large", "mail", large)
end

-- Gossip Text
self:UpdateFont("QuestFont", "gossip")
Expand Down
2 changes: 1 addition & 1 deletion Modules/WunderBar/Modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ end

function WB:ConstructModule(panel, moduleIndex, parentIndex)
local module = CreateFrame("Button", "TXUIWunderBar" .. panel.panelName .. "Module" .. parentIndex, panel)
module:RegisterForClicks("AnyUp")
module:RegisterForClicks("AnyDown")
module.subModule = nil
module.extendedModule = false
module.extendModuleRequest = false
Expand Down
8 changes: 3 additions & 5 deletions Modules/WunderBar/SubModules/Currency.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@ function CR:CreateElvUIDB()
_G.ElvDB.serverID[E.serverID][E.myrealm] = true
end

local function UpdateMarketPrice()
return C_WowTokenPublic_UpdateMarketPrice
end

function CR:OnInit()
-- Get our settings DB
self.db = WB:GetSubModuleDB(self:GetName())
Expand All @@ -391,7 +387,9 @@ function CR:OnInit()
self:CreateElvUIDB()

-- Create Token Ticker
self.tokenTicker = C_Timer_NewTicker(60, UpdateMarketPrice)
self.tokenCallback = F.Event.GenerateClosure(C_WowTokenPublic_UpdateMarketPrice)
self.tokenTicker = C_Timer_NewTicker(60, self.tokenCallback)
self.tokenCallback()

self:CreateText()
self:OnWunderBarUpdate()
Expand Down
2 changes: 1 addition & 1 deletion Modules/WunderBar/SubModules/DataBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function DB:CreateBar()
barFrame:SetScript("OnEnter", onEnter)
barFrame:SetScript("OnLeave", onLeave)

barFrame:RegisterForClicks("AnyUp")
barFrame:RegisterForClicks("AnyDown")
barFrame:SetScript("OnClick", onClick)

self.barFrame = barFrame
Expand Down
2 changes: 1 addition & 1 deletion Modules/WunderBar/SubModules/Hearthstone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function HS:CreateText()
secureFrameHolder:ClearAllPoints()
secureFrameHolder:SetAllPoints()
secureFrameHolder:EnableMouse(true)
secureFrameHolder:RegisterForClicks("AnyUp")
secureFrameHolder:RegisterForClicks("AnyDown")

self:HookScript(secureFrameHolder, "OnEnter", function(...)
WB:ModuleOnEnter(self, ...)
Expand Down
2 changes: 1 addition & 1 deletion Modules/WunderBar/SubModules/MicroMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ end
function MM:CreateButtons()
local function createMicroMenuButton(name, info)
local frame = CreateFrame("BUTTON", nil, self.frame, "SecureActionButtonTemplate")
frame:RegisterForClicks("AnyUp")
frame:RegisterForClicks("AnyDown")

frame.id = name
frame.info = info
Expand Down
Loading