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