from retail
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
local L = WeakAuras.L;
|
||||
|
||||
do
|
||||
local function subCreateOptions(parentData, data, index, subIndex)
|
||||
local order = 9
|
||||
local options = {
|
||||
__title = L["Background"],
|
||||
__order = 1,
|
||||
__up = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionUp(child, index, "subbackground")
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end,
|
||||
__down = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionDown(child, index, "subbackground")
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end,
|
||||
__notcollapsable = true
|
||||
}
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subbackground", subCreateOptions, L["Background"]);
|
||||
end
|
||||
|
||||
-- Foreground for aurabar
|
||||
|
||||
do
|
||||
local function subCreateOptions(parentData, data, index, subIndex)
|
||||
local order = 9
|
||||
local options = {
|
||||
__title = L["Foreground"],
|
||||
__order = 1,
|
||||
__up = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionUp(child, index, "subforeground")
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end,
|
||||
__down = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionDown(child, index, "subforeground")
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end,
|
||||
__notcollapsable = true
|
||||
}
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subforeground", subCreateOptions, L["Foreground"]);
|
||||
end
|
||||
@@ -10,26 +10,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Border %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subborder")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subborder")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subborder")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
border_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.doubleWidth,
|
||||
@@ -79,6 +59,8 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
}
|
||||
}
|
||||
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subborder")
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
|
||||
@@ -19,26 +19,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Glow %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subglow")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subglow")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subglow")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
glow = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
@@ -138,6 +118,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
},
|
||||
glowColor = {
|
||||
type = "color",
|
||||
hasAlpha = true,
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Custom Color"],
|
||||
order = 7,
|
||||
@@ -251,7 +232,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
|
||||
},
|
||||
|
||||
glow_anchor = {
|
||||
glow_expand_anchor = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 20,
|
||||
@@ -262,6 +243,9 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subglow")
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
|
||||
+35
-28
@@ -8,27 +8,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Model %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subbarmodel")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subbarmodel")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
bar_model_visible = {
|
||||
model_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Show Model"],
|
||||
@@ -36,27 +16,51 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
},
|
||||
model_path = {
|
||||
type = "input",
|
||||
width = WeakAuras.normalWidth,
|
||||
width = WeakAuras.doubleWidth - 0.15,
|
||||
name = L["Model"],
|
||||
order = 10
|
||||
order = 10.5
|
||||
},
|
||||
chooseModel = {
|
||||
type = "execute",
|
||||
width = WeakAuras.normalWidth,
|
||||
width = 0.15,
|
||||
name = L["Choose"],
|
||||
order = 11,
|
||||
func = function()
|
||||
OptionsPrivate.OpenModelPicker(data, parentData);
|
||||
OptionsPrivate.OpenModelPicker(parentData, {"subRegions", index});
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
control = "WeakAurasIcon",
|
||||
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
|
||||
},
|
||||
bar_model_clip = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
width = WeakAuras.doubleWidth,
|
||||
name = L["Clipped by Progress"],
|
||||
order = 12,
|
||||
hidden = function() return parentData.regionType ~= "aurabar" end
|
||||
},
|
||||
bar_model_alpha = {
|
||||
extra_width = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Extra Width"],
|
||||
order = 12.1,
|
||||
softMin = -100,
|
||||
softMax = 500,
|
||||
step = 1,
|
||||
hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end
|
||||
},
|
||||
extra_height = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Extra Height"],
|
||||
order = 12.2,
|
||||
softMin = -100,
|
||||
softMax = 500,
|
||||
step = 1,
|
||||
hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end
|
||||
},
|
||||
model_alpha = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Alpha"],
|
||||
@@ -106,7 +110,10 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
order = 45,
|
||||
},
|
||||
}
|
||||
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "submodel")
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionOptions("subbarmodel", createOptions, L["Shows a model"]);
|
||||
WeakAuras.RegisterSubRegionOptions("submodel", createOptions, L["Shows a model"]);
|
||||
@@ -41,7 +41,7 @@ function WeakAuras.DeleteSubRegion(data, index, regionType)
|
||||
AdjustConditions(data, replacements);
|
||||
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ function OptionsPrivate.MoveSubRegionUp(data, index, regionType)
|
||||
AdjustConditions(data, replacements);
|
||||
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ function OptionsPrivate.MoveSubRegionDown(data, index, regionType)
|
||||
AdjustConditions(data, replacements);
|
||||
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,6 +98,33 @@ function OptionsPrivate.DuplicateSubRegion(data, index, regionType)
|
||||
AdjustConditions(data, replacements);
|
||||
|
||||
WeakAuras.Add(data)
|
||||
WeakAuras.ClearAndUpdateOptions(data.id)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
end
|
||||
end
|
||||
|
||||
function OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, subRegionType)
|
||||
options.__up = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionUp(child, index, subRegionType)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
options.__down = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.MoveSubRegionDown(child, index, subRegionType)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
options.__duplicate = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
OptionsPrivate.DuplicateSubRegion(child, index, subRegionType)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
options.__delete = function()
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
WeakAuras.DeleteSubRegion(child, index, subRegionType)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,26 +31,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Text %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtext")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtext")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
text_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.halfWidth,
|
||||
@@ -278,16 +258,11 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
-- 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, OptionsPrivate.Private.GetAnchorsForData(childData, "point"))
|
||||
end
|
||||
else
|
||||
anchors = OptionsPrivate.Private.GetAnchorsForData(parentData, "point")
|
||||
local anchors = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
|
||||
WeakAuras.Mixin(anchors, OptionsPrivate.Private.GetAnchorsForData(child, "point"))
|
||||
end
|
||||
|
||||
-- Anchor Options
|
||||
options.text_anchorsDescription = {
|
||||
type = "execute",
|
||||
@@ -469,25 +444,29 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
end
|
||||
|
||||
if parentData.controlledChildren then
|
||||
for childIndex, childId in pairs(parentData.controlledChildren) do
|
||||
local parentChildData = WeakAuras.GetData(childId)
|
||||
if parentChildData.subRegions then
|
||||
local childData = parentChildData.subRegions[index]
|
||||
if childData then
|
||||
local get = function(key)
|
||||
return childData["text_text_format_" .. key]
|
||||
end
|
||||
local input = childData["text_text"]
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, childIndex, #parentData.controlledChildren)
|
||||
local list = {}
|
||||
for child in OptionsPrivate.Private.TraverseLeafs(parentData) do
|
||||
if child.subRegions then
|
||||
local childSubRegion = child.subRegions[index]
|
||||
if childSubRegion then
|
||||
tinsert(list, childSubRegion)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for listIndex, childSubRegion in ipairs(list) do
|
||||
local get = function(key)
|
||||
return childSubRegion["text_text_format_" .. key]
|
||||
end
|
||||
local input = childSubRegion["text_text"]
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false, listIndex, #list)
|
||||
end
|
||||
else
|
||||
local get = function(key)
|
||||
return data["text_text_format_" .. key]
|
||||
end
|
||||
local input = data["text_text"]
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
|
||||
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false)
|
||||
end
|
||||
|
||||
addOption("footer", {
|
||||
@@ -497,6 +476,8 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
hidden = hidden
|
||||
})
|
||||
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtext")
|
||||
|
||||
return options, commonTextOptions
|
||||
end
|
||||
|
||||
|
||||
@@ -13,26 +13,6 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
local options = {
|
||||
__title = L["Tick %s"]:format(subIndex),
|
||||
__order = 1,
|
||||
__up = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtick")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__down = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtick")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__duplicate = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtick")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
__delete = function()
|
||||
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtick")) then
|
||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||
end
|
||||
end,
|
||||
tick_visible = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
@@ -235,6 +215,9 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtick")
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user