This commit is contained in:
Bunny67
2020-09-14 10:12:22 +03:00
parent 6c3f9d925e
commit 0f4f16b6f0
71 changed files with 2302 additions and 2431 deletions
+29 -28
View File
@@ -1,4 +1,5 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local SharedMedia = LibStub("LibSharedMedia-3.0")
local L = WeakAuras.L
@@ -22,7 +23,7 @@ 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)
return OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
end
local indentWidth = 0.15
@@ -31,22 +32,22 @@ local function createOptions(parentData, data, index, subIndex)
__title = L["Text %s"]:format(subIndex),
__order = 1,
__up = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionUp, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.MoveSubRegionDown, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DuplicateSubRegion, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (WeakAuras.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
@@ -67,12 +68,12 @@ local function createOptions(parentData, data, index, subIndex)
type = "input",
width = WeakAuras.normalWidth,
desc = function()
return L["Dynamic text tooltip"] .. WeakAuras.GetAdditionalProperties(parentData)
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(parentData)
end,
name = L["Display Text"],
order = 11,
set = function(info, v)
data.text_text = WeakAuras.ReplaceLocalizedRaidMarkers(v)
data.text_text = OptionsPrivate.Private.ReplaceLocalizedRaidMarkers(v)
WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
@@ -98,7 +99,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "execute",
control = "WeakAurasExpandSmall",
name = function()
local textFlags = WeakAuras.font_flags[data.text_fontType]
local textFlags = OptionsPrivate.Private.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)
@@ -130,11 +131,11 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 44,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
WeakAuras.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
OptionsPrivate.SetCollapsed("subtext", "subtext", "fontflags" .. index, not collapsed)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
@@ -157,7 +158,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth - indentWidth,
name = L["Outline"],
order = 46,
values = WeakAuras.font_flags,
values = OptionsPrivate.Private.font_flags,
hidden = hiddenFontExtra
},
text_shadowColor = {
@@ -208,7 +209,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "select",
width = WeakAuras.normalWidth - indentWidth,
name = L["Alignment"],
values = WeakAuras.justify_types,
values = OptionsPrivate.Private.justify_types,
order = 50,
hidden = hiddenFontExtra
},
@@ -224,7 +225,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth - indentWidth,
name = L["Width"],
order = 51.5,
values = WeakAuras.text_automatic_width,
values = OptionsPrivate.Private.text_automatic_width,
hidden = hiddenFontExtra
},
text_font_space6 = {
@@ -256,7 +257,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.normalWidth,
name = L["Overflow"],
order = 54,
values = WeakAuras.text_word_wrap,
values = OptionsPrivate.Private.text_word_wrap,
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
},
@@ -282,10 +283,10 @@ local function createOptions(parentData, data, index, subIndex)
anchors = {}
for index, childId in ipairs(parentData.controlledChildren) do
local childData = WeakAuras.GetData(childId)
WeakAuras.Mixin(anchors, WeakAuras.GetAnchorsForData(childData, "point"))
WeakAuras.Mixin(anchors, OptionsPrivate.Private.GetAnchorsForData(childData, "point"))
end
else
anchors = WeakAuras.GetAnchorsForData(parentData, "point")
anchors = OptionsPrivate.Private.GetAnchorsForData(parentData, "point")
end
-- Anchor Options
options.text_anchorsDescription = {
@@ -319,14 +320,14 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
order = 60,
image = function()
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
local collapsed = OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
local collapsed = OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
OptionsPrivate.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
end,
arg = {
expanderName = "subtext_anchor" .. index .. "#" .. subIndex
@@ -335,7 +336,7 @@ local function createOptions(parentData, data, index, subIndex)
local hiddenFunction = function()
return WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
return OptionsPrivate.IsCollapsed("subregion", "text_anchors", tostring(index), true)
end
options.text_anchor_space = {
@@ -414,7 +415,7 @@ local function createOptions(parentData, data, index, subIndex)
end
for index, subRegion in ipairs(parentData.subRegions) do
if subRegion.type == "subtext" and WeakAuras.ContainsCustomPlaceHolder(subRegion.text_text) then
if subRegion.type == "subtext" and OptionsPrivate.Private.ContainsCustomPlaceHolder(subRegion.text_text) then
return false
end
end
@@ -429,7 +430,7 @@ local function createOptions(parentData, data, index, subIndex)
width = WeakAuras.doubleWidth,
hidden = hideCustomTextOption,
name = L["Update Custom Text On..."],
values = WeakAuras.text_check_types,
values = OptionsPrivate.Private.text_check_types,
order = 3,
get = function() return parentData.customTextUpdate or "event" end,
set = function(info, v)
@@ -440,16 +441,16 @@ local function createOptions(parentData, data, index, subIndex)
},
}
WeakAuras.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
OptionsPrivate.commonOptions.AddCodeOption(commonTextOptions, parentData, L["Custom Function"], "customText", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-text",
4, hideCustomTextOption, {"customText"}, false)
-- Add Text Format Options
local hidden = function()
return WeakAuras.IsCollapsed("format_option", "text", "text_text", true)
return OptionsPrivate.IsCollapsed("format_option", "text", "text_text", true)
end
local setHidden = function(hidden)
WeakAuras.SetCollapsed("format_option", "text", "text_text", hidden)
OptionsPrivate.SetCollapsed("format_option", "text", "text_text", hidden)
end
local order = 12
@@ -478,7 +479,7 @@ local function createOptions(parentData, data, index, subIndex)
return childData["text_text_format_" .. key]
end
local input = childData["text_text"]
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
end
end
end
@@ -487,7 +488,7 @@ local function createOptions(parentData, data, index, subIndex)
return data["text_text_format_" .. key]
end
local input = data["text_text"]
WeakAuras.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
end
addOption("footer", {