init
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0");
|
||||
local L = WeakAuras.L;
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Model %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
bar_model_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Show Model"],
|
||||
order = 9,
|
||||
},
|
||||
model_path = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Model"],
|
||||
order = 10
|
||||
},
|
||||
chooseModel = {
|
||||
type = "execute",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Choose"],
|
||||
order = 11,
|
||||
func = function()
|
||||
WeakAuras.OpenModelPicker(data, parentData);
|
||||
end,
|
||||
},
|
||||
bar_model_clip = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Clipped by Progress"],
|
||||
order = 12,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
},
|
||||
bar_model_alpha = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Alpha"],
|
||||
order = 13,
|
||||
min = 0,
|
||||
max = 1,
|
||||
bigStep = 0.1
|
||||
},
|
||||
model_z = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Z Offset"],
|
||||
softMin = -20,
|
||||
softMax = 20,
|
||||
step = .001,
|
||||
bigStep = 0.05,
|
||||
order = 20,
|
||||
},
|
||||
model_x = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["X Offset"],
|
||||
softMin = -20,
|
||||
softMax = 20,
|
||||
step = .001,
|
||||
bigStep = 0.05,
|
||||
order = 30,
|
||||
},
|
||||
model_y = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Y Offset"],
|
||||
softMin = -20,
|
||||
softMax = 20,
|
||||
step = .001,
|
||||
bigStep = 0.05,
|
||||
order = 40,
|
||||
},
|
||||
rotation = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Rotation"],
|
||||
min = 0,
|
||||
max = 360,
|
||||
step = 1,
|
||||
bigStep = 3,
|
||||
order = 45,
|
||||
},
|
||||
}
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subbarmodel", createOptions, L["Shows a model"]);
|
||||
@@ -0,0 +1,84 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0");
|
||||
local L = WeakAuras.L;
|
||||
|
||||
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Border %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
border_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Show Border"],
|
||||
order = 2,
|
||||
},
|
||||
border_edge = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
dialogControl = "LSM30_Border",
|
||||
name = L["Border Style"],
|
||||
order = 3,
|
||||
values = AceGUIWidgetLSMlists.border,
|
||||
},
|
||||
border_color = {
|
||||
type = "color",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Border Color"],
|
||||
hasAlpha = true,
|
||||
order = 4,
|
||||
},
|
||||
border_offset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Border Offset"],
|
||||
order = 5,
|
||||
softMin = 0,
|
||||
softMax = 32,
|
||||
bigStep = 1,
|
||||
},
|
||||
border_size = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Border Size"],
|
||||
order = 6,
|
||||
softMin = 1,
|
||||
softMax = 64,
|
||||
bigStep = 1,
|
||||
},
|
||||
border_anchor = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Border Anchor"],
|
||||
order = 7,
|
||||
values = WeakAuras.aurabar_anchor_areas,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subborder", createOptions, L["Shows a border"]);
|
||||
@@ -0,0 +1,253 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0");
|
||||
local L = WeakAuras.L;
|
||||
|
||||
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
|
||||
|
||||
|
||||
local indentWidth = 0.15
|
||||
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
|
||||
local hiddenGlowExtra = function()
|
||||
return WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
|
||||
end
|
||||
|
||||
local options = {
|
||||
__title = L["Glow %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
glow = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Show Glow"],
|
||||
order = 2,
|
||||
},
|
||||
glowType = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Type"],
|
||||
order = 2,
|
||||
values = WeakAuras.glow_types,
|
||||
},
|
||||
glow_anchor = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Glow Anchor"],
|
||||
order = 3,
|
||||
values = WeakAuras.aurabar_anchor_areas,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
},
|
||||
glowExtraDescription = {
|
||||
type = "execute",
|
||||
control = "WeakAurasExpandSmall",
|
||||
name = function()
|
||||
local line = L["|cFFffcc00Extra Options:|r"]
|
||||
local color = L["Default Color"]
|
||||
if data.useGlowColor then
|
||||
color = L["|c%02x%02x%02x%02xCustom Color|r"]:format(
|
||||
data.glowColor[4] * 255,
|
||||
data.glowColor[1] * 255,
|
||||
data.glowColor[2] * 255,
|
||||
data.glowColor[3] * 255
|
||||
)
|
||||
end
|
||||
if data.glowType == "buttonOverlay" then
|
||||
line = ("%s %s"):format(line, color)
|
||||
elseif data.glowType == "ACShine" then
|
||||
line = L["%s %s, Particles: %d, Frequency: %0.2f, Scale: %0.2f"]:format(
|
||||
line,
|
||||
color,
|
||||
data.glowLines,
|
||||
data.glowFrequency,
|
||||
data.glowScale
|
||||
)
|
||||
if data.glowXOffset ~= 0 or data.glowYOffset ~= 0 then
|
||||
line = L["%s, offset: %0.2f;%0.2f"]:format(line, data.glowXOffset, data.glowYOffset)
|
||||
end
|
||||
elseif data.glowType == "Pixel" then
|
||||
line = L["%s %s, Lines: %d, Frequency: %0.2f, Length: %d, Thickness: %d"]:format(
|
||||
line,
|
||||
color,
|
||||
data.glowLines,
|
||||
data.glowFrequency,
|
||||
data.glowLength,
|
||||
data.glowThickness
|
||||
)
|
||||
if data.glowXOffset ~= 0 or data.glowYOffset ~= 0 then
|
||||
line = L["%s, Offset: %0.2f;%0.2f"]:format(line, data.glowXOffset, data.glowYOffset)
|
||||
end
|
||||
if data.glowBorder then
|
||||
line = L["%s, Border"]:format(line)
|
||||
end
|
||||
end
|
||||
return line
|
||||
end,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 4,
|
||||
image = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
|
||||
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
|
||||
WeakAuras.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed);
|
||||
end,
|
||||
},
|
||||
glow_space1 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = indentWidth,
|
||||
order = 5,
|
||||
hidden = hiddenGlowExtra,
|
||||
},
|
||||
useGlowColor = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Use Custom Color"],
|
||||
desc = L["If unchecked, then a default color will be used (usually yellow)"],
|
||||
order = 6,
|
||||
hidden = hiddenGlowExtra
|
||||
},
|
||||
glowColor = {
|
||||
type = "color",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Custom Color"],
|
||||
order = 7,
|
||||
disabled = function() return not data.useGlowColor end,
|
||||
hidden = hiddenGlowExtra
|
||||
},
|
||||
glow_space2 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = indentWidth,
|
||||
order = 8,
|
||||
hidden = hiddenGlowExtra,
|
||||
},
|
||||
glowLines = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Lines & Particles"],
|
||||
order = 9,
|
||||
min = 1,
|
||||
softMax = 30,
|
||||
step = 1,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
|
||||
},
|
||||
glowFrequency = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Frequency"],
|
||||
order = 10,
|
||||
softMin = -2,
|
||||
softMax = 2,
|
||||
step = 0.05,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
|
||||
},
|
||||
glow_space3 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = indentWidth,
|
||||
order = 11,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
|
||||
},
|
||||
glowLength = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Length"],
|
||||
order = 12,
|
||||
min = 1,
|
||||
softMax = 20,
|
||||
step = 0.05,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
|
||||
},
|
||||
glowThickness = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Thickness"],
|
||||
order = 13,
|
||||
min = 0.05,
|
||||
softMax = 20,
|
||||
step = 0.05,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
|
||||
},
|
||||
glow_space4 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = indentWidth,
|
||||
order = 14,
|
||||
hidden = hiddenGlowExtra,
|
||||
},
|
||||
glowXOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["X-Offset"],
|
||||
order = 15,
|
||||
softMin = -100,
|
||||
softMax = 100,
|
||||
step = 0.5,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
|
||||
},
|
||||
glowYOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Y-Offset"],
|
||||
order = 16,
|
||||
softMin = -100,
|
||||
softMax = 100,
|
||||
step = 0.5,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType == "buttonOverlay" end,
|
||||
},
|
||||
glow_space5 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
width = indentWidth,
|
||||
order = 17,
|
||||
hidden = hiddenGlowExtra,
|
||||
},
|
||||
glowScale = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Scale"],
|
||||
order = 18,
|
||||
min = 0.05,
|
||||
softMax = 10,
|
||||
step = 0.05,
|
||||
isPercent = true,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "ACShine" end,
|
||||
},
|
||||
glowBorder = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Border"],
|
||||
order = 19,
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
|
||||
}
|
||||
}
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subglow", createOptions, L["Shows a glow"]);
|
||||
@@ -0,0 +1,97 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
-- Magic constant
|
||||
local deleteCondition = {}
|
||||
|
||||
local function AdjustConditions(data, replacements)
|
||||
if (data.conditions) then
|
||||
for conditionIndex, condition in ipairs(data.conditions) do
|
||||
for changeIndex, change in ipairs(condition.changes) do
|
||||
if change.property then
|
||||
local sub, rest = string.match(change.property, "^(sub.%d+%.)(.+)$")
|
||||
if sub and replacements[sub] then
|
||||
if replacements[sub] == deleteCondition then
|
||||
change.property = nil
|
||||
else
|
||||
change.property = replacements[sub] .. rest
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.DeleteSubRegion(data, index, regionType)
|
||||
if not data.subRegions then
|
||||
return
|
||||
end
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
tremove(data.subRegions, index)
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. index .. "."] = deleteCondition
|
||||
}
|
||||
|
||||
for i = index + 1, #data.subRegions + 1 do
|
||||
replacements["sub." .. i .. "."] = "sub." .. (i - 1) .. "."
|
||||
end
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.MoveSubRegionUp(data, index, regionType)
|
||||
if not data.subRegions or index <= 1 then
|
||||
return
|
||||
end
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
data.subRegions[index - 1], data.subRegions[index] = data.subRegions[index], data.subRegions[index - 1]
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. (index -1) .. "."] = "sub." .. index .. ".",
|
||||
["sub." .. index .. "."] = "sub." .. (index - 1) .. ".",
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.MoveSubRegionDown(data, index, regionType)
|
||||
if not data.subRegions then
|
||||
return
|
||||
end
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType and data.subRegions[index + 1] then
|
||||
data.subRegions[index], data.subRegions[index + 1] = data.subRegions[index + 1], data.subRegions[index]
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
|
||||
local replacements = {
|
||||
["sub." .. index .. "."] = "sub." .. (index + 1) .. ".",
|
||||
["sub." .. (index + 1) .. "."] = "sub." .. index .. ".",
|
||||
}
|
||||
|
||||
AdjustConditions(data, replacements);
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.DuplicateSubRegion(data, index, regionType)
|
||||
if not data.subRegions then
|
||||
return
|
||||
end
|
||||
if data.subRegions[index] and data.subRegions[index].type == regionType then
|
||||
tinsert(data.subRegions, index, CopyTable(data.subRegions[index]))
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ReloadOptions2(data.id, data)
|
||||
|
||||
local replacements = {}
|
||||
for i = index + 1, #data.subRegions do
|
||||
replacements["sub." .. i .. "."] = "sub." .. (i + 1) .. "."
|
||||
end
|
||||
AdjustConditions(data, replacements);
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,484 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0")
|
||||
local L = WeakAuras.L
|
||||
|
||||
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20
|
||||
|
||||
local self_point_types = {
|
||||
BOTTOMLEFT = L["Bottom Left"],
|
||||
BOTTOM = L["Bottom"],
|
||||
BOTTOMRIGHT = L["Bottom Right"],
|
||||
RIGHT = L["Right"],
|
||||
TOPRIGHT = L["Top Right"],
|
||||
TOP = L["Top"],
|
||||
TOPLEFT = L["Top Left"],
|
||||
LEFT = L["Left"],
|
||||
CENTER = L["Center"],
|
||||
AUTO = L["Automatic"]
|
||||
}
|
||||
|
||||
local function createOptions(parentData, data, index, subIndex)
|
||||
-- The toggles for font flags is intentionally not keyed on the id
|
||||
-- So that all auras share the state of that toggle
|
||||
local hiddenFontExtra = function()
|
||||
return WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
|
||||
end
|
||||
|
||||
local indentWidth = 0.15
|
||||
|
||||
local options = {
|
||||
__title = L["Text %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
end,
|
||||
text_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.halfWidth,
|
||||
order = 9,
|
||||
name = L["Show Text"],
|
||||
},
|
||||
text_color = {
|
||||
type = "color",
|
||||
width = WeakAuras.halfWidth,
|
||||
name = L["Color"],
|
||||
hasAlpha = true,
|
||||
order = 10,
|
||||
},
|
||||
text_text = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
desc = function()
|
||||
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(parentData)
|
||||
end,
|
||||
name = L["Display Text"],
|
||||
order = 11,
|
||||
set = function(info, v)
|
||||
data.text_text = WeakAuras.ReplaceLocalizedRaidMarkers(v)
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
},
|
||||
text_font = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
dialogControl = "LSM30_Font",
|
||||
name = L["Font"],
|
||||
order = 12,
|
||||
values = AceGUIWidgetLSMlists.font,
|
||||
},
|
||||
text_fontSize = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Size"],
|
||||
order = 13,
|
||||
min = 6,
|
||||
softMax = 72,
|
||||
step = 1,
|
||||
},
|
||||
text_fontFlagsDescription = {
|
||||
type = "execute",
|
||||
control = "WeakAurasExpandSmall",
|
||||
name = function()
|
||||
local textFlags = WeakAuras.font_flags[data.text_fontType]
|
||||
local color = format("%02x%02x%02x%02x",
|
||||
data.text_shadowColor[4] * 255, data.text_shadowColor[1] * 255,
|
||||
data.text_shadowColor[2] * 255, data.text_shadowColor[3]*255)
|
||||
|
||||
local textJustify = ""
|
||||
if data.text_justify == "CENTER" then
|
||||
|
||||
elseif data.text_justify == "LEFT" then
|
||||
textJustify = " " .. L["and aligned left"]
|
||||
elseif data.text_justify == "RIGHT" then
|
||||
textJustify = " " .. L["and aligned right"]
|
||||
end
|
||||
|
||||
local textRotate = ""
|
||||
if data.rotateText == "LEFT" then
|
||||
textRotate = " " .. L["and rotated left"]
|
||||
elseif data.rotateText == "RIGHT" then
|
||||
textRotate = " " .. L["and rotated right"]
|
||||
end
|
||||
|
||||
local textWidth = ""
|
||||
if data.text_automaticWidth == "Fixed" then
|
||||
local wordWarp = ""
|
||||
if data.text_wordWrap == "WordWrap" then
|
||||
wordWarp = L["wrapping"]
|
||||
else
|
||||
wordWarp = L["eliding"]
|
||||
end
|
||||
textWidth = " "..L["and with width |cFFFF0000%s|r and %s"]:format(data.text_fixedWidth, wordWarp)
|
||||
end
|
||||
|
||||
local secondline = L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"]:format(textFlags, color, data.text_shadowXOffset, data.text_shadowYOffset, textRotate, textJustify, textWidth)
|
||||
|
||||
return secondline
|
||||
end,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 44,
|
||||
func = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
|
||||
WeakAuras.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
|
||||
end,
|
||||
image = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
|
||||
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24
|
||||
},
|
||||
|
||||
text_font_space = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 45,
|
||||
hidden = hiddenFontExtra,
|
||||
width = indentWidth
|
||||
},
|
||||
|
||||
text_fontType = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Outline"],
|
||||
order = 46,
|
||||
values = WeakAuras.font_flags,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
text_shadowColor = {
|
||||
type = "color",
|
||||
hasAlpha = true,
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Shadow Color"],
|
||||
order = 47,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
|
||||
text_font_space3 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 47.5,
|
||||
hidden = hiddenFontExtra,
|
||||
width = indentWidth
|
||||
},
|
||||
text_shadowXOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Shadow X Offset"],
|
||||
softMin = -15,
|
||||
softMax = 15,
|
||||
bigStep = 1,
|
||||
order = 48,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
text_shadowYOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Shadow Y Offset"],
|
||||
softMin = -15,
|
||||
softMax = 15,
|
||||
bigStep = 1,
|
||||
order = 49,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
|
||||
text_font_space4 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 49.5,
|
||||
hidden = hiddenFontExtra,
|
||||
width = indentWidth
|
||||
},
|
||||
rotateText = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Rotate Text"],
|
||||
values = WeakAuras.text_rotate_types,
|
||||
order = 50,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
text_justify = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Alignment"],
|
||||
values = WeakAuras.justify_types,
|
||||
order = 50.5,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
text_font_space5 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 51,
|
||||
hidden = hiddenFontExtra,
|
||||
width = indentWidth
|
||||
},
|
||||
text_automaticWidth = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Width"],
|
||||
order = 51.5,
|
||||
values = WeakAuras.text_automatic_width,
|
||||
hidden = hiddenFontExtra
|
||||
},
|
||||
text_font_space6 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 52,
|
||||
hidden = hiddenFontExtra,
|
||||
width = WeakAuras.normalWidth
|
||||
},
|
||||
text_font_space7 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 52.5,
|
||||
width = indentWidth,
|
||||
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
|
||||
},
|
||||
text_fixedWidth = {
|
||||
name = L["Width"],
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
order = 53,
|
||||
type = "range",
|
||||
min = 1,
|
||||
softMax = 200,
|
||||
bigStep = 1,
|
||||
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
|
||||
},
|
||||
text_wordWrap = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Overflow"],
|
||||
order = 54,
|
||||
values = WeakAuras.text_word_wrap,
|
||||
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
|
||||
},
|
||||
}
|
||||
|
||||
-- Note: Anchor Options need to be generalized once there are multiple sub regions
|
||||
-- While every sub region will have anchor options, the initial
|
||||
-- design I had for anchor options proved to be not general enough for
|
||||
-- what SubText needed. So, I removed it, and postponed making it work for unknown future
|
||||
-- sub regions
|
||||
local anchors
|
||||
if parentData.controlledChildren then
|
||||
anchors = {}
|
||||
for index, childId in ipairs(parentData.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
WeakAuras:Mixin(anchors, WeakAuras.GetAnchorsForData(childData, "point"))
|
||||
end
|
||||
else
|
||||
anchors = WeakAuras.GetAnchorsForData(parentData, "point")
|
||||
end
|
||||
-- Anchor Options
|
||||
options.text_anchorsDescription = {
|
||||
type = "execute",
|
||||
control = "WeakAurasExpandSmall",
|
||||
name = function()
|
||||
local selfPoint = data.text_selfPoint ~= "AUTO" and self_point_types[data.text_selfPoint]
|
||||
local anchorPoint = anchors[data.text_anchorPoint or "CENTER"] or anchors["CENTER"]
|
||||
|
||||
local xOffset = data.text_anchorXOffset or 0
|
||||
local yOffset = data.text_anchorYOffset or 0
|
||||
|
||||
if (type(anchorPoint) == "table") then
|
||||
anchorPoint = anchorPoint[1] .. "/" .. anchorPoint[2]
|
||||
end
|
||||
|
||||
if selfPoint then
|
||||
if xOffset == 0 and yOffset == 0 then
|
||||
return L["|cFFffcc00Anchors:|r Anchored |cFFFF0000%s|r to frame's |cFFFF0000%s|r"]:format(selfPoint, anchorPoint)
|
||||
else
|
||||
return L["|cFFffcc00Anchors:|r Anchored |cFFFF0000%s|r to frame's |cFFFF0000%s|r with offset |cFFFF0000%s/%s|r"]:format(selfPoint, anchorPoint, xOffset, yOffset)
|
||||
end
|
||||
else
|
||||
if xOffset == 0 and yOffset == 0 then
|
||||
return L["|cFFffcc00Anchors:|r Anchored to frame's |cFFFF0000%s|r"]:format(anchorPoint)
|
||||
else
|
||||
return L["|cFFffcc00Anchors:|r Anchored to frame's |cFFFF0000%s|r with offset |cFFFF0000%s/%s|r"]:format(anchorPoint, xOffset, yOffset)
|
||||
end
|
||||
end
|
||||
end,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = 60,
|
||||
image = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
|
||||
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
func = function()
|
||||
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
|
||||
WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
local hiddenFunction = function()
|
||||
return WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
|
||||
end
|
||||
|
||||
options.text_anchor_space = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 60.15,
|
||||
hidden = hiddenFunction,
|
||||
width = indentWidth
|
||||
}
|
||||
|
||||
options.text_selfPoint = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["Anchor"],
|
||||
order = 60.2,
|
||||
values = self_point_types,
|
||||
hidden = hiddenFunction
|
||||
}
|
||||
|
||||
options.text_anchorPoint = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = function()
|
||||
return L["To Frame's"]
|
||||
end,
|
||||
order = 60.3,
|
||||
values = anchors,
|
||||
hidden = hiddenFunction,
|
||||
control = "WeakAurasTwoColumnDropdown"
|
||||
}
|
||||
|
||||
options.text_anchor_space2 = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 60.35,
|
||||
hidden = hiddenFunction,
|
||||
width = indentWidth
|
||||
}
|
||||
|
||||
options.text_anchorXOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth - indentWidth,
|
||||
name = L["X Offset"],
|
||||
order = 60.4,
|
||||
softMin = (-1 * screenWidth),
|
||||
softMax = screenWidth,
|
||||
bigStep = 10,
|
||||
hidden = hiddenFunction
|
||||
}
|
||||
|
||||
options.text_anchorYOffset = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Y Offset"],
|
||||
order = 60.5,
|
||||
softMin = (-1 * screenHeight),
|
||||
softMax = screenHeight,
|
||||
bigStep = 10,
|
||||
hidden = hiddenFunction
|
||||
}
|
||||
|
||||
local function hideCustomTextOption()
|
||||
if not parentData.subRegions then
|
||||
return true
|
||||
end
|
||||
|
||||
for index, subRegion in ipairs(parentData.subRegions) do
|
||||
if subRegion.type == "subtext" and WeakAuras.ContainsCustomPlaceHolder(subRegion.text_text) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function CheckTextOptions(placeholders)
|
||||
return function()
|
||||
if not parentData.subRegions then
|
||||
return true
|
||||
end
|
||||
|
||||
for index, subRegion in ipairs(parentData.subRegions) do
|
||||
if subRegion.type == "subtext" and WeakAuras.ContainsPlaceHolders(subRegion.text_text, placeholders) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local CheckForTimePlaceHolders = CheckTextOptions("pt")
|
||||
|
||||
local commonTextOptions = {
|
||||
__title = L["Common Text"],
|
||||
__hidden = function() return hideCustomTextOption() and CheckForTimePlaceHolders() end,
|
||||
text_customTextUpdate = {
|
||||
type = "select",
|
||||
width = WeakAuras.doubleWidth,
|
||||
hidden = hideCustomTextOption,
|
||||
name = L["Update Custom Text On..."],
|
||||
values = WeakAuras.text_check_types,
|
||||
order = 3,
|
||||
get = function() return parentData.customTextUpdate or "event" end,
|
||||
set = function(info, v)
|
||||
parentData.customTextUpdate = v
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end
|
||||
},
|
||||
-- Code Editor added below
|
||||
text_progressPrecision = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = CheckForTimePlaceHolders,
|
||||
disabled = CheckTextOptions("p"),
|
||||
order = 5,
|
||||
name = L["Remaining Time Precision"],
|
||||
values = WeakAuras.precision_types,
|
||||
get = function() return parentData.progressPrecision or 1 end,
|
||||
set = function(info, v)
|
||||
parentData.progressPrecision = v
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end,
|
||||
},
|
||||
text_totalPrecision = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = CheckForTimePlaceHolders,
|
||||
disabled = CheckTextOptions("t"),
|
||||
order = 6,
|
||||
name = L["Total Time Precision"],
|
||||
values = WeakAuras.precision_types,
|
||||
get = function() return parentData.totalPrecision or 1 end,
|
||||
set = function(info, v)
|
||||
parentData.totalPrecision = v
|
||||
WeakAuras.Add(parentData)
|
||||
WeakAuras.ReloadOptions2(parentData.id, parentData)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
WeakAuras.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Text-Replacements",
|
||||
4, hideCustomTextOption, {"customText"}, false)
|
||||
|
||||
return options, commonTextOptions
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subtext", createOptions, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"])
|
||||
Reference in New Issue
Block a user