beta
This commit is contained in:
@@ -3,7 +3,6 @@ local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L
|
||||
local regionOptions = WeakAuras.regionOptions
|
||||
local point_types = WeakAuras.point_types;
|
||||
|
||||
local parsePrefix = function(input, data, create)
|
||||
local subRegionIndex, property = string.match(input, "^sub%.(%d+)%..-%.(.+)")
|
||||
@@ -67,15 +66,15 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
|
||||
width = titleWidth,
|
||||
func = function(info, button, secondCall)
|
||||
if not nooptions and not secondCall then
|
||||
local isCollapsed = WeakAuras.IsCollapsed("collapse", "region", key, false)
|
||||
WeakAuras.SetCollapsed("collapse", "region", key, not isCollapsed)
|
||||
local isCollapsed = OptionsPrivate.IsCollapsed("collapse", "region", key, false)
|
||||
OptionsPrivate.SetCollapsed("collapse", "region", key, not isCollapsed)
|
||||
end
|
||||
end,
|
||||
image = function()
|
||||
if nooptions then
|
||||
return "Interface\\AddOns\\WeakAuras\\Media\\Textures\\bullet1", 18, 18
|
||||
else
|
||||
local isCollapsed = WeakAuras.IsCollapsed("collapse", "region", key, false)
|
||||
local isCollapsed = OptionsPrivate.IsCollapsed("collapse", "region", key, false)
|
||||
return isCollapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", 18, 18
|
||||
end
|
||||
end,
|
||||
@@ -175,18 +174,17 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
|
||||
|
||||
if hiddenFunc then
|
||||
return function()
|
||||
return hiddenFunc() or WeakAuras.IsCollapsed("collapse", "region", key, false)
|
||||
return hiddenFunc() or OptionsPrivate.IsCollapsed("collapse", "region", key, false)
|
||||
end
|
||||
else
|
||||
return function()
|
||||
return WeakAuras.IsCollapsed("collapse", "region", key, false)
|
||||
return OptionsPrivate.IsCollapsed("collapse", "region", key, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function copyOptionTable(input, orderAdjustment, collapsedFunc)
|
||||
local resultOption = {};
|
||||
WeakAuras.DeepCopy(input, resultOption);
|
||||
local resultOption = CopyTable(input);
|
||||
resultOption.order = orderAdjustment + resultOption.order;
|
||||
if collapsedFunc then
|
||||
local oldHidden = resultOption.hidden;
|
||||
@@ -315,7 +313,7 @@ local function CreateHiddenAll(subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -352,7 +350,7 @@ local function CreateDisabledAll(subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption);
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption);
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -422,7 +420,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local values = getValueFor(WeakAuras.EnsureOptions(childData, subOption), info, "values");
|
||||
local values = getValueFor(OptionsPrivate.EnsureOptions(childData, subOption), info, "values");
|
||||
if (values) then
|
||||
if (type(values) == "function") then
|
||||
values = values(info);
|
||||
@@ -458,7 +456,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
if isToggle == nil then
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info)
|
||||
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
|
||||
isToggle = childOption and childOption.type == "toggle"
|
||||
end
|
||||
|
||||
@@ -466,7 +464,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
|
||||
local regionType = regionPrefix(info[#info]);
|
||||
if(childData and (not regionType or childData.regionType == regionType or regionType == "sub")) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local get = getValueFor(childOptions, info, "get");
|
||||
if (combinedKeys) then
|
||||
for key, _ in pairs(combinedKeys) do
|
||||
@@ -513,7 +511,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info);
|
||||
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
|
||||
if (childOption) then
|
||||
local name;
|
||||
if(type(childOption.name) == "function") then
|
||||
@@ -552,7 +550,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOption = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info);
|
||||
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
|
||||
if (childOption) then
|
||||
local desc;
|
||||
if(type(childOption.desc) == "function") then
|
||||
@@ -600,7 +598,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -683,7 +681,7 @@ local function replaceImageFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOption = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
if not(childOption) then
|
||||
return "error"
|
||||
end
|
||||
@@ -725,7 +723,7 @@ local function replaceValuesFuncs(intable, data, subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOption = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
if not(childOption) then
|
||||
return "error"
|
||||
end
|
||||
@@ -828,14 +826,14 @@ local function CreateGetAll(subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
if isToggle == nil then
|
||||
local childData = WeakAuras.GetData(childId)
|
||||
local childOptions = getChildOption(WeakAuras.EnsureOptions(childData, subOption), info)
|
||||
local childOptions = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
|
||||
isToggle = childOptions and childOptions.type == "toggle"
|
||||
end
|
||||
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -875,13 +873,13 @@ end
|
||||
|
||||
local function CreateSetAll(subOption, getAll)
|
||||
return function(data, info, ...)
|
||||
WeakAuras.pauseOptionsProcessing(true);
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
OptionsPrivate.Private.pauseOptionsProcessing(true);
|
||||
OptionsPrivate.Private.PauseAllDynamicGroups()
|
||||
local before = getAll(data, info, ...)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -904,11 +902,11 @@ local function CreateSetAll(subOption, getAll)
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.ResumeAllDynamicGroups()
|
||||
WeakAuras.pauseOptionsProcessing(false);
|
||||
WeakAuras.ScanForLoads();
|
||||
OptionsPrivate.Private.ResumeAllDynamicGroups()
|
||||
OptionsPrivate.Private.pauseOptionsProcessing(false);
|
||||
OptionsPrivate.Private.ScanForLoads();
|
||||
WeakAuras.SortDisplayButtons();
|
||||
WeakAuras.UpdateOptions()
|
||||
OptionsPrivate.UpdateOptions()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -918,7 +916,7 @@ local function CreateExecuteAll(subOption)
|
||||
for index, childId in ipairs(data.controlledChildren) do
|
||||
local childData = WeakAuras.GetData(childId);
|
||||
if(childData) then
|
||||
local childOptions = WeakAuras.EnsureOptions(childData, subOption)
|
||||
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
|
||||
local childOption = childOptions;
|
||||
local childOptionTable = {[0] = childOption};
|
||||
for i=1,#info do
|
||||
@@ -985,7 +983,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
data.xOffset = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
OptionsPrivate.ResetMoverSizer();
|
||||
if(data.parent) then
|
||||
local parentData = WeakAuras.GetData(data.parent);
|
||||
if(parentData) then
|
||||
@@ -1007,7 +1005,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
data.yOffset = v;
|
||||
WeakAuras.Add(data);
|
||||
WeakAuras.UpdateThumbnail(data);
|
||||
WeakAuras.ResetMoverSizer();
|
||||
OptionsPrivate.ResetMoverSizer();
|
||||
if(data.parent) then
|
||||
local parentData = WeakAuras.GetData(data.parent);
|
||||
if(parentData) then
|
||||
@@ -1022,7 +1020,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
name = L["Anchor"],
|
||||
order = 70,
|
||||
hidden = IsParentDynamicGroup,
|
||||
values = point_types,
|
||||
values = OptionsPrivate.Private.point_types,
|
||||
disabled = disableSelfPoint,
|
||||
},
|
||||
anchorFrameType = {
|
||||
@@ -1031,7 +1029,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
name = L["Anchored To"],
|
||||
order = 72,
|
||||
hidden = IsParentDynamicGroup,
|
||||
values = (data.regionType == "group" or data.regionType == "dynamicgroup") and WeakAuras.anchor_frame_types_group or WeakAuras.anchor_frame_types,
|
||||
values = (data.regionType == "group" or data.regionType == "dynamicgroup") and OptionsPrivate.Private.anchor_frame_types_group or OptionsPrivate.Private.anchor_frame_types,
|
||||
},
|
||||
-- Input field to select frame to anchor on
|
||||
anchorFrameFrame = {
|
||||
@@ -1059,7 +1057,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
return not (data.anchorFrameType == "SELECTFRAME")
|
||||
end,
|
||||
func = function()
|
||||
WeakAuras.StartFrameChooser(data, {"anchorFrameFrame"});
|
||||
OptionsPrivate.StartFrameChooser(data, {"anchorFrameFrame"});
|
||||
end
|
||||
},
|
||||
anchorPoint = {
|
||||
@@ -1085,7 +1083,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
return data.anchorFrameType == "MOUSE";
|
||||
end
|
||||
end,
|
||||
values = point_types
|
||||
values = OptionsPrivate.Private.point_types
|
||||
},
|
||||
anchorPointGroup = {
|
||||
type = "select",
|
||||
@@ -1123,7 +1121,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Frame Strata"],
|
||||
order = 78,
|
||||
values = WeakAuras.frame_strata_types
|
||||
values = OptionsPrivate.Private.frame_strata_types
|
||||
},
|
||||
anchorFrameSpace = {
|
||||
type = "execute",
|
||||
@@ -1136,7 +1134,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint)
|
||||
end
|
||||
},
|
||||
};
|
||||
WeakAuras.commonOptions.AddCodeOption(positionOptions, data, L["Custom Anchor"], "custom_anchor", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function",
|
||||
OptionsPrivate.commonOptions.AddCodeOption(positionOptions, data, L["Custom Anchor"], "custom_anchor", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-anchor-function",
|
||||
72.1, function() return not(data.anchorFrameType == "CUSTOM" and not IsParentDynamicGroup()) end, {"customAnchor"}, nil, nil, nil, nil, nil, true)
|
||||
return positionOptions;
|
||||
end
|
||||
@@ -1264,7 +1262,7 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p
|
||||
tinsert(extraFunctions, 1, {
|
||||
buttonLabel = L["Expand"],
|
||||
func = function(info)
|
||||
WeakAuras.OpenTextEditor(WeakAuras.GetPickedDisplay(), path, encloseInFunction, multipath, reloadOptions, setOnParent, url)
|
||||
OptionsPrivate.OpenTextEditor(OptionsPrivate.GetPickedDisplay(), path, encloseInFunction, multipath, reloadOptions, setOnParent, url)
|
||||
end
|
||||
});
|
||||
|
||||
@@ -1293,7 +1291,7 @@ local function AddCodeOption(args, data, name, prefix, url, order, hiddenFunc, p
|
||||
extraSetFunction();
|
||||
end
|
||||
if (reloadOptions) then
|
||||
WeakAuras.ClearOptions(data.id)
|
||||
OptionsPrivate.ClearOptions(data.id)
|
||||
end
|
||||
end,
|
||||
get = function(info)
|
||||
@@ -1355,7 +1353,7 @@ local function AddCommonTriggerOptions(options, data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
|
||||
local trigger_types = {};
|
||||
for type, triggerSystem in pairs(WeakAuras.triggerTypes) do
|
||||
for type, triggerSystem in pairs(OptionsPrivate.Private.triggerTypes) do
|
||||
trigger_types[type] = triggerSystem.GetName(type);
|
||||
end
|
||||
|
||||
@@ -1379,7 +1377,7 @@ local function AddCommonTriggerOptions(options, data, triggernum)
|
||||
end,
|
||||
set = function(info, v)
|
||||
trigger.type = v;
|
||||
local prototype = trigger.event and WeakAuras.event_prototypes[trigger.event];
|
||||
local prototype = trigger.event and OptionsPrivate.Private.event_prototypes[trigger.event];
|
||||
if v == "status" and (not prototype or prototype.type == "event") then
|
||||
trigger.event = "Cooldown Progress (Spell)"
|
||||
elseif v == "event" and (not prototype or prototype.type == "status") then
|
||||
@@ -1447,23 +1445,23 @@ local function AddTriggerGetterSetter(options, data, triggernum)
|
||||
end
|
||||
|
||||
|
||||
WeakAuras.commonOptions = {}
|
||||
WeakAuras.commonOptions.parsePrefix = parsePrefix
|
||||
WeakAuras.commonOptions.flattenRegionOptions = flattenRegionOptions
|
||||
WeakAuras.commonOptions.fixMetaOrders = fixMetaOrders
|
||||
WeakAuras.commonOptions.removeFuncs = removeFuncs
|
||||
WeakAuras.commonOptions.CreateHiddenAll = CreateHiddenAll
|
||||
WeakAuras.commonOptions.CreateDisabledAll = CreateDisabledAll
|
||||
WeakAuras.commonOptions.replaceNameDescFuncs = replaceNameDescFuncs
|
||||
WeakAuras.commonOptions.replaceImageFuncs = replaceImageFuncs
|
||||
WeakAuras.commonOptions.replaceValuesFuncs = replaceValuesFuncs
|
||||
WeakAuras.commonOptions.CreateGetAll = CreateGetAll
|
||||
WeakAuras.commonOptions.CreateSetAll = CreateSetAll
|
||||
WeakAuras.commonOptions.CreateExecuteAll = CreateExecuteAll
|
||||
OptionsPrivate.commonOptions = {}
|
||||
OptionsPrivate.commonOptions.parsePrefix = parsePrefix
|
||||
OptionsPrivate.commonOptions.flattenRegionOptions = flattenRegionOptions
|
||||
OptionsPrivate.commonOptions.fixMetaOrders = fixMetaOrders
|
||||
OptionsPrivate.commonOptions.removeFuncs = removeFuncs
|
||||
OptionsPrivate.commonOptions.CreateHiddenAll = CreateHiddenAll
|
||||
OptionsPrivate.commonOptions.CreateDisabledAll = CreateDisabledAll
|
||||
OptionsPrivate.commonOptions.replaceNameDescFuncs = replaceNameDescFuncs
|
||||
OptionsPrivate.commonOptions.replaceImageFuncs = replaceImageFuncs
|
||||
OptionsPrivate.commonOptions.replaceValuesFuncs = replaceValuesFuncs
|
||||
OptionsPrivate.commonOptions.CreateGetAll = CreateGetAll
|
||||
OptionsPrivate.commonOptions.CreateSetAll = CreateSetAll
|
||||
OptionsPrivate.commonOptions.CreateExecuteAll = CreateExecuteAll
|
||||
|
||||
WeakAuras.commonOptions.PositionOptions = PositionOptions
|
||||
WeakAuras.commonOptions.BorderOptions = BorderOptions
|
||||
WeakAuras.commonOptions.AddCodeOption = AddCodeOption
|
||||
OptionsPrivate.commonOptions.PositionOptions = PositionOptions
|
||||
OptionsPrivate.commonOptions.BorderOptions = BorderOptions
|
||||
OptionsPrivate.commonOptions.AddCodeOption = AddCodeOption
|
||||
|
||||
WeakAuras.commonOptions.AddCommonTriggerOptions = AddCommonTriggerOptions
|
||||
WeakAuras.commonOptions.AddTriggerGetterSetter = AddTriggerGetterSetter
|
||||
OptionsPrivate.commonOptions.AddCommonTriggerOptions = AddCommonTriggerOptions
|
||||
OptionsPrivate.commonOptions.AddTriggerGetterSetter = AddTriggerGetterSetter
|
||||
|
||||
Reference in New Issue
Block a user