This commit is contained in:
Bunny67
2020-09-22 17:50:02 +03:00
parent e455eaa4a9
commit ce5da4dc3e
17 changed files with 357 additions and 197 deletions
-1
View File
@@ -302,7 +302,6 @@ local FakeWeakAurasMixin = {
AddManyFromAddons = true, AddManyFromAddons = true,
Delete = true, Delete = true,
DeleteOption = true, DeleteOption = true,
GetData = true,
HideOptions = true, HideOptions = true,
Rename = true, Rename = true,
NewAura = true, NewAura = true,
+3 -2
View File
@@ -536,7 +536,7 @@ end
local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...) local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2, ...)
local optionsEvent = event == "OPTIONS"; local optionsEvent = event == "OPTIONS";
local errorHandler = optionsEvent and ignoreErrorHandler or geterrorhandler() local errorHandler = (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or geterrorhandler()
local updateTriggerState = false; local updateTriggerState = false;
if(data.triggerFunc) then if(data.triggerFunc) then
local untriggerCheck = false; local untriggerCheck = false;
@@ -1376,7 +1376,8 @@ function GenericTrigger.Add(data, region)
duration = duration, duration = duration,
automaticAutoHide = automaticAutoHide, automaticAutoHide = automaticAutoHide,
tsuConditionVariables = tsuConditionVariables, tsuConditionVariables = tsuConditionVariables,
prototype = prototype prototype = prototype,
ignoreOptionsEventErrors = data.ignoreOptionsEventErrors
}; };
end end
end end
+3
View File
@@ -924,6 +924,9 @@ function Private.Modernize(data)
end end
end end
if data.internalVersion < 36 then
data.ignoreOptionsEventErrors = true
end
data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()); data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion());
end end
+49 -45
View File
@@ -4178,7 +4178,7 @@ Private.event_prototypes = {
"TENCH_UPDATE", "TENCH_UPDATE",
}, },
force_events = "TENCH_UPDATE", force_events = "TENCH_UPDATE",
name = L["Weapon Enchant"], name = L["Weapon Enchant / Fishing Lure"],
init = function(trigger) init = function(trigger)
WeakAuras.TenchInit(); WeakAuras.TenchInit();
@@ -4188,12 +4188,12 @@ Private.event_prototypes = {
local triggerStack = %s local triggerStack = %s
local triggerRemaining = %s local triggerRemaining = %s
local triggerShowOn = %q local triggerShowOn = %q
local _, expirationTime, duration, name, stack local expirationTime, duration, name, icon, stack
if triggerWeaponType == "main" then if triggerWeaponType == "main" then
expirationTime, duration, name, shortenedName, _, stack = WeakAuras.GetMHTenchInfo() expirationTime, duration, name, shortenedName, icon, stack = WeakAuras.GetMHTenchInfo()
else else
expirationTime, duration, name, shortenedName, _, stack = WeakAuras.GetOHTenchInfo() expirationTime, duration, name, shortenedName, icon, stack = WeakAuras.GetOHTenchInfo()
end end
local remaining = expirationTime and expirationTime - GetTime() local remaining = expirationTime and expirationTime - GetTime()
@@ -4203,6 +4203,11 @@ Private.event_prototypes = {
local remainingCheck = not triggerRemaining or remaining and remaining %s triggerRemaining local remainingCheck = not triggerRemaining or remaining and remaining %s triggerRemaining
local found = expirationTime and nameCheck and stackCheck and remainingCheck local found = expirationTime and nameCheck and stackCheck and remainingCheck
if not found then
expirationTime = nil
duration = nil
end
if(triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0) then if(triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0) then
WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "TENCH_UPDATE"); WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "TENCH_UPDATE");
end end
@@ -4238,6 +4243,42 @@ Private.event_prototypes = {
display = L["Stack Count"], display = L["Stack Count"],
type = "number", type = "number",
test = "true", test = "true",
store = true
},
{
name = "duration",
hidden = true,
init = "duration",
test = "true",
store = true
},
{
name = "expirationTime",
init = "expirationTime",
hidden = true,
test = "true",
store = true
},
{
name = "progressType",
hidden = true,
init = "'timed'",
test = "true",
store = true
},
{
name = "name",
hidden = true,
init = "spell",
test = "true",
store = true
},
{
name = "icon",
hidden = true,
init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'",
test = "true",
store = true
}, },
{ {
name = "remaining", name = "remaining",
@@ -4261,47 +4302,10 @@ Private.event_prototypes = {
"or (triggerShowOn == 'showAlways')" "or (triggerShowOn == 'showAlways')"
} }
}, },
durationFunc = function(trigger) automaticrequired = true,
local expirationTime, duration; canHaveDuration = true,
if(trigger.weapon == "main") then canHaveAuto = true,
expirationTime, duration = WeakAuras.GetMHTenchInfo(); statesParameter = "one"
elseif(trigger.weapon == "off") then
expirationTime, duration = WeakAuras.GetOHTenchInfo();
end
if(expirationTime) then
return duration, expirationTime;
else
return 0, math.huge;
end
end,
nameFunc = function(trigger)
local _, name;
if(trigger.weapon == "main") then
_, _, name = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, name = WeakAuras.GetOHTenchInfo();
end
return name;
end,
iconFunc = function(trigger)
local _, icon;
if(trigger.weapon == "main") then
_, _, _, _, icon = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, _, _, icon = WeakAuras.GetOHTenchInfo();
end
return icon;
end,
stacksFunc = function(trigger)
local _, charges;
if(trigger.weapon == "main") then
_, _, _, _, _, charges = WeakAuras.GetMHTenchInfo();
elseif(trigger.weapon == "off") then
_, _, _, _, _, charges = WeakAuras.GetOHTenchInfo();
end
return charges;
end,
automaticrequired = true
}, },
["Chat Message"] = { ["Chat Message"] = {
type = "event", type = "event",
+1 -1
View File
@@ -6,7 +6,7 @@ local L = WeakAuras.L;
-- Default settings -- Default settings
local default = { local default = {
icon = true, icon = false,
desaturate = false, desaturate = false,
auto = true, auto = true,
texture = "Blizzard", texture = "Blizzard",
+1 -1
View File
@@ -651,7 +651,7 @@ local function RegisterForFrameTick(region)
regionsForFrameTick[region] = true regionsForFrameTick[region] = true
if not frameForFrameTick:GetScript("OnUpdate") then if not frameForFrameTick:GetScript("OnUpdate") then
frameForFrameTick:SetScript("OnUpdate", WeakAuras.FrameTick); frameForFrameTick:SetScript("OnUpdate", FrameTick);
end end
end end
+1 -1
View File
@@ -779,7 +779,7 @@ Private.text_check_types = {
} }
Private.check_types = { Private.check_types = {
update = L["Every Frame"], update = L["Every Frame (High CPU usage)"],
event = L["Event(s)"] event = L["Event(s)"]
} }
+27 -8
View File
@@ -1,6 +1,6 @@
local AddonName, Private = ... local AddonName, Private = ...
local internalVersion = 33; local internalVersion = 36
-- Lua APIs -- Lua APIs
local insert = table.insert local insert = table.insert
@@ -1657,6 +1657,21 @@ function Private.Convert(data, newType)
end end
end end
-- The default mixin doesn't recurse, this does
function WeakAuras.DeepMixin(dest, source)
local function recurse(source, dest)
for i,v in pairs(source) do
if(type(v) == "table") then
dest[i] = type(dest[i]) == "table" and dest[i] or {};
recurse(v, dest[i]);
else
dest[i] = v;
end
end
end
recurse(source, dest);
end
function WeakAuras.RegisterAddon(addon, displayName, description, icon) function WeakAuras.RegisterAddon(addon, displayName, description, icon)
if(addons[addon]) then if(addons[addon]) then
addons[addon].displayName = displayName; addons[addon].displayName = displayName;
@@ -2371,7 +2386,7 @@ local function pAdd(data, simpleChange)
if simpleChange then if simpleChange then
db.displays[id] = data db.displays[id] = data
Private.SetRegion(data) WeakAuras.SetRegion(data)
Private.UpdatedTriggerState(id) Private.UpdatedTriggerState(id)
else else
if (data.controlledChildren) then if (data.controlledChildren) then
@@ -2380,7 +2395,7 @@ local function pAdd(data, simpleChange)
Private.ClearAuraEnvironment(data.parent); Private.ClearAuraEnvironment(data.parent);
end end
db.displays[id] = data; db.displays[id] = data;
Private.SetRegion(data); WeakAuras.SetRegion(data);
else else
local visible local visible
if (WeakAuras.IsOptionsOpen()) then if (WeakAuras.IsOptionsOpen()) then
@@ -2446,7 +2461,7 @@ local function pAdd(data, simpleChange)
timers[id] = nil; timers[id] = nil;
end end
local region = Private.SetRegion(data); local region = WeakAuras.SetRegion(data);
triggerState[id] = { triggerState[id] = {
disjunctive = data.triggers.disjunctive or "all", disjunctive = data.triggers.disjunctive or "all",
@@ -2485,10 +2500,10 @@ function WeakAuras.Add(data, takeSnapshot, simpleChange)
end end
end end
function Private.SetRegion(data, cloneId) function WeakAuras.SetRegion(data, cloneId)
local regionType = data.regionType; local regionType = data.regionType;
if not(regionType) then if not(regionType) then
error("Improper arguments to Private.SetRegion - regionType not defined"); error("Improper arguments to WeakAuras.SetRegion - regionType not defined");
else else
if(not regionTypes[regionType]) then if(not regionTypes[regionType]) then
regionType = "fallback"; regionType = "fallback";
@@ -2497,7 +2512,7 @@ function Private.SetRegion(data, cloneId)
local id = data.id; local id = data.id;
if not(id) then if not(id) then
error("Improper arguments to Private.SetRegion - id not defined"); error("Improper arguments to WeakAuras.SetRegion - id not defined");
else else
local region; local region;
if(cloneId) then if(cloneId) then
@@ -2585,7 +2600,7 @@ local function EnsureClone(id, cloneId)
clones[id] = clones[id] or {}; clones[id] = clones[id] or {};
if not(clones[id][cloneId]) then if not(clones[id][cloneId]) then
local data = WeakAuras.GetData(id); local data = WeakAuras.GetData(id);
Private.SetRegion(data, cloneId); WeakAuras.SetRegion(data, cloneId);
clones[id][cloneId].justCreated = true; clones[id][cloneId].justCreated = true;
end end
return clones[id][cloneId]; return clones[id][cloneId];
@@ -4588,3 +4603,7 @@ function WeakAuras.ParseNameCheck(name)
return matches return matches
end end
function WeakAuras.IsAuraLoaded(id)
return Private.loaded[id]
end
+121 -107
View File
@@ -45,9 +45,28 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
local hasDown = input.__down local hasDown = input.__down
local hasDuplicate = input.__duplicate local hasDuplicate = input.__duplicate
local hasApplyTemplate = input.__applyTemplate local hasApplyTemplate = input.__applyTemplate
local defaultCollapsed = input.__collapsed
local hiddenFunc = input.__hidden local hiddenFunc = input.__hidden
local nooptions = input.__nooptions local notcollapsable = input.__notcollapsable
local marginTop = input.__topLine local marginTop = input.__topLine
local withoutheader = input.__withoutheader
local isCollapsed = input.__isCollapsed
local setCollapsed = input.__setCollapsed
if not isCollapsed then
isCollapsed = function()
return OptionsPrivate.IsCollapsed("collapse", "region", key, defaultCollapsed)
end
end
if not setCollapsed then
setCollapsed = function(info, button, secondCall)
if not notcollapsable and not secondCall then
local isCollapsed = OptionsPrivate.IsCollapsed("collapse", "region", key, defaultCollapsed)
OptionsPrivate.SetCollapsed("collapse", "region", key, not isCollapsed)
end
end
end
local titleWidth = WeakAuras.doubleWidth - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0) local titleWidth = WeakAuras.doubleWidth - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0)
- (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0) - (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0)
@@ -59,127 +78,122 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab)
width = "full", width = "full",
hidden = hiddenFunc, hidden = hiddenFunc,
} }
options[key .. "collapseButton"] = {
type = "execute",
name = title,
order = order + 0.1,
width = titleWidth,
func = function(info, button, secondCall)
if not nooptions and not secondCall then
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 = 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,
control = "WeakAurasExpand",
hidden = hiddenFunc
}
if hasAdd then if not withoutheader then
options[key .. "addButton"] = { options[key .. "collapseButton"] = {
type = "execute", type = "execute",
name = L["Add"], name = title,
order = order + 0.2, order = order + 0.1,
width = 0.15, width = titleWidth,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\add", func = setCollapsed,
imageWidth = 24, image = function()
imageHeight = 24, if notcollapsable then
control = "WeakAurasIcon", return "Interface\\AddOns\\WeakAuras\\Media\\Textures\\bullet1", 18, 18
else
return isCollapsed() and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse", 18, 18
end
end,
control = "WeakAurasExpand",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "addButton"], input.__add)
end
if hasUp then if hasAdd then
options[key .. "upButton"] = { options[key .. "addButton"] = {
type = "execute", type = "execute",
name = L["Move Up"], name = L["Add"],
order = order + 0.3, order = order + 0.2,
width = 0.15, width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\moveup", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\add",
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
control = "WeakAurasIcon", control = "WeakAurasIcon",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "upButton"], input.__up) setFuncs(options[key .. "addButton"], input.__add)
end end
if hasDown then if hasUp then
options[key .. "downButton"] = { options[key .. "upButton"] = {
type = "execute", type = "execute",
name = L["Move Down"], name = L["Move Up"],
order = order + 0.4, order = order + 0.3,
width = 0.15, width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\movedown", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\moveup",
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
control = "WeakAurasIcon", control = "WeakAurasIcon",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "downButton"], input.__down) setFuncs(options[key .. "upButton"], input.__up)
end end
if hasDuplicate then if hasDown then
options[key .. "duplicateButton"] = { options[key .. "downButton"] = {
type = "execute", type = "execute",
name = L["Duplicate"], name = L["Move Down"],
order = order + 0.5, order = order + 0.4,
width = 0.15, width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\duplicate", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\movedown",
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
control = "WeakAurasIcon", control = "WeakAurasIcon",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "duplicateButton"], input.__duplicate) setFuncs(options[key .. "downButton"], input.__down)
end end
if hasDelete then if hasDuplicate then
options[key .. "deleteButton"] = { options[key .. "duplicateButton"] = {
type = "execute", type = "execute",
name = L["Delete"], name = L["Duplicate"],
order = order + 0.6, order = order + 0.5,
width = 0.15, width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\duplicate",
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
control = "WeakAurasIcon", control = "WeakAurasIcon",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "deleteButton"], input.__delete) setFuncs(options[key .. "duplicateButton"], input.__duplicate)
end end
if hasApplyTemplate then if hasDelete then
options[key .. "applyTemplate"] = { options[key .. "deleteButton"] = {
type = "execute", type = "execute",
name = L["Apply Template"], name = L["Delete"],
order = order + 0.7, order = order + 0.6,
width = 0.15, width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\template", image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete",
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
control = "WeakAurasIcon", control = "WeakAurasIcon",
hidden = hiddenFunc hidden = hiddenFunc
} }
setFuncs(options[key .. "applyTemplate"], input.__applyTemplate) setFuncs(options[key .. "deleteButton"], input.__delete)
end
if hasApplyTemplate then
options[key .. "applyTemplate"] = {
type = "execute",
name = L["Apply Template"],
order = order + 0.7,
width = 0.15,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\template",
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
hidden = hiddenFunc
}
setFuncs(options[key .. "applyTemplate"], input.__applyTemplate)
end
end end
if hiddenFunc then if hiddenFunc then
return function() return function()
return hiddenFunc() or OptionsPrivate.IsCollapsed("collapse", "region", key, false) return hiddenFunc() or isCollapsed()
end end
else else
return function() return isCollapsed
return OptionsPrivate.IsCollapsed("collapse", "region", key, false)
end
end end
end end
+17 -2
View File
@@ -1766,17 +1766,18 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
return; return;
end end
local defaultCollapsed = #conditions > 2
local collapsed = false; local collapsed = false;
if data.controlledChildren then if data.controlledChildren then
for id, reference in pairs(conditions[i].check.references) do for id, reference in pairs(conditions[i].check.references) do
local index = reference.conditionIndex; local index = reference.conditionIndex;
if OptionsPrivate.IsCollapsed(id, "condition", index, false) then if OptionsPrivate.IsCollapsed(id, "condition", index, defaultCollapsed) then
collapsed = true; collapsed = true;
break; break;
end end
end end
else else
collapsed = OptionsPrivate.IsCollapsed(data.id, "condition", i, false); collapsed = OptionsPrivate.IsCollapsed(data.id, "condition", i, defaultCollapsed);
end end
args["condition" .. i .. "header"] = { args["condition" .. i .. "header"] = {
@@ -1830,6 +1831,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tinsert(auraData[conditionVariable], reference.conditionIndex - 1, tmp); tinsert(auraData[conditionVariable], reference.conditionIndex - 1, tmp);
fixUpLinkedInFirstCondition(auraData[conditionVariable]) fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData); WeakAuras.Add(auraData);
OptionsPrivate.MoveCollapseDataUp(auraData.id, "condition", {reference.conditionIndex})
end end
end end
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1840,6 +1842,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tinsert(conditions, i - 1, tmp); tinsert(conditions, i - 1, tmp);
fixUpLinkedInFirstCondition(conditions) fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data); WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataUp(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
end end
end end
@@ -1881,6 +1884,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tinsert(auraData[conditionVariable], reference.conditionIndex + 1, tmp); tinsert(auraData[conditionVariable], reference.conditionIndex + 1, tmp);
fixUpLinkedInFirstCondition(auraData[conditionVariable]) fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData); WeakAuras.Add(auraData);
OptionsPrivate.MoveCollapseDataDown(auraData.id, "condition", {reference.conditionIndex})
end end
end end
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
@@ -1892,6 +1896,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tinsert(conditions, i + 1, tmp); tinsert(conditions, i + 1, tmp);
fixUpLinkedInFirstCondition(conditions) fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data); WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataDown(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
return; return;
end end
@@ -1916,6 +1921,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tremove(auraData[conditionVariable], reference.conditionIndex); tremove(auraData[conditionVariable], reference.conditionIndex);
fixUpLinkedInFirstCondition(auraData[conditionVariable]) fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData); WeakAuras.Add(auraData);
OptionsPrivate.RemoveCollapsed(auraData.id, "condition", {reference.conditionIndex})
end end
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
return; return;
@@ -1923,6 +1929,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tremove(conditions, i); tremove(conditions, i);
fixUpLinkedInFirstCondition(conditions) fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data); WeakAuras.Add(data);
OptionsPrivate.RemoveCollapsed(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true) WeakAuras.ClearAndUpdateOptions(data.id, true)
return; return;
end end
@@ -2535,6 +2542,14 @@ function OptionsPrivate.GetConditionOptions(data)
order = addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties); order = addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
end end
args["addConditionHeader"] = {
type = "header",
width = WeakAuras.doubleWidth,
name = "",
order = order
}
order = order + 1
args["addCondition"] = { args["addCondition"] = {
type = "execute", type = "execute",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
+8 -7
View File
@@ -46,16 +46,17 @@ local function AddOptionsForSupportedSubRegion(regionOption, data, supported)
result.__order = 300 result.__order = 300
result.__title = L["Add Extra Elements"] result.__title = L["Add Extra Elements"]
result.__topLine = true result.__topLine = true
result.__withoutheader = true
result["subregiontypespace"] = {
type = "description",
width = WeakAuras.doubleWidth,
name = "",
order = order,
}
order = order + 1
for subRegionType in pairs(supported) do for subRegionType in pairs(supported) do
if OptionsPrivate.Private.subRegionTypes[subRegionType].supportsAdd then if OptionsPrivate.Private.subRegionTypes[subRegionType].supportsAdd then
hasSubRegions = true hasSubRegions = true
result[subRegionType .. "space"] = {
type = "description",
width = WeakAuras.doubleWidth,
name = "",
order = order,
}
order = order + 1
result[subRegionType] = { result[subRegionType] = {
type = "execute", type = "execute",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
+56 -1
View File
@@ -144,7 +144,7 @@ function OptionsPrivate.GetInformationOptions(data)
end end
end end
-- Show warnings onyl for single selection for now -- Show warnings only for single selection for now
if not isGroup then if not isGroup then
local icon, title, message = OptionsPrivate.Private.AuraWarnings.FormatWarnings(data.uid) local icon, title, message = OptionsPrivate.Private.AuraWarnings.FormatWarnings(data.uid)
if title and message then if title and message then
@@ -167,5 +167,60 @@ function OptionsPrivate.GetInformationOptions(data)
end end
end end
-- Compability Options
args.compabilityTitle = {
type = "header",
name = L["Compability Options"],
width = WeakAuras.doubleWidth,
order = order,
}
order = order + 1
local sameIgnoreOptionsEvents = true
local commonIgnoreOptionsEvents
local ignoreOptionsEventDesc = ""
if data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
ignoreOptionsEventDesc = ignoreOptionsEventDesc .. "|cFFE0E000"..childData.id..": |r".. (childData.ignoreOptionsEventErrors and "true" or "false") .. "\n"
if commonIgnoreOptionsEvents == nil then
commonIgnoreOptionsEvents = childData.ignoreOptionsEventErrors ~= nil and childData.ignoreOptionsEventErrors or false
elseif childData.ignoreOptionsEventErrors ~= commonIgnoreOptionsEvents then
sameIgnoreOptionsEvents = false
end
end
end
args.ignoreOptionsEventErrors = {
type = "toggle",
name = sameIgnoreOptionsEvents and L["Ignore Lua Errors on OPTIONS event"] or "|cFF4080FF" .. L["Ignore Lua Errors on OPTIONS event"],
width = WeakAuras.doubleWidth,
get = function()
if data.controlledChildren then
return sameIgnoreOptionsEvents and commonIgnoreOptionsEvents or false
else
return data.ignoreOptionsEventErrors
end
end,
set = function(info, v)
if data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
childData.ignoreOptionsEventErrors = v
WeakAuras.Add(childData)
OptionsPrivate.ClearOptions(childData.id)
end
else
data.ignoreOptionsEventErrors = v
WeakAuras.Add(data)
OptionsPrivate.ClearOptions(data.id)
end
WeakAuras.ClearAndUpdateOptions(data.id)
end,
desc = sameIgnoreOptionsEvents and "" or ignoreOptionsEventDesc,
order = order
}
order = order + 1
return options return options
end end
@@ -289,9 +289,6 @@ function OptionsPrivate.CreateFrame()
self.bottomLeftResizer:Hide() self.bottomLeftResizer:Hide()
self.bottomRightResizer:Hide() self.bottomRightResizer:Hide()
else else
if self.tipFrameIsVisible then
self.tipFrame.frame:Show()
end
self.bottomLeftResizer:Show() self.bottomLeftResizer:Show()
self.bottomRightResizer:Show() self.bottomRightResizer:Show()
if self.window == "default" then if self.window == "default" then
@@ -979,6 +976,9 @@ function OptionsPrivate.CreateFrame()
tremove(tempGroup.controlledChildren, index) tremove(tempGroup.controlledChildren, index)
displayButtons[id]:ClearPick() displayButtons[id]:ClearPick()
-- Clear trigger expand state
OptionsPrivate.ClearTriggerExpandState()
self:ClearOptions(tempGroup.id) self:ClearOptions(tempGroup.id)
self:FillOptions() self:FillOptions()
end end
@@ -1002,6 +1002,9 @@ function OptionsPrivate.CreateFrame()
self.moversizer:Hide() self.moversizer:Hide()
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups()
-- Clear trigger expand state
OptionsPrivate.ClearTriggerExpandState()
end end
local function GetTarget(pickedDisplay) local function GetTarget(pickedDisplay)
+1 -1
View File
@@ -743,7 +743,7 @@ local function subCreateOptions(parentData, data, index, subIndex)
WeakAuras.ClearAndUpdateOptions(parentData.id, parentData) WeakAuras.ClearAndUpdateOptions(parentData.id, parentData)
end end
end, end,
__nooptions = true __notcollapsable = true
} }
return options return options
end end
+1 -1
View File
@@ -21,7 +21,7 @@ local function createOptions(parentData, data, index, subIndex)
end end
end, end,
__duplicate = function() __duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id) WeakAuras.ClearAndUpdateOptions(parentData.id)
end end
end, end,
+52 -12
View File
@@ -97,6 +97,9 @@ local function GetGlobalOptions(data)
} }
end end
local collapsedId = {}
local maxTriggerNumForExpand = 0
local function AddOptions(allOptions, data) local function AddOptions(allOptions, data)
allOptions = union(allOptions, GetGlobalOptions(data)) allOptions = union(allOptions, GetGlobalOptions(data))
@@ -115,6 +118,35 @@ local function AddOptions(allOptions, data)
end end
end end
triggerOptions["addTriggerOption"] = {
__title = L["Add Trigger"],
__order = 5000,
__withoutheader = true,
__topLine = true,
__collapsed = false,
addTrigger = {
type = "execute",
width = WeakAuras.normalWidth,
name = L["Add Trigger"],
order = 1,
func = function()
tinsert(data.triggers,
{
trigger =
{
type = "aura2"
},
untrigger = {
}
})
WeakAuras.Add(data)
OptionsPrivate.SetCollapsed(collapsedId, "trigger", #data.triggers, false)
maxTriggerNumForExpand = max(maxTriggerNumForExpand, #data.triggers)
WeakAuras.ClearAndUpdateOptions(data.id)
end
}
}
return union(allOptions, triggerOptions) return union(allOptions, triggerOptions)
end end
@@ -222,21 +254,26 @@ local function moveTriggerDownImpl(data, i)
return true; return true;
end end
function OptionsPrivate.ClearTriggerExpandState()
for i = 1, maxTriggerNumForExpand do
OptionsPrivate.SetCollapsed(collapsedId, "trigger", i, nil)
end
maxTriggerNumForExpand = 0
end
function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum) function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
options.__title = L["Trigger %s"]:format(triggernum) options.__title = L["Trigger %s"]:format(triggernum)
options.__order = triggernum * 10 options.__order = triggernum * 10
options.__add = function() options.__collapsed = #data.triggers > 1
tinsert(data.triggers, options.__isCollapsed = function()
{ return OptionsPrivate.IsCollapsed(collapsedId, "trigger", triggernum, #data.triggers > 1)
trigger = end
{ options.__setCollapsed = function(info, button, secondCall)
type = "aura2" if not secondCall then
}, local isCollapsed = OptionsPrivate.IsCollapsed(collapsedId, "trigger", triggernum, #data.triggers > 1)
untrigger = { OptionsPrivate.SetCollapsed(collapsedId, "trigger", triggernum, not isCollapsed)
} maxTriggerNumForExpand = max(maxTriggerNumForExpand, triggernum)
}) end
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
end end
options.__up = options.__up =
{ {
@@ -246,6 +283,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
func = function() func = function()
if (moveTriggerDownImpl(data, triggernum - 1)) then if (moveTriggerDownImpl(data, triggernum - 1)) then
WeakAuras.Add(data); WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataUp(collapsedId, "trigger", {triggernum})
WeakAuras.ClearAndUpdateOptions(data.id); WeakAuras.ClearAndUpdateOptions(data.id);
end end
end end
@@ -258,6 +296,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
func = function() func = function()
if (moveTriggerDownImpl(data, triggernum)) then if (moveTriggerDownImpl(data, triggernum)) then
WeakAuras.Add(data); WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataDown(collapsedId, "trigger", {triggernum})
WeakAuras.ClearAndUpdateOptions(data.id); WeakAuras.ClearAndUpdateOptions(data.id);
end end
end end
@@ -282,6 +321,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
tremove(data.triggers, triggernum) tremove(data.triggers, triggernum)
DeleteConditionsForTrigger(data, triggernum) DeleteConditionsForTrigger(data, triggernum)
WeakAuras.Add(data) WeakAuras.Add(data)
OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum})
WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.FillOptions() WeakAuras.FillOptions()
end, end,
+10 -4
View File
@@ -229,6 +229,9 @@ function OptionsPrivate.MultipleDisplayTooltipMenu()
id = WeakAuras.FindUnusedId(tempGroup.controlledChildren[1].." Group"), id = WeakAuras.FindUnusedId(tempGroup.controlledChildren[1].." Group"),
regionType = "group", regionType = "group",
}; };
WeakAuras.DeepMixin(data, WeakAuras.data_stub)
data.internalVersion = WeakAuras.InternalVersion()
WeakAuras.Add(data); WeakAuras.Add(data);
WeakAuras.NewDisplayButton(data); WeakAuras.NewDisplayButton(data);
@@ -263,6 +266,8 @@ function OptionsPrivate.MultipleDisplayTooltipMenu()
regionType = "dynamicgroup", regionType = "dynamicgroup",
}; };
WeakAuras.DeepMixin(data, WeakAuras.data_stub)
data.internalVersion = WeakAuras.InternalVersion()
WeakAuras.Add(data); WeakAuras.Add(data);
WeakAuras.NewDisplayButton(data); WeakAuras.NewDisplayButton(data);
@@ -724,8 +729,9 @@ function WeakAuras.ShowOptions(msg)
frame.codereview:Close(); frame.codereview:Close();
end end
-- TODO check if it should be shown if firstLoad then
frame:ShowTip() frame:ShowTip()
end
end end
function OptionsPrivate.UpdateOptions() function OptionsPrivate.UpdateOptions()
@@ -1308,9 +1314,9 @@ function WeakAuras.NewAura(sourceData, regionType, targetId)
end end
local new_id = WeakAuras.FindUnusedId("New") local new_id = WeakAuras.FindUnusedId("New")
local data = {id = new_id, regionType = regionType, uid = WeakAuras.GenerateUniqueID()} local data = {id = new_id, regionType = regionType, uid = WeakAuras.GenerateUniqueID()}
WeakAuras.Mixin(data, WeakAuras.data_stub); WeakAuras.DeepMixin(data, WeakAuras.data_stub);
if (sourceData) then if (sourceData) then
WeakAuras.Mixin(data, sourceData) WeakAuras.DeepMixin(data, sourceData);
end end
data.internalVersion = WeakAuras.InternalVersion(); data.internalVersion = WeakAuras.InternalVersion();
WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default); WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default);