Fix up config to comply with meta
Update
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
local addonname, shared = ...
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
|
||||
---@param str string
|
||||
---@return table<string, boolean>
|
||||
@@ -149,15 +148,15 @@ GridFrame = {
|
||||
rowspan = rowspan,
|
||||
parent = self,
|
||||
}
|
||||
---@diagnostic disable-next-line: inject-field, redefined-local
|
||||
frame.SetPos = function(self)
|
||||
if not self.gridData then return end
|
||||
local parent = self.gridData.parent
|
||||
local x = (self.gridData.column - 1) * parent.cellWidth
|
||||
local y = -(self.gridData.row * parent.cellHeight)
|
||||
self:SetPoint("TOPLEFT", parent.frame, "TOPLEFT", x, y)
|
||||
self:SetWidth(parent.cellWidth * self.gridData.colspan)
|
||||
self:SetHeight(parent.cellHeight * self.gridData.rowspan)
|
||||
---@diagnostic disable-next-line: inject-field
|
||||
frame.SetPos = function(selff)
|
||||
if not selff.gridData then return end
|
||||
local parent = selff.gridData.parent
|
||||
local x = (selff.gridData.column - 1) * parent.cellWidth
|
||||
local y = -(selff.gridData.row * parent.cellHeight)
|
||||
selff:SetPoint("TOPLEFT", parent.frame, "TOPLEFT", x, y)
|
||||
selff:SetWidth(parent.cellWidth * selff.gridData.colspan)
|
||||
selff:SetHeight(parent.cellHeight * selff.gridData.rowspan)
|
||||
end
|
||||
frame.SetPos(frame)
|
||||
|
||||
@@ -262,7 +261,7 @@ StaticGridFrame = {
|
||||
return self
|
||||
end,
|
||||
---@param self StaticGridFrame
|
||||
---@param frame Frame
|
||||
---@param frame Region
|
||||
---@param rowspan number
|
||||
---@param colspan number
|
||||
Add = function(self, frame, rowspan, colspan)
|
||||
@@ -295,7 +294,9 @@ StaticGridFrame = {
|
||||
frame:SetWidth(self.cellWidth * colspan)
|
||||
frame:SetHeight(self.cellHeight * rowspan)
|
||||
frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", x, y)
|
||||
frame:SetParent(self.frame)
|
||||
-- Region should have set parent...
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
if frame.SetParent then frame:SetParent(self.frame) end
|
||||
for r = row, row + rowspan - 1 do
|
||||
for c = col, col + colspan - 1 do
|
||||
self.occupancy[r][c] = true
|
||||
@@ -312,8 +313,8 @@ StaticGridFrame = {
|
||||
self.frame:SetMovable(true)
|
||||
self.frame:EnableMouse(true)
|
||||
self.frame:RegisterForDrag("LeftButton")
|
||||
self.frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
|
||||
self.frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
|
||||
self.frame:SetScript("OnDragStart", function(selff) selff:StartMoving() end)
|
||||
self.frame:SetScript("OnDragStop", function(selff) selff:StopMovingOrSizing() end)
|
||||
end,
|
||||
Recalculate = function(self)
|
||||
for _, frame in pairs(self.frame:GetChildren()) do
|
||||
@@ -460,18 +461,23 @@ function shared.Config.Init()
|
||||
---@param name string
|
||||
---@param parent Frame
|
||||
---@param text string
|
||||
---@param onDone fun(editBox: Frame)
|
||||
---@param onDone fun(editBox: EditBox)
|
||||
---@return GridFrame
|
||||
local function CreateBasicSmallEditBox(name, parent, text, initialValue, onDone)
|
||||
local container = GridFrame.new(name, parent, 1, 1)
|
||||
---@type Frame
|
||||
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
|
||||
---@type EditBox
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
|
||||
---@type Frame
|
||||
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
|
||||
---@type FontString
|
||||
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
textElement:SetText(text)
|
||||
|
||||
editBox:SetAutoFocus(false)
|
||||
editBox:SetFontObject("GameFontNormal")
|
||||
editBox:SetText(Heimdall_Data.config.spotter.throttleTime)
|
||||
editBox:SetText("")
|
||||
editBox:SetBackdrop({
|
||||
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||
@@ -500,12 +506,17 @@ function shared.Config.Init()
|
||||
---@param name string
|
||||
---@param parent Frame
|
||||
---@param text string
|
||||
---@param onDone fun(editBox: Frame)
|
||||
---@param onDone fun(editBox: EditBox)
|
||||
---@return GridFrame
|
||||
local function CreateBasicBigEditBox(name, parent, text, initialValue, onDone)
|
||||
local container = GridFrame.new(name, parent, 1, 100)
|
||||
---@type Frame
|
||||
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
|
||||
---@type EditBox
|
||||
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
|
||||
---@type Frame
|
||||
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
|
||||
---@type FontString
|
||||
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||
textElement:SetText(text)
|
||||
|
||||
@@ -553,7 +564,7 @@ function shared.Config.Init()
|
||||
configFrame.frame:SetScale(Heimdall_Data.config.scale)
|
||||
else
|
||||
print(string.format("Invalid scale: %s, please use numbers", text))
|
||||
self:SetText(Heimdall_Data.config.scale)
|
||||
self:SetText(tostring(Heimdall_Data.config.scale))
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -581,7 +592,7 @@ function shared.Config.Init()
|
||||
shared._L("english", Heimdall_Data.config.locale),
|
||||
function()
|
||||
Heimdall_Data.config.locale = "en"
|
||||
russian:UpdateColor(false)
|
||||
if russian then russian:UpdateColor(false) end
|
||||
return Heimdall_Data.config.locale == "en"
|
||||
end
|
||||
)
|
||||
@@ -607,7 +618,7 @@ function shared.Config.Init()
|
||||
spotterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(spotterConfigFrame, 9, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallSpotterConfigTitle",
|
||||
spotterConfigFrame.frame,
|
||||
shared._L("spotter", Heimdall_Data.config.locale),
|
||||
@@ -743,7 +754,7 @@ function shared.Config.Init()
|
||||
whoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(whoerConfigFrame, 30, 6)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallWhoerConfigTitle",
|
||||
whoerConfigFrame.frame,
|
||||
shared._L("whoer", Heimdall_Data.config.locale),
|
||||
@@ -862,7 +873,7 @@ function shared.Config.Init()
|
||||
messengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(messengerConfigFrame, 6, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallMessengerConfigTitle",
|
||||
messengerConfigFrame.frame,
|
||||
shared._L("messenger", Heimdall_Data.config.locale),
|
||||
@@ -905,7 +916,7 @@ function shared.Config.Init()
|
||||
print("Interval set to", tostring(text))
|
||||
else
|
||||
print("Invalid interval", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.messenger.interval)
|
||||
self:SetText(tostring(Heimdall_Data.config.messenger.interval))
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -919,7 +930,7 @@ function shared.Config.Init()
|
||||
deathReporterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(deathReporterConfigFrame, 10, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallDeathReporterConfigTitle",
|
||||
deathReporterConfigFrame.frame,
|
||||
shared._L("deathReporter", Heimdall_Data.config.locale),
|
||||
@@ -974,7 +985,7 @@ function shared.Config.Init()
|
||||
print("Throttle time set to", tostring(text))
|
||||
else
|
||||
print("Invalid throttle time", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.deathReporter.throttle)
|
||||
self:SetText(tostring(Heimdall_Data.config.deathReporter.throttle))
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -1038,7 +1049,7 @@ function shared.Config.Init()
|
||||
inviterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(inviterConfigFrame, 13, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallInviterConfigTitle",
|
||||
inviterConfigFrame.frame,
|
||||
shared._L("inviter", Heimdall_Data.config.locale),
|
||||
@@ -1196,7 +1207,7 @@ function shared.Config.Init()
|
||||
duelerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(duelerConfigFrame, 4, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallDuelerConfigTitle",
|
||||
duelerConfigFrame.frame,
|
||||
shared._L("dueler", Heimdall_Data.config.locale),
|
||||
@@ -1247,7 +1258,7 @@ function shared.Config.Init()
|
||||
agentTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(agentTrackerConfigFrame, 5, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallAgentTrackerConfigTitle",
|
||||
agentTrackerConfigFrame.frame,
|
||||
shared._L("agentTracker", Heimdall_Data.config.locale),
|
||||
@@ -1300,7 +1311,7 @@ function shared.Config.Init()
|
||||
stinkyTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(stinkyTrackerConfigFrame, 5, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallStinkyTrackerConfigTitle",
|
||||
stinkyTrackerConfigFrame.frame,
|
||||
shared._L("stinkyTracker", Heimdall_Data.config.locale),
|
||||
@@ -1353,7 +1364,7 @@ function shared.Config.Init()
|
||||
emoterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(emoterConfigFrame, 7, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallEmoterConfigTitle",
|
||||
emoterConfigFrame.frame,
|
||||
shared._L("emoter", Heimdall_Data.config.locale),
|
||||
@@ -1424,7 +1435,7 @@ function shared.Config.Init()
|
||||
echoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(echoerConfigFrame, 7, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallEchoerConfigTitle",
|
||||
echoerConfigFrame.frame,
|
||||
shared._L("echoer", Heimdall_Data.config.locale),
|
||||
@@ -1495,7 +1506,7 @@ function shared.Config.Init()
|
||||
commanderConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(commanderConfigFrame, 10, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallCommanderConfigTitle",
|
||||
commanderConfigFrame.frame,
|
||||
shared._L("commander", Heimdall_Data.config.locale),
|
||||
@@ -1578,7 +1589,7 @@ function shared.Config.Init()
|
||||
macroerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(macroerConfigFrame, 6, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallMacroerConfigTitle",
|
||||
macroerConfigFrame.frame,
|
||||
shared._L("macroer", Heimdall_Data.config.locale),
|
||||
@@ -1629,7 +1640,7 @@ function shared.Config.Init()
|
||||
combatAlerterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(combatAlerterConfigFrame, 5, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallCombatAlerterConfigTitle",
|
||||
combatAlerterConfigFrame.frame,
|
||||
shared._L("combatAlerter", Heimdall_Data.config.locale),
|
||||
@@ -1682,7 +1693,7 @@ function shared.Config.Init()
|
||||
snifferConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(snifferConfigFrame, 8, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallSnifferConfigTitle",
|
||||
snifferConfigFrame.frame,
|
||||
shared._L("sniffer", Heimdall_Data.config.locale),
|
||||
@@ -1783,7 +1794,7 @@ function shared.Config.Init()
|
||||
bonkDetectorConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(bonkDetectorConfigFrame, 7, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallBonkDetectorConfigTitle",
|
||||
bonkDetectorConfigFrame.frame,
|
||||
shared._L("bonkDetector", Heimdall_Data.config.locale),
|
||||
@@ -1855,7 +1866,7 @@ function shared.Config.Init()
|
||||
minimapTaggerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(minimapTaggerConfigFrame, 18, 6)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallMinimapTaggerConfigTitle",
|
||||
minimapTaggerConfigFrame.frame,
|
||||
shared._L("minimapTagger", Heimdall_Data.config.locale),
|
||||
@@ -1900,7 +1911,7 @@ function shared.Config.Init()
|
||||
)
|
||||
minimapTaggerConfigFrame:Add(channels, 2, 3)
|
||||
|
||||
local scale = CreateBasicSmallEditBox(
|
||||
scale = CreateBasicSmallEditBox(
|
||||
"HeimdallMinimapTaggerConfigScale",
|
||||
minimapTaggerConfigFrame.frame,
|
||||
shared._L("scale", Heimdall_Data.config.locale),
|
||||
@@ -2223,7 +2234,7 @@ function shared.Config.Init()
|
||||
noterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(noterConfigFrame, 7, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallNoterConfigTitle",
|
||||
noterConfigFrame.frame,
|
||||
shared._L("noter", Heimdall_Data.config.locale),
|
||||
@@ -2296,7 +2307,7 @@ function shared.Config.Init()
|
||||
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(networkConfigFrame, 11, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallNetworkConfigTitle",
|
||||
networkConfigFrame.frame,
|
||||
shared._L("network", Heimdall_Data.config.locale),
|
||||
@@ -2368,7 +2379,7 @@ function shared.Config.Init()
|
||||
networkMessengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(networkMessengerConfigFrame, 5, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallNetworkMessengerConfigTitle",
|
||||
networkMessengerConfigFrame.frame,
|
||||
shared._L("networkMessenger", Heimdall_Data.config.locale),
|
||||
@@ -2426,7 +2437,7 @@ function shared.Config.Init()
|
||||
achievementSnifferConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(achievementSnifferConfigFrame, 14, 3)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallAchievementSnifferConfigTitle",
|
||||
achievementSnifferConfigFrame.frame,
|
||||
shared._L("achievementSniffer", Heimdall_Data.config.locale),
|
||||
@@ -2538,7 +2549,7 @@ function shared.Config.Init()
|
||||
addonPrefixConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(addonPrefixConfigFrame, 5, 1)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallAddonPrefixConfigTitle",
|
||||
addonPrefixConfigFrame.frame,
|
||||
shared._L("addonPrefix", Heimdall_Data.config.locale),
|
||||
@@ -2566,7 +2577,7 @@ function shared.Config.Init()
|
||||
whisperNotifyConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(whisperNotifyConfigFrame, 14, 1)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallWhisperNotifyConfigTitle",
|
||||
whisperNotifyConfigFrame.frame,
|
||||
shared._L("whisperNotify", Heimdall_Data.config.locale),
|
||||
@@ -2596,7 +2607,7 @@ function shared.Config.Init()
|
||||
-- Why do 17 rows of content fit into a frame that is 14 rows?
|
||||
-- I don't know, at this point I can't be fucked to fix it, the display is minimally functional
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallStinkiesConfigTitle",
|
||||
stinkiesConfigFrame.frame,
|
||||
shared._L("stinkies", Heimdall_Data.config.locale),
|
||||
@@ -2624,7 +2635,7 @@ function shared.Config.Init()
|
||||
channelLocaleConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(channelLocaleConfigFrame, 14, 1)
|
||||
|
||||
local title = CreateFancyText(
|
||||
title = CreateFancyText(
|
||||
"HeimdallChannelLocaleConfigTitle",
|
||||
channelLocaleConfigFrame.frame,
|
||||
shared._L("channelLocale", Heimdall_Data.config.locale),
|
||||
|
||||
Reference in New Issue
Block a user