from retail

This commit is contained in:
Bunny67
2022-05-19 22:04:17 +03:00
parent 9465daedd8
commit e7e789686a
86 changed files with 9118 additions and 5486 deletions
@@ -32,7 +32,7 @@ local methods = {
["LayoutFinished"] = function(self, width, height)
if self.noAutoHeight then return end
self:SetHeight((height or 0) + 40)
self:SetHeight(height or 0)
end,
["OnWidthSet"] = function(self, width)
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@ Button Widget for our Expand button
-------------------------------------------------------------------------------]]
if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasExpand", 2
local Type, Version = "WeakAurasExpand", 3
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -92,7 +92,11 @@ local methods = {
self.label:SetTextColor(1, 1, 1)
self.image:SetVertexColor(1, 1, 1, 1)
end
end
end,
["SetFontObject"] = function(self, fontObject)
self.label:SetFontObject(fontObject)
end
}
--[[-----------------------------------------------------------------------------
@@ -96,8 +96,33 @@ local methods = {
["SetViewClick"] = function(self, func)
self.view:SetScript("OnClick", func);
end,
["SetViewTest"] = function(self, func)
self.view.func = func;
["PriorityShow"] = function(self, priority)
if (not WeakAuras.IsOptionsOpen()) then
return;
end
if(priority >= self.view.visibility and self.view.visibility ~= priority) then
self.view.visibility = priority;
self:UpdateViewTexture()
end
end,
["PriorityHide"] = function(self, priority)
if (not WeakAuras.IsOptionsOpen()) then
return;
end
if(priority >= self.view.visibility and self.view.visibility ~= 0) then
self.view.visibility = 0;
self:UpdateViewTexture()
end
end,
["UpdateViewTexture"] = function(self)
local visibility = self.view.visibility
if(visibility == 2) then
self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp");
elseif(visibility == 1) then
self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp");
else
self.view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp");
end
end,
["SetViewDescription"] = function(self, desc)
self.view.desc = desc;
@@ -163,16 +188,6 @@ local function Constructor()
view:SetScript("OnEnter", function() Show_Tooltip(button, L["View"], view.desc) end);
view:SetScript("OnLeave", Hide_Tooltip);
view.visibility = 0;
view.func = function() return view.visibility end;
view:SetScript("OnUpdate", function()
if(view.func() == 2) then
view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking0.blp");
elseif(view.func() == 1) then
view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking2.blp");
else
view.texture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp");
end
end);
local widget = {
frame = button,
@@ -0,0 +1,253 @@
if not WeakAuras.IsCorrectVersion() then
return
end
local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local pairs, next, type, unpack = pairs, next, type, unpack
local Type, Version = "WeakAurasPendingInstallButton", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then
return
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(1000)
self:SetHeight(32)
self.hasThumbnail = false
end,
["Initialize"] = function(self, id, companionData)
self.callbacks = {}
self.id = id
self.companionData = companionData
function self.callbacks.OnUpdateClick()
WeakAuras.Import(self.companionData.encoded)
end
self:SetTitle(self.companionData.name)
self.update:SetScript("OnClick", self.callbacks.OnUpdateClick)
local data = OptionsPrivate.Private.StringToTable(self.companionData.encoded, true)
WeakAuras.PreAdd(data.d)
self.data = data.d
self.frame:EnableKeyboard(false)
self:Enable()
self.frame:Hide()
end,
["SetLogo"] = function(self, path)
self.frame.updateLogo.tex:SetTexture(path)
end,
["SetRefreshLogo"] = function(self, path)
self.frame.update:SetNormalTexture(path)
end,
["Disable"] = function(self)
self.background:Hide()
self.frame:Disable()
end,
["Enable"] = function(self)
self.background:Show()
self.frame:Enable()
self.update:Show()
self.update:Enable()
self.updateLogo:Show()
self:UpdateThumbnail()
end,
["OnRelease"] = function(self)
self:ReleaseThumbnail()
self:Enable()
self.title:Show()
self.frame:SetScript("OnEnter", nil)
self.frame:SetScript("OnLeave", nil)
self.frame:SetScript("OnClick", nil)
self.frame:ClearAllPoints()
self.frame:Hide()
self.frame = nil
self.data = nil
end,
["SetTitle"] = function(self, title)
self.titletext = title
self.title:SetText(title)
end,
["SetClick"] = function(self, func)
self.frame:SetScript("OnClick", func)
end,
["UpdateThumbnail"] = function(self)
if not self.hasThumbnail then
return
end
if self.data.regionType ~= self.thumbnailType then
self:ReleaseThumbnail()
self:AcquireThumbnail()
else
local option = WeakAuras.regionOptions[self.thumbnailType]
if option and option.modifyThumbnail then
option.modifyThumbnail(self.frame, self.thumbnail, self.data)
end
end
end,
["ReleaseThumbnail"] = function(self)
if not self.hasThumbnail then
return
end
self.hasThumbnail = false
if self.thumbnail then
local regionType = self.thumbnailType
local option = WeakAuras.regionOptions[regionType]
if self.thumbnail.icon then
self.thumbnail.icon:SetDesaturated(false)
end
option.releaseThumbnail(self.thumbnail)
self.thumbnail = nil
end
end,
["AcquireThumbnail"] = function(self)
if self.hasThumbnail then
return
end
if not self.data then
return
end
self.hasThumbnail = true
local button = self.frame
local regionType = self.data.regionType
self.thumbnailType = regionType
local option = WeakAuras.regionOptions[regionType]
if option and option.acquireThumbnail then
self.thumbnail = option.acquireThumbnail(button, self.data)
if self.thumbnail.icon then
self.thumbnail.icon:SetDesaturated(true)
end
self:SetIcon(self.thumbnail)
else
self:SetIcon("Interface\\Icons\\INV_Misc_QuestionMark")
end
end,
["SetIcon"] = function(self, icon)
self.orgIcon = icon
if (type(icon) == "string" or type(icon) == "number") then
self.icon:SetTexture(icon)
self.icon:Show()
if (self.iconRegion and self.iconRegion.Hide) then
self.iconRegion:Hide()
end
else
self.iconRegion = icon
icon:SetAllPoints(self.icon)
icon:SetParent(self.frame)
icon:Show()
self.iconRegion:Show()
self.icon:Hide()
end
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local name = "WeakAurasPendingInstallButton" .. AceGUI:GetNextWidgetNum(Type)
local button = CreateFrame("BUTTON", name, UIParent)
button:SetHeight(32)
button:SetWidth(1000)
button.data = {}
local background = button:CreateTexture(nil, "BACKGROUND")
button.background = background
background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp")
background:SetBlendMode("ADD")
background:SetVertexColor(0.5, 1, 0.5, 0.3)
background:SetPoint("TOP", button, "TOP")
background:SetPoint("BOTTOM", button, "BOTTOM")
background:SetPoint("LEFT", button, "LEFT")
background:SetPoint("RIGHT", button, "RIGHT")
local icon = button:CreateTexture(nil, "OVERLAY")
button.icon = icon
icon:SetWidth(32)
icon:SetHeight(32)
icon:SetPoint("LEFT", button, "LEFT")
local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
button.title = title
title:SetHeight(14)
title:SetJustifyH("LEFT")
title:SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0)
title:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
title:SetVertexColor(0.6, 0.6, 0.6)
button.description = {}
local update = CreateFrame("BUTTON", nil, button)
button.update = update
update.disabled = true
update.func = function()
end
update:SetNormalTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]])
update:Disable()
update:SetWidth(24)
update:SetHeight(24)
update:SetPoint("RIGHT", button, "RIGHT", -2, 0)
-- Add logo
local updateLogo = CreateFrame("Frame", nil, button)
button.updateLogo = updateLogo
local tex = updateLogo:CreateTexture()
tex:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]])
tex:SetAllPoints()
updateLogo.tex = tex
updateLogo:SetSize(24, 24)
updateLogo:SetPoint("CENTER", update)
updateLogo:SetFrameStrata(update:GetFrameStrata())
updateLogo:SetFrameLevel(update:GetFrameLevel()-1)
-- Animation On Hover
local animGroup = update:CreateAnimationGroup()
update.animGroup = animGroup
local animRotate = animGroup:CreateAnimation("rotation")
animRotate:SetDegrees(-360)
animRotate:SetDuration(1)
animRotate:SetSmoothing("OUT")
animGroup:SetScript("OnFinished", function()
if (MouseIsOver(update)) then
animGroup:Play()
end
end)
update:SetScript("OnEnter", function()
animGroup:Play()
end)
update:Hide()
updateLogo:Hide()
local widget = {
frame = button,
title = title,
icon = icon,
background = background,
update = update,
updateLogo = updateLogo,
type = Type,
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -0,0 +1,382 @@
if not WeakAuras.IsCorrectVersion() then
return
end
local AddonName, OptionsPrivate = ...
local L = WeakAuras.L
local pairs, next, type, unpack = pairs, next, type, unpack
local Type, Version = "WeakAurasPendingUpdateButton", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then
return
end
local function Hide_Tooltip()
GameTooltip:Hide()
end
local function Show_Long_Tooltip(owner, description)
GameTooltip:SetOwner(owner, "ANCHOR_NONE");
GameTooltip:SetPoint("LEFT", owner, "RIGHT");
GameTooltip:ClearLines();
local line = 1;
for i,v in pairs(description) do
if(type(v) == "string") then
if(line > 1) then
GameTooltip:AddLine(v, 1, 1, 1, 1);
else
GameTooltip:AddLine(v);
end
elseif(type(v) == "table") then
if(i == 1) then
GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or ""));
else
GameTooltip:AddDoubleLine(v[1], v[2]..(v[3] and (" |T"..v[3]..":12:12:0:0:64:64:4:60:4:60|t") or ""), 1, 1, 1, 1, 1, 1, 1, 1);
end
end
line = line + 1;
end
GameTooltip:Show();
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetWidth(1000)
self:SetHeight(32)
self.hasThumbnail = false
end,
["Initialize"] = function(self, id, companionData)
self.callbacks = {}
self.id = id
self.companionData = companionData
self.linkedAuras = {}
self.linkedChildren = {}
function self.callbacks.OnUpdateClick()
WeakAuras.Import(self.companionData.encoded)
end
self:SetTitle(self.companionData.name)
self.update:SetScript("OnClick", self.callbacks.OnUpdateClick)
local data = OptionsPrivate.Private.StringToTable(self.companionData.encoded, true)
WeakAuras.PreAdd(data.d)
self.data = data.d
self.frame:EnableKeyboard(false)
self:Enable()
self.frame:Hide()
self.menu = {}
self.frame:SetScript("OnMouseUp", function()
Hide_Tooltip()
self:SetMenu()
EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU")
end)
self.frame:SetScript("OnEnter", function()
self:SetNormalTooltip()
Show_Long_Tooltip(self.frame, self.frame.description)
end)
self.frame:SetScript("OnLeave", Hide_Tooltip)
end,
["SetMenu"] = function(self)
wipe(self.menu)
for auraId in pairs(self.linkedAuras) do
if not self.linkedChildren[auraId] then
tinsert(self.menu,
{
text = auraId,
notCheckable = true,
hasArrow = true,
menuList = {
{
text = L["Update"],
notCheckable = true,
func = function()
local auraData = WeakAuras.GetData(auraId)
if auraData then
WeakAuras.Import(self.companionData.encoded, auraData)
end
end
},
{
text = L["Ignore updates"],
notCheckable = true,
func = function()
StaticPopup_Show("WEAKAURAS_CONFIRM_IGNORE_UPDATES", "", "", auraId)
end
}
}
}
)
end
end
end,
["SetLogo"] = function(self, path)
self.frame.updateLogo.tex:SetTexture(path)
end,
["SetRefreshLogo"] = function(self, path)
self.frame.update:SetNormalTexture(path)
end,
["Disable"] = function(self)
self.background:Hide()
self.frame:Disable()
end,
["Enable"] = function(self)
self.background:Show()
self.frame:Enable()
self.update:Show()
self.update:Enable()
self.updateLogo:Show()
self:UpdateThumbnail()
end,
["OnRelease"] = function(self)
self:ReleaseThumbnail()
self:Enable()
self.title:Show()
self.frame:SetScript("OnEnter", nil)
self.frame:SetScript("OnLeave", nil)
self.frame:SetScript("OnClick", nil)
self.frame:ClearAllPoints()
self.frame:Hide()
self.frame = nil
self.data = nil
end,
["SetNormalTooltip"] = function(self)
local data = self.data;
local namestable = {};
local hasDescription = data.desc and data.desc ~= "";
local hasUrl = data.url and data.url ~= "";
local hasVersion = (data.semver and data.semver ~= "") or (data.version and data.version ~= "");
local hasVersionNote = self.companionData.versionNote and self.companionData.versionNote ~= ""
if(hasDescription or hasUrl or hasVersion or hasVersionNote) then
tinsert(namestable, " ")
end
if hasVersionNote then
tinsert(namestable, "|cFFFFD100"..self.companionData.versionNote)
tinsert(namestable, " ")
end
for auraId in pairs(self.linkedAuras) do
if not self.linkedChildren[auraId] then
tinsert(namestable, "|cFFFFD100" .. L["Linked aura: "] .. auraId .. "|r")
end
end
tinsert(namestable, " ")
if(hasDescription) then
tinsert(namestable, "|cFFFFD100"..data.desc)
end
if (hasUrl) then
tinsert(namestable, "|cFFFFD100" .. data.url .. "|r")
end
if (hasVersion) then
tinsert(namestable, "|cFFFFD100" .. L["Version: "] .. (data.semver or data.version) .. "|r")
end
self:SetDescription({self.companionData.name or self.data.id, self.companionData.author or ""}, unpack(namestable))
end,
["SetDescription"] = function(self, ...)
self.frame.description = {...};
end,
["SetTitle"] = function(self, title)
self.titletext = title
self.title:SetText(title)
end,
["SetClick"] = function(self, func)
self.frame:SetScript("OnClick", func)
end,
["ResetLinkedAuras"] = function(self)
wipe(self.linkedAuras)
wipe(self.linkedChildren)
end,
["MarkLinkedAura"] = function(self, auraId)
self.linkedAuras[auraId] = true
end,
["MarkLinkedChildren"] = function(self, auraId)
self.linkedChildren[auraId] = true
end,
["UpdateThumbnail"] = function(self)
if not self.hasThumbnail then
return
end
if self.data.regionType ~= self.thumbnailType then
self:ReleaseThumbnail()
self:AcquireThumbnail()
else
local option = WeakAuras.regionOptions[self.thumbnailType]
if option and option.modifyThumbnail then
option.modifyThumbnail(self.frame, self.thumbnail, self.data)
end
end
end,
["ReleaseThumbnail"] = function(self)
if not self.hasThumbnail then
return
end
self.hasThumbnail = false
if self.thumbnail then
local regionType = self.thumbnailType
local option = WeakAuras.regionOptions[regionType]
if self.thumbnail.icon then
self.thumbnail.icon:SetDesaturated(false)
end
option.releaseThumbnail(self.thumbnail)
self.thumbnail = nil
end
end,
["AcquireThumbnail"] = function(self)
if self.hasThumbnail then
return
end
if not self.data then
return
end
self.hasThumbnail = true
local button = self.frame
local regionType = self.data.regionType
self.thumbnailType = regionType
local option = WeakAuras.regionOptions[regionType]
if option and option.acquireThumbnail then
self.thumbnail = option.acquireThumbnail(button, self.data)
if self.thumbnail.icon then
self.thumbnail.icon:SetDesaturated(true)
end
self:SetIcon(self.thumbnail)
else
self:SetIcon("Interface\\Icons\\INV_Misc_QuestionMark")
end
end,
["SetIcon"] = function(self, icon)
self.orgIcon = icon
if (type(icon) == "string" or type(icon) == "number") then
self.icon:SetTexture(icon)
self.icon:Show()
if (self.iconRegion and self.iconRegion.Hide) then
self.iconRegion:Hide()
end
else
self.iconRegion = icon
icon:SetAllPoints(self.icon)
icon:SetParent(self.frame)
icon:Show()
self.iconRegion:Show()
self.icon:Hide()
end
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local name = "WeakAurasPendingUpdateButton" .. AceGUI:GetNextWidgetNum(Type)
local button = CreateFrame("BUTTON", name, UIParent)
button:SetHeight(32)
button:SetWidth(1000)
button.data = {}
local background = button:CreateTexture(nil, "BACKGROUND")
button.background = background
background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp")
background:SetBlendMode("ADD")
background:SetVertexColor(0.88, 0.88, 0, 0.3)
background:SetPoint("TOP", button, "TOP")
background:SetPoint("BOTTOM", button, "BOTTOM")
background:SetPoint("LEFT", button, "LEFT")
background:SetPoint("RIGHT", button, "RIGHT")
local icon = button:CreateTexture(nil, "OVERLAY")
button.icon = icon
icon:SetWidth(32)
icon:SetHeight(32)
icon:SetPoint("LEFT", button, "LEFT")
local title = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
button.title = title
title:SetHeight(14)
title:SetJustifyH("LEFT")
title:SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0)
title:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT")
title:SetVertexColor(0.6, 0.6, 0.6)
button.description = {}
local update = CreateFrame("BUTTON", nil, button)
button.update = update
update.disabled = true
update.func = function()
end
update:SetNormalTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]])
update:Disable()
update:SetWidth(24)
update:SetHeight(24)
update:SetPoint("RIGHT", button, "RIGHT", -2, 0)
-- Add logo
local updateLogo = CreateFrame("Frame", nil, button)
button.updateLogo = updateLogo
local tex = updateLogo:CreateTexture()
tex:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]])
tex:SetAllPoints()
updateLogo.tex = tex
updateLogo:SetSize(24, 24)
updateLogo:SetPoint("CENTER", update)
updateLogo:SetFrameStrata(update:GetFrameStrata())
updateLogo:SetFrameLevel(update:GetFrameLevel()-1)
-- Animation On Hover
local animGroup = update:CreateAnimationGroup()
update.animGroup = animGroup
local animRotate = animGroup:CreateAnimation("rotation")
animRotate:SetDegrees(-360)
animRotate:SetDuration(1)
animRotate:SetSmoothing("OUT")
animGroup:SetScript("OnFinished", function()
if (MouseIsOver(update)) then
animGroup:Play()
end
end)
update:SetScript("OnEnter", function()
animGroup:Play()
end)
update:Hide()
updateLogo:Hide()
local widget = {
frame = button,
title = title,
icon = icon,
background = background,
update = update,
updateLogo = updateLogo,
type = Type,
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -0,0 +1,31 @@
--[[-----------------------------------------------------------------------------
Spacer Widget
Just uses up a bit of horizontal space
-------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasSpacer", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local methods = {
["OnAcquire"] = function(self)
self:SetFullWidth(true)
self:SetHeight(4)
end,
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local widget = {
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -167,6 +167,19 @@ local methods = {
firstDropdown:SetCallback("OnValueChanged", OnFirstDropdownValueChanged)
secondDropDown:SetCallback("OnValueChanged", OnSecondDropdownValueChanged)
local function FireOnEnter(self, event)
widget:Fire("OnEnter")
end
local function FireOnLeave(self, event)
widget:Fire("OnLeave")
end
firstDropdown:SetCallback("OnEnter", FireOnEnter)
firstDropdown:SetCallback("OnLeave", FireOnLeave)
secondDropDown:SetCallback("OnEnter", FireOnEnter)
secondDropDown:SetCallback("OnLeave", FireOnLeave)
end,
["OnRelease"] = function(self)
end,
@@ -0,0 +1,58 @@
--[[-----------------------------------------------------------------------------
Progress Bar Widget
A simple progress bar
-------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasProgressBar", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local methods = {
["OnAcquire"] = function(self)
self:SetFullWidth(true)
self:SetHeight(10)
self.value = 0
self.total = 1
end,
["SetProgress"] = function(self, value, total)
self.value = value
self.total = total
local p = value / total
if p > 1 then
p = 1
end
self.foreground:SetPoint("RIGHT", self.background, "LEFT", p * self.frame:GetWidth(), 0)
end,
["OnWidthSet"] = function(self)
self:SetProgress(self.value, self.total)
end,
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
local foreground = frame:CreateTexture(nil, "BORDER")
local background = frame:CreateTexture(nil, "BACKGROUND")
foreground:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White")
background:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White")
background:SetVertexColor(0.5, 0.5, 0.5)
background:SetAllPoints()
foreground:SetPoint("TOPLEFT")
foreground:SetPoint("BOTTOMLEFT")
foreground:SetPoint("RIGHT", background, "LEFT", 0, 0)
frame:Hide()
local widget = {
frame = frame,
foreground = foreground,
background = background,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
+74 -16
View File
@@ -12,6 +12,17 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("action")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("action")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("action", getAll)
local RestrictedChannelCheck
if WeakAuras.IsClassic() then
RestrictedChannelCheck = function()
return false
end
else
RestrictedChannelCheck = function(data)
return data.message_type == "SAY" or data.message_type == "YELL" or data.message_type == "SMARTRAID"
end
end
function OptionsPrivate.GetActionOptions(data)
local action = {
type = "group",
@@ -94,6 +105,13 @@ function OptionsPrivate.GetActionOptions(data)
disabled = function() return not data.actions.start.do_message end,
control = "WeakAurasSortedDropdown"
},
start_message_warning = {
type = "description",
width = WeakAuras.doubleWidth,
name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."],
order = 2.5,
hidden = function() return not RestrictedChannelCheck(data.actions.start) end
},
start_message_space = {
type = "execute",
width = WeakAuras.normalWidth,
@@ -101,7 +119,7 @@ function OptionsPrivate.GetActionOptions(data)
order = 3,
image = function() return "", 0, 0 end,
hidden = function()
return not(data.actions.start.message_type == "WHISPER" or data.actions.start.message_type == "COMBAT"
return not(data.actions.start.message_type == "COMBAT"
or data.actions.start.message_type == "PRINT" or data.actions.start.message_type == "ERROR")
end
},
@@ -130,7 +148,19 @@ function OptionsPrivate.GetActionOptions(data)
name = L["Send To"],
order = 3.1,
disabled = function() return not data.actions.start.do_message end,
hidden = function() return data.actions.start.message_type ~= "WHISPER" end
hidden = function() return data.actions.start.message_type ~= "WHISPER" end,
desc = function()
return L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end,
},
start_message_dest_isunit = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Is Unit"],
order = 3.15,
hidden = function()
return data.actions.start.message_type ~= "WHISPER"
end
},
start_message = {
type = "input",
@@ -300,6 +330,7 @@ function OptionsPrivate.GetActionOptions(data)
},
start_glow_color = {
type = "color",
hasAlpha = true,
width = WeakAuras.normalWidth,
name = L["Glow Color"],
order = 10.8,
@@ -475,13 +506,23 @@ function OptionsPrivate.GetActionOptions(data)
disabled = function() return not data.actions.finish.do_message end,
control = "WeakAurasSortedDropdown"
},
finish_message_warning = {
type = "description",
width = WeakAuras.doubleWidth,
name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."],
order = 22.5,
hidden = function() return not RestrictedChannelCheck(data.actions.finish) end
},
finish_message_space = {
type = "execute",
width = WeakAuras.normalWidth,
name = "",
order = 23,
image = function() return "", 0, 0 end,
hidden = function() return data.actions.finish.message_type ~= "WHISPER" end
hidden = function()
return not(data.actions.finish.message_type == "COMBAT"
or data.actions.finish.message_type == "PRINT" or data.actions.finish.message_type == "ERROR")
end
},
finish_message_color = {
type = "color",
@@ -510,6 +551,15 @@ function OptionsPrivate.GetActionOptions(data)
disabled = function() return not data.actions.finish.do_message end,
hidden = function() return data.actions.finish.message_type ~= "WHISPER" end
},
finish_message_dest_isunit = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Is Unit"],
order = 23.15,
hidden = function()
return data.actions.finish.message_type ~= "WHISPER"
end
},
finish_message = {
type = "input",
width = WeakAuras.doubleWidth,
@@ -654,6 +704,7 @@ function OptionsPrivate.GetActionOptions(data)
},
finish_glow_color = {
type = "color",
hasAlpha = true,
width = WeakAuras.normalWidth,
name = L["Glow Color"],
order = 30.8,
@@ -824,7 +875,7 @@ function OptionsPrivate.GetActionOptions(data)
0.011, function() return not data.actions.init.do_custom end, {"actions", "init", "custom"}, true);
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "start_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
5, function() return not (data.actions.start.do_message and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message)) end, {"actions", "start", "message_custom"}, false);
5, function() return not (data.actions.start.do_message and (OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message) or (data.actions.start.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.start.message_dest)))) end, {"actions", "start", "message_custom"}, false);
local startHidden = function()
return OptionsPrivate.IsCollapsed("format_option", "actions", "start_message", true)
@@ -868,15 +919,19 @@ function OptionsPrivate.GetActionOptions(data)
end
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local list = {}
for child in OptionsPrivate.Private.TraverseLeafs(data) do
tinsert(list, child)
end
for index, child in ipairs(list) do
local startGet = function(key)
return childData.actions.start["message_format_" .. key]
return child.actions.start["message_format_" .. key]
end
OptionsPrivate.AddTextFormatOption(childData.actions and childData.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden, index, #data.controlledChildren)
OptionsPrivate.AddTextFormatOption(child.actions and child.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden, true, index, #list)
end
else
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden)
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.start.message, true, startGet, startAddOption, startHidden, startSetHidden, true)
end
@@ -884,7 +939,7 @@ function OptionsPrivate.GetActionOptions(data)
13, function() return not data.actions.start.do_custom end, {"actions", "start", "custom"}, true);
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish_message", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code",
25, function() return not (data.actions.finish.do_message and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message)) end, {"actions", "finish", "message_custom"}, false);
25, function() return not (data.actions.finish.do_message and (OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message) or (data.actions.finish.message_type == "WHISPER" and OptionsPrivate.Private.ContainsCustomPlaceHolder(data.actions.finish.message_dest)))) end, {"actions", "finish", "message_custom"}, false);
local finishHidden = function()
return OptionsPrivate.IsCollapsed("format_option", "actions", "finish_message", true)
@@ -898,7 +953,7 @@ function OptionsPrivate.GetActionOptions(data)
return data.actions.finish["message_format_" .. key]
end
order = 25
order = 26
usedKeys = {}
local function finishAddOption(key, option)
if usedKeys[key] then
@@ -927,15 +982,18 @@ function OptionsPrivate.GetActionOptions(data)
end
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local list = {}
for child in OptionsPrivate.Private.TraverseLeafs(data) do
tinsert(list, child)
end
for index, child in ipairs(list) do
local finishGet = function(key)
return childData.actions.finish["message_format_" .. key]
return child.actions.finish["message_format_" .. key]
end
OptionsPrivate.AddTextFormatOption(childData.actions and childData.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden, index, #data.controlledChildren)
OptionsPrivate.AddTextFormatOption(child.actions and child.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden, true, index, #list)
end
else
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden)
OptionsPrivate.AddTextFormatOption(data.actions and data.actions.finish.message, true, finishGet, finishAddOption, finishHidden, finishSetHidden, true)
end
OptionsPrivate.commonOptions.AddCodeOption(action.args, data, L["Custom Code"], "finish", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#on-hide",
+9 -15
View File
@@ -12,30 +12,24 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("animation")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("animation")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll)
local function filterAnimPresetTypes(intable, id)
local ret = {};
local region = WeakAuras.regions[id] and WeakAuras.regions[id].region;
local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType;
local data = WeakAuras.GetData(id);
if data.controlledChildren then
return ret
end
if(region and regionType and data) then
for key, value in pairs(intable) do
local preset = OptionsPrivate.Private.anim_presets[key];
if(preset) then
if(regionType == "group" or regionType == "dynamicgroup") then
local valid = true;
for index, childId in pairs(data.controlledChildren) do
local childRegion = WeakAuras.regions[childId] and WeakAuras.regions[childId].region
if(childRegion and ((preset.use_scale and not childRegion.Scale) or (preset.use_rotate and not childRegion.Rotate))) then
valid = false;
end
end
if(valid) then
ret[key] = value;
end
else
if not((preset.use_scale and not region.Scale) or (preset.use_rotate and not region.Rotate)) then
ret[key] = value;
end
if not((preset.use_scale and not region.Scale) or (preset.use_rotate and not region.Rotate)) then
ret[key] = value;
end
end
end
+64 -82
View File
@@ -109,8 +109,8 @@ local function nameHead(data, option, phrase)
if not data.controlledChildren then
return phrase
else
for _, id in ipairs(data.controlledChildren) do
if not option.references[id] then
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if not option.references[child.id] then
return conflictBlue .. phrase
end
end
@@ -527,6 +527,34 @@ local function setArrayStr(data, option, array, index)
end
end
local function ensureUniqueKey(candidate, suffix, options, index)
index = index or 1
local goodKey = true
local key = candidate
local existingKeys = {}
for index, option in ipairs(options) do
if option.key then
if option.key == key then
goodKey = false
end
existingKeys[option.key] = true
end
end
if not goodKey then
local prefix = candidate .. suffix
while not goodKey do
key = prefix .. index
goodKey = not existingKeys[key]
index = index + 1
end
end
return key
end
local function generateKey(prefix, options, index)
return ensureUniqueKey(prefix, "", options, index)
end
local typeControlAdders, addAuthorModeOption
typeControlAdders = {
toggle = function(options, args, data, order, prefix, i)
@@ -948,7 +976,7 @@ typeControlAdders = {
end
args[prefix .. "default"] = {
type = "multiselect",
width = WeakAuras.normalWidth,
width = WeakAuras.normalWidth * 0.9,
name = L["Default"],
order = order(),
values = defaultValues,
@@ -1312,7 +1340,7 @@ typeControlAdders = {
path[#path + 1] = j
childOption.subOptions[j] = {
type = "toggle",
key = "subOption" .. j,
key = generateKey("subOption", childOption.subOptions, j),
name = L["Sub Option %i"]:format(j),
default = false,
width = 1,
@@ -1411,7 +1439,7 @@ local function duplicate(data, options, index)
end
end
while existingKeys[newOption.key] do
newOption.key = newOption.key .. "copy"
newOption.key = generateKey(newOption.key .. "copy", childOptions, 1)
end
end
if newOption.name then
@@ -1424,7 +1452,7 @@ local function duplicate(data, options, index)
end
end
local function ensureNonDuplicateKey(option)
local function validateNonDuplicateKey(option)
-- note: this has some unintuitive behavior
-- e.g. if aura A has option keys "foo", "bar"
-- and aura B has option keys "foo", "baz",
@@ -1511,6 +1539,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
tinsert(newPath, #childGroup.subOptions + 1)
OptionsPrivate.InsertCollapsed(id, "author", newPath, childCollapsed)
local childOption = tremove(optionData.options, optionData.index)
childOption.key = ensureUniqueKey(childOption.key, "In", childGroup.subOptions)
local childData = optionData.data
tinsert(childGroup.subOptions, childOption)
WeakAuras.Add(childData)
@@ -1540,6 +1569,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
tinsert(newPath, 1)
OptionsPrivate.InsertCollapsed(id, "author", newPath, childCollapsed)
local childOption = tremove(optionData.options, optionData.index)
childOption.key = ensureUniqueKey(childOption.key, "In", childGroup.subOptions)
local childData = optionData.data
tinsert(childGroup.subOptions, 1, childOption)
WeakAuras.Add(childData)
@@ -1575,6 +1605,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
end
end
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
childOption.key = ensureUniqueKey(childOption.key, "Out", parentOptions)
tinsert(parentOptions, path[#path - 1], childOption)
path[#path] = nil
OptionsPrivate.InsertCollapsed(id, "author", path)
@@ -1609,6 +1640,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
end
end
OptionsPrivate.RemoveCollapsed(id, "author", optionData.path)
childOption.key = ensureUniqueKey(childOption.key, "Out", parentOptions)
tinsert(parentOptions, path[#path - 1] + 1, childOption)
path[#path] = nil
path[#path] = path[#path] + 1
@@ -1736,7 +1768,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
-- mostly because it would have a very non-intuitive effect
-- the names and keys would likely not match anymore, and so
-- the merged display would basically explode into a bunch of separate options
childOption.name = childOption.name or ("Option %i"):format(i)
childOption.name = childOption.name or (L["Option %i"]):format(i)
if not childOption.key then
local newKey = "option" .. i
local existingKeys = {}
@@ -1779,7 +1811,7 @@ function addAuthorModeOption(options, args, data, order, prefix, i)
width = WeakAuras.normalWidth,
name = name(option, "key", optionClass == "group" and L["Group key"] or L["Option key"]),
order = order(),
validate = ensureNonDuplicateKey(option),
validate = validateNonDuplicateKey(option),
get = get(option, "key"),
set = set(data, option, "key")
}
@@ -2489,18 +2521,12 @@ function OptionsPrivate.GetAuthorOptions(data)
local isAuthorMode = true
local options = {}
local order = createorder(1)
if data.controlledChildren then
-- merge options together
for i = 1, #data.controlledChildren do
local childData = WeakAuras.GetData(data.controlledChildren[i])
mergeOptions(options, childData, childData.authorOptions, childData.config, {})
isAuthorMode = isAuthorMode and childData.authorMode
end
else
-- pretend that this is a group with one child
isAuthorMode = data.authorMode
mergeOptions(options, data, data.authorOptions, data.config, {})
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
mergeOptions(options, child, child.authorOptions, child.config, {})
isAuthorMode = isAuthorMode and child.authorMode
end
if isAuthorMode then
args["enterUserMode"] = {
type = "execute",
@@ -2509,14 +2535,9 @@ function OptionsPrivate.GetAuthorOptions(data)
desc = L["Enter user mode."],
order = order(),
func = function()
if data.controlledChildren then
for _, id in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
childData.authorMode = nil
-- no need to add, author mode is picked up by ClearAndUpdateOptions
end
else
data.authorMode = nil
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
child.authorMode = nil
-- no need to add, author mode is picked up by ClearAndUpdateOptions
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
@@ -2535,33 +2556,18 @@ function OptionsPrivate.GetAuthorOptions(data)
name = L["Add Option"],
order = order(),
func = function()
if data.controlledChildren then
for _, id in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
local i = #childData.authorOptions + 1
childData.authorOptions[i] = {
type = "toggle",
key = "option" .. i,
name = L["Option %i"]:format(i),
default = false,
width = 1,
useDesc = false,
}
OptionsPrivate.SetCollapsed(childData.id, "author", i, false)
WeakAuras.Add(childData)
end
else
local i = #data.authorOptions + 1
data.authorOptions[i] = {
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
local i = #child.authorOptions + 1
child.authorOptions[i] = {
type = "toggle",
key = "option" .. i,
key = generateKey("option", child.authorOptions, i),
name = L["Option %i"]:format(i),
default = false,
width = 1,
useDesc = false,
}
OptionsPrivate.SetCollapsed(data.id, "author", i, false)
WeakAuras.Add(data)
OptionsPrivate.SetCollapsed(child.id, "author", i, false)
WeakAuras.Add(child)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
@@ -2582,43 +2588,24 @@ function OptionsPrivate.GetAuthorOptions(data)
desc = L["Reset all options to their default values."],
order = order(),
func = function()
if data.controlledChildren then
for _, id in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
OptionsPrivate.ResetCollapsed(id, "config")
childData.config = {} -- config validation in Add() will set all the needed keys to their defaults
WeakAuras.Add(childData)
end
else
data.config = {}
OptionsPrivate.ResetCollapsed(data.id, "config")
WeakAuras.Add(data)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
child.config = {} -- config validation in Add() will set all the needed keys to their defaults
OptionsPrivate.ResetCollapsed(child.id, "config")
WeakAuras.Add(child)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
end,
disabled = function()
local path = {}
if data.controlledChildren then
for _, id in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
local childConfig = childData.config
for i, childOption in ipairs(childData.authorOptions) do
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
local config = child.config
for i, option in ipairs(child.authorOptions) do
path[1] = i
local result = allChoicesAreDefault(childOption, childConfig, id, path)
local result = allChoicesAreDefault(option, config, child.id, path)
if result == false then
return false
end
end
end
else
local config = data.config
for i, option in ipairs(data.authorOptions) do
path[1] = i
local result = allChoicesAreDefault(option, config, data.id, path)
if result == false then
return false
end
end
end
return true
end
@@ -2630,13 +2617,8 @@ function OptionsPrivate.GetAuthorOptions(data)
desc = L["Configure what options appear on this panel."],
order = order(),
func = function()
if data.controlledChildren then
for _, id in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(id)
childData.authorMode = true
-- no need to add, author mode is picked up by ClearAndUpdateOptions
end
else
for data in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
-- no need to add, author mode is picked up by ClearAndUpdateOptions
data.authorMode = true
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
+1 -1
View File
@@ -130,7 +130,7 @@ local function GetBuffTriggerOptions(data, triggernum)
func = function()
OptionsPrivate.Private.ConvertBuffTrigger2(trigger);
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data)
WeakAuras.UpdateThumbnail(data)
WeakAuras.ClearAndUpdateOptions(data.id);
end
},
+253 -134
View File
@@ -76,7 +76,7 @@ local function CanHaveMatchCheck(trigger)
return trigger.showClones
end
local function CreateNameOptions(aura_options, data, trigger, size, isExactSpellId, isIgnoreList, prefix, baseOrder, useKey, optionKey, name, desc)
local function CreateNameOptions(aura_options, data, trigger, size, isExactSpellId, isIgnoreList, prefix, baseOrder, useKey, optionKey, name, desc, inverse)
local spellCache = WeakAuras.spellCache
for i = 1, size do
@@ -94,7 +94,7 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell
if i ~= 1 then
aura_options[prefix .. "space" .. i] = {
type = "execute",
name = L["or"],
name = inverse and L["and"] or L["or"],
width = WeakAuras.normalWidth - 0.2,
image = function() return "", 0, 0 end,
order = baseOrder + i / 100 + 0.0001,
@@ -107,13 +107,13 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell
type = "execute",
width = 0.2,
order = baseOrder + i / 100 + 0.0002,
hidden = hiddenFunction
hidden = hiddenFunction,
control = "WeakAurasIcon"
}
if isExactSpellId then
aura_options[iconOption].name = ""
aura_options[iconOption].desc = function()
local name = GetSpellInfo(trigger[optionKey] and trigger[optionKey][i] or 0)
aura_options[iconOption].name = function()
local name = GetSpellInfo(WeakAuras.SafeToNumber(trigger[optionKey] and trigger[optionKey][i] or 0))
return name
end
aura_options[iconOption].image = function()
@@ -191,7 +191,6 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell
WeakAuras.Add(data)
WeakAuras.UpdateThumbnail(data)
WeakAuras.UpdateDisplayButton(data)
WeakAuras.ClearAndUpdateOptions(data.id)
end,
validate = isExactSpellId and WeakAuras.ValidateNumeric or nil
@@ -211,6 +210,14 @@ local function GetBuffTriggerOptions(data, triggernum)
end
end
local function HasMatchPerUnitCount(trigger)
if trigger.type == "aura2" and IsGroupTrigger(trigger)
and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected"
then
return trigger.useMatchPerUnit_count
end
end
local ValidateNumeric = WeakAuras.ValidateNumeric
local aura_options = {
useUnit = {
@@ -230,7 +237,8 @@ local function GetBuffTriggerOptions(data, triggernum)
values = function()
return OptionsPrivate.Private.unit_types_bufftrigger_2
end,
hidden = function() return not trigger.type == "aura2" end
hidden = function() return not trigger.type == "aura2" end,
desc = L["• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.\n• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.\n|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.\n• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.\n• |cffffff00Smart Group|r adjusts to your current group type, matching just the \"player\" when solo, \"party\" units (including \"player\") in a party or \"raid\" units in a raid.\n• |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.\n|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.\n\n|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting."],
},
useSpecificUnit = {
type = "toggle",
@@ -275,11 +283,17 @@ local function GetBuffTriggerOptions(data, triggernum)
values = OptionsPrivate.Private.debuff_types,
hidden = function() return not trigger.type == "aura2" end
},
spell_filters_header = {
type = "header",
name = L["Spell Selection Filters"],
order = 11.15,
},
use_debuffClass = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Debuff Type"],
order = 11.2,
desc = L["Filter to only dispellable de/buffs of the given type(s)"],
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger)) end
},
debuffClass = {
@@ -366,6 +380,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Name Pattern Match"],
desc = L["Filter based on the spell Name string."],
order = 55,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi") end
},
@@ -391,6 +406,11 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 55.2,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and trigger.useNamePattern) end
},
aura_filters_header = {
type = "header",
name = L["Active Aura Filters and Info"],
order = 59.9,
},
useStacks = {
type = "toggle",
width = WeakAuras.normalWidth,
@@ -490,90 +510,13 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 61.7,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.useTotal) end
},
fetchTooltip = {
type = "toggle",
name = L["Use Tooltip Information"],
desc = L["This adds %tooltip, %tooltip1, %tooltip2, %tooltip3 as text replacements."],
order = 62,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger)) end
},
use_tooltip = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip Pattern Match"],
order = 62.1,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end
},
use_tooltipSpace = {
type = "description",
name = "",
order = 62.2,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltip and trigger.fetchTooltip) end
},
tooltip_operator = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Operator"],
order = 62.3,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.string_operator_types
},
tooltip = {
type = "input",
name = L["Tooltip Content"],
width = WeakAuras.doubleWidth,
order = 62.4,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end
},
use_tooltipValue = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip Value"],
order = 63.1,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end
},
tooltipValueNumber = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Tooltip Value #"],
order = 63.2,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.tooltip_count
},
use_tooltipValueSpace = {
type = "description",
name = "",
order = 63.2,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltipValue and trigger.fetchTooltip) end
},
tooltipValue_operator = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Operator"],
order = 63.3,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.operator_types
},
tooltipValue = {
type = "input",
name = L["Tooltip"],
width = WeakAuras.normalWidth,
validate = ValidateNumeric,
order = 63.4,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end
},
use_stealable = {
type = "toggle",
name = function(input)
local value = trigger.use_stealable
if value == nil then return L["Is Stealable"]
elseif value == false then return "|cFFFF0000 "..L["Negator"].." "..L["Is Stealable"]
else return "|cFF00FF00"..L["Is Stealable"] end
elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Is Stealable"] .. "|r"
else return "|cFF00FF00" .. L["Is Stealable"] .. "|r" end
end,
width = WeakAuras.doubleWidth,
order = 64,
@@ -595,21 +538,14 @@ local function GetBuffTriggerOptions(data, triggernum)
WeakAuras.Add(data)
end
},
useAffected = {
type = "toggle",
name = L["Fetch Affected/Unaffected Names"],
width = WeakAuras.doubleWidth,
order = 65,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ownOnly = {
type = "toggle",
width = WeakAuras.doubleWidth,
name = function()
local value = trigger.ownOnly
if value == nil then return L["Own Only"]
elseif value == false then return "|cFFFF0000 "..L["Negator"].." "..L["Own Only"]
else return "|cFF00FF00"..L["Own Only"] end
elseif value == false then return "|cFFFF0000 " .. L["Negator"] .. " " .. L["Own Only"] .. "|r"
else return "|cFF00FF00" .. L["Own Only"] .. "|r" end
end,
desc = function()
local value = trigger.ownOnly
@@ -633,16 +569,137 @@ local function GetBuffTriggerOptions(data, triggernum)
end
WeakAuras.Add(data)
end,
order = 66,
order = 64.3,
hidden = function() return not trigger.type == "aura2" end
},
ignoreSelf = {
fetchTooltip = {
type = "toggle",
name = L["Ignore Self"],
order = 67.3,
name = L["Fetch Tooltip Information"],
desc = L["This adds %tooltip, %tooltip1, %tooltip2, %tooltip3 as text replacements and also allows filtering based on the tooltip content/values."],
order = 64.5,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger)) end
},
use_tooltip = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip Pattern Match"],
order = 64.51,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end
},
use_tooltipSpace = {
type = "description",
name = "",
order = 64.52,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltip and trigger.fetchTooltip) end
},
tooltip_operator = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Operator"],
order = 64.53,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.string_operator_types
},
tooltip = {
type = "input",
name = L["Tooltip Content"],
width = WeakAuras.doubleWidth,
order = 64.54,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltip and trigger.fetchTooltip) end
},
use_tooltipValue = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip Value"],
order = 64.55,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.fetchTooltip) end
},
tooltipValueNumber = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Tooltip Value #"],
order = 64.56,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.tooltip_count
},
use_tooltipValueSpace = {
type = "description",
name = "",
order = 64.57,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and not trigger.use_tooltipValue and trigger.fetchTooltip) end
},
tooltipValue_operator = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Operator"],
order = 64.58,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end,
values = OptionsPrivate.Private.operator_types
},
tooltipValue = {
type = "input",
name = L["Tooltip"],
width = WeakAuras.normalWidth,
validate = ValidateNumeric,
order = 64.59,
hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.use_tooltipValue and trigger.fetchTooltip) end
},
unit_filters_header = {
type = "header",
name = L["Affected Unit Filters and Info"],
order = 65,
hidden = function() return trigger.unit == "multi" end,
},
useAffected = {
type = "toggle",
name = L["Fetch Affected/Unaffected Names"],
width = WeakAuras.doubleWidth,
order = 65.1,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
fetchRaidMark = {
type = "toggle",
name = L["Fetch Raid Mark Information"],
desc = L["This adds %raidMark as text replacements."],
order = 65.3,
width = WeakAuras.doubleWidth,
hidden = function()
return not (trigger.type == "aura2" and trigger.unit ~= "multi")
end
},
use_includePets = {
type = "toggle",
width = WeakAuras.normalWidth,
name = WeakAuras.newFeatureString .. L["Include Pets"],
order = 66.1,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
end
},
includePets = {
type = "select",
values = OptionsPrivate.Private.include_pets_types,
width = WeakAuras.normalWidth,
name = WeakAuras.newFeatureString .. L["Include Pets"],
order = 66.15,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.use_includePets) end,
},
includePetsSpace = {
type = "description",
name = "",
order = 66.16,
width = WeakAuras.normalWidth,
hidden = function()
return not (trigger.type == "aura2"
and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_includePets)
end
},
useClass = {
type = "toggle",
@@ -669,35 +726,11 @@ local function GetBuffTriggerOptions(data, triggernum)
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useClass) end
},
ignoreDead = {
type = "toggle",
name = L["Ignore Dead"],
order = 68.7,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ignoreDisconnected = {
type = "toggle",
name = L["Ignore Disconnected"],
order = 68.8,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ignoreInvisible = {
type = "toggle",
name = L["Ignore out of checking range"],
desc = L["Uses UnitIsVisible() to check if in range. This is polled every second."],
order = 68.9,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
useUnitName = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["UnitName Filter"],
order = 69.1,
name = L["Filter by Unit Name"],
order = 68.4,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
end
@@ -705,9 +738,9 @@ local function GetBuffTriggerOptions(data, triggernum)
unitName = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Unit Name Filter"],
desc = L["Filter formats: 'Name', 'Name-Realm', '-Realm'.\n\nSupports multiple entries, separated by commas\n"],
order = 69.2,
name = L["Filter by Unit Name"],
desc = L["Filter formats: 'Name', 'Name-Realm', '-Realm'.\n\nSupports multiple entries, separated by commas\nCan use \\ to escape -."],
order = 68.5,
hidden = function()
return not (trigger.type == "aura2"
and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useUnitName)
@@ -716,7 +749,7 @@ local function GetBuffTriggerOptions(data, triggernum)
unitNameSpace = {
type = "description",
name = "",
order = 69.3,
order = 68.5,
width = WeakAuras.normalWidth,
hidden = function()
return not (trigger.type == "aura2"
@@ -724,7 +757,50 @@ local function GetBuffTriggerOptions(data, triggernum)
end
},
ignoreSelf = {
type = "toggle",
name = L["Ignore Self"],
order = 69.35,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ignoreDead = {
type = "toggle",
name = L["Ignore Dead"],
order = 69.4,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ignoreDisconnected = {
type = "toggle",
name = L["Ignore Disconnected"],
order = 69.8,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
ignoreInvisible = {
type = "toggle",
name = L["Ignore out of checking range"],
desc = L["Uses UnitIsVisible() to check if in range. This is polled every second."],
order = 69.9,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
},
show_settings_header = {
type = "header",
name = L["Show and Clone Settings"],
order = 69.91,
},
multi_unit_hint = {
type = "description",
order = 69.92,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger)) end,
name = L["|cff999999Triggers tracking multiple units will default to being active even while no affected units are found without a Unit Count or Match Count setting applied.|r"],
},
useGroup_count = {
type = "toggle",
width = WeakAuras.normalWidth,
@@ -833,6 +909,45 @@ local function GetBuffTriggerOptions(data, triggernum)
validate = ValidateNumeric,
desc = L["Counts the number of matches over all units."]
},
useMatchPerUnit_count = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Match Count per Unit"],
hidden = function() return not (trigger.type == "aura2" and IsGroupTrigger(trigger)
and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected") end,
order = 71.6
},
useMatchPerUnit_countSpace = {
type = "description",
name = "",
order = 71.7,
width = WeakAuras.normalWidth,
hidden = function()
if trigger.type == "aura2" and IsGroupTrigger(trigger)
and trigger.showClones and trigger.combinePerUnit and trigger.perUnitMode ~= "unaffected" then
return trigger.useMatchPerUnit_count
end
return true
end
},
matchPerUnit_countOperator = {
type = "select",
name = L["Operator"],
order = 71.8,
width = WeakAuras.halfWidth,
values = OptionsPrivate.Private.operator_types,
hidden = function() return not (HasMatchPerUnitCount(trigger)) end,
desc = L["Counts the number of matches per unit."]
},
matchPerUnit_count = {
type = "input",
name = L["Count"],
order = 71.9,
width = WeakAuras.halfWidth,
hidden = function() return not (HasMatchPerUnitCount(trigger)) end,
validate = ValidateNumeric,
desc = L["Counts the number of matches per unit."]
},
showClones = {
type = "toggle",
name = L["Auto-Clone (Show All Matches)"],
@@ -943,21 +1058,25 @@ local function GetBuffTriggerOptions(data, triggernum)
CreateNameOptions(aura_options, data, trigger, nameOptionSize,
false, false, "name", 12, "useName", "auranames",
L["Aura Name"],
L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."])
L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."],
IsSingleMissing(trigger))
CreateNameOptions(aura_options, data, trigger, spellOptionsSize,
true, false, "spellid", 22, "useExactSpellId", "auraspellids",
L["Spell ID"], L["Enter a Spell ID"])
L["Spell ID"], L["Enter a Spell ID"],
IsSingleMissing(trigger))
CreateNameOptions(aura_options, data, trigger, ignoreNameOptionSize,
false, true, "ignorename", 32, "useIgnoreName", "ignoreAuraNames",
L["Ignored Aura Name"],
L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."])
L["Enter an Aura Name, partial Aura Name, or Spell ID. A Spell ID will match any spells with the same name."],
IsSingleMissing(trigger))
CreateNameOptions(aura_options, data, trigger, ignoreSpellOptionsSize,
true, true, "ignorespellid", 42, "useIgnoreExactSpellId", "ignoreAuraSpellids",
L["Ignored Spell ID"], L["Enter a Spell ID"])
L["Ignored Spell ID"], L["Enter a Spell ID"],
IsSingleMissing(trigger))
OptionsPrivate.commonOptions.AddCommonTriggerOptions(aura_options, data, triggernum, true)
OptionsPrivate.commonOptions.AddTriggerGetterSetter(aura_options, data, triggernum)
+275 -288
View File
@@ -41,10 +41,23 @@ commonOptionsCache.GetSameAll = function(self, info)
end
end
commonOptionsCache.SetNameAll = function(self, info, value)
local base = self:GetOrCreateData(info)
base.nameAll = value
end
commonOptionsCache.GetNameAll = function(self, info)
local base = self:GetData(info)
if base then
return base.nameAll
end
end
commonOptionsCache.Clear = function(self)
self.data = {}
end
local parsePrefix = function(input, data, create)
local subRegionIndex, property = string.match(input, "^sub%.(%d+)%..-%.(.+)")
subRegionIndex = tonumber(subRegionIndex)
@@ -341,7 +354,6 @@ local function getChildOption(options, info)
end
end
end
end
return options
end
@@ -365,20 +377,17 @@ local function CreateHiddenAll(subOption)
return true;
end
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
if (not hiddenChild(childOptionTable, info)) then
return false;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
if (not hiddenChild(childOptionTable, info)) then
return false;
end
end
end
@@ -402,20 +411,17 @@ end
local function CreateDisabledAll(subOption)
return function(data, info)
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption);
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
if (not disabledChild(childOptionTable, info)) then
return false;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption);
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
if (not disabledChild(childOptionTable, info)) then
return false;
end
end
end
@@ -428,6 +434,7 @@ local function disabledOrHiddenChild(childOptionTable, info)
return hiddenChild(childOptionTable, info) or disabledChild(childOptionTable, info);
end
local function replaceNameDescFuncs(intable, data, subOption)
local function compareTables(tableA, tableB)
if(#tableA == #tableB) then
@@ -472,19 +479,16 @@ local function replaceNameDescFuncs(intable, data, subOption)
local function combineKeys(info)
local combinedKeys = nil;
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local values = getValueFor(OptionsPrivate.EnsureOptions(childData, subOption), info, "values");
if (values) then
if (type(values) == "function") then
values = values(info);
end
if (type(values) == "table") then
combinedKeys = combinedKeys or {};
for k, v in pairs(values) do
combinedKeys[k] = v;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local values = getValueFor(OptionsPrivate.EnsureOptions(child, subOption), info, "values");
if (values) then
if (type(values) == "function") then
values = values(info);
end
if (type(values) == "table") then
combinedKeys = combinedKeys or {};
for k, v in pairs(values) do
combinedKeys[k] = v;
end
end
end
@@ -513,18 +517,15 @@ local function replaceNameDescFuncs(intable, data, subOption)
local isToggle = nil
for index, childId in ipairs(data.controlledChildren) do
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if isToggle == nil then
local childData = WeakAuras.GetData(childId)
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info)
isToggle = childOption and childOption.type == "toggle"
end
local childData = WeakAuras.GetData(childId);
local regionType = regionPrefix(info[#info]);
if(childData and (not regionType or childData.regionType == regionType or regionType == "sub")) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
if(child and (not regionType or child.regionType == regionType or regionType == "sub")) then
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local get = getValueFor(childOptions, info, "get");
if (combinedKeys) then
for key, _ in pairs(combinedKeys) do
@@ -568,64 +569,69 @@ local function replaceNameDescFuncs(intable, data, subOption)
end
local function nameAll(info)
local cached = commonOptionsCache:GetNameAll(info)
if (cached ~= nil) then
return cached
end
local combinedName;
local first = true;
local foundNames = {};
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
if (childOption) then
local name;
if(type(childOption.name) == "function") then
name = childOption.name(info);
else
name = childOption.name;
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info);
if (childOption) then
local name;
if(type(childOption.name) == "function") then
name = childOption.name(info);
else
name = childOption.name;
commonOptionsCache:SetNameAll(info, name)
return name
end
if (not name) then
-- Do nothing
elseif(first) then
if (name ~= "") then
combinedName = name;
first = false;
end
if (not name) then
-- Do nothing
elseif(first) then
if (combinedName ~= "") then
combinedName = name;
first = false;
foundNames[name] = true;
elseif not(foundNames[name]) then
if (name ~= "") then
if (childOption.type == "description") then
combinedName = combinedName .. "\n\n" .. name;
else
combinedName = combinedName .. " / " .. name;
end
foundNames[name] = true;
elseif not(foundNames[name]) then
if (name ~= "") then
if (childOption.type == "description") then
combinedName = combinedName .. "\n\n" .. name;
else
combinedName = combinedName .. " / " .. name;
end
end
foundNames[name] = true;
end
foundNames[name] = true;
end
end
end
return combinedName;
if combinedName then
commonOptionsCache:SetNameAll(info, combinedName)
end
return combinedName or ""
end
local function descAll(info)
local combinedDesc;
local first = true;
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info);
if (childOption) then
local desc;
if(type(childOption.desc) == "function") then
desc = childOption.desc(info);
else
desc = childOption.desc;
end
if(first) then
combinedDesc = desc;
first = false;
elseif not(combinedDesc == desc) then
return L["Not all children have the same value for this option"];
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOption = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info);
if (childOption) then
local desc;
if(type(childOption.desc) == "function") then
desc = childOption.desc(info);
else
desc = childOption.desc;
end
if(first) then
combinedDesc = desc;
first = false;
elseif not(combinedDesc == desc) then
return L["Not all children have the same value for this option"];
end
end
end
@@ -643,7 +649,7 @@ local function replaceNameDescFuncs(intable, data, subOption)
if(name == "") then
return name;
else
return "|cFF4080FF"..(name or "error");
return "|cFF4080FF"..(name or "error").."|r";
end
end
end
@@ -657,70 +663,71 @@ local function replaceNameDescFuncs(intable, data, subOption)
end
local values = {};
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption and not hiddenChild(childOptionTable, info)) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].get) then
if(intable.type == "toggle") then
local name, tri;
if(type(childOption.name) == "function") then
name = childOption.name(info);
tri = true;
else
name = childOption.name;
end
if(tri and childOptionTable[i].get(info)) then
tinsert(values, "|cFFE0E000"..childId..": |r"..name);
elseif(tri) then
tinsert(values, "|cFFE0E000"..childId..": |r"..L["Ignored"]);
elseif(childOptionTable[i].get(info)) then
tinsert(values, "|cFFE0E000"..childId..": |r|cFF00FF00"..L["Enabled"]);
else
tinsert(values, "|cFFE0E000"..childId..": |r|cFFFF0000"..L["Disabled"]);
end
elseif(intable.type == "color") then
local r, g, b = childOptionTable[i].get(info);
r, g, b = r or 1, g or 1, b or 1;
tinsert(values, ("|cFF%2x%2x%2x%s"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, childId));
elseif(intable.type == "select") then
local selectValues = type(intable.values) == "table" and intable.values or intable.values(info);
local key = childOptionTable[i].get(info);
local display = key and selectValues[key] or L["None"];
if intable.dialogControl == "LSM30_Font" then
tinsert(values, "|cFFE0E000"..childId..": |r" .. key);
else
tinsert(values, "|cFFE0E000"..childId..": |r"..display);
end
elseif(intable.type == "multiselect") then
local selectedValues = {};
for k, v in pairs(combinedKeys) do
if (childOptionTable[i].get(info, k)) then
tinsert(selectedValues, tostring(v))
end
end
tinsert(values, "|cFFE0E000"..childId..": |r"..table.concat(selectedValues, ","));
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption and not hiddenChild(childOptionTable, info)) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].get) then
if(intable.type == "toggle") then
local name, tri;
if(type(childOption.name) == "function") then
name = childOption.name(info);
tri = true;
else
local display = childOptionTable[i].get(info) or L["None"];
if(type(display) == "number") then
display = math.floor(display * 100) / 100;
else
if #display > 50 then
display = display:sub(1, 50) .. "..."
end
end
tinsert(values, "|cFFE0E000"..childId..": |r"..display);
name = childOption.name;
end
break;
if(tri and childOptionTable[i].get(info)) then
tinsert(values, "|cFFE0E000"..child.id..": |r"..name);
elseif(tri) then
tinsert(values, "|cFFE0E000"..child.id..": |r"..L["Ignored"]);
elseif(childOptionTable[i].get(info)) then
tinsert(values, "|cFFE0E000"..child.id..": |r|cFF00FF00"..L["Enabled"].."|r");
else
tinsert(values, "|cFFE0E000"..child.id..": |r|cFFFF0000"..L["Disabled"].."|r");
end
elseif(intable.type == "color") then
local r, g, b = childOptionTable[i].get(info);
r, g, b = r or 1, g or 1, b or 1;
tinsert(values, ("|cFF%2x%2x%2x%s|r"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, child.id));
elseif(intable.type == "select") then
local selectValues = type(intable.values) == "table" and intable.values or intable.values(info);
local key = childOptionTable[i].get(info);
local display = key and selectValues[key] or L["None"];
if intable.dialogControl == "LSM30_Font" then
tinsert(values, "|cFFE0E000"..child.id..": |r" .. key);
else
if type(display) == "string" then
tinsert(values, "|cFFE0E000"..child.id..": |r"..display);
elseif type(display) == "table" then
tinsert(values, "|cFFE0E000"..child.id..": |r"..display[1].."/"..display[2] );
end
end
elseif(intable.type == "multiselect") then
local selectedValues = {};
for k, v in pairs(combinedKeys) do
if (childOptionTable[i].get(info, k)) then
tinsert(selectedValues, tostring(v))
end
end
tinsert(values, "|cFFE0E000"..child.id..": |r"..table.concat(selectedValues, ","));
else
local display = childOptionTable[i].get(info) or L["None"];
if(type(display) == "number") then
display = math.floor(display * 100) / 100;
else
if #display > 50 then
display = display:sub(1, 50) .. "..."
end
end
tinsert(values, "|cFFE0E000"..child.id..": |r"..display);
end
break;
end
end
end
@@ -740,23 +747,20 @@ local function replaceImageFuncs(intable, data, subOption)
local function imageAll(info)
local combinedImage = {};
local first = true;
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
if not(childOption) then
return "error"
end
childOption = getChildOption(childOption, info);
if childOption and childOption.image then
local image = {childOption.image(info)};
if(first) then
combinedImage = image;
first = false;
else
if not(combinedImage[1] == image[1]) then
return "", 0, 0;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOption = OptionsPrivate.EnsureOptions(child, subOption)
if not(childOption) then
return "error"
end
childOption = getChildOption(childOption, info);
if childOption and childOption.image then
local image = {childOption.image(info)};
if(first) then
combinedImage = image;
first = false;
else
if not(combinedImage[1] == image[1]) then
return "", 0, 0;
end
end
end
@@ -782,40 +786,37 @@ local function replaceValuesFuncs(intable, data, subOption)
local combinedValues = {};
local handledValues = {};
local first = true;
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOption = OptionsPrivate.EnsureOptions(childData, subOption)
if not(childOption) then
return "error"
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOption = OptionsPrivate.EnsureOptions(child, subOption)
if not(childOption) then
return "error"
end
childOption = getChildOption(childOption, info);
if (childOption) then
local values = childOption.values;
if (type(values) == "function") then
values = values(info);
childOption = getChildOption(childOption, info);
if (childOption) then
local values = childOption.values;
if (type(values) == "function") then
values = values(info);
end
if(first) then
for k, v in pairs(values) do
handledValues[k] = handledValues[k] or {};
handledValues[k][v] = true;
combinedValues[k] = v;
end
if(first) then
for k, v in pairs(values) do
first = false;
else
for k, v in pairs(values) do
if (handledValues[k] and handledValues[k][v]) then
-- Already known key/value pair
else
if (combinedValues[k]) then
combinedValues[k] = combinedValues[k] .. "/" .. v;
else
combinedValues[k] = v;
end
handledValues[k] = handledValues[k] or {};
handledValues[k][v] = true;
combinedValues[k] = v;
end
first = false;
else
for k, v in pairs(values) do
if (handledValues[k] and handledValues[k][v]) then
-- Already known key/value pair
else
if (combinedValues[k]) then
combinedValues[k] = combinedValues[k] .. "/" .. v;
else
combinedValues[k] = v;
end
handledValues[k] = handledValues[k] or {};
handledValues[k][v] = true;
end
end
end
end
@@ -881,49 +882,43 @@ local getHelper = {
end
}
local function CreateGetAll(subOption)
return function(data, info, ...)
local isToggle = nil
local allChildren = CopyTable(getHelper)
local enabledChildren = CopyTable(getHelper)
for index, childId in ipairs(data.controlledChildren) do
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if isToggle == nil then
local childData = WeakAuras.GetData(childId)
local childOptions = getChildOption(OptionsPrivate.EnsureOptions(childData, subOption), info)
local childOptions = getChildOption(OptionsPrivate.EnsureOptions(child, subOption), info)
isToggle = childOptions and childOptions.type == "toggle"
end
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].get) then
local values = {childOptionTable[i].get(info, ...)};
if isToggle and values[1] == nil then
values[1] = false
end
allChildren:Set(values)
if not disabledOrHiddenChild(childOptionTable, info) then
enabledChildren:Set(values)
end
if not allChildren:GetSame() and not enabledChildren:GetSame() then
return nil;
end
break;
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].get) then
local values = {childOptionTable[i].get(info, ...)};
if isToggle and values[1] == nil then
values[1] = false
end
allChildren:Set(values)
if not disabledOrHiddenChild(childOptionTable, info) then
enabledChildren:Set(values)
end
if not allChildren:GetSame() and not enabledChildren:GetSame() then
return nil;
end
break;
end
end
end
@@ -943,27 +938,24 @@ local function CreateSetAll(subOption, getAll)
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 = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].set) then
if (childOptionTable[i].type == "multiselect") then
childOptionTable[i].set(info, ..., not before);
else
childOptionTable[i].set(info, ...);
end
break;
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
for i=#childOptionTable,0,-1 do
if(childOptionTable[i].set) then
if (childOptionTable[i].type == "multiselect") then
childOptionTable[i].set(info, ..., not before);
else
childOptionTable[i].set(info, ...);
end
break;
end
end
end
@@ -972,7 +964,7 @@ local function CreateSetAll(subOption, getAll)
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.pauseOptionsProcessing(false);
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
OptionsPrivate.UpdateOptions()
end
end
@@ -980,24 +972,21 @@ end
local function CreateExecuteAll(subOption)
return function(data, info, button)
local secondCall = nil
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childOptions = OptionsPrivate.EnsureOptions(childData, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
local childOption = childOptions;
local childOptionTable = {[0] = childOption};
for i=1,#info do
childOption = childOption.args[info[i]];
childOptionTable[i] = childOption;
end
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
-- Some functions, that is the expand/collapse functions need to be
-- effectively called only once. Passing in the secondCall parameter allows
-- them to distinguish between the first and every other call
childOption.func(info, button, secondCall)
secondCall = true
end
if (childOption and not disabledOrHiddenChild(childOptionTable, info)) then
-- Some functions, that is the expand/collapse functions need to be
-- effectively called only once. Passing in the secondCall parameter allows
-- them to distinguish between the first and every other call
childOption.func(info, button, secondCall)
secondCall = true
end
end
WeakAuras.ClearAndUpdateOptions(data.id)
@@ -1013,6 +1002,10 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
end
end
local function IsGroupByFrame()
return data.regionType == "dynamicgroup" and data.useAnchorPerUnit
end
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
local positionOptions = {
__title = L["Position Settings"],
@@ -1055,12 +1048,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
OptionsPrivate.ResetMoverSizer();
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
WeakAuras.Add(parentData);
end
end
OptionsPrivate.Private.AddParents(data)
end
},
yOffset = {
@@ -1079,12 +1067,7 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
OptionsPrivate.ResetMoverSizer();
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
WeakAuras.Add(parentData);
end
end
OptionsPrivate.Private.AddParents(data)
end
},
selfPoint = {
@@ -1101,7 +1084,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
width = WeakAuras.normalWidth,
name = L["Anchored To"],
order = 72,
hidden = IsParentDynamicGroup,
hidden = function()
return IsParentDynamicGroup() or IsGroupByFrame()
end,
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
@@ -1148,9 +1133,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
order = 75,
hidden = function()
if (data.parent) then
--if (IsParentDynamicGroup()) then
-- return true;
--end
if IsGroupByFrame() then
return false
end
return data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE";
else
return data.anchorFrameType == "MOUSE";
@@ -1164,6 +1149,9 @@ local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, g
name = L["To Group's"],
order = 76,
hidden = function()
if IsGroupByFrame() then
return true
end
if (data.anchorFrameType ~= "SCREEN") then
return true;
end
@@ -1468,7 +1456,6 @@ local function AddCommonTriggerOptions(options, data, triggernum, doubleWidth)
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.ClearAndUpdateOptions(data.id);
end,
control = "WeakAurasSortedDropdown"
+315 -178
View File
@@ -108,18 +108,17 @@ local function valueToString(a, propertytype)
return tostring(a);
end
local function isSubset(data, reference)
local function isSubset(data, reference, totalAuraCount)
if (data.controlledChildren) then
local auraCount = #data.controlledChildren;
if (auraCount > reference.referenceCount) then
if (totalAuraCount > reference.referenceCount) then
return true;
end
end
return false;
end
local function blueIfSubset(data, reference)
if (isSubset(data, reference)) then
local function blueIfSubset(data, reference, totalAuraCount)
if (isSubset(data, reference, totalAuraCount)) then
return "|cFF4080FF";
end
return "";
@@ -143,8 +142,8 @@ local function blueIfNoValue2(data, object, variable, subvariable, blueString, n
return normalString or "";
end
local function descIfSubset(data, reference)
if (isSubset(data, reference)) then
local function descIfSubset(data, reference, totalAuraCount)
if (isSubset(data, reference, totalAuraCount)) then
local desc = L["Used in auras:"];
for id in pairs(reference.references) do
desc = desc .. "\n" .. id;
@@ -156,7 +155,6 @@ end
local function descIfNoValue(data, object, variable, type, values)
if (data.controlledChildren) then
local auraCount = #data.controlledChildren;
if (object["same" .. variable] == false) then
local desc = "";
for id, reference in pairs(object.references) do
@@ -174,7 +172,6 @@ end
local function descIfNoValue2(data, object, variable, subvariable, type, values)
if (data.controlledChildren) then
local auraCount = #data.controlledChildren;
if (object["same" .. variable] and object["same" .. variable][subvariable] == false) then
local desc = "";
for id, reference in pairs(object.references) do
@@ -215,15 +212,15 @@ local function wrapWithPlaySound(func, kit)
end
end
local function addControlsForChange(args, order, data, conditionVariable, conditions, i, j, allProperties, usedProperties)
local function addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties)
local thenText = (j == 1) and L["Then "] or L["And "];
local display = isSubset(data, conditions[i].changes[j]) and allProperties.displayWithCopy or allProperties.display;
local display = isSubset(data, conditions[i].changes[j], totalAuraCount) and allProperties.displayWithCopy or allProperties.display;
local valuesForProperty = filterUsedProperties(allProperties.indexToProperty, display, usedProperties, conditions[i].changes[j].property);
args["condition" .. i .. "property" .. j] = {
type = "select",
width = WeakAuras.normalWidth,
name = blueIfSubset(data, conditions[i].changes[j]) .. thenText,
desc = descIfSubset(data, conditions[i].changes[j]),
name = blueIfSubset(data, conditions[i].changes[j], totalAuraCount) .. thenText,
desc = descIfSubset(data, conditions[i].changes[j], totalAuraCount),
order = order,
values = valuesForProperty,
control = "WeakAurasTwoColumnDropdown",
@@ -234,13 +231,13 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
set = function(info, index)
local property = allProperties.indexToProperty[index];
if (property == "COPY") then
for _, id in ipairs(data.controlledChildren) do
if (conditions[i].changes[j].references[id]) then
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if (conditions[i].changes[j].references[child.id]) then
-- Already exist
else
local insertPoint = 1;
for index = j, 1, -1 do
if (conditions[i].changes[index].references[id]) then
if (conditions[i].changes[index].references[child.id]) then
insertPoint = index + 1;
break;
end
@@ -254,13 +251,16 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
change.value = conditions[i].changes[j].value;
end
local conditionIndex = conditions[i].check.references[id].conditionIndex;
local auraData = WeakAuras.GetData(id);
tinsert(auraData[conditionVariable][conditionIndex].changes, insertPoint, change);
WeakAuras.Add(auraData);
local reference = conditions[i].check.references[child.id]
if reference then
local conditionIndex = reference.conditionIndex;
tinsert(child[conditionVariable][conditionIndex].changes, insertPoint, change);
WeakAuras.Add(child);
OptionsPrivate.ClearOptions(child.id)
end
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
elseif (property == "DELETE") then
if (data.controlledChildren) then
@@ -269,12 +269,13 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local conditionIndex = conditions[i].check.references[id].conditionIndex;
tremove(auraData[conditionVariable][conditionIndex].changes, reference.changeIndex);
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
tremove(conditions[i].changes, j);
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
return;
end
@@ -287,14 +288,15 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].property = property;
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = default;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
conditions[i].changes[j].property = property;
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
conditions[i].changes[j].property = property;
conditions[i].changes[j].value = default;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
}
@@ -311,9 +313,10 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local conditionIndex = conditions[i].check.references[id].conditionIndex;
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = v;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
conditions[i].changes[j].value = v;
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueColor = function(info, r, g, b, a)
for id, reference in pairs(conditions[i].changes[j].references) do
@@ -325,16 +328,17 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[3] = b;
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[4] = a;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
conditions[i].changes[j].value = conditions[i].changes[j].value or {};
conditions[i].changes[j].value[1] = r;
conditions[i].changes[j].value[2] = g;
conditions[i].changes[j].value[3] = b;
conditions[i].changes[j].value[4] = a;
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueComplex = function(property, reloadOptions)
setValueComplex = function(property)
return function(info, v)
for id, reference in pairs(conditions[i].changes[j].references) do
local auraData = WeakAuras.GetData(id);
@@ -344,15 +348,15 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
end
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property] = v;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
if (type(conditions[i].changes[j].value) ~= "table") then
conditions[i].changes[j].value = {};
end
conditions[i].changes[j].value[property] = v;
if reloadOptions then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
@@ -372,6 +376,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][3] = b;
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value[property][4] = a;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
if (type(conditions[i].changes[j].value) ~= "table") then
conditions[i].changes[j].value = {};
@@ -383,13 +388,14 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
conditions[i].changes[j].value[property][2] = g;
conditions[i].changes[j].value[property][3] = b;
conditions[i].changes[j].value[property][4] = a;
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
else
setValue = function(info, v)
conditions[i].changes[j].value = v;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueColor = function(info, r, g, b, a)
conditions[i].changes[j].value = conditions[i].changes[j].value or {};
@@ -398,18 +404,17 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
conditions[i].changes[j].value[3] = b;
conditions[i].changes[j].value[4] = a;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueComplex = function(property, reloadOptions)
setValueComplex = function(property)
return function(info, v)
if (type (conditions[i].changes[j].value) ~= "table") then
conditions[i].changes[j].value = {};
end
conditions[i].changes[j].value[property] = v;
WeakAuras.Add(data);
if reloadOptions then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
@@ -426,6 +431,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
conditions[i].changes[j].value[property][3] = b;
conditions[i].changes[j].value[property][4] = a;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
end
@@ -694,11 +700,60 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
return false;
end
if WeakAuras.IsRetail() then
args["condition" .. i .. "value" .. j .. "message type warning"] = {
type = "description",
width = WeakAuras.doubleWidth,
name = L["Note: Automated Messages to SAY and YELL are blocked outside of Instances."],
order = order,
hidden = function()
return not (anyMessageType("SAY") or anyMessageType("YELL") or anyMessageType("SMARTRAID"));
end
}
order = order + 1;
end
args["condition" .. i .. "value" .. j .. "_indent"] = {
type = "description",
width = WeakAuras.normalWidth,
name = "",
order = order,
hidden = function()
return anyMessageType("WHISPER");
end
}
order = order + 1;
args["condition" .. i .. "value" .. j .. "message color"] = {
type = "color",
width = WeakAuras.normalWidth,
hasAlpha = false,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_color", L["Color"], L["Color"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_color", propertyType),
order = order,
get = function()
if (conditions[i].changes[j].value and type(conditions[i].changes[j].value) == "table") and type(conditions[i].changes[j].value.message_color) == "table" then
return conditions[i].changes[j].value.message_color[1], conditions[i].changes[j].value.message_color[2], conditions[i].changes[j].value.message_color[3];
end
return 1, 1, 1, 1;
end,
set = setValueColorComplex("message_color"),
hidden = function()
return not (anyMessageType("COMBAT") or anyMessageType("PRINT") or anyMessageType("ERROR"));
end
}
order = order + 1;
local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType);
if (not descMessage and data ~= OptionsPrivate.tempGroup) then
descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end
args["condition" .. i .. "value" .. j .. "message dest"] = {
type = "input",
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_dest", L["Send To"], L["Send To"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_dest", propertyType),
desc = descMessage,
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest;
@@ -710,10 +765,21 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
}
order = order + 1;
local descMessage = descIfNoValue2(data, conditions[i].changes[j], "value", "message", propertyType);
if (not descMessage and data ~= OptionsPrivate.tempGroup) then
descMessage = L["Dynamic text tooltip"] .. OptionsPrivate.Private.GetAdditionalProperties(data)
end
args["condition" .. i .. "value" .. j] = {
type = "toggle",
width = WeakAuras.normalWidth,
name = blueIfNoValue(data, conditions[i].changes[j], "value", "message_dest_isunit", L["Is Unit"], L["Is Unit"]),
desc = descIfNoValue(data, conditions[i].changes[j], "value", "message_dest_isunit", propertyType),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_dest_isunit;
end,
set = setValueComplex("message_dest_isunit"),
hidden = function()
return not anyMessageType("WHISPER");
end
}
order = order + 1;
local message_getter = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
@@ -753,8 +819,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
option.desc = descIfNoValue2(data, conditions[i].changes[j], "value", "message_format_" .. key, nil, option.values)
end
option.set = setValueComplex("message_format_" .. key, option.reloadOptions)
option.reloadOptions = nil
option.set = setValueComplex("message_format_" .. key)
args[fullKey] = option
end
@@ -776,11 +841,11 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
end
for index, reference in ipairs(ordered) do
local input = reference.value and reference.value.message
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, index, #ordered)
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, true, index, #ordered)
end
else
local input = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value["message"]
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden)
hasTextFormatOption = OptionsPrivate.AddTextFormatOption(input, true, formatGet, addOption, hidden, setHidden, true)
end
if hasTextFormatOption then
@@ -794,8 +859,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local function customHidden()
local message = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
if (not message) then return true; end
return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message);
local message_dest = type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_type == "WHISPER" and conditions[i].changes[j].value.message_dest
if (not message and not message_dest) then return true; end
return not OptionsPrivate.Private.ContainsCustomPlaceHolder(message) and not OptionsPrivate.Private.ContainsCustomPlaceHolder(message_dest);
end
args["condition" .. i .. "value" .. j .. "custom"] = {
@@ -824,9 +890,9 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
local changeIndex = reference.changeIndex;
multipath[id] = {"conditions", conditionIndex, "changes", changeIndex, "value", "custom"};
end
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, multipath, nil, true, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1");
else
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#custom-check");
OptionsPrivate.OpenTextEditor(data, {"conditions", i, "changes", j, "value", "custom"}, nil, nil, nil, nil, "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#chat-message---custom-code-1");
end
end
}
@@ -993,6 +1059,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", L["Glow Frame Type"], L["Glow Frame Type"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_frame_type", propertyType, {
UNITFRAME = L["Unit Frame"],
NAMEPLATE = L["Nameplate"],
FRAMESELECTOR = L["Frame Selector"]
}),
order = order,
@@ -1065,6 +1132,7 @@ local function addControlsForChange(args, order, data, conditionVariable, condit
order = order + 1
args["condition" .. i .. "value" .. j .. "glow_color"] = {
type = "color",
hasAlpha = true,
width = WeakAuras.normalWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "glow_color", L["Glow Color"], L["Glow Color"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "glow_color", "color"),
@@ -1284,7 +1352,7 @@ local function removeSubCheck(base, path)
tremove(parent.checks, path[#path]);
end
local function addControlsForIfLine(args, order, data, conditionVariable, conditions, i, path, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, parentType)
local function addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, path, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, parentType)
local check = getSubCheck(conditions[i].check, path);
local indentDepth = min(#path, 3); -- Be reasonable
@@ -1293,7 +1361,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
local conditionTemplatesToUse = indentDepth < 3 and conditionTemplates or conditionTemplateWithoutCombinations;
local optionsName = blueIfSubset(data, conditions[i].check);
local optionsName = blueIfSubset(data, conditions[i].check, totalAuraCount);
local needsTriggerName = check and check.trigger and check.trigger ~= -1 and check.trigger ~= -2;
if (parentType) then
local isFirst = path[#path] == 1;
@@ -1363,27 +1431,27 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
if (indentDepth > 0) then
valuesForIf = conditionTemplatesToUse.displayWithRemove;
else
valuesForIf = isSubset(data, conditions[i].check) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display;
valuesForIf = isSubset(data, conditions[i].check, totalAuraCount) and conditionTemplatesToUse.displayWithCopy or conditionTemplatesToUse.display;
end
args["condition" .. i .. tostring(path) .. "if"] = {
type = "select",
name = optionsName,
desc = descIfSubset(data, conditions[i].check),
desc = descIfSubset(data, conditions[i].check, totalAuraCount),
order = order,
values = valuesForIf,
width = normalWidth;
set = function(info, v)
if (conditionTemplatesToUse.indexToTrigger[v] == "COPY") then
for _, id in ipairs(data.controlledChildren) do
if (conditions[i].check.references[id]) then
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if (conditions[i].check.references[child.id]) then
-- Already exists
else
-- find a good insertion point, if any other condition has a reference to this
-- insert directly after that
local insertPoint = 1;
for index = i, 1, -1 do
if (conditions[index].check.references[id]) then
if (conditions[index].check.references[child.id]) then
insertPoint = index + 1;
break;
end
@@ -1414,12 +1482,12 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
end
local auraData = WeakAuras.GetData(id);
tinsert(auraData[conditionVariable], insertPoint, condition);
WeakAuras.Add(auraData);
tinsert(child[conditionVariable], insertPoint, condition);
WeakAuras.Add(child);
OptionsPrivate.ClearOptions(child.id)
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
end
@@ -1453,8 +1521,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
childCheck.trigger = trigger;
childCheck.value = nil;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
local oldType;
check = getOrCreateSubCheck(conditions[i].check, path);
@@ -1470,7 +1539,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
check.value = nil;
end
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end,
get = function()
@@ -1495,7 +1564,7 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
for subCheck = 1, subCheckCount do
local subPath = CopyTable(path);
tinsert(subPath, subCheck);
order = addControlsForIfLine(args, order, data, conditionVariable, conditions, i, subPath, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, check.variable);
order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, subPath, conditionTemplates, conditionTemplateWithoutCombinations, allProperties, check.variable);
end
end
@@ -1509,46 +1578,33 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
end
if (currentConditionTemplate and currentConditionTemplate.type and type(currentConditionTemplate.type) == "string") then
local setOp;
local setValue;
if (data.controlledChildren) then
setOp = function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
for id, reference in pairs(conditions[i].check.references) do
local auraData = WeakAuras.GetData(id);
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
childCheck.op = v;
WeakAuras.Add(auraData);
local function makeSetter(field)
if (data.controlledChildren) then
return function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
for id, reference in pairs(conditions[i].check.references) do
local auraData = WeakAuras.GetData(id);
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
childCheck[field] = v;
WeakAuras.Add(auraData);
OptionsPrivate.ClearOptions(auraData.id)
end
check[field] = v;
WeakAuras.ClearAndUpdateOptions(data.id)
end
check.op = v;
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
setValue = function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
for id, reference in pairs(conditions[i].check.references) do
local auraData = WeakAuras.GetData(id);
local childCheck = getOrCreateSubCheck(auraData[conditionVariable][reference.conditionIndex].check, path);
childCheck.value = v;
WeakAuras.Add(auraData);
else
return function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
check[field] = v;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
end
check.value = v;
WeakAuras.ClearAndUpdateOptions(data.id, true)
end
else
setOp = function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
check.op = v;
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValue = function(info, v)
check = getOrCreateSubCheck(conditions[i].check, path);
check.value = v;
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
local setOp = makeSetter("op")
local setValue = makeSetter("value")
if (currentConditionTemplate.type == "number" or currentConditionTemplate.type == "timer" or currentConditionTemplate.type == "elapsedTimer") then
local opTypes = OptionsPrivate.Private.operator_types
if currentConditionTemplate.operator_types == "without_equal" then
@@ -1694,6 +1750,95 @@ local function addControlsForIfLine(args, order, data, conditionVariable, condit
order = order + 1;
elseif currentConditionTemplate.type == "alwaystrue" then
order = addSpace(args, order)
elseif (currentConditionTemplate.type == "range") then
args["condition" .. i .. tostring(path) .. "_op_range"] = {
name = blueIfNoValue(data, conditions[i].check, "op_range", L["Differences"]),
desc = descIfNoValue(data, conditions[i].check, "op_range", currentConditionTemplate.type),
type = "select",
order = order,
values = OptionsPrivate.Private.operator_types_without_equal,
width = WeakAuras.halfWidth,
get = function()
return check.op_range;
end,
set = makeSetter("op_range"),
}
order = order + 1;
args["condition" .. i .. tostring(path) .. "_range"] = {
type = "input",
name = L["Range in yards"],
desc = descIfNoValue(data, conditions[i].check, "range", currentConditionTemplate.type),
width = WeakAuras.halfWidth,
order = order,
validate = WeakAuras.ValidateNumeric,
get = function()
return check.range;
end,
set = makeSetter("range")
}
order = order + 1;
if (indentWidth > 0) then
args["condition" .. i .. tostring(path) .. "_space"] = {
type = "description",
name = "",
order = order,
width = WeakAuras.doubleWidth * 1.5,
}
order = order + 1;
args["condition" .. i .. tostring(path) .. "_indent"] = {
type = "description",
width = indentWidth,
name = "",
order = order
}
order = order + 1;
end
args["condition" .. i .. tostring(path) .. "_type"] = {
type = "select",
width = normalWidth,
name = blueIfNoValue(data, conditions[i].check, "type", L["Differences"]),
desc = descIfNoValue(data, conditions[i].check, "type", currentConditionTemplate.type),
order = order,
values = {
group = L["Group player(s) found"],
},
get = function()
return check.type
end,
set = makeSetter("type"),
}
order = order + 1;
args["condition" .. i .. tostring(path) .. "_op"] = {
name = blueIfNoValue(data, conditions[i].check, "op", L["Differences"]),
desc = descIfNoValue(data, conditions[i].check, "op", currentConditionTemplate.type),
type = "select",
order = order,
values = OptionsPrivate.Private.operator_types,
width = WeakAuras.halfWidth,
get = function()
return check.op;
end,
set = setOp,
}
order = order + 1;
args["condition" .. i .. tostring(path) .. "_value"] = {
type = "input",
name = blueIfNoValue(data, conditions[i].check, "value", L["Differences"]),
desc = descIfNoValue(data, conditions[i].check, "value", currentConditionTemplate.type),
width = WeakAuras.halfWidth,
order = order,
validate = WeakAuras.ValidateNumeric,
get = function()
return check.value;
end,
set = setValue
}
order = order + 1;
elseif currentConditionTemplate.type == "customcheck" then
args["condition" .. i .. tostring(path) .. "_op"] = {
name = blueIfNoValue(data, conditions[i].check, "op", L["Additional Events"], L["Additional Events"]),
@@ -1799,7 +1944,7 @@ local function fixUpLinkedInFirstCondition(conditions)
end
end
local function addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
if (not conditions[i].check) then
return order;
end
@@ -1828,11 +1973,12 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
for id, reference in pairs(conditions[i].check.references) do
local index = reference.conditionIndex
OptionsPrivate.SetCollapsed(id, "condition", index, not collapsed);
OptionsPrivate.ClearOptions(id)
end
else
OptionsPrivate.SetCollapsed(data.id, "condition", i, not collapsed);
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end,
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
imageWidth = 18,
@@ -1870,9 +2016,10 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
OptionsPrivate.MoveCollapseDataUp(auraData.id, "condition", {reference.conditionIndex})
OptionsPrivate.ClearOptions(auraData.id)
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
if (i > 1) then
local tmp = conditions[i];
@@ -1881,7 +2028,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataUp(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
end,
@@ -1923,9 +2070,10 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
OptionsPrivate.MoveCollapseDataDown(auraData.id, "condition", {reference.conditionIndex})
OptionsPrivate.ClearOptions(auraData.id)
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
else
if (i < #conditions) then
@@ -1935,7 +2083,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
OptionsPrivate.MoveCollapseDataDown(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
end
end
@@ -1960,15 +2108,16 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
tinsert(auraData[conditionVariable], reference.conditionIndex + 1, clone);
WeakAuras.Add(auraData);
OptionsPrivate.DuplicateCollapseData(auraData.id, "condition", {reference.conditionIndex})
OptionsPrivate.ClearOptions(auraData.id)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
else
local clone = CopyTable(conditions[i])
tinsert(conditions, i + 1, clone);
WeakAuras.Add(data);
OptionsPrivate.DuplicateCollapseData(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
end
end,
@@ -1992,15 +2141,16 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
fixUpLinkedInFirstCondition(auraData[conditionVariable])
WeakAuras.Add(auraData);
OptionsPrivate.RemoveCollapsed(auraData.id, "condition", {reference.conditionIndex})
OptionsPrivate.ClearOptions(auraData.id)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
else
tremove(conditions, i);
fixUpLinkedInFirstCondition(conditions)
WeakAuras.Add(data);
OptionsPrivate.RemoveCollapsed(data.id, "condition", {i})
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
return;
end
end,
@@ -2016,7 +2166,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
return order;
end
order = addControlsForIfLine(args, order, data, conditionVariable, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
order = addControlsForIfLine(args, order, data, conditionVariable, totalAuraCount, conditions, i, {}, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
-- Add Property changes
@@ -2029,7 +2179,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
end
for j = 1, conditions[i].changes and #conditions[i].changes or 0 do
order = addControlsForChange(args, order, data, conditionVariable, conditions, i, j, allProperties, usedProperties);
order = addControlsForChange(args, order, data, conditionVariable, totalAuraCount, conditions, i, j, allProperties, usedProperties);
end
args["condition" .. i .. "_addChange"] = {
@@ -2044,13 +2194,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
auradata[conditionVariable][reference.conditionIndex].changes = auradata[conditionVariable][reference.conditionIndex].changes or {}
tinsert(auradata[conditionVariable][reference.conditionIndex].changes, {})
WeakAuras.Add(auradata);
OptionsPrivate.ClearOptions(auradata.id)
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
conditions[i].changes = conditions[i].changes or {};
conditions[i].changes[#conditions[i].changes + 1] = {};
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
}
@@ -2091,13 +2242,14 @@ local function addControlsForCondition(args, order, data, conditionVariable, con
if reference.conditionIndex > 1 then
auradata[conditionVariable][reference.conditionIndex].linked = not isLinked
WeakAuras.Add(auradata);
OptionsPrivate.ClearOptions(auradata.id)
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
else
conditions[i].linked = not isLinked
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.ClearAndUpdateOptions(data.id)
end
end
}
@@ -2196,11 +2348,10 @@ local function createConditionTemplates(data)
local numTriggers = 0;
if (data.controlledChildren) then
allConditionTemplates = {};
for _, id in ipairs(data.controlledChildren) do
local data = WeakAuras.GetData(id);
numTriggers = max(numTriggers, #data.triggers);
for child in OptionsPrivate.Private.TraverseLeafs(data) do
numTriggers = max(numTriggers, #child.triggers);
local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(data);
local auraConditionsTemplate = OptionsPrivate.Private.GetTriggerConditions(child);
mergeConditionTemplates(allConditionTemplates, auraConditionsTemplate, numTriggers)
end
else
@@ -2238,39 +2389,28 @@ end
local function buildAllPotentialProperties(data, category)
local allProperties = {};
allProperties.propertyMap = {};
if (data.controlledChildren) then
for _, id in ipairs(data.controlledChildren) do
local auradata = WeakAuras.GetData(id);
local regionProperties = OptionsPrivate.Private.GetProperties(auradata);
if (regionProperties) then
for k, v in pairs(regionProperties) do
if (v.category == category) then
if (allProperties.propertyMap[k]) then
if (allProperties.propertyMap[k].type ~= v.type) then
allProperties.propertyMap[k].type = "incompatible";
end
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
local regionProperties = OptionsPrivate.Private.GetProperties(child);
if (allProperties.propertyMap[k].type == "list") then
-- Merge value lists
for key, value in pairs(v.values) do
if (allProperties.propertyMap[k].values[key] == nil) then
allProperties.propertyMap[k].values[key] = value;
end
end
end
else
allProperties.propertyMap[k] = CopyTable(v)
end
end
end
end
end
else
local regionProperties = OptionsPrivate.Private.GetProperties(data);
if (regionProperties) then
for k, v in pairs(regionProperties) do
if (v.category == category) then
allProperties.propertyMap[k] = v;
if (allProperties.propertyMap[k]) then
if (allProperties.propertyMap[k].type ~= v.type) then
allProperties.propertyMap[k].type = "incompatible";
end
if (allProperties.propertyMap[k].type == "list") then
-- Merge value lists
for key, value in pairs(v.values) do
if (allProperties.propertyMap[k].values[key] == nil) then
allProperties.propertyMap[k].values[key] = value;
end
end
end
else
allProperties.propertyMap[k] = CopyTable(v)
end
end
end
end
@@ -2411,7 +2551,7 @@ local function SubPropertiesForChange(change)
"glow_scale", "glow_border"
}
elseif change.property == "chat" then
local result = { "message_type", "message_dest", "message_channel", "message", "custom" }
local result = { "message_type", "message_dest", "message_channel", "message_color", "message", "custom" }
local input = change.value and change.value.message
if input then
local getter = function(key)
@@ -2419,14 +2559,15 @@ local function SubPropertiesForChange(change)
end
OptionsPrivate.AddTextFormatOption(input, false, getter, function(key)
tinsert(result, "message_format_" .. key)
end)
end, nil, nil, true)
end
return result
end
end
local subPropertyToType = {
glow_color = "color"
glow_color = "color",
message_color = "color"
}
local function mergeConditionChange(all, change, id, changeIndex, allProperties)
@@ -2601,16 +2742,23 @@ function OptionsPrivate.GetConditionOptions(data)
-- Build currently selected conditions
local conditions;
local totalAuraCount
if (data.controlledChildren) then
local allChildren = {}
for child in OptionsPrivate.Private.TraverseLeafs(data) do
tinsert(allChildren, child)
end
totalAuraCount = #allChildren
conditions = {};
local last = #data.controlledChildren;
for index = last, 1, -1 do
local id = data.controlledChildren[index];
local data = WeakAuras.GetData(id);
fixupConditions(data[conditionVariable])
mergeConditions(conditions, data[conditionVariable], data.id, conditionTemplates.all, allProperties);
for index = totalAuraCount, 1, -1 do
local child = allChildren[index]
fixupConditions(child[conditionVariable])
mergeConditions(conditions, child[conditionVariable], child.id, conditionTemplates.all, allProperties);
end
else
totalAuraCount = 1
data[conditionVariable] = data[conditionVariable] or {};
conditions = data[conditionVariable];
fixupConditions(data[conditionVariable])
@@ -2618,7 +2766,7 @@ function OptionsPrivate.GetConditionOptions(data)
local order = startorder;
for i = 1, #conditions do
order = addControlsForCondition(args, order, data, conditionVariable, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
order = addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties);
end
args["addConditionHeader"] = {
@@ -2635,28 +2783,17 @@ function OptionsPrivate.GetConditionOptions(data)
name = L["Add Condition"],
order = order,
func = function()
if (data.controlledChildren) then
for _, id in ipairs(data.controlledChildren) do
local aura = WeakAuras.GetData(id);
aura[conditionVariable][#aura[conditionVariable] + 1] = {};
aura[conditionVariable][#aura[conditionVariable]].check = {};
aura[conditionVariable][#aura[conditionVariable]].changes = {};
aura[conditionVariable][#aura[conditionVariable]].changes[1] = {}
aura[conditionVariable][#aura[conditionVariable]].category = category;
OptionsPrivate.SetCollapsed(id, "condition", #aura[conditionVariable], false);
WeakAuras.Add(aura);
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
else
conditions[#conditions + 1] = {};
conditions[#conditions].check = {};
conditions[#conditions].changes = {};
conditions[#conditions].changes[1] = {}
conditions[#conditions].category = category;
OptionsPrivate.SetCollapsed(data.id, "condition", #conditions, false);
WeakAuras.Add(data);
WeakAuras.ClearAndUpdateOptions(data.id, true)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
child[conditionVariable][#child[conditionVariable] + 1] = {};
child[conditionVariable][#child[conditionVariable]].check = {};
child[conditionVariable][#child[conditionVariable]].changes = {};
child[conditionVariable][#child[conditionVariable]].changes[1] = {}
child[conditionVariable][#child[conditionVariable]].category = category;
OptionsPrivate.SetCollapsed(child.id, "condition", #child[conditionVariable], false);
WeakAuras.Add(child);
OptionsPrivate.ClearOptions(child.id)
end
WeakAuras.ClearAndUpdateOptions(data.id)
end
}
order = order + 1;
+24 -33
View File
@@ -15,24 +15,21 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("region")
local getAll = OptionsPrivate.commonOptions.CreateGetAll("region")
local setAll = OptionsPrivate.commonOptions.CreateSetAll("region", getAll)
local function AddSubRegionImpl(data, subRegionName)
data.subRegions = data.subRegions or {}
if OptionsPrivate.Private.subRegionTypes[subRegionName] and OptionsPrivate.Private.subRegionTypes[subRegionName] then
if OptionsPrivate.Private.subRegionTypes[subRegionName].supports(data.regionType) then
local default = OptionsPrivate.Private.subRegionTypes[subRegionName].default
local subRegionData = type(default) == "function" and default(data.regionType) or CopyTable(default)
subRegionData.type = subRegionName
tinsert(data.subRegions, subRegionData)
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
local function AddSubRegion(data, subRegionName)
for data in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
data.subRegions = data.subRegions or {}
if OptionsPrivate.Private.subRegionTypes[subRegionName] and OptionsPrivate.Private.subRegionTypes[subRegionName] then
if OptionsPrivate.Private.subRegionTypes[subRegionName].supports(data.regionType) then
local default = OptionsPrivate.Private.subRegionTypes[subRegionName].default
local subRegionData = type(default) == "function" and default(data.regionType) or CopyTable(default)
subRegionData.type = subRegionName
tinsert(data.subRegions, subRegionData)
WeakAuras.Add(data)
OptionsPrivate.ClearOptions(data.id)
end
end
end
end
local function AddSubRegion(data, subRegionName)
if (OptionsPrivate.Private.ApplyToDataOrChildData(data, AddSubRegionImpl, subRegionName)) then
WeakAuras.ClearAndUpdateOptions(data.id)
end
WeakAuras.ClearAndUpdateOptions(data.id)
end
local function AddOptionsForSupportedSubRegion(regionOption, data, supported)
@@ -183,12 +180,7 @@ function OptionsPrivate.GetDisplayOptions(data)
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
WeakAuras.Add(parentData);
end
end
OptionsPrivate.Private.AddParents(data)
OptionsPrivate.ResetMoverSizer();
end,
args = options
@@ -209,33 +201,32 @@ function OptionsPrivate.GetDisplayOptions(data)
local supportedSubRegions = {}
local hasSubElements = false
for index, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if childData and not handledRegionTypes[childData.regionType] then
handledRegionTypes[childData.regionType] = true;
if regionOptions[childData.regionType] then
allOptions = union(allOptions, regionOptions[childData.regionType].create(id, data));
for child in OptionsPrivate.Private.TraverseLeafs(data) do
if child and not handledRegionTypes[child.regionType] then
handledRegionTypes[child.regionType] = true;
if regionOptions[child.regionType] then
allOptions = union(allOptions, regionOptions[child.regionType].create(id, data));
else
unsupportedCount = unsupportedCount + 1
allOptions["__unsupported" .. unsupportedCount] = {
__title = "|cFFFFFF00" .. childData.regionType,
__title = "|cFFFFFF00" .. child.regionType,
__order = 1,
warning = {
type = "description",
name = L["Regions of type \"%s\" are not supported."]:format(childData.regionType),
name = L["Regions of type \"%s\" are not supported."]:format(child.regionType),
order = 1
},
}
end
for subRegionName, subRegionType in pairs(OptionsPrivate.Private.subRegionTypes) do
if subRegionType.supports(childData.regionType) then
if subRegionType.supports(child.regionType) then
supportedSubRegions[subRegionName] = true
end
end
end
if childData.subRegions then
if child.subRegions then
local subIndex = {}
for index, subRegionData in ipairs(childData.subRegions) do
for index, subRegionData in ipairs(child.subRegions) do
local subRegionType = subRegionData.type
local alreadyHandled = handledSubRegionTypes[index] and handledSubRegionTypes[index][subRegionType]
if OptionsPrivate.Private.subRegionOptions[subRegionType] and not alreadyHandled then
-336
View File
@@ -1,336 +0,0 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
-- Lua APIs
local tinsert, wipe = table.insert, wipe
local pairs = pairs
local AceGUI = LibStub("AceGUI-3.0")
local displayButtons = WeakAuras.displayButtons
local importAddonButtons = {}
local importDisplayButtons = {}
WeakAuras.importDisplayButtons = importDisplayButtons
function OptionsPrivate.CreateImportButtons()
wipe(importAddonButtons);
wipe(importDisplayButtons);
for addonName, addonData in pairs(OptionsPrivate.Private) do
local addonButton = AceGUI:Create("WeakAurasImportButton");
importAddonButtons[addonName] = addonButton;
addonButton:SetTitle(addonData.displayName);
addonButton:SetIcon(addonData.icon);
addonButton:SetDescription(addonData.description);
addonButton:SetClick(function()
if(addonButton.checkbox:GetChecked()) then
for id, data in pairs(addonData.displays) do
if not(data.parent) then
local childButton = importDisplayButtons[id];
childButton.checkbox:SetChecked(true);
WeakAuras.EnableAddonDisplay(id);
end
end
for id, data in pairs(addonData.displays) do
if(data.parent) then
local childButton = importDisplayButtons[id];
childButton.checkbox:SetChecked(true);
WeakAuras.EnableAddonDisplay(id);
end
end
else
for id, data in pairs(addonData.displays) do
if not(data.parent) then
local childButton = importDisplayButtons[id];
childButton.checkbox:SetChecked(false);
WeakAuras.DisableAddonDisplay(id);
end
end
for id, data in pairs(addonData.displays) do
if(data.parent) then
local childButton = importDisplayButtons[id];
childButton.checkbox:SetChecked(false);
WeakAuras.DisableAddonDisplay(id);
end
end
end
OptionsPrivate.Private.ResolveCollisions(function()
for groupId, dataFromAddon in pairs(addonData.displays) do
if(dataFromAddon.controlledChildren) then
local data = WeakAuras.GetData(groupId);
if(data) then
for index, childId in pairs(data.controlledChildren) do
local childButton = WeakAuras.GetDisplayButton(childId);
childButton:SetGroup(groupId, data.regionType == "dynamicgroup");
childButton:SetGroupOrder(index, #data.controlledChildren);
end
local button = WeakAuras.GetDisplayButton(groupId);
button.callbacks.UpdateExpandButton();
WeakAuras.UpdateDisplayButton(data);
WeakAuras.ClearAndUpdateOptions(data.id);
end
end
end
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
end);
end);
local function UpdateAddonChecked()
local shouldBeChecked = true;
for id, data in pairs(addonData.displays) do
if not(OptionsPrivate.Private.IsDefinedByAddon(id)) then
shouldBeChecked = false;
break;
end
end
addonButton.checkbox:SetChecked(shouldBeChecked);
end
local numAddonDisplays = 0;
for id, data in pairs(addonData.displays) do
if(data.controlledChildren) then
numAddonDisplays = numAddonDisplays + 1;
local groupButton = AceGUI:Create("WeakAurasImportButton");
importDisplayButtons[id] = groupButton;
groupButton:SetTitle(id);
groupButton:SetDescription(data.desc);
local numGroupDisplays = 0;
local function UpdateGroupChecked()
local shouldBeChecked = true;
for index, childId in pairs(data.controlledChildren) do
if not(OptionsPrivate.Private.IsDefinedByAddon(childId)) then
shouldBeChecked = false;
break;
end
end
groupButton.checkbox:SetChecked(shouldBeChecked);
UpdateAddonChecked();
end
for index, childId in pairs(data.controlledChildren) do
numGroupDisplays = numGroupDisplays + 1;
numAddonDisplays = numAddonDisplays + 1;
local childButton = AceGUI:Create("WeakAurasImportButton");
importDisplayButtons[childId] = childButton;
local data = OptionsPrivate.Private[addonName].displays[childId];
childButton:SetTitle(childId);
childButton:SetDescription(data.desc);
childButton:SetExpandVisible(false);
childButton:SetLevel(3);
childButton:SetClick(function()
if(childButton.checkbox:GetChecked()) then
WeakAuras.EnableAddonDisplay(childId);
else
WeakAuras.DisableAddonDisplay(childId);
end
OptionsPrivate.Private.ResolveCollisions(function()
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
UpdateGroupChecked();
end);
end);
childButton.updateChecked = UpdateGroupChecked;
childButton.checkbox:SetChecked(OptionsPrivate.Private.IsDefinedByAddon(childId));
end
groupButton:SetClick(function()
if(groupButton.checkbox:GetChecked()) then
WeakAuras.EnableAddonDisplay(id);
for index, childId in pairs(data.controlledChildren) do
local childButton = importDisplayButtons[childId];
childButton.checkbox:SetChecked(true);
WeakAuras.EnableAddonDisplay(childId);
end
else
WeakAuras.DisableAddonDisplay(id);
for index, childId in pairs(data.controlledChildren) do
local childButton = importDisplayButtons[childId];
childButton.checkbox:SetChecked(false);
WeakAuras.DisableAddonDisplay(childId);
end
end
OptionsPrivate.Private.ResolveCollisions(function()
local data = WeakAuras.GetData(id);
if(data) then
for index, childId in pairs(data.controlledChildren) do
local childButton = WeakAuras.GetDisplayButton(childId);
childButton:SetGroup(id, data.regionType == "dynamicgroup");
childButton:SetGroupOrder(index, #data.controlledChildren);
end
local button = WeakAuras.GetDisplayButton(id);
button.callbacks.UpdateExpandButton();
WeakAuras.UpdateDisplayButton(data);
WeakAuras.ClearAndUpdateOptions(data.id);
end
OptionsPrivate.Private.ScanForLoads();
WeakAuras.SortDisplayButtons();
UpdateAddonChecked();
end);
end);
groupButton.updateChecked = UpdateAddonChecked;
groupButton:SetExpandVisible(true);
if(numGroupDisplays > 0) then
groupButton:EnableExpand();
groupButton:SetOnExpandCollapse(WeakAuras.SortImportButtons);
end
groupButton:SetLevel(2);
UpdateGroupChecked();
elseif not(importDisplayButtons[id]) then
numAddonDisplays = numAddonDisplays + 1;
local displayButton = AceGUI:Create("WeakAurasImportButton");
importDisplayButtons[id] = displayButton;
displayButton:SetTitle(id);
displayButton:SetDescription(data.desc);
displayButton:SetExpandVisible(false);
displayButton:SetLevel(2);
displayButton:SetClick(function()
if(displayButton.checkbox:GetChecked()) then
WeakAuras.EnableAddonDisplay(id);
else
WeakAuras.DisableAddonDisplay(id);
end
OptionsPrivate.Private.ResolveCollisions(function()
WeakAuras.SortDisplayButtons()
UpdateAddonChecked();
end);
end);
displayButton.updateChecked = UpdateAddonChecked;
displayButton.checkbox:SetChecked(OptionsPrivate.Private.IsDefinedByAddon(id));
end
end
addonButton:SetExpandVisible(true);
if(numAddonDisplays > 0) then
addonButton:EnableExpand();
addonButton:SetOnExpandCollapse(WeakAuras.SortImportButtons);
end
addonButton:SetLevel(1);
UpdateAddonChecked();
end
end
local container = nil;
function WeakAuras.SortImportButtons(newContainer)
container = newContainer or container;
wipe(container.children);
local toSort = {};
for addon, addonData in pairs(OptionsPrivate.Private) do
container:AddChild(importAddonButtons[addon]);
wipe(toSort);
for id, data in pairs(addonData.displays) do
if not(data.parent) then
tinsert(toSort, id);
end
end
table.sort(toSort, function(a, b) return a < b end);
for index, id in ipairs(toSort) do
if(importAddonButtons[addon]:GetExpanded()) then
importDisplayButtons[id].frame:Show();
container:AddChild(importDisplayButtons[id]);
else
importDisplayButtons[id].frame:Hide();
end
if(addonData.displays[id].controlledChildren) then
for childIndex, childId in pairs(addonData.displays[id].controlledChildren) do
if(importAddonButtons[addon]:GetExpanded() and importDisplayButtons[id]:GetExpanded()) then
importDisplayButtons[childId].frame:Show();
container:AddChild(importDisplayButtons[childId]);
else
importDisplayButtons[childId].frame:Hide();
end
end
end
end
end
container:DoLayout();
end
function WeakAuras.EnableAddonDisplay(id)
local db = OptionsPrivate.savedVars.db
if not(db.registered[id]) then
local addon, data;
for addonName, addonData in pairs(OptionsPrivate.Private) do
if(addonData.displays[id]) then
addon = addonName;
data = CopyTable(addonData.displays[id]);
break;
end
end
if(db.displays[id]) then
-- ID collision
OptionsPrivate.Private.collisions[id] = {addon, data};
else
db.registered[id] = addon;
if(data.controlledChildren) then
wipe(data.controlledChildren);
end
WeakAuras.Add(data);
OptionsPrivate.Private.SyncParentChildRelationships(true);
OptionsPrivate.AddDisplayButton(data);
end
end
end
-- This function overrides the WeakAuras.CollisionResolved that is defined in WeakAuras.lua,
-- ensuring that sidebar buttons are created properly after collision resolution
function WeakAuras.CollisionResolved(addon, data, force)
WeakAuras.EnableAddonDisplay(data.id);
end
function WeakAuras.DisableAddonDisplay(id)
local frame = WeakAuras.OptionsFrame()
local db = OptionsPrivate.savedVars.db
db.registered[id] = false;
local data = WeakAuras.GetData(id);
if(data) then
local parentData;
if(data.parent) then
parentData = db.displays[data.parent];
end
if(data.controlledChildren) then
for index, childId in pairs(data.controlledChildren) do
local childButton = displayButtons[childId];
if(childButton) then
childButton:SetGroup();
end
local childData = db.displays[childId];
if(childData) then
childData.parent = nil;
end
end
end
WeakAuras.Delete(data);
OptionsPrivate.Private.SyncParentChildRelationships(true);
frame.buttonsScroll:DeleteChild(displayButtons[id]);
displayButtons[id] = nil;
if(parentData and parentData.controlledChildren) then
for index, childId in pairs(parentData.controlledChildren) do
local childButton = displayButtons[childId];
if(childButton) then
childButton:SetGroupOrder(index, #parentData.controlledChildren);
end
end
WeakAuras.Add(parentData);
WeakAuras.ClearAndUpdateOptions(parentData.id);
WeakAuras.UpdateDisplayButton(parentData);
end
end
end
+4 -10
View File
@@ -37,7 +37,7 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.custom_type = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.ClearAndUpdateOptions(data.id);
end
},
@@ -55,7 +55,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.check = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
check2 = {
@@ -72,7 +71,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.check = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
events = {
@@ -88,7 +86,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.events = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
events2 = {
@@ -102,7 +99,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.events = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
event_customError = {
@@ -173,7 +169,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.custom_hide = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
custom_hide2 = {
@@ -187,7 +182,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.custom_hide = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
},
dynamicDuration = {
@@ -202,7 +196,6 @@ local function GetCustomTriggerOptions(data, triggernum)
set = function(info, v)
trigger.dynamicDuration = v;
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.ClearAndUpdateOptions(data.id);
end
},
@@ -255,7 +248,7 @@ local function GetCustomTriggerOptions(data, triggernum)
};
local function extraSetFunction()
WeakAuras.UpdateDisplayButton(data);
WeakAuras.UpdateThumbnail(data);
end
local function extraSetFunctionReload()
@@ -287,7 +280,8 @@ local function GetCustomTriggerOptions(data, triggernum)
type = "string",
test = "function",
events = "table",
values = "table"
values = "table",
display = "string"
}
local function validateCustomVariables(variables)
+46 -63
View File
@@ -47,23 +47,16 @@ function OptionsPrivate.GetInformationOptions(data)
local sameURL = true
local commonURL
local desc = ""
if not isTmpGroup then
commonURL = data.url
if data.url then
desc = "|cFFE0E000"..data.id..": |r".. data.url .. "\n"
local traverseForUrl = isTmpGroup and OptionsPrivate.Private.TraverseAllChildren or OptionsPrivate.Private.TraverseAll
for child in traverseForUrl(data) do
if child.url then
desc = desc .. "|cFFE0E000"..child.id..": |r"..child.url .. "\n"
end
end
if data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
if childData.url then
desc = desc .. "|cFFE0E000"..childData.id..": |r"..childData.url .. "\n"
end
if not commonURL then
commonURL = childData.url or ""
elseif childData.url ~= commonURL then
sameURL = false
end
if not commonURL then
commonURL = child.url or ""
elseif child.url ~= commonURL then
sameURL = false
end
end
@@ -72,26 +65,15 @@ function OptionsPrivate.GetInformationOptions(data)
name = sameURL and L["URL"] or "|cFF4080FF" .. L["URL"],
width = WeakAuras.doubleWidth,
get = function()
if data.controlledChildren then
return sameURL and commonURL or ""
else
return data.url
end
return sameURL and commonURL or ""
end,
set = function(info, v)
if data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
childData.url = v
WeakAuras.Add(childData)
OptionsPrivate.ClearOptions(childData.id)
end
for child in traverseForUrl(data) do
child.url = v
WeakAuras.Add(child)
OptionsPrivate.ClearOptions(child.id)
end
if not isTmpGroup then
data.url = v
WeakAuras.Add(data)
end
WeakAuras.ClearAndUpdateOptions(data.id)
end,
desc = sameURL and "" or desc,
@@ -177,7 +159,7 @@ function OptionsPrivate.GetInformationOptions(data)
local properties = {
ignoreOptionsEventErrors = {
name = L["Ignore Lua Errors on OPTIONS event"]
name = L["Ignore Lua Errors on OPTIONS event"],
},
groupOffset = {
name = L["Offset by 1px"],
@@ -200,23 +182,7 @@ function OptionsPrivate.GetInformationOptions(data)
}
for property, propertyData in pairs(properties) do
if not propertyData.onParent and data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
if not propertyData.regionType or propertyData.regionType == childData.regionType then
mergedDesc[property] = (mergedDesc[property] or "") .. "|cFFE0E000"..childData.id..": |r".. (childData.information[property] and "true" or "false") .. "\n"
if common[property] == nil then
if childData.information[property] ~= nil then
common[property] = childData.information[property]
else
common[property] = false
end
elseif childData.information[property] ~= common[property] then
same[property] = false
end
end
end
else
if propertyData.onParent then
if not isTmpGroup and (not propertyData.regionType or propertyData.regionType == data.regionType) then
if data.information[property] ~= nil then
common[property] = data.information[property]
@@ -224,6 +190,24 @@ function OptionsPrivate.GetInformationOptions(data)
common[property] = false
end
end
else
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
if not propertyData.regionType or propertyData.regionType == child.regionType then
local effectiveProperty = child.information[property]
if effectiveProperty == nil then
effectiveProperty = false
end
mergedDesc[property] = (mergedDesc[property] or "") .. "|cFFE0E000" .. child.id .. ": |r"
.. (effectiveProperty and "true" or "false") .. "\n"
if common[property] == nil then
common[property] = effectiveProperty
elseif effectiveProperty ~= common[property] then
same[property] = false
end
end
end
end
if common[property] ~= nil then
@@ -232,26 +216,25 @@ function OptionsPrivate.GetInformationOptions(data)
name = same[property] and propertyData.name or "|cFF4080FF" .. propertyData.name,
width = WeakAuras.doubleWidth,
get = function()
if not propertyData.onParent and data.controlledChildren then
return same[property] and common[property] or false
else
if propertyData.onParent then
return data.information[property]
else
return same[property] and common[property] or false
end
end,
set = function(info, v)
if not propertyData.onParent and data.controlledChildren then
for _, childId in ipairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
if not propertyData.regionType or propertyData.regionType == childData.regionType then
childData.information[property] = v
WeakAuras.Add(childData)
OptionsPrivate.ClearOptions(childData.id)
end
end
else
if propertyData.onParent then
data.information[property] = v
WeakAuras.Add(data)
OptionsPrivate.ClearOptions(data.id)
else
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
if not propertyData.regionType or propertyData.regionType == child.regionType then
child.information[property] = v
WeakAuras.Add(child)
OptionsPrivate.ClearOptions(child.id)
end
end
end
WeakAuras.ClearAndUpdateOptions(data.id)
end,
+27 -42
View File
@@ -147,8 +147,8 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
name = function(input)
local value = trigger["use_"..realname];
if(value == nil) then return arg.display;
elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..arg.display;
else return "|cFF00FF00"..arg.display; end
elseif(value == false) then return "|cFFFF0000 "..L["Negator"].." "..arg.display.."|r";
else return "|cFF00FF00"..arg.display.."|r"; end
end,
desc = arg.desc,
get = function()
@@ -174,8 +174,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end,
hidden = hidden,
order = order
@@ -223,8 +222,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end,
hidden = hidden,
order = order
@@ -271,8 +269,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
end
@@ -317,8 +314,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -329,7 +325,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.ClearAndUpdateOptions(data.id)
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
order = order + 1;
@@ -352,8 +348,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -364,7 +359,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.ClearAndUpdateOptions(data.id)
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
order = order + 1;
@@ -385,8 +380,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
@@ -406,7 +400,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.ClearAndUpdateOptions(data.id)
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
order = order + 1;
@@ -428,8 +422,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -440,7 +433,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.ClearAndUpdateOptions(data.id)
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
order = order + 1;
@@ -461,8 +454,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -473,7 +465,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.ClearAndUpdateOptions(data.id)
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
order = order + 1;
@@ -493,8 +485,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
WeakAuras.Add(data);
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end,
};
order = order + 1;
@@ -549,7 +540,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
return nil;
end
elseif(arg.type == "spell") then
local useExactSpellId = (arg.showExactOption and trigger["use_exact_"..realname]) or arg.forceExactOption
local useExactSpellId = (arg.showExactOption and trigger["use_exact_"..realname])
if(trigger["use_"..realname]) then
if (trigger[realname] and trigger[realname] ~= "") then
if useExactSpellId then
@@ -588,8 +579,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
order = order + 1;
@@ -611,6 +601,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
order = order,
hidden = hidden,
values = values,
desc = arg.desc,
disabled = function() return not trigger["use_"..realname]; end,
get = function()
if(arg.type == "unit" and trigger["use_specific_"..realname]) then
@@ -642,8 +633,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -660,8 +650,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
if (arg.control) then
@@ -733,8 +722,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -746,8 +734,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
@@ -767,7 +754,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
trigger[realname .. "_extraOption"] = v
WeakAuras.Add(data)
OptionsPrivate.Private.ScanForLoads({[data.id] = true})
WeakAuras.SortDisplayButtons()
OptionsPrivate.SortDisplayButtons(nil, true)
end
}
order = order + 1
@@ -800,8 +787,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
};
if(arg.required and not triggertype) then
@@ -817,8 +803,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
end
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end
end
@@ -886,7 +871,7 @@ function OptionsPrivate.GetLoadOptions(data)
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
OptionsPrivate.Private.ScanForLoads({[data.id] = true});
WeakAuras.SortDisplayButtons();
OptionsPrivate.SortDisplayButtons(nil, true);
end,
args = {}
}
+113 -7
View File
@@ -7,29 +7,100 @@ end
local L = WeakAuras.L
-- WeakAuras/Options
L[" • %d |4aura:auras; added"] = " • %d |4индикация добавлена:индикации добавлены:индикаций добавлено;"
L[" • %d |4aura:auras; deleted"] = " • %d |4индикация удалена:индикации удалены:индикаций удалено;"
L[" • %d |4aura:auras; modified"] = " • %d |4индикация изменена:индикации изменены:индикаций изменено;"
--[[Translation missing --]]
L[" and "] = " and "
L[" and |cFFFF0000mirrored|r"] = "; Отражение"
L["-- Do not remove this comment, it is part of this trigger: "] = "-- Не удаляйте этот комментарий, он является частью этого триггера: "
L["-- Do not remove this comment, it is part of this aura: "] = "-- Не удаляйте этот комментарий! Он является частью кода индикации "
L[" rotated |cFFFF0000%s|r degrees"] = "; Поворот %.4g"
L["% of Progress"] = "% прогресса"
L["%i auras selected"] = "%i |4индикация выбрана:индикации выбраны:индикаций выбрано;"
L["%i Matches"] = "%i |4совпадение:совпадения:совпадений;"
--[[Translation missing --]]
L["%s - %i. Trigger"] = "%s - %i. Trigger"
L["%s - Alpha Animation"] = "%s анимация прозрачности"
L["%s - Color Animation"] = "%s анимация цвета"
--[[Translation missing --]]
L["%s - Condition Custom Chat %s"] = "%s - Condition Custom Chat %s"
--[[Translation missing --]]
L["%s - Condition Custom Check %s"] = "%s - Condition Custom Check %s"
--[[Translation missing --]]
L["%s - Condition Custom Code %s"] = "%s - Condition Custom Code %s"
--[[Translation missing --]]
L["%s - Custom Anchor"] = "%s - Custom Anchor"
--[[Translation missing --]]
L["%s - Custom Grow"] = "%s - Custom Grow"
--[[Translation missing --]]
L["%s - Custom Sort"] = "%s - Custom Sort"
--[[Translation missing --]]
L["%s - Custom Text"] = "%s - Custom Text"
L["%s - Finish"] = "%s - Конечная"
--[[Translation missing --]]
L["%s - Finish Action"] = "%s - Finish Action"
--[[Translation missing --]]
L["%s - Finish Custom Text"] = "%s - Finish Custom Text"
--[[Translation missing --]]
L["%s - Init Action"] = "%s - Init Action"
L["%s - Main"] = "%s - Основная"
L["%s - Option #%i has the key %s. Please choose a different option key."] = "Ключ |cFFE6CC80%3$s|r уже используется в Параметре %2$i индикации %1$s. Пожалуйста, выберите другой ключ."
L["%s - Rotate Animation"] = "%s анимация вращения"
L["%s - Scale Animation"] = "%s анимация масштаба"
L["%s - Start"] = "%s - Начальная"
--[[Translation missing --]]
L["%s - Start Action"] = "%s - Start Action"
--[[Translation missing --]]
L["%s - Start Custom Text"] = "%s - Start Custom Text"
L["%s - Translate Animation"] = "%s анимация перемещения"
L["%s - Trigger Logic"] = "%s - Комбинация триггеров"
L["%s %s, Lines: %d, Frequency: %0.2f, Length: %d, Thickness: %d"] = "%s %s; Линии %d; Частота %.3g; Длина %0.3g; Толщина %0.3g"
L["%s %s, Particles: %d, Frequency: %0.2f, Scale: %0.2f"] = "%s %s; Частицы %d; Частота %.3g; Масштаб %.3g"
--[[Translation missing --]]
L["%s %u. Overlay Function"] = "%s %u. Overlay Function"
L["%s Alpha: %d%%"] = "%s Прозрачность %d%%"
--[[Translation missing --]]
L[ [=[%s auras will be added.
]=] ] = [=[%s auras will be added.
]=]
--[[Translation missing --]]
L[ [=[%s auras will be removed.
]=] ] = [=[%s auras will be removed.
]=]
L["%s Color"] = "%s "
--[[Translation missing --]]
L["%s Custom Variables"] = "%s Custom Variables"
L["%s Default Alpha, Zoom, Icon Inset, Aspect Ratio"] = "%s Значения по умолчанию"
--[[Translation missing --]]
L["%s Duration Function"] = "%s Duration Function"
--[[Translation missing --]]
L["%s Icon Function"] = "%s Icon Function"
L["%s Inset: %d%%"] = "%s Вставка %d%%"
L["%s is not a valid SubEvent for COMBAT_LOG_EVENT_UNFILTERED"] = "%s не является допустимым внутренним событием COMBAT_LOG_EVENT_UNFILTERED"
L["%s Keep Aspect Ratio"] = "%s Сохранение пропорций изображения"
--[[Translation missing --]]
L["%s Name Function"] = "%s Name Function"
--[[Translation missing --]]
L["%s Stacks Function"] = "%s Stacks Function"
L["%s Texture"] = "%s"
--[[Translation missing --]]
L["%s Texture Function"] = "%s Texture Function"
L["%s total auras"] = "Всего %s |4индикация:индикации:индикаций;"
--[[Translation missing --]]
L["%s Trigger Function"] = "%s Trigger Function"
--[[Translation missing --]]
L["%s Untrigger Function"] = "%s Untrigger Function"
L["%s Zoom: %d%%"] = "%s Увеличение %d%%"
L["%s, Border"] = "%s; Граница"
L["%s, Offset: %0.2f;%0.2f"] = "%s; Смещение (%.4g, %.4g)"
L["%s, offset: %0.2f;%0.2f"] = "%s; Смещение (%.4g, %.4g)"
L["%s|cFFFF0000custom|r texture with |cFFFF0000%s|r blend mode%s%s"] = "Своя %sтекстура; Режим наложения |cFFE6CC80%s|r%s%s"
L["(Right click to rename)"] = "(Правый клик для смены названия)"
--[[Translation missing --]]
L[", "] = ", "
L["|c%02x%02x%02x%02xCustom Color|r"] = "Свечение |c%02x%02x%02x%02xO|r цвета"
--[[Translation missing --]]
L["|cff999999Triggers tracking multiple units will default to being active even while no affected units are found without a Unit Count or Match Count setting applied.|r"] = "|cff999999Triggers tracking multiple units will default to being active even while no affected units are found without a Unit Count or Match Count setting applied.|r"
L["|cFFE0E000Note:|r This sets the description only on '%s'"] = "|cFFFFCC00Примечание.|r Задает описание только для индикации %s"
L["|cFFE0E000Note:|r This sets the URL on all selected auras"] = "|cFFFFCC00Примечание.|r Устанавливает URL-адрес для выбранных индикаций"
L["|cFFE0E000Note:|r This sets the URL on this group and all its members."] = "|cFFFFCC00Примечание.|r Устанавливает URL-адрес для этой группы и всех ее индикаций"
@@ -46,6 +117,24 @@ local L = WeakAuras.L
L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s"] = "|cFFFFCC00Атрибуты текста:|r |cFFE6CC80%s|r; Тень |c%sO|r цвета со смещением (%s, %s);%s%s"
L["|cFFffcc00Font Flags:|r |cFFFF0000%s|r and shadow |c%sColor|r with offset |cFFFF0000%s/%s|r%s%s%s"] = "|cFFFFCC00Атрибуты текста:|r |cFFE6CC80%s|r; Тень |c%sO|r цвета со смещением (%s, %s);%s%s%s"
L["|cFFffcc00Format Options|r"] = "|cFFFFCC00Параметры форматирования|r"
--[[Translation missing --]]
L[ [=[• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.
• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.
|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.
• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.
• |cffffff00Smart Group|r adjusts to your current group type, matching just the "player" when solo, "party" units (including "player") in a party or "raid" units in a raid.
• |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.
|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.
|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting.]=] ] = [=[• |cff00ff00Player|r, |cff00ff00Target|r, |cff00ff00Focus|r, and |cff00ff00Pet|r correspond directly to those individual unitIDs.
• |cff00ff00Specific Unit|r lets you provide a specific valid unitID to watch.
|cffff0000Note|r: The game will not fire events for all valid unitIDs, making some untrackable by this trigger.
• |cffffff00Party|r, |cffffff00Raid|r, |cffffff00Boss|r, |cffffff00Arena|r, and |cffffff00Nameplate|r can match multiple corresponding unitIDs.
• |cffffff00Smart Group|r adjusts to your current group type, matching just the "player" when solo, "party" units (including "player") in a party or "raid" units in a raid.
• |cffffff00Multi-target|r attempts to use the Combat Log events, rather than unitID, to track affected units.
|cffff0000Note|r: Without a direct relationship to actual unitIDs, results may vary.
|cffffff00*|r Yellow Unit settings can match multiple units and will default to being active even while no affected units are found without a Unit Count or Match Count setting.]=]
L["1 Match"] = "1 cовпадение"
L["A 20x20 pixels icon"] = "Иконка 20х20 пикселей"
L["A 32x32 pixels icon"] = "Иконка 32х32 пикселей"
@@ -53,9 +142,15 @@ local L = WeakAuras.L
L["A 48x48 pixels icon"] = "Иконка 48х48 пикселей"
L["A 64x64 pixels icon"] = "Иконка 64х64 пикселей"
L["A group that dynamically controls the positioning of its children"] = "Группа, динамически изменяющая позиции своих индикаций"
L[ [=[A timer will automatically be displayed according to default Interface Settings (overridden by some addons).
Enable this setting if you want this timer to be hidden, or when using a WeakAuras text to display the timer]=] ] = [=[Отсчет времени будет отображаться в соответствии с настройками интерфейса (переопределено некоторыми аддонами).
Включите этот параметр, если вы хотите скрыть этот отсчет или использовать текст WeakAuras для его отображения.]=]
L["A Unit ID (e.g., party1)."] = [=[Введите идентификатор единицы (UID, Unit ID).
Например: party4, raid7, arena3, boss2, nameplate6, target, focus, pet и др.]=]
L["Actions"] = "Действия"
--[[Translation missing --]]
L["Active Aura Filters and Info"] = "Active Aura Filters and Info"
L["Add"] = "Добавить"
L["Add %s"] = "%s"
L["Add a new display"] = "Добавить новую индикацию"
@@ -84,6 +179,7 @@ local L = WeakAuras.L
L["Anchor Point"] = "Точка крепления"
L["Anchored To"] = "Прикрепить к"
L["And "] = "И "
L["and"] = "и"
L["and aligned left"] = "Выравнивание по левому краю;"
L["and aligned right"] = "Выравнивание по правому краю;"
L["and rotated left"] = "Текст повернут вверх;"
@@ -111,12 +207,13 @@ local L = WeakAuras.L
L["Arcane Orb"] = "Чародейский шар"
L["At a position a bit left of Left HUD position."] = "Немного левее позиции левого HUD"
L["At a position a bit left of Right HUD position"] = "Немного правее позиции правого HUD"
L["At the same position as Blizzard's spell alert"] = "В таком же положении, как предупреждение заклинаний Blizzard"
L["At the same position as Blizzard's spell alert"] = "В таком же положении, что и предупреждение о заклинаниях Blizzard"
L[ [=[Aura is
Off Screen]=] ] = [=[Индикация за
пределами экрана]=]
L["Aura Name"] = "Название эффекта"
L["Aura Name Pattern"] = "Образец названия эффекта"
L["Aura received from: %s"] = "Индикация получена от: %s"
L["Aura Type"] = "Тип эффекта"
L["Aura(s)"] = "Эффекты"
L["Author Options"] = "Параметры автора"
@@ -158,9 +255,12 @@ Off Screen]=] ] = [=[Индикация за
L["Can be a Name or a Unit ID (e.g. party1). A name only works on friendly players in your group."] = "Введите имя или идентификатор единицы (Unit ID). Имена работают только для игроков, находящихся в вашей группе."
L["Can be a UID (e.g., party1)."] = [=[Введите идентификатор единицы (UID, Unit ID).
Например: party4, raid7, arena3, boss2, nameplate6, target, focus, pet и др.]=]
L["Can set to 0 if Columns * Width equal File Width"] = "Можно указать 0 в качестве значения, если последовательность изображений занимает всю ширину текстуры (т. е. произведение количества столбцов и ширины кадра равно ширине текстуры)"
L["Can set to 0 if Rows * Height equal File Height"] = "Можно указать 0 в качестве значения, если последовательность изображений занимает всю высоту текстуры (т. е. произведение количества строк и высоты кадра равно высоте текстуры)"
L["Cancel"] = "Отмена"
L["Cast by Player Character"] = "Применён игроком"
L["Cast by Players"] = "Применён игроком"
--[[Translation missing --]]
L["Cast by a Player Character"] = "Cast by a Player Character"
L["Categories to Update"] = "Категории для обновления"
L["Center"] = "Центр"
L["Chat Message"] = "Сообщение в чат"
L["Chat with WeakAuras experts on our Discord server."] = "Общайтесь со знатоками WeakAuras на нашем сервере Discord."
@@ -172,16 +272,18 @@ Off Screen]=] ] = [=[Индикация за
L["Clip Overlays"] = "Обрезать наложения"
L["Clipped by Progress"] = "Ограничить прогрессом"
L["Close"] = "Закрыть"
L["Code Editor"] = "Редактор кода"
L["Collapse"] = "Свернуть"
L["Collapse all loaded displays"] = "Свернуть все загруженные индикации"
L["Collapse all non-loaded displays"] = "Свернуть все не загруженные индикации"
L["Collapse all pending Import"] = "Свернуть все индикации, ожидающие импорта"
L["Collapsible Group"] = "Свёртываемая группа"
L["color"] = "цвет"
L["Color"] = "Цвет"
L["Column Height"] = "Высота столбца"
L["Column Space"] = "Отступ между столбцами"
L["Columns"] = "Столбцы"
L["Combinations"] = "Логические операции"
L["Combinations"] = "Комбинации"
L["Combine Matches Per Unit"] = "Объединить совпадения для каждой единицы"
L["Common Text"] = "Общие параметры текста"
L["Compare against the number of units affected."] = "Сравнение с количеством единиц, находящихся под действием эффекта."
@@ -195,6 +297,8 @@ Off Screen]=] ] = [=[Индикация за
L["Controls the positioning and configuration of multiple displays at the same time"] = "Управляет позиционированием и настройкой нескольких индикаций одновременно"
L["Convert to New Aura Trigger"] = "Преобразовать в новую версию триггера"
L["Convert to..."] = "Преобразовать в ..."
--[[Translation missing --]]
L["Cooldown Reduction changes the duration of seconds instead of showing the real time seconds."] = "Cooldown Reduction changes the duration of seconds instead of showing the real time seconds."
L["Cooldown Edge"] = "Эффект Edge (кромка)"
L["Cooldown Settings"] = "Настройки восстановления"
L["Cooldown Swipe"] = "Эффект Swipe (затемнение)"
@@ -204,8 +308,10 @@ Off Screen]=] ] = [=[Индикация за
L["Could not parse '%s'. Expected a table."] = "Не удалось разобрать переменную %s. Требуется таблица."
L["Count"] = "Количество"
L["Counts the number of matches over all units."] = "Сравнение с количеством совпадений для всех единиц."
L["Creating buttons: "] = "Создание кнопок:"
L["Creating options: "] = "Создание настроек:"
--[[Translation missing --]]
L["Create a Copy"] = "Create a Copy"
L["Creating buttons: "] = "Создание кнопок: "
L["Creating options: "] = "Создание параметров: "
L["Crop X"] = "Обрезать по X"
L["Crop Y"] = "Обрезать по Y"
L["Custom"] = "Самостоятельно"
+24 -11
View File
@@ -56,25 +56,37 @@ local colorScheme = {
}
local function ConstructCodeReview(frame)
local group = AceGUI:Create("InlineGroup");
local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 30);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide();
group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
title:SetText(L["Custom Code Viewer"])
group:AddChild(title)
local codeTree = AceGUI:Create("TreeGroup");
codeTree:SetTreeWidth(300, false)
codeTree:SetFullWidth(true)
codeTree:SetFullHeight(true)
codeTree:SetLayout("flow")
codeTree.dragger:Hide()
codeTree.border:SetBackdrop(nil)
codeTree.content:SetAllPoints()
group.codeTree = codeTree;
group:SetLayout("fill");
group:AddChild(codeTree);
local codebox = AceGUI:Create("MultiLineEditBox");
codebox.frame:SetAllPoints(codeTree.content);
codebox.frame:SetFrameStrata("FULLSCREEN");
codebox:SetLabel("");
group:AddChild(codebox);
codebox:DisableButton(true)
codebox:SetFullWidth(true)
codebox:SetFullHeight(true)
codeTree:AddChild(codebox)
codebox.button:Hide();
IndentationLib.enable(codebox.editBox, colorScheme, 4);
local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium");
if(fontPath) then
@@ -92,7 +104,7 @@ local function ConstructCodeReview(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
cancel:SetScript("OnClick", function() group:Close() end);
cancel:SetPoint("bottomright", frame, "bottomright", -27, 11);
cancel:SetPoint("BOTTOMRIGHT", -20, -24);
cancel:SetHeight(20);
cancel:SetWidth(100);
cancel:SetText(L["Okay"]);
@@ -102,16 +114,17 @@ local function ConstructCodeReview(frame)
return
end
local _, firstEntry = next(data)
self.data = data;
self.codeTree:SetTree(data);
self.codeTree:SelectByValue(firstEntry.value)
WeakAuras.ShowOptions();
frame.window = "codereview";
frame:UpdateFrameVisible()
end
function group.Close()
frame.window = "default";
frame.window = "update";
frame:UpdateFrameVisible()
end
+28 -34
View File
@@ -121,21 +121,18 @@ local function ConstructIconPicker(frame)
function group.Pick(self, texturePath)
local valueToPath = OptionsPrivate.Private.ValueToPath
if(not self.groupIcon and self.baseObject.controlledChildren) then
for index, childId in pairs(self.baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
valueToPath(childData, self.paths[childId], texturePath)
WeakAuras.Add(childData)
WeakAuras.ClearAndUpdateOptions(childData.id)
WeakAuras.UpdateThumbnail(childData);
end
end
else
if self.groupIcon then
valueToPath(self.baseObject, self.paths[self.baseObject.id], texturePath)
WeakAuras.Add(self.baseObject)
WeakAuras.ClearAndUpdateOptions(self.baseObject.id)
WeakAuras.UpdateThumbnail(self.baseObject)
else
for child in OptionsPrivate.Private.TraverseLeafsOrAura(self.baseObject) do
valueToPath(child, self.paths[child.id], texturePath)
WeakAuras.Add(child)
WeakAuras.ClearAndUpdateOptions(child.id)
WeakAuras.UpdateThumbnail(child);
end
end
local success = icon:SetTexture(texturePath) and texturePath;
if(success) then
@@ -150,18 +147,17 @@ local function ConstructIconPicker(frame)
self.baseObject = baseObject
self.paths = paths
self.groupIcon = groupIcon
if(not groupIcon and baseObject.controlledChildren) then
self.givenPath = {};
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local value = valueFromPath(childData, paths[childId])
self.givenPath[childId] = value;
end
end
else
if groupIcon then
local value = valueFromPath(self.baseObject, paths[self.baseObject.id])
self.givenPath = value
else
self.givenPath = {};
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
if(child) then
local value = valueFromPath(child, paths[child.id])
self.givenPath[child.id] = value or "";
end
end
end
-- group:Pick(self.givenPath);
frame.window = "icon";
@@ -177,24 +173,22 @@ local function ConstructIconPicker(frame)
function group.CancelClose()
local valueToPath = OptionsPrivate.Private.ValueToPath
if(not group.groupIcon and group.baseObject.controlledChildren) then
for index, childId in pairs(group.baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
if (group.givenPath[childId]) then
valueToPath(childData, group.paths[childId], group.givenPath[childId])
WeakAuras.Add(childData);
WeakAuras.ClearAndUpdateOptions(childData.id)
WeakAuras.UpdateThumbnail(childData);
end
end
end
else
if group.groupIcon then
valueToPath(group.baseObject, group.paths[group.baseObject.id], group.givenPath)
WeakAuras.Add(group.baseObject)
WeakAuras.ClearAndUpdateOptions(group.baseObject.id)
WeakAuras.UpdateThumbnail(group.baseObject)
else
for child in OptionsPrivate.Private.TraverseLeafsOrAura(group.baseObject) do
if (group.givenPath[child.id]) then
valueToPath(child, group.paths[child.id], group.givenPath[child.id])
WeakAuras.Add(child);
WeakAuras.ClearAndUpdateOptions(child.id)
WeakAuras.UpdateThumbnail(child);
end
end
end
group.Close();
end
+25 -35
View File
@@ -5,7 +5,7 @@ local AddonName, OptionsPrivate = ...
local strtrim, strsub = strtrim, strsub
-- WoW APIs
local CreateFrame = CreateFrame
local GetTime, CreateFrame = GetTime, CreateFrame
local AceGUI = LibStub("AceGUI-3.0")
@@ -15,26 +15,31 @@ local L = WeakAuras.L
local importexport
local function ConstructImportExport(frame)
local group = AceGUI:Create("InlineGroup");
local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 12);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide();
group:SetLayout("fill");
group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
group:AddChild(title)
local input = AceGUI:Create("MultiLineEditBox");
input:SetWidth(400);
input.button:Hide();
--input.frame:SetClipsChildren(true);
input:DisableButton(true)
input:SetFullWidth(true)
input:SetFullHeight(true)
group:AddChild(input);
local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
close:SetScript("OnClick", function() group:Close() end);
close:SetPoint("BOTTOMRIGHT", -27, 13);
close:SetPoint("BOTTOMRIGHT", -20, -24);
close:SetFrameLevel(close:GetFrameLevel() + 1)
close:SetHeight(20);
close:SetWidth(100);
close:SetText(L["Done"])
close:SetText(L["Close"])
function group.Open(self, mode, id)
if(frame.window == "texture") then
@@ -47,16 +52,17 @@ local function ConstructImportExport(frame)
frame.window = "importexport";
frame:UpdateFrameVisible()
if(mode == "export" or mode == "table") then
title:SetText(L["Exporting"])
if(id) then
local displayStr;
if(mode == "export") then
displayStr = WeakAuras.DisplayToString(id, true);
displayStr = OptionsPrivate.Private.DisplayToString(id, true);
elseif(mode == "table") then
displayStr = OptionsPrivate.Private.DataToString(id);
end
input.editBox:SetMaxBytes(nil);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
input.editBox:SetScript("OnTextChanged", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end);
input:SetLabel(id.." - "..#displayStr);
input.button:Hide();
@@ -65,37 +71,21 @@ local function ConstructImportExport(frame)
input:SetFocus();
end
elseif(mode == "import") then
local textBuffer, i, lastPaste = {}, 0
local function clearBuffer(self)
lastPaste = nil
self:SetScript('OnUpdate', nil)
local pasted = strtrim(table.concat(textBuffer))
input.editBox:ClearFocus();
pasted = pasted:match( "^%s*(.-)%s*$" );
if (#pasted > 20) then
WeakAuras.Import(pasted);
input:SetLabel(L["Processed %i chars"]:format(i));
input.editBox:SetMaxBytes(2500);
input.editBox:SetText(strsub(pasted, 1, 2500));
title:SetText(L["Importing"])
input.editBox:SetScript("OnTextChanged", function(self)
local pasted = self:GetText()
pasted = pasted:match("^%s*(.-)%s*$")
if #pasted > 20 then
WeakAuras.Import(pasted)
end
end
input.editBox:SetScript('OnChar', function(self, c)
if not lastPaste then
textBuffer, i, lastPaste = {}, 0, 1
self:SetScript('OnUpdate', clearBuffer)
end
i = i + 1
textBuffer[i] = c
end)
input.editBox:SetText("");
input.editBox:SetMaxBytes(2500);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnMouseUp", nil);
input:SetLabel(L["Paste text below"]);
input:SetFocus();
end
group:DoLayout()
end
function group.Close(self)
+76 -53
View File
@@ -20,31 +20,23 @@ local function GetAll(baseObject, path, property, default)
if not property then
return default
end
if baseObject.controlledChildren then
local result
local first = true
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local childObject = valueFromPath(childData, path)
if childObject and childObject[property] then
if first then
result = childObject[property]
first = false
else
if result ~= childObject[property] then
return default
end
local result = default
local first = true
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local childObject = valueFromPath(child, path)
if childObject and childObject[property] then
if first then
result = childObject[property]
first = false
else
if result ~= childObject[property] then
return default
end
end
end
return result
else
local object = valueFromPath(baseObject, path)
if object and object[property] then
return object[property]
end
return default
end
return result
end
local function ConstructModelPicker(frame)
@@ -161,11 +153,19 @@ local function ConstructModelPicker(frame)
group:Pick(nil, nil, nil, modelPickerY:GetValue());
end);
local modelPickerRotation = AceGUI:Create("Slider");
modelPickerRotation:SetSliderValues(0, 360, 0.05);
modelPickerRotation:SetLabel(L["Rotation"]);
modelPickerRotation.frame:SetParent(group.frame);
modelPickerRotation:SetCallback("OnValueChanged", function()
group:Pick(nil, nil, nil, nil, modelPickerRotation:GetValue());
end);
local modelTree = AceGUI:Create("WeakAurasTreeGroup");
group.modelTree = modelTree;
group.frame:SetScript("OnUpdate", function()
group.frame:SetScript("OnSizeChanged", function()
local frameWidth = frame:GetWidth();
local sliderWidth = (frameWidth - 50) / 3;
local sliderWidth = (frameWidth - 50) / 4;
local narrowSliderWidth = (frameWidth - 50) / 7;
modelTree:SetTreeWidth(frameWidth - 370);
@@ -178,6 +178,9 @@ local function ConstructModelPicker(frame)
modelPickerY.frame:SetPoint("bottomleft", frame, "bottomleft", 35 + (2 * sliderWidth), 43);
modelPickerY.frame:SetPoint("bottomright", frame, "bottomleft", 35 + (3 * sliderWidth), 43);
modelPickerRotation.frame:SetPoint("bottomleft", frame, "bottomleft", 45 + (3 * sliderWidth), 43);
modelPickerRotation.frame:SetPoint("bottomright", frame, "bottomleft", 45 + (4 * sliderWidth), 43);
end);
group:SetLayout("fill");
modelTree:SetTree(WeakAuras.ModelPaths);
@@ -194,7 +197,26 @@ local function ConstructModelPicker(frame)
model:SetFrameStrata("FULLSCREEN");
group.model = model;
local function SetOnObject(object, model_path, model_z, model_x, model_y)
local startX, rotation
local function OnUpdateScript()
local uiScale, x = UIParent:GetEffectiveScale(), GetCursorPosition()
local screenW, screenH = GetScreenWidth(), GetScreenHeight()
local diffX = startX/uiScale - x/uiScale
rotation = (rotation + 180 / screenW * diffX) % 360
model:SetFacing(rad(rotation))
end
model:EnableMouse()
model:SetScript("OnMouseDown", function(self)
startX = GetCursorPosition()
rotation = group.selectedValues.rotation or 0
self:SetScript("OnUpdate", OnUpdateScript)
end)
model:SetScript("OnMouseUp", function(self)
self:SetScript("OnUpdate", nil)
group:Pick(nil, nil, nil, nil, rotation)
end)
local function SetOnObject(object, model_path, model_z, model_x, model_y, rotation)
if model_path then
object.model_path = model_path
end
@@ -207,37 +229,31 @@ local function ConstructModelPicker(frame)
if model_y then
object.model_y = model_y
end
if rotation then
object.rotation = rotation
end
end
function group.Pick(self, model_path, model_z, model_x, model_y)
function group.Pick(self, model_path, model_z, model_x, model_y, rotation)
local valueFromPath = OptionsPrivate.Private.ValueFromPath
self.selectedValues.model_path = model_path or self.selectedValues.model_path
self.selectedValues.model_x = model_x or self.selectedValues.model_x
self.selectedValues.model_y = model_y or self.selectedValues.model_y
self.selectedValues.model_z = model_z or self.selectedValues.model_z
self.selectedValues.rotation = rotation or self.selectedValues.rotation
WeakAuras.SetModel(self.model, self.selectedValues.model_path)
self.model:SetPosition(self.selectedValues.model_z, self.selectedValues.model_x, self.selectedValues.model_y);
self.model:SetFacing(rad(self.selectedValues.rotation));
if(self.baseObject.controlledChildren) then
for index, childId in pairs(self.baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local object = valueFromPath(childData, self.path)
if(object) then
SetOnObject(object, model_path, model_z, model_x, model_y)
WeakAuras.Add(childData)
WeakAuras.UpdateThumbnail(childData)
end
end
else
local object = valueFromPath(self.baseObject, self.path)
if object then
SetOnObject(object, model_path, model_z, model_x, model_y)
WeakAuras.Add(self.baseObject)
WeakAuras.UpdateThumbnail(self.baseObject)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(self.baseObject) do
local object = valueFromPath(child, self.path)
if(object) then
SetOnObject(object, model_path, model_z, model_x, model_y, rotation)
WeakAuras.Add(child)
WeakAuras.UpdateThumbnail(child)
end
end
end
@@ -266,20 +282,24 @@ local function ConstructModelPicker(frame)
modelPickerX.editbox:SetText(("%.2f"):format(self.selectedValues.model_x));
modelPickerY:SetValue(self.selectedValues.model_y);
modelPickerY.editbox:SetText(("%.2f"):format(self.selectedValues.model_y));
modelPickerRotation:SetValue(self.selectedValues.rotation);
modelPickerRotation.editbox:SetText(("%.2f"):format(self.selectedValues.rotation));
if(baseObject.controlledChildren) then
self.givenModel = {};
self.givenZ = {};
self.givenX = {};
self.givenY = {};
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local object = valueFromPath(childData, path)
self.givenRotation = {};
for child in OptionsPrivate.Private.TraverseLeafs(baseObject) do
local childId = child.id
local object = valueFromPath(child, path)
if(object) then
self.givenModel[childId] = object.model_path;
self.givenZ[childId] = object.model_z;
self.givenX[childId] = object.model_x;
self.givenY[childId] = object.model_y;
self.givenRotation[childId] = object.rotation;
end
end
else
@@ -289,6 +309,7 @@ local function ConstructModelPicker(frame)
self.givenZ = object.model_z;
self.givenX = object.model_x;
self.givenY = object.model_y;
self.givenRotation = object.rotation;
end
frame.window = "model";
frame:UpdateFrameVisible()
@@ -300,31 +321,33 @@ local function ConstructModelPicker(frame)
WeakAuras.FillOptions()
end
function group.CancelClose(self)
function group.CancelClose()
local valueFromPath = OptionsPrivate.Private.ValueFromPath
if(group.baseObject.controlledChildren) then
for index, childId in pairs(group.baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
local object = valueFromPath(childData, self.path)
for child in OptionsPrivate.Private.TraverseLeafs(group.baseObject) do
local childId = child.id
local object = valueFromPath(child, group.path)
if(object) then
object.model_path = group.givenModel[childId];
object.model_z = group.givenZ[childId];
object.model_x = group.givenX[childId];
object.model_y = group.givenY[childId];
WeakAuras.Add(childData);
WeakAuras.UpdateThumbnail(childData);
object.rotation = group.givenRotation[childId];
WeakAuras.Add(child);
WeakAuras.UpdateThumbnail(child);
end
end
else
local object = valueFromPath(self.baseObject, self.path)
local object = valueFromPath(group.baseObject, group.path)
if(object) then
object.model_path = group.givenModel
object.model_z = group.givenZ
object.model_x = group.givenX
object.model_y = group.givenY
WeakAuras.Add(self.baseObject);
WeakAuras.UpdateThumbnail(self.baseObject);
object.rotation = group.givenRotation
WeakAuras.Add(group.baseObject);
WeakAuras.UpdateThumbnail(group.baseObject);
end
end
group.Close();
+8 -19
View File
@@ -45,12 +45,7 @@ local function moveOnePxl(direction)
WeakAuras.Add(data, nil, true)
WeakAuras.UpdateThumbnail(data)
OptionsPrivate.ResetMoverSizer()
if data.parent then
local parentData = WeakAuras.GetData(data.parent)
if parentData then
WeakAuras.Add(parentData)
end
end
OptionsPrivate.Private.AddParents(data)
WeakAuras.FillOptions()
end
end
@@ -382,11 +377,9 @@ local function BuildAlignLines(mover)
y = {}
}
local x, y = {}, {}
local skipIds = { [data.id] = true }
if data.controlledChildren then
for _, id in pairs(data.controlledChildren) do
skipIds[id] = true
end
local skipIds = {}
for child in OptionsPrivate.Private.TraverseAll(data) do
skipIds[child.id] = true
end
for k, v in pairs(WeakAuras.displayButtons) do
@@ -400,8 +393,8 @@ local function BuildAlignLines(mover)
tinsert(y, (region:GetBottom() or 0) * scale)
else
local centerX, centerY = region:GetCenter()
tinsert(x, centerX or 0 * scale)
tinsert(y, centerY or 0 * scale)
tinsert(x, (centerX or 0) * scale)
tinsert(y, (centerY or 0) * scale)
end
end
end
@@ -657,12 +650,7 @@ local function ConstructMoverSizer(parent)
mover:SetHeight(region:GetHeight() * scale)
mover:SetPoint(mover.selfPoint, mover.anchor, mover.anchorPoint, xOff * scale, yOff * scale)
end
if data.parent then
local parentData = db.displays[data.parent]
if parentData then
WeakAuras.Add(parentData)
end
end
OptionsPrivate.Private.AddParents(data)
WeakAuras.FillOptions()
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
-- hide alignment lines
@@ -767,6 +755,7 @@ local function ConstructMoverSizer(parent)
region:ResetPosition()
WeakAuras.Add(data, nil, true)
OptionsPrivate.Private.AddParents(data)
WeakAuras.UpdateThumbnail(data)
frame:ScaleCorners(region:GetWidth(), region:GetHeight())
+197 -121
View File
@@ -20,7 +20,6 @@ local L = WeakAuras.L
local displayButtons = WeakAuras.displayButtons
local regionOptions = WeakAuras.regionOptions
local tempGroup = OptionsPrivate.tempGroup
local prettyPrint = WeakAuras.prettyPrint
local aceOptions = {}
local function CreateDecoration(frame)
@@ -140,16 +139,17 @@ function OptionsPrivate.CreateFrame()
local odb = OptionsPrivate.savedVars.odb
-------- Mostly Copied from AceGUIContainer-Frame--------
frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent)
tinsert(UISpecialFrames, frame:GetName())
frame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
bgFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
frame:SetBackdropColor(0, 0, 0, 1)
frame:SetBackdropColor(0.1, 0.1, 0.1, 0.85)
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetResizable(true)
@@ -274,6 +274,7 @@ function OptionsPrivate.CreateFrame()
self.iconPicker.frame:Hide()
self.modelPicker.frame:Hide()
self.importexport.frame:Hide()
self.update.frame:Hide()
self.texteditor.frame:Hide()
self.codereview.frame:Hide()
if self.newView then
@@ -346,7 +347,11 @@ function OptionsPrivate.CreateFrame()
self.newView.frame:Hide()
end
end
if self.window == "update" then
self.update.frame:Show()
else
self.update.frame:Hide()
end
if self.window == "default" then
if self.loadProgessVisible then
self.loadProgress:Show()
@@ -482,7 +487,7 @@ function OptionsPrivate.CreateFrame()
addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."])
if not WeakAurasCompanion then
if not OptionsPrivate.Private.CompanionData.slugs then
addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf",
L["Keep your Wago imports up to date with the Companion App."])
end
@@ -518,7 +523,6 @@ function OptionsPrivate.CreateFrame()
container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14)
container.frame:Show()
--container.frame:SetClipsChildren(true)
container.titletext:Hide()
-- Hide the border
container.content:GetParent():SetBackdrop(nil)
@@ -532,6 +536,7 @@ function OptionsPrivate.CreateFrame()
frame.importexport = OptionsPrivate.ImportExport(frame)
frame.texteditor = OptionsPrivate.TextEditor(frame)
frame.codereview = OptionsPrivate.CodeReview(frame)
frame.update = OptionsPrivate.UpdateFrame(frame)
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
@@ -596,7 +601,7 @@ function OptionsPrivate.CreateFrame()
else
self.Instructions:Hide()
end
WeakAuras.SortDisplayButtons(filterInput:GetText())
OptionsPrivate.SortDisplayButtons(filterInput:GetText())
end)
filterInput:SetHeight(15)
filterInput:SetPoint("TOP", frame, "TOP", 0, -44)
@@ -715,10 +720,8 @@ function OptionsPrivate.CreateFrame()
-- override SetScroll to make children visible as needed
local oldSetScroll = buttonsScroll.SetScroll
buttonsScroll.SetScroll = function(self, value)
if self:GetScrollPos() ~= value then
oldSetScroll(self, value)
self.LayoutFunc(self.content, self.children, true)
end
oldSetScroll(self, value)
self.LayoutFunc(self.content, self.children, true)
end
function buttonsScroll:SetScrollPos(top, bottom)
@@ -746,20 +749,53 @@ function OptionsPrivate.CreateFrame()
status.scrollvalue = status.offset / ((height - viewheight) / 1000.0)
end
local numAddons = 0
for addon, addonData in pairs(OptionsPrivate.Private) do
numAddons = numAddons + 1
-- Ready to Install section
local pendingInstallButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
pendingInstallButton:SetText(L["Ready for Install"])
pendingInstallButton:Disable()
pendingInstallButton:EnableExpand()
pendingInstallButton.frame.view:Hide()
if odb.pendingImportCollapse then
pendingInstallButton:Collapse()
else
pendingInstallButton:Expand()
end
pendingInstallButton:SetOnExpandCollapse(function()
if pendingInstallButton:GetExpanded() then
odb.pendingImportCollapse = nil
else
odb.pendingImportCollapse = true
end
OptionsPrivate.SortDisplayButtons()
end)
pendingInstallButton:SetExpandDescription(L["Expand all pending Import"])
pendingInstallButton:SetCollapseDescription(L["Collapse all pending Import"])
frame.pendingInstallButton = pendingInstallButton
if numAddons > 0 then
local addonsButton = AceGUI:Create("WeakAurasNewHeaderButton")
addonsButton:SetText(L["Addons"])
addonsButton:SetDescription(L["Manage displays defined by Addons"])
addonsButton:SetClick(function() frame:PickOption("Addons") end)
frame.addonsButton = addonsButton
-- Ready for update section
local pendingUpdateButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
pendingUpdateButton:SetText(L["Ready for Update"])
pendingUpdateButton:Disable()
pendingUpdateButton:EnableExpand()
pendingUpdateButton.frame.view:Hide()
if odb.pendingUpdateCollapse then
pendingUpdateButton:Collapse()
else
pendingUpdateButton:Expand()
end
pendingUpdateButton:SetOnExpandCollapse(function()
if pendingUpdateButton:GetExpanded() then
odb.pendingUpdateCollapse = nil
else
odb.pendingUpdateCollapse = true
end
OptionsPrivate.SortDisplayButtons()
end)
pendingUpdateButton:SetExpandDescription(L["Expand all pending Import"])
pendingUpdateButton:SetCollapseDescription(L["Collapse all pending Import"])
frame.pendingUpdateButton = pendingUpdateButton
-- Loaded section
local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
loadedButton:SetText(L["Loaded"])
loadedButton:Disable()
@@ -775,28 +811,30 @@ function OptionsPrivate.CreateFrame()
else
odb.loadedCollapse = true
end
WeakAuras.SortDisplayButtons()
OptionsPrivate.SortDisplayButtons()
end)
loadedButton:SetExpandDescription(L["Expand all loaded displays"])
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
loadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
if loadedButton.view.func() == 2 then
if loadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
child:PriorityHide(2)
end
end
loadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
child:PriorityShow(2)
end
end
loadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
end)
loadedButton:SetViewTest(function()
loadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
@@ -808,17 +846,23 @@ function OptionsPrivate.CreateFrame()
end
end
end
local newVisibility
if all then
return 2
newVisibility = 2
elseif none then
return 0
newVisibility = 0
else
return 1
newVisibility = 1
end
end)
if newVisibility ~= self.view.visibility then
self.view.visibility = newVisibility
self:UpdateViewTexture()
end
end
loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"])
frame.loadedButton = loadedButton
-- Not Loaded section
local unloadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
unloadedButton:SetText(L["Not Loaded"])
unloadedButton:Disable()
@@ -834,28 +878,30 @@ function OptionsPrivate.CreateFrame()
else
odb.unloadedCollapse = true
end
WeakAuras.SortDisplayButtons()
OptionsPrivate.SortDisplayButtons()
end)
unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"])
unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"])
unloadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
if unloadedButton.view.func() == 2 then
if unloadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityHide(2)
end
end
unloadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityShow(2)
end
end
unloadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
end)
unloadedButton:SetViewTest(function()
unloadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
@@ -867,14 +913,19 @@ function OptionsPrivate.CreateFrame()
end
end
end
local newVisibility
if all then
return 2
newVisibility = 2
elseif none then
return 0
newVisibility = 0
else
return 1
newVisibility = 1
end
end)
if newVisibility ~= self.view.visibility then
self.view.visibility = newVisibility
self:UpdateViewTexture()
end
end
unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"])
frame.unloadedButton = unloadedButton
@@ -887,8 +938,8 @@ function OptionsPrivate.CreateFrame()
if data and data.parent then
frame:ClearOptions(data.parent)
end
for _, tmpId in ipairs(tempGroup.controlledChildren) do
if (id == tmpId) then
for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do
if (id == child.id) then
frame:ClearOptions(tempGroup.id)
end
end
@@ -906,10 +957,8 @@ function OptionsPrivate.CreateFrame()
data = tempGroup
end
if data.controlledChildren then
for _, id in ipairs(data.controlledChildren) do
frame:ClearOptions(id)
end
for child in OptionsPrivate.Private.TraverseAllChildren(data) do
frame:ClearOptions(child.id)
end
end
if (type(self.pickedDisplay) == "string" and self.pickedDisplay == id)
@@ -1026,6 +1075,10 @@ function OptionsPrivate.CreateFrame()
AceConfigDialog:Open("WeakAuras", group)
tabsWidget:SetTitle("")
if data.controlledChildren and #data.controlledChildren == 0 then
WeakAurasOptions:NewAura()
end
end
frame.ClearPick = function(self, id)
@@ -1047,19 +1100,31 @@ function OptionsPrivate.CreateFrame()
self:FillOptions()
end
frame.OnRename = function(self, uid, oldid, newid)
if type(frame.pickedDisplay) == "string" and frame.pickedDisplay == oldid then
frame.pickedDisplay = newid
else
for i, childId in pairs(tempGroup.controlledChildren) do
if (childId == newid) then
tempGroup.controlledChildren[i] = newid
end
end
end
end
frame.ClearPicks = function(self, noHide)
OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do
button:ClearPick(true)
if not noHide then
button:PriorityHide(1)
button:SetVisibilityDirectly(0)
end
end
frame.pickedDisplay = nil
frame.pickedOption = nil
wipe(tempGroup.controlledChildren)
for id, button in pairs(displayButtons) do
button:ClearPick(noHide)
end
--newButton:ClearPick(noHide)
if frame.addonsButton then
frame.addonsButton:ClearPick(noHide)
end
loadedButton:ClearPick(noHide)
unloadedButton:ClearPick(noHide)
container:ReleaseChildren()
@@ -1071,30 +1136,46 @@ function OptionsPrivate.CreateFrame()
OptionsPrivate.ClearTriggerExpandState()
end
local function GetTarget(pickedDisplay)
local targetId
if pickedDisplay then
if type(pickedDisplay) == "table" and tempGroup.controlledChildren and tempGroup.controlledChildren[1] then
targetId = tempGroup.controlledChildren[1]
elseif type(pickedDisplay) == "string" then
targetId = pickedDisplay
frame.GetTargetAura = function(self)
if self.pickedDisplay then
if type(self.pickedDisplay) == "table" and tempGroup.controlledChildren and tempGroup.controlledChildren[1] then
return tempGroup.controlledChildren[1]
elseif type(self.pickedDisplay) == "string" then
return self.pickedDisplay
end
end
return targetId
return nil
end
frame.NewAura = function(self, fromGroup)
local targetId = GetTarget(self.pickedDisplay)
self:ClearPicks()
frame.NewAura = function(self)
local targetId
local targetIsDynamicGroup
if self.pickedDisplay then
if type(self.pickedDisplay) == "table" and tempGroup.controlledChildren and tempGroup.controlledChildren[1] then
targetId = tempGroup.controlledChildren[1]
WeakAuras.PickDisplay(targetId)
elseif type(self.pickedDisplay) == "string" then
targetId = self.pickedDisplay
else
self:ClearPicks()
end
end
if targetId then
local pickedButton = WeakAuras.GetDisplayButton(targetId)
if pickedButton then
pickedButton:Pick()
if pickedButton.data.controlledChildren then
targetIsDynamicGroup = pickedButton.data.regionType == "dynamicgroup"
else
local parent = pickedButton.data.parent
local parentData = parent and WeakAuras.GetData(parent)
targetIsDynamicGroup = parentData and parentData.regionType == "dynamicgroup"
end
end
self.moversizer:Hide()
self.pickedOption = "New"
container:ReleaseChildren()
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -8)
container:SetLayout("fill")
local border = AceGUI:Create("InlineGroup")
@@ -1119,7 +1200,7 @@ function OptionsPrivate.CreateFrame()
button:SetDescription(L["Offer a guided way to create auras for your character"])
button:SetIcon("Interface\\Icons\\INV_Misc_Book_06")
button:SetClick(function()
WeakAuras.OpenTriggerTemplate(nil, targetId)
OptionsPrivate.OpenTriggerTemplate(nil, self:GetTargetAura())
end)
containerScroll:AddChild(button)
@@ -1140,13 +1221,31 @@ function OptionsPrivate.CreateFrame()
tinsert(regionTypesSorted, regionType)
end
-- Sort group + dynamic group first, then the others alphabeticaly
table.sort(regionTypesSorted, function(a, b)
if (a == "group") then
return true
end
if (b == "group") then
return false
end
if (a == "dynamicgroup") then
return true
end
if (b == "dynamicgroup") then
return false
end
return regionOptions[a].displayName < regionOptions[b].displayName
end)
for index, regionType in ipairs(regionTypesSorted) do
local regionData = regionOptions[regionType]
if (not (fromGroup and (regionType == "group" or regionType == "dynamicgroup"))) then
if (targetIsDynamicGroup and (regionType == "group" or regionType == "dynamicgroup")) then
-- Dynamic groups can't contain group/dynamic groups
else
local regionData = regionOptions[regionType]
local button = AceGUI:Create("WeakAurasNewButton")
button:SetTitle(regionData.displayName)
if(type(regionData.icon) == "string" or type(regionData.icon) == "table") then
@@ -1154,7 +1253,7 @@ function OptionsPrivate.CreateFrame()
end
button:SetDescription(regionData.description)
button:SetClick(function()
WeakAuras.NewAura(nil, regionType, targetId)
WeakAuras.NewAura(nil, regionType, self:GetTargetAura())
end)
containerScroll:AddChild(button)
end
@@ -1213,50 +1312,22 @@ function OptionsPrivate.CreateFrame()
containerScroll:AddChild(importButton)
end
frame.PickOption = function(self, option, fromGroup)
local targetId = GetTarget(self.pickedDisplay)
self:ClearPicks()
if targetId then
local pickedButton = WeakAuras.GetDisplayButton(targetId)
if pickedButton then
pickedButton:Pick()
end
end
self.moversizer:Hide()
self.pickedOption = option
if option == "Addons" then
frame.addonsButton:Pick()
local containerScroll = AceGUI:Create("ScrollFrame")
containerScroll:SetLayout("AbsoluteList")
container:SetLayout("fill")
container:AddChild(containerScroll)
OptionsPrivate.CreateImportButtons()
WeakAuras.SortImportButtons(containerScroll)
else
error("An options button other than New or Addons was selected... but there are no other options buttons!")
end
end
frame.PickDisplay = function(self, id, tab, noHide)
if self.pickedDisplay == id then
return
end
OptionsPrivate.Private.PauseAllDynamicGroups()
self:ClearPicks(noHide)
local data = WeakAuras.GetData(id)
displayButtons[id]:Pick()
self.pickedDisplay = id
local function ExpandParents(data)
if data.parent then
if not displayButtons[data.parent]:GetExpanded() then
displayButtons[data.parent]:Expand()
end
local parentData = WeakAuras.GetData(data.parent)
ExpandParents(parentData)
end
end
frame.PickDisplay = function(self, id, tab, noHide)
local data = WeakAuras.GetData(id)
-- Always expand even if already picked
ExpandParents(data)
if OptionsPrivate.Private.loaded[id] ~= nil then
-- Under loaded
if not loadedButton:GetExpanded() then
@@ -1269,6 +1340,18 @@ function OptionsPrivate.CreateFrame()
end
end
if self.pickedDisplay == id then
return
end
OptionsPrivate.Private.PauseAllDynamicGroups()
self:ClearPicks(noHide)
displayButtons[id]:Pick()
self.pickedDisplay = id
if tab then
self.selectedTab = tab
end
@@ -1283,15 +1366,10 @@ function OptionsPrivate.CreateFrame()
self.buttonsScroll:SetScrollPos(yOffset, yOffset - 32)
end
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
displayButtons[childId]:PriorityShow(1)
end
end
if data.controlledChildren and #data.controlledChildren == 0 then
WeakAurasOptions:NewAura(true)
for child in OptionsPrivate.Private.TraverseAllChildren(data) do
displayButtons[child.id]:PriorityShow(1)
end
displayButtons[data.id]:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups()
end
@@ -1318,7 +1396,7 @@ function OptionsPrivate.CreateFrame()
else
local wasGroup = false
if type(self.pickedDisplay) == "string" then
if WeakAuras.GetData(self.pickedDisplay).controlledChildren then
if WeakAuras.GetData(self.pickedDisplay).controlledChildren or WeakAuras.GetData(id).controlledChildren then
wasGroup = true
elseif not OptionsPrivate.IsDisplayPicked(id) then
tinsert(tempGroup.controlledChildren, self.pickedDisplay)
@@ -1337,15 +1415,13 @@ function OptionsPrivate.CreateFrame()
end
frame.PickDisplayBatch = function(self, batchSelection)
local alreadySelected = {}
for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do
alreadySelected[child.id] = true
end
for index, id in ipairs(batchSelection) do
local alreadySelected = false
for _, v in pairs(tempGroup.controlledChildren) do
if v == id then
alreadySelected = true
break
end
end
if not alreadySelected then
if not alreadySelected[id] then
displayButtons[id]:Pick()
tinsert(tempGroup.controlledChildren, id)
end
+55 -45
View File
@@ -4,6 +4,7 @@ local AddonName, OptionsPrivate = ...
-- Lua APIs
local pairs, type, ipairs = pairs, type, ipairs
local loadstring = loadstring
local gsub = gsub
-- WoW APIs
local CreateFrame = CreateFrame
@@ -148,22 +149,40 @@ end]=]
}
local function ConstructTextEditor(frame)
local group = AceGUI:Create("InlineGroup")
local group = AceGUI:Create("WeakAurasInlineGroup")
group.frame:SetParent(frame)
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 12)
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10)
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide()
group:SetLayout("fill")
group:SetLayout("flow")
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
title:SetText(L["Code Editor"])
group:AddChild(title)
local editor = AceGUI:Create("MultiLineEditBox")
editor:SetWidth(400)
editor.button:Hide()
editor:SetFullWidth(true)
editor:SetFullHeight(true)
editor:DisableButton(true)
local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium")
if (fontPath) then
editor.editBox:SetFont(fontPath, 12)
end
group:AddChild(editor)
--editor.frame:SetClipsChildren(true)
local originalOnCursorChanged = editor.editBox:GetScript("OnCursorChanged")
editor.editBox:SetScript("OnCursorChanged", function(self, ...)
-- WORKAROUND the editbox sends spurious OnCursorChanged events if its resized
-- That makes AceGUI scroll the editbox to make the cursor visible, leading to unintended
-- movements. Prevent all of that by checking if the edit box has focus, as otherwise the cursor
-- is invisible, and we don't care about making it visible
if not self:HasFocus() then
return
end
originalOnCursorChanged(self, ...)
end)
-- The indention lib overrides GetText, but for the line number
-- display we ned the original, so save it here.
@@ -178,7 +197,7 @@ local function ConstructTextEditor(frame)
group:CancelClose()
end
)
cancel:SetPoint("BOTTOMRIGHT", -27, 13)
cancel:SetPoint("BOTTOMRIGHT", -20, -24)
cancel:SetFrameLevel(cancel:GetFrameLevel() + 1)
cancel:SetHeight(20)
cancel:SetWidth(100)
@@ -205,7 +224,7 @@ local function ConstructTextEditor(frame)
settings_frame:RegisterForClicks("LeftButtonUp")
local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
helpButton:SetPoint("BOTTOMLEFT", 12, 13)
helpButton:SetPoint("BOTTOMLEFT", 12, -24)
helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1)
helpButton:SetHeight(20)
helpButton:SetWidth(100)
@@ -220,11 +239,11 @@ local function ConstructTextEditor(frame)
urlText:Hide()
local urlCopyLabel = urlText:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
urlCopyLabel:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMLEFT", 12, 18)
urlCopyLabel:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMLEFT", 12, -20)
urlCopyLabel:SetText(L["Press Ctrl+C to copy"])
urlCopyLabel:Hide()
urlText:SetPoint("TOPLEFT", urlCopyLabel, "TOPRIGHT", 12, 13)
urlText:SetPoint("TOPLEFT", urlCopyLabel, "TOPRIGHT", 12, 0)
urlText:SetPoint("RIGHT", settings_frame, "LEFT")
local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate")
@@ -349,8 +368,9 @@ local function ConstructTextEditor(frame)
-- iterate saved snippets and make buttons
for order, snippet in ipairs(savedSnippets) do
local button = AceGUI:Create("WeakAurasSnippetButton")
local snippetInsert = gsub(snippet.snippet, "|", "||")
button:SetTitle(snippet.name)
button:SetDescription(snippet.snippet)
button:SetDescription(snippetInsert)
button:SetEditable(true)
button:SetRelativeWidth(1)
button:SetNew(snippet.new)
@@ -358,7 +378,7 @@ local function ConstructTextEditor(frame)
button:SetCallback(
"OnClick",
function()
editor.editBox:Insert(snippet.snippet)
editor.editBox:Insert(snippetInsert)
editor:SetFocus()
end
)
@@ -662,32 +682,34 @@ local function ConstructTextEditor(frame)
self.oldOnTextChanged(...)
end
)
if (data.controlledChildren and not setOnParent) then
if setOnParent then
editor:SetText(OptionsPrivate.Private.ValueFromPath(data, path) or "")
else
local singleText
local sameTexts = true
local combinedText = ""
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
local text
if multipath then
text = path[childId] and OptionsPrivate.Private.ValueFromPath(childData, path[childId])
text = path[child.id] and OptionsPrivate.Private.ValueFromPath(child, path[child.id])
else
text = OptionsPrivate.Private.ValueFromPath(childData, path)
text = OptionsPrivate.Private.ValueFromPath(child, path)
end
if text then
if not (singleText) then
singleText = text
else
if not (singleText == text) then
if singleText ~= text then
sameTexts = false
end
end
if not (combinedText == "") then
if combinedText ~= "" then
combinedText = combinedText .. "\n\n"
end
combinedText =
combinedText .. L["-- Do not remove this comment, it is part of this trigger: "] .. childId .. "\n"
combinedText .. L["-- Do not remove this comment, it is part of this aura: "] .. child.id .. "\n"
combinedText = combinedText .. (text or "")
end
end
@@ -698,8 +720,6 @@ local function ConstructTextEditor(frame)
editor:SetText(combinedText)
editor.combinedText = true
end
else
editor:SetText(OptionsPrivate.Private.ValueFromPath(data, path) or "")
end
editor:SetFocus()
end
@@ -711,13 +731,13 @@ local function ConstructTextEditor(frame)
frame:UpdateFrameVisible()
end
local function extractTexts(input, ids)
local function extractTexts(input)
local texts = {}
local currentPos, id, startIdLine, startId, endId, endIdLine
while (true) do
startIdLine, startId =
string.find(input, L["-- Do not remove this comment, it is part of this trigger: "], currentPos, true)
string.find(input, L["-- Do not remove this comment, it is part of this aura: "], currentPos, true)
if (not startId) then
break
end
@@ -749,31 +769,21 @@ local function ConstructTextEditor(frame)
end
function group.Close(self)
if (self.data.controlledChildren and not self.setOnParent) then
local textById = editor.combinedText and extractTexts(editor:GetText(), self.data.controlledChildren)
for index, childId in pairs(self.data.controlledChildren) do
local text = editor.combinedText and (textById[childId] or "") or editor:GetText()
local childData = WeakAuras.GetData(childId)
OptionsPrivate.Private.ValueToPath(childData, self.multipath and self.path[childId] or self.path, text)
WeakAuras.Add(childData)
end
else
if self.setOnParent then
OptionsPrivate.Private.ValueToPath(self.data, self.path, editor:GetText())
WeakAuras.Add(self.data)
end
if (self.reloadOptions) then
if (self.data.controlledChildren) then
for index, childId in pairs(self.data.controlledChildren) do
WeakAuras.ClearAndUpdateOptions(childId)
end
WeakAuras.ClearAndUpdateOptions(self.data.id)
else
WeakAuras.ClearAndUpdateOptions(self.data.id)
end
else
WeakAuras.ClearAndUpdateOptions(self.data.id)
local textById = editor.combinedText and extractTexts(editor:GetText())
for child in OptionsPrivate.Private.TraverseLeafsOrAura(self.data) do
local text = editor.combinedText and (textById[child.id] or "") or editor:GetText()
OptionsPrivate.Private.ValueToPath(child, self.multipath and self.path[child.id] or self.path, text)
WeakAuras.Add(child)
OptionsPrivate.ClearOptions(child.id)
end
end
WeakAuras.ClearAndUpdateOptions(self.data.id)
editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged)
editor:ClearFocus()
frame.window = "default"
@@ -42,52 +42,34 @@ local function GetAll(baseObject, path, property, default)
if not property then
return default
end
if baseObject.controlledChildren then
local result
local first = true
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local childObject = valueFromPath(childData, path)
if childObject and childObject[property] then
if first then
result = childObject[property]
first = false
else
if not CompareValues(result, childObject[property]) then
return default
end
local result = default
local first = true
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local childObject = valueFromPath(child, path)
if childObject and childObject[property] then
if first then
result = childObject[property]
first = false
else
if not CompareValues(result, childObject[property]) then
return default
end
end
end
return result
else
local object = valueFromPath(baseObject, path)
if object and object[property] then
return object[property]
end
return default
end
return result
end
local function SetAll(baseObject, path, property, value)
local valueFromPath = OptionsPrivate.Private.ValueFromPath
if baseObject.controlledChildren then
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local object = valueFromPath(childData, path)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local object = valueFromPath(child, path)
if object then
object[property] = value
WeakAuras.Add(childData)
WeakAuras.UpdateThumbnail(childData)
WeakAuras.Add(child)
WeakAuras.UpdateThumbnail(child)
end
end
else
local object = valueFromPath(baseObject, path)
if object then
object[property] = value
WeakAuras.Add(baseObject)
WeakAuras.UpdateThumbnail(baseObject)
end
end
end
@@ -114,7 +96,6 @@ local function ConstructTexturePicker(frame)
local scroll = AceGUI:Create("ScrollFrame");
scroll:SetWidth(540);
scroll:SetLayout("flow");
--scroll.frame:SetClipsChildren(true);
dropdown:AddChild(scroll);
local function texturePickerGroupSelected(widget, event, uniquevalue)
@@ -153,6 +134,7 @@ local function ConstructTexturePicker(frame)
dropdown:SetCallback("OnGroupSelected", texturePickerGroupSelected)
function group.UpdateList(self)
dropdown.dropdown.pullout:Close()
wipe(dropdown.list);
for categoryName, category in pairs(self.textures) do
local match = false;
@@ -198,21 +180,11 @@ local function ConstructTexturePicker(frame)
self.SetTextureFunc = SetTextureFunc
self.givenPath = {};
self.selectedTextures = {}
if(baseObject.controlledChildren) then
for index, childId in pairs(baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childObject = valueFromPath(childData, path)
if childObject and childObject[properties.texture] then
self.givenPath[childId] = childObject[properties.texture]
self.selectedTextures[childObject[properties.texture]] = true
end
end
end
else
local object = valueFromPath(baseObject, path)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(baseObject) do
local object = valueFromPath(child, path)
if object and object[properties.texture] then
self.givenPath[baseObject.id] = object[properties.texture]
self.givenPath[child.id] = object[properties.texture]
self.selectedTextures[object[properties.texture]] = true
end
end
@@ -262,24 +234,12 @@ local function ConstructTexturePicker(frame)
function group.CancelClose()
local valueFromPath = OptionsPrivate.Private.ValueFromPath
if(group.baseObject.controlledChildren) then
for index, childId in pairs(group.baseObject.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if(childData) then
local childObject = valueFromPath(childData, group.path)
if childObject then
childObject[group.properties.texture] = group.givenPath[childId]
WeakAuras.Add(childData);
WeakAuras.UpdateThumbnail(childData);
end
end
end
else
local object = valueFromPath(group.baseObject, group.path)
if object then
object[group.properties.texture] = group.givenPath[group.baseObject.id]
WeakAuras.Add(group.baseObject)
WeakAuras.UpdateThumbnail(group.baseObject)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(group.baseObject) do
local childObject = valueFromPath(child, group.path)
if childObject then
childObject[group.properties.texture] = group.givenPath[child.id]
WeakAuras.Add(child);
WeakAuras.UpdateThumbnail(child);
end
end
group.Close();
File diff suppressed because it is too large Load Diff
+24 -30
View File
@@ -178,12 +178,8 @@ local function createOptions(id, data)
func = function()
local path = {"displayIcon"}
local paths = {}
if data.controlledChildren then
for i, childId in pairs(data.controlledChildren) do
paths[childId] = path
end
else
paths[data.id] = path
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
paths[child.id] = path
end
OptionsPrivate.OpenIconPicker(data, paths)
end,
@@ -393,12 +389,32 @@ local function createOptions(id, data)
}
local index = 0.01
for id, display in ipairs(overlayInfo) do
options["overlaytexture" .. id] = {
type = "select",
dialogControl = "LSM30_Statusbar",
width = WeakAuras.doubleWidth,
name = string.format(L["%s Texture"], display),
values = AceGUIWidgetLSMlists.statusbar,
order = 58.1 + index,
set = function(info, texture)
if (not data.overlaysTexture) then
data.overlaysTexture = {};
end
data.overlaysTexture[id] = texture;
WeakAuras.Add(data);
end,
get = function()
if data.overlaysTexture and data.overlaysTexture[id] then
return data.overlaysTexture[id]
end
end
}
options["overlaycolor" .. id] = {
type = "color",
width = WeakAuras.normalWidth,
name = string.format(L["%s Color"], display),
hasAlpha = true,
order = 58 + index,
order = 58.2 + index,
get = function()
if (data.overlays and data.overlays[id]) then
return unpack(data.overlays[id]);
@@ -420,7 +436,7 @@ local function createOptions(id, data)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Clip Overlays"],
order = 58 + index;
order = 58.3 + index;
}
end
@@ -770,27 +786,5 @@ local function GetAnchors(data)
return anchorPoints;
end
local function subCreateOptions(parentData, data, index, subIndex)
local order = 9
local options = {
__title = L["Foreground"],
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "aurabar_bar")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "aurabar_bar")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__notcollapsable = true
}
return options
end
-- Register new region type options with WeakAuras
WeakAuras.RegisterRegionOptions("aurabar", createOptions, createIcon, L["Progress Bar"], createThumbnail, modifyThumbnail, L["Shows a progress bar with name, timer, and icon"], templates, GetAnchors);
WeakAuras.RegisterSubRegionOptions("aurabar_bar", subCreateOptions, L["Foreground"]);
@@ -134,12 +134,7 @@ local function createOptions(id, data)
order = 1.5,
width = WeakAuras.normalWidth,
name = L["Group by Frame"],
desc = L[
[[Group and anchor each auras by frame.
- Unit Frames: attach to unit frame buttons per unit.
- Custom Frames: choose which frame each region should be anchored to.]]
],
desc = L["Group and anchor each auras by frame.\n\n- Unit Frames: attach to unit frame buttons per unit.\n- Custom Frames: choose which frame each region should be anchored to."],
hidden = function() return data.grow == "CUSTOM" end,
},
anchorPerUnit = {
+67 -36
View File
@@ -54,40 +54,8 @@ local function getWidth(data, region)
end
end
-- Create region options table
local function createOptions(id, data)
-- Region options
local options = {
__title = L["Group Settings"],
__order = 1,
groupIcon = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
name = L["Group Icon"],
desc = L["Set Thumbnail Icon"],
order = 0.50,
get = function()
return data.groupIcon and tostring(data.groupIcon) or ""
end,
set = function(info, v)
data.groupIcon = v
WeakAuras.Add(data)
WeakAuras.UpdateThumbnail(data)
end
},
chooseIcon = {
type = "execute",
width = 0.15,
name = L["Choose"],
order = 0.51,
func = function()
OptionsPrivate.OpenIconPicker(data, { [data.id] = {"groupIcon"} }, true)
end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
local function createDistributeAlignOptions(id, data)
return {
align_h = {
type = "select",
width = WeakAuras.normalWidth,
@@ -551,7 +519,45 @@ local function createOptions(id, data)
WeakAuras.Add(data);
OptionsPrivate.ResetMoverSizer();
end
}
}
end
-- Create region options table
local function createOptions(id, data)
-- Region options
local options = {
__title = L["Group Settings"],
__order = 1,
groupIcon = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
name = L["Group Icon"],
desc = L["Set Thumbnail Icon"],
order = 0.50,
get = function()
return data.groupIcon and tostring(data.groupIcon) or ""
end,
set = function(info, v)
data.groupIcon = v
WeakAuras.Add(data)
WeakAuras.UpdateThumbnail(data)
end
},
chooseIcon = {
type = "execute",
width = 0.15,
name = L["Choose"],
order = 0.51,
func = function()
OptionsPrivate.OpenIconPicker(data, { [data.id] = {"groupIcon"} }, true)
end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
-- Alignment/Distribute options are added below
scale = {
type = "range",
width = WeakAuras.normalWidth,
@@ -581,8 +587,33 @@ local function createOptions(id, data)
},
};
for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
options[k] = v
local hasSubGroups = false
local hasDynamicSubGroup = false
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId);
if childData.controlledChildren then
hasSubGroups = true
end
if childData.regionType == "dynamicgroup" then
hasDynamicSubGroup = true
end
if hasSubGroups and hasDynamicSubGroup then
break
end
end
if not hasSubGroups then
for k, v in pairs(createDistributeAlignOptions(id, data)) do
options[k] = v
end
end
if not hasDynamicSubGroup then
for k, v in pairs(OptionsPrivate.commonOptions.BorderOptions(id, data, nil, nil, 70)) do
options[k] = v
end
end
return {
+9 -10
View File
@@ -55,12 +55,8 @@ local function createOptions(id, data)
func = function()
local path = {"displayIcon"}
local paths = {}
if data.controlledChildren then
for i, childId in pairs(data.controlledChildren) do
paths[childId] = path
end
else
paths[data.id] = path
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
paths[child.id] = path
end
OptionsPrivate.OpenIconPicker(data, paths)
end,
@@ -188,13 +184,14 @@ local function createOptions(id, data)
cooldownHeader = {
type = "header",
order = 11,
name = L["Cooldown Settings"],
name = L["Swipe Overlay Settings"],
},
cooldown = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Show Cooldown"],
name = L["Enable Swipe"],
order = 11.1,
desc = L["Enable the \"Swipe\" radial overlay"],
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end,
get = function() return OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end
},
@@ -203,6 +200,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Inverse"],
order = 11.2,
desc = L["Invert the direction of progress"],
disabled = function() return not (OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown); end,
get = function() return data.inverse and OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end,
hidden = function() return not data.cooldown end
@@ -210,8 +208,9 @@ local function createOptions(id, data)
cooldownEdge = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Cooldown Edge"],
order = 11.3,
name = L["Show \"Edge\""],
order = 11.4,
desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\edge-example:30|t\n"..L["Enable \"Edge\" part of the overlay"],
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data) end,
hidden = function() return not data.cooldown end,
},
+2 -2
View File
@@ -42,7 +42,7 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Animation Sequence"],
min = 0,
max = 150,
softMax = 150,
step = 1,
bigStep = 1,
order = 6,
@@ -106,7 +106,7 @@ local function createOptions(id, data)
else
options.model_path = {
type = "input",
width = WeakAuras.doubleWidth,
width = WeakAuras.doubleWidth - 0.15,
name = L["Model"],
order = 1
}
@@ -189,12 +189,6 @@ local function createOptions(id, data)
data.crop_x = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
WeakAuras.Add(parentData);
end
end
OptionsPrivate.ResetMoverSizer();
end,
},
@@ -212,12 +206,6 @@ local function createOptions(id, data)
data.crop_y = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
if(data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData) then
WeakAuras.Add(parentData);
end
end
OptionsPrivate.ResetMoverSizer();
end,
},
@@ -240,18 +228,25 @@ local function createOptions(id, data)
bigStep = 0.01,
isPercent = true
},
smoothProgress = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Smooth Progress"],
desc = L["Animates progress changes"],
order = 55.1
},
slanted = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Slanted"],
order = 55.2,
order = 55.3,
hidden = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end
},
slant = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Slant Amount"],
order = 55.3,
order = 55.4,
min = 0,
max = 1,
bigStep = 0.1,
@@ -261,14 +256,14 @@ local function createOptions(id, data)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Inverse Slant"],
order = 55.4,
order = 55.5,
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end
},
slantMode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Slant Mode"],
order = 55.5,
order = 55.6,
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end,
values = OptionsPrivate.Private.slant_mode
},
@@ -413,11 +408,11 @@ local function createThumbnail()
local background = region:CreateTexture(nil, "BACKGROUND");
borderframe.background = background;
local foreground = region:CreateTexture(nil, "ART");
local foreground = region:CreateTexture(nil, "ARTWORK");
borderframe.foreground = foreground;
borderframe.foregroundSpinner = WeakAuras.createSpinner(region, "ARTWORK", region:GetFrameLevel() + 2);
borderframe.backgroundSpinner = WeakAuras.createSpinner(region, "BACKGROUND", region:GetFrameLevel() + 1);
borderframe.foregroundSpinner = WeakAuras.createSpinner(region, "ARTWORK", region:GetFrameLevel() + 2);
return borderframe;
end
@@ -792,8 +787,4 @@ local templates = {
},
}
local function GetAnchors(data)
return OptionsPrivate.Private.default_types_for_anchor
end
WeakAuras.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates, GetAnchors);
WeakAuras.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates);
+444 -198
View File
@@ -8,34 +8,74 @@ local setTile = WeakAuras.setTile;
local function setTextureFunc(textureWidget, texturePath, textureName)
local data = texture_data[texturePath];
if not(data) then
local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]"
local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]"
local rows, columns, frames = texturePath:lower():match(pattern)
if rows then
data = {
count = tonumber(frames),
rows = tonumber(rows),
columns = tonumber(columns)
}
else
local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = texturePath:match(pattern2)
if rows then
rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = tonumber(rows), tonumber(columns), tonumber(frames), tonumber(frameWidth), tonumber(frameHeight), tonumber(fileWidth), tonumber(fileHeight)
local frameScaleW = 1
local frameScaleH = 1
if fileWidth > 0 and frameWidth > 0 then
frameScaleW = (frameWidth * columns) / fileWidth
end
if fileHeight > 0 and frameHeight > 0 then
frameScaleH = (frameHeight * rows) / fileHeight
end
data = {
count = frames,
rows = rows,
columns = columns,
frameScaleW = frameScaleW,
frameScaleH = frameScaleH
}
end
end
end
textureWidget.frameNr = 0;
if (data) then
if (data.rows and data.columns) then
-- Texture Atlas
textureWidget:SetTexture(texturePath, textureName);
setTile(textureWidget, data.count, data.rows, data.columns);
setTile(textureWidget, data.count, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1);
textureWidget:SetOnUpdate(function()
textureWidget.frameNr = textureWidget.frameNr + 1;
if (textureWidget.frameNr == data.count) then
textureWidget.frameNr = 1;
textureWidget:SetOnUpdate(function(self, elapsed)
self.elapsed = (self.elapsed or 0) + elapsed
if(self.elapsed > 0.1) then
self.elapsed = self.elapsed - 0.1;
textureWidget.frameNr = textureWidget.frameNr + 1;
if (textureWidget.frameNr == data.count) then
textureWidget.frameNr = 1;
end
setTile(textureWidget, textureWidget.frameNr, data.rows, data.columns, data.frameScaleW or 1, data.frameScaleH or 1);
end
setTile(textureWidget, textureWidget.frameNr, data.rows, data.columns);
end);
end)
else
-- Numbered Textures
local texture = texturePath .. format("%03d", texture_data[texturePath].count)
textureWidget:SetTexture(texture, textureName)
textureWidget:SetTexCoord(0, 1, 0, 1);
textureWidget:SetOnUpdate(function()
textureWidget.frameNr = textureWidget.frameNr + 1;
if (textureWidget.frameNr == data.count) then
textureWidget.frameNr = 1;
textureWidget:SetOnUpdate(function(self, elapsed)
self.elapsed = (self.elapsed or 0) + elapsed
if(self.elapsed > 0.1) then
self.elapsed = self.elapsed - 0.1;
textureWidget.frameNr = textureWidget.frameNr + 1;
if (textureWidget.frameNr == data.count) then
textureWidget.frameNr = 1;
end
local texture = texturePath .. format("%03d", textureWidget.frameNr)
textureWidget:SetTexture(texture, textureName);
end
local texture = texturePath .. format("%03d", textureWidget.frameNr)
textureWidget:SetTexture(texture, textureName);
end);
end
else
@@ -45,9 +85,16 @@ local function setTextureFunc(textureWidget, texturePath, textureName)
end
local function textureNameHasData(textureName)
local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]"
local rows, columns, frames = textureName:lower():match(pattern)
return rows and columns and frames
local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]$"
local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]$"
local ok = textureName:lower():match(pattern)
if ok then return true end
local ok2 = textureName:match(pattern2)
if ok2 then
return true
else
return false
end
end
local function createOptions(id, data)
@@ -56,7 +103,7 @@ local function createOptions(id, data)
__order = 1,
foregroundTexture = {
type = "input",
width = WeakAuras.normalWidth - 0.15,
width = WeakAuras.doubleWidth - 0.15,
name = L["Texture"],
order = 1,
},
@@ -79,169 +126,157 @@ local function createOptions(id, data)
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
backgroundTexture = {
type = "input",
width = WeakAuras.normalWidth - 0.15,
name = L["Background Texture"],
order = 5,
disabled = function() return data.sameTexture or data.hideBackground end,
get = function() return data.sameTexture and data.foregroundTexture or data.backgroundTexture; end,
},
chooseBackgroundTexture = {
type = "execute",
width = 0.15,
name = L["Choose"],
order = 6,
func = function()
OptionsPrivate.OpenTexturePicker(data, {}, {
texture = "backgroundTexture",
color = "backgroundColor",
rotation = "rotation",
mirror = "mirror",
blendMode = "blendMode"
}, texture_types, setTextureFunc);
end,
disabled = function() return data.sameTexture or data.hideBackground; end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
sameTextureSpace = {
type = "description",
width = WeakAuras.normalWidth,
name = "",
order = 13,
},
hideBackground = {
type = "toggle",
name = L["Hide"],
order = 14,
width = WeakAuras.halfWidth,
},
sameTexture = {
type = "toggle",
width = WeakAuras.halfWidth,
name = L["Same"],
order = 15,
disabled = function() return data.hideBackground; end
foregroundColor = {
type = "color",
width = WeakAuras.normalWidth,
name = L["Color"],
hasAlpha = true,
order = 3
},
desaturateForeground = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Desaturate"],
order = 17.5,
},
desaturateBackground = {
type = "toggle",
name = L["Desaturate"],
order = 17.6,
width = WeakAuras.normalWidth,
disabled = function() return data.hideBackground; end
},
-- Foreground options for custom textures
customForegroundHeader = {
type = "header",
name = L["Custom Foreground"],
order = 17.70,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Desaturate"],
order = 3.5,
},
customForegroundRows = {
type = "range",
width = WeakAuras.normalWidth,
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Rows"],
min = 1,
max = 64,
order = 17.71,
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customForegroundRows and tostring(data.customForegroundRows) or "";
end,
set = function(info, v)
data.customForegroundRows = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 4,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
customForegroundColumns = {
type = "range",
width = WeakAuras.normalWidth,
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Columns"],
min = 1,
max = 64,
order = 17.72,
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customForegroundColumns and tostring(data.customForegroundColumns) or "";
end,
set = function(info, v)
data.customForegroundColumns = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 5,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
customForegroundFrames = {
type = "range",
width = WeakAuras.normalWidth,
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Frame Count"],
min = 0,
max = 4096,
--bigStep = 0.01,
order = 17.73,
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customForegroundFrames and tostring(data.customForegroundFrames) or "";
end,
set = function(info, v)
data.customForegroundFrames = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 6,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
customForegroundSpace = {
type = "execute",
width = WeakAuras.normalWidth,
name = "",
order = 17.74,
image = function() return "", 0, 0 end,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
customForegroundFileWidth = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["File Width"],
desc = L["Must be a power of 2"],
validate = function(info, val)
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
return false;
end
return true
end,
get = function()
return data.customForegroundFileWidth and tostring(data.customForegroundFileWidth) or "";
end,
set = function(info, v)
data.customForegroundFileWidth = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 7,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
-- Background options for custom textures
customBackgroundHeader = {
type = "header",
name = L["Custom Background"],
order = 18.00,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
or data.hideBackground end
customForegroundFileHeight = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["File Height"],
desc = L["Must be a power of 2"],
validate = function(info, val)
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
return false;
end
return true
end,
get = function()
return data.customForegroundFileHeight and tostring(data.customForegroundFileHeight) or "";
end,
set = function(info, v)
data.customForegroundFileHeight = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 8,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
customBackgroundRows = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Rows"],
min = 1,
max = 64,
order = 18.01,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
or data.hideBackground end
customForegroundFrameWidth = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["Frame Width"],
validate = WeakAuras.ValidateNumeric,
desc = L["Can set to 0 if Columns * Width equal File Width"],
get = function()
return data.customForegroundFrameWidth and tostring(data.customForegroundFrameWidth) or "";
end,
set = function(info, v)
data.customForegroundFrameWidth = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 9,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
customBackgroundColumns = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Columns"],
min = 1,
max = 64,
order = 18.02,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
or data.hideBackground end
},
customBackgroundFrames = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Frame Count"],
min = 0,
max = 4096,
step = 1,
order = 18.03,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
or data.hideBackground end
},
customBackgroundSpace = {
type = "execute",
width = WeakAuras.normalWidth,
name = "",
order = 18.04,
image = function() return "", 0, 0 end,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture)
or data.hideBackground end
customForegroundFrameHeight = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["Frame Height"],
validate = WeakAuras.ValidateNumeric,
desc = L["Can set to 0 if Rows * Height equal File Height"],
get = function()
return data.customForegroundFrameHeight and tostring(data.customForegroundFrameHeight) or "";
end,
set = function(info, v)
data.customForegroundFrameHeight = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 10,
hidden = function() return texture_data[data.foregroundTexture] or textureNameHasData(data.foregroundTexture) end
},
blendMode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 20,
order = 11,
values = OptionsPrivate.Private.blend_types
},
animationType = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Animation Mode"],
order = 21,
order = 12,
values = animation_types
},
startPercent = {
@@ -251,7 +286,7 @@ local function createOptions(id, data)
min = 0,
max = 1,
--bigStep = 0.01,
order = 22,
order = 13,
isPercent = true
},
endPercent = {
@@ -261,7 +296,7 @@ local function createOptions(id, data)
min = 0,
max = 1,
--bigStep = 0.01,
order = 23,
order = 14,
isPercent = true
},
frameRate = {
@@ -272,47 +307,225 @@ local function createOptions(id, data)
max = 120,
step = 1,
bigStep = 3,
order = 24,
order = 15,
disabled = function() return data.animationType == "progress" end;
},
backgroundPercent = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Background"],
min = 0,
max = 1,
order = 25,
isPercent = true,
disabled = function() return data.hideBackground; end
inverse = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Inverse"],
order = 15.5
},
foregroundColor = {
type = "color",
width = WeakAuras.normalWidth,
name = L["Foreground Color"],
hasAlpha = true,
order = 30
customBackgroundHeader = {
type = "header",
name = L["Background Texture"],
order = 16,
},
hideBackground = {
type = "toggle",
name = L["Hide Background"],
order = 17,
width = WeakAuras.normalWidth,
},
sameTexture = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Same texture as Foreground"],
order = 18,
disabled = function() return data.hideBackground; end,
hidden = function() return data.hideBackground; end
},
backgroundTexture = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
name = L["Background Texture"],
order = 19,
disabled = function() return data.sameTexture or data.hideBackground end,
hidden = function() return data.hideBackground end,
get = function() return data.sameTexture and data.foregroundTexture or data.backgroundTexture; end,
},
chooseBackgroundTexture = {
type = "execute",
width = 0.15,
name = L["Choose"],
order = 20,
func = function()
OptionsPrivate.OpenTexturePicker(data, {}, {
texture = "backgroundTexture",
color = "backgroundColor",
rotation = "rotation",
mirror = "mirror",
blendMode = "blendMode"
}, texture_types, setTextureFunc);
end,
disabled = function() return data.sameTexture or data.hideBackground; end,
hidden = function() return data.hideBackground end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
backgroundColor = {
type = "color",
width = WeakAuras.normalWidth,
name = L["Background Color"],
name = L["Color"],
hasAlpha = true,
order = 32,
disabled = function() return data.hideBackground; end
order = 21,
disabled = function() return data.hideBackground; end,
hidden = function() return data.hideBackground; end
},
inverse = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Inverse"],
order = 33
},
space3 = {
type = "execute",
width = WeakAuras.normalWidth,
name = "",
order = 36,
image = function() return "", 0, 0 end,
desaturateBackground = {
type = "toggle",
name = L["Desaturate"],
order = 22,
width = WeakAuras.normalWidth,
disabled = function() return data.hideBackground; end,
hidden = function() return data.hideBackground; end
},
backgroundColorHiddenSpacer = {
type = "execute",
width = WeakAuras.normalWidth,
name = "",
order = 23,
image = function() return "", 0, 0 end,
hidden = function() return not data.hideBackground end
},
customBackgroundRows = {
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Rows"],
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customBackgroundRows and tostring(data.customBackgroundRows) or "";
end,
set = function(info, v)
data.customBackgroundRows = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 24,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundColumns = {
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Columns"],
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customBackgroundColumns and tostring(data.customBackgroundColumns) or "";
end,
set = function(info, v)
data.customBackgroundColumns = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 25,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundFrames = {
type = "input",
width = WeakAuras.doubleWidth / 3,
name = L["Frame Count"],
validate = WeakAuras.ValidateNumeric,
get = function()
return data.customBackgroundFrames and tostring(data.customBackgroundFrames) or "";
end,
set = function(info, v)
data.customBackgroundFrames = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 26,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundFileWidth = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["File Width"],
desc = L["Must be a power of 2"],
validate = function(info, val)
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
return false;
end
return true
end,
get = function()
return data.customBackgroundFileWidth and tostring(data.customBackgroundFileWidth) or "";
end,
set = function(info, v)
data.customBackgroundFileWidth = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 27,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundFileHeight = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["File Height"],
desc = L["Must be a power of 2"],
validate = function(info, val)
if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31 or math.frexp(val) ~= 0.5) then
return false;
end
return true
end,
get = function()
return data.customBackgroundFileHeight and tostring(data.customBackgroundFileHeight) or "";
end,
set = function(info, v)
data.customBackgroundFileHeight = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 28,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundFrameWidth = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["Frame Width"],
validate = WeakAuras.ValidateNumeric,
desc = L["Can set to 0 if Columns * Width equal File Width"],
get = function()
return data.customBackgroundFrameWidth and tostring(data.customBackgroundFrameWidth) or "";
end,
set = function(info, v)
data.customBackgroundFrameWidth = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 29,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
customBackgroundFrameHeight = {
type = "input",
width = WeakAuras.normalWidth / 2,
name = L["Frame Height"],
validate = WeakAuras.ValidateNumeric,
desc = L["Can set to 0 if Rows * Height equal File Height"],
get = function()
return data.customBackgroundFrameHeight and tostring(data.customBackgroundFrameHeight) or "";
end,
set = function(info, v)
data.customBackgroundFrameHeight = v and tonumber(v) or 0
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
end,
order = 30,
hidden = function() return data.sameTexture or texture_data[data.backgroundTexture] or textureNameHasData(data.backgroundTexture) end
},
backgroundPercent = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Selected Frame"],
min = 0,
max = 1,
order = 31,
isPercent = true,
hidden = function() return data.hideBackground; end
}
};
if OptionsPrivate.commonOptions then
@@ -361,29 +574,55 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
end
local frame = 1;
region.foreground = region.foreground or {}
local tdata = texture_data[data.foregroundTexture];
if (tdata) then
local lastFrame = tdata.count - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1;
region.foregroundRows = tdata.rows;
region.foregroundColumns = tdata.columns;
region.foreground.rows = tdata.rows;
region.foreground.columns = tdata.columns;
region.foreground.fileWidth = 0
region.foreground.fileHeight = 0
region.foreground.frameWidth = 0
region.foreground.frameHeight = 0
else
local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]"
local pattern2 = "%.x(%d+)y(%d+)f(%d+)w(%d+)h(%d+)W(%d+)H(%d+)%.[tb][gl][ap]"
local rows, columns, frames = data.foregroundTexture:lower():match(pattern)
if rows and columns and frames then
if rows then
local lastFrame = frames - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1;
region.foregroundRows = rows;
region.foregroundColumns = columns;
region.foreground.rows = tonumber(rows);
region.foreground.columns = tonumber(columns);
region.foreground.fileWidth = 0
region.foreground.fileHeight = 0
region.foreground.frameWidth = 0
region.foreground.frameHeight = 0
else
local lastFrame = data.customForegroundFrames - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1;
region.foregroundRows = data.customForegroundRows;
region.foregroundColumns = data.customForegroundColumns;
local rows, columns, frames, frameWidth, frameHeight, fileWidth, fileHeight = data.foregroundTexture:match(pattern2)
if rows then
local lastFrame = frames - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1;
region.foreground.rows = tonumber(rows)
region.foreground.columns = tonumber(columns)
region.foreground.fileWidth = tonumber(fileWidth)
region.foreground.fileHeight = tonumber(fileHeight)
region.foreground.frameWidth = tonumber(frameWidth)
region.foreground.frameHeight = tonumber(frameHeight)
else
local lastFrame = data.customForegroundFrames - 1;
region.startFrame = floor( (data.startPercent or 0) * lastFrame) + 1;
region.endFrame = floor( (data.endPercent or 1) * lastFrame) + 1;
region.foreground.rows = data.customForegroundRows;
region.foreground.columns = data.customForegroundColumns;
region.foreground.fileWidth = data.customForegroundFileWidth
region.foreground.fileHeight = data.customForegroundFileHeight
region.foreground.frameWidth = data.customForegroundFrameWidth
region.foreground.frameHeight = data.customForegroundFrameHeight
end
end
end
@@ -393,13 +632,20 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
local texture = data.foregroundTexture or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion";
if (region.foregroundRows and region.foregroundColumns) then
if (region.foreground.rows and region.foreground.columns) then
region.texture:SetTexture(texture);
setTile(region.texture, frame, region.foregroundRows, region.foregroundColumns);
local frameScaleW, frameScaleH = 1, 1
if region.foreground.fileWidth and region.foreground.frameWidth and region.foreground.fileWidth > 0 and region.foreground.frameWidth > 0 then
frameScaleW = (region.foreground.frameWidth * region.foreground.columns) / region.foreground.fileWidth
end
if region.foreground.fileHeight and region.foreground.frameHeight and region.foreground.fileHeight > 0 and region.foreground.frameHeight > 0 then
frameScaleH = (region.foreground.frameHeight * region.foreground.rows) / region.foreground.fileHeight
end
setTile(region.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH);
region.SetValue = function(self, percent)
local frame = floor(percent * (region.endFrame - region.startFrame) + region.startFrame);
setTile(self.texture, frame, region.foregroundRows, region.foregroundColumns);
setTile(self.texture, frame, region.foreground.rows, region.foreground.columns, frameScaleW, frameScaleH);
end
else
region.texture:SetTexture(texture .. format("%03d", frame));
+16 -15
View File
@@ -289,22 +289,20 @@ local function createOptions(id, data)
options["displayText_format_" .. key] = option
end
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local get = function(key)
return childData["displayText_format_" .. key]
end
local input = childData.displayText
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, index, #data.controlledChildren)
end
else
local get = function(key)
return data["displayText_format_" .. key]
end
local input = data.displayText
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
local total, index = 0, 1
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
total = total + 1
end
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
local get = function(key)
return child["displayText_format_" .. key]
end
local input = child.displayText
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false, index, total)
index = index + 1
end
addOption("footer", {
type = "description",
name = "",
@@ -354,6 +352,9 @@ local function modifyThumbnail(parent, borderframe, data, fullModify, size)
local fontPath = SharedMedia:Fetch("font", data.font) or data.font;
text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil);
if not text:GetFont() then -- Font invalid, set the font but keep the setting
text:SetFont(STANDARD_TEXT_FONT, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil);
end
text:SetTextHeight(data.fontSize);
text:SetText(data.displayText);
text:SetTextColor(data.color[1], data.color[2], data.color[3], data.color[4]);
+1 -5
View File
@@ -241,8 +241,4 @@ local templates = {
},
}
local function GetAnchors(data)
return OptionsPrivate.Private.default_types_for_anchor
end
WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates, GetAnchors);
WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates);
@@ -0,0 +1,57 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
local L = WeakAuras.L;
do
local function subCreateOptions(parentData, data, index, subIndex)
local order = 9
local options = {
__title = L["Background"],
__order = 1,
__up = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionUp(child, index, "subbackground")
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end,
__down = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionDown(child, index, "subbackground")
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end,
__notcollapsable = true
}
return options
end
WeakAuras.RegisterSubRegionOptions("subbackground", subCreateOptions, L["Background"]);
end
-- Foreground for aurabar
do
local function subCreateOptions(parentData, data, index, subIndex)
local order = 9
local options = {
__title = L["Foreground"],
__order = 1,
__up = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionUp(child, index, "subforeground")
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end,
__down = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionDown(child, index, "subforeground")
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end,
__notcollapsable = true
}
return options
end
WeakAuras.RegisterSubRegionOptions("subforeground", subCreateOptions, L["Foreground"]);
end
+2 -20
View File
@@ -10,26 +10,6 @@ local function createOptions(parentData, data, index, subIndex)
local options = {
__title = L["Border %s"]:format(subIndex),
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subborder")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
border_visible = {
type = "toggle",
width = WeakAuras.doubleWidth,
@@ -79,6 +59,8 @@ local function createOptions(parentData, data, index, subIndex)
}
}
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subborder")
return options
end
+5 -21
View File
@@ -19,26 +19,6 @@ local function createOptions(parentData, data, index, subIndex)
local options = {
__title = L["Glow %s"]:format(subIndex),
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subglow")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
glow = {
type = "toggle",
width = WeakAuras.normalWidth,
@@ -138,6 +118,7 @@ local function createOptions(parentData, data, index, subIndex)
},
glowColor = {
type = "color",
hasAlpha = true,
width = WeakAuras.normalWidth,
name = L["Custom Color"],
order = 7,
@@ -251,7 +232,7 @@ local function createOptions(parentData, data, index, subIndex)
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
},
glow_anchor = {
glow_expand_anchor = {
type = "description",
name = "",
order = 20,
@@ -262,6 +243,9 @@ local function createOptions(parentData, data, index, subIndex)
}
}
}
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subglow")
return options
end
@@ -8,27 +8,7 @@ local function createOptions(parentData, data, index, subIndex)
local options = {
__title = L["Model %s"]:format(subIndex),
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subbarmodel")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
bar_model_visible = {
model_visible = {
type = "toggle",
width = WeakAuras.doubleWidth,
name = L["Show Model"],
@@ -36,27 +16,51 @@ local function createOptions(parentData, data, index, subIndex)
},
model_path = {
type = "input",
width = WeakAuras.normalWidth,
width = WeakAuras.doubleWidth - 0.15,
name = L["Model"],
order = 10
order = 10.5
},
chooseModel = {
type = "execute",
width = WeakAuras.normalWidth,
width = 0.15,
name = L["Choose"],
order = 11,
func = function()
OptionsPrivate.OpenModelPicker(data, parentData);
OptionsPrivate.OpenModelPicker(parentData, {"subRegions", index});
end,
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse",
},
bar_model_clip = {
type = "toggle",
width = WeakAuras.normalWidth,
width = WeakAuras.doubleWidth,
name = L["Clipped by Progress"],
order = 12,
hidden = function() return parentData.regionType ~= "aurabar" end
},
bar_model_alpha = {
extra_width = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Extra Width"],
order = 12.1,
softMin = -100,
softMax = 500,
step = 1,
hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end
},
extra_height = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Extra Height"],
order = 12.2,
softMin = -100,
softMax = 500,
step = 1,
hidden = function() return data.bar_model_clip and parentData.regionType == "aurabar" end
},
model_alpha = {
type = "range",
width = WeakAuras.normalWidth,
name = L["Alpha"],
@@ -106,7 +110,10 @@ local function createOptions(parentData, data, index, subIndex)
order = 45,
},
}
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "submodel")
return options
end
WeakAuras.RegisterSubRegionOptions("subbarmodel", createOptions, L["Shows a model"]);
WeakAuras.RegisterSubRegionOptions("submodel", createOptions, L["Shows a model"]);
@@ -41,7 +41,7 @@ function WeakAuras.DeleteSubRegion(data, index, regionType)
AdjustConditions(data, replacements);
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
OptionsPrivate.ClearOptions(data.id)
end
end
@@ -60,7 +60,7 @@ function OptionsPrivate.MoveSubRegionUp(data, index, regionType)
AdjustConditions(data, replacements);
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
OptionsPrivate.ClearOptions(data.id)
end
end
@@ -79,7 +79,7 @@ function OptionsPrivate.MoveSubRegionDown(data, index, regionType)
AdjustConditions(data, replacements);
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
OptionsPrivate.ClearOptions(data.id)
end
end
@@ -98,6 +98,33 @@ function OptionsPrivate.DuplicateSubRegion(data, index, regionType)
AdjustConditions(data, replacements);
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
OptionsPrivate.ClearOptions(data.id)
end
end
function OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, subRegionType)
options.__up = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionUp(child, index, subRegionType)
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
options.__down = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.MoveSubRegionDown(child, index, subRegionType)
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
options.__duplicate = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
OptionsPrivate.DuplicateSubRegion(child, index, subRegionType)
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
options.__delete = function()
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
WeakAuras.DeleteSubRegion(child, index, subRegionType)
end
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end
+21 -40
View File
@@ -31,26 +31,6 @@ local function createOptions(parentData, data, index, subIndex)
local options = {
__title = L["Text %s"]:format(subIndex),
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtext")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
text_visible = {
type = "toggle",
width = WeakAuras.halfWidth,
@@ -278,16 +258,11 @@ local function createOptions(parentData, data, index, subIndex)
-- design I had for anchor options proved to be not general enough for
-- what SubText needed. So, I removed it, and postponed making it work for unknown future
-- sub regions
local anchors
if parentData.controlledChildren then
anchors = {}
for index, childId in ipairs(parentData.controlledChildren) do
local childData = WeakAuras.GetData(childId)
WeakAuras.Mixin(anchors, OptionsPrivate.Private.GetAnchorsForData(childData, "point"))
end
else
anchors = OptionsPrivate.Private.GetAnchorsForData(parentData, "point")
local anchors = {}
for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do
WeakAuras.Mixin(anchors, OptionsPrivate.Private.GetAnchorsForData(child, "point"))
end
-- Anchor Options
options.text_anchorsDescription = {
type = "execute",
@@ -469,25 +444,29 @@ local function createOptions(parentData, data, index, subIndex)
end
if parentData.controlledChildren then
for childIndex, childId in pairs(parentData.controlledChildren) do
local parentChildData = WeakAuras.GetData(childId)
if parentChildData.subRegions then
local childData = parentChildData.subRegions[index]
if childData then
local get = function(key)
return childData["text_text_format_" .. key]
end
local input = childData["text_text"]
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, childIndex, #parentData.controlledChildren)
local list = {}
for child in OptionsPrivate.Private.TraverseLeafs(parentData) do
if child.subRegions then
local childSubRegion = child.subRegions[index]
if childSubRegion then
tinsert(list, childSubRegion)
end
end
end
for listIndex, childSubRegion in ipairs(list) do
local get = function(key)
return childSubRegion["text_text_format_" .. key]
end
local input = childSubRegion["text_text"]
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false, listIndex, #list)
end
else
local get = function(key)
return data["text_text_format_" .. key]
end
local input = data["text_text"]
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden)
OptionsPrivate.AddTextFormatOption(input, true, get, addOption, hidden, setHidden, false)
end
addOption("footer", {
@@ -497,6 +476,8 @@ local function createOptions(parentData, data, index, subIndex)
hidden = hidden
})
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtext")
return options, commonTextOptions
end
+3 -20
View File
@@ -13,26 +13,6 @@ local function createOptions(parentData, data, index, subIndex)
local options = {
__title = L["Tick %s"]:format(subIndex),
__order = 1,
__up = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionUp, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__down = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.MoveSubRegionDown, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__duplicate = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, OptionsPrivate.DuplicateSubRegion, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
__delete = function()
if (OptionsPrivate.Private.ApplyToDataOrChildData(parentData, WeakAuras.DeleteSubRegion, index, "subtick")) then
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
end,
tick_visible = {
type = "toggle",
width = WeakAuras.normalWidth,
@@ -235,6 +215,9 @@ local function createOptions(parentData, data, index, subIndex)
}
}
}
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtick")
return options
end
+17 -21
View File
@@ -16,8 +16,6 @@ local executeAll = OptionsPrivate.commonOptions.CreateExecuteAll("trigger")
local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions
local fixMetaOrders = OptionsPrivate.commonOptions.fixMetaOrders
local spellCache = WeakAuras.spellCache
local function union(table1, table2)
local meta = {};
for i,v in pairs(table1) do
@@ -80,7 +78,6 @@ local function GetGlobalOptions(data)
data.triggers.activeTriggerMode = v;
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
hidden = function() return #data.triggers <= 1 end
}
@@ -153,13 +150,8 @@ end
function OptionsPrivate.GetTriggerOptions(data)
local allOptions = {}
if data.controlledChildren then
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
allOptions = AddOptions(allOptions, childData)
end
else
allOptions = AddOptions(allOptions, data)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do
allOptions = AddOptions(allOptions, child)
end
fixMetaOrders(allOptions)
@@ -323,11 +315,12 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
local canDelete = false
-- Since we want to handle all selected auras in one dialog, we have to iterate over GetPickedDisplay
local picked = OptionsPrivate.GetPickedDisplay()
OptionsPrivate.Private.ApplyToDataOrChildData(picked, function(childData)
if #childData.triggers > 1 and #childData.triggers >= triggernum then
for child in OptionsPrivate.Private.TraverseLeafsOrAura(picked) do
if #child.triggers > 1 and #child.triggers >= triggernum then
canDelete = true
break;
end
end)
end
if canDelete then
StaticPopupDialogs["WEAKAURAS_CONFIRM_TRIGGER_DELETE"] = {
@@ -335,15 +328,16 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
button1 = L["Delete"],
button2 = L["Cancel"],
OnAccept = function()
OptionsPrivate.Private.ApplyToDataOrChildData(picked, function(childData)
if #childData.triggers > 1 and #childData.triggers >= triggernum then
tremove(childData.triggers, triggernum)
DeleteConditionsForTrigger(childData, triggernum)
WeakAuras.Add(childData)
for child in OptionsPrivate.Private.TraverseLeafsOrAura(picked) do
if #child.triggers > 1 and #child.triggers >= triggernum then
tremove(child.triggers, triggernum)
DeleteConditionsForTrigger(child, triggernum)
WeakAuras.Add(child)
OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum})
WeakAuras.ClearAndUpdateOptions(childData.id)
OptionsPrivate.ClearOptions(child.id)
end
end)
end
WeakAuras.FillOptions()
triggerDeleteDialogOpen = false
end,
@@ -363,7 +357,9 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
local _, _, _, enabled = GetAddOnInfo("WeakAurasTemplates")
if enabled then
options.__applyTemplate = function()
WeakAuras.OpenTriggerTemplate(data)
-- If we have more than a single aura selected,
-- we want to open the template view with the group/multi selection
OptionsPrivate.OpenTriggerTemplate(OptionsPrivate.GetPickedDisplay())
end
end
end
File diff suppressed because it is too large Load Diff
+12 -5
View File
@@ -1,7 +1,7 @@
## Interface: 30300
## Title: WeakAuras Options
## Author: The WeakAuras Team
## Version: 3.2.3
## Version: 3.7.9
## Notes: Options for WeakAuras
## Notes-esES: Opciones para WeakAuras
## Notes-deDE: Optionen für WeakAuras
@@ -29,11 +29,12 @@ RegionOptions\Model.lua
RegionOptions\ProgressTexture.lua
SubRegionOptions\SubRegionCommon.lua
SubRegionOptions\Background.lua
SubRegionOptions\SubText.lua
SubRegionOptions\Border.lua
SubRegionOptions\Glow.lua
SubRegionOptions\Tick.lua
SubRegionOptions\BarModel.lua
SubRegionOptions\Model.lua
Cache.lua
@@ -51,19 +52,21 @@ BuffTrigger2.lua
GenericTrigger.lua
WeakAurasOptions.lua
ExternalAddons.lua
ConditionOptions.lua
AuthorOptions.lua
OptionsFrames\OptionsFrame.lua
# -- Groups
# Groups
OptionsFrames\CodeReview.lua
OptionsFrames\IconPicker.lua
OptionsFrames\ImportExport.lua
OptionsFrames\ModelPicker.lua
OptionsFrames\TextEditor.lua
OptionsFrames\TexturePicker.lua
# -- misc Frames
OptionsFrames\Update.lua
# Misc frames
OptionsFrames\MoverSizer.lua
OptionsFrames\FrameChooser.lua
@@ -73,6 +76,8 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasIcon.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasNewHeaderButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasLoadedHeaderButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasDisplayButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasPendingInstallButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasPendingUpdateButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasTextureButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasIconButton.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasMultiLineEditBox.lua
@@ -86,3 +91,5 @@ AceGUI-Widgets\AceGUIContainer-WeakAurasTreeGroup.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua
AceGUI-Widgets\AceGUIContainer-WeakAurasInlineGroup.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasExpandAnchor.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasSpacer.lua
AceGUI-Widgets\AceGuiWidget-WeakAurasProgressBar.lua