This commit is contained in:
Bunny67
2020-08-06 17:41:52 +03:00
parent 5a7277a5a3
commit 969ef6edf8
16 changed files with 221 additions and 129 deletions
@@ -5,7 +5,7 @@ This file was forked from AceGUIContainer-TreeGroup.lua version 41
-------------------------------------------------------------------------------]]
if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasTreeGroup", 1
local Type, Version = "WeakAurasTreeGroup", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -636,7 +636,7 @@ local PaneBackdrop = {
local DraggerBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = nil,
tile = true, tileSize = 16, edgeSize = 0,
tile = true, tileSize = 16,
insets = { left = 3, right = 3, top = 7, bottom = 7 }
}
@@ -649,9 +649,7 @@ local function Constructor()
treeframe:SetPoint("BOTTOMLEFT")
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
treeframe:EnableMouseWheel(true)
treeframe:SetBackdrop(PaneBackdrop)
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
treeframe:SetResizable(true)
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400, 1600)
@@ -659,6 +657,12 @@ local function Constructor()
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
local treeframeBG = CreateFrame("Frame", nil, treeframe, BackdropTemplateMixin and "BackdropTemplate")
treeframeBG:SetBackdrop(PaneBackdrop)
treeframeBG:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
treeframeBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
treeframeBG:SetAllPoints(treeframe)
local dragger = CreateFrame("Button", nil, treeframe)
dragger:SetWidth(8)
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
@@ -32,7 +32,7 @@ local ignoreForCopyingDisplay = {
semver = true,
version = true,
internalVersion = true,
tocbuild = true
tocversion = true
}
local function copyAuraPart(source, destination, part)
@@ -422,26 +422,26 @@ local function GetAction(target, area, source)
Actions["Group"](_source)
end,
Icons["Ungroup"]
else -- area == "BOTTOM"
if source.data.parent == target.data.id then
return Actions["Move"], Icons["Move"]
else
return function(_source, _target)
Actions["Ungroup"](_source)
Actions["Group"](_source, _target.data.id)
end,
Icons["Group"]
end
end
else -- area == "BOTTOM"
if source.data.parent == target.data.id then
return Actions["Move"], Icons["Move"]
else
return function(_source, _target)
Actions["Ungroup"](_source)
Actions["Group"](_source, _target.data.id)
end,
Icons["Group"]
end
end
else -- not target.data.parent and not source.data.parent
if target:IsGroup() and area == "BOTTOM" then
return function(_source, _target)
Actions["Group"](_source, _target.data.id)
end,
Icons["Group"]
else
return nil
end
else
return nil
end
end
end
end
@@ -692,8 +692,8 @@ local methods = {
WeakAuras.SortDisplayButtons();
local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32};
local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32};
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]), "main", updata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]), "main", downdata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index-1]).uid, "main", updata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", downdata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.UpdateDisplayButton(parentData);
WeakAuras.FillOptions()
end
@@ -731,8 +731,8 @@ local methods = {
WeakAuras.SortDisplayButtons()
local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32};
local downdata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = 32};
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]), "main", downdata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]), "main", updata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index+1]).uid, "main", downdata, self.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.Animate("button", WeakAuras.GetData(parentData.controlledChildren[index]).uid, "main", updata, otherbutton.frame, true, function() WeakAuras.SortDisplayButtons() end);
WeakAuras.UpdateDisplayButton(parentData);
WeakAuras.FillOptions()
end
@@ -805,7 +805,6 @@ local methods = {
if (WeakAuras.IsImporting()) then return end;
local oldid = data.id;
if not(newid == oldid) then
WeakAuras.Rename(data, newid);
WeakAuras.HandleRename(data, oldid, newid)
end
+7 -9
View File
@@ -84,11 +84,11 @@ function WeakAuras.GetAnimationOptions(data)
data.animation = data.animation or {};
data.animation[field] = data.animation[field] or {};
data.animation[field][value] = v;
if(field == "main" and not WeakAuras.IsAnimating("display", id)) then
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(field == "main") then
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
WeakAuras.Animate("display", data, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
WeakAuras.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
end
end
end
@@ -843,12 +843,10 @@ function WeakAuras.GetAnimationOptions(data)
}
local function extraSetFunction()
if(not WeakAuras.IsAnimating("display", id)) then
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
WeakAuras.Animate("display", data, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
end
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true);
if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
WeakAuras.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
end
end
end
+78 -9
View File
@@ -100,6 +100,8 @@ local function valueToString(a, propertytype)
elseif (propertytype == "chat" or propertytype == "sound" or propertytype == "customcode"
or propertytype == "glowexternal" or propertytype == "customcheck") then
return tostring(a);
elseif (propertytype == "alwaystrue") then
return ""
elseif (propertytype == "bool") then
return (a == 1 or a == true) and L["True"] or L["False"];
end
@@ -689,9 +691,6 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message", L["Message"], L["Message"]),
desc = descMessage,
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
end,
get = message_getter,
set = setValueComplex("message", true)
}
@@ -1274,10 +1273,15 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
end
else
local isLinked = conditions[i].linked and i > 1
if (needsTriggerName) then
optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger);
if isLinked then
optionsName = optionsName .. string.format(L["Else If Trigger %s"], check.trigger);
else
optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger);
end
else
optionsName = optionsName .. L["If"];
optionsName = optionsName .. (isLinked and L["Else If"] or L["If"])
end
end
@@ -1648,9 +1652,11 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
set = setValue
}
order = order + 1;
elseif currentConditionTemplate.type == "alwaystrue" then
order = addSpace(args, order)
elseif currentConditionTemplate.type == "customcheck" then
args["condition" .. i .. tostring(path) .. "_op"] = {
name = blueIfNoValue(data, conditions[i].check, "op", L["Events"], L["Events"]),
name = blueIfNoValue(data, conditions[i].check, "op", L["Additional Events"], L["Additional Events"]),
desc = descIfNoValue(data, conditions[i].check, "op", currentConditionTemplate.type) or "",
type = "input",
width = WeakAuras.doubleWidth,
@@ -1751,6 +1757,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
return order;
end
local function fixUpLinkedInFirstCondition(conditions)
if conditions[1] and conditions[1].linked then
conditions[1].linked = false
end
end
local function addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
if (not conditions[i].check) then
return;
@@ -1774,7 +1786,6 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
name = L["Condition %i"]:format(i),
order = order,
width = WeakAuras.doubleWidth - 0.45,
--fontSize = "large",
func = function()
if data.controlledChildren then
for id, reference in pairs(conditions[i].check.references) do
@@ -1819,6 +1830,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
local tmp = auraData[conditionVariable][reference.conditionIndex];
tremove(auraData[conditionVariable], reference.conditionIndex);
tinsert(auraData[conditionVariable], reference.conditionIndex - 1, tmp);
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
end
end
@@ -1828,6 +1840,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
local tmp = conditions[i];
tremove(conditions, i);
tinsert(conditions, i - 1, tmp);
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
@@ -1868,6 +1881,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
local tmp = auraData[conditionVariable][reference.conditionIndex];
tremove(auraData[conditionVariable], reference.conditionIndex);
tinsert(auraData[conditionVariable], reference.conditionIndex + 1, tmp);
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
end
end
@@ -1878,6 +1892,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
local tmp = conditions[i];
tremove(conditions, i);
tinsert(conditions, i + 1, tmp);
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
return;
@@ -1901,12 +1916,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
for id, reference in pairs(conditions[i].check.references) do
local auraData = WeakAuras.GetData(id);
tremove(auraData[conditionVariable], reference.conditionIndex);
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
return;
else
tremove(conditions, i);
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
return;
@@ -1963,7 +1980,56 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
end
}
order = order + 1;
order = addSpace(args, order);
local showElseIf = false
local isLinked = false
if (data.controlledChildren) then
for id, reference in pairs(conditions[i].check.references) do
if reference.conditionIndex > 1 then
local auradata = WeakAuras.GetData(id);
isLinked = auradata[conditionVariable][reference.conditionIndex].linked
showElseIf = true
break;
end
end
else
if i > 1 then
showElseIf = true
isLinked = conditions[i].linked
end
end
if showElseIf then
args["condition" .. i .. "_else"] = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Else If"],
order = order,
get = function()
return isLinked
end,
set = function()
if (data.controlledChildren) then
for id, reference in pairs(conditions[i].check.references) do
local auradata = WeakAuras.GetData(id);
if reference.conditionIndex > 1 then
auradata[conditionVariable][reference.conditionIndex].linked = not isLinked
WeakAuras.Add(auradata);
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
else
conditions[i].linked = not isLinked
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
end
}
order = order + 1;
else
order = addSpace(args, order)
end
return order;
end
@@ -2213,6 +2279,8 @@ local function compareSubChecks(a, b, allConditionTemplates)
if (a[i].value ~= b[i].value) then
return false;
end
elseif (type == "alwaystrue") then
return true
end
end
end
@@ -2226,7 +2294,8 @@ local function findMatchingCondition(all, needle, start, allConditionTemplates)
return nil;
end
if (condition.check.trigger == needle.check.trigger and condition.check.variable == needle.check.variable) then
if (condition.check.trigger == needle.check.trigger and condition.check.variable == needle.check.variable
and condition.linked == needle.linked) then
if condition.check.variable == "customcheck" then
-- Be a bit more strict for custom checks, there's little benefit in merging them
if condition.check.op == needle.check.op and condition.check.value == needle.check.value then
@@ -68,6 +68,7 @@ function WeakAuras.StartFrameChooser(data, path)
if(focus ~= oldFocus) then
if(focusName) then
frameChooserBox:ClearAllPoints();
frameChooserBox:SetPoint("bottomleft", focus, "bottomleft", -4, -4);
frameChooserBox:SetPoint("topright", focus, "topright", 4, 4);
frameChooserBox:Show();
@@ -616,7 +616,7 @@ local function ConstructMoverSizer(parent)
end
end
WeakAuras.FillOptions()
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
-- hide alignment lines
frame.lineY:Hide()
frame.lineX:Hide()
@@ -736,7 +736,7 @@ local function ConstructMoverSizer(parent)
frame.text:Hide()
frame:SetScript("OnUpdate", nil)
WeakAuras.FillOptions()
WeakAuras.Animate("display", data, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
-- hide alignment lines
frame.lineY:Hide()
frame.lineX:Hide()
+19 -4
View File
@@ -275,10 +275,25 @@ function WeakAuras.AddTriggerMetaFunctions(options, data, triggernum)
end,
func = function()
if #data.triggers > 1 then
tremove(data.triggers, triggernum)
DeleteConditionsForTrigger(data, triggernum);
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
StaticPopupDialogs["WEAKAURAS_CONFIRM_TRIGGER_DELETE"] = {
text = L["You are about to delete a trigger. |cFFFF0000This cannot be undone!|r Would you like to continue?"],
button1 = L["Delete"],
button2 = L["Cancel"],
OnAccept = function()
tremove(data.triggers, triggernum)
DeleteConditionsForTrigger(data, triggernum)
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
WeakAuras.FillOptions()
end,
OnCancel = function()
-- no-op
end,
showAlert = 1,
whileDead = 1,
preferredindex = STATICPOPUP_NUMDIALOGS,
}
StaticPopup_Show("WEAKAURAS_CONFIRM_TRIGGER_DELETE")
end
end
}
+1 -1
View File
@@ -1218,7 +1218,7 @@ function WeakAuras.DropIndicator()
indicator:SetHeight(4)
indicator:SetFrameStrata("FULLSCREEN")
local texture = indicator:CreateTexture(nil, "HIGHLIGHT")
local texture = indicator:CreateTexture(nil, "ARTWORK")
texture:SetBlendMode("ADD")
texture:SetAllPoints(indicator)
texture:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")